30 #if (!defined(__CINT__) && !defined(__CLING__))
33 #if defined(__MAKECINT__) || defined(__ROOTCLING__) || defined(COMPILER)
39 using namespace RestFrames;
41 void example_top_to_bWlnu(
const std::string& output_name =
42 "output_top_to_bWlnu.root"){
54 g_Log << LogInfo <<
"Initializing generator frames and tree..." << LogEnd;
65 LAB_Gen.SetChildFrame(T_Gen);
66 T_Gen.AddChildFrame(B_Gen);
67 T_Gen.AddChildFrame(W_Gen);
68 W_Gen.AddChildFrame(L_Gen);
69 W_Gen.AddChildFrame(NU_Gen);
71 if(LAB_Gen.InitializeTree())
72 g_Log << LogInfo <<
"...Successfully initialized generator tree" << LogEnd;
74 g_Log << LogError <<
"...Failed initializing generator tree" << LogEnd;
79 T_Gen.SetMass(mtop); T_Gen.SetWidth(wtop);
81 W_Gen.SetMass(mW); W_Gen.SetWidth(wW);
84 L_Gen.SetPtCut(20.); L_Gen.SetEtaCut(2.5);
85 B_Gen.SetPtCut(20.); B_Gen.SetEtaCut(2.5);
87 if(LAB_Gen.InitializeAnalysis())
88 g_Log << LogInfo <<
"...Successfully initialized generator analysis" << std::endl << LogEnd;
90 g_Log << LogError <<
"...Failed initializing generator analysis" << LogEnd;
95 g_Log << LogInfo <<
"Initializing reconstruction frames and trees..." << LogEnd;
106 LAB_Mt.SetChildFrame(T_Mt); LAB_MW.SetChildFrame(T_MW);
107 T_Mt.AddChildFrame(B_Mt); T_MW.AddChildFrame(B_MW);
108 T_Mt.AddChildFrame(W_Mt); T_MW.AddChildFrame(W_MW);
109 W_Mt.AddChildFrame(L_Mt); W_MW.AddChildFrame(L_MW);
110 W_Mt.AddChildFrame(NU_Mt); W_MW.AddChildFrame(NU_MW);
112 if(LAB_Mt.InitializeTree() && LAB_MW.InitializeTree())
113 g_Log << LogInfo <<
"...Successfully initialized reconstruction trees" << LogEnd;
115 g_Log << LogError <<
"...Failed initializing reconstruction trees" << LogEnd;
121 INV_Mt.AddFrame(NU_Mt);
123 INV_MW.AddFrame(NU_MW);
127 INV_Mt.AddJigsaw(NuM_Mt);
129 INV_MW.AddJigsaw(NuM_MW);
133 INV_Mt.AddJigsaw(NuR_Mt);
134 NuR_Mt.AddVisibleFrame(L_Mt);
135 NuR_Mt.AddVisibleFrame(B_Mt);
137 INV_MW.AddJigsaw(NuR_MW);
138 NuR_MW.AddVisibleFrame(L_MW);
140 if(LAB_Mt.InitializeAnalysis() && LAB_MW.InitializeAnalysis())
141 g_Log << LogInfo <<
"...Successfully initialized analyses" << LogEnd;
143 g_Log << LogError <<
"...Failed initializing analyses" << LogEnd;
151 treePlot->
Draw(
"GenTree",
"Generator Tree",
true);
154 treePlot->
Draw(
"RecoTree",
"Reconstruction Tree");
159 HistPlot* histPlot =
new HistPlot(
"HistPlot",
"pp #rightarrow t #rightarrow W(#it{l} #nu) b");
172 const HistPlotVar& DcosT = histPlot->
GetNewVar(
"DcosT",
"#theta_{t} - #theta_{t}^{gen}", -1., 1.);
173 const HistPlotVar& DcosW = histPlot->
GetNewVar(
"DcosW",
"#theta_{W} - #theta_{W}^{gen}", -1., 1.);
174 const HistPlotVar& DdphiT = histPlot->
GetNewVar(
"DdphiT",
"#Delta #phi_{t} - #Delta #phi_{t}^{gen}", -1., 1.);
175 const HistPlotVar& DdphiW = histPlot->
GetNewVar(
"DdphiW",
"#Delta #phi_{W} - #Delta #phi_{W}^{gen}", -1., 1.);
177 histPlot->
AddPlot(DcosT, cat_minMt+cat_minMW);
178 histPlot->
AddPlot(DcosW, cat_minMt+cat_minMW);
179 histPlot->
AddPlot(DdphiT, cat_minMt+cat_minMW);
180 histPlot->
AddPlot(DdphiW, cat_minMt+cat_minMW);
181 histPlot->
AddPlot(MW, cat_minMt+cat_minMW+cat_Gen);
182 histPlot->
AddPlot(Mt, cat_minMt+cat_minMW+cat_Gen);
183 histPlot->
AddPlot(Mt, MW, cat_minMt+cat_minMW+cat_Gen);
184 histPlot->
AddPlot(Mt, pTtoMt, cat_minMt+cat_minMW);
185 histPlot->
AddPlot(MW, pTtoMt, cat_minMt+cat_minMW);
186 histPlot->
AddPlot(DcosW, MW, cat_minMt+cat_minMW);
187 histPlot->
AddPlot(DcosT, Mt, cat_minMt+cat_minMW);
188 histPlot->
AddPlot(Mt, pTtoMt, cat_minMt+cat_minMW);
189 histPlot->
AddPlot(MW, pTtoMt, cat_minMt+cat_minMW);
190 histPlot->
AddPlot(DcosT, DcosW, cat_minMt+cat_minMW);
196 for(
int igen = 0; igen < Ngen; igen++){
197 if(igen%((std::max(Ngen,10))/10) == 0)
198 g_Log << LogInfo <<
"Generating event " << igen <<
" of " << Ngen << LogEnd;
201 LAB_Gen.ClearEvent();
203 pTtoMt = gRandom->Rndm();
204 LAB_Gen.SetPToverM(pTtoMt);
206 LAB_Gen.AnalyzeEvent();
208 TVector3 MET = LAB_Gen.GetInvisibleMomentum();
214 L_Mt.SetLabFrameFourVector(L_Gen.GetFourVector());
215 B_Mt.SetLabFrameFourVector(B_Gen.GetFourVector());
216 INV_Mt.SetLabFrameThreeVector(MET);
218 LAB_Mt.AnalyzeEvent();
223 L_MW.SetLabFrameFourVector(L_Gen.GetFourVector());
224 B_MW.SetLabFrameFourVector(B_Gen.GetFourVector());
225 INV_MW.SetLabFrameThreeVector(MET);
227 LAB_MW.AnalyzeEvent();
230 double MTgen = T_Gen.GetMass();
231 double cosTgen = T_Gen.GetCosDecayAngle();
232 double dphiTgen = LAB_Gen.GetDeltaPhiDecayPlanes(T_Gen);
233 double MWgen = W_Gen.GetMass();
234 double cosWgen = W_Gen.GetCosDecayAngle();
235 double dphiWgen = T_Gen.GetDeltaPhiDecayPlanes(W_Gen);
239 histPlot->
Fill(cat_Gen);
243 cosT = T_Mt.GetCosDecayAngle();
244 dphiT = LAB_Mt.GetDeltaPhiDecayPlanes(T_Mt);
246 cosW = W_Mt.GetCosDecayAngle();
247 dphiW = T_Mt.GetDeltaPhiDecayPlanes(W_Mt);
248 DcosT = asin(sqrt(1.-cosT*cosT)*cosTgen-sqrt(1.-cosTgen*cosTgen)*cosT);
249 DdphiT = asin(sin(dphiT-dphiTgen));
250 DcosW = asin(sqrt(1.-cosW*cosW)*cosWgen-sqrt(1.-cosWgen*cosWgen)*cosW);
251 DdphiW = asin(sin(dphiW-dphiWgen));
253 histPlot->
Fill(cat_minMt);
257 cosT = T_MW.GetCosDecayAngle();
258 dphiT = LAB_MW.GetDeltaPhiDecayPlanes(T_MW);
260 cosW = W_MW.GetCosDecayAngle();
261 dphiW = T_MW.GetDeltaPhiDecayPlanes(W_MW);
262 DcosT = asin(sqrt(1.-cosT*cosT)*cosTgen-sqrt(1.-cosTgen*cosTgen)*cosT);
263 DdphiT = asin(sin(dphiT-dphiTgen));
264 DcosW = asin(sqrt(1.-cosW*cosW)*cosWgen-sqrt(1.-cosWgen*cosWgen)*cosW);
265 DdphiW = asin(sin(dphiW-dphiWgen));
267 histPlot->
Fill(cat_minMW);
272 LAB_Gen.PrintGeneratorEfficiency();
274 TFile fout(output_name.c_str(),
"RECREATE");
280 g_Log << LogInfo <<
"Finished" << LogEnd;
284 # ifndef __CINT__ // main function for stand-alone compilation
286 example_top_to_bWlnu();