30 #define COMPILER (!defined(__CINT__) && !defined(__CLING__))
31 #if defined(__MAKECINT__) || defined(__ROOTCLING__) || COMPILER
39 void example_Hp_to_HggWlnu(
const std::string& output_name =
40 "output_Hp_to_HggWlnu.root"){
47 std::vector<double> mHp;
58 g_Log << LogInfo <<
"Initializing generator frames and tree..." << LogEnd;
71 LAB_Gen.SetChildFrame(Hp_Gen);
72 Hp_Gen.AddChildFrame(H_Gen);
73 Hp_Gen.AddChildFrame(W_Gen);
74 H_Gen.AddChildFrame(G1_Gen);
75 H_Gen.AddChildFrame(G2_Gen);
76 W_Gen.AddChildFrame(L_Gen);
77 W_Gen.AddChildFrame(NU_Gen);
79 if(LAB_Gen.InitializeTree())
80 g_Log << LogInfo <<
"...Successfully initialized generator tree" << LogEnd;
82 g_Log << LogError <<
"...Failed initializing generator tree" << LogEnd;
86 if(mHp.size() < 1)
return;
89 Hp_Gen.SetMass(mHp[0]); H_Gen.SetMass(mH);
91 W_Gen.SetMass(mW); W_Gen.SetWidth(wW);
94 L_Gen.SetPtCut(15.); L_Gen.SetEtaCut(2.5);
95 G1_Gen.SetPtCut(20.); G1_Gen.SetEtaCut(3.);
96 G2_Gen.SetPtCut(20.); G2_Gen.SetEtaCut(3.);
98 if(LAB_Gen.InitializeAnalysis())
99 g_Log << LogInfo <<
"...Successfully initialized generator analysis" << std::endl << LogEnd;
101 g_Log << LogError <<
"...Failed initializing generator analysis" << LogEnd;
106 g_Log << LogInfo <<
"Initializing reconstruction frames and trees..." << LogEnd;
119 LAB.SetChildFrame(Hp);
127 if(LAB.InitializeTree())
128 g_Log << LogInfo <<
"...Successfully initialized reconstruction trees" << LogEnd;
130 g_Log << LogError <<
"...Failed initializing reconstruction trees" << LogEnd;
145 NuR.AddVisibleFrames(Hp.GetListVisibleFrames());
147 if(LAB.InitializeAnalysis())
148 g_Log << LogInfo <<
"...Successfully initialized analyses" << LogEnd;
150 g_Log << LogError <<
"...Failed initializing analyses" << LogEnd;
157 treePlot->SetTree(LAB_Gen);
158 treePlot->Draw(
"GenTree",
"Generator Tree",
true);
160 treePlot->SetTree(LAB);
161 treePlot->Draw(
"RecoTree",
"Reconstruction Tree");
166 std::string plot_title =
"pp #rightarrow H^{ +} #rightarrow h^{ 0}(#gamma #gamma ) W(#it{l} #nu)";
170 int Nmass = mHp.size();
171 for(
int m = 0; m < Nmass; m++){
172 char smass[50], scat[50];
173 sprintf(scat,
"MHp%.0f", mHp[m]);
174 sprintf(smass,
"m_{H^{ +}} = %.0f", mHp[m]);
175 cat_list += histPlot->GetNewCategory(scat, smass);
178 const HistPlotCategory& cat_Hp = histPlot->GetNewCategory(
"HprodHp",
"h^{ 0} prod. frame = H^{ +}");
179 const HistPlotCategory& cat_LAB = histPlot->GetNewCategory(
"HprodLAB",
"h^{ 0} prod. frame = LAB");
181 const HistPlotVar& MHp = histPlot->GetNewVar(
"MHp",
"M_{H^{ +}}", 0., 2400.,
"[GeV]");
182 const HistPlotVar& MHpN = histPlot->GetNewVar(
"MHpN",
"M_{H^{ +}} / m_{H^{ +}}^{true}", 0.7, 1.05);
183 const HistPlotVar& MWN = histPlot->GetNewVar(
"MWN",
"M_{W} / m_{W}^{true}", 0., 2.);
184 const HistPlotVar& cosHp = histPlot->GetNewVar(
"cosHp",
"cos #theta_{H^{ +}}", -1., 1.);
185 const HistPlotVar& cosW = histPlot->GetNewVar(
"cosW",
"cos #theta_{W}", -1., 1.);
186 const HistPlotVar& cosH = histPlot->GetNewVar(
"cosH",
"cos #theta_{h^{ 0}}", -1., 1.);
187 const HistPlotVar& DcosHp = histPlot->GetNewVar(
"DcosHp",
"#theta_{H^{ +}} - #theta_{H^{ +}}^{true}", -1., 1.);
188 const HistPlotVar& DcosW = histPlot->GetNewVar(
"DcosW",
"#theta_{W} - #theta_{W}^{true}", -1., 1.);
189 const HistPlotVar& DcosH = histPlot->GetNewVar(
"DcosW",
"#theta_{h^{ 0}} - #theta_{h^{ 0}}^{true}", -1., 1.);
191 histPlot->AddPlot(DcosH, cat_list);
192 histPlot->AddPlot(DcosW, cat_list);
193 histPlot->AddPlot(DcosHp, cat_list);
194 histPlot->AddPlot(MWN, cat_list);
195 histPlot->AddPlot(MHpN, cat_list);
196 histPlot->AddPlot(MHp, cat_list);
197 histPlot->AddPlot(MWN, MHpN, cat_list[2]);
198 histPlot->AddPlot(DcosW, MWN, cat_list[2]);
199 histPlot->AddPlot(DcosHp, MHpN, cat_list[2]);
200 histPlot->AddPlot(DcosHp, DcosW, cat_list[2]);
201 histPlot->AddPlot(DcosH, MHpN, cat_list[2]);
203 histPlot->AddPlot(DcosH, cat_Hp+cat_LAB);
208 for(
int m = 0; m < Nmass; m++){
209 g_Log << LogInfo <<
"Generating events for H^{+} mass = " << mHp[m] << LogEnd;
211 Hp_Gen.SetMass(mHp[m]);
212 LAB_Gen.InitializeAnalysis();
214 for(
int igen = 0; igen < Ngen; igen++){
215 if(igen%((std::max(Ngen,10))/10) == 0)
216 g_Log << LogInfo <<
"Generating event " << igen <<
" of " << Ngen << LogEnd;
219 LAB_Gen.ClearEvent();
221 LAB_Gen.SetPToverM(gRandom->Rndm());
223 LAB_Gen.AnalyzeEvent();
225 TVector3 MET = LAB_Gen.GetInvisibleMomentum();
231 L.SetLabFrameFourVector(L_Gen.GetFourVector());
232 G1.SetLabFrameFourVector(G1_Gen.GetFourVector());
233 G2.SetLabFrameFourVector(G2_Gen.GetFourVector());
234 INV.SetLabFrameThreeVector(MET);
239 double MHpgen = Hp_Gen.GetMass();
240 double MWgen = W_Gen.GetMass();
241 double cosHpgen = Hp_Gen.GetCosDecayAngle();
242 double cosHgen = H_Gen.GetCosDecayAngle();
243 double cosWgen = W_Gen.GetCosDecayAngle();
247 MHpN = Hp.GetMass()/MHpgen;
248 MWN = W.GetMass()/MWgen;
249 cosHp = Hp.GetCosDecayAngle();
250 cosH = H.GetCosDecayAngle();
251 cosW = W.GetCosDecayAngle();
252 DcosHp = asin(sqrt(1.-cosHp*cosHp)*cosHpgen-sqrt(1.-cosHpgen*cosHpgen)*cosHp);
253 DcosH = asin(sqrt(1.-cosH*cosH)*cosHgen-sqrt(1.-cosHgen*cosHgen)*cosH);
254 DcosW = asin(sqrt(1.-cosW*cosW)*cosWgen-sqrt(1.-cosWgen*cosWgen)*cosW);
256 histPlot->Fill(cat_list[m]);
259 histPlot->Fill(cat_Hp);
261 TVector3 Hboost = H.GetFourVector().BoostVector();
262 TLorentzVector vP_G1 = G1.GetFourVector();
263 vP_G1.Boost(-Hboost);
264 cosH = -vP_G1.Vect().Unit().Dot(Hboost.Unit());
265 DcosH = asin(sqrt(1.-cosH*cosH)*cosHgen-sqrt(1.-cosHgen*cosHgen)*cosH);
267 histPlot->Fill(cat_LAB);
271 LAB_Gen.PrintGeneratorEfficiency();
276 TFile fout(output_name.c_str(),
"RECREATE");
278 histPlot->WriteOutput(output_name);
279 histPlot->WriteHist(output_name);
280 treePlot->WriteOutput(output_name);
282 g_Log << LogInfo <<
"Finished" << LogEnd;
286 # ifndef __CINT__ // main function for stand-alone compilation
288 example_Hp_to_HggWlnu();