ComparisonHints.h
Go to the documentation of this file.
1 #include "CAFAna/Core/Binning.h"
2 #include "CAFAna/Core/Var.h"
3 
5 
8 
9 // --- Define the height / widht of the detector.
10 const float XMinEx = -758.;
11 const float XMaxEx = 765.;
12 const float YMinEx = -749.;
13 const float YMaxEx = 765.;
14 // --- Center pos.
15 const float XCent = XMinEx + ((XMaxEx-XMinEx)/2);
16 const float YCent = YMinEx + ((YMaxEx-YMinEx)/2);
17 
18 namespace ana {
19 
20  // ******* Define some bin sets which I want to use *******
21  const unsigned int NumBins = 100;
22  const Binning NumHitBins = Binning::Simple(NumBins, 0 , 1000 );
23  const Binning RatioBins = Binning::Simple(NumBins, 0 , 1.01 );
24  const Binning CompBins = Binning::Simple(NumBins, -1.01, 1.01 );
25  const Binning CompZBins = Binning::Simple(NumBins, -0.5 , 0.5 );
26  // Energy bins
27  const Binning EnergyBins = Binning::Simple(NumBins, 0 , 5 );
28  const Binning LowEnBins = Binning::Simple(NumBins, 0 , 3 );
29  const Binning EnPHitBins = Binning::Simple(NumBins, 0 , 0.1 );
30  const Binning RangeBins = Binning::Simple(NumBins, -0.2 , 0.2 );
31  const Binning SmallBins = Binning::Simple(NumBins, 0 , 0.02 );
32  const Binning TinyBins = Binning::Simple(NumBins, 0 , 0.002);
33  // Length / hit bins
34  const Binning NumTrkBins = Binning::Simple(11 , -0.5 , 10 );
35  const Binning YRangeBins = Binning::Simple(NumBins, -8 , 8 );
36  const Binning ZRangeBins = Binning::Simple(NumBins, -0.1 , 60.1 );
37  const Binning LengthBins = Binning::Simple(NumBins, 0 , 20 );
38  const Binning CellsBins = Binning::Simple(NumBins, 0 , 1000 );
39  // Time bins
40  const Binning TimeFBins = Binning::Simple(NumBins, 0 , 550 );
41  const Binning TimeZBins = Binning::Simple(NumBins, 200, 250 );
42 
43  // ********** Define my Positional cuts **********
44 
45  // Y inc
46  // ^
47  // | TL TR
48  // |
49  // | BL BR
50  // ------> X inc
51  // If Y is positive and X is negative.
52  const Cut kW_TL( [](const caf::SRProxy* sr) {
53  bool IsTrue = ( sr->trk.kalman.tracks[0].start.X() < XCent &&
54  sr->trk.kalman.tracks[0].start.Y() > YCent );
55  /*
56  std::cout << "\nStartX is " << sr->trk.kalman.tracks[0].start.X() << " StartY is " << sr->trk.kalman.tracks[0].start.Y()
57  << "\t...\tXCent is " << XCent << " && YCent is " << YCent << "\n"
58  << "\tInkW_TL ==> IsTrue " << IsTrue << std::endl;
59  */
60  return IsTrue;
61  });
62  // If Y is positive and X is positive.
63  const Cut kW_TR( [](const caf::SRProxy* sr) {
64  bool IsTrue ( sr->trk.kalman.tracks[0].start.X() > XCent &&
65  sr->trk.kalman.tracks[0].start.Y() > YCent );
66  //std::cout << "\tIn kW_TR ==> IsTrue " << IsTrue << std::endl;
67  return IsTrue;
68  });
69  // If Y is negative and X is negative.
70  const Cut kW_BL( [](const caf::SRProxy* sr) {
71  bool IsTrue ( sr->trk.kalman.tracks[0].start.X() < XCent &&
72  sr->trk.kalman.tracks[0].start.Y() < YCent );
73  //std::cout << "\tIn kW_BL ==> IsTrue " << IsTrue << std::endl;
74  return IsTrue;
75  });
76  // If Y is negative and X is positive.
77  const Cut kW_BR( [](const caf::SRProxy* sr) {
78  bool IsTrue ( sr->trk.kalman.tracks[0].start.X() > XCent &&
79  sr->trk.kalman.tracks[0].start.Y() < YCent );
80  //std::cout << "\tIn kW_BR ==> IsTrue " << IsTrue << std::endl;
81  return IsTrue;
82  });
83 
84  // ************** Define my additional Vars **************
85  // --- The Reco - True / True neutrino energy
86  const Var kRTOvTNuE = ( (kCCE-kTrueE)/kTrueE );
87  // --- The most forward Kalman track hit cell.
88  const Var kKalFwdCell( [](const caf::SRProxy* sr) { return sr->sel.contain.kalfwdcell; });
89  // --- The most backward Kalman track hit cell.
90  const Var kKalBakCell( [](const caf::SRProxy* sr) { return sr->sel.contain.kalbakcell; });
91  // --- The highest Y vertex of Kalman track.
92  const Var kMaxKalYPos( [](const caf::SRProxy* sr) {
93  if(sr->trk.kalman.ntracks < 1) return -10.0f;
94  return std::max( sr->trk.kalman.tracks[0].start.Y()/100,
95  sr->trk.kalman.tracks[0].stop.Y()/100 );
96  });
97  // --- The highest Z vertex of Kalman track.
98  const Var kMaxKalZPos( [](const caf::SRProxy* sr) {
99  if(sr->trk.kalman.ntracks < 1) return -10.0f;
100  return std::max( sr->trk.kalman.tracks[0].start.Z()/100,
101  sr->trk.kalman.tracks[0].stop.Z()/100 );
102  });
103  // --- Scattering over track length
104  const Var kScattTrLen( [](const caf::SRProxy* sr) {
105  if(sr->trk.kalman.ntracks < 1) return -10.0f;
106  return (float)((float)sr->sel.cosrej.scatt / (float)sr->trk.kalman.tracks[0].len);
107  });
108  // --- Min Proj cells to edge
109  const Var kMinCellEdg( [](const caf::SRProxy* sr) {
110  return std::min((sr->sel.contain.kalfwdcell + sr->sel.contain.kalbakcell),
112  });
113  // --- Ratio of kalman hits in slice.
114  const Var kRatOfKalHi( [](const caf::SRProxy* sr) {
115  if(sr->trk.kalman.ntracks < 1) return -10.0f;
116  return (float)((float)sr->trk.kalman.tracks[0].nhit / (float)sr->slc.nhit);
117  });
118  // --- The Second analysis BDT result
119  const Var kSANumuContPID( [](const caf::SRProxy* sr) { return sr->sel.cosrej.numuSAcontpid; });
120  // --- The first hit cell.
121  const Var kFirstCell( [](const caf::SRProxy* sr) { return sr->slc.firstcell; });
122  // --- The last hit cell.
123  const Var kLastCell ( [](const caf::SRProxy* sr) { return sr->slc.lastcell; });
124 
125  // *** Some more plots from Alex
126  // Slice.
127  // --- The Vis En in the slice
128  const Var kVisESlc( [](const caf::SRProxy* sr) { return sr->slc.calE; });
129  // --- The Num.Hits in the slic
130  const Var kNHitSlc( [](const caf::SRProxy* sr) { return sr->slc.nhit; });
131  // --- Visibile E per hit in sl
132  const Var kEnPHSlc( [](const caf::SRProxy* sr) { if(sr->slc.nhit < 1) return -10.0f; return (float)(sr->slc.calE) / (float)(1.78*sr->slc.nhit); });
133  // Track.
134  // --- The Vis En of the track
135  const Var kVisETrk( [](const caf::SRProxy* sr) { if(sr->trk.kalman.ntracks < 1) return -10.0f; return (float)sr->trk.kalman.tracks[0].calE; });
136  // --- The NumHits in the track
137  const Var kNHitTrk( [](const caf::SRProxy* sr) { if(sr->trk.kalman.ntracks < 1) return -10.0f; return (float)sr->trk.kalman.tracks[0].nhit; });
138  // --- Visibile E PerHit in trk
139  const Var kEnPHTrk( [](const caf::SRProxy* sr) {
140  if(sr->trk.kalman.ntracks < 1) return -10.0f;
141  return (float)(sr->trk.kalman.tracks[0].calE) / (float)(1.78 * sr->trk.kalman.tracks[0].nhit); });
142  // Hadronic energy
143  // --- The Hadronic Vis Energy
144  const Var kVisEHad( [](const caf::SRProxy* sr) { if(sr->trk.kalman.ntracks < 1) return -10.0f; return (float)(sr->slc.calE - sr->trk.kalman.tracks[0].calE); });
145  // --- The Num.Hits in the slic
146  const Var kNHitHad( [](const caf::SRProxy* sr) { if(sr->trk.kalman.ntracks < 1) return -10.0f; return (float)(sr->slc.nhit - sr->trk.kalman.tracks[0].nhit); });
147  // --- Visibile E per hit in sl
148  const Var kEnPHHad( [](const caf::SRProxy* sr) {
149  if(sr->trk.kalman.ntracks < 1) return -10.0f;
150  return (float)(sr->slc.calE - sr->trk.kalman.tracks[0].calE) / (float)(1.78 * (sr->slc.nhit - sr->trk.kalman.tracks[0].nhit) );
151  });
152 
153  // --- The difference in XY Track Length
154  const Var kTrkLenXY( [](const caf::SRProxy* sr) {
155  if(sr->trk.kalman.ntracks < 1) return -10.0f;
156  float XLen = ( sr->trk.kalman.tracks[0].start.X() - sr->trk.kalman.tracks[0].stop.X() ) /100;
157  float YLen = ( sr->trk.kalman.tracks[0].start.Y() - sr->trk.kalman.tracks[0].stop.Y() ) /100;
158  return XLen - YLen;
159  });
160 
161  // --- The True Hadronic Energy
163  // --- The True Hadronic Energy Fraction
164  const Var kTrueHFrE( [](const caf::SRProxy* sr) {
165  float HadE = kTrueHadE(sr);
166  float TruE = kTrueE(sr);
167  return ( HadE / TruE );
168  });
169 }
const Binning ZRangeBins
T max(const caf::Proxy< T > &a, T b)
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:16
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kEnPHHad([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return(float)(sr->slc.calE-sr->trk.kalman.tracks[0].calE)/(float)(1.78 *(sr->slc.nhit-sr->trk.kalman.tracks[0].nhit));})
const Var kMaxKalYPos([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return std::max(sr->trk.kalman.tracks[0].start.Y()/100, sr->trk.kalman.tracks[0].stop.Y()/100);})
const float YCent
const Var kVisESlc([](const caf::SRProxy *sr){return sr->slc.calE;})
const Var kNHitSlc([](const caf::SRProxy *sr){return sr->slc.nhit;})
caf::Proxy< size_t > ntracks
Definition: SRProxy.h:1778
const Var kEnPHSlc([](const caf::SRProxy *sr){if(sr->slc.nhit< 1) return-10.0f;return(float)(sr->slc.calE)/(float)(1.78 *sr->slc.nhit);})
caf::Proxy< unsigned int > firstcell
Definition: SRProxy.h:1304
caf::Proxy< caf::SRContain > contain
Definition: SRProxy.h:1251
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const Binning YRangeBins
const Binning EnPHitBins
const Var kNHitHad([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return(float)(sr->slc.nhit-sr->trk.kalman.tracks[0].nhit);})
const Var kMinCellEdg([](const caf::SRProxy *sr){return std::min((sr->sel.contain.kalfwdcell+sr->sel.contain.kalbakcell), (sr->sel.contain.cosfwdcell+sr->sel.contain.cosbakcell));})
const float YMinEx
const Var kFirstCell([](const caf::SRProxy *sr){return sr->slc.firstcell;})
const Binning LowEnBins
const Var kTrueHFrE([](const caf::SRProxy *sr){float HadE=kTrueHadE(sr);float TruE=kTrueE(sr);return(HadE/TruE);})
const Var kLastCell([](const caf::SRProxy *sr){return sr->slc.lastcell;})
const Binning TimeZBins
caf::Proxy< int > cosfwdcell
Definition: SRProxy.h:810
caf::Proxy< int > cosbakcell
Definition: SRProxy.h:805
const Var kKalFwdCell([](const caf::SRProxy *sr){return sr->sel.contain.kalfwdcell;})
const Var kScattTrLen([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return(float)((float) sr->sel.cosrej.scatt/(float) sr->trk.kalman.tracks[0].len);})
const float XMaxEx
caf::Proxy< caf::SRCosRej > cosrej
Definition: SRProxy.h:1252
caf::Proxy< unsigned int > lastcell
Definition: SRProxy.h:1308
const Var kTrueE([](const caf::SRProxy *sr){assert(sr->mc.nnu==1);return sr->mc.nu[0].E;})
Definition: Vars.cxx:85
caf::Proxy< unsigned int > nhit
Definition: SRProxy.h:1315
const Var kRatOfKalHi([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return(float)((float) sr->trk.kalman.tracks[0].nhit/(float) sr->slc.nhit);})
const Binning EnergyBins
caf::Proxy< float > scatt
Definition: SRProxy.h:887
const Cut kW_TR([](const caf::SRProxy *sr){bool IsTrue(sr->trk.kalman.tracks[0].start.X() > XCent && sr->trk.kalman.tracks[0].start.Y() > YCent);return IsTrue;})
const Binning SmallBins
caf::Proxy< caf::SRTrackBranch > trk
Definition: SRProxy.h:2145
const Var kSANumuContPID([](const caf::SRProxy *sr){return sr->sel.cosrej.numuSAcontpid;})
const Cut kW_BR([](const caf::SRProxy *sr){bool IsTrue(sr->trk.kalman.tracks[0].start.X() > XCent && sr->trk.kalman.tracks[0].start.Y()< YCent);return IsTrue;})
const Var kCCE
Definition: NumuVars.h:21
const Var kNHitTrk([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return(float) sr->trk.kalman.tracks[0].nhit;})
const float YMaxEx
caf::StandardRecord * sr
const Binning CompBins
const Binning CompZBins
const Cut kW_TL([](const caf::SRProxy *sr){bool IsTrue=(sr->trk.kalman.tracks[0].start.X()< XCent && sr->trk.kalman.tracks[0].start.Y() > YCent);return IsTrue;})
const Binning CellsBins
const Var kTrkLenXY([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;float XLen=(sr->trk.kalman.tracks[0].start.X()-sr->trk.kalman.tracks[0].stop.X())/100;float YLen=(sr->trk.kalman.tracks[0].start.Y()-sr->trk.kalman.tracks[0].stop.Y())/100;return XLen-YLen;})
caf::Proxy< int > kalbakcell
Definition: SRProxy.h:817
caf::Proxy< int > kalfwdcell
Definition: SRProxy.h:822
caf::Proxy< caf::SRKalman > kalman
Definition: SRProxy.h:1797
const Var kKalBakCell([](const caf::SRProxy *sr){return sr->sel.contain.kalbakcell;})
const Cut kW_BL([](const caf::SRProxy *sr){bool IsTrue(sr->trk.kalman.tracks[0].start.X()< XCent && sr->trk.kalman.tracks[0].start.Y()< YCent);return IsTrue;})
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
const Var kRTOvTNuE
const Binning NumHitBins
const Var kVisETrk([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return(float) sr->trk.kalman.tracks[0].calE;})
caf::Proxy< float > calE
Definition: SRProxy.h:1292
const Binning LengthBins
const Var kTrueMuonE([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return 0.f;if(sr->mc.nu[0].prim.empty()) return 0.f;if(std::abs(sr->mc.nu[0].prim[0].pdg)!=13) return 0.f;return float(sr->mc.nu[0].prim[0].p.E);})
Definition: NumuVars.h:107
const float XMinEx
const Var kTrueHadE
const Var kVisEHad([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return(float)(sr->slc.calE-sr->trk.kalman.tracks[0].calE);})
const unsigned int NumBins
const Binning RangeBins
const Binning NumTrkBins
const Binning TimeFBins
const Var kMaxKalZPos([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return std::max(sr->trk.kalman.tracks[0].start.Z()/100, sr->trk.kalman.tracks[0].stop.Z()/100);})
caf::Proxy< std::vector< caf::SRKalmanTrack > > tracks
Definition: SRProxy.h:1780
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2141
T min(const caf::Proxy< T > &a, T b)
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const float XCent
const Binning TinyBins
const Binning RatioBins
const Var kEnPHTrk([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return(float)(sr->trk.kalman.tracks[0].calE)/(float)(1.78 *sr->trk.kalman.tracks[0].nhit);})