30 #define COMPILER (!defined(__CINT__) && !defined(__CLING__))
31 #if defined(__MAKECINT__) || defined(__ROOTCLING__) || COMPILER
39 void example_top_to_bWlnu(
const std::string& output_name =
40 "output_top_to_bWlnu.root"){
52 g_Log << LogInfo <<
"Initializing generator frames and tree..." << LogEnd;
63 LAB_Gen.SetChildFrame(T_Gen);
64 T_Gen.AddChildFrame(B_Gen);
65 T_Gen.AddChildFrame(W_Gen);
66 W_Gen.AddChildFrame(L_Gen);
67 W_Gen.AddChildFrame(NU_Gen);
69 if(LAB_Gen.InitializeTree())
70 g_Log << LogInfo <<
"...Successfully initialized generator tree" << LogEnd;
72 g_Log << LogError <<
"...Failed initializing generator tree" << LogEnd;
77 T_Gen.SetMass(mtop); T_Gen.SetWidth(wtop);
79 W_Gen.SetMass(mW); W_Gen.SetWidth(wW);
82 L_Gen.SetPtCut(20.); L_Gen.SetEtaCut(2.5);
83 B_Gen.SetPtCut(20.); B_Gen.SetEtaCut(2.5);
85 if(LAB_Gen.InitializeAnalysis())
86 g_Log << LogInfo <<
"...Successfully initialized generator analysis" << std::endl << LogEnd;
88 g_Log << LogError <<
"...Failed initializing generator analysis" << LogEnd;
93 g_Log << LogInfo <<
"Initializing reconstruction frames and trees..." << LogEnd;
104 LAB_Mt.SetChildFrame(T_Mt); LAB_MW.SetChildFrame(T_MW);
105 T_Mt.AddChildFrame(B_Mt); T_MW.AddChildFrame(B_MW);
106 T_Mt.AddChildFrame(W_Mt); T_MW.AddChildFrame(W_MW);
107 W_Mt.AddChildFrame(L_Mt); W_MW.AddChildFrame(L_MW);
108 W_Mt.AddChildFrame(NU_Mt); W_MW.AddChildFrame(NU_MW);
110 if(LAB_Mt.InitializeTree() && LAB_MW.InitializeTree())
111 g_Log << LogInfo <<
"...Successfully initialized reconstruction trees" << LogEnd;
113 g_Log << LogError <<
"...Failed initializing reconstruction trees" << LogEnd;
119 INV_Mt.AddFrame(NU_Mt);
121 INV_MW.AddFrame(NU_MW);
125 INV_Mt.AddJigsaw(NuM_Mt);
127 INV_MW.AddJigsaw(NuM_MW);
131 INV_Mt.AddJigsaw(NuR_Mt);
132 NuR_Mt.AddVisibleFrame(L_Mt);
133 NuR_Mt.AddVisibleFrame(B_Mt);
135 INV_MW.AddJigsaw(NuR_MW);
136 NuR_MW.AddVisibleFrame(L_MW);
138 if(LAB_Mt.InitializeAnalysis() && LAB_MW.InitializeAnalysis())
139 g_Log << LogInfo <<
"...Successfully initialized analyses" << LogEnd;
141 g_Log << LogError <<
"...Failed initializing analyses" << LogEnd;
148 treePlot->SetTree(LAB_Gen);
149 treePlot->Draw(
"GenTree",
"Generator Tree",
true);
151 treePlot->SetTree(LAB_Mt);
152 treePlot->Draw(
"RecoTree",
"Reconstruction Tree");
157 HistPlot* histPlot =
new HistPlot(
"HistPlot",
"pp #rightarrow t #rightarrow W(#it{l} #nu) b");
159 const HistPlotCategory& cat_Gen = histPlot->GetNewCategory(
"Gen",
"Generator");
160 const HistPlotCategory& cat_minMt = histPlot->GetNewCategory(
"minMt",
"min M_{t} Reco");
161 const HistPlotCategory& cat_minMW = histPlot->GetNewCategory(
"minMW",
"min M_{W} Reco");
163 const HistPlotVar& Mt = histPlot->GetNewVar(
"Mt",
"M_{t}", 0., 280.,
"[GeV]");
164 const HistPlotVar& MW = histPlot->GetNewVar(
"MW",
"M_{W}", 0., 150.,
"[GeV]");
165 const HistPlotVar& pTtoMt = histPlot->GetNewVar(
"pTtoMt",
"p_{T}^{top} / m_{top}", 0., 1.);
166 const HistPlotVar& cosT = histPlot->GetNewVar(
"cosT",
"cos #theta_{t}", -1., 1.);
167 const HistPlotVar& cosW = histPlot->GetNewVar(
"cosW",
"cos #theta_{W}", -1., 1.);
168 const HistPlotVar& dphiT = histPlot->GetNewVar(
"dphiT",
"#Delta #phi_{t}", 0., 2.*acos(-1.));
169 const HistPlotVar& dphiW = histPlot->GetNewVar(
"dphiW",
"#Delta #phi_{W}", 0., 2.*acos(-1.));
170 const HistPlotVar& DcosT = histPlot->GetNewVar(
"DcosT",
"#theta_{t} - #theta_{t}^{gen}", -1., 1.);
171 const HistPlotVar& DcosW = histPlot->GetNewVar(
"DcosW",
"#theta_{W} - #theta_{W}^{gen}", -1., 1.);
172 const HistPlotVar& DdphiT = histPlot->GetNewVar(
"DdphiT",
"#Delta #phi_{t} - #Delta #phi_{t}^{gen}", -1., 1.);
173 const HistPlotVar& DdphiW = histPlot->GetNewVar(
"DdphiW",
"#Delta #phi_{W} - #Delta #phi_{W}^{gen}", -1., 1.);
175 histPlot->AddPlot(DcosT, cat_minMt+cat_minMW);
176 histPlot->AddPlot(DcosW, cat_minMt+cat_minMW);
177 histPlot->AddPlot(DdphiT, cat_minMt+cat_minMW);
178 histPlot->AddPlot(DdphiW, cat_minMt+cat_minMW);
179 histPlot->AddPlot(MW, cat_minMt+cat_minMW+cat_Gen);
180 histPlot->AddPlot(Mt, cat_minMt+cat_minMW+cat_Gen);
181 histPlot->AddPlot(Mt, MW, cat_minMt+cat_minMW+cat_Gen);
182 histPlot->AddPlot(Mt, pTtoMt, cat_minMt+cat_minMW);
183 histPlot->AddPlot(MW, pTtoMt, cat_minMt+cat_minMW);
184 histPlot->AddPlot(DcosW, MW, cat_minMt+cat_minMW);
185 histPlot->AddPlot(DcosT, Mt, cat_minMt+cat_minMW);
186 histPlot->AddPlot(Mt, pTtoMt, cat_minMt+cat_minMW);
187 histPlot->AddPlot(MW, pTtoMt, cat_minMt+cat_minMW);
188 histPlot->AddPlot(DcosT, DcosW, cat_minMt+cat_minMW);
194 for(
int igen = 0; igen < Ngen; igen++){
195 if(igen%((std::max(Ngen,10))/10) == 0)
196 g_Log << LogInfo <<
"Generating event " << igen <<
" of " << Ngen << LogEnd;
199 LAB_Gen.ClearEvent();
201 pTtoMt = gRandom->Rndm();
202 LAB_Gen.SetPToverM(pTtoMt);
204 LAB_Gen.AnalyzeEvent();
206 TVector3 MET = LAB_Gen.GetInvisibleMomentum();
212 L_Mt.SetLabFrameFourVector(L_Gen.GetFourVector());
213 B_Mt.SetLabFrameFourVector(B_Gen.GetFourVector());
214 INV_Mt.SetLabFrameThreeVector(MET);
216 LAB_Mt.AnalyzeEvent();
221 L_MW.SetLabFrameFourVector(L_Gen.GetFourVector());
222 B_MW.SetLabFrameFourVector(B_Gen.GetFourVector());
223 INV_MW.SetLabFrameThreeVector(MET);
225 LAB_MW.AnalyzeEvent();
228 double MTgen = T_Gen.GetMass();
229 double cosTgen = T_Gen.GetCosDecayAngle();
230 double dphiTgen = LAB_Gen.GetDeltaPhiDecayPlanes(T_Gen);
231 double MWgen = W_Gen.GetMass();
232 double cosWgen = W_Gen.GetCosDecayAngle();
233 double dphiWgen = T_Gen.GetDeltaPhiDecayPlanes(W_Gen);
237 histPlot->Fill(cat_Gen);
241 cosT = T_Mt.GetCosDecayAngle();
242 dphiT = LAB_Mt.GetDeltaPhiDecayPlanes(T_Mt);
244 cosW = W_Mt.GetCosDecayAngle();
245 dphiW = T_Mt.GetDeltaPhiDecayPlanes(W_Mt);
246 DcosT = asin(sqrt(1.-cosT*cosT)*cosTgen-sqrt(1.-cosTgen*cosTgen)*cosT);
247 DdphiT = asin(sin(dphiT-dphiTgen));
248 DcosW = asin(sqrt(1.-cosW*cosW)*cosWgen-sqrt(1.-cosWgen*cosWgen)*cosW);
249 DdphiW = asin(sin(dphiW-dphiWgen));
251 histPlot->Fill(cat_minMt);
255 cosT = T_MW.GetCosDecayAngle();
256 dphiT = LAB_MW.GetDeltaPhiDecayPlanes(T_MW);
258 cosW = W_MW.GetCosDecayAngle();
259 dphiW = T_MW.GetDeltaPhiDecayPlanes(W_MW);
260 DcosT = asin(sqrt(1.-cosT*cosT)*cosTgen-sqrt(1.-cosTgen*cosTgen)*cosT);
261 DdphiT = asin(sin(dphiT-dphiTgen));
262 DcosW = asin(sqrt(1.-cosW*cosW)*cosWgen-sqrt(1.-cosWgen*cosWgen)*cosW);
263 DdphiW = asin(sin(dphiW-dphiWgen));
265 histPlot->Fill(cat_minMW);
270 LAB_Gen.PrintGeneratorEfficiency();
272 TFile fout(output_name.c_str(),
"RECREATE");
274 histPlot->WriteOutput(output_name);
275 histPlot->WriteHist(output_name);
276 treePlot->WriteOutput(output_name);
278 g_Log << LogInfo <<
"Finished" << LogEnd;
282 # ifndef __CINT__ // main function for stand-alone compilation
284 example_top_to_bWlnu();