30 #define COMPILER (!defined(__CINT__) && !defined(__CLING__))
31 #if defined(__MAKECINT__) || defined(__ROOTCLING__) || COMPILER
39 void example_Wlnu(
const std::string& output_name =
"output_Wlnu.root"){
48 g_Log << LogInfo <<
"Initializing generator frames and tree..." << LogEnd;
57 LAB_Gen.SetChildFrame(W_Gen);
58 W_Gen.AddChildFrame(L_Gen);
59 W_Gen.AddChildFrame(NU_Gen);
61 if(LAB_Gen.InitializeTree())
62 g_Log << LogInfo <<
"...Successfully initialized generator tree" << LogEnd;
64 g_Log << LogError <<
"...Failed initializing generator tree" << LogEnd;
69 W_Gen.SetMass(mW); W_Gen.SetWidth(wW);
72 L_Gen.SetPtCut(20.); L_Gen.SetEtaCut(2.5);
74 if(LAB_Gen.InitializeAnalysis())
75 g_Log << LogInfo <<
"...Successfully initialized generator analysis" << std::endl << LogEnd;
77 g_Log << LogError <<
"...Failed initializing generator analysis" << LogEnd;
82 g_Log << LogInfo <<
"Initializing reconstruction frames and trees..." << LogEnd;
95 if(LAB.InitializeTree())
96 g_Log << LogInfo <<
"...Successfully initialized reconstruction trees" << LogEnd;
98 g_Log << LogError <<
"...Failed initializing reconstruction trees" << LogEnd;
108 INV.AddJigsaw(MassJigsaw);
112 INV.AddJigsaw(RapidityJigsaw);
113 RapidityJigsaw.AddVisibleFrame(L);
115 if(LAB.InitializeAnalysis())
116 g_Log << LogInfo <<
"...Successfully initialized analyses" << LogEnd;
118 g_Log << LogError <<
"...Failed initializing analyses" << LogEnd;
126 tree_plot->SetTree(LAB_Gen);
127 tree_plot->Draw(
"GenTree",
"Generator Tree",
true);
130 tree_plot->SetTree(LAB);
131 tree_plot->Draw(
"RecoTree",
"Reconstruction Tree");
134 tree_plot->SetTree(INV);
135 tree_plot->Draw(
"InvTree",
"InvisibleJigsaws",
true);
142 const HistPlotVar& MW = hist_plot->GetNewVar(
"MW",
"M_{W}", 30., 120.,
"[GeV]");
143 const HistPlotVar& cosW = hist_plot->GetNewVar(
"cosW",
"cos #phi_{W}", -1., 1.);
144 const HistPlotVar& dphiW = hist_plot->GetNewVar(
"dphiW",
"#Delta #phi_{W}", 0., 2.*acos(-1.));
145 const HistPlotVar& DcosW = hist_plot->GetNewVar(
"DcosW",
"#phi_{W} - #phi_{W}^{true}", -0.5, 0.5);
146 const HistPlotVar& DdphiW = hist_plot->GetNewVar(
"DdphiW",
"#Delta #phi_{W} - #Delta #phi_{W}^{true}", -0.5, 0.5);
147 const HistPlotVar& pTWoMW = hist_plot->GetNewVar(
"pTW",
"p_{T}^{W} / m_{W}",0.,1.);
149 const HistPlotCategory& cat_Gen = hist_plot->GetNewCategory(
"Reco",
"Generator");
150 const HistPlotCategory& cat_Reco = hist_plot->GetNewCategory(
"Reco",
"Reconstruction");
152 hist_plot->AddPlot(DcosW, cat_Reco);
153 hist_plot->AddPlot(DdphiW, cat_Reco);
154 hist_plot->AddPlot(MW, cat_Gen+cat_Reco);
155 hist_plot->AddPlot(DcosW, MW, cat_Reco);
156 hist_plot->AddPlot(DdphiW, MW, cat_Reco);
157 hist_plot->AddPlot(MW, pTWoMW, cat_Reco);
158 hist_plot->AddPlot(DcosW, pTWoMW, cat_Reco);
159 hist_plot->AddPlot(DdphiW, pTWoMW, cat_Reco);
161 for(
int igen = 0; igen < Ngen; igen++){
162 if(igen%((std::max(Ngen,10))/10) == 0)
163 g_Log << LogInfo <<
"Generating event " << igen <<
" of " << Ngen << LogEnd;
166 LAB_Gen.ClearEvent();
168 pTWoMW = LAB_Gen.GetRandom();
169 LAB_Gen.SetPToverM(pTWoMW);
170 double PzW = mW*(2.*LAB_Gen.GetRandom()-1.);
171 LAB_Gen.SetLongitudinalMomentum(PzW);
173 LAB_Gen.AnalyzeEvent();
178 L.SetLabFrameFourVector(L_Gen.GetFourVector());
180 TVector3 MET = LAB_Gen.GetInvisibleMomentum();
182 INV.SetLabFrameThreeVector(MET);
187 MW = W_Gen.GetMass();
188 cosW = cos(W_Gen.GetDeltaPhiDecayAngle());
189 dphiW = LAB_Gen.GetDeltaPhiDecayPlanes(W_Gen);
191 hist_plot->Fill(cat_Gen);
195 cosW = cos(W.GetDeltaPhiDecayAngle());
196 dphiW = LAB.GetDeltaPhiDecayPlanes(W);
198 double cosWgen = cos(W_Gen.GetDeltaPhiDecayAngle());
199 double dphiWgen = LAB_Gen.GetDeltaPhiDecayPlanes(W_Gen);
200 DcosW = asin(sqrt(1.-cosW*cosW)*cosWgen-sqrt(1.-cosWgen*cosWgen)*cosW);
201 DdphiW = asin(sin(dphiW-dphiWgen));
203 hist_plot->Fill(cat_Reco);
208 TFile fout(output_name.c_str(),
"RECREATE");
210 hist_plot->WriteOutput(output_name);
211 hist_plot->WriteHist(output_name);
212 tree_plot->WriteOutput(output_name);
216 # ifndef __CINT__ // main function for stand-alone compilation