LOGO

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