Project

General

Profile

datascanner01.C

Athanasios Hatzikoutelis, 01/21/2016 07:07 PM

 
1
// setupnova -r S13-10-11 -b maxopt
2

    
3
// Make a simple spectrum plot
4

    
5
#ifdef __CINT__
6
void datascanner01()
7
{
8
  std::cout << "Sorry, you must run in compiled mode" << std::endl;
9
}
10
#else
11

    
12
//#include "OscLib/func/OscCalculatorPMNSOpt.h"
13

    
14
#include "CAFAna//Core/Binning.h"
15
#include "CAFAna/Cuts/Cuts.h"
16
#include "CAFAna/Core/Spectrum.h"
17
#include "CAFAna/Core/SpectrumLoader.h"
18
#include "CAFAna/Vars/Vars.h"
19
#include <iostream>
20
#include <fstream>
21
#include <vector>
22
#include <cstring>
23
#include <string>
24

    
25
#include "TArrow.h"
26
#include "TCanvas.h"
27
#include "TH1.h"
28
#include "TH2.h"
29
#include "TH2F.h"
30
#include "TFile.h"
31
#include "TLegend.h"
32

    
33
#include <cmath>
34
#include <fstream>
35
#include <iomanip>
36
#include <iostream>
37
#include <cassert>
38
#include <memory>
39

    
40
#include "Utilities/func/MathUtil.h"
41

    
42
using namespace ana;
43

    
44

    
45
 static int nocut =0;
46
                          static int nocutnue =0;
47
                          static int nocutnumu =0;
48
                          static int nocutnc =0;
49
                          static int selection =0;
50
                          static int selectionnue =0;
51
                          static int selectionnumu =0;
52
                          static int selectionnc =0;
53
                          static int slice =0;
54
                          static int slicenue =0;
55
                          static int slicenumu =0;
56
                          static int slicenc =0;
57
                          static int shower =0;
58
                          static int showernue =0;
59
                          static int showernumu =0;
60
                          static int showernc =0;
61
                          static int vertex =0;
62
                          static int vertexnue =0;
63
                          static int vertexnumu =0;
64
                          static int vertexnc =0;
65
                          static int gap =0;
66
                          static int gapnue =0;
67
                          static int gapnumu =0;
68
                          static int gapnc =0;
69
                          static int len =0;
70
                          static int lennue =0;
71
                          static int lennumu =0;
72
                          static int lennc =0;
73
                          static int muon =0;
74
                          static int muonnue =0;
75
                          static int muonnumu =0;
76
                          static int muonnc =0;
77
                          static int cale =0;
78
                          static int calenue =0;
79
                          static int calenumu =0;
80
                          static int calenc =0;
81

    
82
                          static int vertexh =0;
83
                          static int vertexnueh =0;
84
                          static int vertexnumuh =0;
85
                          static int vertexnch =0;
86
                          static int gaph =0;
87
                          static int gapnueh =0;
88
                          static int gapnumuh =0;
89
                          static int gapnch =0;
90
                          static int lenh =0;
91
                          static int lennueh =0;
92
                          static int lennumuh =0;
93
                          static int lennch =0;
94
                          static int muonh =0;
95
                          static int muonnueh =0;
96
                          static int muonnumuh =0;
97
                          static int muonnch =0;
98
                          static int caleh =0;
99
                          static int calenueh =0;
100
                          static int calenumuh =0;
101
                          static int calench =0;
102

    
103
                          static int contain =0;
104
                          static int containnue =0;
105
                          static int containnumu =0;
106
                          static int containnc =0;
107
                          static int uncontain =0;
108
                          static int uncontainnue =0;
109
                          static int uncontainnumu =0;
110
                          static int uncontainnc =0;
111

    
112
                          static int nocut2 =0;
113
                          static int selection2 =0;
114
                          static int slice2 =0;
115
                          static int shower2 =0;
116
                          static int vertex2 =0;
117
                          static int gap2 =0;
118
                          static int cale2 =0;
119
                          static int len2 =0;
120
                          static int muon2 =0;
121

    
122
                          static int vertex2h =0;
123
                          static int gap2h =0;
124
                          static int cale2h =0;
125
                          static int len2h =0;
126
                          static int muon2h =0;
127

    
128
static int lid =0;
129
static int nc =0;
130
static int nue =0;
131
static int numu =0;
132
 float f=0;
133

    
134
 void saveHist(Spectrum s, string name){
135
   //std::cout << "POT: " << s.POT() << std::endl;  
136

    
137
   TH1D *h = s.ToTH1(s.POT());
138

    
139
   // TH1D *h = s.ToTH1(pot1);
140
   h->SetStats(kTRUE);
141
   h->SetName(name.c_str());
142
   h->Write();  
143
 }
