Cuts.h
Go to the documentation of this file.
1 #pragma once
2 
3 // Definition of the generic Cut object
4 #include "CAFAna/Core/Cut.h"
5 
7 
8 namespace ana
9 {
10  /// \brief Does this event pass the nue preselection?
11  ///
12  /// In this case the selection is complicated enough to be split out into a
13  /// separate usual function.
14  extern const Cut kPassesPresel;
15 
16  /// Extremely crude CC selection, only for use in some old demos
17  extern const Cut kCrudeCCSel;
18 
19  /// numu group selection: see NumuCuts.h
20  extern const Cut kUCCosmicRej;
21 
22  extern const Cut kNDContainNue;
23 
24  // Like kNDContainNue, but with FD-appropriate dimensions
25  extern const Cut kFDContainNue;
26 
27  //--------------------------------------------------------------------------
28  // Data neutrino search useful cuts - likely temporary, but here for
29  // convenience for now as multiple folks use same cuts
30  //
31  /// Cut events that are not in time 208us - 236us
32  extern const Cut kInTime;
33 
34  /// An "angle-variable" type cut based on looking at events with a track-hit to slice-hit ratio > 0.88.
35  /// Cuts vary based on number of hits in the slice to carve out a curved 2D space. \hideinitializer
36  extern const Cut kAngVar;
37 
38  /// XY containment in 2 di-block era based on slice box coordinates
39  extern const Cut kXYContainment;
40 
41  /// 2 di-block era contained-type event selector
42  extern const Cut kContained;
43 
44  /// 2 di-block era through-going-type event selector
45  extern const Cut kThroughGoing;
46 
47  /// 2 di-block era Entering-type event selector
48  extern const Cut kEnter;
49 
50  /// 2 di-block era Exiting-type event selector
51  extern const Cut kExit;
52 
53  /// 2 di-block era cleanup before applying other cuts
54  extern const Cut kCleanup;
55 
56  /// functions for sliding containment, useful for modeling smaller detector for early reach
57  class ContainFxn
58  {
59  public:
60  ContainFxn(double zmax) : zmax(zmax)
61  {
62  }
63 
64  bool operator()(const caf::SRProxy* sr) const;
65 
66  protected:
67  double zmax;
68  };
69 
71  {
72  public:
73  NotContainFxn(double zmax) : zmax(zmax)
74  {
75  }
76 
77  bool operator()(const caf::SRProxy* sr) const;
78 
79  protected:
80  double zmax;
81  };
82 
83  //standard ND nue cuts on containment, length, energy, reconstruction used in docdb-12240
84  extern const Cut kNueNDCont;
85 
86  // ND truth containment. Looks at neutrino vertex and checks
87  // if it's outside the detector
88  extern const Cut kTruthContainedND;
89 
90  extern const Cut kIsSingleGap;
91 
93 
94  extern const Cut kIsFarDet;
95 
96 } // namespace
const Cut kTruthContainedND([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;if(fabs(sr->mc.nu[0].vtx.X()) > 200|| fabs(sr->mc.nu[0].vtx.Y()) > 200|| sr->mc.nu[0].vtx.Z()< 0|| sr->mc.nu[0].vtx.Z() > 1650) return false;return true;})
Definition: Cuts.h:88
const Cut kAngVar([](const caf::SRProxy *sr){std::cout<< "\n\n\n"<< "WARNING: This cut used sandbox variables which no longer exist. Aborting."<< std::endl;abort();return false;})
Definition: Cuts.h:36
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
bool operator()(const caf::SRProxy *sr) const
Definition: Cuts.cxx:162
const Cut kCrudeCCSel([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks==0) return false;return sr->trk.kalman.tracks[0].len > 200;})
Extremely crude CC selection, only for use in some old demos.
Definition: Cuts.h:17
ContainFxn(double zmax)
Definition: Cuts.h:60
const Cut kEnter([](const caf::SRProxy *sr){return(sr->slc.boxmin.Z()< 100 && sr->slc.boxmax.Z()< 800);})
2 di-block era Entering-type event selector
Definition: Cuts.h:48
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2108
const Cut kXYContainment([](const caf::SRProxy *sr){return(sr->slc.boxmin.X() >-700 && sr->slc.boxmin.Y() >-700 && sr->slc.boxmax.X()< 700 && sr->slc.boxmax.Y()< 660);})
XY containment in 2 di-block era based on slice box coordinates.
Definition: Cuts.h:39
NotContainFxn(double zmax)
Definition: Cuts.h:73
const Cut kIsFarDet([](const caf::SRProxy *sr){return sr->hdr.det==caf::kFARDET;})
Definition: Cuts.h:94
const Cut kExit([](const caf::SRProxy *sr){return(sr->slc.boxmin.Z() > 100 && sr->slc.boxmax.Z() > 800);})
2 di-block era Exiting-type event selector
Definition: Cuts.h:51
const Cut kInTime([](const caf::SRProxy *sr){return(sr->slc.meantime >=208000 && sr->slc.meantime<=236000);})
Cut events that are not in time 208us - 236us.
Definition: Cuts.h:32
const Cut kContained([](const caf::SRProxy *sr){return(sr->slc.boxmin.Z() > 100 && sr->slc.boxmax.Z()< 800);})
2 di-block era contained-type event selector
Definition: Cuts.h:42
functions for sliding containment, useful for modeling smaller detector for early reach ...
Definition: Cuts.h:57
const Cut kNueNDCont([](const caf::SRProxy *sr){bool cut=false;if(!sr->vtx.elastic.IsValid) return cut;if(sr->vtx.elastic.fuzzyk.npng==0) return cut;if(sr->vtx.elastic.fuzzyk.nshwlid==0) return cut;if(sr->slc.nhit< 20) return cut;if(std::min(sr->vtx.elastic.fuzzyk.png[0].shwlid.start.X(), sr->vtx.elastic.fuzzyk.png[0].shwlid.stop.X())< -180.0) return cut;if(std::max(sr->vtx.elastic.fuzzyk.png[0].shwlid.start.X(), sr->vtx.elastic.fuzzyk.png[0].shwlid.stop.X()) > 180.0) return cut;if(std::min(sr->vtx.elastic.fuzzyk.png[0].shwlid.start.Y(), sr->vtx.elastic.fuzzyk.png[0].shwlid.stop.Y())< -180.0) return cut;if(std::max(sr->vtx.elastic.fuzzyk.png[0].shwlid.start.Y(), sr->vtx.elastic.fuzzyk.png[0].shwlid.stop.Y()) > 180.0) return cut;if(std::min(sr->vtx.elastic.fuzzyk.png[0].shwlid.start.Z(), sr->vtx.elastic.fuzzyk.png[0].shwlid.stop.Z())< 25.0) return cut;if(std::max(sr->vtx.elastic.fuzzyk.png[0].shwlid.start.Z(), sr->vtx.elastic.fuzzyk.png[0].shwlid.stop.Z()) > 1225.0) return cut;if(sr->vtx.elastic.vtx.X()< -140.0) return cut;if(sr->vtx.elastic.vtx.X() > 140.0) return cut;if(sr->vtx.elastic.vtx.Y()< -140.0) return cut;if(sr->vtx.elastic.vtx.Y() > 140.0) return cut;if(sr->vtx.elastic.vtx.Z()< 100.0) return cut;if(sr->vtx.elastic.vtx.Z() > 550.0) return cut;if(sr->vtx.elastic.fuzzyk.png[sr->vtx.elastic.fuzzyk.longestidx].len > 600.0) return cut;if(sr->slc.calE > 5.0) return cut;if(sr->vtx.elastic.fuzzyk.png[sr->vtx.elastic.fuzzyk.longestidx].shwlid.gap > 150.0) return cut;cut=true;return cut;})
Definition: Cuts.h:84
const Cut kFDContainNue([](const caf::SRProxy *sr){if(sr->vtx.elastic.fuzzyk.nshwlid<=0) return false;const caf::SRShowerLIDProxy &shwlid=sr->vtx.elastic.fuzzyk.png[0].shwlid;const caf::SRVector3DProxy &start=shwlid.start;const caf::SRVector3DProxy &stop=shwlid.stop;return(std::min(start.X(), stop.X()) >-725 && std::max(start.X(), stop.X())< +725 && std::min(start.Y(), stop.Y()) >-725 && std::max(start.Y(), stop.Y())< +725 && std::min(start.Z(), stop.Z()) > 50 && std::max(start.Z(), stop.Z())< 5910);})
Definition: Cuts.h:25
const Cut kUCCosmicRej([](const caf::SRProxy *sr){return(sr->sel.cosrej.anglekal > 0.5 && sr->sel.cosrej.numuunconttunedpid > 0.55);})
numu group selection: see NumuCuts.h
Definition: Cuts.h:20
const Cut kPassesPresel(PassesPreselFunc)
Does this event pass the nue preselection?
Definition: Cuts.h:14
caf::StandardRecord * sr
const Cut kCleanup([](const caf::SRProxy *sr){return(sr->slc.nhit > 20 && sr->trk.cosmic.tracks[0].view==2);})
2 di-block era cleanup before applying other cuts
Definition: Cuts.h:54
const Cut kNDContainNue([](const caf::SRProxy *sr){if(sr->vtx.elastic.fuzzyk.nshwlid<=0) return false;const caf::SRShowerLIDProxy &shwlid=sr->vtx.elastic.fuzzyk.png[0].shwlid;const caf::SRVector3DProxy &start=shwlid.start;const caf::SRVector3DProxy &stop=shwlid.stop;return(std::min(start.X(), stop.X()) >-150 && std::max(start.X(), stop.X())< +150 && std::min(start.Y(), stop.Y()) >-150 && std::max(start.Y(), stop.Y())< +150 && std::min(start.Z(), stop.Z()) > 50 && std::max(start.Z(), stop.Z())< 1230);})
Definition: Cuts.h:22
const Cut kIsSingleGap([](const caf::SRProxy *sr){ if(sr->hdr.det!=caf::kFARDET) return false;std::bitset< 14 > binary(sr->hdr.dibmask);if(binary[0]==1) return false;bool gap=false;for(int i=0;i< 13;++i){if(binary[i]==0 &&binary[i+1]==1){if(gap) return false;gap=true;}}return gap;})
Definition: Cuts.h:90
const Cut kIsNeutrinoInUpstreamDeadDBSingleGap([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;if(sr->hdr.det!=caf::kFARDET) return false;std::bitset< 14 > binary(sr->hdr.dibmask);if(binary[0]==1) return false;int FirstActiveDB=0;for(int i=0;i< 14;++i){if(binary[i]==0 &&binary[i+1]==1){FirstActiveDB=i+1;}} int nspace=1+2 *FirstActiveDB;double start=nspace *0.45+32 *(6.61+0.0379)*2 *FirstActiveDB;bool isUpStreamOfStart=sr->mc.nu[0].vtx.z< start;return isUpStreamOfStart;})
Definition: Cuts.h:92
const Cut kThroughGoing([](const caf::SRProxy *sr){return(sr->slc.boxmin.Z()< 100 && sr->slc.boxmax.Z() > 800);})
2 di-block era through-going-type event selector
Definition: Cuts.h:45
double zmax
Definition: Cuts.h:67
double zmax
Definition: Cuts.h:80