ProducingSA.C
Go to the documentation of this file.
2 #include "CAFAna/Core/Progress.h"
9 #include "CAFAna/Core/Binning.h"
10 #include "CAFAna/Cuts/Cuts.h"
11 #include "CAFAna/Core/Spectrum.h"
14 #include "CAFAna/Vars/Vars.h"
15 #include "CAFAna/Core/OscCurve.h"
17 #include "CAFAna/Core/EventList.h"
18 #include "CAFAna/Analysis/Plots.h"
19 #include "CAFAna/Cuts/Cuts.h"
20 #include "CAFAna/Cuts/SpillCuts.h"
22 #include "TLorentzVector.h"
23 #include <cmath>
24 #include <iostream>
25 #include <functional>
26 #include <list>
27 #include <memory>
28 #include <set>
29 #include <string>
30 #include <vector>
31 // ROOT includes
32 #include "TStyle.h"
33 #include "TFile.h"
34 #include "TROOT.h"
35 #include "TTree.h"
36 #include "TVector3.h"
38 #include "TCanvas.h"
39 #include "TLatex.h"
40 #include "TLegend.h"
41 
42 using namespace ana;
43 
44 void ProducingSA(){
45 
46  ///Training and Testing
47  const std::string fnamecos = "defname:prod_limitedcaf_R16-03-03-prod2reco.a_fd_cosmic_full_nueveto_v1_goodruns with limit 100000 with stride 2";
48  SpectrumLoader loadercos(fnamecos);
49  const std::string fnamenc = "defname:prod_caf_R16-03-03-prod2reco.f_fd_genie_nonswap_fhc_nova_v08_period2_v1_prod2-snapshot with limit 1000";
50  SpectrumLoader loadernc(fnamenc);
51 
52  // Output file
53  TFile tMVALoad("TrainingSA.root","RECREATE");
54  // Four trees for four interactions
55  TTree *ncTree = new TTree("ncTree", "NC event tree");
56  TTree *muTree = new TTree("muTree", "Numu event tree");
57  TTree *neTree = new TTree("neTree", "Nue event tree");
58  TTree *csTree = new TTree("csTree", "Cosmic event tree");
59  // Definding the useful variables to transform into Input.root
60  int Run;
61  int SubRun;
62  int Evt;
63  int SubEvt;
64  int IsCC;
65 
66  float ncid; // CVN
67  float nueid; // CVN
68  float numuid; // CVN
69  float nutauid; // CVN
70  float cosmicid; // CVN SY 1
71 
72  float partptp; // NueCosRej SY 2 We need to choose one from them
73  float pngptp; // NueCosRej SY 2
74  float starttop; // NueCosRej
75  float startbottom; // NueCosRej
76  float startfront; // NueCosRej
77  float startback; // NueCosRej
78  float startwest; // NueCosRej
79  float starteast; // NueCosRej
80  float stoptop; // NueCosRej
81  float stopbottom; // NueCosRej
82  float stopfront; // NueCosRej
83  float stopback; // NueCosRej
84  float stopwest; // NueCosRej
85  float stopeast; // NueCosRej
86  float cosdang; // NueCosRej
87  float vtxdoca; // NueCosRej
88  float prongmaxx; // NueCosRej
89  float prongmaxy; // NueCosRej
90  float prongmaxz; // NueCosRej
91  float prongminx; // NueCosRej
92  float prongminy; // NueCosRej
93  float prongminz; // NueCosRej
94 
95  float sparsenessasymm; // NueCosRej I wanna check this one
96 
97  float hitsperplaneasymm; // NueCosRej I wanna check this one
98  float hitsperplane; // NueCosRej
99  float musliceidx; // NueCosRej
100  float muanglediff; // NueCosRej
101  float mutimediff; // NueCosRej
102  float muclosestapproach; // NueCosRej
103 
104  /// Do we want to use Prong to replace Showe at all!!!
105  float shwnhit; // Shower Branch SY 3
106  float shwnhitx; // Shower Branch SY 4
107  float shwnhity; // Shower Branch SY 5
108  float shwxminusy; // shwnhitx - shwnhity SY 6
109  float shwxplusy; // shwnhitx + shwnhity SY 7
110  float shwxovery; // shwnhitx/shwnhity SY 8
111  float shwnplane; // Shower Branch
112  float shwmaxplanecont; // Shower Branch
113  float shwmaxplanegap; // Shower Branch
114  float shwcalE; // Shower Branch SY 9
115  float shwstartX; // Shower Branch
116  float shwstartY; // Shower Branch
117  float shwstartZ; // Shower Branch
118  float shwdirX; // Shower Branch
119  float shwdirY; // Shower Branch SY 10
120  float shwdirZ; // Shower Branch
121  float shwlen; // Shower Branch SY 11
122  float shwwwidth; // Shower Branch SY 12
123  float shwNplaneX; // Shower Branch
124  float shwNplaneY; // Shower Branch
125  float shwGap; // Shower Branch SY 13
126  float shwstopX; // Shower Branch
127  float shwstopY; // Shower Branch
128  float shwstopZ; // Shower Branch
129  float nshwlid; // Shower Branch SY 14
130 
131  //float nhit; // Slice Branch
132  float ncalhit; // Slice Branch SY 15
133  /// What is the different between the ncalhit and nmiphit
134  float nmiphit; // Slice Branch
135  float ncontplanes; // Slice Branch
136  float starttime; // Slice Branch
137  float endtime; // Slice Branch
138  float meantime; // Slice Branch
139  float meanposX; // Slice Branch
140  float meanposY; // Slice Branch
141  float meanposZ; // Slice Branch
142 
143  /// I do want to use our NUS Sandbox Vars
144  float sumtx; // NuS Sandbox
145  float sumty; // NuS Sandbox
146  float ewsumtx; // NuS Sandbox
147  float ewsumty; // NuS Sandbox
148  float cossumtx; // NuS Sandbox
149  float cossumty; // NuS Sandbox
150  float cosewsumtx; // NuS Sandbox
151  float cosewsumty; // NuS Sandbox
152  float angsumtx; // NuS Sandbox
153  float angsumty; // NuS Sandbox
154  float angewsumtx; // NuS Sandbox
155  float angewsumty; // NuS Sandbox
156 
157  float numupid; // CosBDT Score by Kirk
158 
159  float rempid; // RemID /// We will try it as a selection CUT
160  float remlen; // RemID
161 
162  float vtxTime; // Vertex Branch
163  float vtxX; // Vertex Branch
164  float vtxY; // Vertex Branch
165  float vtxZ; // Vertex Branch
166  float vtxpngNhit; // Vertex Branch Prong Hits
167  float vtxpngNhitX; // Vertex Branch Prong Hits X View
168  float vtxpngNhitY; // Vertex Branch Prong Hits Y View
169 
170  float anglekal; // Kirk 1
171  float dirFY; // Kirk 2
172  float boxmaxFY; // Kirk 3
173  float kalnhit; // Kirk 4
174  float kallen; // Kirk 5
175  float kalfwdcell; // Kirk 6
176  float kalbakcell; // Kirk 6
177  float scatt; // Kirk 7
178  float nhit; // Kirk 8
179  float energy; // Kirk 9
180  float boxminFY; // Kirk 10
181  float nkal; // Kirk 11
182 
183  // cosmic tree
184  csTree->Branch("Run",&Run,"Run/I"); // True Info
185  csTree->Branch("SubRun",&SubRun,"SubRun/I"); // True Info
186  csTree->Branch("Evt",&Evt,"Evt/I"); // True Info
187  csTree->Branch("SubEvt",&SubEvt,"SubEvt/I"); // True Info
188  csTree->Branch("IsCC",&IsCC,"IsCC/I"); // True Info
189 
190  csTree->Branch("nueid",&nueid,"nueid/F"); // CVN
191  csTree->Branch("numuid",&numuid,"numuid/F"); // CVN
192  csTree->Branch("nutauid",&nutauid,"nutauid/F"); // CVN
193 
194  csTree->Branch("pngptp",&pngptp,"pngptp/F"); // NueCosRej
195  csTree->Branch("starttop",&starttop,"starttop/F"); // NueCosRej
196  csTree->Branch("startbottom",&startbottom,"startbottom/F"); // NueCosRej
197  csTree->Branch("startfront",&startfront,"startfront/F"); // NueCosRej
198  csTree->Branch("startback",&startback,"startback/F"); // NueCosRej
199  csTree->Branch("startwest",&startwest,"startwest/F"); // NueCosRej
200  csTree->Branch("starteast",&starteast,"starteast/F"); // NueCosRej
201  csTree->Branch("stoptop",&stoptop,"stoptop/F"); // NueCosRej
202  csTree->Branch("stopbottom",&stopbottom,"stopbottom/F"); // NueCosRej
203  csTree->Branch("stopfront",&stopfront,"stopfront/F"); // NueCosRej
204  csTree->Branch("stopback",&stopback,"stopback/F"); // NueCosRej
205  csTree->Branch("stopwest",&stopwest,"stopwest/F"); // NueCosRej
206  csTree->Branch("stopeast",&stopeast,"stopeast/F"); // NueCosRej
207  csTree->Branch("cosdang",&cosdang,"cosdang/F"); // NueCosRej
208  csTree->Branch("vtxdoca",&vtxdoca,"vtxdoca/F"); // NueCosRej
209  csTree->Branch("prongmaxx",&prongmaxx,"prongmaxx/F"); // NueCosRej
210  csTree->Branch("prongmaxy",&prongmaxy,"prongmaxy/F"); // NueCosRej
211  csTree->Branch("prongmaxz",&prongmaxz,"prongmaxz/F"); // NueCosRej
212  csTree->Branch("prongminx",&prongminx,"prongminx/F"); // NueCosRej
213  csTree->Branch("prongminy",&prongminy,"prongminy/F"); // NueCosRej
214  csTree->Branch("prongminz",&prongminz,"prongminz/F"); // NueCosRej
215  csTree->Branch("sparsenessasymm",&sparsenessasymm,"sparsenessasymm/F"); // NueCosRej
216  csTree->Branch("hitsperplaneasymm",&hitsperplaneasymm,"hitsperplaneasymm/F"); // NueCosRej
217  csTree->Branch("hitsperplane",&hitsperplane,"hitsperplane/F"); // NueCosRej
218  csTree->Branch("musliceidx",&musliceidx,"musliceidx/F"); // NueCosRej
219  csTree->Branch("muanglediff",&muanglediff,"muanglediff/F"); // NueCosRej
220  csTree->Branch("mutimediff",&mutimediff,"mutimediff/F"); // NueCosRej
221  csTree->Branch("muclosestapproach",&muclosestapproach,"muclosestapproach/F"); // NueCosRej
222 
223  csTree->Branch("shwnplane",&shwnplane,"shwnplane/F"); // Shower Branch
224  csTree->Branch("shwmaxplanecont",&shwmaxplanecont,"shwmaxplanecont/F"); // Shower Branch
225  csTree->Branch("shwmaxplanegap",&shwmaxplanegap,"shwmaxplanegap/F"); // Shower Branch
226  csTree->Branch("shwstartX",&shwstartX,"shwstartX/F"); // Shower Branch
227  csTree->Branch("shwstartY",&shwstartY,"shwstartY/F"); // Shower Branch
228  csTree->Branch("shwstartZ",&shwstartZ,"shwstartZ/F"); // Shower Branch
229  csTree->Branch("shwdirX",&shwdirX,"shwdirX/F"); // Shower Branch
230  csTree->Branch("shwdirZ",&shwdirZ,"shwdirZ/F"); // Shower Branch
231  csTree->Branch("shwNplaneX",&shwNplaneX,"shwNplaneX/F"); // Shower Branch
232  csTree->Branch("shwNplaneY",&shwNplaneY,"shwNplaneY/F"); // Shower Branch
233  csTree->Branch("shwstopX",&shwstopX,"shwstopX/F"); // Shower Branch
234  csTree->Branch("shwstopY",&shwstopY,"shwstopY/F"); // Shower Branch
235  csTree->Branch("shwstopZ",&shwstopZ,"shwstopZ/F"); // Shower Branch
236 
237  csTree->Branch("sumtx",&sumtx,"sumtx/F"); // NuS Sandbox
238  csTree->Branch("sumty",&sumty,"sumty/F"); // NuS Sandbox
239  csTree->Branch("ewsumtx",&ewsumtx,"ewsumtx/F"); // NuS Sandbox
240  csTree->Branch("ewsumty",&ewsumty,"ewsumty/F"); // NuS Sandbox
241  csTree->Branch("cossumtx",&cossumtx,"cossumtx/F"); // NuS Sandbox
242  csTree->Branch("cossumty",&cossumty,"cossumty/F"); // NuS Sandbox
243  csTree->Branch("cosewsumtx",&cosewsumtx,"cosewsumtx/F"); // NuS Sandbox
244  csTree->Branch("cosewsumty",&cosewsumty,"cosewsumty/F"); // NuS Sandbox
245  csTree->Branch("angsumtx",&angsumtx,"angsumtx/F"); // NuS Sandbox
246  csTree->Branch("angsumty",&angsumty,"angsumty/F"); // NuS Sandbox
247  csTree->Branch("angewsumtx",&angewsumtx,"angewsumtx/F"); // NuS Sandbox
248  csTree->Branch("angewsumty",&angewsumty,"angewsumty/F"); // NuS Sandbox
249 
250  csTree->Branch("numupid",&numupid,"numupid/F"); // CosBDT score by Kirk
251 
252  csTree->Branch("rempid",&rempid,"rempid/F"); // RemID
253  csTree->Branch("remlen",&remlen,"remlen/F"); // RemID
254 
255  csTree->Branch("ncalhit",&ncalhit,"ncalhit/F"); // Slice Branch
256 
257  csTree->Branch("ncontplanes",&ncontplanes,"ncontplanes/F"); // Slice Branch
258  csTree->Branch("starttime",&starttime,"starttime/F"); // Slice Branch
259  csTree->Branch("endtime",&endtime,"endtime/F"); // Slice Branch
260  csTree->Branch("meantime",&meantime,"meantime/F"); // Slice Branch
261  csTree->Branch("meanposX",&meanposX,"meanposX/F"); // Slice Branch
262  csTree->Branch("meanposY",&meanposY,"meanposY/F"); // Slice Branch
263  csTree->Branch("meanposZ",&meanposZ,"meanposZ/F"); // Slice Branch
264 
265  csTree->Branch("vtxTime",&vtxTime,"vtxTime/F"); // Vertex Branch
266  csTree->Branch("vtxX",&vtxX,"vtxX/F"); // Vertex Branch
267  csTree->Branch("vtxY",&vtxY,"vtxY/F"); // Vertex Branch
268  csTree->Branch("vtxZ",&vtxZ,"vtxZ/F"); // Vertex Branch
269  csTree->Branch("vtxpngNhit",&vtxpngNhit,"vtxpngNhit/F"); // Vertex Branch Prong Hits
270  csTree->Branch("vtxpngNhitX",&vtxpngNhitX,"vtxpngNhitX/F"); // Vertex Branch Prong Hits X View
271  csTree->Branch("vtxpngNhitY",&vtxpngNhitY,"vtxpngNhitY/F"); // Vertex Branch Prong Hits Y View
272 
273  csTree->Branch("ncid",&ncid,"ncid/F"); // CVN SY 1
274  csTree->Branch("cosmicid",&cosmicid,"cosmicid/F"); // CVN SY 1
275  csTree->Branch("partptp",&partptp,"partptp/F"); // NueCosRej SY 2 LIDShower PtP
276  csTree->Branch("shwnhit",&shwnhit,"shwnhit/F"); // Shower Branch SY 3
277  csTree->Branch("shwnhitx",&shwnhitx,"shwnhitx/F"); // Shower Branch SY 4
278  csTree->Branch("shwnhity",&shwnhity,"shwnhity/F"); // Shower Branch SY 5
279  csTree->Branch("shwxminusy",&shwxminusy,"shwxminusy/F"); // Shower Branch SY 6
280  csTree->Branch("shwxplusy",&shwxplusy,"shwxplusy/F"); // Shower Branch SY 7
281  csTree->Branch("shwxovery",&shwxovery,"shwxovery/F"); // Shower Branch SY 8
282  csTree->Branch("shwcalE",&shwcalE,"shwcalE/F"); // Shower Branch SY 9
283  csTree->Branch("shwdirY",&shwdirY,"shwdirY/F"); // Shower Branch SY 10
284  csTree->Branch("shwlen",&shwlen,"shwlen/F"); // Shower Branch SY 11
285  csTree->Branch("shwwwidth",&shwwwidth,"shwwwidth/F"); // Shower Branch SY 12
286  csTree->Branch("shwGap",&shwGap,"shwGap/F"); // Shower Branch SY 13
287  csTree->Branch("nshwlid",&nshwlid,"nshwlid/F"); // Shower Branch SY 14
288  csTree->Branch("nmiphit",&nmiphit,"nmiphit/F"); // Slice Branch SY 15
289 
290  csTree->Branch("anglekal",&anglekal,"anglekal/F"); // Kirk 1
291  csTree->Branch("dirFY",&dirFY,"dirFY/F"); // Kirk 2
292  csTree->Branch("boxmaxFY",&boxmaxFY,"boxmaxFY/F"); // Kirk 3
293  csTree->Branch("kalnhit",&kalnhit,"kalnhit/F"); // Kirk 4
294  csTree->Branch("kallen",&kallen,"kallen/F"); // Kirk 5
295  csTree->Branch("kalfwdcell",&kalfwdcell,"kalfwdcell/F"); // Kirk 6
296  csTree->Branch("kalbakcell",&kalbakcell,"kalbakcell/F"); // Kirk 6
297  csTree->Branch("scatt",&scatt,"scatt/F"); // Kirk 7
298  csTree->Branch("nhit",&nhit,"nhit/F"); // Kirk 8
299  csTree->Branch("energy",&energy,"energy/F"); // kirk 9
300  csTree->Branch("boxminFY",&boxminFY,"boxminFY/F"); // Kirk 10
301  csTree->Branch("nkal",&nkal,"nkal/F"); // Kirk 11
302 
303  // nc tree
304  ncTree->Branch("Run",&Run,"Run/I"); // Ture Info
305  ncTree->Branch("SubRun",&SubRun,"SubRun/I"); // Ture Info
306  ncTree->Branch("Evt",&Evt,"Evt/I"); // Ture Info
307  ncTree->Branch("SubEvt",&SubEvt,"SubEvt/I"); // Ture Info
308  ncTree->Branch("IsCC",&IsCC,"IsCC/I"); // Ture Info
309 
310  ncTree->Branch("sumtx",&sumtx,"sumtx/F"); // NuS Sandbox
311  ncTree->Branch("sumty",&sumty,"sumty/F"); // NuS Sandbox
312  ncTree->Branch("ewsumtx",&ewsumtx,"ewsumtx/F"); // NuS Sandbox
313  ncTree->Branch("ewsumty",&ewsumty,"ewsumty/F"); // NuS Sandbox
314  ncTree->Branch("cossumtx",&cossumtx,"cossumtx/F"); // NuS Sandbox
315  ncTree->Branch("cossumty",&cossumty,"cossumty/F"); // NuS Sandbox
316  ncTree->Branch("cosewsumtx",&cosewsumtx,"cosewsumtx/F"); // NuS Sandbox
317  ncTree->Branch("cosewsumty",&cosewsumty,"cosewsumty/F"); // NuS Sandbox
318  ncTree->Branch("angsumtx",&angsumtx,"angsumtx/F"); // NuS Sandbox
319  ncTree->Branch("angsumty",&angsumty,"angsumty/F"); // NuS Sandbox
320  ncTree->Branch("angewsumtx",&angewsumtx,"angewsumtx/F"); // NuS Sandbox
321  ncTree->Branch("angewsumty",&angewsumty,"angewsumty/F"); // NuS Sandbox
322 
323  ncTree->Branch("starttop",&starttop,"starttop/F"); // NueCosRej
324  ncTree->Branch("startbottom",&startbottom,"startbottom/F"); // NueCosRej
325  ncTree->Branch("startfront",&startfront,"startfront/F"); // NueCosRej
326  ncTree->Branch("startback",&startback,"startback/F"); // NueCosRej
327  ncTree->Branch("startwest",&startwest,"startwest/F"); // NueCosRej
328  ncTree->Branch("starteast",&starteast,"starteast/F"); // NueCosRej
329  ncTree->Branch("stoptop",&stoptop,"stoptop/F"); // NueCosRej
330  ncTree->Branch("stopbottom",&stopbottom,"stopbottom/F"); // NueCosRej
331  ncTree->Branch("stopfront",&stopfront,"stopfront/F"); // NueCosRej
332  ncTree->Branch("stopback",&stopback,"stopback/F"); // NueCosRej
333  ncTree->Branch("stopwest",&stopwest,"stopwest/F"); // NueCosRej
334  ncTree->Branch("stopeast",&stopeast,"stopeast/F"); // NueCosRej
335  ncTree->Branch("cosdang",&cosdang,"cosdang/F"); // NueCosRej
336  ncTree->Branch("vtxdoca",&vtxdoca,"vtxdoca/F"); // NueCosRej
337  ncTree->Branch("prongmaxx",&prongmaxx,"prongmaxx/F"); // NueCosRej
338  ncTree->Branch("prongmaxy",&prongmaxy,"prongmaxy/F"); // NueCosRej
339  ncTree->Branch("prongmaxz",&prongmaxz,"prongmaxz/F"); // NueCosRej
340  ncTree->Branch("prongminx",&prongminx,"prongminx/F"); // NueCosRej
341  ncTree->Branch("prongminy",&prongminy,"prongminy/F"); // NueCosRej
342  ncTree->Branch("prongminz",&prongminz,"prongminz/F"); // NueCosRej
343  ncTree->Branch("sparsenessasymm",&sparsenessasymm,"sparsenessasymm/F"); // NueCosRej
344  ncTree->Branch("hitsperplaneasymm",&hitsperplaneasymm,"hitsperplaneasymm/F"); // NueCosRej
345  ncTree->Branch("musliceidx",&musliceidx,"musliceidx/F"); // NueCosRej
346  ncTree->Branch("muanglediff",&muanglediff,"muanglediff/F"); // NueCosRej
347  ncTree->Branch("mutimediff",&mutimediff,"mutimediff/F"); // NueCosRej
348  ncTree->Branch("muclosestapproach",&muclosestapproach,"muclosestapproach/F"); // NueCosRej
349  //ncTree->Branch("partptp",&partptp,"partptp/F"); // NueCosRej
350  ncTree->Branch("pngptp",&pngptp,"pngptp/F"); // NueCosRej
351 
352  ncTree->Branch("numupid",&numupid,"numupid/F");
353 
354  ncTree->Branch("nueid",&nueid,"nueid/F"); // CVN
355  ncTree->Branch("numuid",&numuid,"numuid/F"); // CVN
356  ncTree->Branch("nutauid",&nutauid,"nutauid/F"); // CVN
357 
358  ncTree->Branch("rempid",&rempid,"rempid/F"); // RemID
359  ncTree->Branch("remlen",&remlen,"remlen/F"); // RemID
360 
361  ncTree->Branch("ncalhit",&ncalhit,"ncalhit/F"); // Slice Branch
362  //ncTree->Branch("nmiphit",&nmiphit,"nmiphit/F"); // Slice Branch
363  ncTree->Branch("ncontplanes",&ncontplanes,"ncontplanes/F"); // Slice Branch
364  ncTree->Branch("starttime",&starttime,"starttime/F"); // Slice Branch
365  ncTree->Branch("endtime",&endtime,"endtime/F"); // Slice Branch
366  ncTree->Branch("meantime",&meantime,"meantime/F"); // Slice Branch
367  ncTree->Branch("meanposX",&meanposX,"meanposX/F"); // Slice Branch
368  ncTree->Branch("meanposY",&meanposY,"meanposY/F"); // Slice Branch
369  ncTree->Branch("meanposZ",&meanposZ,"meanposZ/F"); // Slice Branch
370 
371  //ncTree->Branch("shwnhit",&shwnhit,"shwnhit/F"); // Shower Branch
372  //ncTree->Branch("shwnhitx",&shwnhitx,"shwnhitx/F"); // Shower Branch
373  //ncTree->Branch("shwnhity",&shwnhity,"shwnhity/F"); // Shower Branch
374  ncTree->Branch("shwnplane",&shwnplane,"shwnplane/F"); // Shower Branch
375  ncTree->Branch("shwmaxplanecont",&shwmaxplanecont,"shwmaxplanecont/F"); // Shower Branch
376  ncTree->Branch("shwmaxplanegap",&shwmaxplanegap,"shwmaxplanegap/F"); // Shower Branch
377  //ncTree->Branch("shwcalE",&shwcalE,"shwcalE/F"); // Shower Branch
378  ncTree->Branch("shwstartX",&shwstartX,"shwstartX/F"); // Shower Branch
379  ncTree->Branch("shwstartY",&shwstartY,"shwstartY/F"); // Shower Branch
380  ncTree->Branch("shwstartZ",&shwstartZ,"shwstartZ/F"); // Shower Branch
381  ncTree->Branch("shwdirX",&shwdirX,"shwdirX/F"); // Shower Branch
382  //ncTree->Branch("shwdirY",&shwdirY,"shwdirY/F"); // Shower Branch
383  ncTree->Branch("shwdirZ",&shwdirZ,"shwdirZ/F"); // Shower Branch
384  //ncTree->Branch("shwlen",&shwlen,"shwlen/F"); // Shower Branch
385  //ncTree->Branch("shwwwidth",&shwwwidth,"shwwwidth/F"); // Shower Branch
386  ncTree->Branch("shwNplaneX",&shwNplaneX,"shwNplaneX/F"); // Shower Branch
387  ncTree->Branch("shwNplaneY",&shwNplaneY,"shwNplaneY/F"); // Shower Branch
388  //ncTree->Branch("shwGap",&shwGap,"shwGap/F"); // Shower Branch
389  ncTree->Branch("shwstopX",&shwstopX,"shwstopX/F"); // Shower Branch
390  ncTree->Branch("shwstopY",&shwstopY,"shwstopY/F"); // Shower Branch
391  ncTree->Branch("shwstopZ",&shwstopZ,"shwstopZ/F"); // Shower Branch
392  //ncTree->Branch("nshwlid",&nshwlid,"nshwlid/F"); // Shower Branch
393 
394  ncTree->Branch("vtxTime",&vtxTime,"vtxTime/F"); // Vertex Branch
395  ncTree->Branch("vtxX",&vtxX,"vtxX/F"); // Vertex Branch
396  ncTree->Branch("vtxY",&vtxY,"vtxY/F"); // Vertex Branch
397  ncTree->Branch("vtxZ",&vtxZ,"vtxZ/F"); // Vertex Branch
398  ncTree->Branch("vtxpngNhit",&vtxpngNhit,"vtxpngNhit/F"); // Vertex Branch Prong Hits
399  ncTree->Branch("vtxpngNhitX",&vtxpngNhitX,"vtxpngNhitX/F"); // Vertex Branch Prong Hits X View
400  ncTree->Branch("vtxpngNhitY",&vtxpngNhitY,"vtxpngNhitY/F"); // Vertex Branch Prong Hits Y View
401 
402  ncTree->Branch("ncid",&ncid,"ncid/F"); // CVN SY 1
403  ncTree->Branch("cosmicid",&cosmicid,"cosmicid/F"); // CVN SY 1
404  ncTree->Branch("partptp",&partptp,"partptp/F"); // NueCosRej SY 2
405  ncTree->Branch("shwnhit",&shwnhit,"shwnhit/F"); // Shower Branch SY 3
406  ncTree->Branch("shwnhitx",&shwnhitx,"shwnhitx/F"); // Shower Branch SY 4
407  ncTree->Branch("shwnhity",&shwnhity,"shwnhity/F"); // Shower Branch SY 5
408  ncTree->Branch("shwxminusy",&shwxminusy,"shwxminusy/F"); // Shower Branch SY 6
409  ncTree->Branch("shwxplusy",&shwxplusy,"shwxplusy/F"); // Shower Branch SY 7
410  ncTree->Branch("shwxovery",&shwxovery,"shwxovery/F"); // Shower Branch SY 8
411  ncTree->Branch("shwcalE",&shwcalE,"shwcalE/F"); // Shower Branch SY 9
412  ncTree->Branch("shwdirY",&shwdirY,"shwdirY/F"); // Shower Branch SY 10
413  ncTree->Branch("shwlen",&shwlen,"shwlen/F"); // Shower Branch SY 11
414  ncTree->Branch("shwwwidth",&shwwwidth,"shwwwidth/F"); // Shower Branch SY 12
415  ncTree->Branch("shwGap",&shwGap,"shwGap/F"); // Shower Branch SY 13
416  ncTree->Branch("nshwlid",&nshwlid,"nshwlid/F"); // Shower Branch SY 14
417  ncTree->Branch("nmiphit",&nmiphit,"nmiphit/F"); // Slice Branch SY 15
418 
419  ncTree->Branch("anglekal",&anglekal,"anglekal/F"); // Kirk 1
420  ncTree->Branch("dirFY",&dirFY,"dirFY/F"); // Kirk 2
421  ncTree->Branch("boxmaxFY",&boxmaxFY,"boxmaxFY/F"); // Kirk 3
422  ncTree->Branch("kalnhit",&kalnhit,"kalnhit/F"); // Kirk 4
423  ncTree->Branch("kallen",&kallen,"kallen/F"); // Kirk 5
424  ncTree->Branch("kalfwdcell",&kalfwdcell,"kalfwdcell/F"); // Kirk 6
425  ncTree->Branch("kalbakcell",&kalbakcell,"kalbakcell/F"); // Kirk 6
426  ncTree->Branch("scatt",&scatt,"scatt/F"); // Kirk 7
427  ncTree->Branch("nhit",&nhit,"nhit/F"); // Kirk 8
428  ncTree->Branch("energy",&energy,"energy/F"); // Kirk 9
429  ncTree->Branch("boxminFY",&boxminFY,"boxminFY/F"); // Kirk 10
430  ncTree->Branch("nkal",&nkal,"nkal/F"); // Kirk 11
431 
432  // numu tree
433  muTree->Branch("Run",&Run,"Run/I"); // Ture Info
434  muTree->Branch("SubRun",&SubRun,"SubRun/I"); // Ture Info
435  muTree->Branch("Evt",&Evt,"Evt/I"); // Ture Info
436  muTree->Branch("SubEvt",&SubEvt,"SubEvt/I"); // Ture Info
437  muTree->Branch("IsCC",&IsCC,"IsCC/I"); // Ture Info
438 
439  muTree->Branch("sumtx",&sumtx,"sumtx/F"); // NuS Sandbox
440  muTree->Branch("sumty",&sumty,"sumty/F"); // NuS Sandbox
441  muTree->Branch("ewsumtx",&ewsumtx,"ewsumtx/F"); // NuS Sandbox
442  muTree->Branch("ewsumty",&ewsumty,"ewsumty/F"); // NuS Sandbox
443  muTree->Branch("cossumtx",&cossumtx,"cossumtx/F"); // NuS Sandbox
444  muTree->Branch("cossumty",&cossumty,"cossumty/F"); // NuS Sandbox
445  muTree->Branch("cosewsumtx",&cosewsumtx,"cosewsumtx/F"); // NuS Sandbox
446  muTree->Branch("cosewsumty",&cosewsumty,"cosewsumty/F"); // NuS Sandbox
447  muTree->Branch("angsumtx",&angsumtx,"angsumtx/F"); // NuS Sandbox
448  muTree->Branch("angsumty",&angsumty,"angsumty/F"); // NuS Sandbox
449  muTree->Branch("angewsumtx",&angewsumtx,"angewsumtx/F"); // NuS Sandbox
450  muTree->Branch("angewsumty",&angewsumty,"angewsumty/F"); // NuS Sandbox
451 
452  muTree->Branch("starttop",&starttop,"starttop/F"); // NueCosRej
453  muTree->Branch("startbottom",&startbottom,"startbottom/F"); // NueCosRej
454  muTree->Branch("startfront",&startfront,"startfront/F"); // NueCosRej
455  muTree->Branch("startback",&startback,"startback/F"); // NueCosRej
456  muTree->Branch("startwest",&startwest,"startwest/F"); // NueCosRej
457  muTree->Branch("starteast",&starteast,"starteast/F"); // NueCosRej
458  muTree->Branch("stoptop",&stoptop,"stoptop/F"); // NueCosRej
459  muTree->Branch("stopbottom",&stopbottom,"stopbottom/F"); // NueCosRej
460  muTree->Branch("stopfront",&stopfront,"stopfront/F"); // NueCosRej
461  muTree->Branch("stopback",&stopback,"stopback/F"); // NueCosRej
462  muTree->Branch("stopwest",&stopwest,"stopwest/F"); // NueCosRej
463  muTree->Branch("stopeast",&stopeast,"stopeast/F"); // NueCosRej
464  muTree->Branch("cosdang",&cosdang,"cosdang/F"); // NueCosRej
465  muTree->Branch("vtxdoca",&vtxdoca,"vtxdoca/F"); // NueCosRej
466  muTree->Branch("prongmaxx",&prongmaxx,"prongmaxx/F"); // NueCosRej
467  muTree->Branch("prongmaxy",&prongmaxy,"prongmaxy/F"); // NueCosRej
468  muTree->Branch("prongmaxz",&prongmaxz,"prongmaxz/F"); // NueCosRej
469  muTree->Branch("prongminx",&prongminx,"prongminx/F"); // NueCosRej
470  muTree->Branch("prongminy",&prongminy,"prongminy/F"); // NueCosRej
471  muTree->Branch("prongminz",&prongminz,"prongminz/F"); // NueCosRej
472  muTree->Branch("sparsenessasymm",&sparsenessasymm,"sparsenessasymm/F"); // NueCosRej
473  muTree->Branch("hitsperplaneasymm",&hitsperplaneasymm,"hitsperplaneasymm/F"); // NueCosRej
474  muTree->Branch("hitsperplane",&hitsperplane,"hitsperplane/F"); // NueCosRej
475  muTree->Branch("musliceidx",&musliceidx,"musliceidx/F"); // NueCosRej
476  muTree->Branch("muanglediff",&muanglediff,"muanglediff/F"); // NueCosRej
477  muTree->Branch("mutimediff",&mutimediff,"mutimediff/F"); // NueCosRej
478  muTree->Branch("muclosestapproach",&muclosestapproach,"muclosestapproach/F"); // NueCosRej
479  //muTree->Branch("partptp",&partptp,"partptp/F"); // NueCosRej
480  muTree->Branch("pngptp",&pngptp,"pngptp/F"); // NueCosRej
481 
482 
483  muTree->Branch("nueid",&nueid,"nueid/F"); // CVN
484  muTree->Branch("numuid",&numuid,"numuid/F"); // CVN
485  muTree->Branch("nutauid",&nutauid,"nutauid/F"); // CVN
486 
487  muTree->Branch("numupid",&numupid,"numupid/F");
488 
489  muTree->Branch("rempid",&rempid,"rempid/F"); // RemID
490  muTree->Branch("remlen",&remlen,"remlen/F"); // RemID
491 
492  muTree->Branch("ncalhit",&ncalhit,"ncalhit/F"); // Slice Branch
493  //muTree->Branch("nmiphit",&nmiphit,"nmiphit/F"); // Slice Branch
494  muTree->Branch("ncontplanes",&ncontplanes,"ncontplanes/F"); // Slice Branch
495  muTree->Branch("starttime",&starttime,"starttime/F"); // Slice Branch
496  muTree->Branch("endtime",&endtime,"endtime/F"); // Slice Branch
497  muTree->Branch("meantime",&meantime,"meantime/F"); // Slice Branch
498  muTree->Branch("meanposX",&meanposX,"meanposX/F"); // Slice Branch
499  muTree->Branch("meanposY",&meanposY,"meanposY/F"); // Slice Branch
500  muTree->Branch("meanposZ",&meanposZ,"meanposZ/F"); // Slice Branch
501 
502  //muTree->Branch("shwnhit",&shwnhit,"shwnhit/F"); // Shower Branch
503  //muTree->Branch("shwnhitx",&shwnhitx,"shwnhitx/F"); // Shower Branch
504  //muTree->Branch("shwnhity",&shwnhity,"shwnhity/F"); // Shower Branch
505  muTree->Branch("shwnplane",&shwnplane,"shwnplane/F"); // Shower Branch
506  muTree->Branch("shwmaxplanecont",&shwmaxplanecont,"shwmaxplanecont/F"); // Shower Branch
507  muTree->Branch("shwmaxplanegap",&shwmaxplanegap,"shwmaxplanegap/F"); // Shower Branch
508  //muTree->Branch("shwcalE",&shwcalE,"shwcalE/F"); // Shower Branch
509  muTree->Branch("shwstartX",&shwstartX,"shwstartX/F"); // Shower Branch
510  muTree->Branch("shwstartY",&shwstartY,"shwstartY/F"); // Shower Branch
511  muTree->Branch("shwstartZ",&shwstartZ,"shwstartZ/F"); // Shower Branch
512  muTree->Branch("shwdirX",&shwdirX,"shwdirX/F"); // Shower Branch
513  //muTree->Branch("shwdirY",&shwdirY,"shwdirY/F"); // Shower Branch
514  muTree->Branch("shwdirZ",&shwdirZ,"shwdirZ/F"); // Shower Branch
515  //muTree->Branch("shwlen",&shwlen,"shwlen/F"); // Shower Branch
516  //muTree->Branch("shwwwidth",&shwwwidth,"shwwwidth/F"); // Shower Branch
517  muTree->Branch("shwNplaneX",&shwNplaneX,"shwNplaneX/F"); // Shower Branch
518  muTree->Branch("shwNplaneY",&shwNplaneY,"shwNplaneY/F"); // Shower Branch
519  //muTree->Branch("shwGap",&shwGap,"shwGap/F"); // Shower Branch
520  muTree->Branch("shwstopX",&shwstopX,"shwstopX/F"); // Shower Branch
521  muTree->Branch("shwstopY",&shwstopY,"shwstopY/F"); // Shower Branch
522  muTree->Branch("shwstopZ",&shwstopZ,"shwstopZ/F"); // Shower Branch
523  //muTree->Branch("nshwlid",&nshwlid,"nshwlid/F"); // Shower Branch
524 
525  muTree->Branch("vtxTime",&vtxTime,"vtxTime/F"); // Vertex Branch
526  muTree->Branch("vtxX",&vtxX,"vtxX/F"); // Vertex Branch
527  muTree->Branch("vtxY",&vtxY,"vtxY/F"); // Vertex Branch
528  muTree->Branch("vtxZ",&vtxZ,"vtxZ/F"); // Vertex Branch
529  muTree->Branch("vtxpngNhit",&vtxpngNhit,"vtxpngNhit/F"); // Vertex Branch Prong Hits
530  muTree->Branch("vtxpngNhitX",&vtxpngNhitX,"vtxpngNhitX/F"); // Vertex Branch Prong Hits X View
531  muTree->Branch("vtxpngNhitY",&vtxpngNhitY,"vtxpngNhitY/F"); // Vertex Branch Prong Hits Y View
532 
533  muTree->Branch("ncid",&ncid,"ncid/F"); // CVN SY 1
534  muTree->Branch("cosmicid",&cosmicid,"cosmicid/F"); // CVN SY 1
535  muTree->Branch("partptp",&partptp,"partptp/F"); // NueCosRej SY 2
536  muTree->Branch("shwnhit",&shwnhit,"shwnhit/F"); // Shower Branch SY 3
537  muTree->Branch("shwnhitx",&shwnhitx,"shwnhitx/F"); // Shower Branch SY 4
538  muTree->Branch("shwnhity",&shwnhity,"shwnhity/F"); // Shower Branch SY 5
539  muTree->Branch("shwxminusy",&shwxminusy,"shwxminusy/F"); // Shower Branch SY 6
540  muTree->Branch("shwxplusy",&shwxplusy,"shwxplusy/F"); // Shower Branch SY 7
541  muTree->Branch("shwxovery",&shwxovery,"shwxovery/F"); // Shower Branch SY 8
542  muTree->Branch("shwcalE",&shwcalE,"shwcalE/F"); // Shower Branch SY 9
543  muTree->Branch("shwdirY",&shwdirY,"shwdirY/F"); // Shower Branch SY 10
544  muTree->Branch("shwlen",&shwlen,"shwlen/F"); // Shower Branch SY 11
545  muTree->Branch("shwwwidth",&shwwwidth,"shwwwidth/F"); // Shower Branch SY 12
546  ncTree->Branch("shwGap",&shwGap,"shwGap/F"); // Shower Branch SY 13
547  muTree->Branch("nshwlid",&nshwlid,"nshwlid/F"); // Shower Branch SY 14
548  muTree->Branch("nmiphit",&nmiphit,"nmiphit/F"); // Slice Branch SY 15
549 
550  muTree->Branch("anglekal",&anglekal,"anglekal/F"); // Kirk 1
551  muTree->Branch("dirFY",&dirFY,"dirFY/F"); // Kirk 2
552  muTree->Branch("boxmaxFY",&boxmaxFY,"boxmaxFY/F"); // Krik 3
553  muTree->Branch("kalnhit",&kalnhit,"kalnhit/F"); // Kirk 4
554  muTree->Branch("kallen",&kallen,"kallen/F"); // Kirk 5
555  muTree->Branch("kalfwdcell",&kalfwdcell,"kalfwdcell/F"); // Kirk 6
556  muTree->Branch("kalbakcell",&kalbakcell,"kalbakcell/F"); // Kirk 6
557  muTree->Branch("scatt",&scatt,"scatt/F"); // Kirk 7
558  muTree->Branch("nhit",&nhit,"nhit/F"); // Kirk 8
559  muTree->Branch("energy",&energy,"energy/F"); // Kirk 9
560  muTree->Branch("boxminFY",&boxminFY,"boxminFY/F"); // Kirk 10
561  muTree->Branch("nkal",&nkal,"nkal/F"); // Krik 11
562 
563  // nue tree
564  neTree->Branch("Run",&Run,"Run/I"); // Ture Info
565  neTree->Branch("SubRun",&SubRun,"SubRun/I"); // Ture Info
566  neTree->Branch("Evt",&Evt,"Evt/I"); // Ture Info
567  neTree->Branch("SubEvt",&SubEvt,"SubEvt/I"); // Ture Info
568  neTree->Branch("IsCC",&IsCC,"IsCC/I"); // Ture Info
569 
570  neTree->Branch("sumtx",&sumtx,"sumtx/F"); // NuS Sandbox
571  neTree->Branch("sumty",&sumty,"sumty/F"); // NuS Sandbox
572  neTree->Branch("ewsumtx",&ewsumtx,"ewsumtx/F"); // NuS Sandbox
573  neTree->Branch("ewsumty",&ewsumty,"ewsumty/F"); // NuS Sandbox
574  neTree->Branch("cossumtx",&cossumtx,"cossumtx/F"); // NuS Sandbox
575  neTree->Branch("cossumty",&cossumty,"cossumty/F"); // NuS Sandbox
576  neTree->Branch("cosewsumtx",&cosewsumtx,"cosewsumtx/F"); // NuS Sandbox
577  neTree->Branch("cosewsumty",&cosewsumty,"cosewsumty/F"); // NuS Sandbox
578  neTree->Branch("angsumtx",&angsumtx,"angsumtx/F"); // NuS Sandbox
579  neTree->Branch("angsumty",&angsumty,"angsumty/F"); // NuS Sandbox
580  neTree->Branch("angewsumtx",&angewsumtx,"angewsumtx/F"); // NuS Sandbox
581  neTree->Branch("angewsumty",&angewsumty,"angewsumty/F"); // NuS Sandbox
582 
583  neTree->Branch("starttop",&starttop,"starttop/F"); // NueCosRej
584  neTree->Branch("startbottom",&startbottom,"startbottom/F"); // NueCosRej
585  neTree->Branch("startfront",&startfront,"startfront/F"); // NueCosRej
586  neTree->Branch("startback",&startback,"startback/F"); // NueCosRej
587  neTree->Branch("startwest",&startwest,"startwest/F"); // NueCosRej
588  neTree->Branch("starteast",&starteast,"starteast/F"); // NueCosRej
589  neTree->Branch("stoptop",&stoptop,"stoptop/F"); // NueCosRej
590  neTree->Branch("stopbottom",&stopbottom,"stopbottom/F"); // NueCosRej
591  neTree->Branch("stopfront",&stopfront,"stopfront/F"); // NueCosRej
592  neTree->Branch("stopback",&stopback,"stopback/F"); // NueCosRej
593  neTree->Branch("stopwest",&stopwest,"stopwest/F"); // NueCosRej
594  neTree->Branch("stopeast",&stopeast,"stopeast/F"); // NueCosRej
595  neTree->Branch("cosdang",&cosdang,"cosdang/F"); // NueCosRej
596  neTree->Branch("vtxdoca",&vtxdoca,"vtxdoca/F"); // NueCosRej
597  neTree->Branch("prongmaxx",&prongmaxx,"prongmaxx/F"); // NueCosRej
598  neTree->Branch("prongmaxy",&prongmaxy,"prongmaxy/F"); // NueCosRej
599  neTree->Branch("prongmaxz",&prongmaxz,"prongmaxz/F"); // NueCosRej
600  neTree->Branch("prongminx",&prongminx,"prongminx/F"); // NueCosRej
601  neTree->Branch("prongminy",&prongminy,"prongminy/F"); // NueCosRej
602  neTree->Branch("prongminz",&prongminz,"prongminz/F"); // NueCosRej
603  neTree->Branch("sparsenessasymm",&sparsenessasymm,"sparsenessasymm/F"); // NueCosRej
604  neTree->Branch("hitsperplaneasymm",&hitsperplaneasymm,"hitsperplaneasymm/F"); // NueCosRej
605  neTree->Branch("musliceidx",&musliceidx,"musliceidx/F"); // NueCosRej
606  neTree->Branch("muanglediff",&muanglediff,"muanglediff/F"); // NueCosRej
607  neTree->Branch("mutimediff",&mutimediff,"mutimediff/F"); // NueCosRej
608  neTree->Branch("muclosestapproach",&muclosestapproach,"muclosestapproach/F"); // NueCosRej
609  //neTree->Branch("partptp",&partptp,"partptp/F"); // NueCosRej
610  neTree->Branch("pngptp",&pngptp,"pngptp/F"); // NueCosRej
611 
612 
613  neTree->Branch("nueid",&nueid,"nueid/F"); // CVN
614  neTree->Branch("numuid",&numuid,"numuid/F"); // CVN
615  neTree->Branch("nutauid",&nutauid,"nutauid/F"); // CVN
616 
617  neTree->Branch("numupid",&numupid,"numupid/F");
618 
619  neTree->Branch("rempid",&rempid,"rempid/F"); // RemID
620  neTree->Branch("remlen",&remlen,"remlen/F"); // RemID
621 
622  neTree->Branch("ncalhit",&ncalhit,"ncalhit/F"); // Slice Branch
623  //neTree->Branch("nmiphit",&nmiphit,"nmiphit/F"); // Slice Branch
624  neTree->Branch("ncontplanes",&ncontplanes,"ncontplanes/F"); // Slice Branch
625  neTree->Branch("starttime",&starttime,"starttime/F"); // Slice Branch
626  neTree->Branch("endtime",&endtime,"endtime/F"); // Slice Branch
627  neTree->Branch("meantime",&meantime,"meantime/F"); // Slice Branch
628  neTree->Branch("meanposX",&meanposX,"meanposX/F"); // Slice Branch
629  neTree->Branch("meanposY",&meanposY,"meanposY/F"); // Slice Branch
630  neTree->Branch("meanposZ",&meanposZ,"meanposZ/F"); // Slice Branch
631 
632  //neTree->Branch("shwnhit",&shwnhit,"shwnhit/F"); // Shower Branch
633  //neTree->Branch("shwnhitx",&shwnhitx,"shwnhitx/F"); // Shower Branch
634  //neTree->Branch("shwnhity",&shwnhity,"shwnhity/F"); // Shower Branch
635  neTree->Branch("shwnplane",&shwnplane,"shwnplane/F"); // Shower Branch
636  neTree->Branch("shwmaxplanecont",&shwmaxplanecont,"shwmaxplanecont/F"); // Shower Branch
637  neTree->Branch("shwmaxplanegap",&shwmaxplanegap,"shwmaxplanegap/F"); // Shower Branch
638  //neTree->Branch("shwcalE",&shwcalE,"shwcalE/F"); // Shower Branch
639  neTree->Branch("shwstartX",&shwstartX,"shwstartX/F"); // Shower Branch
640  neTree->Branch("shwstartY",&shwstartY,"shwstartY/F"); // Shower Branch
641  neTree->Branch("shwstartZ",&shwstartZ,"shwstartZ/F"); // Shower Branch
642  neTree->Branch("shwdirX",&shwdirX,"shwdirX/F"); // Shower Branch
643  //neTree->Branch("shwdirY",&shwdirY,"shwdirY/F"); // Shower Branch
644  neTree->Branch("shwdirZ",&shwdirZ,"shwdirZ/F"); // Shower Branch
645  //neTree->Branch("shwlen",&shwlen,"shwlen/F"); // Shower Branch
646  //neTree->Branch("shwwwidth",&shwwwidth,"shwwwidth/F"); // Shower Branch
647  neTree->Branch("shwNplaneX",&shwNplaneX,"shwNplaneX/F"); // Shower Branch
648  neTree->Branch("shwNplaneY",&shwNplaneY,"shwNplaneY/F"); // Shower Branch
649  //neTree->Branch("shwGap",&shwGap,"shwGap/F"); // Shower Branch
650  neTree->Branch("shwstopX",&shwstopX,"shwstopX/F"); // Shower Branch
651  neTree->Branch("shwstopY",&shwstopY,"shwstopY/F"); // Shower Branch
652  neTree->Branch("shwstopZ",&shwstopZ,"shwstopZ/F"); // Shower Branch
653  //neTree->Branch("nshwlid",&nshwlid,"nshwlid/F"); // Shower Branch
654 
655  neTree->Branch("vtxTime",&vtxTime,"vtxTime/F"); // Vertex Branch
656  neTree->Branch("vtxX",&vtxX,"vtxX/F"); // Vertex Branch
657  neTree->Branch("vtxY",&vtxY,"vtxY/F"); // Vertex Branch
658  neTree->Branch("vtxZ",&vtxZ,"vtxZ/F"); // Vertex Branch
659  neTree->Branch("vtxpngNhit",&vtxpngNhit,"vtxpngNhit/F"); // Vertex Branch Prong Hits
660  neTree->Branch("vtxpngNhitX",&vtxpngNhitX,"vtxpngNhitX/F"); // Vertex Branch Prong Hits X View
661  neTree->Branch("vtxpngNhitY",&vtxpngNhitY,"vtxpngNhitY/F"); // Vertex Branch Prong Hits Y View
662 
663  neTree->Branch("ncid",&ncid,"ncid/F"); // CVN SY 1
664  neTree->Branch("cosmicid",&cosmicid,"cosmicid/F"); // CVN SY 1
665  neTree->Branch("partptp",&partptp,"partptp/F"); // NueCosRej SY 2
666  neTree->Branch("shwnhit",&shwnhit,"shwnhit/F"); // Shower Branch SY 3
667  neTree->Branch("shwnhitx",&shwnhitx,"shwnhitx/F"); // Shower Branch SY 4
668  neTree->Branch("shwnhity",&shwnhity,"shwnhity/F"); // Shower Branch SY 5
669  neTree->Branch("shwxminusy",&shwxminusy,"shwxminusy/F"); // Shower Branch SY 6
670  neTree->Branch("shwxplusy",&shwxplusy,"shwxplusy/F"); // Shower Branch SY 7
671  neTree->Branch("shwxovery",&shwxovery,"shwxovery/F"); // Shower Branch SY 8
672  neTree->Branch("shwcalE",&shwcalE,"shwcalE/F"); // Shower Branch SY 9
673  neTree->Branch("shwdirY",&shwdirY,"shwdirY/F"); // Shower Branch SY 10
674  neTree->Branch("shwlen",&shwlen,"shwlen/F"); // Shower Branch SY 11
675  neTree->Branch("shwwwidth",&shwwwidth,"shwwwidth/F"); // Shower Branch SY 12
676  neTree->Branch("shwGap",&shwGap,"shwGap/F"); // Shower Branch SY 13
677  neTree->Branch("nshwlid",&nshwlid,"nshwlid/F"); // Shower Branch SY 14
678  neTree->Branch("nmiphit",&nmiphit,"nmiphit/F"); // Slice Branch SY 15
679 
680  neTree->Branch("anglekal",&anglekal,"anglekal/F"); // Kirk 1
681  neTree->Branch("dirFY",&dirFY,"dirFY/F"); // Kirk 2
682  neTree->Branch("boxmaxFY",&boxmaxFY,"boxmaxFY/F"); // Kirk 3
683  neTree->Branch("kalnhit",&kalnhit,"kalnhit/F"); // Kirk 4
684  neTree->Branch("kallen",&kallen,"kallen/F"); // Kirk 5
685  neTree->Branch("kalfwdcell",&kalfwdcell,"kalfwdcell/F"); // Kirk 6
686  neTree->Branch("kalbakcell",&kalbakcell,"kalbakcell/F"); // Kirk 6
687  neTree->Branch("scatt",&scatt,"scatt/F"); // Kirk 7
688  neTree->Branch("nhit",&nhit,"nhit/F"); // Kirk 8
689  neTree->Branch("energy",&energy,"energy/F"); // Kirk 9
690  neTree->Branch("boxminFY",&boxminFY,"boxminFY/F"); // Kirk 10
691  neTree->Branch("nkal",&nkal,"nkal/F"); // Kirk 11
692 
693  //recTreecos->SetBranchAddress("rec", &recTreeObject);
694  //recTreenon->SetBranchAddress("rec", &recTreeObject);
695 
696  IFileSource* nonswap=loadernc.WildcardOrSAMQuery(fnamenc);
697  int AllNon = nonswap->NFiles();
698  //std::cout<<"NUMBER OF FILES: "<<Nfiles<<std::endl;
699 
700  Progress* prog = 0;
701  TFile* nonfile;
702  int NumNon = -1;
703  while(TFile* nonfile =(TFile*)nonswap->GetNextFile()){ //Straring to loop over files
704  ++NumNon;
705  std::cout<<"******************************NonSwap File NUMBER: "<<NumNon<<std::endl;
706  if(AllNon >= 0 && !prog) prog = new Progress(TString::Format("Filling tree from %d files", AllNon).Data());
707  loadernc.HandleFile(nonfile, AllNon == 1 ? prog : 0);
708  if(AllNon > 1 && prog) prog->SetProgress((NumNon+1.)/AllNon);
709 
710  TTree *recTreenon = (TTree*)nonfile->Get("recTree");
711  caf::StandardRecord* recTreeObject = 0;
712  recTreenon->SetBranchAddress("rec", &recTreeObject);
713 
714  // Turn off all the branches first
715  recTreenon->SetBranchStatus("*",0);
716  // Turn on the useful branches from the beam file
717  recTreenon->SetBranchStatus("hdr.run",1); // Ture Info
718  recTreenon->SetBranchStatus("hdr.subrun",1); // Ture Info
719  recTreenon->SetBranchStatus("hdr.evt",1); // Ture Info
720  recTreenon->SetBranchStatus("hdr.subevt",1); // Ture Info
721 
722  recTreenon->SetBranchStatus("mc.nnu",1); // Ture Info
723  recTreenon->SetBranchStatus("mc.nu",1); // Ture Info
724  recTreenon->SetBranchStatus("mc.nu.iscc",1); // Ture Info
725  recTreenon->SetBranchStatus("mc.nu.pdg",1); // Ture Info
726  recTreenon->SetBranchStatus("trk.ncosmic",1); // Ture Info
727 
728  recTreenon->SetBranchStatus("sel.nuecosrej.starttop",1); // NueCosRej
729  recTreenon->SetBranchStatus("sel.nuecosrej.startbottom",1); // NueCosRej
730  recTreenon->SetBranchStatus("sel.nuecosrej.startfront",1); // NueCosRej
731  recTreenon->SetBranchStatus("sel.nuecosrej.startback",1); // NueCosRej
732  recTreenon->SetBranchStatus("sel.nuecosrej.startwest",1); // NueCosRej
733  recTreenon->SetBranchStatus("sel.nuecosrej.starteast",1); // NueCosRej
734  recTreenon->SetBranchStatus("sel.nuecosrej.stoptop",1); // NueCosRej
735  recTreenon->SetBranchStatus("sel.nuecosrej.stopbottom",1); // NueCosRej
736  recTreenon->SetBranchStatus("sel.nuecosrej.stopfront",1); // NueCosRej
737  recTreenon->SetBranchStatus("sel.nuecosrej.stopback",1); // NueCosRej
738  recTreenon->SetBranchStatus("sel.nuecosrej.stopwest",1); // NueCosRej
739  recTreenon->SetBranchStatus("sel.nuecosrej.stopeast",1); // NueCosRej
740  recTreenon->SetBranchStatus("sel.nuecosrej.cosdang",1); // NueCosRej
741  recTreenon->SetBranchStatus("sel.nuecosrej.vtxdoca",1); // NueCosRej
742  recTreenon->SetBranchStatus("sel.nuecosrej.prongmaxx",1); // NueCosRej
743  recTreenon->SetBranchStatus("sel.nuecosrej.prongmaxy",1); // NueCosRej
744  recTreenon->SetBranchStatus("sel.nuecosrej.prongmaxz",1); // NueCosRej
745  recTreenon->SetBranchStatus("sel.nuecosrej.prongminx",1); // NueCosRej
746  recTreenon->SetBranchStatus("sel.nuecosrej.prongminy",1); // NueCosRej
747  recTreenon->SetBranchStatus("sel.nuecosrej.prongminz",1); // NueCosRej
748  recTreenon->SetBranchStatus("sel.nuecosrej.sparsenessasymm",1); // NueCosRej
749  recTreenon->SetBranchStatus("sel.nuecosrej.hitsperplane",1); // NueCosRej ///////
750  recTreenon->SetBranchStatus("sel.nuecosrej.hitsperplaneasymm",1); // NueCosRej
751  recTreenon->SetBranchStatus("sel.nuecosrej.musliceidx",1); // NueCosRej
752  recTreenon->SetBranchStatus("sel.nuecosrej.muanglediff",1); // NueCosRej
753  recTreenon->SetBranchStatus("sel.nuecosrej.mutimediff",1); // NueCosRej
754  recTreenon->SetBranchStatus("sel.nuecosrej.muclosestapproach",1); // NueCosRej
755 
756  //recTreenon->SetBranchStatus("sel.nuecosrej.pngptp",1); // NueCosRej Shaokai 1
757  //recTreenon->SetBranchStatus("shw.shwlid.nhit",1); // Shower Branch Shaokai 2
758  //recTreenon->SetBranchStatus("shw.shwlid.nhitx",1); // Shower Branch Shaokai 3
759  //recTreenon->SetBranchStatus("shw.shwlid.nhity",1); // Shower Branch Shaokai 3
760  recTreenon->SetBranchStatus("shw.shwlid.nplane",1); // Shower Branch Shaokai 4
761  recTreenon->SetBranchStatus("shw.shwlid.maxplanecont",1); // Shower Branch Shaokai 5
762  recTreenon->SetBranchStatus("shw.shwlid.maxplanegap",1); // Shower Branch Shaokai 6
763 
764  recTreenon->SetBranchStatus("shw.shwlid.start.fX",1); // Shower Branch
765  recTreenon->SetBranchStatus("shw.shwlid.start.fY",1); // Shower Branch
766  recTreenon->SetBranchStatus("shw.shwlid.start.fZ",1); // Shower Branch
767  recTreenon->SetBranchStatus("shw.shwlid.dir.fX",1); // Shower Branch
768  recTreenon->SetBranchStatus("shw.shwlid.dir.fZ",1); // Shower Branch
769  recTreenon->SetBranchStatus("shw.shwlid.nplanex",1); // Shower Branch
770  recTreenon->SetBranchStatus("shw.shwlid.nplaney",1); // Shower Branch
771 
772  recTreenon->SetBranchStatus("shw.shwlid.stop.fX",1); // Shower Branch
773  recTreenon->SetBranchStatus("shw.shwlid.stop.fY",1); // Shower Branch
774  recTreenon->SetBranchStatus("shw.shwlid.stop.fZ",1); // Shower Branch
775 
776  //recTreenon->SetBranchStatus("shw.shwlid.gap",1); // Shower Branch
777 
778  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
779  recTreenon->SetBranchStatus("sel.elecid.shwlid.ismuon",1); //sel.elecid.shwlid[0].ismuon
780  recTreenon->SetBranchStatus("sel.cosrej.numucontpid",1);
781  //sr->sel.cosrej.numucontpid
782  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
783 
784  recTreenon->SetBranchStatus("sel.cvn.nueid",1); // CVN
785  recTreenon->SetBranchStatus("sel.cvn.numuid",1); // CVN
786  recTreenon->SetBranchStatus("sel.cvn.nutauid",1); // CVN
787 
788  recTreenon->SetBranchStatus("slc.nhit",1); // Slice Branch
789  //recTreenon->SetBranchStatus("slc.calhit",1); // Slice Branch
790 
791  recTreenon->SetBranchStatus("slc.ncontplanes",1); // Slice Branch
792  recTreenon->SetBranchStatus("slc.ncellsfromedge",1); // Slice Branch
793  recTreenon->SetBranchStatus("slc.starttime",1); // Slice Branch
794  recTreenon->SetBranchStatus("slc.endtime",1); // Slice Branch
795  recTreenon->SetBranchStatus("slc.meantime",1); // Slice Branch
796  recTreenon->SetBranchStatus("slc.meanpos.fX",1); // Slice Branch
797  recTreenon->SetBranchStatus("slc.meanpos.fY",1); // Slice Branch
798  recTreenon->SetBranchStatus("slc.meanpos.fZ",1); // Slice Branch
799 
800  recTreenon->SetBranchStatus("sand.nus.sumtx",1); // NuS Sandbox
801  recTreenon->SetBranchStatus("sand.nus.sumty",1); // NuS Sandbox
802  recTreenon->SetBranchStatus("sand.nus.ewsumtx",1); // NuS Sandbox
803  recTreenon->SetBranchStatus("sand.nus.ewsumty",1); // NuS Sandbox
804  recTreenon->SetBranchStatus("sand.nus.cossumtx",1); // NuS Sandbox
805  recTreenon->SetBranchStatus("sand.nus.cossumty",1); // NuS Sandbox
806  recTreenon->SetBranchStatus("sand.nus.cosewsumtx",1); // NuS Sandbox
807  recTreenon->SetBranchStatus("sand.nus.cosewsumty",1); // NuS Sandbox
808  recTreenon->SetBranchStatus("sand.nus.angsumtx",1); // NuS Sandbox
809  recTreenon->SetBranchStatus("sand.nus.angsumty",1); // NuS Sandbox
810  recTreenon->SetBranchStatus("sand.nus.angewsumtx",1); // NuS Sandbox
811  recTreenon->SetBranchStatus("sand.nus.angewsumty",1); // NuS Sandbox
812 
813  //float shwGap; // Shower Branch SY 13
814  recTreenon->SetBranchStatus("sel.remid.pid",1); // RemID
815  recTreenon->SetBranchStatus("sel.remid.len",1); // RemID
816 
817  recTreenon->SetBranchStatus("vtx.elastic.time",1); // Vertex Branch
818  recTreenon->SetBranchStatus("vtx.elastic.vtx.fX",1); // Vertex Branch
819  recTreenon->SetBranchStatus("vtx.elastic.vtx.fY",1); // Vertex Branch
820  recTreenon->SetBranchStatus("vtx.elastic.vtx.fZ",1); // Vertex Branch
821  //recTreenon->SetBranchStatus("vtx.elastic.png3d.nhit",1); // Vertex Branch
822  //recTreenon->SetBranchStatus("vtx.elastic.png3d.nhitx",1); // Vertex Branch
823  //recTreenon->SetBranchStatus("vtx.elastic.png3d.nhity",1); // Vertex Branch
824  recTreenon->SetBranchStatus("vtx.elastic.IsValid",1); // Vertex Branch
825 
826  recTreenon->SetBranchStatus("sel.cvn.ncid",1); // CVN SY 1
827  //recTreenon->SetBranchStatus("sel.cvn.output[14]",1); // CVN SY 1
828  recTreenon->SetBranchStatus("sel.cvn.output",1); // CVN SY 1
829  recTreenon->SetBranchStatus("sel.nuecosrej.partptp",1); // NueCosRej SY 2
830  recTreenon->SetBranchStatus("shw.shwlid.nhit",1); // Shower Branch SY 3
831  recTreenon->SetBranchStatus("shw.shwlid.nhitx",1); // Shower Branch SY 4
832  recTreenon->SetBranchStatus("shw.shwlid.nhity",1); // Shower Branch SY 5
833  recTreenon->SetBranchStatus("shw.shwlid.calE",1); // Shower Branch SY 6
834  recTreenon->SetBranchStatus("shw.shwlid.dir.fY",1); // Shower Branch SY 7
835  recTreenon->SetBranchStatus("shw.shwlid.len",1); // Shower Branch SY 8
836  recTreenon->SetBranchStatus("shw.shwlid.width",1); // Shower Branch SY 9
837  recTreenon->SetBranchStatus("shw.shwlid.gap",1); // Shower Branch SY 11
838  recTreenon->SetBranchStatus("shw.nshwlid",1); // Shower Branch SY 12
839  recTreenon->SetBranchStatus("slc.nmiphit",1); // Slice Branch SY 13
840 
841  recTreenon->SetBranchStatus("sel.cosrej.anglekal",1); // Kirk 1
842  //recTreenon->SetBranchStatus("trk.kalman.dir.*",1); // Kirk 2
843  recTreenon->SetBranchStatus("trk.kalman.dir.fY",1); // Kirk 2
844  recTreenon->SetBranchStatus("slc.boxmax.*",1); // Kirk 3
845  recTreenon->SetBranchStatus("trk.kalman.nhit",1); // Kirk 4
846  recTreenon->SetBranchStatus("trk.kalman.len",1); // Kirk 5
847  recTreenon->SetBranchStatus("sel.contain.kalfwdcell",1); // Kirk 6
848  recTreenon->SetBranchStatus("sel.contain.kalbakcell",1); // Kirk 6
849  recTreenon->SetBranchStatus("sel.cosrej.scatt",1); // Kirk 7
850  recTreenon->SetBranchStatus("slc.nhit",1); // Kirk 8
851  recTreenon->SetBranchStatus("slc.calE",1); // Kirk 9
852  recTreenon->SetBranchStatus("slc.boxmin.*",1); // Kirk 10
853  recTreenon->SetBranchStatus("trk.nkalman",1 ); // Kirk 11
854  recTreenon->SetBranchStatus("trk.kalman.calE",1);
855  recTreenon->SetBranchStatus("sel.cosrej.numucontpid",1);
856  recTreenon->SetBranchStatus("sel.contain.cosfwdcell",1);
857  recTreenon->SetBranchStatus("sel.contain.cosbakcell",1);
858  recTreenon->SetBranchStatus("sel.contain.nplanestofront",1);
859  recTreenon->SetBranchStatus("sel.contain.nplanestoback",1);
860 
861  Int_t nbeam = recTreenon->GetEntries();
862  //Int_t nbeam = recTreenon->GetEntriesFast();
863  for (Int_t j = 0; j < nbeam; ++j) { //Starting to loop over cosmic events
864  recTreenon->GetEntry(j);
865  cerr << "\r-- Processing event " << j << " of " << nbeam;
866 
867  //if(recTreeObject->trk.nkalman == 0) continue;
868  Short_t nnu = recTreeObject->mc.nnu;
869  //std::cout<<"------------nnu is "<<nnu<<std::endl;
870  if(nnu != 1) continue;
871  Int_t nccc = recTreeObject->mc.nu[0].iscc;
872  Short_t pdg = recTreeObject->mc.nu[0].pdg;
873  //Short_t CalE = recTreeObject->slc.calE;
874  ///(recTreeObject->sel.cvn.ncid)
875  // NC Offical Quality Cuts
876  if(recTreeObject->sel.nuecosrej.hitsperplane >= 8) continue;
877  if(recTreeObject->shw.nshwlid == 0 ) continue;
878  if(recTreeObject->shw.shwlid[0].gap >= 100.) continue;
879  if(recTreeObject->slc.ncontplanes <= 2) continue;
880  if( !recTreeObject->vtx.elastic.IsValid) continue;
881  // NC Official Fiducial Cuts
882  if (recTreeObject->vtx.elastic.vtx.fX < -680.0) continue;
883  if (recTreeObject->vtx.elastic.vtx.fX > 650.0) continue;
884  if (recTreeObject->vtx.elastic.vtx.fY < -720.0) continue;
885  if (recTreeObject->vtx.elastic.vtx.fY > 500.0) continue; ///////Loosen Cuts
886  if (recTreeObject->vtx.elastic.vtx.fZ < 50.0) continue;
887  if (recTreeObject->vtx.elastic.vtx.fZ > 5450.0) continue;
888  // NC Official Containment Cuts
889  if(recTreeObject->sel.nuecosrej.startfront < 10) continue;
890  if(recTreeObject->sel.nuecosrej.stopfront < 10) continue;
891  if(recTreeObject->sel.nuecosrej.startback < 10) continue;
892  if(recTreeObject->sel.nuecosrej.stopback < 10) continue;
893  if(recTreeObject->sel.nuecosrej.starteast < 10) continue;
894  if(recTreeObject->sel.nuecosrej.stopeast < 10) continue;
895  if(recTreeObject->sel.nuecosrej.startwest < 10) continue;
896  if(recTreeObject->sel.nuecosrej.stopwest < 10) continue;
897  if(recTreeObject->sel.nuecosrej.starttop < 10) continue;
898  if(recTreeObject->sel.nuecosrej.stoptop < 10) continue;
899  if(recTreeObject->sel.nuecosrej.startbottom < 10) continue;
900  if(recTreeObject->sel.nuecosrej.stopbottom < 10) continue;
901 
902  // NC Official NC/CC rejection
903  //if (recTreeObject->slc.nhit >= 200) continue;
904  //if (recTreeObject->slc.nhit < 20) continue;
905  //if (recTreeObject->sel.cvn.ncid < 0.2) continue;
906 
907  // Muon Removed Cut
908  if(recTreeObject->sel.remid.pid >= 0.9 ) continue;
909  // Energy Cut
910  if(recTreeObject->slc.calE > 4) continue;
911  if(recTreeObject->slc.calE < 0.5) continue;
912 
913  Run = recTreeObject->hdr.run; // True Info
914  SubRun = recTreeObject->hdr.subrun; // True Info
915  Evt = recTreeObject->hdr.evt; // True Info
916  SubEvt = recTreeObject->hdr.subevt; // True Info
917 
918  starttop = recTreeObject->sel.nuecosrej.starttop; // NueCosRej
919  startbottom = recTreeObject->sel.nuecosrej.startbottom; // NueCosRe
920  startfront = recTreeObject->sel.nuecosrej.startfront; // NueCosRej
921  startback = recTreeObject->sel.nuecosrej.startback; // NueCosRej
922  startwest = recTreeObject->sel.nuecosrej.startwest; // NueCosRej
923  starteast = recTreeObject->sel.nuecosrej.starteast; // NueCosRej
924  stoptop = recTreeObject->sel.nuecosrej.stoptop; // NueCosRej
925  stopbottom = recTreeObject->sel.nuecosrej.stopbottom; // NueCosRej
926  stopfront = recTreeObject->sel.nuecosrej.stopfront; // NueCosRej
927  stopback = recTreeObject->sel.nuecosrej.stopback; // NueCosRej
928  stopwest = recTreeObject->sel.nuecosrej.stopwest; // NueCosRej
929  stopeast = recTreeObject->sel.nuecosrej.stopeast; // NueCosRej
930  cosdang = recTreeObject->sel.nuecosrej.cosdang; // NueCosRej
931  vtxdoca = recTreeObject->sel.nuecosrej.vtxdoca; // NueCosRej
932  prongmaxx = recTreeObject->sel.nuecosrej.prongmaxx; // NueCosRej
933  prongmaxy = recTreeObject->sel.nuecosrej.prongmaxy; // NueCosRej
934  prongmaxz = recTreeObject->sel.nuecosrej.prongmaxz; // NueCosRej
935  prongminx = recTreeObject->sel.nuecosrej.prongminx; // NueCosRej
936  prongminy = recTreeObject->sel.nuecosrej.prongminy; // NueCosRej
937  prongminz = recTreeObject->sel.nuecosrej.prongminz; // NueCosRej
938  sparsenessasymm = recTreeObject->sel.nuecosrej.sparsenessasymm; // NueCosRej
939  hitsperplane = recTreeObject->sel.nuecosrej.hitsperplane; // NueCosRej
940  hitsperplaneasymm = recTreeObject->sel.nuecosrej.hitsperplaneasymm; // NueCosRej
941  musliceidx = recTreeObject->sel.nuecosrej.musliceidx; // NueCosRej
942  muanglediff = recTreeObject->sel.nuecosrej.muanglediff; // NueCosRej
943  mutimediff = recTreeObject->sel.nuecosrej.mutimediff; // NueCosRej
944  muclosestapproach = recTreeObject->sel.nuecosrej.muclosestapproach; // NueCosRej
945  numupid = recTreeObject->sel.cosrej.numucontpid;
946 
947  pngptp = recTreeObject->sel.nuecosrej.pngptp; // NueCosRej
948  //sumtx = recTreeObject->sand.nus.sumtx; // NuS Sandbox
949  //sumty = recTreeObject->sand.nus.sumty; // NuS Sandbox
950  //ewsumtx = recTreeObject->sand.nus.ewsumtx; // NuS Sandbox
951  //ewsumty = recTreeObject->sand.nus.ewsumty; // NuS Sandbox
952  //cossumtx = recTreeObject->sand.nus.cossumtx; // NuS Sandbox
953  //cossumty = recTreeObject->sand.nus.cossumty; // NuS Sandbox
954  //cosewsumtx = recTreeObject->sand.nus.cosewsumtx; // NuS Sandbox
955  //cosewsumty = recTreeObject->sand.nus.cosewsumty; // NuS Sandbox
956  //angsumtx = recTreeObject->sand.nus.angsumtx; // NuS Sandbox
957  //angsumty = recTreeObject->sand.nus.angsumty; // NuS Sandbox
958  //angewsumtx = recTreeObject->sand.nus.angewsumtx; // NuS Sandbox
959  //angewsumty = recTreeObject->sand.nus.angewsumty; // NuS Sandbox
960 
961  shwnplane = recTreeObject->shw.shwlid[0].nplane; // Shower Branch
962  shwmaxplanecont = recTreeObject->shw.shwlid[0].maxplanecont; // Shower Branch
963  shwmaxplanegap = recTreeObject->shw.shwlid[0].maxplanegap; // Shower Branch
964  shwstartX = recTreeObject->shw.shwlid[0].start.fX; // Shower Branch
965  shwstartY = recTreeObject->shw.shwlid[0].start.fY; // Shower Branch
966  shwstartZ = recTreeObject->shw.shwlid[0].start.fZ; // Shower Branch
967  shwdirX = recTreeObject->shw.shwlid[0].dir.fX; // Shower Branch
968  shwdirZ = recTreeObject->shw.shwlid[0].dir.fZ; // Shower Branch
969  //shwNplaneX = recTreeObject->shw.shwlid[0].nplanex; // Shower Branch
970  //shwNplaneY = recTreeObject->shw.shwlid[0].nplaney; // Shower Branch
971  //shwstopX = recTreeObject->shw.shwlid[0].stop.fX; // Shower Branch
972  //shwstopY = recTreeObject->shw.shwlid[0].stop.fY; // Shower Branch
973  //shwstopZ = recTreeObject->shw.shwlid[0].stop.fZ; // Shower Branch
974 
975  //nueid = recTreeObject->sel.cvn.nueid; // CVN
976  //numuid = recTreeObject->sel.cvn.numuid; // CVN
977  //nutauid = recTreeObject->sel.cvn.nutauid; // CVN
978 
979  nhit = recTreeObject->slc.nhit; // Slice Branch
980  //ncalhit = recTreeObject->slc.ncalhit; // Slice Branch
981  //ncontplanes = recTreeObject->slc.ncontplanes; // Slice Branch
982  //ncellsfromedge = recTreeObject->slc.; // Slice Branch
983  //starttime = recTreeObject->slc.starttime; // Slice Branch
984  //endtime = recTreeObject->slc.endtime; // Slice Branch
985  //meantime = recTreeObject->slc.meantime; // Slice Branch
986  //meanposX = recTreeObject->slc.meanpos.fX; // Slice Branch
987  //meanposY = recTreeObject->slc.meanpos.fY; // Slice Branch
988  //meanposZ = recTreeObject->slc.meanpos.fZ; // Slice Branch
989 
990  rempid = recTreeObject->sel.remid.pid; // RemID
991  remlen = recTreeObject->sel.remid.len; // RemID
992 
993  //vtxTime = recTreeObject->vtx.elastic.time; // Vertex Branch
994  //vtxX = recTreeObject->vtx.elastic.vtx.fX; // Vertex Branch
995  //vtxY = recTreeObject->vtx.elastic.vtx.fY; // Vertex Branch
996  //vtxZ = recTreeObject->vtx.elastic.vtx.fZ; // Vertex Branch
997  //vtxX = recTreeObject->vtx.elastic; // Vertex Branch
998 
999  ncid = recTreeObject->sel.cvn.ncid; // CVN SY 1
1000  //cosmicid = recTreeObject->sel.cvn.kCosmic;
1001  cosmicid = recTreeObject->sel.cvn.output[14];
1002  partptp = recTreeObject->sel.nuecosrej.partptp; // NueCosRej SY 2
1003  shwnhit = recTreeObject->shw.shwlid[0].nhit; // Shower Branch SY 3
1004  shwnhitx = recTreeObject->shw.shwlid[0].nhitx; // Shower Branch SY 4
1005  shwnhity = recTreeObject->shw.shwlid[0].nhity; // Shower Branch SY 5
1006  shwxminusy = shwnhitx - shwnhity; // SY 6
1007  shwxplusy = shwnhitx + shwnhity; // SY 7
1008  shwxovery = shwxminusy/shwxplusy; // SY 8
1009  shwcalE = recTreeObject->shw.shwlid[0].calE; // Shower Branch SY 9
1010  shwdirY = recTreeObject->shw.shwlid[0].dir.fY; // Shower Branch SY 10
1011  shwlen = recTreeObject->shw.shwlid[0].len; // Shower Branch SY 11
1012  shwwwidth = recTreeObject->shw.shwlid[0].width; // Shower Branch SY 12
1013  shwGap = recTreeObject->shw.shwlid[0].gap; // Shower Branch SY 13
1014  nshwlid = recTreeObject->shw.nshwlid; // Shower Branch SY 14
1015  nmiphit = recTreeObject->slc.nmiphit; // Slice Branch SY 15
1016 
1017  anglekal = recTreeObject->sel.cosrej.anglekal; // Kirk 1
1018  dirFY = recTreeObject->trk.kalman[0].dir.fY; // Kirk 2
1019  boxmaxFY = recTreeObject->slc.boxmax.fY; // Kirk 3
1020  kalnhit = recTreeObject->trk.kalman[0].nhit; // Kirk 4
1021  kallen = recTreeObject->trk.kalman[0].len; // Kirk 5
1022  kalfwdcell = recTreeObject->sel.contain.kalfwdcell; // Kirk 6
1023  kalbakcell = recTreeObject->sel.contain.kalbakcell; // Kirk 6
1024  scatt = recTreeObject->sel.cosrej.scatt; // Kirk 7
1025  nhit = recTreeObject->slc.nhit; // Kirk 8
1026  energy = recTreeObject->slc.calE; // Kirk 9
1027  boxminFY = recTreeObject->slc.boxmin.fY; // Kirk 10
1028  nkal = recTreeObject->trk.nkalman; // Kirk 11
1029 
1030  if(nccc == 0){ ncTree->Fill(); }
1031  else if(pdg == 14){muTree->Fill();}
1032  else {neTree->Fill();}
1033  } // Ending to loop over beam events
1034  } // Ending to loop over files
1035 
1036  IFileSource* cosmicdata=loadercos.WildcardOrSAMQuery(fnamecos);
1037  int AllCos = cosmicdata->NFiles();
1038  //std::cout<<"*****************************************NUMBER OF FILES: "<<AllCos<<std::endl;
1039  //Progress* prog = 0;
1040  TFile* cosfile;
1041  int NumCos = -1;
1042  while(TFile* cosfile =(TFile*)cosmicdata->GetNextFile()){ //Straring to loop over files
1043  ++NumCos;
1044  std::cout<<"*******************************************************Cosmic File NUMBER: "<<NumCos<<std::endl;
1045  if(AllCos >= 0 && !prog) prog = new Progress(TString::Format("Filling tree from %d files", AllCos).Data());
1046  loadercos.HandleFile(cosfile, AllCos == 1 ? prog : 0);
1047  if(AllCos > 1 && prog) prog->SetProgress((NumCos+1.)/AllCos);
1048  TTree *recTreecos = (TTree*)cosfile->Get("recTree");
1049  caf::StandardRecord* recTreeObject = 0;
1050  recTreecos->SetBranchAddress("rec", &recTreeObject);
1051  // Turn off all the branches first
1052  recTreecos->SetBranchStatus("*",0);
1053  // Turn on the useful branches from the cosmic file
1054  recTreecos->SetBranchStatus("hdr.run",1);
1055  recTreecos->SetBranchStatus("hdr.subrun",1);
1056  recTreecos->SetBranchStatus("hdr.evt",1);
1057  recTreecos->SetBranchStatus("hdr.subevt",1);
1058  recTreecos->SetBranchStatus("mc.nnu",1);
1059  recTreecos->SetBranchStatus("mc.nu",1);
1060  recTreecos->SetBranchStatus("mc.nu.iscc",1);
1061  recTreecos->SetBranchStatus("mc.nu.pdg",1);
1062  recTreecos->SetBranchStatus("trk.ncosmic",1);
1063 
1064  recTreecos->SetBranchStatus("sand.nus.sumtx",1); // NuS Sandbox
1065  recTreecos->SetBranchStatus("sand.nus.sumty",1); // NuS Sandbox
1066  recTreecos->SetBranchStatus("sand.nus.ewsumtx",1); // NuS Sandbox
1067  recTreecos->SetBranchStatus("sand.nus.ewsumty",1); // NuS Sandbox
1068  recTreecos->SetBranchStatus("sand.nus.cossumtx",1); // NuS Sandbox
1069  recTreecos->SetBranchStatus("sand.nus.cossumty",1); // NuS Sandbox
1070  recTreecos->SetBranchStatus("sand.nus.cosewsumtx",1); // NuS Sandbox
1071  recTreecos->SetBranchStatus("sand.nus.cosewsumty",1); // NuS Sandbox
1072  recTreecos->SetBranchStatus("sand.nus.angsumtx",1); // NuS Sandbox
1073  recTreecos->SetBranchStatus("sand.nus.angsumty",1); // NuS Sandbox
1074  recTreecos->SetBranchStatus("sand.nus.angewsumtx",1); // NuS Sandbox
1075  recTreecos->SetBranchStatus("sand.nus.angewsumty",1); // NuS Sandbox
1076 
1077  recTreecos->SetBranchStatus("sel.nuecosrej.starttop",1); // NueCosRej
1078  recTreecos->SetBranchStatus("sel.nuecosrej.startbottom",1); // NueCosRej
1079  recTreecos->SetBranchStatus("sel.nuecosrej.startfront",1); // NueCosRej
1080  recTreecos->SetBranchStatus("sel.nuecosrej.startback",1); // NueCosRej
1081  recTreecos->SetBranchStatus("sel.nuecosrej.startwest",1); // NueCosRej
1082  recTreecos->SetBranchStatus("sel.nuecosrej.starteast",1); // NueCosRej
1083  recTreecos->SetBranchStatus("sel.nuecosrej.stoptop",1); // NueCosRej
1084  recTreecos->SetBranchStatus("sel.nuecosrej.stopbottom",1); // NueCosRej
1085  recTreecos->SetBranchStatus("sel.nuecosrej.stopfront",1); // NueCosRej
1086  recTreecos->SetBranchStatus("sel.nuecosrej.stopback",1); // NueCosRej
1087  recTreecos->SetBranchStatus("sel.nuecosrej.stopwest",1); // NueCosRej
1088  recTreecos->SetBranchStatus("sel.nuecosrej.stopeast",1); // NueCosRej
1089  recTreecos->SetBranchStatus("sel.nuecosrej.cosdang",1); // NueCosRej
1090  recTreecos->SetBranchStatus("sel.nuecosrej.vtxdoca",1); // NueCosRej
1091  recTreecos->SetBranchStatus("sel.nuecosrej.prongmaxx",1); // NueCosRej
1092  recTreecos->SetBranchStatus("sel.nuecosrej.prongmaxy",1); // NueCosRej
1093  recTreecos->SetBranchStatus("sel.nuecosrej.prongmaxz",1); // NueCosRej
1094  recTreecos->SetBranchStatus("sel.nuecosrej.prongminx",1); // NueCosRej
1095  recTreecos->SetBranchStatus("sel.nuecosrej.prongminy",1); // NueCosRej
1096  recTreecos->SetBranchStatus("sel.nuecosrej.prongminz",1); // NueCosRej
1097  recTreecos->SetBranchStatus("sel.nuecosrej.sparsenessasymm",1); // NueCosRej
1098  recTreecos->SetBranchStatus("sel.nuecosrej.hitsperplane",1); // NueCosRej ///////
1099  recTreecos->SetBranchStatus("sel.nuecosrej.hitsperplaneasymm",1); // NueCosRej
1100  recTreecos->SetBranchStatus("sel.nuecosrej.musliceidx",1); // NueCosRej
1101  recTreecos->SetBranchStatus("sel.nuecosrej.muanglediff",1); // NueCosRej
1102  recTreecos->SetBranchStatus("sel.nuecosrej.mutimediff",1); // NueCosRej
1103  recTreecos->SetBranchStatus("sel.nuecosrej.muclosestapproach",1); // NueCosRej
1104  recTreecos->SetBranchStatus("sel.nuecosrej.partptp",1); // NueCosRej
1105  recTreecos->SetBranchStatus("sel.nuecosrej.pngptp",1); // NueCosRej
1106 
1107  recTreecos->SetBranchStatus("sel.cvn.ncid",1); // CVN
1108  recTreecos->SetBranchStatus("sel.cvn.nueid",1); // CVN
1109  recTreecos->SetBranchStatus("sel.cvn.numuid",1); // CVN
1110  recTreecos->SetBranchStatus("sel.cvn.nutauid",1); // CVN
1111 
1112  recTreecos->SetBranchStatus("sel.remid.pid",1); // RemID
1113  recTreecos->SetBranchStatus("sel.remid.len",1); // RemID
1114 
1115  recTreecos->SetBranchStatus("slc.nhit",1); // Slice Branch
1116  //recTreecos->SetBranchStatus("slc.calhit",1); // Slice Branch
1117  recTreecos->SetBranchStatus("slc.nmiphit",1); // Slice Branch
1118  recTreecos->SetBranchStatus("slc.ncontplanes",1); // Slice Branch
1119  recTreecos->SetBranchStatus("slc.ncellsfromedge",1); // Slice Branch
1120  recTreecos->SetBranchStatus("slc.starttime",1); // Slice Branch
1121  recTreecos->SetBranchStatus("slc.endtime",1); // Slice Branch
1122  recTreecos->SetBranchStatus("slc.meantime",1); // Slice Branch
1123  recTreecos->SetBranchStatus("slc.meanpos.fX",1); // Slice Branch
1124  recTreecos->SetBranchStatus("slc.meanpos.fY",1); // Slice Branch
1125  recTreecos->SetBranchStatus("slc.meanpos.fZ",1); // Slice Branch
1126 
1127  recTreecos->SetBranchStatus("shw.shwlid.nhit",1); // Shower Branch
1128  recTreecos->SetBranchStatus("shw.shwlid.nhitx",1); // Shower Branch
1129  recTreecos->SetBranchStatus("shw.shwlid.nhity",1); // Shower Branch
1130  recTreecos->SetBranchStatus("shw.shwlid.nplane",1); // Shower Branch
1131  recTreecos->SetBranchStatus("shw.shwlid.maxplanecont",1); // Shower Branch
1132  recTreecos->SetBranchStatus("shw.shwlid.maxplanegap",1); // Shower Branch
1133  recTreecos->SetBranchStatus("shw.shwlid.calE",1); // Shower Branch
1134  recTreecos->SetBranchStatus("shw.shwlid.start.fX",1); // Shower Branch
1135  recTreecos->SetBranchStatus("shw.shwlid.start.fY",1); // Shower Branch
1136  recTreecos->SetBranchStatus("shw.shwlid.start.fZ",1); // Shower Branch
1137  recTreecos->SetBranchStatus("shw.shwlid.dir.fX",1); // Shower Branch
1138  recTreecos->SetBranchStatus("shw.shwlid.dir.fY",1); // Shower Branch
1139  recTreecos->SetBranchStatus("shw.shwlid.dir.fZ",1); // Shower Branch
1140  recTreecos->SetBranchStatus("shw.shwlid.len",1); // Shower Branch
1141  recTreecos->SetBranchStatus("shw.shwlid.width",1); // Shower Branch
1142  recTreecos->SetBranchStatus("shw.shwlid.nplanex",1); // Shower Branch
1143  recTreecos->SetBranchStatus("shw.shwlid.nplaney",1); // Shower Branch
1144  recTreecos->SetBranchStatus("shw.shwlid.gap",1); // Shower Branch
1145  recTreecos->SetBranchStatus("shw.shwlid.stop.fX",1); // Shower Branch
1146  recTreecos->SetBranchStatus("shw.shwlid.stop.fY",1); // Shower Branch
1147  recTreecos->SetBranchStatus("shw.shwlid.stop.fZ",1); // Shower Branch
1148  recTreecos->SetBranchStatus("shw.nshwlid",1); // Shower Branch
1149  recTreecos->SetBranchStatus("shw.shwlid.gap",1); // Shower Branch
1150 
1151  recTreecos->SetBranchStatus("vtx.elastic.time",1); // Vertex Branch
1152  recTreecos->SetBranchStatus("vtx.elastic.vtx.fX",1); // Vertex Branch
1153  recTreecos->SetBranchStatus("vtx.elastic.vtx.fY",1); // Vertex Branch
1154  recTreecos->SetBranchStatus("vtx.elastic.vtx.fZ",1); // Vertex Branch
1155  //recTreecos->SetBranchStatus("vtx.elastic.png3d.nhit",1); // Vertex Branch
1156  //recTreecos->SetBranchStatus("vtx.elastic.png3d.nhitx",1); // Vertex Branch
1157  //recTreecos->SetBranchStatus("vtx.elastic.png3d.nhity",1); // Vertex Branch
1158  recTreecos->SetBranchStatus("vtx.elastic.IsValid",1); // Vertex Branch
1159 
1160  recTreecos->SetBranchStatus("sel.cvn.output",1); // CVN SY 1
1161  //recTreecos->SetBranchStatus("sel.cvn.output[14]",1); // CVN SY 1
1162  recTreecos->SetBranchStatus("sel.nuecosrej.partptp",1); // NueCosRej SY 2
1163  recTreecos->SetBranchStatus("shw.shwlid.nhit",1); // Shower Branch SY 3
1164  recTreecos->SetBranchStatus("shw.shwlid.nhitx",1); // Shower Branch SY 4
1165  recTreecos->SetBranchStatus("shw.shwlid.nhity",1); // Shower Branch SY 5
1166  recTreecos->SetBranchStatus("shw.shwlid.calE",1); // Shower Branch SY 6
1167  recTreecos->SetBranchStatus("shw.shwlid.dir.fY",1); // Shower Branch SY 7
1168  recTreecos->SetBranchStatus("shw.shwlid.len",1); // Shower Branch SY 8
1169  recTreecos->SetBranchStatus("shw.shwlid.width",1); // Shower Branch SY 9
1170  recTreecos->SetBranchStatus("shw.shwlid.gap",1); // Shower Branch SY 11
1171  recTreecos->SetBranchStatus("shw.nshwlid",1); // Shower Branch SY 12
1172  recTreecos->SetBranchStatus("slc.nmiphit",1); // Slice Branch SY 13
1173 
1174  recTreecos->SetBranchStatus("sel.cosrej.anglekal",1); // Kirk 1
1175  recTreecos->SetBranchStatus("trk.kalman.dir.*",1); // Kirk 2
1176  recTreecos->SetBranchStatus("slc.boxmax.*",1); // Kirk 3
1177  recTreecos->SetBranchStatus("trk.kalman.nhit",1); // Kirk 4
1178  recTreecos->SetBranchStatus("trk.kalman.len",1); // Kirk 5
1179  recTreecos->SetBranchStatus("sel.contain.kalfwdcell",1); // Kirk 6
1180  recTreecos->SetBranchStatus("sel.contain.kalbakcell",1); // Kirk 6
1181  recTreecos->SetBranchStatus("sel.cosrej.scatt",1); // Kirk 7
1182  recTreecos->SetBranchStatus("slc.nhit",1); // Kirk 8
1183  recTreecos->SetBranchStatus("slc.calE",1); // Kirk 9
1184  recTreecos->SetBranchStatus("slc.boxmin.*",1); // Kirk 10
1185  recTreecos->SetBranchStatus("trk.nkalman",1 ); // Kirk 11
1186 
1187  recTreecos->SetBranchStatus("trk.kalman.calE",1);
1188 
1189  recTreecos->SetBranchStatus("sel.cosrej.numucontpid",1);
1190  recTreecos->SetBranchStatus("sel.contain.cosfwdcell",1);
1191  recTreecos->SetBranchStatus("sel.contain.cosbakcell",1);
1192  recTreecos->SetBranchStatus("sel.contain.nplanestofront",1);
1193  recTreecos->SetBranchStatus("sel.contain.nplanestoback",1);
1194 
1195  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1196  recTreecos->SetBranchStatus("sel.elecid.shwlid.ismuon",1); //sel.elecid.shwlid[0].ismuon
1197  recTreecos->SetBranchStatus("sel.cosrej.numucontpid",1);
1198  //sr->sel.cosrej.numucontpid
1199  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1200 
1201  Int_t ncosmic = recTreecos->GetEntriesFast();
1202  for (Int_t i = 0; i < ncosmic; ++i) { //Starting to loop over cosmic events
1203  recTreecos->GetEntry(i);
1204  cerr << "\r-- Processing event " << i << " of " << ncosmic;
1205  //if(recTreeObject->mc.nnu == 0) continue;
1206  //if(recTreeObject->trk.nkalman == 0) continue;
1207 
1208  //Short_t nnu = recTreeObject->mc.nnu;
1209  //std::cout<<"------------nnu is "<<nnu<<std::endl;
1210  //if(nnu != 1) continue;
1211  //Int_t nccc = recTreeObject->mc.nu[0].iscc;
1212  //Short_t pdg = recTreeObject->mc.nu[0].pdg;
1213 
1214  // NC Offical Quality Cuts
1215  if(recTreeObject->sel.nuecosrej.hitsperplane >= 8) continue;
1216  if(recTreeObject->shw.nshwlid == 0 ) continue;
1217  if(recTreeObject->shw.shwlid[0].gap >= 100.) continue;
1218  if(recTreeObject->slc.ncontplanes <= 2) continue;
1219  if( !recTreeObject->vtx.elastic.IsValid ) continue;
1220 
1221  // NC Official Fiducial Cuts
1222  if (recTreeObject->vtx.elastic.vtx.fX < -680.0) continue;
1223  if (recTreeObject->vtx.elastic.vtx.fX > 650.0) continue;
1224  if (recTreeObject->vtx.elastic.vtx.fY < -720.0) continue;
1225  if (recTreeObject->vtx.elastic.vtx.fY > 500.0) continue; ///////Loosen Cuts
1226  if (recTreeObject->vtx.elastic.vtx.fZ < 50.0) continue;
1227  if (recTreeObject->vtx.elastic.vtx.fZ > 5450.0) continue;
1228 
1229  // NC Official Containment Cuts
1230  if(recTreeObject->sel.nuecosrej.startfront < 10) continue;
1231  if(recTreeObject->sel.nuecosrej.stopfront < 10) continue;
1232  if(recTreeObject->sel.nuecosrej.startback < 10) continue;
1233  if(recTreeObject->sel.nuecosrej.stopback < 10) continue;
1234  if(recTreeObject->sel.nuecosrej.starteast < 10) continue;
1235  if(recTreeObject->sel.nuecosrej.stopeast < 10) continue;
1236  if(recTreeObject->sel.nuecosrej.startwest < 10) continue;
1237  if(recTreeObject->sel.nuecosrej.stopwest < 10) continue;
1238  if(recTreeObject->sel.nuecosrej.starttop < 10) continue;
1239  if(recTreeObject->sel.nuecosrej.stoptop < 10) continue;
1240  if(recTreeObject->sel.nuecosrej.startbottom < 10) continue;
1241  if(recTreeObject->sel.nuecosrej.stopbottom < 10) continue;
1242 
1243  // NC Official NC/CC rejection
1244  //if (recTreeObject->slc.nhit >= 200) continue;
1245  //if (recTreeObject->slc.nhit < 20) continue;
1246  //if (recTreeObject->sel.cvn.ncid < 0.2) continue;
1247 
1248  // Muon Removed Cut
1249  if(recTreeObject->sel.remid.pid >= 0.9 ) continue;
1250 
1251  // Energy Cut
1252  if(recTreeObject->slc.calE > 4) continue;
1253  if(recTreeObject->slc.calE < 0.5) continue;
1254 
1255  Run = recTreeObject->hdr.run;
1256  SubRun = recTreeObject->hdr.subrun;
1257  Evt = recTreeObject->hdr.evt;
1258  SubEvt = recTreeObject->hdr.subevt;
1259 
1260  //sumtx = recTreeObject->sand.nus.sumtx; // NuS Sandbox
1261  //sumty = recTreeObject->sand.nus.sumty; // NuS Sandbox
1262  //ewsumtx = recTreeObject->sand.nus.ewsumtx; // NuS Sandbox
1263  //ewsumty = recTreeObject->sand.nus.ewsumty; // NuS Sandbox
1264  //cossumtx = recTreeObject->sand.nus.cossumtx; // NuS Sandbox
1265  //cossumty = recTreeObject->sand.nus.cossumty; // NuS Sandbox
1266  //cosewsumtx = recTreeObject->sand.nus.cosewsumtx; // NuS Sandbox
1267  //cosewsumty = recTreeObject->sand.nus.cosewsumty; // NuS Sandbox
1268  //angsumtx = recTreeObject->sand.nus.angsumtx; // NuS Sandbox
1269  //angsumty = recTreeObject->sand.nus.angsumty; // NuS Sandbox
1270  //angewsumtx = recTreeObject->sand.nus.angewsumtx; // NuS Sandbox
1271  //angewsumty = recTreeObject->sand.nus.angewsumty; // NuS Sandbox
1272 
1273  starttop = recTreeObject->sel.nuecosrej.starttop; // NueCosRej
1274  startbottom = recTreeObject->sel.nuecosrej.startbottom; // NueCosRe
1275  startfront = recTreeObject->sel.nuecosrej.startfront; // NueCosRej
1276  startback = recTreeObject->sel.nuecosrej.startback; // NueCosRej
1277  startwest = recTreeObject->sel.nuecosrej.startwest; // NueCosRej
1278  starteast = recTreeObject->sel.nuecosrej.starteast; // NueCosRej
1279  stoptop = recTreeObject->sel.nuecosrej.stoptop; // NueCosRej
1280  stopbottom = recTreeObject->sel.nuecosrej.stopbottom; // NueCosRej
1281  stopfront = recTreeObject->sel.nuecosrej.stopfront; // NueCosRej
1282  stopback = recTreeObject->sel.nuecosrej.stopback; // NueCosRej
1283  stopwest = recTreeObject->sel.nuecosrej.stopwest; // NueCosRej
1284  stopeast = recTreeObject->sel.nuecosrej.stopeast; // NueCosRej
1285  cosdang = recTreeObject->sel.nuecosrej.cosdang; // NueCosRej
1286  vtxdoca = recTreeObject->sel.nuecosrej.vtxdoca; // NueCosRej
1287  prongmaxx = recTreeObject->sel.nuecosrej.prongmaxx; // NueCosRej
1288  prongmaxy = recTreeObject->sel.nuecosrej.prongmaxy; // NueCosRej
1289  prongmaxz = recTreeObject->sel.nuecosrej.prongmaxz; // NueCosRej
1290  prongminx = recTreeObject->sel.nuecosrej.prongminx; // NueCosRej
1291  prongminy = recTreeObject->sel.nuecosrej.prongminy; // NueCosRej
1292  prongminz = recTreeObject->sel.nuecosrej.prongminz; // NueCosRej
1293  sparsenessasymm = recTreeObject->sel.nuecosrej.sparsenessasymm; // NueCosRej
1294  hitsperplane = recTreeObject->sel.nuecosrej.hitsperplane; // NueCosRej
1295  hitsperplaneasymm = recTreeObject->sel.nuecosrej.hitsperplaneasymm; // NueCosRej
1296  musliceidx = recTreeObject->sel.nuecosrej.musliceidx; // NueCosRej
1297  muanglediff = recTreeObject->sel.nuecosrej.muanglediff; // NueCosRej
1298  mutimediff = recTreeObject->sel.nuecosrej.mutimediff; // NueCosRej
1299  muclosestapproach = recTreeObject->sel.nuecosrej.muclosestapproach; // NueCosRej
1300 
1301  //partptp = recTreeObject->sel.nuecosrej.partptp; // NueCosRej
1302  pngptp = recTreeObject->sel.nuecosrej.pngptp; // NueCosRej
1303 
1304  numupid = recTreeObject->sel.cosrej.numucontpid;
1305 
1306  //ncid = recTreeObject->sel.cvn.ncid; // CVN
1307  //nueid = recTreeObject->sel.cvn.nueid; // CVN
1308  //numuid = recTreeObject->sel.cvn.numuid; // CVN
1309  //nutauid = recTreeObject->sel.cvn.nutauid; // CVN
1310 
1311  rempid = recTreeObject->sel.remid.pid; // RemID
1312  remlen = recTreeObject->sel.remid.len; // RemID
1313 
1314  // nhit = recTreeObject->slc.nhit; // Slice Branch
1315  //ncalhit = recTreeObject->slc.ncalhit; // Slice Branch
1316  //nmiphit = recTreeObject->slc.nmiphit; // Slice Branch
1317  //ncontplanes = recTreeObject->slc.ncontplanes; // Slice Branch
1318  //ncellsfromedge = recTreeObject->slc.; // Slice Branch
1319  //starttime = recTreeObject->slc.starttime; // Slice Branch
1320  //endtime = recTreeObject->slc.endtime; // Slice Branch
1321  //meantime = recTreeObject->slc.meantime; // Slice Branch
1322  //meanposX = recTreeObject->slc.meanpos.fX; // Slice Branch
1323  //meanposY = recTreeObject->slc.meanpos.fY; // Slice Branch
1324  //meanposZ = recTreeObject->slc.meanpos.fZ; // Slice Branch
1325 
1326  shwnhit = recTreeObject->shw.shwlid[0].nhit; // Shower Branch
1327  shwnhitx = recTreeObject->shw.shwlid[0].nhitx; // Shower Branch
1328  //shwnhity = recTreeObject->shw.shwlid[0].nhity; // Shower Branch
1329  shwnplane = recTreeObject->shw.shwlid[0].nplane; // Shower Branch
1330  shwmaxplanecont = recTreeObject->shw.shwlid[0].maxplanecont; // Shower Branch
1331  shwmaxplanegap = recTreeObject->shw.shwlid[0].maxplanegap; // Shower Branch
1332  //shwcalE = recTreeObject->shw.shwlid[0].calE; // Shower Branch
1333  shwstartX = recTreeObject->shw.shwlid[0].start.fX; // Shower Branch
1334  shwstartY = recTreeObject->shw.shwlid[0].start.fY; // Shower Branch
1335  shwstartZ = recTreeObject->shw.shwlid[0].start.fZ; // Shower Branch
1336  shwdirX = recTreeObject->shw.shwlid[0].dir.fX; // Shower Branch
1337  //shwdirY = recTreeObject->shw.shwlid[0].dir.fY; // Shower Branch
1338  shwdirZ = recTreeObject->shw.shwlid[0].dir.fZ; // Shower Branch
1339  //shwlen = recTreeObject->shw.shwlid[0].len; // Shower Branch
1340  //shwwwidth = recTreeObject->shw.shwlid[0].width; // Shower Branch
1341  shwNplaneX = recTreeObject->shw.shwlid[0].nplanex; // Shower Branch
1342  shwNplaneY = recTreeObject->shw.shwlid[0].nplaney; // Shower Branch
1343  //shwGap = recTreeObject->shw.shwlid[0].gap; // Shower Branch
1344  //shwstopX = recTreeObject->shw.shwlid[0].stop.fX; // Shower Branch
1345  //shwstopY = recTreeObject->shw.shwlid[0].stop.fY; // Shower Branch
1346  //shwstopZ = recTreeObject->shw.shwlid[0].stop.fZ; // Shower Branch
1347  //nshwlid = recTreeObject->shw.nshwlid; // Shower Branch
1348 
1349  //vtxTime = recTreeObject->vtx.elastic.time; // Vertex Branch
1350  //vtxX = recTreeObject->vtx.elastic.vtx.fX; // Vertex Branch
1351  //vtxY = recTreeObject->vtx.elastic.vtx.fY; // Vertex Branch
1352  //vtxZ = recTreeObject->vtx.elastic.vtx.fZ; // Vertex Branch
1353 
1354  ncid = recTreeObject->sel.cvn.ncid; // CVN SY 1
1355  cosmicid = recTreeObject->sel.cvn.output[14];
1356  partptp = recTreeObject->sel.nuecosrej.partptp; // NueCosRej SY 2
1357  shwnhit = recTreeObject->shw.shwlid[0].nhit; // Shower Branch SY 3
1358  shwnhitx = recTreeObject->shw.shwlid[0].nhitx; // Shower Branch SY 4
1359  shwnhity = recTreeObject->shw.shwlid[0].nhity; // Shower Branch SY 5
1360  shwxminusy = shwnhitx - shwnhity; // SY 6
1361  shwxplusy = shwnhitx + shwnhity; // SY 7
1362  shwxovery = shwxminusy/shwxplusy; // SY 8
1363  shwcalE = recTreeObject->shw.shwlid[0].calE; // Shower Branch SY 9
1364  shwdirY = recTreeObject->shw.shwlid[0].dir.fY; // Shower Branch SY 10
1365  shwlen = recTreeObject->shw.shwlid[0].len; // Shower Branch SY 11
1366  shwwwidth = recTreeObject->shw.shwlid[0].width; // Shower Branch SY 12
1367  shwGap = recTreeObject->shw.shwlid[0].gap; // Shower Branch SY 13
1368  nshwlid = recTreeObject->shw.nshwlid; // Shower Branch SY 14
1369  nmiphit = recTreeObject->slc.nmiphit; // Slice Branch SY 15
1370 
1371  anglekal = recTreeObject->sel.cosrej.anglekal; // Kirk 1
1372  dirFY = recTreeObject->trk.kalman[0].dir.fY; // Kirk 2
1373  boxmaxFY = recTreeObject->slc.boxmax.fY; // Kirk 3
1374  kalnhit = recTreeObject->trk.kalman[0].nhit; // Kirk 4
1375  kallen = recTreeObject->trk.kalman[0].len; // Kirk 5
1376  kalfwdcell = recTreeObject->sel.contain.kalfwdcell; // Kirk 6
1377  kalbakcell = recTreeObject->sel.contain.kalbakcell; // Kirk 6
1378  scatt = recTreeObject->sel.cosrej.scatt; // Kirk 7
1379  nhit = recTreeObject->slc.nhit; // Kirk 8
1380  energy = recTreeObject->slc.calE; // Kirk 9
1381  boxminFY = recTreeObject->slc.boxmin.fY; // Kirk 10
1382  nkal = recTreeObject->trk.nkalman; // Kirk 11
1383  csTree->Fill();
1384  } // Ending to loop over cosmic events
1385  } //Ending to loop over files
1386 
1387  tMVALoad.Write();
1388  tMVALoad.Close();
1389 }
float nshwlid
float ncid
Likelihood Neutral Current.
Definition: SRCVNResult.h:23
float partptp
Definition: NusVarsTemp.cxx:50
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
SRHeader hdr
Header branch: run, subrun, etc.
unsigned int subrun
subrun number
Definition: SRHeader.h:22
float shwnhity
SRCosRej cosrej
Output from CosRej (Cosmic Rejection)
Definition: SRIDBranch.h:47
float shwGap
float len
Track length of identified track.
Definition: SRRemid.h:28
SRVector3D boxmax
Maximum coordinates box containing all the hits [cm].
Definition: SRSlice.h:47
static Var numuid(const std::shared_ptr< CAFAnaModel > &model)
Definition: SliceLIDVar.h:63
nhit
Definition: demo1.py:25
OStream cerr
Definition: OStream.cxx:7
unsigned int run
run number
Definition: SRHeader.h:21
float shwxplusy
float scatt
sum of all all angular deviation (looping over kaltrk traj pts) / trk len
Definition: SRCosRej.h:41
float shwnhitx
float shwcalE
void ProducingSA()
Definition: ProducingSA.C:44
unsigned int evt
ART event number, indexes trigger windows.
Definition: SRHeader.h:25
float cosmicid
SRKalman kalman
Tracks produced by KalmanTrack.
Definition: SRTrackBranch.h:24
float pid
PID value output by kNN.
Definition: SRRemid.h:25
virtual int NFiles() const
May return -1 indicating the number of files is not known.
Definition: IFileSource.h:21
SRVector3D boxmin
Minimum coordinates box containing all the hits [cm].
Definition: SRSlice.h:46
float shwlen
float anglekal
cos of angle of best ReMId Kalman track
Definition: SRCosRej.h:23
float nmiphit
static Var nutauid(const std::shared_ptr< CAFAnaModel > &model)
Definition: SliceLIDVar.h:93
SRCVNResult cvn
Horrible hack to appease CAFAna.
Definition: SRIDBranch.h:53
static Var nueid(const std::shared_ptr< CAFAnaModel > &model)
Definition: SliceLIDVar.h:83
unsigned int nmiphit
number of minimum ionizing hits
Definition: SRSlice.h:24
SRNueCosRej nuecosrej
Output from NueCosRej (Nue Cosmic Rejection)
Definition: SRIDBranch.h:48
SRRemid remid
Output from RecoMuonID (ReMId) package.
Definition: SRIDBranch.h:39
float calE
Calorimetric energy of the cluster [GeV].
Definition: SRSlice.h:38
double energy
Definition: plottest35.C:25
std::vector< float > output
List of net output nodes.
Definition: SRCVNResult.h:19
const double j
Definition: BetheBloch.cxx:29
SRVector3D vtx
Vertex position in detector coordinates. [cm].
Definition: SRElastic.h:40
short nnu
Number of neutrinos in nu vector (0 or 1)
Definition: SRTruthBranch.h:37
unsigned int nhit
number of hits
Definition: SRSlice.h:22
float shwdirY
OStream cout
Definition: OStream.cxx:6
float ncid
virtual TFile * GetNextFile()=0
Returns the next file in sequence, ready for reading.
The StandardRecord is the primary top-level object in the Common Analysis File trees.
int kalfwdcell
Kalmantrack projected # cells from end point forwards to det edge.
Definition: SRContain.h:40
Interface class for accessing ROOT files in sequence.
Definition: IFileSource.h:10
void SetProgress(double frac)
Update the progress fraction between zero and one.
Definition: Progress.cxx:41
float shwxovery
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
float hitsperplaneasymm
Definition: SRNueCosRej.h:170
float shwxminusy
IFileSource * WildcardOrSAMQuery(const std::string &str) const
Figure out if str is a wildcard or SAM query and return a source.
SRIDBranch sel
Selector (PID) branch.
SRElastic elastic
Single vertex found by Elastic Arms.
float ncontplanes
Definition: NusVarsTemp.cxx:34
int kalbakcell
Kalmantrack projected # cells from start point backwards to det edge.
Definition: SRContain.h:45
A simple ascii-art progress bar.
Definition: Progress.h:9
SRSlice slc
Slice branch: nhit, extents, time, etc.
SRTruthBranch mc
Truth branch for MC: energy, flavor, etc.
virtual void HandleFile(TFile *f, Progress *prog=0)
float shwnhit
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
unsigned short subevt
slice number within spill
Definition: SRHeader.h:26
unsigned int ncontplanes
number of continuous planes
Definition: SRSlice.h:25
SRTrackBranch trk
Track branch: nhit, len, etc.
SRContain contain
Output from SRContain (containment related variables)
Definition: SRIDBranch.h:51
std::vector< SRNeutrino > nu
implemented as a vector to maintain mc.nu structure, i.e. not a pointer, but with 0 or 1 entries...
Definition: SRTruthBranch.h:25
SRVertexBranch vtx
Vertex branch: location, time, etc.
enum BeamMode string