Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
rf711_lagrangianmorph.C File Reference

Detailed Description

View in nbviewer Open in SWAN Morphing effective field theory distributions with RooLagrangianMorphFunc A morphing function as a function of one coefficient is setup and can be used to obtain the distribution for any value of the coefficient.

␛[1mRooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby␛[0m
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
[#0] PROGRESS:InputArguments -- initializing physics inputs from file /home/sftnight/build/workspace/root-makedoc-v626/rootspi/rdoc/src/v6-26-00-patches.build/tutorials/roofit/input_histos_rf_lagrangianmorph.root with object name(s) 'pTV'
[#0] PROGRESS:Caching -- creating cache from getCache function for 0x7fffb8aa6f98
[#0] PROGRESS:Caching -- current storage has size 3
[#0] PROGRESS:ObjectHandling -- observable: pTV
[#0] PROGRESS:ObjectHandling -- binWidth: binWidth_pTV
[#1] INFO:DataHandling -- RooDataHist::adjustBinning(morph_dh_cHq3=0.01): fit range of variable pTV expanded to nearest bin boundaries: [10,600] --> [0,600]
[#1] INFO:DataHandling -- RooDataHist::adjustBinning(morph_dh_cHq3=0.25): fit range of variable pTV expanded to nearest bin boundaries: [0,600] --> [0,600]
[#1] INFO:DataHandling -- RooDataHist::adjustBinning(morph_dh_cHq3=0.5): fit range of variable pTV expanded to nearest bin boundaries: [0,600] --> [0,600]
[#1] INFO:InputArguments -- RooAbsData::plotOn(SM_NPsq0) INFO: dataset has non-integer weights, auto-selecting SumW2 errors instead of Poisson errors
[#1] INFO:InputArguments -- RooAbsData::plotOn(cHq3_NPsq1) INFO: dataset has non-integer weights, auto-selecting SumW2 errors instead of Poisson errors
[#1] INFO:Plotting -- RooPlot::updateFitRangeNorm: New event count of 24931.9 will supercede previous event count of 10852.3 for normalization of PDF projections
[#1] INFO:InputArguments -- RooAbsData::plotOn(cHq3_NPsq2) INFO: dataset has non-integer weights, auto-selecting SumW2 errors instead of Poisson errors
[#1] INFO:Plotting -- RooPlot::updateFitRangeNorm: New event count of 29789.2 will supercede previous event count of 24931.9 for normalization of PDF projections
[#1] INFO:Plotting -- RooPlot::updateFitRangeNorm: New event count of 18947.1 will supercede previous event count of 11104.6 for normalization of PDF projections
[#1] INFO:Plotting -- RooPlot::updateFitRangeNorm: New event count of 30765.5 will supercede previous event count of 18947.1 for normalization of PDF projections
[#0] PROGRESS:Caching -- creating cache from getCache function for 0x55894493f0e0
[#0] PROGRESS:Caching -- current storage has size 3
[#0] PROGRESS:ObjectHandling -- observable: pTV
[#0] PROGRESS:ObjectHandling -- binWidth: binWidth_pTV
[#1] INFO:NumericIntegration -- RooRealIntegral::init(w_SM_NPsq0_morphfunc_Int[cHq3]) using numeric integrator RooIntegrator1D to calculate Int(cHq3)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(w_cHq3_NPsq1_morphfunc_Int[cHq3]) using numeric integrator RooIntegrator1D to calculate Int(cHq3)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(w_cHq3_NPsq2_morphfunc_Int[cHq3]) using numeric integrator RooIntegrator1D to calculate Int(cHq3)
[#0] PROGRESS:Caching -- creating cache from getCache function for 0x558944eefbb0
[#0] PROGRESS:Caching -- current storage has size 3
[#0] PROGRESS:ObjectHandling -- observable: pTV
[#0] PROGRESS:ObjectHandling -- binWidth: binWidth_pTV
[#1] INFO:NumericIntegration -- RooRealIntegral::init(w_SM_NPsq0_morphfunc_Int[cHq3]) using numeric integrator RooIntegrator1D to calculate Int(cHq3)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(w_cHq3_NPsq1_morphfunc_Int[cHq3]) using numeric integrator RooIntegrator1D to calculate Int(cHq3)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(w_cHq3_NPsq2_morphfunc_Int[cHq3]) using numeric integrator RooIntegrator1D to calculate Int(cHq3)
#include <RooDataHist.h>
#include <RooDataSet.h>
#include <RooPlot.h>
#include <RooRealVar.h>
#include <TCanvas.h>
#include <TColor.h>
#include <TFile.h>
#include <TFolder.h>
#include <TH1.h>
#include <TLegend.h>
#include <TStyle.h>
using namespace RooFit;
{
// C r e a t e v a r i a b l e s f o r
// m o r p h i n g f u n c t i o n
// ---------------------------------------------
std::string observablename = "pTV";
// Setup observable that is morphed
RooRealVar obsvar(observablename.c_str(), "p_{T}^{V}", 10, 600);
// Setup two couplings that enters the morphing function
// kSM -> SM coupling set to constant (1)
// cHq3 -> EFT parameter with NewPhysics attribute set to true
RooRealVar kSM("kSM", "sm modifier", 1.0);
RooRealVar cHq3("cHq3", "EFT modifier", 0.0, 1.0);
cHq3.setAttribute("NewPhysics", true);
// I n p u t s n e e d e d f o r c o n f i g
// ---------------------------------------------
std::string infilename = std::string(gROOT->GetTutorialDir()) + "/roofit/input_histos_rf_lagrangianmorph.root";
std::vector<std::string> samplelist = {"SM_NPsq0", "cHq3_NPsq1", "cHq3_NPsq2"};
// S e t u p C o n f i g
// ---------------------------------------------
config.fileName = infilename;
config.observableName = observablename;
config.folderNames = samplelist;
config.couplings.add(cHq3);
config.couplings.add(kSM);
// C r e a t e m o r p h i n g f u n c t i o n
// ---------------------------------------------
RooLagrangianMorphFunc morphfunc("morphfunc", "morphed dist. of pTV", config);
// G e t m o r p h e d d i s t r i b u t i o n f o r
// d i f f e r e n t c H q 3
// ---------------------------------------------
morphfunc.setParameter("cHq3", 0.01);
auto morph_hist_0p01 = morphfunc.createTH1("morph_cHq3=0.01");
morphfunc.setParameter("cHq3", 0.25);
auto morph_hist_0p25 = morphfunc.createTH1("morph_cHq3=0.25");
morphfunc.setParameter("cHq3", 0.5);
auto morph_hist_0p5 = morphfunc.createTH1("morph_cHq3=0.5");
RooDataHist morph_datahist_0p01("morph_dh_cHq3=0.01", "", RooArgList(obsvar), morph_hist_0p01);
RooDataHist morph_datahist_0p25("morph_dh_cHq3=0.25", "", RooArgList(obsvar), morph_hist_0p25);
RooDataHist morph_datahist_0p5("morph_dh_cHq3=0.5", "", RooArgList(obsvar), morph_hist_0p5);
// E x t r a c t i n p u t t e m p l a t e s
// f o r p l o t t i n g
// ---------------------------------------------
TFile *file = new TFile(infilename.c_str(), "READ");
TFolder *folder = 0;
file->GetObject(samplelist[0].c_str(), folder);
TH1 *input_hist0 = dynamic_cast<TH1 *>(folder->FindObject(observablename.c_str()));
input_hist0->SetDirectory(NULL);
file->GetObject(samplelist[1].c_str(), folder);
TH1 *input_hist1 = dynamic_cast<TH1 *>(folder->FindObject(observablename.c_str()));
input_hist1->SetDirectory(NULL);
file->GetObject(samplelist[2].c_str(), folder);
TH1 *input_hist2 = dynamic_cast<TH1 *>(folder->FindObject(observablename.c_str()));
input_hist2->SetDirectory(NULL);
file->Close();
RooDataHist input_dh0(samplelist[0].c_str(), "", RooArgList(obsvar), input_hist0);
RooDataHist input_dh1(samplelist[1].c_str(), "", RooArgList(obsvar), input_hist1);
RooDataHist input_dh2(samplelist[2].c_str(), "", RooArgList(obsvar), input_hist2);
auto frame0 = obsvar.frame(Title("Input templates for p_{T}^{V}"));
input_dh0.plotOn(frame0, Name(samplelist[0].c_str()), LineColor(kBlack), MarkerColor(kBlack), MarkerSize(1));
input_dh1.plotOn(frame0, Name(samplelist[1].c_str()), LineColor(kRed), MarkerColor(kRed), MarkerSize(1));
input_dh2.plotOn(frame0, Name(samplelist[2].c_str()), LineColor(kBlue), MarkerColor(kBlue), MarkerSize(1));
// P l o t m o r p h e d d i s t r i b u t i o n f o r
// d i f f e r e n t c H q 3
// ---------------------------------------------
auto frame1 = obsvar.frame(Title("Morphed templates for selected values"));
morph_datahist_0p01.plotOn(frame1, Name("morph_dh_cHq3=0.01"), DrawOption("C"), LineColor(kGreen),
DataError(RooAbsData::None), XErrorSize(0));
morph_datahist_0p25.plotOn(frame1, Name("morph_dh_cHq3=0.25"), DrawOption("C"), LineColor(kGreen + 1),
DataError(RooAbsData::None), XErrorSize(0));
morph_datahist_0p5.plotOn(frame1, Name("morph_dh_cHq3=0.5"), DrawOption("C"), LineColor(kGreen + 2),
DataError(RooAbsData::None), XErrorSize(0));
// C r e a t e w r a p p e d p d f t o g e n e r a t e
// 2D d a t a s e t o f c H q 3 a s a f u n c t i o n o f
// o b s e r v a b l e
// ---------------------------------------------
RooWrapperPdf model("wrap_pdf", "wrap_pdf", morphfunc);
RooDataSet *data = model.generate(RooArgSet(cHq3, obsvar), 1000000);
TH1 *hh_data = data->createHistogram("pTV vs cHq3", obsvar, Binning(20), YVar(cHq3, Binning(50)));
hh_data->SetTitle("Morphing prediction");
// D r a w p l o t s o n c a n v a s
// ---------------------------------------------
TCanvas *c1 = new TCanvas("fig3", "fig3", 1200, 400);
c1->Divide(3, 1);
c1->cd(1);
gPad->SetLeftMargin(0.15);
gPad->SetRightMargin(0.05);
frame0->Draw();
TLegend *leg1 = new TLegend(0.55, 0.65, 0.94, 0.87);
leg1->SetTextSize(0.04);
leg1->AddEntry(frame0->findObject("SM_NPsq0"), "SM", "LP");
leg1->AddEntry((TObject *)0, "", "");
leg1->AddEntry(frame0->findObject("cHq3_NPsq1"), "c_{Hq^(3)}=1.0 at #Lambda^{-2}", "LP");
leg1->AddEntry((TObject *)0, "", "");
leg1->AddEntry(frame0->findObject("cHq3_NPsq2"), "c_{Hq^(3)}=1.0 at #Lambda^{-4}", "LP");
leg1->Draw();
c1->cd(2);
gPad->SetLeftMargin(0.15);
gPad->SetRightMargin(0.05);
frame1->Draw();
TLegend *leg2 = new TLegend(0.60, 0.65, 0.94, 0.87);
leg2->SetTextSize(0.04);
leg2->AddEntry(frame1->findObject("morph_dh_cHq3=0.01"), "c_{Hq^{(3)}}=0.01", "L");
leg2->AddEntry((TObject *)0, "", "");
leg2->AddEntry(frame1->findObject("morph_dh_cHq3=0.25"), "c_{Hq^{(3)}}=0.25", "L");
leg2->AddEntry((TObject *)0, "", "");
leg2->AddEntry(frame1->findObject("morph_dh_cHq3=0.5"), "c_{Hq^{(3)}}=0.5", "L");
leg2->AddEntry((TObject *)0, "", "");
leg2->Draw();
c1->cd(3);
gPad->SetLeftMargin(0.12);
gPad->SetRightMargin(0.18);
gPad->SetLogz();
hh_data->GetYaxis()->SetTitle("c_{Hq^{(3)}}");
hh_data->GetYaxis()->SetRangeUser(0, 0.5);
hh_data->GetZaxis()->SetTitleOffset(1.8);
hh_data->Draw("COLZ");
c1->SaveAs("rf711_lagrangianmorph.png");
}
@ kRed
Definition Rtypes.h:66
@ kBlack
Definition Rtypes.h:65
@ kGreen
Definition Rtypes.h:66
@ kWhite
Definition Rtypes.h:65
@ kBlue
Definition Rtypes.h:66
@ kGreyScale
Definition TColor.h:108
#define gROOT
Definition TROOT.h:404
R__EXTERN TStyle * gStyle
Definition TStyle.h:413
#define gPad
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:35
The RooDataHist is a container class to hold N-dimensional binned data.
Definition RooDataHist.h:45
RooDataSet is a container class to hold unbinned data.
Definition RooDataSet.h:36
TH2F * createHistogram(const RooAbsRealLValue &var1, const RooAbsRealLValue &var2, const char *cuts="", const char *name="hist") const
Create a TH2F histogram of the distribution of the specified variable using this dataset.
Class RooLagrangianMorphing is a implementation of the method of Effective Lagrangian Morphing,...
RooRealVar represents a variable that can be changed from the outside.
Definition RooRealVar.h:39
The RooWrapperPdf is a class that can be used to convert a function into a PDF.
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
Definition TAttAxis.cxx:302
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:37
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:40
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition TAttText.h:47
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates, that is,...
Definition TAxis.cxx:946
The Canvas class.
Definition TCanvas.h:23
static void InvertPalette()
Invert the current color palette.
Definition TColor.cxx:3260
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition TFile.h:54
A TFolder object is a collection of objects and folders.
Definition TFolder.h:30
virtual TObject * FindObject(const char *name) const
Search object identified by name in the tree of folders inside this folder.
Definition TFolder.cxx:312
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
Definition TH1.cxx:8767
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
Definition TH1.cxx:6667
TAxis * GetZaxis()
Definition TH1.h:322
TAxis * GetYaxis()
Definition TH1.h:321
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition TH1.cxx:3074
This class displays a legend box (TPaveText) containing several legend entries.
Definition TLegend.h:23
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
Definition TLegend.cxx:330
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
Definition TLegend.cxx:423
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:164
Mother of all ROOT objects.
Definition TObject.h:41
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition TStyle.cxx:1589
void SetPalette(Int_t ncolors=kBird, Int_t *colors=0, Float_t alpha=1.)
See TColor::SetPalette.
Definition TStyle.cxx:1782
void SetNumberContours(Int_t number=20)
Set the default number of contour levels when drawing 2-d plots.
Definition TStyle.cxx:1448
return c1
Definition legend1.C:41
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition Common.h:18
Definition file.py:1
std::vector< std::string > folderNames
Date
January 2022
Author
Rahul Balasubramanian

Definition in file rf711_lagrangianmorph.C.