30 #if (!defined(__CINT__) && !defined(__CLING__))
33 #if defined(__MAKECINT__) || defined(__ROOTCLING__) || defined(COMPILER)
39 using namespace RestFrames;
41 void example_Wlnu(
const std::string& output_name =
"output_Wlnu.root"){
50 g_Log << LogInfo <<
"Initializing generator frames and tree..." << LogEnd;
59 LAB_Gen.SetChildFrame(W_Gen);
60 W_Gen.AddChildFrame(L_Gen);
61 W_Gen.AddChildFrame(NU_Gen);
63 if(LAB_Gen.InitializeTree())
64 g_Log << LogInfo <<
"...Successfully initialized generator tree" << LogEnd;
66 g_Log << LogError <<
"...Failed initializing generator tree" << LogEnd;
71 W_Gen.SetMass(mW); W_Gen.SetWidth(wW);
74 L_Gen.SetPtCut(20.); L_Gen.SetEtaCut(2.5);
76 if(LAB_Gen.InitializeAnalysis())
77 g_Log << LogInfo <<
"...Successfully initialized generator analysis" << std::endl << LogEnd;
79 g_Log << LogError <<
"...Failed initializing generator analysis" << LogEnd;
84 g_Log << LogInfo <<
"Initializing reconstruction frames and trees..." << LogEnd;
97 if(LAB.InitializeTree())
98 g_Log << LogInfo <<
"...Successfully initialized reconstruction trees" << LogEnd;
100 g_Log << LogError <<
"...Failed initializing reconstruction trees" << LogEnd;
110 INV.AddJigsaw(MassJigsaw);
114 INV.AddJigsaw(RapidityJigsaw);
115 RapidityJigsaw.AddVisibleFrame(L);
117 if(LAB.InitializeAnalysis())
118 g_Log << LogInfo <<
"...Successfully initialized analyses" << LogEnd;
120 g_Log << LogError <<
"...Failed initializing analyses" << LogEnd;
129 tree_plot->
Draw(
"GenTree",
"Generator Tree",
true);
133 tree_plot->
Draw(
"RecoTree",
"Reconstruction Tree");
137 tree_plot->
Draw(
"InvTree",
"InvisibleJigsaws",
true);
147 const HistPlotVar& DcosW = hist_plot->
GetNewVar(
"DcosW",
"#phi_{W} - #phi_{W}^{true}", -0.5, 0.5);
148 const HistPlotVar& DdphiW = hist_plot->
GetNewVar(
"DdphiW",
"#Delta #phi_{W} - #Delta #phi_{W}^{true}", -0.5, 0.5);
154 hist_plot->
AddPlot(DcosW, cat_Reco);
155 hist_plot->
AddPlot(DdphiW, cat_Reco);
156 hist_plot->
AddPlot(MW, cat_Gen+cat_Reco);
157 hist_plot->
AddPlot(DcosW, MW, cat_Reco);
158 hist_plot->
AddPlot(DdphiW, MW, cat_Reco);
159 hist_plot->
AddPlot(MW, pTWoMW, cat_Reco);
160 hist_plot->
AddPlot(DcosW, pTWoMW, cat_Reco);
161 hist_plot->
AddPlot(DdphiW, pTWoMW, cat_Reco);
163 for(
int igen = 0; igen < Ngen; igen++){
164 if(igen%((std::max(Ngen,10))/10) == 0)
165 g_Log << LogInfo <<
"Generating event " << igen <<
" of " << Ngen << LogEnd;
168 LAB_Gen.ClearEvent();
170 pTWoMW = LAB_Gen.GetRandom();
171 LAB_Gen.SetPToverM(pTWoMW);
172 double PzW = mW*(2.*LAB_Gen.GetRandom()-1.);
173 LAB_Gen.SetLongitudinalMomentum(PzW);
175 LAB_Gen.AnalyzeEvent();
180 L.SetLabFrameFourVector(L_Gen.GetFourVector());
182 TVector3 MET = LAB_Gen.GetInvisibleMomentum();
184 INV.SetLabFrameThreeVector(MET);
189 MW = W_Gen.GetMass();
190 cosW = cos(W_Gen.GetDeltaPhiDecayAngle());
191 dphiW = LAB_Gen.GetDeltaPhiDecayPlanes(W_Gen);
193 hist_plot->
Fill(cat_Gen);
197 cosW = cos(W.GetDeltaPhiDecayAngle());
198 dphiW = LAB.GetDeltaPhiDecayPlanes(W);
200 double cosWgen = cos(W_Gen.GetDeltaPhiDecayAngle());
201 double dphiWgen = LAB_Gen.GetDeltaPhiDecayPlanes(W_Gen);
202 DcosW = asin(sqrt(1.-cosW*cosW)*cosWgen-sqrt(1.-cosWgen*cosWgen)*cosW);
203 DdphiW = asin(sin(dphiW-dphiWgen));
205 hist_plot->
Fill(cat_Reco);
210 TFile fout(output_name.c_str(),
"RECREATE");
218 # ifndef __CINT__ // main function for stand-alone compilation