AnalysisMasks.cxx
Go to the documentation of this file.
2 
4 
5 namespace ana
6 {
7  //intended for FD Only
8  std::pair<int, int> calcFirstLastLivePlane(int plane,
9  std::bitset<14> binary,
10  caf::Det_t det){
11  //if not the FD, return full ND size
12  if (det != caf::kFARDET) return std::pair<int, int>(0,213);
13  int testDB = (plane / 64);
14  int minblock = testDB;
15  int maxblock = testDB;
16  //find block boundaries;
17  for (int i=testDB-1; i>=0; --i){
18  if (binary[i]) minblock=i;
19  else break;
20  }
21  for (int i=testDB+1; i<14; ++i){
22  if (binary[i]) maxblock=i;
23  else break;
24  }
25  return std::pair<int, int>(64*(minblock), 64*(maxblock+1)-1);
26  }
27 
28 
29  /// Cut to introduce Analysis diblock masking rules at CAFAna stage
30  /// to work around cases where RunHistory did not apply the rules at the
31  /// reco stage. Keep any section of detector larger then 4 diblocks
33  [](const caf::SRProxy* sr)
34  {
35  //only look at diblock masking for FD
36  if (sr->hdr.det != caf::kFARDET) return true;
37  //cast diblock mast as 14 bit binary number, with
38  //diblock 1 being the least significant bit
39  std::bitset<14> binary(sr->hdr.dibmask);
40  std::pair<int,int> planesA = calcFirstLastLivePlane(sr->slc.firstplane,
41  binary);
42  std::pair<int,int> planesB = calcFirstLastLivePlane(sr->slc.lastplane,
43  binary);
44  if ((planesA.first != planesB.first) || (planesA.second != planesB.second))
45  return false;
46  return ((planesA.second - planesA.first + 1)/64 >= 4);
47  });
48 
49 
50  /// A cut to select only events in a very small central region of the detector.
51  const Cut kBoxCutIdeal([](const caf::SRProxy* sr)
52  {
53  if (sr->mc.nnu == 0) return false;
54  std::bitset<14> binary(sr->hdr.dibmask);
55  std::pair<int,int> planesA = calcFirstLastLivePlane(sr->slc.firstplane, binary);
56  std::pair<int,int> planesB = calcFirstLastLivePlane(sr->slc.lastplane , binary);
57  if ((planesA.first != planesB.first) || (planesA.second != planesB.second))
58  return false;
59  if ((planesA.second - planesA.first + 1)/64 < 14)
60  return false;
61  if (sr->mc.nu[0].vtx.x < -100) return false;
62  if (sr->mc.nu[0].vtx.x > 100) return false;
63  if (sr->mc.nu[0].vtx.y < -100) return false;
64  if (sr->mc.nu[0].vtx.y > 100) return false;
65  if (sr->mc.nu[0].vtx.z < 1000) return false;
66  if (sr->mc.nu[0].vtx.z > 3500) return false;
67  return true;
68  });
69 
70  /// A cut to select only events in the fiducial region of the detector.
71  /// Probably isn't perfect, but keeps about 98% of the fiducial mass.
72  const Cut kBoxCut([](const caf::SRProxy* sr)
73  {
74  if (sr->mc.nnu == 0) return false;
75  if (sr->mc.nu[0].vtx.x < - 762) return false;
76  if (sr->mc.nu[0].vtx.x > 763) return false;
77  if (sr->mc.nu[0].vtx.y < - 762) return false;
78  if (sr->mc.nu[0].vtx.y > 763) return false;
79  std::bitset<14> binary(sr->hdr.dibmask);
80  std::pair<int,int> planesA = calcFirstLastLivePlane(sr->slc.firstplane, binary);
81  std::pair<int,int> planesB = calcFirstLastLivePlane(sr->slc.lastplane , binary);
82  if ((planesA.first != planesB.first) || (planesA.second != planesB.second))
83  return false;
84  if ((planesA.second - planesA.first + 1)/64 < 4) return false;
85  int first = planesA.first/64;
86  int last = (planesA.second +1)/64;
87  if (sr->mc.nu[0].vtx.z < ((first)*426.0)) return false;
88  if (sr->mc.nu[0].vtx.z > ((last)*426.0)) return false;
89  return true;
90  });
91 }
Det_t
Which NOvA detector?
Definition: SREnums.h:7
Far Detector at Ash River.
Definition: SREnums.h:11
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Cut kApplySecondAnalysisMask([](const caf::SRProxy *sr){if(sr->hdr.det!=caf::kFARDET) return true; std::bitset< 14 > binary(sr->hdr.dibmask);std::pair< int, int > planesA=calcFirstLastLivePlane(sr->slc.firstplane, binary);std::pair< int, int > planesB=calcFirstLastLivePlane(sr->slc.lastplane, binary);if((planesA.first!=planesB.first)||(planesA.second!=planesB.second)) return false;return((planesA.second-planesA.first+1)/64 >=4);})
Definition: AnalysisMasks.h:18
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Definition: SRProxy.h:618
caf::Proxy< short int > nnu
Definition: SRProxy.h:617
if(dump)
const Cut kBoxCut([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;if(sr->mc.nu[0].vtx.x< -762) return false;if(sr->mc.nu[0].vtx.x > 763) return false;if(sr->mc.nu[0].vtx.y< -762) return false;if(sr->mc.nu[0].vtx.y > 763) return false;std::bitset< 14 > binary(sr->hdr.dibmask);std::pair< int, int > planesA=calcFirstLastLivePlane(sr->slc.firstplane, binary);std::pair< int, int > planesB=calcFirstLastLivePlane(sr->slc.lastplane, binary);if((planesA.first!=planesB.first)||(planesA.second!=planesB.second)) return false;if((planesA.second-planesA.first+1)/64< 4) return false;int first=planesA.first/64;int last=(planesA.second+1)/64;if(sr->mc.nu[0].vtx.z< ((first)*426.0)) return false;if(sr->mc.nu[0].vtx.z >((last)*426.0)) return false;return true;})
Definition: AnalysisMasks.h:25
caf::StandardRecord * sr
caf::Proxy< unsigned int > lastplane
Definition: SRProxy.h:1309
const Cut kBoxCutIdeal([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;std::bitset< 14 > binary(sr->hdr.dibmask);std::pair< int, int > planesA=calcFirstLastLivePlane(sr->slc.firstplane, binary);std::pair< int, int > planesB=calcFirstLastLivePlane(sr->slc.lastplane, binary);if((planesA.first!=planesB.first)||(planesA.second!=planesB.second)) return false;if((planesA.second-planesA.first+1)/64< 14) return false;if(sr->mc.nu[0].vtx.x< -100) return false;if(sr->mc.nu[0].vtx.x > 100) return false;if(sr->mc.nu[0].vtx.y< -100) return false;if(sr->mc.nu[0].vtx.y > 100) return false;if(sr->mc.nu[0].vtx.z< 1000) return false;if(sr->mc.nu[0].vtx.z > 3500) return false;return true;})
A cut to select only events in a very small central region of the detector.
Definition: AnalysisMasks.h:21
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:2138
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
std::pair< int, int > calcFirstLastLivePlane(int plane, std::bitset< 14 > binary, caf::Det_t det)
caf::Proxy< unsigned int > firstplane
Definition: SRProxy.h:1305
caf::Proxy< short unsigned int > dibmask
Definition: SRProxy.h:235
caf::Proxy< caf::Det_t > det
Definition: SRProxy.h:232