30 #if (!defined(__CINT__) && !defined(__CLING__))
33 #if defined(__MAKECINT__) || defined(__ROOTCLING__) || defined(COMPILER)
39 using namespace RestFrames;
41 void example_Hp_to_HggWlnu(
const std::string& output_name =
42 "output_Hp_to_HggWlnu.root"){
49 std::vector<double> mHp;
60 g_Log << LogInfo <<
"Initializing generator frames and tree..." << LogEnd;
73 LAB_Gen.SetChildFrame(Hp_Gen);
74 Hp_Gen.AddChildFrame(H_Gen);
75 Hp_Gen.AddChildFrame(W_Gen);
76 H_Gen.AddChildFrame(G1_Gen);
77 H_Gen.AddChildFrame(G2_Gen);
78 W_Gen.AddChildFrame(L_Gen);
79 W_Gen.AddChildFrame(NU_Gen);
81 if(LAB_Gen.InitializeTree())
82 g_Log << LogInfo <<
"...Successfully initialized generator tree" << LogEnd;
84 g_Log << LogError <<
"...Failed initializing generator tree" << LogEnd;
88 if(mHp.size() < 1)
return;
91 Hp_Gen.SetMass(mHp[0]); H_Gen.SetMass(mH);
93 W_Gen.SetMass(mW); W_Gen.SetWidth(wW);
96 L_Gen.SetPtCut(15.); L_Gen.SetEtaCut(2.5);
97 G1_Gen.SetPtCut(20.); G1_Gen.SetEtaCut(3.);
98 G2_Gen.SetPtCut(20.); G2_Gen.SetEtaCut(3.);
100 if(LAB_Gen.InitializeAnalysis())
101 g_Log << LogInfo <<
"...Successfully initialized generator analysis" << std::endl << LogEnd;
103 g_Log << LogError <<
"...Failed initializing generator analysis" << LogEnd;
108 g_Log << LogInfo <<
"Initializing reconstruction frames and trees..." << LogEnd;
121 LAB.SetChildFrame(Hp);
129 if(LAB.InitializeTree())
130 g_Log << LogInfo <<
"...Successfully initialized reconstruction trees" << LogEnd;
132 g_Log << LogError <<
"...Failed initializing reconstruction trees" << LogEnd;
147 NuR.AddVisibleFrames(Hp.GetListVisibleFrames());
149 if(LAB.InitializeAnalysis())
150 g_Log << LogInfo <<
"...Successfully initialized analyses" << LogEnd;
152 g_Log << LogError <<
"...Failed initializing analyses" << LogEnd;
160 treePlot->
Draw(
"GenTree",
"Generator Tree",
true);
163 treePlot->
Draw(
"RecoTree",
"Reconstruction Tree");
168 std::string plot_title =
"pp #rightarrow H^{ +} #rightarrow h^{ 0}(#gamma #gamma ) W(#it{l} #nu)";
172 int Nmass = mHp.size();
173 for(
int m = 0; m < Nmass; m++){
174 char smass[50], scat[50];
175 sprintf(scat,
"MHp%.0f", mHp[m]);
176 sprintf(smass,
"m_{H^{ +}} = %.0f", mHp[m]);
184 const HistPlotVar& MHpN = histPlot->
GetNewVar(
"MHpN",
"M_{H^{ +}} / m_{H^{ +}}^{true}", 0.7, 1.05);
189 const HistPlotVar& DcosHp = histPlot->
GetNewVar(
"DcosHp",
"#theta_{H^{ +}} - #theta_{H^{ +}}^{true}", -1., 1.);
190 const HistPlotVar& DcosW = histPlot->
GetNewVar(
"DcosW",
"#theta_{W} - #theta_{W}^{true}", -1., 1.);
191 const HistPlotVar& DcosH = histPlot->
GetNewVar(
"DcosW",
"#theta_{h^{ 0}} - #theta_{h^{ 0}}^{true}", -1., 1.);
193 histPlot->
AddPlot(DcosH, cat_list);
194 histPlot->
AddPlot(DcosW, cat_list);
195 histPlot->
AddPlot(DcosHp, cat_list);
196 histPlot->
AddPlot(MWN, cat_list);
197 histPlot->
AddPlot(MHpN, cat_list);
198 histPlot->
AddPlot(MHp, cat_list);
199 histPlot->
AddPlot(MWN, MHpN, cat_list[2]);
200 histPlot->
AddPlot(DcosW, MWN, cat_list[2]);
201 histPlot->
AddPlot(DcosHp, MHpN, cat_list[2]);
202 histPlot->
AddPlot(DcosHp, DcosW, cat_list[2]);
203 histPlot->
AddPlot(DcosH, MHpN, cat_list[2]);
205 histPlot->
AddPlot(DcosH, cat_Hp+cat_LAB);
210 for(
int m = 0; m < Nmass; m++){
211 g_Log << LogInfo <<
"Generating events for H^{+} mass = " << mHp[m] << LogEnd;
213 Hp_Gen.SetMass(mHp[m]);
214 LAB_Gen.InitializeAnalysis();
216 for(
int igen = 0; igen < Ngen; igen++){
217 if(igen%((std::max(Ngen,10))/10) == 0)
218 g_Log << LogInfo <<
"Generating event " << igen <<
" of " << Ngen << LogEnd;
221 LAB_Gen.ClearEvent();
223 LAB_Gen.SetPToverM(gRandom->Rndm());
225 LAB_Gen.AnalyzeEvent();
227 TVector3 MET = LAB_Gen.GetInvisibleMomentum();
233 L.SetLabFrameFourVector(L_Gen.GetFourVector());
234 G1.SetLabFrameFourVector(G1_Gen.GetFourVector());
235 G2.SetLabFrameFourVector(G2_Gen.GetFourVector());
236 INV.SetLabFrameThreeVector(MET);
241 double MHpgen = Hp_Gen.GetMass();
242 double MWgen = W_Gen.GetMass();
243 double cosHpgen = Hp_Gen.GetCosDecayAngle();
244 double cosHgen = H_Gen.GetCosDecayAngle();
245 double cosWgen = W_Gen.GetCosDecayAngle();
249 MHpN = Hp.GetMass()/MHpgen;
250 MWN = W.GetMass()/MWgen;
251 cosHp = Hp.GetCosDecayAngle();
252 cosH = H.GetCosDecayAngle();
253 cosW = W.GetCosDecayAngle();
254 DcosHp = asin(sqrt(1.-cosHp*cosHp)*cosHpgen-sqrt(1.-cosHpgen*cosHpgen)*cosHp);
255 DcosH = asin(sqrt(1.-cosH*cosH)*cosHgen-sqrt(1.-cosHgen*cosHgen)*cosH);
256 DcosW = asin(sqrt(1.-cosW*cosW)*cosWgen-sqrt(1.-cosWgen*cosWgen)*cosW);
258 histPlot->
Fill(cat_list[m]);
261 histPlot->
Fill(cat_Hp);
263 TVector3 Hboost = H.GetFourVector().BoostVector();
264 TLorentzVector vP_G1 = G1.GetFourVector();
265 vP_G1.Boost(-Hboost);
266 cosH = -vP_G1.Vect().Unit().Dot(Hboost.Unit());
267 DcosH = asin(sqrt(1.-cosH*cosH)*cosHgen-sqrt(1.-cosHgen*cosHgen)*cosH);
269 histPlot->
Fill(cat_LAB);
273 LAB_Gen.PrintGeneratorEfficiency();
278 TFile fout(output_name.c_str(),
"RECREATE");
284 g_Log << LogInfo <<
"Finished" << LogEnd;
288 # ifndef __CINT__ // main function for stand-alone compilation
290 example_Hp_to_HggWlnu();