Evaluator.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: Evaluator
3 // File: Evaluator.cxx
4 //
5 ////////////////////////////////////////////////////////////////////////
8 
9 //------------------------------------------------------------------------------
11 {
12 }
13 
14 //------------------------------------------------------------------------------
16 {
17 }
18 
19 //------------------------------------------------------------------------------
21 {
22  // look in CAFAna/TimingCuts.h for definitions of the timing constants
23 
24  const double BeamWindowMinMicroSec = 217;
25  const double BeamWindowMaxMicroSec = 229;
26  const double PeakShiftMicroSec = 64;
27  const int LastBadTimingRun = 17945;
28 
29  auto time = slice.MeanTNS();
30 
31  LOG_DEBUG("Evaluator")
32  << "the mean time is " << time
33  << "\ncurrent Run " << fCurrentRun << "/" << LastBadTimingRun
34  << "\nbeam window min " << 1000 * BeamWindowMinMicroSec
35  << "\nbeam window max " << 1000 * BeamWindowMaxMicroSec
36  << "\nbeam offset " << 1000 * PeakShiftMicroSec;
37 
38  if(fCurrentRun <= LastBadTimingRun &&
39  time > 1000 * (BeamWindowMinMicroSec + PeakShiftMicroSec) &&
40  time < 1000 * (BeamWindowMaxMicroSec + PeakShiftMicroSec)) return true;
41 
42  if(time > 1000 * BeamWindowMinMicroSec &&
43  time < 1000 * BeamWindowMaxMicroSec) return true;
44 
45  return false;
46 }
47 
48 //------------------------------------------------------------------------------
49 // This is a stop gap \TODO: remove at some point
50 
51 std::pair<int, int> calcFirstLastLivePlane(int plane,
52  std::bitset<14> binary,
54  //if not the FD, return full ND size
55  if (det != novadaq::cnv::kFARDET) return std::pair<int, int>(0,213);
56  int testDB = (plane / 64);
57  int minblock = testDB;
58  int maxblock = testDB;
59  //find block boundaries;
60  for (int i=testDB-1; i>=0; --i){
61  if (binary[i]) minblock=i;
62  else break;
63  }
64  for (int i=testDB+1; i<14; ++i){
65  if (binary[i]) maxblock=i;
66  else break;
67  }
68  return std::pair<int, int>(64*(minblock), 64*(maxblock+1)-1);
69 }
70 
71 
72 //------------------------------------------------------------------------------
74 {
75  if(fDetId != novadaq::cnv::kFARDET) return true;
76 
78  unsigned int dibmask = (rh->GoodDiBlockMask()&rh->GetConfiguration());
79  std::bitset<14> binary(dibmask);
80 
81  std::pair<int,int> planesA = calcFirstLastLivePlane(slice.MinPlane(), binary, fDetId);
82  std::pair<int,int> planesB = calcFirstLastLivePlane(slice.MaxPlane(), binary, fDetId);
83 
84  LOG_DEBUG("Evaluator")
85  << "min plane: " << slice.MinPlane() << " max plane: " << slice.MaxPlane()
86  << " " << planesA.first << " " << planesA.second
87  << " " << planesB.first << " " << planesB.second
88  << " " << (planesA.second - planesA.first + 1)/64 << " > 3";
89 
90  if ((planesA.first != planesB.first) || (planesA.second != planesB.second))
91  return false;
92 
93  // 1/64 = 0.015625
94  return ((planesA.second - planesA.first + 1) * 0.015625 > 3);
95 }
96 
97 /******
98 //------------------------------------------------------------------------------
99 static bool skim::Evaluator::ShowerByEnergy(slid::ShowerLID const* s1, slid::ShowerLID const* s2)
100 {
101  return s1->ShowerEnergy() > s2->ShowerEnergy();
102 }
103 
104 //------------------------------------------------------------------------------
105 static bool skim::Evaluator::ProngByLength(rb::Prong const* p1, rb::Prong const* p2)
106 {
107  return p1->TotalLength() > p2->TotalLength();
108 }
109 ********/
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
novadaq::cnv::DetId fDetId
the id of the detector we are looking at
Definition: Evaluator.h:84
TH2 * rh
Definition: drawXsec.C:5
std::pair< int, int > calcFirstLastLivePlane(int plane, std::bitset< 14 > binary, novadaq::cnv::DetId det)
Definition: Evaluator.cxx:51
A collection of associated CellHits.
Definition: Cluster.h:47
bool CheckTiming(rb::Cluster const &slice)
Definition: Evaluator.cxx:20
Far Detector at Ash River, MN.
virtual ~Evaluator()
Definition: Evaluator.cxx:15
unsigned int MinPlane(geo::View_t view=geo::kXorY) const
Definition: Cluster.cxx:462
double MeanTNS(rb::AveragingScheme scheme=kDefaultScheme) const
Definition: Cluster.cxx:554
unsigned int MaxPlane(geo::View_t view=geo::kXorY) const
Definition: Cluster.cxx:508
int fCurrentRun
the current run number
Definition: Evaluator.h:88
int GoodDiBlockMask(int subrun=-1, bool reload=false)
bool CheckSliceQuality(rb::Cluster const &slice)
Definition: Evaluator.cxx:73