30 #define COMPILER (!defined(__CINT__) && !defined(__CLING__))
31 #if defined(__MAKECINT__) || defined(__ROOTCLING__) || COMPILER
39 void example_DiGluino_to_bbXbbX(std::string output_name =
40 "output_DiGluino_to_bbXbbX.root"){
48 g_Log << LogInfo <<
"Initializing generator frames and tree..." << LogEnd;
63 LAB_Gen.SetChildFrame(GG_Gen);
64 GG_Gen.AddChildFrame(Ga_Gen);
65 GG_Gen.AddChildFrame(Gb_Gen);
66 Ga_Gen.AddChildFrame(V1a_Gen);
67 Ga_Gen.AddChildFrame(V2a_Gen);
68 Ga_Gen.AddChildFrame(Xa_Gen);
69 Gb_Gen.AddChildFrame(V1b_Gen);
70 Gb_Gen.AddChildFrame(V2b_Gen);
71 Gb_Gen.AddChildFrame(Xb_Gen);
73 if(LAB_Gen.InitializeTree())
74 g_Log << LogInfo <<
"...Successfully initialized generator tree" << LogEnd;
76 g_Log << LogError <<
"...Failed initializing generator tree" << LogEnd;
80 GG_Gen.SetVariableMass();
88 V1a_Gen.SetPtCut(30.); V1a_Gen.SetEtaCut(2.5);
89 V1b_Gen.SetPtCut(30.); V1b_Gen.SetEtaCut(2.5);
90 V2a_Gen.SetPtCut(30.); V2a_Gen.SetEtaCut(2.5);
91 V2b_Gen.SetPtCut(30.); V2b_Gen.SetEtaCut(2.5);
93 if(LAB_Gen.InitializeAnalysis())
94 g_Log << LogInfo <<
"...Successfully initialized generator analysis" << std::endl << LogEnd;
96 g_Log << LogError <<
"...Failed initializing generator analysis" << LogEnd;
101 g_Log << LogInfo <<
"Initializing reconstruction frames and trees..." << LogEnd;
118 LAB.SetChildFrame(GG);
119 GG.AddChildFrame(Ga);
120 GG.AddChildFrame(Gb);
121 Ga.AddChildFrame(V1a);
122 Ga.AddChildFrame(Ca);
123 Ca.AddChildFrame(V2a);
124 Ca.AddChildFrame(Xa);
125 Gb.AddChildFrame(V1b);
126 Gb.AddChildFrame(Cb);
127 Cb.AddChildFrame(V2b);
128 Cb.AddChildFrame(Xb);
130 if(LAB.InitializeTree())
131 g_Log << LogInfo <<
"...Successfully initialized reconstruction trees" << LogEnd;
133 g_Log << LogError <<
"...Failed initializing reconstruction trees" << LogEnd;
142 LAB_B.SetChildFrame(CM_B);
143 CM_B.AddChildFrame(V_B);
144 CM_B.AddChildFrame(I_B);
146 if(LAB.InitializeTree())
147 g_Log << LogInfo <<
"...Successfully initialized reconstruction trees" << LogEnd;
149 g_Log << LogError <<
"...Failed initializing reconstruction trees" << LogEnd;
161 VIS.SetNElementsForFrame(V1a,1,
false);
162 VIS.SetNElementsForFrame(V1b,1,
false);
166 VIS.SetNElementsForFrame(V2a,0,
false);
167 VIS.SetNElementsForFrame(V2b,0,
false);
173 VIS_B.SetNElementsForFrame(V_B,1,
false);
179 INV.AddJigsaw(MinMassJigsaw);
181 INV.AddJigsaw(RapidityJigsaw);
182 RapidityJigsaw.AddVisibleFrames((LAB.GetListVisibleFrames()));
184 INV.AddJigsaw(ContraBoostJigsaw);
185 ContraBoostJigsaw.AddVisibleFrames((Ga.GetListVisibleFrames()), 0);
186 ContraBoostJigsaw.AddVisibleFrames((Gb.GetListVisibleFrames()), 1);
187 ContraBoostJigsaw.AddInvisibleFrames((Ga.GetListInvisibleFrames()), 0);
188 ContraBoostJigsaw.AddInvisibleFrames((Gb.GetListInvisibleFrames()), 1);
190 VIS.AddJigsaw(HemiJigsaw);
191 HemiJigsaw.AddFrame(V1a,0);
192 HemiJigsaw.AddFrame(V1b,1);
193 HemiJigsaw.AddFrame(V2a,0);
194 HemiJigsaw.AddFrame(V2b,1);
196 VIS.AddJigsaw(CaHemiJigsaw);
197 CaHemiJigsaw.AddFrame(V1a,0);
198 CaHemiJigsaw.AddFrame(V2a,1);
199 CaHemiJigsaw.AddFrame(Xa,1);
201 VIS.AddJigsaw(CbHemiJigsaw);
202 CbHemiJigsaw.AddFrame(V1b,0);
203 CbHemiJigsaw.AddFrame(V2b,1);
204 CbHemiJigsaw.AddFrame(Xb,1);
207 SetMassInvJigsaw MinMassJigsaw_B(
"MINMASS_B",
"Zero Mass for invisible system");
208 INV_B.AddJigsaw(MinMassJigsaw_B);
210 INV_B.AddJigsaw(RapidityJigsaw_B);
211 RapidityJigsaw_B.AddVisibleFrames((LAB_B.GetListVisibleFrames()));
214 if(LAB.InitializeAnalysis() && LAB_B.InitializeAnalysis())
215 g_Log << LogInfo <<
"...Successfully initialized analyses" << LogEnd;
217 g_Log << LogError <<
"...Failed initializing analyses" << LogEnd;
226 tree_plot->SetTree(LAB_Gen);
227 tree_plot->Draw(
"GenTree",
"Generator Tree",
true);
230 tree_plot->SetTree(LAB);
231 tree_plot->AddJigsaw(ContraBoostJigsaw);
232 tree_plot->AddJigsaw(HemiJigsaw);
233 tree_plot->AddJigsaw(CaHemiJigsaw);
234 tree_plot->AddJigsaw(CbHemiJigsaw);
235 tree_plot->Draw(
"SigRecoTree",
"Signal Reconstruction Tree");
238 tree_plot->SetTree(LAB_B);
239 tree_plot->Draw(
"BkgRecoTree",
"Background Reconstruction Tree");
242 tree_plot->SetTree(INV);
243 tree_plot->Draw(
"InvTree",
"Invisible Objects Jigsaws");
246 tree_plot->SetTree(VIS);
247 tree_plot->Draw(
"VisTree",
"Visible Objects Jigsaws");
250 for(
int igen = 0; igen < Ngen; igen++){
251 if(igen%((std::max(Ngen,10))/10) == 0)
252 g_Log << LogInfo <<
"Generating event " << igen <<
" of " << Ngen << LogEnd;
255 LAB_Gen.ClearEvent();
257 LAB_Gen.SetPToverM(LAB_Gen.GetRandom());
259 LAB_Gen.AnalyzeEvent();
262 TVector3 MET = LAB_Gen.GetInvisibleMomentum();
264 std::vector<TLorentzVector> JETS;
265 JETS.push_back(V1a_Gen.GetFourVector());
266 JETS.push_back(V2a_Gen.GetFourVector());
267 JETS.push_back(V1b_Gen.GetFourVector());
268 JETS.push_back(V2b_Gen.GetFourVector());
272 INV.SetLabFrameThreeVector(MET);
273 std::vector<RFKey> jetID;
274 for(
int i = 0; i < int(JETS.size()); i++)
275 jetID.push_back(VIS.AddLabFrameFourVector(JETS[i]));
280 INV_B.SetLabFrameThreeVector(MET);
281 for(
int i = 0; i < int(JETS.size()); i++){
282 TLorentzVector jet = JETS[i];
283 jet.SetPtEtaPhiM(jet.Pt(), 0., jet.Phi(), jet.M());
284 VIS_B.AddLabFrameFourVector(jet);
286 LAB_B.AnalyzeEvent();
294 int flip = (gRandom->Rndm() > 0.5);
300 VS[(flip+1)%2] = &V1b;
302 VC[(flip+1)%2] = &V2b;
315 double shat = GG.GetMass();
317 double gaminv = GG.GetVisibleShape();
319 TVector3 vPGG = GG.GetFourVector(LAB).Vect();
322 double RPT = vPGG.Pt() / (vPGG.Pt() + shat/4.);
324 double RPZ = vPGG.Pz() / (vPGG.Pz() + shat/4.);
326 double cosGG = GG.GetCosDecayAngle();
328 double dphiLGG = LAB.GetDeltaPhiDecayPlanes(GG);
330 TLorentzVector vV1 = G[0]->GetVisibleFourVector(*G[0]);
331 TLorentzVector vV2 = G[1]->GetVisibleFourVector(*G[1]);
334 double MG = (vV1.M2()-vV2.M2())/(2.*(vV1.E()-vV2.E()));
336 double PG = G[0]->GetMomentum(GG);
337 double MGG = 2.*sqrt(PG*PG + MG*MG);
338 double gaminvGG = 2.*MG/MGG;
339 double beta = sqrt(1.- gaminv*gaminv);
340 double betaGG = sqrt(1.- gaminvGG*gaminvGG);
343 double DeltaBetaGG = -(betaGG-beta)/(1.-betaGG*beta);
345 double dphiVG = GG.GetDeltaPhiDecayVisible();
347 double dphiVGG = GG.GetDeltaPhiBoostVisible();
368 for(
int i = 0; i < 2; i++){
369 NV[i] = VIS.GetNElementsInFrame(*VS[i]);
370 NV[i] += VIS.GetNElementsInFrame(*VC[i]);
372 TVector3 vP1 = VS[i]->GetFourVector(*G[i]).Vect();
373 TVector3 vP2 = VC[i]->GetFourVector(*G[i]).Vect();
374 Pinv[i] = 2.*(vP1+vP2).Mag()/(vP1.Mag()+vP2.Mag()+(vP1+vP2).Mag());
376 cosG[i] = G[i]->GetCosDecayAngle();
378 int N = jetID.size();
379 double pTmax[2]; pTmax[0] = -1.; pTmax[1] = -1.;
380 for(
int j = 0; j < N; j++){
381 const RestFrame& frame = VIS.GetFrame(jetID[j]);
382 if(VS[i]->IsSame(frame) || VC[i]->IsSame(frame)){
383 double pT = VIS.GetLabFrameFourVector(jetID[j]).Pt();
388 if(pT > pTmax[1]) pTmax[1] = pT;
393 jet1PT[i] = pTmax[0];
394 jet2PT[i] = pTmax[1];
397 cosC[i] = C[i]->GetCosDecayAngle();
398 dphiGC[i] = G[i]->GetDeltaPhiDecayPlanes(*C[i]);
399 RCG[i] = (C[i]->GetMass()-X[i]->GetMass())/(G[i]->GetMass()-X[i]->GetMass());
411 TLorentzVector Psib = I_B.GetSiblingFrame().GetFourVector(LAB_B);
412 TLorentzVector Pmet = I_B.GetFourVector(LAB_B);
415 double Rpsib = std::max(0.,Psib.Vect().Dot(Pmet.Vect().Unit()));
416 Rpsib = Rpsib / (Pmet.Pt() + Rpsib);
418 TVector3 boostQCD = (Pmet+Psib).BoostVector();
419 Psib.Boost(-boostQCD);
420 double cosQCD = -1.*Psib.Vect().Unit().Dot(boostQCD.Unit());
421 cosQCD = (1.-cosQCD)/2.;
424 double DeltaQCD = (cosQCD-Rpsib)/(cosQCD+Rpsib);
428 TFile fout(output_name.c_str(),
"RECREATE");
430 tree_plot->WriteOutput(output_name);
433 # ifndef __CINT__ // main function for stand-alone compilation
435 example_DiGluino_to_bbXbbX();
abstract base class for all Frame objects