LEMPresel_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////
2 /// \file LEMPresel_module.cc
3 /// \brief Speed up LEM processing, mostly of FD data
4 /// \author Christopher Backhouse - bckhouse@caltech.edu
5 ///////////////////////////////////////////////////////////////////////////
6 
13 #include "fhiclcpp/ParameterSet.h"
14 
15 #include "CosRej/NueCosRej.h"
16 #include "NovaDAQConventions/DAQConventions.h"
17 #include "RecoBase/Cluster.h"
18 #include "RecoBase/FilterList.h"
20 
21 namespace presel
22 {
23  /// Speed up LEM processing, mostly of FD data
24  class LEMPresel: public art::EDProducer
25  {
26  public:
27  explicit LEMPresel(const fhicl::ParameterSet& pset);
28  virtual ~LEMPresel();
29  virtual void produce(art::Event& evt) override;
30 
31  protected:
32  bool PassesContainment(const cosrej::NueCosRej& cr) const;
33 
36 
37  double fMinCaloE;
38  double fMaxCaloE;
39 
40  double fEastDist;
41  double fWestDist;
42  double fTopDist;
43  double fBottomDist;
44  double fFrontDist;
45  double fBackDist;
46  };
47 
48  //----------------------------------------------------------------------
50  fSlicerLabel (pset.get<std::string>("SlicerLabel")),
51  fNueCosRejLabel(pset.get<std::string>("NueCosRejLabel")),
52  fMinCaloE (pset.get<double>("MinCaloE")),
53  fMaxCaloE (pset.get<double>("MaxCaloE")),
54  fEastDist (pset.get<double>("EastDist")),
55  fWestDist (pset.get<double>("WestDist")),
56  fTopDist (pset.get<double>("TopDist")),
57  fBottomDist(pset.get<double>("BottomDist")),
58  fFrontDist (pset.get<double>("FrontDist")),
59  fBackDist (pset.get<double>("BackDist"))
60  {
61  produces<rb::FilterList<rb::Cluster>>();
62  }
63 
64  //----------------------------------------------------------------------
66  {
67  }
68 
69  //----------------------------------------------------------------------
71  {
72  std::unique_ptr< rb::FilterList<rb::Cluster> > filtcol(new rb::FilterList<rb::Cluster>);
73 
75  if(det->DetId() != novadaq::cnv::kFARDET){
76  evt.put(std::move(filtcol));
77  return;
78  }
79 
81  evt.getByLabel(fSlicerLabel, slices);
82 
84 
85  const int sliceMax = slices->size();
86  for(int sliceIdx = 0; sliceIdx < sliceMax; ++sliceIdx){
87  const rb::Cluster& slice = (*slices)[sliceIdx];
88  if(slice.IsNoise()) continue;
89 
90  const double caloE = slice.CalorimetricEnergy();
91  // Make sure to test calE even if NueCosRej is unavailable
92  if(caloE < fMinCaloE || (fMaxCaloE > 0 && caloE > fMaxCaloE)){
93  filtcol->Add(slices, sliceIdx);
94  // Once we've filtered the slice there's no need to check anything else
95  continue;
96  }
97 
98  std::vector< art::Ptr<cosrej::NueCosRej> > cosrejs = fmcr.at(sliceIdx);
99  if(cosrejs.empty()) continue;
100  assert(cosrejs.size() == 1);
101 
102  if(!PassesContainment(*cosrejs[0])){
103  filtcol->Add(slices, sliceIdx);
104  }
105  } // end for sliceIdx
106 
107  evt.put(std::move(filtcol));
108  }
109 
110  //----------------------------------------------------------------------
112  {
113  if(cr.StartDistToEast() < fEastDist ||
114  cr.StopDistToEast() < fEastDist ) return false;
115 
116  if(cr.StartDistToWest() < fWestDist ||
117  cr.StopDistToWest() < fWestDist ) return false;
118 
119  if(cr.StartDistToTop() < fTopDist ||
120  cr.StopDistToTop() < fTopDist ) return false;
121 
122  if(cr.StartDistToBottom() < fBottomDist ||
123  cr.StopDistToBottom() < fBottomDist) return false;
124 
125  if(cr.StartDistToFront() < fFrontDist ||
126  cr.StopDistToFront() < fFrontDist ) return false;
127 
128  if(cr.StartDistToBack() < fBackDist ||
129  cr.StopDistToBack() < fBackDist ) return false;
130 
131  return true;
132  }
133 
135 } // end namespace presel
Preselection Object.
Definition: FillPIDs.h:20
novadaq::cnv::DetId DetId() const
What detector are we in?
A simple list of products that have been marked "filtered out".
Definition: FilterList.h:74
double StopDistToTop() const
Perpendicular distance of stop point of the leading prong to the top edge of the detector.
Definition: NueCosRej.h:72
A collection of associated CellHits.
Definition: Cluster.h:47
double StopDistToWest() const
Perpendicular distance of stop point of the leading prong to the west edge of the detector (west is p...
Definition: NueCosRej.h:88
double StopDistToFront() const
Perpendicular distance of stop point of the leading prong to the front edge of the detector...
Definition: NueCosRej.h:80
DEFINE_ART_MODULE(TestTMapFile)
LEMPresel(const fhicl::ParameterSet &pset)
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
Far Detector at Ash River, MN.
double CalorimetricEnergy(EEnergyCalcScheme escheme=kRecomputeEnergy) const
Simple estimate of neutrino energy.
Definition: Cluster.cxx:439
int evt
double StartDistToBottom() const
Perpendicular distance of start point of the leading prong to the bottom edge of the detector...
Definition: NueCosRej.h:52
double StopDistToBack() const
Perpendicular distance of stop point of the leading prong to the back edge of the detector...
Definition: NueCosRej.h:84
std::string fSlicerLabel
double StartDistToTop() const
Perpendicular distance of start point of the leading prong to the top edge of the detector...
Definition: NueCosRej.h:48
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
bool PassesContainment(const cosrej::NueCosRej &cr) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
double StartDistToEast() const
Perpendicular distance of start point of the leading prong to the east edge of the detector (east is ...
Definition: NueCosRej.h:68
double StopDistToBottom() const
Perpendicular distance of stop point of the leading prong to the bottom edge of the detector...
Definition: NueCosRej.h:76
assert(nhit_max >=nhit_nbins)
double StartDistToBack() const
Perpendicular distance of start point of the leading prong to the back edge of the detector...
Definition: NueCosRej.h:60
virtual void produce(art::Event &evt) override
double StartDistToFront() const
Perpendicular distance of start point of the leading prong to the front edge of the detector...
Definition: NueCosRej.h:56
bool IsNoise() const
Is the noise flag set?
Definition: Cluster.h:163
double StopDistToEast() const
Perpendicular distance of stop point of the leading prong to the east edge of the detector (east is n...
Definition: NueCosRej.h:92
Speed up LEM processing, mostly of FD data.
std::string fNueCosRejLabel
double StartDistToWest() const
Perpendicular distance of start point of the leading prong to the west edge of the detector (west is ...
Definition: NueCosRej.h:64