30 #define COMPILER (!defined(__CINT__) && !defined(__CLING__))
31 #if defined(__MAKECINT__) || defined(__ROOTCLING__) || COMPILER
39 void example_Zll(
const std::string& output_name =
"output_Zll.root"){
48 g_Log << LogInfo <<
"Initializing generator frames and tree..." << LogEnd;
57 LAB_Gen.SetChildFrame(Z_Gen);
58 Z_Gen.AddChildFrame(Lp_Gen);
59 Z_Gen.AddChildFrame(Lm_Gen);
61 if(LAB_Gen.InitializeTree())
62 g_Log << LogInfo <<
"...Successfully initialized generator tree" << LogEnd;
64 g_Log << LogError <<
"...Failed initializing generator tree" << LogEnd;
69 Z_Gen.SetMass(mZ); Z_Gen.SetWidth(wZ);
72 Lp_Gen.SetPtCut(15.); Lp_Gen.SetEtaCut(2.5);
73 Lm_Gen.SetPtCut(15.); Lm_Gen.SetEtaCut(2.5);
75 if(LAB_Gen.InitializeAnalysis())
76 g_Log << LogInfo <<
"...Successfully initialized generator analysis" << std::endl << LogEnd;
78 g_Log << LogError <<
"...Failed initializing generator analysis" << LogEnd;
83 g_Log << LogInfo <<
"Initializing reconstruction frames and trees..." << LogEnd;
96 if(LAB.InitializeTree())
97 g_Log << LogInfo <<
"...Successfully initialized reconstruction trees" << LogEnd;
99 g_Log << LogError <<
"...Failed initializing reconstruction trees" << LogEnd;
101 if(LAB.InitializeAnalysis())
102 g_Log << LogInfo <<
"...Successfully initialized analyses" << LogEnd;
104 g_Log << LogError <<
"...Failed initializing analyses" << LogEnd;
112 tree_plot->SetTree(LAB_Gen);
113 tree_plot->Draw(
"GenTree",
"Generator Tree",
true);
116 tree_plot->SetTree(LAB);
117 tree_plot->Draw(
"RecoTree",
"Reconstruction Tree");
122 HistPlot* hist_plot =
new HistPlot(
"HistPlot",
"Z #rightarrow #it{l}^{+} #it{l}^{-}");
124 const HistPlotVar& MZ = hist_plot->GetNewVar(
"MZ",
"M_{Z}", 70., 110.,
"[GeV]");
125 const HistPlotVar& cosZ = hist_plot->GetNewVar(
"cosZ",
"cos #theta_{Z}", -1., 1.);
126 const HistPlotVar& dphiZ = hist_plot->GetNewVar(
"dphiZ",
"#Delta #phi_{Z}", 0., 2.*acos(-1.));
128 hist_plot->AddPlot(MZ);
129 hist_plot->AddPlot(cosZ);
130 hist_plot->AddPlot(dphiZ);
131 hist_plot->AddPlot(cosZ, MZ);
133 for(
int igen = 0; igen < Ngen; igen++){
134 if(igen%((std::max(Ngen,10))/10) == 0)
135 g_Log << LogInfo <<
"Generating event " << igen <<
" of " << Ngen << LogEnd;
138 LAB_Gen.ClearEvent();
140 double PTZ = mZ*gRandom->Rndm();
141 LAB_Gen.SetTransverseMomentum(PTZ);
142 double PzZ = mZ*(2.*gRandom->Rndm()-1.);
143 LAB_Gen.SetLongitudinalMomentum(PzZ);
145 LAB_Gen.AnalyzeEvent();
150 Lp.SetLabFrameFourVector(Lp_Gen.GetFourVector(), 1);
151 Lm.SetLabFrameFourVector(Lm_Gen.GetFourVector(),-1);
157 cosZ = Z.GetCosDecayAngle();
158 dphiZ = LAB.GetDeltaPhiDecayPlanes(Z);
165 TFile fout(output_name.c_str(),
"RECREATE");
167 hist_plot->WriteOutput(output_name);
168 hist_plot->WriteHist(output_name);
169 tree_plot->WriteOutput(output_name);
173 # ifndef __CINT__ // main function for stand-alone compilation