144

    
145

    
146

    
147
////////////////   Save Spectrums to a folder  /////////
148

    
149
void SaveToFile(Spectrum &s, const std::string &f, const string& name) {  
150
  TFile fout("f.c_str().root", "UPDATE"); 
151
  s.SaveTo(fout.mkdir(name.c_str()));
152
}
153

    
154
//////////////////////////////////////////////////
155

    
156

    
157

    
158
void datascanner01()
159
{
160
//-- test input data file--- "test_data.caf.root"; 
161
//-- test input MC file---"test_sim.caf.root"; 
162
//-- test input signal file--- "nuh600_3.caf.root"; 
163

    
164
/*-- current input file---*/  const std::string fname = "test_sim.caf.root"; 
165

    
166
                                std::cout << "|======>  input file Name: " << fname << std::endl;
167
                                SpectrumLoader loader(fname);
168
  
169
 
170
  // Specify variables needed and arbitrary code to extract value from
171
  // StandardRecord
172

    
173
  ////////////////  Different Components  ///////////
174
  /////////////////////////////////////////
175

    
176

    
177
      const Cut kIsNuMuCC({"mc.nnu","mc.nu.iscc","mc.nu.pdg"},
178
                        [](const caf::StandardRecord* sr){
179
                          if (sr->mc.nnu != 1) return false;
180
                          if (sr->mc.nu[0].iscc == 0) return false;
181
                          if (abs(sr->mc.nu[0].pdg) == 14) return true;
182
                          return false;
183
                        });
184
      
185
      const Cut kIsNueCC({"mc.nnu","mc.nu.pdg", "mc.nu.iscc"},
186
                         [](const caf::StandardRecord* sr)
187
                         {
188
                           if(sr->mc.nnu == 0) return false;
189
                           if(sr->mc.nu[0].pdg ==12 && sr->mc.nu[0].iscc ==1) return true;
190
                           return false;
191
                         });
192

    
193
      const Cut kNC({"mc.nnu","mc.nu.iscc","mc.nu.pdg"},
194
                    [](const caf::StandardRecord* sr){
195
                      if (sr->mc.nnu != 1) return false;
196
                      if (sr->mc.nu[0].iscc == 0) return true;
197
                      return false;
198
                    });
199

    
200

    
201
      const Cut kIsAllMC({"mc.nnu"},
202
                    [](const caf::StandardRecord* sr){
203
                      if (sr->mc.nnu != 1) return false;                     
204
                      return true;
205
                    });
206

    
207
      ////////////////////******************************/////////////////////////////////
208
      ////////////////////  Cuts applied  ///////////////////////////////////////////////
209
     
210
      const Cut kDataQ({"spill.isgoodspill", "spill.spillpot"},
211
                         [](const caf::StandardRecord* sr)
212
                         {
213
                           if (sr->spill.isgoodspill != 1) return false;
214
                           return sr->spill.spillpot > 2e+12; 
215
                         });
216
     
217

    
218
      const Cut kFidCut({"vtx.nelastic", "vtx.elastic.*", "shw.nshwlid", "vtx.elastic.vtx.fX", "vtx.elastic.vtx.fY", "vtx.elastic.vtx.fZ"},
219
                       [](const caf::StandardRecord* sr)
220
                       {
221
                         if (sr->vtx.nelastic != 1) return false;
222
                         if (sr->vtx.elastic[0].npng3d == 0) return false;
223
                         if (sr->shw.nshwlid ==0) return false;
224
                         if (sr->vtx.elastic[0].vtx.fX < -140.0) return false;
225
                         if (sr->vtx.elastic[0].vtx.fX >  140.0) return false;
226
                         if (sr->vtx.elastic[0].vtx.fY < -140.0) return false;
227
                         if (sr->vtx.elastic[0].vtx.fY >  140.0) return false;
228
                         if (sr->vtx.elastic[0].vtx.fZ <  100.0) return false;
229
                         if (sr->vtx.elastic[0].vtx.fZ >  550.0) return false;
230
                         return true; 
231
                       });
232
      
233
     
234
      const Cut kNhitCut({"slc.nhit"},
235
                      [](const caf::StandardRecord* sr)
236
                      {
237
                        return (sr->slc.nhit > 20); 
238
                      });
239

    
240
    
241
      const Cut kShwStartStopCut({"sel.elecid.nshwlid","shw.shwlid.start.fX",
242
                       "shw.shwlid.start.fY",
243
                       "shw.shwlid.start.fZ",
244
                       "shw.shwlid.stop.fX",
245
                       "shw.shwlid.stop.fY",
246
                       "shw.shwlid.stop.fZ"},
247
                      [](const caf::StandardRecord* sr)
248
                      {
249
                        if (sr->sel.elecid.nshwlid ==0) return false;
250
                        for (unsigned int ix =0; ix<sr->sel.elecid.nshwlid; ++ix){
251
                          if (std::min(sr->shw.shwlid[ix].start.fX,sr->shw.shwlid[ix].stop.fX) < -180.0) return false;
252
                          if (std::max(sr->shw.shwlid[ix].start.fX,sr->shw.shwlid[ix].stop.fX) > 180.0) return false;
253
                          if (std::min(sr->shw.shwlid[ix].start.fY,sr->shw.shwlid[ix].stop.fY) < -180.0) return false;
254
                          if (std::max(sr->shw.shwlid[ix].start.fY,sr->shw.shwlid[ix].stop.fY) > 180.0) return false;
255
                          if (std::min(sr->shw.shwlid[ix].start.fZ,sr->shw.shwlid[ix].stop.fZ) < 25.0) return false;
256
                          if (std::max(sr->shw.shwlid[ix].start.fZ,sr->shw.shwlid[ix].stop.fZ) > 1225.0) return false;
257
                        }
258

    
259
                        return true; 
260
                      });
261

    
262
   
263
      const Cut kFuzzyKLenCut({"vtx.elastic.*", "vtx.elastic.npng3d"},
264
                       [](const caf::StandardRecord* sr)
265
                       {
266
                         if (sr->vtx.elastic[0].npng3d ==0) return false;
267
                         return sr->vtx.elastic[0].png3d[0].len < 600; 
268
                       });
269
      
270
    
271
      const Cut kSlcECut({"slc.calE"},
272
                       [](const caf::StandardRecord* sr)
273
                       {
274
                         return sr->slc.calE < 5.0; 
275
                       });
276

    
277
   
278
      const Cut kShwGapCut({"sel.elecid.shwlid.gap", "sel.elecid.nshwlid"},
279
                       [](const caf::StandardRecord* sr)
280
                       {
281
                         if (sr->sel.elecid.nshwlid ==0) return false;
282
                         return sr->sel.elecid.shwlid[0].gap < 150; 
283
                       });
284

    
285
   
286
      const Cut kIsMuonCut({"sel.elecid.shwlid.ismuon", "sel.elecid.nshwlid"},
287
                       [](const caf::StandardRecord* sr)
288
                       {
289
                         int n=0;
290
                         if (sr->sel.elecid.nshwlid > 0){
291
                           // std::cout << "Ok, No,of showers is more than 1***" <<std::endl;
292
                            for (unsigned int i=0; i<sr->sel.elecid.nshwlid; ++i){
293
                              // std::cout  << "No.of Showers " << "\t" <<sr->sel.elecid.nshwlid << "\t" << "Shower" << "\t" << i << " \t is" << "IsMuon: " << "\t" << sr->sel.elecid.shwlid[i].ismuon << std::endl;
294
                              if (sr->sel.elecid.shwlid[i].ismuon == 1){ ++n;
295
                                return false;}
296
                              else
297
                                return true;
298
                            }
299
                            return true;
300
                          }
301
                         // std::cout << "No.of Muons like:" << n << std::endl;
302
                         return false;                        
303
                       });
304

    
305
    
306
      const Cut kAnnCut({"sel.elecid.ann"},
307
                       [](const caf::StandardRecord* sr)
308
                       {
309
                         return sr->sel.elecid.ann > 0.7; 
310
                       });
311

    
312

    
313
      const Cut kTrueVertCut({"mc.nnu", "mc.nu.eff", "mc.nu.pur", "mc.nu.vtx.fX", "mc.nu.vtx.fY", "mc.nu.vtx.fZ"}, 
314
                             [](const caf::StandardRecord* sr){
315
                               if (sr->mc.nnu != 1) return false;
316
                               if (sr->mc.nu[0].eff < 0.85) return false;
317
                               if (sr->mc.nu[0].pur < 0.85) return false;
318
                               if (sr->mc.nu[0].vtx.fX < -140.0) return false;
319
                               if (sr->mc.nu[0].vtx.fX >  140.0) return false;
320
                               if (sr->mc.nu[0].vtx.fY < -140.0) return false;
321
                               if (sr->mc.nu[0].vtx.fY >  140.0) return false;
322
                               if (sr->mc.nu[0].vtx.fZ <  100.0) return false;
323
                               if (sr->mc.nu[0].vtx.fZ >  550.0) return false;
324
                               return true; 
325
                               
326
                             });
327

    
328

    
329
      ////////////////////////////////////////////
330
      ///////    Plot the variables //////////////
331
      ////////////////////////////////////////////
332

    
333

    
334

    
335
      //////   Each slice has vertex, one 3D fuzzyK prong and one shower  ///////
336

    
337
      const Var kDQ({"spill.spillpot"},
338
                         [](const caf::StandardRecord* sr)
339
                    {
340
                      //  f += sr->spill.spillpot;
341
                      // std::cout << "POT: " << "\t" << f << "\t" << sr->spill.spillpot  << "\t" << sr->spill.isgoodspill<< std::endl;        
342
                      return sr->spill.spillpot; 
343
                    });
344
      
345
      const Var kMCnVert({"mc.nnu", "vtx.nelastic"},   ////  For  MC
346
                             [](const caf::StandardRecord* sr){
347
                               if (sr->mc.nnu > 0) {
348
                                 // std::cout << "1" << std::endl;
349
                               return sr->vtx.nelastic;
350
                               }
351
                             });
352

    
353
      const Var knVert({"vtx.nelastic"},   ////  For  Data or All MC
354
                             [](const caf::StandardRecord* sr){        
355
                                                   
356
                               return sr->vtx.nelastic;
357
                             });
358

    
359
    
360

    
361
      const Var knShower({"vtx.nelastic", "shw.nshwlid"}, 
362
                             [](const caf::StandardRecord* sr){
363
                               // std::cout << "No.of Showers" << sr->vtx.nelastic << "\t" << sr->shw.nshwlid << std::endl;
364
                               if (sr->vtx.nelastic == 0 || sr->vtx.nelastic == 1)
365
                        
366
                               return sr->shw.nshwlid;
367
                                                             
368
                             });
369

    
370
      const Var knFuzzyK({"vtx.nelastic", "vtx.elastic.*"}, 
371
                         [](const caf::StandardRecord* sr){                          
372
                           if (sr->vtx.nelastic == 0) return (long unsigned int)0.0;
373
                             return sr->vtx.elastic[0].npng3d;
374
                                                 
375
                         });
376
      
377

    
378
      //////   Fiducial volume  ////////////////
379

    
380
      const Var kVertX({"vtx.nelastic", "vtx.elastic.vtx.fX"}, 
381
                       [](const caf::StandardRecord* sr){
382
                         if (sr->vtx.nelastic ==0) return -9999.0;
383
                         // std::cout << "5" << std::endl;       
384
                         return sr->vtx.elastic[0].vtx.fX;
385
                        
386
                       });
387

    
388
      const Var kVertY({"vtx.nelastic", "vtx.elastic.vtx.fY"}, 
389
                       [](const caf::StandardRecord* sr){
390
                         if (sr->vtx.nelastic ==0) return -9999.0; 
391
                              
392
                         return sr->vtx.elastic[0].vtx.fY; 
393
                         // std::cout << "6" << std::endl;      
394
                       });
395

    
396
      const Var kVertZ({"vtx.nelastic", "vtx.elastic.vtx.fZ"}, 
397
                       [](const caf::StandardRecord* sr){
398
                         if (sr->vtx.nelastic ==0) return -9999.0;
399
                         // std::cout << "7" << std::endl;                
400
                         return sr->vtx.elastic[0].vtx.fZ;
401
                
402
                       });
403
      
404

    
405
      //////   No.of hits in a slice  //////////
406

    
407
      const Var kSlcnHit({"slc.nhit"}, 
408
                             [](const caf::StandardRecord* sr){
409
                               // std::cout << "8" << std::endl;
410
                              return sr->slc.nhit;
411
                                                              
412
                             });
413

    
414

    
415
      //////  Shower containment  ///////////
416

    
417
      ////  Do we need 
418

    
419
      const Var kShwStartX({"sel.elecid.nshwlid", "shw.shwlid.start.fX"}, 
420
                             [](const caf::StandardRecord* sr){
421
                               if (sr->sel.elecid.nshwlid ==0) return -9999.0;
422
                               for (unsigned int ip=0; ip < sr->sel.elecid.nshwlid ; ++ip) {
423
                               return sr->shw.shwlid[ip].start.fX;
424
                               // std::cout << "9" << std::endl;
425
                               }                               
426
                             });
427

    
428
      const Var kShwStartY({"sel.elecid.nshwlid", "shw.shwlid.start.fY"}, 
429
                             [](const caf::StandardRecord* sr){
430
                               if (sr->sel.elecid.nshwlid ==0) return -9999.0;
431
                               for (unsigned int ip=0; ip < sr->sel.elecid.nshwlid; ++ip) {
432
                               return sr->shw.shwlid[ip].start.fY;
433
                               // std::cout << "10" << std::endl;
434
                               }                               
435
                             });
436

    
437
      const Var kShwStartZ({"sel.elecid.nshwlid", "shw.shwlid.start.fZ"}, 
438
                             [](const caf::StandardRecord* sr){
439
                               if (sr->sel.elecid.nshwlid ==0) return -9999.0;
440
                               for (unsigned int ip=0; ip < sr->sel.elecid.nshwlid; ++ip) {
441
                               return sr->shw.shwlid[ip].start.fZ;
442
                               // std::cout << "11" << std::endl;
443
                               }                               
444
                             });
445

    
446
      const Var kShwStopX({"sel.elecid.nshwlid", "shw.shwlid.stop.fX"}, 
447
                             [](const caf::StandardRecord* sr){
448
                               if (sr->sel.elecid.nshwlid ==0) return -9999.0;
449
                               for (unsigned int ip=0; ip < sr->sel.elecid.nshwlid; ++ip) {
450
                               return sr->shw.shwlid[ip].stop.fX;
451
                               // std::cout << "12" << std::endl;
452
                               }                               
453
                             });
454

    
455
      const Var kShwStopY({"sel.elecid.nshwlid", "shw.shwlid.stop.fY"}, 
456
                             [](const caf::StandardRecord* sr){
457
                               if (sr->sel.elecid.nshwlid ==0) return -9999.0;
458
                               for (unsigned int ip=0; ip < sr->sel.elecid.nshwlid; ++ip) {
459
                               return sr->shw.shwlid[ip].stop.fY;
460
                               }                               
461
                             });
462

    
463
      const Var kShwStopZ({"sel.elecid.nshwlid", "shw.shwlid.stop.fZ"}, 
464
                             [](const caf::StandardRecord* sr){
465
                               if (sr->sel.elecid.nshwlid ==0) return -9999.0;
466
                               for (unsigned int ip=0; ip < sr->sel.elecid.nshwlid; ++ip) {
467
                               return sr->shw.shwlid[ip].stop.fZ;
468
                               }                               
469
                             });
470

    
471

    
472
      //////  FuzzyK length  //////////////
473

    
474
      const Var kFuzzyKLen({"vtx.nelastic", "vtx.elastic.*"}, 
475
                             [](const caf::StandardRecord* sr){
476
                               if (sr->vtx.nelastic ==0) return 0.0f;
477
                               if (sr->vtx.elastic[0].npng3d == 0) return 0.0f;
478
                               return sr->vtx.elastic[0].png3d[0].len;
479
                               // std::cout << "13" << std::endl;                               
480
                             });
481

    
482

    
483
      //////   Slice Calorimetric energy  ///////
484

    
485
      const Var kSlcE({"slc.calE"}, 
486
                             [](const caf::StandardRecord* sr){
487
                               return sr->slc.calE;
488
                               // std::cout << "14" << std::endl;                                
489
                             });
490

    
491
      //////   Vertex to Shower start gap  ///////
492

    
493
      const Var kShwGap({"sel.elecid.nshwlid", "sel.elecid.shwlid.gap"}, 
494
                             [](const caf::StandardRecord* sr){
495
                               if (sr->sel.elecid.nshwlid > 0) {
496
                               return sr->sel.elecid.shwlid[0].gap;
497
                               // std::cout << "15" << std::endl;
498
                               }
499
                             });
500

    
501

    
502
      //////   IsMuon  //////////////////// 
503

    
504
      const Var kIsMuon({"sel.elecid.nshwlid", "sel.elecid.shwlid.ismuon"}, 
505
                             [](const caf::StandardRecord* sr){
506
                               if(sr->sel.elecid.nshwlid >0) {
507
                                 for (unsigned int ip=0; ip < sr->sel.elecid.nshwlid; ++ip) {
508
                                   return  sr->sel.elecid.shwlid[ip].ismuon;
509
                                 }
510
                               }
511
                             });
512
      
513

    
514
      /////////    End of All variables  ///////////////
515
      //////////////////////////////////////////////////
516

    
517

    
518

    
519
      const Var kAnn({"sel.elecid.ann"},
520
                       [](const caf::StandardRecord* sr)
521
                       {
522
                        
523
                         return sr->sel.elecid.ann; 
524
                       });
525
     
526
      const Var kNuX({"mc.nnu","mc.nu.vtx.fX"},
527
                     [](const caf::StandardRecord* sr){
528
                       if (sr->mc.nnu != 1) return -9999.0;
529
                       return sr->mc.nu[0].vtx.fX;
530
                     });
531
      const Var kNuY({"mc.nnu","mc.nu.vtx.fY"},
532
                     [](const caf::StandardRecord* sr){
533
                       if (sr->mc.nnu != 1) return -9999.0;
534
                       return sr->mc.nu[0].vtx.fY;
535
                     });
536
      const Var kNuZ({"mc.nnu","mc.nu.vtx.fZ"},
537
                     [](const caf::StandardRecord* sr){
538
                       if (sr->mc.nnu != 1) return -9999.0;
539
                       return sr->mc.nu[0].vtx.fZ;
540
                     });
541

    
542

    
543
     
544
      
545
      
546
// 250MeV bins
547

    
548
const Cut kAllCuts({"vtx.elastic.*",
549
                       "vtx.elastic.vtx.fX", 
550
                       "vtx.nelastic",
551
                       "vtx.elastic.vtx.fY",
552
                       "vtx.elastic.vtx.fZ",
553
                       "vtx.elastic.npng3d",
554
                       "vtx.elastic.npng2d",
555
                       "slc.calE","slc.nhit",
556
                       "slc.boxmin.fX",
557
                       "slc.boxmin.fY",
558
                       "slc.boxmin.fZ",
559
                       "slc.boxmax.fX",
560
                       "slc.boxmax.fY",
561
                       "slc.boxmax.fZ",
562
                       "shw.nshwlid",
563
                       "shw.shwlid.start.fX",
564
                       "shw.shwlid.start.fY",
565
                       "shw.shwlid.start.fZ",
566
                       "shw.shwlid.stop.fX",
567
                       "shw.shwlid.stop.fY",
568
                       "shw.shwlid.stop.fZ",
569
                       "mc.nu","mc.nnu",
570
                       "mc.nu.iscc",
571
                       "mc.nu.pdg",
572
                       "sel.elecid.ann",
573
                       "sel.elecid.shwlid.mulll",
574
                       "hdr.run","hdr.subrun",
575
                       "hdr.subevt","hdr.evt",
576
                       "mc.nu.vtx.fX",
577
                       "mc.nu.vtx.fY",
578
                       "mc.nu.vtx.fZ",
579
                       "sel.elecid.nshwlid",
580
                       "sel.elecid.shwlid.ismuon",
581
                       "sel.elecid.shwlid.gap"},
582
                        [](const caf::StandardRecord* sr)
583
                        {
584
                          nocut++;
585
                          if (sr->mc.nnu == 1){
586
                            if (sr->mc.nu[0].iscc == 0) nocutnc++;
587
                            else {
588
                              if (abs(sr->mc.nu[0].pdg) == 12) nocutnue++; 
589
                              if (abs(sr->mc.nu[0].pdg) == 14) nocutnumu++;
590
                            }
591
                          }
592
 
593
                          bool cut = false;
594

    
595

    
596
                      //*****Tian's tight cuts**********(goes with 1e20 pot scaling)
597
                          if (sr->vtx.nelastic ==0) return cut;
598
                          if (sr->vtx.elastic[0].npng3d == 0) return cut;
599
                          if (sr->shw.nshwlid ==0) return cut;
600

    
601
                          //if (sr->sel.elecid.ann <= -1) return cut;
602

    
603
                          selection++;
604
                          if (sr->mc.nnu == 1){
605
                            if (sr->mc.nu[0].iscc == 0) selectionnc++;
606
                            else {
607
                              if (abs(sr->mc.nu[0].pdg) == 12) selectionnue++; 
608
                              if (abs(sr->mc.nu[0].pdg) == 14) selectionnumu++;
609
                            }
610
                          } 
611

    
612

    
613
                          if (sr->vtx.elastic[0].vtx.fX < -140.0) return cut;
614
                          if (sr->vtx.elastic[0].vtx.fX >  140.0) return cut;
615
                          if (sr->vtx.elastic[0].vtx.fY < -140.0) return cut;
616
                          if (sr->vtx.elastic[0].vtx.fY >  140.0) return cut;
617
                          if (sr->vtx.elastic[0].vtx.fZ <  100.0) return cut;
618
                          if (sr->vtx.elastic[0].vtx.fZ >  550.0) return cut;
619
                          vertex++;
620
                          if (sr->mc.nnu == 1){
621
                            if (sr->mc.nu[0].iscc == 0) vertexnc++;
622
                            else {
623
                              if (abs(sr->mc.nu[0].pdg) == 12) vertexnue++; 
624
                              if (abs(sr->mc.nu[0].pdg) == 14) vertexnumu++;
625
                            }
626
                          }
627
                          if (sr->sel.elecid.ann > 0.7){ 
628
                            vertexh++;
629
                            if (sr->mc.nnu == 1){
630
                              if (sr->mc.nu[0].iscc == 0) vertexnch++;
631
                              else {
632
                                if (abs(sr->mc.nu[0].pdg) == 12) vertexnueh++; 
633
                                if (abs(sr->mc.nu[0].pdg) == 14) vertexnumuh++;
634
                              }
635
                            }
636
                          }
637

    
638
                          if (sr->slc.nhit < 20) return cut;
639

    
640
                          slice++;
641
                          if (sr->mc.nnu == 1){
642
                            if (sr->mc.nu[0].iscc == 0) slicenc++;
643
                            else {
644
                              if (abs(sr->mc.nu[0].pdg) == 12) slicenue++; 
645
                              if (abs(sr->mc.nu[0].pdg) == 14) slicenumu++;
646
                            }
647
                          } 
648

    
649
                          for (unsigned int ix =0; ix<sr->sel.elecid.nshwlid; ++ix){
650
                            if (std::min(sr->shw.shwlid[ix].start.fX,sr->shw.shwlid[ix].stop.fX) < -180.0) return cut;
651
                            if (std::max(sr->shw.shwlid[ix].start.fX,sr->shw.shwlid[ix].stop.fX) > 180.0) return cut;
652
                            if (std::min(sr->shw.shwlid[ix].start.fY,sr->shw.shwlid[ix].stop.fY) < -180.0) return cut;
653
                            if (std::max(sr->shw.shwlid[ix].start.fY,sr->shw.shwlid[ix].stop.fY) > 180.0) return cut;
654
                            if (std::min(sr->shw.shwlid[ix].start.fZ,sr->shw.shwlid[ix].stop.fZ) < 25.0) return cut;
655
                            if (std::max(sr->shw.shwlid[ix].start.fZ,sr->shw.shwlid[ix].stop.fZ) > 1225.0) return cut;
656
                          }
657
                          //if (sr->slc.nhit > 115) return cut;
658
                          if (std::min(sr->shw.shwlid[sr->sel.elecid.nshwlid-1].start.fX,sr->shw.shwlid[sr->sel.elecid.nshwlid-1].stop.fX) < -180.0) return cut;
659
                          if (std::max(sr->shw.shwlid[sr->sel.elecid.nshwlid-1].start.fX,sr->shw.shwlid[sr->sel.elecid.nshwlid-1].stop.fX) > 180.0) return cut;
660
                          if (std::min(sr->shw.shwlid[sr->sel.elecid.nshwlid-1].start.fY,sr->shw.shwlid[sr->sel.elecid.nshwlid-1].stop.fY) < -180.0) return cut;
661
                          if (std::max(sr->shw.shwlid[sr->sel.elecid.nshwlid-1].start.fY,sr->shw.shwlid[sr->sel.elecid.nshwlid-1].stop.fY) > 180.0) return cut;
662
                          if (std::min(sr->shw.shwlid[sr->sel.elecid.nshwlid-1].start.fZ,sr->shw.shwlid[sr->sel.elecid.nshwlid-1].stop.fZ) < 25.0) return cut;
663
                          if (std::max(sr->shw.shwlid[sr->sel.elecid.nshwlid-1].start.fZ,sr->shw.shwlid[sr->sel.elecid.nshwlid-1].stop.fZ) > 1225.0) return cut;
664

    
665
                          shower++;
666
                          if (sr->mc.nnu == 1){
667
                            if (sr->mc.nu[0].iscc == 0) showernc++;
668
                            else {
669
                              if (abs(sr->mc.nu[0].pdg) == 12) showernue++; 
670
                              if (abs(sr->mc.nu[0].pdg) == 14) showernumu++;
671
                            }
672
                          } 
673

    
674
                         //cut on longest fuzzyk 3d track length
675
                         if (sr->vtx.elastic[0].png3d[0].len > 600.0) return cut;
676

    
677
                          len++;
678
                          if (sr->mc.nnu == 1){
679
                            if (sr->mc.nu[0].iscc == 0) lennc++;
680
                            else {
681
                              if (abs(sr->mc.nu[0].pdg) == 12) lennue++; 
682
                              if (abs(sr->mc.nu[0].pdg) == 14) lennumu++;
683
                            }
684
                          }
685
                          if (sr->sel.elecid.ann > 0.7){ 
686
                            lenh++;
687
                            if (sr->mc.nnu == 1){
688
                              if (sr->mc.nu[0].iscc == 0) lennch++;
689
                              else {
690
                                if (abs(sr->mc.nu[0].pdg) == 12) lennueh++; 
691
                                if (abs(sr->mc.nu[0].pdg) == 14) lennumuh++;
692
                              }
693
                            }
694
                          } 
695

    
696

    
697

    
698
                          if (sr->sel.elecid.shwlid[0].gap > 150.0) return cut;
699

    
700
                          gap++;
701
                          if (sr->mc.nnu == 1){
702
                            if (sr->mc.nu[0].iscc == 0) gapnc++;
703
                            else {
704
                              if (abs(sr->mc.nu[0].pdg) == 12) gapnue++; 
705
                              if (abs(sr->mc.nu[0].pdg) == 14) gapnumu++;
706
                            }
707
                          }
708
                          if (sr->sel.elecid.ann > 0.7){ 
709
                            gaph++;
710
                            if (sr->mc.nnu == 1){
711
                              if (sr->mc.nu[0].iscc == 0) gapnch++;
712
                              else {
713
                                if (abs(sr->mc.nu[0].pdg) == 12) gapnueh++; 
714
                                if (abs(sr->mc.nu[0].pdg) == 14) gapnumuh++;
715
                              }
716
                            }
717
                          }
718

    
719
                          if (sr->sel.elecid.nshwlid > 0){
720
                            for (unsigned int i=0; i<sr->sel.elecid.nshwlid; ++i){
721
                              if (sr->sel.elecid.shwlid[i].ismuon == 1){
722
                   
723
                                return cut;
724
                              }
725
                            }
726
                          }
727

    
728
                          muon++;
729
                          if (sr->mc.nnu == 1){
730
                            if (sr->mc.nu[0].iscc == 0) muonnc++;
731
                            else {
732
                              if (abs(sr->mc.nu[0].pdg) == 12) muonnue++; 
733
                              if (abs(sr->mc.nu[0].pdg) == 14) muonnumu++;
734
                            }
735
                          }
736
                          if (sr->sel.elecid.ann > 0.7){ 
737
                            muonh++;
738
                            if (sr->mc.nnu == 1){
739
                              if (sr->mc.nu[0].iscc == 0) muonnch++;
740
                              else {
741
                                if (abs(sr->mc.nu[0].pdg) == 12) muonnueh++; 
742
                                if (abs(sr->mc.nu[0].pdg) == 14) muonnumuh++;
743
                              }
744
                            }
745
                          }
746

    
747
                          
748
                         cut = true;
749
                          return cut;
750
                        });
751

    
752
 const Cut kAllCuts2({"vtx.elastic.*","vtx.elastic.vtx.fX", "vtx.nelastic","vtx.elastic.vtx.fY","vtx.elastic.vtx.fZ",
753
                    "vtx.elastic.npng3d","vtx.elastic.npng2d","slc.calE","slc.nhit","slc.boxmin.fX","slc.boxmin.fY",
754
                    "slc.boxmin.fZ","slc.boxmax.fX","slc.boxmax.fY","slc.boxmax.fZ","shw.nshwlid","shw.shwlid.start.fX","shw.shwlid.start.fY","shw.shwlid.start.fZ",
755
                    "shw.shwlid.stop.fX","shw.shwlid.stop.fY","shw.shwlid.stop.fZ",
756
                    "mc.nu","mc.nnu","mc.nu.iscc","mc.nu.pdg","sel.elecid.shwlid.gap","sel.elecid.ann","sel.elecid.nshwlid","sel.elecid.shwlid.ismuon",
757
                    "hdr.run","hdr.subrun","hdr.evt","hdr.subevt","sel.lem.pid"},
758
                        [](const caf::StandardRecord* sr)
759
                        {
760
                          bool cut = false;
761
                          nocut2++;
762
                          //return true;
763
                          
764
                      //*****Tian's tight cuts**********(goes with 1e20 pot scaling)
765
                          if (sr->vtx.nelastic ==0) return cut;
766
                          if (sr->vtx.elastic[0].npng3d == 0) return cut;
767
                          if (sr->shw.nshwlid ==0) return cut;
768

    
769
                          selection2++;
770
 
771
                          if (sr->vtx.elastic[0].vtx.fX < -140.0) return cut;
772
                          if (sr->vtx.elastic[0].vtx.fX >  140.0) return cut;
773
                          if (sr->vtx.elastic[0].vtx.fY < -140.0) return cut;
774
                          if (sr->vtx.elastic[0].vtx.fY >  140.0) return cut;
775
                          if (sr->vtx.elastic[0].vtx.fZ <  100.0) return cut;
776
                          if (sr->vtx.elastic[0].vtx.fZ >  550.0) return cut;
777

    
778
                          vertex2++;
779
                          if (sr->sel.elecid.ann > 0.7) vertex2h++;
780

    
781

    
782
                          if (sr->slc.nhit < 20) return cut;
783

    
784
                          slice2++;
785

    
786
                          for (unsigned int ix =0; ix<sr->sel.elecid.nshwlid; ++ix){
787
                            if (std::min(sr->shw.shwlid[ix].start.fX,sr->shw.shwlid[ix].stop.fX) < -180.0) return cut;
788
                            if (std::max(sr->shw.shwlid[ix].start.fX,sr->shw.shwlid[ix].stop.fX) > 180.0) return cut;
789
                            if (std::min(sr->shw.shwlid[ix].start.fY,sr->shw.shwlid[ix].stop.fY) < -180.0) return cut;
790
                            if (std::max(sr->shw.shwlid[ix].start.fY,sr->shw.shwlid[ix].stop.fY) > 180.0) return cut;
791
                            if (std::min(sr->shw.shwlid[ix].start.fZ,sr->shw.shwlid[ix].stop.fZ) < 25.0) return cut;
792
                            if (std::max(sr->shw.shwlid[ix].start.fZ,sr->shw.shwlid[ix].stop.fZ) > 1225.0) return cut;
793
                          }
794

    
795
                          if (std::min(sr->shw.shwlid[sr->sel.elecid.nshwlid-1].start.fX,sr->shw.shwlid[sr->sel.elecid.nshwlid-1].stop.fX) < -180.0) return cut;
796
                          if (std::max(sr->shw.shwlid[sr->sel.elecid.nshwlid-1].start.fX,sr->shw.shwlid[sr->sel.elecid.nshwlid-1].stop.fX) > 180.0) return cut;
797
                          if (std::min(sr->shw.shwlid[sr->sel.elecid.nshwlid-1].start.fY,sr->shw.shwlid[sr->sel.elecid.nshwlid-1].stop.fY) < -180.0) return cut;
798
                          if (std::max(sr->shw.shwlid[sr->sel.elecid.nshwlid-1].start.fY,sr->shw.shwlid[sr->sel.elecid.nshwlid-1].stop.fY) > 180.0) return cut;
799
                          if (std::min(sr->shw.shwlid[sr->sel.elecid.nshwlid-1].start.fZ,sr->shw.shwlid[sr->sel.elecid.nshwlid-1].stop.fZ) < 25.0) return cut;
800
                          if (std::max(sr->shw.shwlid[sr->sel.elecid.nshwlid-1].start.fZ,sr->shw.shwlid[sr->sel.elecid.nshwlid-1].stop.fZ) > 1225.0) return cut;
801

    
802
                          shower2++;
803
  
804

    
805
                         //cut on longest fuzzyk 3d track length
806
                         if (sr->vtx.elastic[0].png3d[0].len > 600.0) return cut;
807

    
808
                          len2++;
809
                          if (sr->sel.elecid.ann > 0.7) len2h++;
810

    
811

    
812
                          // if (sr->slc.calE > 5.0) return cut;
813
                          // cale2++;
814
                          // if (sr->sel.elecid.ann > 0.7) cale2h++;
815

    
816
                          if (sr->sel.elecid.shwlid[0].gap > 150.0) return cut;
817

    
818
                          gap2++;
819
                          if (sr->sel.elecid.ann > 0.7) gap2h++;
820

    
821
                          if (sr->sel.elecid.nshwlid > 0){
822
                            for (unsigned int i=0; i<sr->sel.elecid.nshwlid; ++i){
823
                              if (sr->sel.elecid.shwlid[i].ismuon == 1) return cut;
824
                            }
825
                          }
826

    
827
                          muon2++;
828
                          if (sr->sel.elecid.ann > 0.7) muon2h++;
829

    
830

    
831

    
832

    
833
                          cut = true;
834
                          return cut;
835
                        });
836

    
837

    
838

    
839
  // Spectrum to be filled from the loader
840
// Spectrum len("Track length (cm)", bins, loader, kTrackLen, kIsNumuCC);
841

    
842
// Cuts Applied
843
//  kNumuCC  kIsNueCC  kNC  kDataQ   kFid   kNhit   kShwStartStop   kFuzzyKLen   kSlcE   kShwGap   kIsMuon   kAnn
844

    
845
   
846
 const Binning bins = Binning::Simple(100, 0, 1000);
847
 const Binning bins1 = Binning::Simple(100, 0, 5000);
848
 const Binning binsVtxy = Binning::Simple(100, -300, 300);
849
 const Binning binsVtz = Binning::Simple(170, -100, 1600); // 100 cm per bin, was (100, -100, 1600);
850
 
851
 const Binning binsnhit = Binning::Simple(100, 0, 1000);
852

    
853
 const Binning binsann = Binning::Simple(100, 0, 1);
854
 const Binning binsslcE = Binning::Simple(1200,0,120);   //100 MeV/bin, max 120. was (80, 0, 20);
855
 const Binning binsFuzzyK = Binning::Simple(160, 0, 1600); // 100cm bins, max 15m was (50, 0, 1000); 
856
 const Binning binsmuon = Binning::Simple(2, 0, 2);  // it is a yes-no choice
857

    
858
 const Binning binspot = Binning::Simple(30, 0, 30e+12);
859

    
860
 
861
 /////   NuMu Slc E  after each cuts
862

    
863
 Spectrum SpillPOT(" Spill POT", binspot, loader, kDQ, kDataQ);
864
 // Spectrum SpillPOT(" Spill POT", binspot, kDQ);
865

    
866
 ////////     Vertex X  ////////////////////////
867

    
868
Spectrum VertXNuMuCC(" VertXNuMuCC IsMuon cut", binsVtxy, loader, kVertX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kIsNuMuCC && kAnnCut);
869

    
870

    
871
 /////   Nue Slc E  after each cuts
872

    
873
 
874
 Spectrum VertXNueCC(" VertXNueCC IsMuon cut", binsVtxy, loader, kVertX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kIsNueCC && kAnnCut);
875

    
876

    
877
 /////   NC Slc E  after each cuts
878

    
879
 
880
 Spectrum VertXNC(" VertXNC IsMuon cut", binsVtxy, loader, kVertX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
881

    
882
 /////   All MC Slc E  after each cuts
883

    
884
 
885
 Spectrum VertXAllMC(" VertXAllMC IsMuon cut", binsVtxy, loader, kVertX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
886

    
887
 ////  Data  //////////
888

    
889
 
890
 Spectrum VertXData(" VertXData IsMuon cut", binsVtxy, loader, kVertX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
891

    
892

    
893

    
894
 ////////////  Vertex Y  ////////////////////
895

    
896

    
897
 
898
 Spectrum VertYNuMuCC(" VertYNuMuCC IsMuon cut", binsVtxy, loader, kVertY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
899

    
900

    
901

    
902

    
903
 Spectrum VertYNueCC(" VertYNueCC IsMuon cut", binsVtxy, loader, kVertY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
904

    
905

    
906
 /////   NC Slc E  after each cuts
907

    
908

    
909
 Spectrum VertYNC(" VertYNC IsMuon cut", binsVtxy, loader, kVertY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
910
 
911

    
912
 /////   All MC Slc E  after each cuts
913

    
914
 
915
 Spectrum VertYAllMC(" VertYAllMC IsMuon cut", binsVtxy, loader, kVertY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
916

    
917
 ////  Data  //////////
918

    
919
 Spectrum VertYData(" VertYData IsMuon cut", binsVtxy, loader, kVertY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
920

    
921

    
922
 ///////////////       Vertex Z   //////////////
923

    
924

    
925
 Spectrum VertZNuMuCC(" VertZNuMuCC IsMuon cut", binsVtz, loader, kVertZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
926

    
927

    
928

    
929
 Spectrum VertZNueCC(" VertZNueCC IsMuon cut", binsVtz, loader, kVertZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
930

    
931

    
932
 /////   NC Slc E  after each cuts
933

    
934
 
935
 Spectrum VertZNC(" VertZNC IsMuon cut", binsVtz, loader, kVertZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
936

    
937
 /////   All MC Slc E  after each cuts
938

    
939
 
940
 Spectrum VertZAllMC(" VertZAllMC IsMuon cut", binsVtz, loader, kVertZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
941

    
942
 ////  Data  //////////
943

    
944
 Spectrum VertZData(" VertZData IsMuon cut", binsVtz, loader, kVertZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
945

    
946

    
947
 ///////////   Slice nHits  ////////////
948

    
949

    
950
 Spectrum SlcnHitNuMuCC(" SlcnHitNuMuCC IsMuon cut", binsnhit, loader, kSlcnHit,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
951

    
952

    
953
 Spectrum SlcnHitNueCC(" SlcnHitNueCC IsMuon cut", binsnhit, loader, kSlcnHit,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
954

    
955

    
956
 /////   NC Slc E  after each cuts
957

    
958
 Spectrum SlcnHitNC(" SlcnHitNC IsMuon cut", binsnhit, loader, kSlcnHit,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
959

    
960
 /////   All MC Slc E  after each cuts
961

    
962
 Spectrum SlcnHitAllMC(" SlcnHitAllMC IsMuon cut", binsnhit, loader, kSlcnHit,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
963

    
964
 ////  Data  //////////
965

    
966
 Spectrum SlcnHitData(" SlcnHitData IsMuon cut", binsnhit, loader, kSlcnHit,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
967
 
968

    
969
 ////////////////////       Shower Start X   //////////
970

    
971
 Spectrum ShwStartXNuMuCC(" ShwStartXNuMuCC IsMuon cut", binsVtxy, loader, kShwStartX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
972

    
973

    
974
 Spectrum ShwStartXNueCC(" ShwStartXNueCC IsMuon cut", binsVtxy, loader, kShwStartX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
975

    
976

    
977
 /////   NC Slc E  after each cuts
978

    
979
 Spectrum ShwStartXNC(" ShwStartXNC IsMuon cut", binsVtxy, loader, kShwStartX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
980

    
981

    
982
 /////   All MC Slc E  after each cuts
983

    
984
 Spectrum ShwStartXAllMC(" ShwStartXAllMC IsMuon cut", binsVtxy, loader, kShwStartX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
985

    
986

    
987
 ////  Data  //////////
988

    
989
 Spectrum ShwStartXData(" ShwStartXData IsMuon cut", binsVtxy, loader, kShwStartX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
990

    
991

    
992

    
993
 /////////////   Shower Start Y  //////////////
994

    
995
 Spectrum ShwStartYNuMuCC(" ShwStartYNuMuCC IsMuon cut", binsVtxy, loader, kShwStartY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
996

    
997

    
998
 Spectrum ShwStartYNueCC(" ShwStartYNueCC IsMuon cut", binsVtxy, loader, kShwStartY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
999

    
1000

    
1001
 /////   NC Slc E  after each cuts
1002

    
1003
 Spectrum ShwStartYNC(" ShwStartYNC IsMuon cut", binsVtxy, loader, kShwStartY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
1004

    
1005

    
1006
 /////   All MC Slc E  after each cuts
1007

    
1008
 Spectrum ShwStartYAllMC(" ShwStartYAllMC IsMuon cut", binsVtxy, loader, kShwStartY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
1009

    
1010

    
1011
 ////  Data  //////////
1012

    
1013
 Spectrum ShwStartYData(" ShwStartYData IsMuon cut", binsVtxy, loader, kShwStartY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kAnnCut && kIsMuonCut);
1014

    
1015

    
1016
 /////////////   Shower Start Z  //////////////
1017

    
1018
 Spectrum ShwStartZNuMuCC(" ShwStartZNuMuCC IsMuon cut", binsVtz, loader, kShwStartZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
1019

    
1020
 Spectrum ShwStartZNueCC(" ShwStartZNueCC IsMuon cut", binsVtz, loader, kShwStartZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
1021

    
1022

    
1023
 /////   NC Slc E  after each cuts
1024

    
1025
 Spectrum ShwStartZNC(" ShwStartZNC IsMuon cut", binsVtz, loader, kShwStartZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
1026

    
1027
 /////   All MC Slc E  after each cuts
1028

    
1029
 Spectrum ShwStartZAllMC(" ShwStartZAllMC IsMuon cut", binsVtz, loader, kShwStartZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
1030

    
1031
 ////  Data  //////////
1032

    
1033
 Spectrum ShwStartZData(" ShwStartZData IsMuon cut", binsVtz, loader, kShwStartZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
1034

    
1035

    
1036

    
1037
 /////////////   Shower Stop X  //////////////
1038

    
1039

    
1040
 Spectrum ShwStopXNuMuCC(" ShwStopXNuMuCC IsMuon cut", binsVtxy, loader, kShwStopX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
1041

    
1042

    
1043
 Spectrum ShwStopXNueCC(" ShwStopXNueCC IsMuon cut", binsVtxy, loader, kShwStopX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
1044

    
1045

    
1046
 /////   NC Slc E  after each cuts
1047

    
1048
 Spectrum ShwStopXNC(" ShwStopXNC IsMuon cut", binsVtxy, loader, kShwStopX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
1049

    
1050

    
1051
 /////   All MC Slc E  after each cuts
1052

    
1053
 Spectrum ShwStopXAllMC(" ShwStopXAllMC IsMuon cut", binsVtxy, loader, kShwStopX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
1054

    
1055

    
1056
 ////  Data  //////////
1057

    
1058
 Spectrum ShwStopXData(" ShwStopXData IsMuon cut", binsVtxy, loader, kShwStopX,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
1059

    
1060

    
1061
 /////////////   Shower Stop Y  //////////////
1062

    
1063
 Spectrum ShwStopYNuMuCC(" ShwStopYNuMuCC IsMuon cut", binsVtxy, loader, kShwStopY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
1064

    
1065

    
1066
 Spectrum ShwStopYNueCC(" ShwStopYNueCC IsMuon cut", binsVtxy, loader, kShwStopY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
1067

    
1068

    
1069
 /////   NC Slc E  after each cuts
1070

    
1071
 Spectrum ShwStopYNC(" ShwStopYNC IsMuon cut", binsVtxy, loader, kShwStopY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
1072

    
1073

    
1074
 /////   All MC Slc E  after each cuts
1075

    
1076
 Spectrum ShwStopYAllMC(" ShwStopYAllMC IsMuon cut", binsVtxy, loader, kShwStopY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
1077

    
1078
 ////  Data  //////////
1079

    
1080
 Spectrum ShwStopYData(" ShwStopYData IsMuon cut", binsVtxy, loader, kShwStopY,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
1081

    
1082

    
1083
 /////////////   Shower Stop Z  //////////////
1084

    
1085

    
1086
 Spectrum ShwStopZNuMuCC(" ShwStopZNuMuCC IsMuon cut", binsVtz, loader, kShwStopZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
1087

    
1088

    
1089
 Spectrum ShwStopZNueCC(" ShwStopZNueCC IsMuon cut", binsVtz, loader, kShwStopZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
1090

    
1091

    
1092
 /////   NC Slc E  after each cuts
1093

    
1094
 Spectrum ShwStopZNC(" ShwStopZNC IsMuon cut", binsVtz, loader, kShwStopZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
1095

    
1096

    
1097
 /////   All MC Slc E  after each cuts
1098

    
1099
 Spectrum ShwStopZAllMC(" ShwStopZAllMC IsMuon cut", binsVtz, loader, kShwStopZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
1100

    
1101
 ////  Data  //////////
1102

    
1103
 Spectrum ShwStopZData(" ShwStopZData IsMuon cut", binsVtz, loader, kShwStopZ,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
1104

    
1105

    
1106
 /////////////   FuzzyK Length  //////////////
1107

    
1108
 Spectrum FuzzyKLenNuMuCC(" FuzzyKLenNuMuCC IsMuon cut", binsFuzzyK, loader, kFuzzyKLen,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
1109

    
1110

    
1111
 Spectrum FuzzyKLenNueCC(" FuzzyKLenNueCC IsMuon cut", binsFuzzyK, loader, kFuzzyKLen,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
1112

    
1113

    
1114
 /////   NC Slc E  after each cuts
1115

    
1116
 Spectrum FuzzyKLenNC(" FuzzyKLenNC IsMuon cut", binsFuzzyK, loader, kFuzzyKLen,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
1117

    
1118

    
1119

    
1120
 /////   All MC Slc E  after each cuts
1121

    
1122
 Spectrum FuzzyKLenAllMC(" FuzzyKLenAllMC IsMuon cut", binsFuzzyK, loader, kFuzzyKLen,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
1123

    
1124

    
1125

    
1126
 ////  Data  //////////
1127

    
1128
 Spectrum FuzzyKLenData(" FuzzyKLenData IsMuon cut", binsFuzzyK, loader, kFuzzyKLen,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
1129

    
1130

    
1131
 ////////////////   Slice Energy  ///////////
1132

    
1133

    
1134
 Spectrum SlcENuMuCC(" SlcENuMuCC IsMuon cut", binsslcE, loader, kSlcE,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
1135

    
1136

    
1137

    
1138
 /////   Nue Slc E  after each cuts
1139

    
1140
 Spectrum SlcENueCC(" SlcENueCC IsMuon cut", binsslcE, loader, kSlcE,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
1141

    
1142

    
1143
 /////   NC Slc E  after each cuts
1144
 
1145
 Spectrum SlcENC(" SlcENC IsMuon cut", binsslcE, loader, kSlcE,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
1146

    
1147
 /////   All MC Slc E  after each cuts
1148
 
1149
 Spectrum SlcEAllMC(" SlcEAllMC IsMuon cut", binsslcE, loader, kSlcE,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
1150

    
1151
 
1152
 Spectrum SlcEData(" SlcEData IsMuon cut", binsslcE, loader, kSlcE,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
1153

    
1154

    
1155

    
1156
 /////////   Shower Gap  /////////////////
1157

    
1158
 
1159
 Spectrum ShwGapNuMuCC(" ShwGapNuMuCC IsMuon cut", binsslcE, loader, kShwGap,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
1160

    
1161
 
1162
 Spectrum ShwGapNueCC(" ShwGapNueCC IsMuon cut", binsslcE, loader, kShwGap,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
1163

    
1164

    
1165
 /////   NC Slc E  after each cuts
1166
 
1167
 Spectrum ShwGapNC(" ShwGapNC IsMuon cut", binsslcE, loader, kShwGap,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
1168

    
1169
 /////   All MC Slc E  after each cuts
1170
 
1171
 Spectrum ShwGapAllMC(" ShwGapAllMC IsMuon cut", binsslcE, loader, kShwGap,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
1172

    
1173
 ////  Data  //////////
1174
 
1175
 Spectrum ShwGapData(" ShwGapData IsMuon cut", binsslcE, loader, kShwGap,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
1176

    
1177

    
1178

    
1179
 ///////////////   IsMuon   //////////////////
1180
 
1181
 Spectrum IsMuonNuMuCC(" IsMuonNuMuCC IsMuon cut", binsmuon, loader, kIsMuon,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNuMuCC);
1182

    
1183

    
1184
 
1185
 Spectrum IsMuonNueCC(" IsMuonNueCC IsMuon cut", binsmuon, loader, kIsMuon,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNueCC);
1186

    
1187

    
1188
 /////   NC Slc E  after each cuts
1189
 
1190
 Spectrum IsMuonNC(" IsMuonNC IsMuon cut", binsmuon, loader, kIsMuon,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsNC);
1191

    
1192

    
1193
 /////   All MC Slc E  after each cuts
1194
 
1195
 Spectrum IsMuonAllMC(" IsMuonAllMC IsMuon cut", binsmuon, loader, kIsMuon,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut && kIsAllMC);
1196

    
1197

    
1198
 ////  Data  //////////
1199
 
1200
 Spectrum IsMuonData(" IsMuonData IsMuon cut", binsmuon, loader, kIsMuon,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kAnnCut);
1201

    
1202

    
1203
 ////  Ann  after each cuts
1204
 
1205
 Spectrum AnnNuMuCC(" AnnNuMuCC IsMuon cut", binsann, loader, kAnn,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kIsNuMuCC);
1206

    
1207
 
1208
 Spectrum AnnNueCC(" AnnNueCC IsMuon cut", binsann, loader, kAnn,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kIsNueCC);
1209

    
1210
 
1211
 Spectrum AnnNC(" AnnNC IsMuon cut", binsann, loader, kAnn,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kIsNC);
1212
 
1213
 Spectrum AnnAllMC(" AnnAllMC IsMuon cut", binsann, loader, kAnn,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut && kIsAllMC);
1214

    
1215
 
1216
 Spectrum AnnData(" AnnData IsMuon cut", binsann, loader, kAnn,  kDataQ && kFidCut && kNhitCut && kShwStartStopCut && kFuzzyKLenCut && kShwGapCut && kIsMuonCut);
1217

    
1218
 
1219

    
1220
 ///////    Plot all standard Nue selection variables ////////////
1221

    
1222

    
1223
// kMCnVert
1224
// knVert
1225
// knFuzzyK
1226
// knShower
1227
// kVertX
1228
// kVertY
1229
// kVertZ
1230
// kSlcnHit
1231
// kShwStartX
1232
// kShwStartY
1233
// kShwStartZ
1234
// kShwStopX
1235
// kShwStopY
1236
// kShwStopZ
1237
// kFuzzyKLen
1238
// kSlcE
1239
// kShwGap
1240
// kIsMuon
1241

    
1242

    
1243
 //////   (1)
1244

    
1245
 const Binning binsnVert = Binning::Simple(2, 0, 2);
1246

    
1247

    
1248
 Spectrum MCnVert1("No.of Vertices ", binsnVert, loader, kMCnVert, kDataQ && kIsAllMC);
1249
 Spectrum MCnVert2("No.of Vertices ", binsnVert, loader, kMCnVert, kDataQ && kIsNuMuCC);
1250
 Spectrum MCnVert3("No.of Vertices ", binsnVert, loader, kMCnVert, kDataQ && kIsNC);
1251
 Spectrum MCnVert4("No.of Vertices ", binsnVert, loader, kMCnVert, kDataQ && kIsNueCC);
1252

    
1253
 Spectrum nVert("No.of Vertices Data", binsnVert, loader, knVert, kDataQ);
1254

    
1255

    
1256
 //////  (2)  No.of FuzzyK 3D prongs
1257

    
1258
  const Binning binsnFuzzyK = Binning::Simple(10, 0, 10);
1259

    
1260
  Spectrum nFuzzyK1("No.of FuzzyK 3D prongs ", binsnFuzzyK, loader, knFuzzyK, kDataQ && kIsAllMC);
1261
  Spectrum nFuzzyK2("No.of FuzzyK 3D prongs ", binsnFuzzyK, loader, knFuzzyK, kDataQ && kIsNuMuCC);
1262
  Spectrum nFuzzyK3("No.of FuzzyK 3D prongs ", binsnFuzzyK, loader, knFuzzyK, kDataQ && kIsNC);
1263
  Spectrum nFuzzyK4("No.of FuzzyK 3D prongs ", binsnFuzzyK, loader, knFuzzyK, kDataQ && kIsNueCC);
1264
  
1265
  Spectrum nFuzzyK("No.of FuzzyK 3D prongs ", binsnFuzzyK, loader, knFuzzyK, kDataQ);
1266
  
1267

    
1268
 //////  (3)  No.of Showers
1269

    
1270
 const Binning binsnShower = Binning::Simple(10, 0, 10);
1271

    
1272
 Spectrum nShower1("No.of Showers ", binsnShower, loader, knShower, kDataQ && kIsAllMC);
1273
 Spectrum nShower2("No.of Showers ", binsnShower, loader, knShower, kDataQ && kIsNuMuCC);
1274
 Spectrum nShower3("No.of Showers ", binsnShower, loader, knShower, kDataQ && kIsNC);
1275
 Spectrum nShower4("No.of Showers ", binsnShower, loader, knShower, kDataQ && kIsNueCC);
1276

    
1277
 Spectrum nShower("No.of Showers ", binsnShower, loader, knShower, kDataQ);
1278

    
1279

    
1280
 /////  (4)  Fiducial Cuts
1281

    
1282
 const Binning binsVertXY = Binning::Simple(60, -300, 300);
1283
 const Binning binsVertZ = Binning::Simple(170, -100, 1600);
1284

    
1285
 Spectrum VertX1("Vertex X ", binsVertXY, loader, kVertX, kDataQ && kIsAllMC);
1286
 Spectrum VertX2("Vertex X2 ", binsVertXY, loader, kVertX, kDataQ && kIsNuMuCC);
1287
 Spectrum VertX3("Vertex X3", binsVertXY, loader, kVertX, kDataQ && kIsNC);
1288
 Spectrum VertX4("Vertex X4 ", binsVertXY, loader, kVertX, kDataQ && kIsNueCC);
1289

    
1290
 Spectrum VertY1("Vertex X ", binsVertXY, loader, kVertY, kDataQ && kIsAllMC);
1291
 Spectrum VertY2("Vertex X ", binsVertXY, loader, kVertY, kDataQ && kIsNuMuCC);
1292
 Spectrum VertY3("Vertex X ", binsVertXY, loader, kVertY, kDataQ && kIsNC);
1293
 Spectrum VertY4("Vertex X ", binsVertXY, loader, kVertY, kDataQ && kIsNueCC);
1294

    
1295
 Spectrum VertZ1("Vertex X ", binsVertZ, loader, kVertZ, kDataQ && kIsAllMC);
1296
 Spectrum VertZ2("Vertex X ", binsVertZ, loader, kVertZ, kDataQ && kIsNuMuCC);
1297
 Spectrum VertZ3("Vertex X ", binsVertZ, loader, kVertZ, kDataQ && kIsNC);
1298
 Spectrum VertZ4("Vertex X ", binsVertZ, loader, kVertZ, kDataQ && kIsNueCC);
1299

    
1300
 Spectrum VertX("Vertex X ", binsVertXY, loader, kVertX, kDataQ);
1301
 Spectrum VertY("Vertex Y ", binsVertXY, loader, kVertY, kDataQ);
1302
 Spectrum VertZ("Vertex Z ", binsVertZ, loader, kVertZ, kDataQ);
1303

    
1304

    
1305

    
1306
 /////  (5)  No.of Hits in a Slice
1307

    
1308
 const Binning binsnHit = Binning::Simple(100, 0, 1000);
1309

    
1310
 Spectrum SlcnHit1("No of Hits in a Slice ", binsnHit, loader, kSlcnHit, kDataQ && kIsAllMC);
1311
 Spectrum SlcnHit2("No of Hits in a Slice ", binsnHit, loader, kSlcnHit, kDataQ && kIsNuMuCC);
1312
 Spectrum SlcnHit3("No of Hits in a Slice ", binsnHit, loader, kSlcnHit, kDataQ && kIsNC);
1313
 Spectrum SlcnHit4("No of Hits in a Slice ", binsnHit, loader, kSlcnHit, kDataQ && kIsNueCC);
1314

    
1315
 Spectrum SlcnHit("No of Hits in a Slice ", binsnHit, loader, kSlcnHit, kDataQ);
1316

    
1317

    
1318
 /////  (6) Shower Start and Stop
1319

    
1320
 const Binning binsShwXY = Binning::Simple(30, -300, 300);
1321
 const Binning binsShwZ = Binning::Simple(180, -100, 1700); //(90, -100, 1700);
1322

    
1323
 Spectrum ShwStartX1(" Shower Start X ", binsShwXY, loader, kShwStartX, kDataQ && kIsAllMC);
1324
 Spectrum ShwStartX2(" Shower Start X ", binsShwXY, loader, kShwStartX, kDataQ && kIsNuMuCC);
1325
 Spectrum ShwStartX3(" Shower Start X ", binsShwXY, loader, kShwStartX, kDataQ && kIsNC);
1326
 Spectrum ShwStartX4(" Shower Start X ", binsShwXY, loader, kShwStartX, kDataQ && kIsNueCC);
1327

    
1328
 Spectrum ShwStartY1(" Shower Start Y ", binsShwXY, loader, kShwStartY, kDataQ && kIsAllMC);
1329
 Spectrum ShwStartY2(" Shower Start Y ", binsShwXY, loader, kShwStartY, kDataQ && kIsNuMuCC);
1330
 Spectrum ShwStartY3(" Shower Start Y ", binsShwXY, loader, kShwStartY, kDataQ && kIsNC);
1331
 Spectrum ShwStartY4(" Shower Start Y ", binsShwXY, loader, kShwStartY, kDataQ && kIsNueCC);
1332

    
1333
 Spectrum ShwStartZ1(" Shower Start Z ", binsShwZ, loader, kShwStartZ, kDataQ && kIsAllMC);
1334
 Spectrum ShwStartZ2(" Shower Start Z ", binsShwZ, loader, kShwStartZ, kDataQ && kIsNuMuCC);
1335
 Spectrum ShwStartZ3(" Shower Start Z ", binsShwZ, loader, kShwStartZ, kDataQ && kIsNC);
1336
 Spectrum ShwStartZ4(" Shower Start Z ", binsShwZ, loader, kShwStartZ, kDataQ && kIsNueCC);
1337

    
1338
 Spectrum ShwStartX(" Shower Start X ", binsShwXY, loader, kShwStartX, kDataQ);
1339
 Spectrum ShwStartY(" Shower Start Y ", binsShwXY, loader, kShwStartY, kDataQ);
1340
 Spectrum ShwStartZ(" Shower Start Z ", binsShwZ, loader, kShwStartZ, kDataQ);
1341

    
1342

    
1343
 Spectrum ShwStopX1(" Shower Stop X ", binsShwXY, loader, kShwStopX, kDataQ && kIsAllMC);
1344
 Spectrum ShwStopX2(" Shower Stop X ", binsShwXY, loader, kShwStopX, kDataQ && kIsNuMuCC);
1345
 Spectrum ShwStopX3(" Shower Stop X ", binsShwXY, loader, kShwStopX, kDataQ && kIsNC);
1346
 Spectrum ShwStopX4(" Shower Stop X ", binsShwXY, loader, kShwStopX, kDataQ && kIsNueCC);
1347

    
1348
 Spectrum ShwStopY1(" Shower Stop Y ", binsShwXY, loader, kShwStopY, kDataQ && kIsAllMC);
1349
 Spectrum ShwStopY2(" Shower Stop Y ", binsShwXY, loader, kShwStopY, kDataQ && kIsNuMuCC);
1350
 Spectrum ShwStopY3(" Shower Stop Y ", binsShwXY, loader, kShwStopY, kDataQ && kIsNC);
1351
 Spectrum ShwStopY4(" Shower Stop Y ", binsShwXY, loader, kShwStopY, kDataQ && kIsNueCC);
1352

    
1353
 Spectrum ShwStopZ1(" Shower Stop Z ", binsShwZ, loader, kShwStopZ, kDataQ && kIsAllMC);
1354
 Spectrum ShwStopZ2(" Shower Stop Z ", binsShwZ, loader, kShwStopZ, kDataQ && kIsNuMuCC);
1355
 Spectrum ShwStopZ3(" Shower Stop Z ", binsShwZ, loader, kShwStopZ, kDataQ && kIsNC);
1356
 Spectrum ShwStopZ4(" Shower Stop Z ", binsShwZ, loader, kShwStopZ, kDataQ && kIsNueCC);
1357

    
1358
 Spectrum ShwStopX(" Shower Stop X ", binsShwXY, loader, kShwStopX, kDataQ);
1359
 Spectrum ShwStopY(" Shower Stop Y ", binsShwXY, loader, kShwStopY, kDataQ);
1360
 Spectrum ShwStopZ(" Shower Stop Z ", binsShwZ, loader, kShwStopZ, kDataQ);
1361

    
1362

    
1363
 /////  (7)  FuzzyK length
1364

    
1365
 // const Binning binsFuzzyK = Binning::Simple(50, 0, 1000);
1366

    
1367
 Spectrum FuzzyKLen1(" FuzzyK Length ", binsFuzzyK, loader, kFuzzyKLen, kDataQ && kIsAllMC);
1368
 Spectrum FuzzyKLen2(" FuzzyK Length ", binsFuzzyK, loader, kFuzzyKLen, kDataQ && kIsNuMuCC);
1369
 Spectrum FuzzyKLen3(" FuzzyK Length ", binsFuzzyK, loader, kFuzzyKLen, kDataQ && kIsNC);
1370
 Spectrum FuzzyKLen4(" FuzzyK Length ", binsFuzzyK, loader, kFuzzyKLen, kDataQ && kIsNueCC);
1371

    
1372
 Spectrum FuzzyKLen(" FuzzyK Length ", binsFuzzyK, loader, kFuzzyKLen, kDataQ);
1373

    
1374
 /////  (8)  Slice CalE
1375

    
1376
 const Binning binsSlcE = Binning::Simple(1200, 0 , 120);  //(40, 0, 10); 
1377

    
1378
 Spectrum SlcE1(" Slice CalE ", binsSlcE, loader, kSlcE, kDataQ && kIsAllMC);
1379
 Spectrum SlcE2(" Slice CalE ", binsSlcE, loader, kSlcE, kDataQ && kIsNuMuCC);
1380
 Spectrum SlcE3(" Slice CalE ", binsSlcE, loader, kSlcE, kDataQ && kIsNC);
1381
 Spectrum SlcE4(" Slice CalE ", binsSlcE, loader, kSlcE, kDataQ && kIsNueCC);
1382

    
1383
 Spectrum SlcE(" Slice CalE ", binsSlcE, loader, kSlcE, kDataQ);//&& is_data
1384

    
1385

    
1386
 /////  (9)  Shower Gap
1387

    
1388
 const Binning binsShwGap = Binning::Simple(25, 0, 500);  // 25cm bins , max 500cm
1389

    
1390
 Spectrum ShwGap1(" Shower Gap ", binsShwGap, loader, kShwGap, kDataQ && kIsAllMC);
1391
 Spectrum ShwGap2(" Shower Gap ", binsShwGap, loader, kShwGap, kDataQ && kIsNuMuCC);
1392
 Spectrum ShwGap3(" Shower Gap ", binsShwGap, loader, kShwGap, kDataQ && kIsNC);
1393
 Spectrum ShwGap4(" Shower Gap ", binsShwGap, loader, kShwGap, kDataQ && kIsNueCC);
1394

    
1395
 Spectrum ShwGap(" Shower Gap ", binsShwGap, loader, kShwGap, kDataQ); //&& is_data
1396

    
1397

    
1398
 /////  (10)  IsMuon
1399

    
1400
 const Binning binsIsMuon = Binning::Simple(2, 0, 2);  // it is a yes-no choice
1401

    
1402
 Spectrum IsMuon1(" IsMuon ", binsIsMuon, loader, kIsMuon, kDataQ && kIsAllMC);
1403
 Spectrum IsMuon2(" IsMuon ", binsIsMuon, loader, kIsMuon, kDataQ && kIsNuMuCC);
1404
 Spectrum IsMuon3(" IsMuon ", binsIsMuon, loader, kIsMuon, kDataQ && kIsNC);
1405
 Spectrum IsMuon4(" IsMuon ", binsIsMuon, loader, kIsMuon, kDataQ && kIsNueCC);
1406

    
1407
 Spectrum IsMuon(" IsMuon ", binsIsMuon, loader, kIsMuon, kDataQ);
1408

    
1409

    
1410
 //////  MC //////////
1411

    
1412
 Spectrum SlcEAfterTrueVertCutNueCC(" SlcE after True Vertex cut NueCC", binsslcE, loader, kSlcE, kDataQ && kTrueVertCut && kIsNueCC);
1413
 Spectrum SlcEAfterTrueVertCutNuMuCC(" SlcE after True Vertex cut NuMuCC", binsslcE, loader, kSlcE, kDataQ && kTrueVertCut && kIsNuMuCC);
1414
 Spectrum SlcEAfterTrueVertCutNC(" SlcE after True Vertex cut NC", binsslcE, loader, kSlcE, kDataQ && kTrueVertCut && kIsNC);
1415
 Spectrum SlcEAfterTrueVertCutAllMC(" SlcE after True Vertex cut AllMC", binsslcE, loader, kSlcE, kDataQ && kTrueVertCut);
1416

    
1417

    
1418

    
1419
 Spectrum SlcEAfterAllCutNueCC(" SlcE after All cut NueCC", binsslcE, loader, kSlcE, kDataQ && kAllCuts && kAnnCut && kIsNueCC);
1420
 Spectrum SlcEAfterAllCutNuMuCC(" SlcE after All cut NuMuCC", binsslcE, loader, kSlcE, kDataQ && kAllCuts && kAnnCut && kIsNuMuCC);
1421
 Spectrum SlcEAfterAllCutNC(" SlcE after All cut NC", binsslcE, loader, kSlcE, kDataQ && kAllCuts && kAnnCut && kIsNC);
1422
 Spectrum SlcEAfterAllCutAllMC(" SlcE after All cut All MC", binsslcE, loader, kSlcE, kDataQ && kAllCuts && kAnnCut);
1423

    
1424

    
1425
 /// Data //
1426

    
1427
 Spectrum SlcEAfterVertCutData(" SlcE after Vertex cut Data", binsslcE, loader, kSlcE, kDataQ && kFidCut);
1428
 Spectrum SlcEAfterAllCutData(" SlcE after selection Data", binsslcE, loader, kSlcE, kDataQ && kAllCuts2 && kAnnCut);
1429

    
1430
  // Do it!
1431
  loader.Go();
1432

    
1433
  // How to scale histograms
1434
  const double pot = 5.87185e+19;
1435

    
1436
/*-- output file---*/  const char* foutname = "test_cafAna_hist.root"; 
1437
                                std::cout << "ouput file Name: " << foutname << std::endl;
1438
                                TFile *hist = new TFile(foutname, "recreate");
1439

    
1440
  // We have histograms
1441

    
1442
  saveHist(SpillPOT,"Spill_POT");
1443

    
1444

    
1445
  saveHist(VertXNuMuCC,"VertX_NuMuCC");
1446

    
1447
  saveHist(VertXNueCC,"VertX_NueCC"); 
1448

    
1449
  saveHist(VertXNC,"VertX_NC"); 
1450
  
1451
  saveHist(VertXAllMC,"VertX_AllMC"); 
1452

    
1453
  saveHist(VertXData,"VertX_Data"); 
1454

    
1455
  ///////////  Vertex Y  ////////
1456

    
1457

    
1458
  saveHist(VertYNuMuCC,"VertY_NuMuCC"); 
1459

    
1460
  saveHist(VertYNueCC,"VertY_NueCC"); 
1461

    
1462
  saveHist(VertYNC,"VertY_NC"); 
1463
  
1464
  saveHist(VertYAllMC,"VertY_AllMC"); 
1465

    
1466
  saveHist(VertYData,"VertY_Data"); 
1467

    
1468
  //////////////  Vertex Z  ////////
1469

    
1470

    
1471
  saveHist(VertZNuMuCC,"VertZ_NuMuCC"); 
1472

    
1473
  saveHist(VertZNueCC,"VertZ_NueCC"); 
1474

    
1475
  saveHist(VertZNC,"VertZ_NC"); 
1476
  
1477
  saveHist(VertZAllMC,"VertZ_AllMC"); 
1478

    
1479
  saveHist(VertZData,"VertZ_Data"); 
1480

    
1481

    
1482
  //////////   Slice NHits  //////
1483

    
1484

    
1485
  saveHist(SlcnHitNuMuCC,"SlcnHit_NuMuCC"); 
1486

    
1487
  saveHist(SlcnHitNueCC,"SlcnHit_NueCC"); 
1488

    
1489
  saveHist(SlcnHitNC,"SlcnHit_NC"); 
1490
  
1491
  saveHist(SlcnHitAllMC,"SlcnHit_AllMC"); 
1492

    
1493
  saveHist(SlcnHitData,"SlcnHit_Data"); 
1494

    
1495

    
1496

    
1497

    
1498
  //////////////  Shower Start X //////
1499

    
1500

    
1501
  saveHist(ShwStartXNuMuCC,"ShwStartX_NuMuCC"); 
1502

    
1503
  saveHist(ShwStartXNueCC,"ShwStartX_NueCC"); 
1504

    
1505
  saveHist(ShwStartXNC,"ShwStartX_NC"); 
1506
  
1507
  saveHist(ShwStartXAllMC,"ShwStartX_AllMC"); 
1508

    
1509
  saveHist(ShwStartXData,"ShwStartX_Data"); 
1510

    
1511
  ///////////  Shower Start Y ///////
1512

    
1513

    
1514
  saveHist(ShwStartYNuMuCC,"ShwStartY_NuMuCC"); 
1515

    
1516
  saveHist(ShwStartYNueCC,"ShwStartY_NueCC"); 
1517

    
1518
  saveHist(ShwStartYNC,"ShwStartY_NC"); 
1519
  
1520
  saveHist(ShwStartYAllMC,"ShwStartY_AllMC"); 
1521

    
1522
  saveHist(ShwStartYData,"ShwStartY_Data"); 
1523

    
1524
  ////////////   Shower start Z //////
1525

    
1526

    
1527
  saveHist(ShwStartZNuMuCC,"ShwStartZ_NuMuCC"); 
1528

    
1529
  saveHist(ShwStartZNueCC,"ShwStartZ_NueCC"); 
1530

    
1531
  saveHist(ShwStartZNC,"ShwStartZ_NC"); 
1532
  
1533
  saveHist(ShwStartZAllMC,"ShwStartZ_AllMC"); 
1534

    
1535
  saveHist(ShwStartZData,"ShwStartZ_Data"); 
1536

    
1537
  /////////////  Shower Stop X  ///////
1538

    
1539

    
1540
  saveHist(ShwStopXNuMuCC,"ShwStopX_NuMuCC"); 
1541

    
1542
  saveHist(ShwStopXNueCC,"ShwStopX_NueCC"); 
1543

    
1544
  saveHist(ShwStopXNC,"ShwStopX_NC"); 
1545
  
1546
  saveHist(ShwStopXAllMC,"ShwStopX_AllMC"); 
1547

    
1548
  saveHist(ShwStopXData,"ShwStopX_Data"); 
1549

    
1550
  ///////////  Shower Stop Y /////
1551

    
1552
  saveHist(ShwStopYNuMuCC,"ShwStopY_NuMuCC"); 
1553

    
1554
  saveHist(ShwStopYNueCC,"ShwStopY_NueCC"); 
1555

    
1556
  saveHist(ShwStopYNC,"ShwStopY_NC"); 
1557
  
1558
  saveHist(ShwStopYAllMC,"ShwStopY_AllMC"); 
1559

    
1560
  saveHist(ShwStopYData,"ShwStopY_Data"); 
1561

    
1562
  /////////////  Shwower stop Z ////////
1563

    
1564
  saveHist(ShwStopZNuMuCC,"ShwStopZ_NuMuCC");  
1565

    
1566
  saveHist(ShwStopZNueCC,"ShwStopZ_NueCC"); 
1567

    
1568
  saveHist(ShwStopZNC,"ShwStopZ_NC"); 
1569
  
1570
  saveHist(ShwStopZAllMC,"ShwStopZ_AllMC"); 
1571

    
1572
  saveHist(ShwStopZData,"ShwStopZ_Data"); 
1573

    
1574

    
1575
  ////////////  FuzzyK Length //////
1576

    
1577

    
1578
  saveHist(FuzzyKLenNuMuCC,"FuzzyKLen_NuMuCC"); 
1579

    
1580
  saveHist(FuzzyKLenNueCC,"FuzzyKLen_NueCC"); 
1581

    
1582
  saveHist(FuzzyKLenNC,"FuzzyKLen_NC"); 
1583
  
1584
  saveHist(FuzzyKLenAllMC,"FuzzyKLen_AllMC"); 
1585

    
1586
  saveHist(FuzzyKLenData,"FuzzyKLen_Data"); 
1587

    
1588

    
1589
  ///////////  Slice Energy  //////////////////
1590

    
1591
  saveHist(SlcENuMuCC,"SlcE_NuMuCC"); 
1592

    
1593
  saveHist(SlcENueCC,"SlcE_NueCC"); 
1594

    
1595
  saveHist(SlcENC,"SlcE_NC"); 
1596
  
1597
  saveHist(SlcEAllMC,"SlcE_AllMC"); 
1598

    
1599
  saveHist(SlcEData,"SlcE_Data"); 
1600

    
1601

    
1602
  ///////////   IsMuon  ////////
1603

    
1604

    
1605
  saveHist(IsMuonNuMuCC,"IsMuon_NuMuCC"); 
1606

    
1607
  saveHist(IsMuonNueCC,"IsMuon_NueCC"); 
1608

    
1609
  saveHist(IsMuonNC,"IsMuon_NC"); 
1610
  
1611
  saveHist(IsMuonAllMC,"IsMuon_AllMC"); 
1612

    
1613
  saveHist(IsMuonData,"IsMuon_Data"); 
1614

    
1615
  /////////   Ann  ///////////////
1616

    
1617
  saveHist(AnnNuMuCC,"Ann_NuMuCC"); 
1618
  // saveHist(AnnNuMuCC8,"Ann8_NuMuCC");
1619

    
1620
  saveHist(AnnNueCC,"Ann_NueCC"); 
1621

    
1622
  saveHist(AnnNC,"Ann_NC"); 
1623
  
1624
  saveHist(AnnAllMC,"Ann_AllMC"); 
1625

    
1626
  saveHist(AnnData,"Ann_Data"); 
1627

    
1628

    
1629

    
1630
  saveHist(SlcEAfterTrueVertCutNueCC, "SlcEAfterTrueVertCut_NueCC");
1631
  saveHist(SlcEAfterTrueVertCutNuMuCC, "SlcEAfterTrueVertCut_NuMuCC");
1632
  saveHist(SlcEAfterTrueVertCutNC, "SlcEAfterTrueVertCut_NC");
1633
  saveHist(SlcEAfterTrueVertCutAllMC, "SlcEAfterTrueVertCut_AllMC");
1634

    
1635

    
1636
  saveHist(SlcEAfterAllCutNueCC, "SlcEAfterAllCut_NueCC");
1637
  saveHist(SlcEAfterAllCutNuMuCC, "SlcEAfterAllCut_NuMuCC");
1638
  saveHist(SlcEAfterAllCutNC, "SlcEAfterAllCut_NC");
1639
  saveHist(SlcEAfterAllCutAllMC, "SlcEAfterAllCut_AllMC");
1640

    
1641

    
1642
  saveHist (SlcEAfterVertCutData, "SlcEAfterVertCutData");
1643
  saveHist (SlcEAfterAllCutData, "SlcEAfterAllCutData");
1644

    
1645

    
1646
  saveHist(MCnVert1, "MCnVert_AllMC");
1647
  saveHist(MCnVert2, "MCnVert_NuMuCC");
1648
  saveHist(MCnVert3, "MCnVert_NC");
1649
  saveHist(MCnVert4, "MCnVert_NueCC");
1650

    
1651
  saveHist(nFuzzyK1,"nFuzzyK_AllMC");
1652
  saveHist(nFuzzyK2,"nFuzzyK_NuMuCC");
1653
  saveHist(nFuzzyK3,"nFuzzyK_NC");
1654
  saveHist(nFuzzyK4,"nFuzzyK_NueCC");
1655

    
1656
  saveHist(nShower1,"nShower_AllMC");
1657
  saveHist(nShower2,"nShower_NuMuCC");
1658
  saveHist(nShower3,"nShower_NC");
1659
  saveHist(nShower4,"nShower_NueCC");
1660

    
1661
  saveHist(VertX1,"VertX_AllMC");
1662
  saveHist(VertX2,"VertX_NuMuCC");
1663
  saveHist(VertX3,"VertX_NC");
1664
  saveHist(VertX4,"VertX_NueCC");
1665

    
1666
  saveHist(VertY1,"VertY_AllMC");
1667
  saveHist(VertY2,"VertY_NuMuCC");
1668
  saveHist(VertY3,"VertY_NC");
1669
  saveHist(VertY4,"VertY_NueCC");
1670

    
1671
  saveHist(VertZ1,"VertZ_AllMC");
1672
  saveHist(VertZ2,"VertZ_NuMuCC");
1673
  saveHist(VertZ3,"VertZ_NC");
1674
  saveHist(VertZ4,"VertZ_NueCC");
1675

    
1676
  saveHist(SlcnHit1,"SlcnHit_AllMC");
1677
  saveHist(SlcnHit2,"SlcnHit_NuMuCC");
1678
  saveHist(SlcnHit3,"SlcnHit_NC");
1679
  saveHist(SlcnHit4,"SlcnHit_NueCC");
1680

    
1681
  saveHist(ShwStartX1,"ShwStartX_AllMC");
1682
  saveHist(ShwStartX2,"ShwStartX_NuMuCC");
1683
  saveHist(ShwStartX3,"ShwStartX_NC");
1684
  saveHist(ShwStartX4,"ShwStartX_NueCC");
1685

    
1686
  saveHist(ShwStartY1,"ShwStartY_AllMC");
1687
  saveHist(ShwStartY2,"ShwStartY_NuMuCC");
1688
  saveHist(ShwStartY3,"ShwStartY_NC");
1689
  saveHist(ShwStartY4,"ShwStartY_NueCC");
1690

    
1691
  saveHist(ShwStartZ1,"ShwStartZ_AllMC");
1692
  saveHist(ShwStartZ2,"ShwStartZ_NuMuCC");
1693
  saveHist(ShwStartZ3,"ShwStartZ_NC");
1694
  saveHist(ShwStartZ4,"ShwStartZ_NueCC");
1695

    
1696
  saveHist(ShwStopX1,"ShwStopX_AllMC");
1697
  saveHist(ShwStopX2,"ShwStopX_NuMuCC");
1698
  saveHist(ShwStopX3,"ShwStopX_NC");
1699
  saveHist(ShwStopX4,"ShwStopX_NueCC");
1700

    
1701
  saveHist(ShwStopY1,"ShwStopY_AllMC");
1702
  saveHist(ShwStopY2,"ShwStopY_NuMuCC");
1703
  saveHist(ShwStopY3,"ShwStopY_NC");
1704
  saveHist(ShwStopY4,"ShwStopY_NueCC");
1705

    
1706
  saveHist(ShwStopZ1,"ShwStopZ_AllMC");
1707
  saveHist(ShwStopZ2,"ShwStopZ_NuMuCC");
1708
  saveHist(ShwStopZ3,"ShwStopZ_NC");
1709
  saveHist(ShwStopZ4,"ShwStopZ_NueCC");
1710

    
1711
  saveHist(FuzzyKLen1,"FuzzyKLen_AllMC");
1712
  saveHist(FuzzyKLen2,"FuzzyKLen_NuMuCC");
1713
  saveHist(FuzzyKLen3,"FuzzyKLen_NC");
1714
  saveHist(FuzzyKLen4,"FuzzyKLen_NueCC");
1715

    
1716
  saveHist(SlcE1,"SlcE_AllMC");
1717
  saveHist(SlcE2,"SlcE_NuMuCC");
1718
  saveHist(SlcE3,"SlcE_NC");
1719
  saveHist(SlcE4,"SlcE_NueCC");
1720

    
1721
  saveHist(ShwGap1,"ShwGap_AllMC");
1722
  saveHist(ShwGap2,"ShwGap_NuMuCC");
1723
  saveHist(ShwGap3,"ShwGap_NC");
1724
  saveHist(ShwGap4,"ShwGap_NueCC");
1725

    
1726
  saveHist(IsMuon1,"IsMuon_AllMC");
1727
  saveHist(IsMuon2,"IsMuon_NuMuCC");
1728
  saveHist(IsMuon3,"IsMuon_NC");
1729
  saveHist(IsMuon4,"IsMuon_NueCC");
1730

    
1731

    
1732
  ////   Data  ///////
1733

    
1734
  saveHist(nVert, "nVert_data");
1735
  saveHist(nFuzzyK, "nFuzzyK_data");
1736
  saveHist(nShower, "nShower_data");
1737
  saveHist(VertX, "VertX_data");
1738
  saveHist(VertY, "VertY_data");
1739
  saveHist(VertZ, "VertZ_data");
1740
  saveHist(ShwStartX, "ShwStartX_data");
1741
  saveHist(ShwStartY, "ShwStartY_data");
1742
  saveHist(ShwStartZ, "ShwStartZ_data");
1743
  saveHist(ShwStopX, "ShwStopX_data");
1744
  saveHist(ShwStopY, "ShwStopY_data");
1745
  saveHist(ShwStopZ, "ShwStopZ_data");
1746
  saveHist(FuzzyKLen, "FuzzyKLen_data");
1747
  saveHist(SlcE, "SlcE_data");
1748
  saveHist(ShwGap, "ShwGap_data");
1749
  saveHist(IsMuon, "IsMuon_data");
1750
 
1751
  hist->Close();
1752

    
1753
 
1754
}
1755

    
1756
#endif
1757

    
1758

    
1759