LOGO

RestFrames  v1.0.1
RestFrames HEP Event Analysis Software Library
example_N_Wlnu.C
Go to the documentation of this file.
1 // RestFrames: particle physics event analysis library
3 // --------------------------------------------------------------------
4 // Copyright (c) 2014-2019, Christopher Rogan
13 //
14 // This file is part of RestFrames.
15 //
16 // RestFrames is free software; you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation; either version 2 of the License, or
19 // (at your option) any later version.
20 //
21 // RestFrames is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU General Public License for more details.
25 //
26 // You should have received a copy of the GNU General Public License
27 // along with RestFrames. If not, see <http://www.gnu.org/licenses/>.
29 
30 #if (!defined(__CINT__) && !defined(__CLING__))
31 #define COMPILER
32 #endif
33 #if defined(__MAKECINT__) || defined(__ROOTCLING__) || defined(COMPILER)
34 #include "RestFrames/RestFrames.hh"
35 #else
36 RestFrames::RFKey ensure_autoload(1);
37 #endif
38 
39 using namespace RestFrames;
40 
41 void example_N_Wlnu(const std::string& output_name =
42  "output_example_N_Wlnu.root"){
43 
44  double mW = 80.385; // GeV, PDG 2016
45  double wW = 2.085;
46  double mL = 0.106; // muons
47  double mN = 0.;
48 
49  // number of events to generate (for each W multiplicity)
50  int Ngen = 10000;
51 
53  g_Log << LogInfo << "Initializing generator frames and tree..." << LogEnd;
55 
56  ppLabGenFrame LAB_G2W("LAB_G2W","LAB"); ppLabGenFrame LAB_G3W("LAB_G3W","LAB");
57  DecayGenFrame CM_G2W("CM_G2W","CM"); DecayGenFrame CM_G3W("CM_G3W","CM");
58  ResonanceGenFrame Wa_G2W("Wa_G2W","W_{a}"); ResonanceGenFrame Wa_G3W("Wa_G3W","W_{a}");
59  ResonanceGenFrame Wb_G2W("Wb_G2W","W_{b}"); ResonanceGenFrame Wb_G3W("Wb_G3W","W_{b}");
60  ResonanceGenFrame Wc_G3W("Wc_G3W","W_{c}");
61  VisibleGenFrame La_G2W("La_G2W","#it{l}_{a}"); VisibleGenFrame La_G3W("La_G3W","#it{l}_{a}");
62  InvisibleGenFrame Na_G2W("Na_G2W","#nu_{a}"); InvisibleGenFrame Na_G3W("Na_G3W","#nu_{a}");
63  VisibleGenFrame Lb_G2W("Lb_G2W","#it{l}_{b}"); VisibleGenFrame Lb_G3W("Lb_G3W","#it{l}_{b}");
64  InvisibleGenFrame Nb_G2W("Nb_G2W","#nu_{b}"); InvisibleGenFrame Nb_G3W("Nb_G3W","#nu_{b}");
65  VisibleGenFrame Lc_G3W("Lc_G3W","#it{l}_{c}");
66  InvisibleGenFrame Nc_G3W("Nc_G3W","#nu_{c}");
67 
68  ppLabGenFrame LAB_G4W("LAB_G4W","LAB");
69  DecayGenFrame CM_G4W("CM_G4W","CM");
70  ResonanceGenFrame Wa_G4W("Wa_G4W","W_{a}");
71  ResonanceGenFrame Wb_G4W("Wb_G4W","W_{b}");
72  ResonanceGenFrame Wc_G4W("Wc_G4W","W_{c}");
73  ResonanceGenFrame Wd_G4W("Wd_G4W","W_{d}");
74  VisibleGenFrame La_G4W("La_G4W","#it{l}_{a}");
75  InvisibleGenFrame Na_G4W("Na_G4W","#nu_{a}");
76  VisibleGenFrame Lb_G4W("Lb_G4W","#it{l}_{b}");
77  InvisibleGenFrame Nb_G4W("Nb_G4W","#nu_{b}");
78  VisibleGenFrame Lc_G4W("Lc_G4W","#it{l}_{c}");
79  InvisibleGenFrame Nc_G4W("Nc_G4W","#nu_{c}");
80  VisibleGenFrame Ld_G4W("Ld_G4W","#it{l}_{d}");
81  InvisibleGenFrame Nd_G4W("Nd_G4W","#nu_{d}");
82 
83  //-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//
84 
85  LAB_G2W.SetChildFrame(CM_G2W); LAB_G3W.SetChildFrame(CM_G3W);
86  CM_G2W.AddChildFrame(Wa_G2W); CM_G3W.AddChildFrame(Wa_G3W);
87  CM_G2W.AddChildFrame(Wb_G2W); CM_G3W.AddChildFrame(Wb_G3W);
88  Wa_G2W.AddChildFrame(La_G2W); CM_G3W.AddChildFrame(Wc_G3W);
89  Wa_G2W.AddChildFrame(Na_G2W); Wa_G3W.AddChildFrame(La_G3W);
90  Wb_G2W.AddChildFrame(Lb_G2W); Wa_G3W.AddChildFrame(Na_G3W);
91  Wb_G2W.AddChildFrame(Nb_G2W); Wb_G3W.AddChildFrame(Lb_G3W);
92  Wb_G3W.AddChildFrame(Nb_G3W);
93  LAB_G4W.SetChildFrame(CM_G4W); Wc_G3W.AddChildFrame(Lc_G3W);
94  CM_G4W.AddChildFrame(Wa_G4W); Wc_G3W.AddChildFrame(Nc_G3W);
95  CM_G4W.AddChildFrame(Wb_G4W);
96  CM_G4W.AddChildFrame(Wc_G4W);
97  CM_G4W.AddChildFrame(Wd_G4W);
98  Wa_G4W.AddChildFrame(La_G4W);
99  Wa_G4W.AddChildFrame(Na_G4W);
100  Wb_G4W.AddChildFrame(Lb_G4W);
101  Wb_G4W.AddChildFrame(Nb_G4W);
102  Wc_G4W.AddChildFrame(Lc_G4W);
103  Wc_G4W.AddChildFrame(Nc_G4W);
104  Wd_G4W.AddChildFrame(Ld_G4W);
105  Wd_G4W.AddChildFrame(Nd_G4W);
106 
107  if(LAB_G2W.InitializeTree() && LAB_G3W.InitializeTree() &&
108  LAB_G4W.InitializeTree())
109  g_Log << LogInfo << "...Successfully initialized generator trees" << LogEnd;
110  else
111  g_Log << LogError << "...Failed initializing generator trees" << LogEnd;
112 
113  //-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//
114 
115  // non-resonant production
116  CM_G2W.SetVariableMass(true); CM_G3W.SetVariableMass(true); CM_G4W.SetVariableMass(true);
117  // set W masses and widths
118  Wa_G2W.SetMass(mW); Wb_G2W.SetMass(mW);
119  Wa_G3W.SetMass(mW); Wb_G3W.SetMass(mW); Wc_G3W.SetMass(mW);
120  Wa_G4W.SetMass(mW); Wb_G4W.SetMass(mW); Wc_G4W.SetMass(mW); Wd_G4W.SetMass(mW);
121  Wa_G2W.SetWidth(wW); Wb_G2W.SetWidth(wW);
122  Wa_G3W.SetWidth(wW); Wb_G3W.SetWidth(wW); Wc_G3W.SetWidth(wW);
123  Wa_G4W.SetWidth(wW); Wb_G4W.SetWidth(wW); Wc_G4W.SetWidth(wW); Wd_G4W.SetWidth(wW);
124  // set lepton masses
125  La_G2W.SetMass(mL); Lb_G2W.SetMass(mL);
126  La_G3W.SetMass(mL); Lb_G3W.SetMass(mL); Lc_G3W.SetMass(mL);
127  La_G4W.SetMass(mL); Lb_G4W.SetMass(mL); Lc_G4W.SetMass(mL); Ld_G4W.SetMass(mL);
128  // set neutrino masses
129  Na_G2W.SetMass(mN); Nb_G2W.SetMass(mN);
130  Na_G3W.SetMass(mN); Nb_G3W.SetMass(mN); Nc_G3W.SetMass(mN);
131  Na_G4W.SetMass(mN); Nb_G4W.SetMass(mN); Nc_G4W.SetMass(mN); Nd_G4W.SetMass(mN);
132 
133  // lepton pT/eta cuts
134  La_G2W.SetPtCut(15.); Lb_G2W.SetPtCut(15.);
135  La_G2W.SetEtaCut(2.5); Lb_G2W.SetEtaCut(2.5);
136  La_G3W.SetPtCut(15.); Lb_G3W.SetPtCut(15.); Lc_G3W.SetPtCut(15.);
137  La_G3W.SetEtaCut(2.5); Lb_G3W.SetEtaCut(2.5); Lc_G3W.SetEtaCut(2.5);
138  La_G4W.SetPtCut(15.); Lb_G4W.SetPtCut(15.); Lc_G4W.SetPtCut(15.); Ld_G4W.SetPtCut(15.);
139  La_G4W.SetEtaCut(2.5); Lb_G4W.SetEtaCut(2.5); Lc_G4W.SetEtaCut(2.5); Ld_G4W.SetEtaCut(2.5);
140 
141  if(LAB_G2W.InitializeAnalysis() && LAB_G3W.InitializeAnalysis() &&
142  LAB_G4W.InitializeAnalysis())
143  g_Log << LogInfo << "...Successfully initialized generator analyses" << LogEnd;
144  else
145  g_Log << LogError << "...Failed initializing generator analyses" << LogEnd;
148 
150  g_Log << LogInfo << "Initializing reconstruction frames and trees..." << LogEnd;
152 
153  LabRecoFrame LAB_2W("LAB_2W","LAB"); LabRecoFrame LAB_3W("LAB_3W","LAB");
154  DecayRecoFrame CM_2W("CM_2W","CM"); DecayRecoFrame CM_3W("CM_3W","CM");
155  DecayRecoFrame Wa_2W("Wa_2W","W_{a}"); DecayRecoFrame Wa_3W("Wa_3W","W_{a}");
156  DecayRecoFrame Wb_2W("Wb_2W","W_{b}"); DecayRecoFrame Wb_3W("Wb_3W","W_{b}");
157  DecayRecoFrame Wc_3W("Wc_3W","W_{c}");
158  VisibleRecoFrame La_2W("La_2W","#it{l}_{a}"); VisibleRecoFrame La_3W("La_3W","#it{l}_{a}");
159  InvisibleRecoFrame Na_2W("Na_2W","#nu_{a}"); InvisibleRecoFrame Na_3W("Na_3W","#nu_{a}");
160  VisibleRecoFrame Lb_2W("Lb_2W","#it{l}_{b}"); VisibleRecoFrame Lb_3W("Lb_3W","#it{l}_{b}");
161  InvisibleRecoFrame Nb_2W("Nb_2W","#nu_{b}"); InvisibleRecoFrame Nb_3W("Nb_3W","#nu_{b}");
162  VisibleRecoFrame Lc_3W("Lc_3W","#it{l}_{c}");
163  InvisibleRecoFrame Nc_3W("Nc_3W","#nu_{c}");
164 
165  LabRecoFrame LAB_4W("LAB_4W","LAB");
166  DecayRecoFrame CM_4W("CM_4W","CM");
167  DecayRecoFrame Wa_4W("Wa_4W","W_{a}");
168  DecayRecoFrame Wb_4W("Wb_4W","W_{b}");
169  DecayRecoFrame Wc_4W("Wc_4W","W_{c}");
170  DecayRecoFrame Wd_4W("Wd_4W","W_{d}");
171  VisibleRecoFrame La_4W("La_4W","#it{l}_{a}");
172  InvisibleRecoFrame Na_4W("Na_4W","#nu_{a}");
173  VisibleRecoFrame Lb_4W("Lb_4W","#it{l}_{b}");
174  InvisibleRecoFrame Nb_4W("Nb_4W","#nu_{b}");
175  VisibleRecoFrame Lc_4W("Lc_4W","#it{l}_{c}");
176  InvisibleRecoFrame Nc_4W("Nc_4W","#nu_{c}");
177  VisibleRecoFrame Ld_4W("Ld_4W","#it{l}_{d}");
178  InvisibleRecoFrame Nd_4W("Nd_4W","#nu_{d}");
179 
180  //-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//
181 
182  LAB_2W.SetChildFrame(CM_2W); LAB_3W.SetChildFrame(CM_3W);
183  CM_2W.AddChildFrame(Wa_2W); CM_3W.AddChildFrame(Wa_3W);
184  CM_2W.AddChildFrame(Wb_2W); CM_3W.AddChildFrame(Wb_3W);
185  Wa_2W.AddChildFrame(La_2W); CM_3W.AddChildFrame(Wc_3W);
186  Wa_2W.AddChildFrame(Na_2W); Wa_3W.AddChildFrame(La_3W);
187  Wb_2W.AddChildFrame(Lb_2W); Wa_3W.AddChildFrame(Na_3W);
188  Wb_2W.AddChildFrame(Nb_2W); Wb_3W.AddChildFrame(Lb_3W);
189  Wb_3W.AddChildFrame(Nb_3W);
190  LAB_4W.SetChildFrame(CM_4W); Wc_3W.AddChildFrame(Lc_3W);
191  CM_4W.AddChildFrame(Wa_4W); Wc_3W.AddChildFrame(Nc_3W);
192  CM_4W.AddChildFrame(Wb_4W);
193  CM_4W.AddChildFrame(Wc_4W);
194  CM_4W.AddChildFrame(Wd_4W);
195  Wa_4W.AddChildFrame(La_4W);
196  Wa_4W.AddChildFrame(Na_4W);
197  Wb_4W.AddChildFrame(Lb_4W);
198  Wb_4W.AddChildFrame(Nb_4W);
199  Wc_4W.AddChildFrame(Lc_4W);
200  Wc_4W.AddChildFrame(Nc_4W);
201  Wd_4W.AddChildFrame(Ld_4W);
202  Wd_4W.AddChildFrame(Nd_4W);
203 
204  if(LAB_2W.InitializeTree() && LAB_3W.InitializeTree() &&
205  LAB_4W.InitializeTree())
206  g_Log << LogInfo << "...Successfully initialized reconstruction trees" << LogEnd;
207  else
208  g_Log << LogError << "...Failed initializing reconstruction trees" << LogEnd;
209 
210  //-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//
211 
212  // Invisible Groups
213  InvisibleGroup INV_2W("INV_2W","#nu #nu Jigsaws");
214  INV_2W.AddFrame(Na_2W);
215  INV_2W.AddFrame(Nb_2W);
216  InvisibleGroup INV_3W("INV_3W","#nu #nu #nu Jigsaws");
217  INV_3W.AddFrame(Na_3W);
218  INV_3W.AddFrame(Nb_3W);
219  INV_3W.AddFrame(Nc_3W);
220  InvisibleGroup INV_4W("INV_4W","#nu #nu #nu #nu Jigsaws");
221  INV_4W.AddFrame(Na_4W);
222  INV_4W.AddFrame(Nb_4W);
223  INV_4W.AddFrame(Nc_4W);
224  INV_4W.AddFrame(Nd_4W);
225 
226  // Set N nu mass equal to ~ N lep mass
227  SetMassInvJigsaw NuNuM_2W("NuNuM_2W", "M_{#nu#nu} ~ m_{#it{l}#it{l}}");
228  INV_2W.AddJigsaw(NuNuM_2W);
229  SetMassInvJigsaw NuNuM_3W("NuNuM_3W", "M_{#nu#nu#nu} ~ m_{#it{l}#it{l}#it{l}}");
230  INV_3W.AddJigsaw(NuNuM_3W);
231  SetMassInvJigsaw NuNuM_4W("NuNuM_4W", "M_{#nu#nu#nu#nu} ~ m_{#it{l}#it{l}#it{l}#it{l}}");
232  INV_4W.AddJigsaw(NuNuM_4W);
233 
234  // Set N nu rapidity equal to N lep rapidity
235  SetRapidityInvJigsaw NuNuR_2W("NuNuR_2W", "#eta_{#nu#nu} = #eta_{#it{l}#it{l}}");
236  INV_2W.AddJigsaw(NuNuR_2W);
237  NuNuR_2W.AddVisibleFrames(La_2W+Lb_2W);
238  SetRapidityInvJigsaw NuNuR_3W("NuNuR_3W", "#eta_{#nu#nu#nu} = #eta_{#it{l}#it{l}#it{l}}");
239  INV_3W.AddJigsaw(NuNuR_3W);
240  NuNuR_3W.AddVisibleFrames(La_3W+Lb_3W+Lc_3W);
241  SetRapidityInvJigsaw NuNuR_4W("NuNuR_4W", "#eta_{#nu#nu#nu#nu} = #eta_{#it{l}#it{l}#it{l}#it{l}}");
242  INV_4W.AddJigsaw(NuNuR_4W);
243  NuNuR_4W.AddVisibleFrames(La_4W+Lb_4W+Lc_4W+Ld_4W);
244 
245  // Set neutrino 4-vectors by minimizing N W masses ^2
246  MinMassesSqInvJigsaw MinMW_2W("MinMW_2W","min #Sigma M_{W}^{ 2}", 2);
247  INV_2W.AddJigsaw(MinMW_2W);
248  MinMW_2W.AddVisibleFrame(La_2W, 0); MinMW_2W.AddInvisibleFrame(Na_2W, 0);
249  MinMW_2W.AddVisibleFrame(Lb_2W, 1); MinMW_2W.AddInvisibleFrame(Nb_2W, 1);
250  MinMassesSqInvJigsaw MinMW_3W("MinMW_3W","min #Sigma M_{W}^{ 2}", 3);
251  INV_3W.AddJigsaw(MinMW_3W);
252  MinMW_3W.AddVisibleFrame(La_3W, 0); MinMW_3W.AddInvisibleFrame(Na_3W, 0);
253  MinMW_3W.AddVisibleFrame(Lb_3W, 1); MinMW_3W.AddInvisibleFrame(Nb_3W, 1);
254  MinMW_3W.AddVisibleFrame(Lc_3W, 2); MinMW_3W.AddInvisibleFrame(Nc_3W, 2);
255  MinMassesSqInvJigsaw MinMW_4W("MinMW_4W","min #Sigma M_{W}^{ 2}", 4);
256  INV_4W.AddJigsaw(MinMW_4W);
257  MinMW_4W.AddVisibleFrame(La_4W, 0); MinMW_4W.AddInvisibleFrame(Na_4W, 0);
258  MinMW_4W.AddVisibleFrame(Lb_4W, 1); MinMW_4W.AddInvisibleFrame(Nb_4W, 1);
259  MinMW_4W.AddVisibleFrame(Lc_4W, 2); MinMW_4W.AddInvisibleFrame(Nc_4W, 2);
260  MinMW_4W.AddVisibleFrame(Ld_4W, 3); MinMW_4W.AddInvisibleFrame(Nd_4W, 3);
261 
262  if(LAB_2W.InitializeAnalysis() && LAB_3W.InitializeAnalysis() &&
263  LAB_4W.InitializeAnalysis())
264  g_Log << LogInfo << "...Successfully initialized analyses" << LogEnd;
265  else
266  g_Log << LogError << "...Failed initializing analyses" << LogEnd;
267 
270 
271  TreePlot* treePlot = new TreePlot("TreePlot","TreePlot");
272 
273  treePlot->SetTree(CM_2W);
274  treePlot->Draw("Reco_2W_Tree", "2W Reconstruction Tree");
275 
276  treePlot->SetTree(CM_3W);
277  treePlot->Draw("Reco_3W_Tree", "3W Reconstruction Tree");
278 
279  treePlot->SetTree(CM_4W);
280  treePlot->Draw("Reco_4W_Tree", "4W Reconstruction Tree");
281 
282  treePlot->SetTree(INV_2W);
283  treePlot->Draw("Inv_2W_Tree", "2W Inivisible Jigsaws", true);
284 
285  treePlot->SetTree(INV_3W);
286  treePlot->Draw("Inv_3W_Tree", "3W Inivisible Jigsaws", true);
287 
288  treePlot->SetTree(INV_4W);
289  treePlot->Draw("Inv_4W_Tree", "4W Inivisible Jigsaws", true);
290 
291  //-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//
292 
293  HistPlot* histPlot = new HistPlot("HistPlot","pp #rightarrow N W(#it{l} #nu)");
294 
295  const HistPlotCategory& cat_2W = histPlot->GetNewCategory("Reco_2W", "2 W(#it{l} #nu)");
296  const HistPlotCategory& cat_3W = histPlot->GetNewCategory("Reco_3W", "3 W(#it{l} #nu)");
297  const HistPlotCategory& cat_4W = histPlot->GetNewCategory("Reco_4W", "4 W(#it{l} #nu)");
298 
299  const HistPlotVar& MCM = histPlot->GetNewVar("MCM", "M_{CM} / m_{CM}^{ true}", 0., 2.);
300  const HistPlotVar& sumMW2 = histPlot->GetNewVar("MWTOT",
301  "#sqrt{#Sigma M_{W}^{ 2} / #Sigma m_{W, true}^{ 2}}", 0., 1.5);
302  double sumMW2gen;
303 
304  histPlot->AddPlot(MCM, cat_2W+cat_3W+cat_4W);
305  histPlot->AddPlot(sumMW2, cat_2W+cat_3W+cat_4W);
306  histPlot->AddPlot(MCM, sumMW2, cat_2W+cat_3W+cat_4W);
307 
308 
309  for(int igen = 0; igen < Ngen; igen++){
310  if(igen%(Ngen/10) == 0)
311  g_Log << LogInfo << "Generating event " << igen << " of " << Ngen << LogEnd;
312 
313  // generate event
314  LAB_G2W.ClearEvent(); // clear the gen tree;
315  LAB_G2W.AnalyzeEvent(); // generate a new event
316  LAB_G3W.ClearEvent();
317  LAB_G3W.AnalyzeEvent();
318  LAB_G4W.ClearEvent();
319  LAB_G4W.AnalyzeEvent();
320 
321  TVector3 MET_2W = LAB_G2W.GetInvisibleMomentum(); // Get the MET from gen tree
322  MET_2W.SetZ(0.);
323  TVector3 MET_3W = LAB_G3W.GetInvisibleMomentum();
324  MET_3W.SetZ(0.);
325  TVector3 MET_4W = LAB_G4W.GetInvisibleMomentum();
326  MET_4W.SetZ(0.);
327 
328  // analyze event(s)
329  LAB_2W.ClearEvent(); // clear the reco tree
330  INV_2W.SetLabFrameThreeVector(MET_2W); // Set the MET in reco tree
331  LAB_3W.ClearEvent();
332  INV_3W.SetLabFrameThreeVector(MET_3W);
333  LAB_4W.ClearEvent();
334  INV_4W.SetLabFrameThreeVector(MET_4W);
335 
336  La_2W.SetLabFrameFourVector(La_G2W.GetFourVector()); // Set "measured" lep 4-vectors
337  Lb_2W.SetLabFrameFourVector(Lb_G2W.GetFourVector());
338  La_3W.SetLabFrameFourVector(La_G3W.GetFourVector());
339  Lb_3W.SetLabFrameFourVector(Lb_G3W.GetFourVector());
340  Lc_3W.SetLabFrameFourVector(Lc_G3W.GetFourVector());
341  La_4W.SetLabFrameFourVector(La_G4W.GetFourVector());
342  Lb_4W.SetLabFrameFourVector(Lb_G4W.GetFourVector());
343  Lc_4W.SetLabFrameFourVector(Lc_G4W.GetFourVector());
344  Ld_4W.SetLabFrameFourVector(Ld_G4W.GetFourVector());
345 
346  LAB_2W.AnalyzeEvent(); // analyze the event
347  LAB_3W.AnalyzeEvent();
348  LAB_4W.AnalyzeEvent();
349 
351  // Observable Calculations
353 
354  MCM = CM_2W.GetMass()/CM_G2W.GetMass();
355  sumMW2 = Wa_2W.GetMass()*Wa_2W.GetMass();
356  sumMW2 += Wb_2W.GetMass()*Wb_2W.GetMass();
357  sumMW2gen = Wa_G2W.GetMass()*Wa_G2W.GetMass();
358  sumMW2gen += Wb_G2W.GetMass()*Wb_G2W.GetMass();
359  sumMW2 /= sumMW2gen;
360  sumMW2 = sqrt(sumMW2);
361 
362  histPlot->Fill(cat_2W);
363 
364  MCM = CM_3W.GetMass()/CM_G3W.GetMass();
365  sumMW2 = Wa_3W.GetMass()*Wa_3W.GetMass();
366  sumMW2 += Wb_3W.GetMass()*Wb_3W.GetMass();
367  sumMW2 += Wc_3W.GetMass()*Wc_3W.GetMass();
368  sumMW2gen = Wa_G3W.GetMass()*Wa_G3W.GetMass();
369  sumMW2gen += Wb_G3W.GetMass()*Wb_G3W.GetMass();
370  sumMW2gen += Wc_G3W.GetMass()*Wc_G3W.GetMass();
371  sumMW2 /= sumMW2gen;
372  sumMW2 = sqrt(sumMW2);
373 
374  histPlot->Fill(cat_3W);
375 
376  MCM = CM_4W.GetMass()/CM_G4W.GetMass();
377  sumMW2 = Wa_4W.GetMass()*Wa_4W.GetMass();
378  sumMW2 += Wb_4W.GetMass()*Wb_4W.GetMass();
379  sumMW2 += Wc_4W.GetMass()*Wc_4W.GetMass();
380  sumMW2 += Wd_4W.GetMass()*Wd_4W.GetMass();
381  sumMW2gen = Wa_G4W.GetMass()*Wa_G4W.GetMass();
382  sumMW2gen += Wb_G4W.GetMass()*Wb_G4W.GetMass();
383  sumMW2gen += Wc_G4W.GetMass()*Wc_G4W.GetMass();
384  sumMW2gen += Wd_G4W.GetMass()*Wd_G4W.GetMass();
385  sumMW2 /= sumMW2gen;
386  sumMW2 = sqrt(sumMW2);
387 
388  histPlot->Fill(cat_4W);
389  }
390 
391  histPlot->Draw();
392 
393  TFile fout(output_name.c_str(),"RECREATE");
394  fout.Close();
395  histPlot->WriteOutput(output_name);
396  histPlot->WriteHist(output_name);
397  treePlot->WriteOutput(output_name);
398 
399  g_Log << LogInfo << "Finished" << LogEnd;
400 }
401 
402 # ifndef __CINT__ // main function for stand-alone compilation
403 int main(){
404  example_N_Wlnu();
405  return 0;
406 }
407 #endif
RestFrames::TreePlot::Draw
void Draw(const std::string &name="", const std::string &title="", bool invert_colors=false, bool invert_node_colors=false)
Draws tree.
Definition: TreePlot.cc:127
RestFrames::HistPlot::WriteHist
void WriteHist(const std::string &filename)
Stores all histograms in root file.
Definition: HistPlot.cc:581
RestFrames::InvisibleGenFrame
Definition: InvisibleGenFrame.hh:41
RestFrames::HistPlotCategory
Definition: HistPlotCategory.hh:40
RestFrames::ppLabGenFrame
Definition: ppLabGenFrame.hh:40
RestFrames::DecayGenFrame
Definition: DecayGenFrame.hh:43
RestFrames::HistPlot
Definition: HistPlot.hh:44
RestFrames::RFPlot::WriteOutput
void WriteOutput(const std::string &filename)
Stores all plots in root file.
Definition: RFPlot.cc:59
RestFrames.hh
RestFrames::VisibleRecoFrame
Definition: VisibleRecoFrame.hh:41
RestFrames::ResonanceGenFrame
Definition: ResonanceGenFrame.hh:40
RestFrames::MinMassesSqInvJigsaw
Definition: MinMassesSqInvJigsaw.hh:37
RestFrames::SetRapidityInvJigsaw
Definition: SetRapidityInvJigsaw.hh:37
RestFrames::LabRecoFrame
Definition: LabRecoFrame.hh:44
RestFrames::HistPlot::GetNewVar
HistPlotVar const & GetNewVar(const std::string &name, const std::string &title, double minval, double maxval, const std::string &unit="")
Defines new variable for plotting.
Definition: HistPlot.cc:86
RestFrames::VisibleGenFrame
Definition: VisibleGenFrame.hh:41
RestFrames::HistPlot::Fill
void Fill(double weight=1.)
Fills an entry for every variable according to each's current value.
Definition: HistPlot.cc:242
RestFrames::InvisibleRecoFrame
Definition: InvisibleRecoFrame.hh:41
RestFrames::TreePlot::SetTree
void SetTree(const RestFrame &frame)
Sets a tree that shows how a frame is connected to its children.
Definition: TreePlot.cc:160
RestFrames::TreePlot
Definition: TreePlot.hh:50
RestFrames::HistPlot::GetNewCategory
HistPlotCategory const & GetNewCategory(const std::string &name, const std::string &title)
Defines new category for plotting.
Definition: HistPlot.cc:95
RestFrames::SetMassInvJigsaw
Definition: SetMassInvJigsaw.hh:37
RestFrames::RFKey
Definition: RFKey.hh:38
RestFrames::HistPlotVar
Definition: HistPlotVar.hh:40
RestFrames::HistPlot::AddPlot
void AddPlot(const HistPlotVar &var, RestFrames::RFList< const HistPlotCategory > cats=RestFrames::RFList< const RestFrames::HistPlotCategory >(), bool invert_colors=false)
Defines new 1D plot.
Definition: HistPlot.cc:102
RestFrames::DecayRecoFrame
Definition: DecayRecoFrame.hh:43
RestFrames::InvisibleGroup
Definition: InvisibleGroup.hh:40
RestFrames::HistPlot::Draw
void Draw(bool invert_colors=false)
Draws every histogram.
Definition: HistPlot.cc:272