ccpiinc_mc_studies.C
Go to the documentation of this file.
1 // Make two simple spectrum plots
2 
3 #ifdef __CINT__
4 void ccpiinc_mc_studies(int fileset)
5 {
6  std::cout << "Sorry, you must run in compiled mode" << std::endl;
7 }
8 #else
9 
10 #include "CAFAna/Core/Binning.h"
11 #include "CAFAna/Cuts/Cuts.h"
13 #include "CAFAna/Core/EventList.h"
14 #include "CAFAna/Analysis/Plots.h"
15 #include "CAFAna/Core/Spectrum.h"
17 #include "CAFAna/Vars/Vars.h"
20 #include "CAFAna/Vars/Vars.h"
25 #include "CAFAna/Vars/XsecTunes.h"
26 #include "CAFAna/Systs/BeamSysts.h"
31 //#include "./NDXSecTrackPID.cxx"
36 
37 #include <cassert>
38 #include "TCanvas.h"
39 #include "TH2.h"
40 #include "TStyle.h"
41 #include "TLegend.h"
42 #include "TLatex.h"
43 #include "TVector3.h"
44 #include "TSystem.h"
45 #include <fstream>
46 #include <climits>
47 #include "TF1.h"
48 #include "TLorentzVector.h"
49 
50 using namespace ana;
51 
52 
53 void ccpiinc_mc_studies(int fileset)
54 {
55  // Environment variables and wildcards work
56 
57  /////////////////////////////////////////////////////////////////////////////////////////////////////
58  //File list location
59  /////////////////////////////////////////////////////////////////////////////////////////////////////
60  //
61  //fname is a string that needs to be either a directory or path tofile name or dataset def.
62  //Wildcards are allowed in the name.
63  //
64  /////////////////////////////////////////////////////////////////////////////////////////////////////
65 
66  std::string tmpfname;
67 
68  if (fileset==0) tmpfname ="dataset_def_name_newest_snapshot nd_fhc_cvnprongrespin_caf_minus_muonid_training";
69  else if (fileset==1) tmpfname ="dataset_def_name_newest_snapshot prod_caf_R17-11-14-prod4reco.remid-hotfix.b_nd_genie_nonswap_fhc_nova_v08_full_lightmodel-lightdown-calibup_v1_good_seventh";
70  else if (fileset==2) tmpfname ="dataset_def_name_newest_snapshot prod_caf_R17-11-14-prod4reco.remid-hotfix.b_nd_genie_nonswap_fhc_nova_v08_full_lightmodel-lightup-calibdown_v1_good_seventh";
71  else if (fileset==3) tmpfname ="dataset_def_name_newest_snapshot prod_caf_R17-11-14-prod4reco.remid-hotfix.b_nd_genie_nonswap_fhc_nova_v08_full_ckv-proton-shift-down_v1_good_seventh";
72  else if (fileset==4) tmpfname ="dataset_def_name_newest_snapshot prod_caf_R17-11-14-prod4reco.remid-hotfix.b_nd_genie_nonswap_fhc_nova_v08_full_calib-shift-nd-xyview-neg-offset_v1_good_seventh";
73  else if (fileset==5) tmpfname ="dataset_def_name_newest_snapshot prod_caf_R17-11-14-prod4reco.remid-hotfix.b_nd_genie_nonswap_fhc_nova_v08_full_calib-shift-nd-xyview-pos-offset_v1_good_seventh";
74  else if (fileset==6) tmpfname ="dataset_def_name_newest_snapshot prod_caf_R17-11-14-prod4reco.remid-hotfix.b_nd_genie_nonswap_fhc_nova_v08_full_calib-shift-nd-func_v1_good_seventh";
75  else if (fileset==7) tmpfname ="dataset_def_name_newest_snapshot nd_fhc_cvnprongrespin_caf_minus_muonid_training with limit 1";
76  else if (fileset==8) tmpfname ="dataset_def_name_newest_snapshot nd_fhc_cvnprongrespin_caf_minus_muonid_training with limit 100";
77  else if (fileset==9) tmpfname ="dataset_def_name_newest_snapshot projas_cafana_snap_prod_caf_R17-11-14-prod4reco.remid-hotfix.b_nd_genie_nonswap_fhc_nova_v08_full_v1_15928555 with stride 400 offset 343";
78  else if (fileset==10) tmpfname ="dataset_def_name_newest_snapshot nd_fhc_cvnprongrespin_caf_minus_muonid_training_minus_fakedata";
79  else if (fileset==11) tmpfname ="dataset_def_name_newest_snapshot nd_fhc_cvnprongrespin_caf_fake_data";
80 
81  else tmpfname="near_prod3_all_24554_ccpi";
82 
83 
84  const std::string fname = tmpfname;
85 
86  //const std::string fname ="near_prod3_all_24554_ccpi";
87 
88  /////////////////////////////////////////////////////////////////////////////////////////////////////
89  //End File list location
90  /////////////////////////////////////////////////////////////////////////////////////////////////////
91 
92  /////////////////////////////////////////////////////////////////////////////////////////////////////
93  //Setting up some stuff to be used later on
94  /////////////////////////////////////////////////////////////////////////////////////////////////////
95 
96  SpectrumLoader loader(fname); //Loads in the files to run over
97 
98  ///////////////////////////////////////////////////////////////////////////////////////////////////////////
99  //Making Spectrums
100  ///////////////////////////////////////////////////////////////////////////////////////////////////////////
101  //
102  //Spectrums are CAFAna objects with information relating to a CAF variable after CAF cuts.
103  //You can pull out the histogram and pot and some other objects too, as defined on the repository.
104  //
105  ///////////////////////////////////////////////////////////////////////////////////////////////////////////
106 
108  Spectrum BestEventPionScoreSignal("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
109  Spectrum BestEventPionScoreBackground("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
110  Spectrum BestEventPionScoreTru("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
111 
112  Spectrum BestEventPionScoreBackgroundNC("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueBackgroundEvent&&kTrueNCEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
113  Spectrum BestEventPionScoreBackgroundCC0Pi("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueBackgroundEvent&&kTrueCC0piEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
114  Spectrum BestEventPionScoreBackgroundBTPion("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueBackgroundEvent&&kTrueBelowThresholdEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
115  Spectrum BestEventPionScoreBackgroundNumuBar("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kIsAntiNumuCC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
116  Spectrum BestEventPionScoreBackgroundNue("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueBackgroundEvent&&kTrueNueEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
117  Spectrum BestEventPionScoreBackgroundOoF("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueBackgroundEvent&&!kTrueFiducial,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
118 
119  Spectrum BestEventPionScoreTruePion("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kBestEventPionTrackTruePion,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
120  Spectrum BestEventPionScoreTrueProton("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kBestEventPionTrackTrueProton,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
121  Spectrum BestEventPionScoreTrueMuon("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kBestEventPionTrackTrueMuon,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
122  Spectrum BestEventPionScoreTrueGamma("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kBestEventPionTrackTrueGamma,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
123  Spectrum BestEventPionScoreTrueOther("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kBestEventPionTrackTrueOther,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
124  //kBestEventPionTrackTrueOther
125 
126  Spectrum BestEventPionScoreTruePionSignal("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueSignalEvent&&kBestEventPionTrackTruePion,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
127  Spectrum BestEventPionScoreTrueProtonSignal("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueSignalEvent&&kBestEventPionTrackTrueProton,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
128  Spectrum BestEventPionScoreTrueMuonSignal("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueSignalEvent&&kBestEventPionTrackTrueMuon,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
129  Spectrum BestEventPionScoreTrueGammaSignal("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueSignalEvent&&kBestEventPionTrackTrueGamma,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
130  Spectrum BestEventPionScoreTrueOtherSignal("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueSignalEvent&&kBestEventPionTrackTrueOther,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
131 
132  Spectrum BestEventPionScoreTruePionBackground("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueBackgroundEvent&&kBestEventPionTrackTruePion,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
133  Spectrum BestEventPionScoreTrueProtonBackground("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueBackgroundEvent&&kBestEventPionTrackTrueProton,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
134  Spectrum BestEventPionScoreTrueMuonBackground("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueBackgroundEvent&&kBestEventPionTrackTrueMuon,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
135  Spectrum BestEventPionScoreTrueGammaBackground("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueBackgroundEvent&&kBestEventPionTrackTrueGamma,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
136  Spectrum BestEventPionScoreTrueOtherBackground("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueBackgroundEvent&&kBestEventPionTrackTrueOther,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
137 
138  Spectrum BestEventPionScoreTruePionObSig("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueSignalEvent&&kIsPionReco&&kBestEventPionTrackTruePion,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
139  Spectrum BestEventPionScoreTrueProtonObSig("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueSignalEvent&&kIsPionReco&&kBestEventPionTrackTrueProton,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
140  Spectrum BestEventPionScoreTrueMuonObSig("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueSignalEvent&&kIsPionReco&&kBestEventPionTrackTrueMuon,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
141  Spectrum BestEventPionScoreTrueGammaObSig("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueSignalEvent&&kIsPionReco&&kBestEventPionTrackTrueGamma,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
142  Spectrum BestEventPionScoreTrueOtherObSig("Best Pion Score", anglepionresbinning, loader, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueSignalEvent&&kIsPionReco&&kBestEventPionTrackTrueOther,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
143 
144  Spectrum RecoPionEnergySel("Reco Pion KE (GeV)", energy2GeVmaxbinning,loader,kRecoPionEnergy,kPreselection&&PionSelec,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
145  Spectrum RecoPionEnergySig("Reco Pion KE (GeV)", energy2GeVmaxbinning,loader,kRecoPionEnergy,kPreselection&&PionSelec&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
146  Spectrum RecoPionEnergyBkg("Reco Pion KE (GeV)", energy2GeVmaxbinning,loader,kRecoPionEnergy,kPreselection&&PionSelec&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
147  Spectrum RecoPionEnergyTru("Reco Pion KE (GeV)", energy2GeVmaxbinning,loader,kRecoPionEnergy,kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
148 
149  Spectrum RecoPionLengthSel("Reco Pion KE (GeV)", lengthbinning,loader,kRecoPionLength,kPreselection&&PionSelec,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
150  Spectrum RecoPionLengthSig("Reco Pion KE (GeV)", lengthbinning,loader,kRecoPionLength,kPreselection&&PionSelec&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
151  Spectrum RecoPionLengthBkg("Reco Pion KE (GeV)", lengthbinning,loader,kRecoPionLength,kPreselection&&PionSelec&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
152  Spectrum RecoPionLengthTru("Reco Pion KE (GeV)", lengthbinning,loader,kRecoPionLength,kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
153 
154  Spectrum RecoPionHitsSel("Reco Pion KE (GeV)", lengthbinning,loader,kRecoPionHits,kPreselection&&PionSelec,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
155  Spectrum RecoPionHitsSig("Reco Pion KE (GeV)", lengthbinning,loader,kRecoPionHits,kPreselection&&PionSelec&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
156  Spectrum RecoPionHitsBkg("Reco Pion KE (GeV)", lengthbinning,loader,kRecoPionHits,kPreselection&&PionSelec&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
157  Spectrum RecoPionHitsTru("Reco Pion KE (GeV)", lengthbinning,loader,kRecoPionHits,kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
158 
159  Spectrum TruePionESel("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
160  Spectrum TruePionESig("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
161  Spectrum TruePionEBkg("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
162  Spectrum TruePionETru("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
163 
164  Spectrum TruePionESelLowBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kLowBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
165  Spectrum TruePionESigLowBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kTrueSignalEvent&&kLowBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
166  Spectrum TruePionEBkgLowBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kTrueBackgroundEvent&&kLowBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
167  Spectrum TruePionETruLowBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kTrueSignalEvent&&kLowBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
168 
169  Spectrum TruePionESelMedLowBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kMedLowBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
170  Spectrum TruePionESigMedLowBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kTrueSignalEvent&&kMedLowBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
171  Spectrum TruePionEBkgMedLowBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kTrueBackgroundEvent&&kMedLowBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
172  Spectrum TruePionETruMedLowBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kTrueSignalEvent&&kMedLowBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
173 
174  Spectrum TruePionESelMedHighBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kMedHighBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
175  Spectrum TruePionESigMedHighBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kTrueSignalEvent&&kMedHighBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
176  Spectrum TruePionEBkgMedHighBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kTrueBackgroundEvent&&kMedHighBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
177  Spectrum TruePionETruMedHighBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kTrueSignalEvent&&kMedHighBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
178 
179  Spectrum TruePionESelHighBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kHighBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
180  Spectrum TruePionESigHighBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kTrueSignalEvent&&kHighBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
181  Spectrum TruePionEBkgHighBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kPreselection&&PionSelec&&kTrueBackgroundEvent&&kHighBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
182  Spectrum TruePionETruHighBDTScore("True Pion KE (GeV)", energy2GeVmaxbinning,loader,kTruePionE,kTrueSignalEvent&&kHighBDTScore,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
183 
184  Spectrum BestEventPionScorevsdedxlast10cmSel("PionBDTScorevsdEdxLast10cm", loader, anglepionresbinning, kBestEventPionBDTScore, remaininghitsbinning, kdedxlast10cm, kPreselection&&PionSelec,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
185  Spectrum BestEventPionScorevsdedxlast10cmSig("PionBDTScorevsdEdxLast10cm", loader, anglepionresbinning, kBestEventPionBDTScore, remaininghitsbinning, kdedxlast10cm, kPreselection&&PionSelec&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
186  Spectrum BestEventPionScorevsdedxlast10cmBkg("PionBDTScorevsdEdxLast10cm", loader, anglepionresbinning, kBestEventPionBDTScore, remaininghitsbinning, kdedxlast10cm, kPreselection&&PionSelec&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
187  Spectrum BestEventPionScorevsdedxlast10cmTru("PionBDTScorevsdEdxLast10cm", loader, anglepionresbinning, kBestEventPionBDTScore, remaininghitsbinning, kdedxlast10cm, kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
188 
189  //const Cut kPreselection = kIsFiducial&&kNumuTightContainND&&kNumuMyQuality;
190  Spectrum NHitsSigQual("# of Hits in Slice", bins,loader,kNHits,kNumuMyQuality&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
191  Spectrum NHitsSigContainPlusQual("# of Hits in Slice", bins,loader,kNHits,kNumuTightContainND&&kNumuMyQuality&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
192  Spectrum NHitsSigPreSel("# of Hits in Slice", bins,loader,kNHits,kPreselection&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
193  Spectrum NHitsSigPreSelPlusMuonID("# of Hits in Slice", bins,loader,kNHits,kPreselection&&kMuonIDCut&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
194 
195 
196  Spectrum NHitsTruBkg("# of Hits in Slice", bins,loader,kNHits,kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
197  Spectrum NHitsBkgQual("# of Hits in Slice", bins,loader,kNHits,kNumuMyQuality&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
198  Spectrum NHitsBkgContainPlusQual("# of Hits in Slice", bins,loader,kNHits,kNumuTightContainND&&kNumuMyQuality&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
199  Spectrum NHitsBkgPreSel("# of Hits in Slice", bins,loader,kNHits,kPreselection&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
200  Spectrum NHitsBkgPreSelPlusMuonID("# of Hits in Slice", bins,loader,kNHits,kPreselection&&kMuonIDCut&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
201 
202  Spectrum TruePionEvsBestEventPionBDTScoreSel("TruePionE vs Pion BDT Score", loader, energy2GeVmaxbinning, kTruePionE, anglepionresbinning, kBestEventPionBDTScore, kPreselection&&PionSelec,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
203  Spectrum TruePionEvsBestEventPionBDTScoreSig("TruePionE vs Pion BDT Score", loader, energy2GeVmaxbinning, kTruePionE, anglepionresbinning, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
204  Spectrum TruePionEvsBestEventPionBDTScoreBkg("TruePionE vs Pion BDT Score", loader, energy2GeVmaxbinning, kTruePionE, anglepionresbinning, kBestEventPionBDTScore, kPreselection&&PionSelec&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
205  Spectrum TruePionEvsBestEventPionBDTScoreTru("TruePionE vs Pion BDT Score", loader, energy2GeVmaxbinning, kTruePionE, anglepionresbinning, kBestEventPionBDTScore, kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
206 
207  Spectrum TruePionKE("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
208  Spectrum RecoPionTruePionKE("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTrueSignalEvent&&kIsPionReco,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
209 
210  Spectrum TruePionKE1("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTrueSignalEvent&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
211  Spectrum RecoPionTruePionKE1("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTrueSignalEvent&&kIsPionReco&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
212 
214  Spectrum RecoPionTruePionKE2("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTrueSignalEvent&&kIsPionReco&&kTrueSignalEvent&&kPreselection,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
215 
216  Spectrum TruePionKE3("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTrueSignalEvent&&kPreselection,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
217  Spectrum RecoPionTruePionKE3("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTrueSignalEvent&&kIsPionReco&&kPreselection,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
218 
221 
222  Spectrum TruePionKERes("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeRes,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
223  Spectrum TruePionKEDIS("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeDIS,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
224  Spectrum TruePionKECoh("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeCoh,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
225  Spectrum TruePionKEMEC("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeMEC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
226  Spectrum TruePionKEOther("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeOther,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
227 
228  Spectrum TruePionKECCRes("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeRes&&kIsCC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
229  Spectrum TruePionKECCDIS("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeDIS&&kIsCC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
230  Spectrum TruePionKECCCoh("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeCoh&&kIsCC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
231  Spectrum TruePionKECCMEC("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeMEC&&kIsCC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
232  Spectrum TruePionKECCOther("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeOther&&kIsCC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
233 
234  Spectrum TruePionKENCRes("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeRes&&kIsNC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
235  Spectrum TruePionKENCDIS("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeDIS&&kIsNC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
236  Spectrum TruePionKENCCoh("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeCoh&&kIsNC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
237  Spectrum TruePionKENCMEC("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeMEC&&kIsNC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
238  Spectrum TruePionKENCOther("True Pion KE (GeV)",energy1point5GeVmaxbinning,loader,kTruePionE,kTruePionEvent&&kTrueFiducial&&kIsModeOther&&kIsNC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
239 
240  Spectrum TruePionEvsTrueNuE("Neutrino Energy vs True Pion KE", loader, energy1point5GeVmaxbinning, kTruePionE, energy5GeVmaxbinning, kTrueE, kTruePionEvent&&kTrueFiducial,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
241  Spectrum TruePionEvsTrueNuERes("Neutrino Energy vs True Pion KE", loader, energy1point5GeVmaxbinning, kTruePionE, energy5GeVmaxbinning, kTrueE, kTruePionEvent&&kTrueFiducial&&kIsModeRes,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
242  Spectrum TruePionEvsTrueNuEDIS("Neutrino Energy vs True Pion KE", loader, energy1point5GeVmaxbinning, kTruePionE, energy5GeVmaxbinning, kTrueE, kTruePionEvent&&kTrueFiducial&&kIsModeDIS,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
243  Spectrum TruePionEvsTrueNuECoh("Neutrino Energy vs True Pion KE", loader, energy1point5GeVmaxbinning, kTruePionE, energy5GeVmaxbinning, kTrueE, kTruePionEvent&&kTrueFiducial&&kIsModeCoh,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
244  Spectrum TruePionEvsTrueNuEMEC("Neutrino Energy vs True Pion KE", loader, energy1point5GeVmaxbinning, kTruePionE, energy5GeVmaxbinning, kTrueE, kTruePionEvent&&kTrueFiducial&&kIsModeMEC,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
245  Spectrum TruePionEvsTrueNuEOther("Neutrino Energy vs True Pion KE", loader, energy1point5GeVmaxbinning, kTruePionE, energy5GeVmaxbinning, kTrueE, kTruePionEvent&&kTrueFiducial&&kIsModeOther,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
246 
247  Spectrum RecoPionEnergySelAnalysisBinning("Reco Pion KE (GeV)", pionkebinning,loader,kRecoPionEnergy,kPreselection&&PionSelec,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
248  Spectrum RecoPionEnergySigAnalysisBinning("Reco Pion KE (GeV)", pionkebinning,loader,kRecoPionEnergy,kPreselection&&PionSelec&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
249  Spectrum RecoPionEnergyBkgAnalysisBinning("Reco Pion KE (GeV)", pionkebinning,loader,kRecoPionEnergy,kPreselection&&PionSelec&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
250  Spectrum RecoPionEnergyTruAnalysisBinning("Reco Pion KE (GeV)", pionkebinning,loader,kRecoPionEnergy,kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
251 
252  Spectrum RecoPionEnergySelAnalysisBinningwBDTCut("Reco Pion KE (GeV)", pionkebinning,loader,kRecoPionEnergy,kPreselection&&PionSelec&&kTmpBDTCut,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
253  Spectrum RecoPionEnergySigAnalysisBinningwBDTCut("Reco Pion KE (GeV)", pionkebinning,loader,kRecoPionEnergy,kPreselection&&PionSelec&&kTrueSignalEvent&&kTmpBDTCut,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
254  Spectrum RecoPionEnergyBkgAnalysisBinningwBDTCut("Reco Pion KE (GeV)", pionkebinning,loader,kRecoPionEnergy,kPreselection&&PionSelec&&kTrueBackgroundEvent&&kTmpBDTCut,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
255  Spectrum RecoPionEnergyTruAnalysisBinningwBDTCut("Reco Pion KE (GeV)", pionkebinning,loader,kRecoPionEnergy,kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
256 
257  //kBestEventPionTrackTruePion
258  Spectrum RecoPionEnergyTruePionSig("Reco Pion KE (GeV)", energy2GeVmaxbinning,loader,kRecoPionEnergy,kPreselection&&PionSelec&&kTrueSignalEvent&&kBestEventPionTrackTruePion,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
259 
260  Spectrum RecoMuonEnergySel("Reco Muon Total Energy (GeV)", mukebinsDisplay,loader,kRecoMuKE,kPreselection&&PionSelec,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
261  Spectrum RecoMuonEnergySig("Reco Muon Total Energy (GeV)", mukebinsDisplay,loader,kRecoMuKE,kPreselection&&PionSelec&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
262  Spectrum RecoMuonEnergyBkg("Reco Muon Total Energy (GeV)", mukebinsDisplay,loader,kRecoMuKE,kPreselection&&PionSelec&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
263  Spectrum RecoMuonEnergyTru("Reco Muon Total Energy (GeV)", mukebinsDisplay,loader,kRecoMuKE,kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
264 
265  Spectrum RecoPionEnergyvsPionBDTScoreSel("Reco Pion KE (GeV)",loader,pionkebinning,kRecoPionEnergy,anglepionresbinning,kBestEventPionBDTScore,kPreselection&&PionSelec,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
266  Spectrum RecoPionEnergyvsPionBDTScoreSig("Reco Pion KE (GeV)",loader,pionkebinning,kRecoPionEnergy,anglepionresbinning,kBestEventPionBDTScore,kPreselection&&PionSelec&&kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
267  Spectrum RecoPionEnergyvsPionBDTScoreBkg("Reco Pion KE (GeV)",loader, pionkebinning,kRecoPionEnergy,anglepionresbinning,kBestEventPionBDTScore,kPreselection&&PionSelec&&kTrueBackgroundEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
268  Spectrum RecoPionEnergyvsPionBDTScoreTru("Reco Pion KE (GeV)",loader, pionkebinning,kRecoPionEnergy,anglepionresbinning,kBestEventPionBDTScore,kTrueSignalEvent,kNoShift,kXSecCVWgt2018*kPPFXFluxCVWgt);
269 
276 
277  ///////////////////////////////////////////////////////////////////////////////////////////////////////////
278  // Process Spectra
279  ///////////////////////////////////////////////////////////////////////////////////////////////////////////
280  loader.Go();
281 
282 
283  ///////////////////////////////
284  //Saving Spectrums to file
285  ///////////////////////////////
286 
287 
288  string ofn;
289  ofn = "ccpi_fhc_mcstudies_spectra-standardcuts.root";
290 
291  TFile * outf = new TFile(ofn.c_str(), "recreate");
292 
293  BestEventPionScore.SaveTo(outf->mkdir("BestEventPionScore"));
294  BestEventPionScoreSignal.SaveTo(outf->mkdir("BestEventPionScoreSignal"));
295  BestEventPionScoreBackground.SaveTo(outf->mkdir("BestEventPionScoreBackground"));
296  BestEventPionScoreTru.SaveTo(outf->mkdir("BestEventPionScoreTru"));
297 
298  BestEventPionScoreBackgroundNC.SaveTo(outf->mkdir("BestEventPionScoreBackgroundNC"));
299  BestEventPionScoreBackgroundCC0Pi.SaveTo(outf->mkdir("BestEventPionScoreBackgroundCC0Pi"));
300  BestEventPionScoreBackgroundBTPion.SaveTo(outf->mkdir("BestEventPionScoreBackgroundBTPion"));
301  BestEventPionScoreBackgroundNumuBar.SaveTo(outf->mkdir("BestEventPionScoreBackgroundNumuBar"));
302  BestEventPionScoreBackgroundNue.SaveTo(outf->mkdir("BestEventPionScoreBackgroundNue"));
303  BestEventPionScoreBackgroundOoF.SaveTo(outf->mkdir("BestEventPionScoreBackgroundOoF"));
304 
305  BestEventPionScoreTruePion.SaveTo(outf->mkdir("BestEventPionScoreTruePion"));
306  BestEventPionScoreTrueProton.SaveTo(outf->mkdir("BestEventPionScoreTrueProton"));
307  BestEventPionScoreTrueGamma.SaveTo(outf->mkdir("BestEventPionScoreTrueGamma"));
308  BestEventPionScoreTrueMuon.SaveTo(outf->mkdir("BestEventPionScoreTrueMuon"));
309  BestEventPionScoreTrueOther.SaveTo(outf->mkdir("BestEventPionScoreTrueOther"));
310 
311  BestEventPionScoreTruePionSignal.SaveTo(outf->mkdir("BestEventPionScoreTruePionSignal"));
312  BestEventPionScoreTrueProtonSignal.SaveTo(outf->mkdir("BestEventPionScoreTrueProtonSignal"));
313  BestEventPionScoreTrueGammaSignal.SaveTo(outf->mkdir("BestEventPionScoreTrueGammaSignal"));
314  BestEventPionScoreTrueMuonSignal.SaveTo(outf->mkdir("BestEventPionScoreTrueMuonSignal"));
315  BestEventPionScoreTrueOtherSignal.SaveTo(outf->mkdir("BestEventPionScoreTrueOtherSignal"));
316 
317  BestEventPionScoreTruePionBackground.SaveTo(outf->mkdir("BestEventPionScoreTruePionBackground"));
318  BestEventPionScoreTrueProtonBackground.SaveTo(outf->mkdir("BestEventPionScoreTrueProtonBackground"));
319  BestEventPionScoreTrueGammaBackground.SaveTo(outf->mkdir("BestEventPionScoreTrueGammaBackground"));
320  BestEventPionScoreTrueMuonBackground.SaveTo(outf->mkdir("BestEventPionScoreTrueMuonBackground"));
321  BestEventPionScoreTrueOtherBackground.SaveTo(outf->mkdir("BestEventPionScoreTrueOtherBackground"));
322 
323  RecoPionEnergySel.SaveTo(outf->mkdir("RecoPionEnergySel"));
324  RecoPionEnergySig.SaveTo(outf->mkdir("RecoPionEnergySig"));
325  RecoPionEnergyBkg.SaveTo(outf->mkdir("RecoPionEnergyBkg"));
326  RecoPionEnergyTru.SaveTo(outf->mkdir("RecoPionEnergyTru"));
327 
328  RecoPionLengthSel.SaveTo(outf->mkdir("RecoPionLengthSel"));
329  RecoPionLengthSig.SaveTo(outf->mkdir("RecoPionLengthSig"));
330  RecoPionLengthBkg.SaveTo(outf->mkdir("RecoPionLengthBkg"));
331  RecoPionLengthTru.SaveTo(outf->mkdir("RecoPionLengthTru"));
332 
333  RecoPionHitsSel.SaveTo(outf->mkdir("RecoPionHitsSel"));
334  RecoPionHitsSig.SaveTo(outf->mkdir("RecoPionHitsSig"));
335  RecoPionHitsBkg.SaveTo(outf->mkdir("RecoPionHitsBkg"));
336  RecoPionHitsTru.SaveTo(outf->mkdir("RecoPionHitsTru"));
337 
338  TruePionESel.SaveTo(outf->mkdir("TruePionESel"));
339  TruePionESig.SaveTo(outf->mkdir("TruePionESig"));
340  TruePionEBkg.SaveTo(outf->mkdir("TruePionEBkg"));
341  TruePionETru.SaveTo(outf->mkdir("TruePionETru"));
342 
343  TruePionESelLowBDTScore.SaveTo(outf->mkdir("TruePionESelLowBDTScore"));
344  TruePionESigLowBDTScore.SaveTo(outf->mkdir("TruePionESigLowBDTScore"));
345  TruePionEBkgLowBDTScore.SaveTo(outf->mkdir("TruePionEBkgLowBDTScore"));
346  TruePionETruLowBDTScore.SaveTo(outf->mkdir("TruePionETruLowBDTScore"));
347 
348  TruePionESelMedLowBDTScore.SaveTo(outf->mkdir("TruePionESelMedLowBDTScore"));
349  TruePionESigMedLowBDTScore.SaveTo(outf->mkdir("TruePionESigMedLowBDTScore"));
350  TruePionEBkgMedLowBDTScore.SaveTo(outf->mkdir("TruePionEBkgMedLowBDTScore"));
351  TruePionETruMedLowBDTScore.SaveTo(outf->mkdir("TruePionETruMedLowBDTScore"));
352 
353  TruePionESelMedHighBDTScore.SaveTo(outf->mkdir("TruePionESelMedHighBDTScore"));
354  TruePionESigMedHighBDTScore.SaveTo(outf->mkdir("TruePionESigMedHighBDTScore"));
355  TruePionEBkgMedHighBDTScore.SaveTo(outf->mkdir("TruePionEBkgMedHighBDTScore"));
356  TruePionETruMedHighBDTScore.SaveTo(outf->mkdir("TruePionETruMedHighBDTScore"));
357 
358  TruePionESelHighBDTScore.SaveTo(outf->mkdir("TruePionESelHighBDTScore"));
359  TruePionESigHighBDTScore.SaveTo(outf->mkdir("TruePionESigHighBDTScore"));
360  TruePionEBkgHighBDTScore.SaveTo(outf->mkdir("TruePionEBkgHighBDTScore"));
361  TruePionETruHighBDTScore.SaveTo(outf->mkdir("TruePionETruHighBDTScore"));
362 
363  BestEventPionScorevsdedxlast10cmSel.SaveTo(outf->mkdir("BestEventPionScorevsdedxlast10cmSel"));
364  BestEventPionScorevsdedxlast10cmSig.SaveTo(outf->mkdir("BestEventPionScorevsdedxlast10cmSig"));
365  BestEventPionScorevsdedxlast10cmBkg.SaveTo(outf->mkdir("BestEventPionScorevsdedxlast10cmBkg"));
366  BestEventPionScorevsdedxlast10cmTru.SaveTo(outf->mkdir("BestEventPionScorevsdedxlast10cmTru"));
367 
368  NHitsSigQual.SaveTo(outf->mkdir("NHitsSigQual"));
369  NHitsSigContainPlusQual.SaveTo(outf->mkdir("NHitsSigContainPlusQual"));
370  NHitsSigPreSel.SaveTo(outf->mkdir("NHitsSigPreSel"));
371  NHitsSigPreSelPlusMuonID.SaveTo(outf->mkdir("NHitsSigPreSelPlusMuonID"));
372 
373  NHitsTruBkg.SaveTo(outf->mkdir("NHitsTruBkg"));
374  NHitsBkgQual.SaveTo(outf->mkdir("NHitsBkgQual"));
375  NHitsBkgContainPlusQual.SaveTo(outf->mkdir("NHitsBkgContainPlusQual"));
376  NHitsBkgPreSel.SaveTo(outf->mkdir("NHitsBkgPreSel"));
377  NHitsBkgPreSelPlusMuonID.SaveTo(outf->mkdir("NHitsBkgPreSelPlusMuonID"));
378 
379  TruePionEvsBestEventPionBDTScoreSel.SaveTo(outf->mkdir("TruePionEvsBestEventPionBDTScoreSel"));
380  TruePionEvsBestEventPionBDTScoreSig.SaveTo(outf->mkdir("TruePionEvsBestEventPionBDTScoreSig"));
381  TruePionEvsBestEventPionBDTScoreBkg.SaveTo(outf->mkdir("TruePionEvsBestEventPionBDTScoreBkg"));
382  TruePionEvsBestEventPionBDTScoreTru.SaveTo(outf->mkdir("TruePionEvsBestEventPionBDTScoreTru"));
383 
384  TruePionKE.SaveTo(outf->mkdir("TruePionKE"));
385  RecoPionTruePionKE.SaveTo(outf->mkdir("RecoPionTruePionKE"));
386 
387  TruePionKE1.SaveTo(outf->mkdir("TruePionKE1"));
388  RecoPionTruePionKE1.SaveTo(outf->mkdir("RecoPionTruePionKE1"));
389 
390  TruePionKE2.SaveTo(outf->mkdir("TruePionKE2"));
391  RecoPionTruePionKE2.SaveTo(outf->mkdir("RecoPionTruePionKE2"));
392 
393  TruePionKE3.SaveTo(outf->mkdir("TruePionKE3"));
394  RecoPionTruePionKE3.SaveTo(outf->mkdir("RecoPionTruePionKE3"));
395 
396  TruePionKE4.SaveTo(outf->mkdir("TruePionKE4"));
397  RecoPionTruePionKE4.SaveTo(outf->mkdir("RecoPionTruePionKE4"));
398 
399  TruePionKERes.SaveTo(outf->mkdir("TruePionKERes"));
400  TruePionKECoh.SaveTo(outf->mkdir("TruePionKECoh"));
401  TruePionKEDIS.SaveTo(outf->mkdir("TruePionKEDIS"));
402  TruePionKEMEC.SaveTo(outf->mkdir("TruePionKEMEC"));
403  TruePionKEOther.SaveTo(outf->mkdir("TruePionKEOther"));
404 
405  TruePionKECCRes.SaveTo(outf->mkdir("TruePionKECCRes"));
406  TruePionKECCCoh.SaveTo(outf->mkdir("TruePionKECCCoh"));
407  TruePionKECCDIS.SaveTo(outf->mkdir("TruePionKECCDIS"));
408  TruePionKECCMEC.SaveTo(outf->mkdir("TruePionKECCMEC"));
409  TruePionKECCOther.SaveTo(outf->mkdir("TruePionKECCOther"));
410 
411  TruePionKENCRes.SaveTo(outf->mkdir("TruePionKENCRes"));
412  TruePionKENCCoh.SaveTo(outf->mkdir("TruePionKENCCoh"));
413  TruePionKENCDIS.SaveTo(outf->mkdir("TruePionKENCDIS"));
414  TruePionKENCMEC.SaveTo(outf->mkdir("TruePionKENCMEC"));
415  TruePionKENCOther.SaveTo(outf->mkdir("TruePionKENCOther"));
416 
417  TruePionEvsTrueNuE.SaveTo(outf->mkdir("TruePionEvsTrueNuE"));
418  TruePionEvsTrueNuERes.SaveTo(outf->mkdir("TruePionEvsTrueNuERes"));
419  TruePionEvsTrueNuEDIS.SaveTo(outf->mkdir("TruePionEvsTrueNuEDIS"));
420  TruePionEvsTrueNuECoh.SaveTo(outf->mkdir("TruePionEvsTrueNuECoh"));
421  TruePionEvsTrueNuEMEC.SaveTo(outf->mkdir("TruePionEvsTrueNuEMEC"));
422  TruePionEvsTrueNuEOther.SaveTo(outf->mkdir("TruePionEvsTrueNuEOther"));
423 
424  RecoPionEnergySelAnalysisBinning.SaveTo(outf->mkdir("RecoPionEnergySelAnalysisBinning"));
425  RecoPionEnergySigAnalysisBinning.SaveTo(outf->mkdir("RecoPionEnergySigAnalysisBinning"));
426  RecoPionEnergyBkgAnalysisBinning.SaveTo(outf->mkdir("RecoPionEnergyBkgAnalysisBinning"));
427  RecoPionEnergyTruAnalysisBinning.SaveTo(outf->mkdir("RecoPionEnergyTruAnalysisBinning"));
428 
429  RecoPionEnergySelAnalysisBinningwBDTCut.SaveTo(outf->mkdir("RecoPionEnergySelAnalysisBinningwBDTCut"));
430  RecoPionEnergySigAnalysisBinningwBDTCut.SaveTo(outf->mkdir("RecoPionEnergySigAnalysisBinningwBDTCut"));
431  RecoPionEnergyBkgAnalysisBinningwBDTCut.SaveTo(outf->mkdir("RecoPionEnergyBkgAnalysisBinningwBDTCut"));
432  RecoPionEnergyTruAnalysisBinningwBDTCut.SaveTo(outf->mkdir("RecoPionEnergyTruAnalysisBinningwBDTCut"));
433 
434  RecoPionEnergyTruePionSig.SaveTo(outf->mkdir("RecoPionEnergyTruePionSig"));
435 
436  RecoMuonEnergySel.SaveTo(outf->mkdir("RecoMuonEnergySel"));
437  RecoMuonEnergySig.SaveTo(outf->mkdir("RecoMuonEnergySig"));
438  RecoMuonEnergyBkg.SaveTo(outf->mkdir("RecoMuonEnergyBkg"));
439  RecoMuonEnergyTru.SaveTo(outf->mkdir("RecoMuonEnergyTru"));
440 
441  RecoPionEnergyvsPionBDTScoreSel.SaveTo(outf->mkdir("RecoPionEnergyvsPionBDTScoreSel"));
442  RecoPionEnergyvsPionBDTScoreSig.SaveTo(outf->mkdir("RecoPionEnergyvsPionBDTScoreSig"));
443  RecoPionEnergyvsPionBDTScoreBkg.SaveTo(outf->mkdir("RecoPionEnergyvsPionBDTScoreBkg"));
444  RecoPionEnergyvsPionBDTScoreTru.SaveTo(outf->mkdir("RecoPionEnergyvsPionBDTScoreTru"));
445 
446  RecoPionEnergyvsPionBDTScoreCC0Pi.SaveTo(outf->mkdir("RecoPionEnergyvsPionBDTScoreCC0Pi"));
447  RecoPionEnergyvsPionBDTScoreCCPi0.SaveTo(outf->mkdir("RecoPionEnergyvsPionBDTScoreCCPi0"));
448  RecoPionEnergyvsPionBDTScoreOtherBkg.SaveTo(outf->mkdir("RecoPionEnergyvsPionBDTScoreOtherBkg"));
449  RecoPionEnergyvsPionBDTScoreBTPion.SaveTo(outf->mkdir("RecoPionEnergyvsPionBDTScoreBTPion"));
450  RecoPionEnergyvsPionBDTScoreNC.SaveTo(outf->mkdir("RecoPionEnergyvsPionBDTScoreNC"));
451  RecoPionEnergyvsPionBDTScoreNewOtherBkg.SaveTo(outf->mkdir("RecoPionEnergyvsPionBDTScoreNewOtherBkg"));
452 
453  //.SaveTo(outf->mkdir(""));
454  //*/
455  std::cout << "\nOutput save to: " << outf->GetName() << std::endl;
456  outf->Close();
457 }
458 
459 #endif
const Binning lengthbinning
Definition: NumuCC_CPiBin.h:12
const Var kRecoPionEnergy([](const caf::SRProxy *sr){float pionidx=GetBestPionTrack()(sr);float pionscore=GetBestPionID()(sr);if(pionscore< -1) return-2.0f;if(pionidx< 0) return-3.0f;float len=sr->trk.kalman.tracks[pionidx].len;float recoE=0.0699059+0.00454418 *len+-2.44087e-05 *len *len+1.19292e-07 *len *len *len+-2.61589e-10 *len *len *len *len+2.06403e-13 *len *len *len *len *len;return recoE;})
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kRecoMuKE
const Cut kTrueCC0piEvent
const Cut kNumuTightContainND([](const caf::SRProxy *sr){if(sr->vtx.nelastic< 1) return false;int ibesttrk=kBestTrack(sr);for(unsigned int i=0;i< sr->vtx.elastic[0].fuzzyk.nshwlid;++i){TVector3 start=sr->vtx.elastic[0].fuzzyk.png[i].shwlid.start;TVector3 stop=sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop;if(std::min(start.X(), stop.X())< -180.0) return false;if(std::max(start.X(), stop.X()) > 180.0) return false;if(std::min(start.Y(), stop.Y())< -180.0) return false;if(std::max(start.Y(), stop.Y()) > 180.0) return false;if(std::min(start.Z(), stop.Z())< 20.0) return false;if(std::max(start.Z(), stop.Z()) > 1525.0) return false;}if(sr->trk.kalman.ntracks< 1) return false;for(int i=0;i< int(sr->trk.kalman.ntracks);++i){if(i==ibesttrk) continue;else if(sr->trk.kalman.tracks[i].start.Z() > 1275|| sr->trk.kalman.tracks[i].stop.Z() > 1275) return false;}if(ibesttrk< 0||ibesttrk >=int(sr->trk.kalman.ntracks)) return false;return((sr->trk.kalman.tracks[ibesttrk].stop.Z()< 1275 ||sr->trk.kalman.tracks[ibesttrk].trkyposattrans< 55) &&sr->trk.kalman.tracks[ibesttrk].trkfwdcellnd > 5 &&sr->trk.kalman.tracks[ibesttrk].trkbakcellnd > 10);})
Definition: NumuCCIncCuts.h:29
const Cut kMedHighBDTScore
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
const Var kNHits([](const caf::SRProxy *sr){float nhit=sr->slc.nhit;return nhit;})
const Binning remaininghitsbinning
Definition: NumuCC_CPiBin.h:80
const Var kRecoPionHits([](const caf::SRProxy *sr){float pionidx=GetBestPionTrack()(sr);float pionscore=GetBestPionID()(sr);if(pionscore< -1) return-2.0f;if(pionidx< 0) return-3.0f;float hits=sr->trk.kalman.tracks[pionidx].nhit;return hits;})
const Cut PionSelec
const Cut kBestEventPionTrackTrueProton([](const caf::SRProxy *sr){int pionidx=GetBestPionTrack()(sr);if(pionidx< 0) return false;int bestpionpdg=abs(sr->trk.kalman.tracks[pionidx].truth.pdg);if(bestpionpdg==2212) return true;return false;})
const Cut kNumuMyQuality([](const caf::SRProxy *sr){return(sr->trk.kalman.ntracks > 0 && sr->slc.nhit > 20 && sr->slc.ncontplanes > 4);})
Definition: NumuCCIncCuts.h:25
const Var kBestEventPionBDTScore([](const caf::SRProxy *sr){float pionscore=GetBestPionID()(sr);if(pionscore<-1) return-2.0f;return pionscore;})
const Binning energy1point5GeVmaxbinning
Definition: NumuCC_CPiBin.h:36
const Cut kIsModeCoh
const Cut kTruePionEvent([](const caf::SRProxy *sr){if(sr->mc.nnu< 1) return false;if(sr->mc.nu[0].iscc==false) return false;bool pionfound=false;for(uint i=0;i< sr->mc.nu[0].prim.size();i++){if(abs(sr->mc.nu[0].prim[i].pdg)==211) pionfound=true;}return pionfound;})
const Cut kTrueNCEvent
const Cut kTrueCCpi0Event
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
const Binning anglepionresbinning
Definition: NumuCC_CPiBin.h:54
const Var kdedxlast10cm([](const caf::SRProxy *sr){float pionidx=GetBestPionTrack()(sr);float pionscore=GetBestPionID()(sr);if(pionidx< 0) return-1.0f;if(sr->trk.kalman.ntracks< 2) return-9999.0f;TVector3 muondir=sr->trk.kalman.tracks[sr->trk.kalman.idxremid].dir;TVector3 piondir=sr->trk.kalman.tracks[pionidx].dir;float dedx=sr->trk.kalman.tracks[pionidx].avedEdxlast10cm;return dedx;})
const Cut kBestEventPionTrackTrueOther([](const caf::SRProxy *sr){int pionidx=GetBestPionTrack()(sr);if(pionidx< 0) return false;int bestpionpdg=abs(sr->trk.kalman.tracks[pionidx].truth.pdg);if(bestpionpdg!=22 &&bestpionpdg!=2212 &&bestpionpdg!=13 &&bestpionpdg!=211) return true;return false;})
const Cut kBestEventPionTrackTrueGamma([](const caf::SRProxy *sr){int pionidx=GetBestPionTrack()(sr);if(pionidx< 0) return false;int bestpionpdg=abs(sr->trk.kalman.tracks[pionidx].truth.pdg);if(bestpionpdg==22) return true;return false;})
const Var kTrueE([](const caf::SRProxy *sr){assert(sr->mc.nnu==1);return sr->mc.nu[0].E;})
Definition: Vars.cxx:85
const Cut kIsNC([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return!sr->mc.nu[0].iscc;})
Is this a Neutral Current event?
Definition: TruthCuts.h:8
const Cut kTrueFiducial
const Binning energy2GeVmaxbinning
Definition: NumuCC_CPiBin.h:32
const Cut kTrueNueEvent
const Cut kPreselection
void ccpiinc_mc_studies(int fileset)
const Cut kBestEventPionTrackTruePion([](const caf::SRProxy *sr){int pionidx=GetBestPionTrack()(sr);if(pionidx< 0) return false;int bestpionpdg=abs(sr->trk.kalman.tracks[pionidx].truth.pdg);if(bestpionpdg==211) return true;return false;})
const Var kTruePionE([](const caf::SRProxy *sr){if(sr->mc.nnu< 1) return-1.0;double trupionE=-1;int pionidx=-1;for(uint i=0;i< sr->mc.nu[0].prim.size();i++){if(abs(sr->mc.nu[0].prim[i].pdg)==211 &&sr->mc.nu[0].prim[i].p.T()>trupionE){pionidx=i;trupionE=sr->mc.nu[0].prim[i].p.T();}}if(pionidx==-1) return-1.0;double gamma=sr->mc.nu[0].prim[pionidx].p.Gamma();double mass=sqrt(sr->mc.nu[0].prim[pionidx].p.T()*sr->mc.nu[0].prim[pionidx].p.T()-sr->mc.nu[0].prim[pionidx].p.Mag()*sr->mc.nu[0].prim[pionidx].p.Mag());double KE=(gamma-1)*mass;return KE;})
TFile * outf
Definition: testXsec.C:51
virtual void Go() override
Load all the registered spectra.
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:506
const Cut kIsCC([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);bool isCC=sr->mc.nu[0].iscc;return isCC;})
const Binning mukebinsDisplay
Definition: NumuCCIncBins.h:91
loader
Definition: demo0.py:10
const Cut kTrueBelowThresholdEvent
const Cut kMuonIDCut
const SystShifts kNoShift
Definition: SystShifts.cxx:21
OStream cout
Definition: OStream.cxx:6
const Binning bins
Definition: NumuCC_CPiBin.h:8
const Var kRecoPionLength([](const caf::SRProxy *sr){float pionidx=GetBestPionTrack()(sr);float pionscore=GetBestPionID()(sr);if(pionscore< -1) return-2.0f;if(pionidx< 0) return-3.0f;float len=sr->trk.kalman.tracks[pionidx].len;return len;})
const Cut kIsModeMEC
const Cut kMedLowBDTScore
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const Cut kBestEventPionTrackTrueMuon([](const caf::SRProxy *sr){int pionidx=GetBestPionTrack()(sr);if(pionidx< 0) return false;int bestpionpdg=abs(sr->trk.kalman.tracks[pionidx].truth.pdg);if(bestpionpdg==13) return true;return false;})
const Var kXSecCVWgt2018
Definition: XsecTunes.h:49
const Cut kIsModeDIS
const Cut kIsPionReco([](const caf::SRProxy *sr){if(sr->mc.nnu< 1) return false;double trupionE=-1;int pionidx=-1;for(uint i=0;i< sr->mc.nu[0].prim.size();i++){if(abs(sr->mc.nu[0].prim[i].pdg)==211 &&sr->mc.nu[0].prim[i].p.T()>trupionE){pionidx=i;trupionE=sr->mc.nu[0].prim[i].p.T();}}if(pionidx==-1) return false;if(sr->trk.kalman.ntracks< 1) return false;for(uint i=0;i< sr->trk.kalman.ntracks;i++){if(abs(sr->trk.kalman.tracks[i].truth.pdg)==211 &&sr->trk.kalman.tracks[i].truth.p.T()==trupionE) return true;}return false;})
const Cut kTrueBackgroundEvent
const Cut kIsModeOther
const Cut kLowBDTScore
const Cut kIsModeRes
const Cut kIsAntiNumuCC
const Cut kHighBDTScore
const Cut kTmpBDTCut
const Binning pionkebinning
const Binning energy5GeVmaxbinning
Definition: NumuCC_CPiBin.h:30
const Cut kTrueSignalEvent
enum BeamMode string