All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Types | Private Attributes | List of all members
HitSelector Class Reference
Inheritance diagram for HitSelector:

Public Member Functions

 HitSelector (fhicl::ParameterSet const &pset)
 
virtual ~HitSelector ()
 Destructor. More...
 
virtual void reconfigure (fhicl::ParameterSet const &pset)
 
virtual void produce (art::Event &e)
 
virtual void beginJob ()
 Begin job method. More...
 
virtual void endJob ()
 End job method. More...
 

Private Types

using HitPtrVector = std::vector< art::Ptr< recob::Hit >>
 

Private Attributes

art::InputTag fHitProducerLabel
 The full collection of hits. More...
 
std::vector< float > fMinMaxPulseHeighMulti
 Max pulse height of a pulse train must be this large. More...
 
std::vector< float > fMinPulseHeightMulti
 Multi hit snippets, minimum pulse height per plane. More...
 
std::vector< float > fMinPulseWidthMulti
 Multi hit snippets, minimum pulse width per plane. More...
 
std::vector< float > fMinPulseHeightSingle
 Single hit snippets, minimum pulse height per plane. More...
 
std::vector< float > fMinPulseWidthSingle
 Single hit snippets, minimum pulse width per plane. More...
 
int fNumEvent
 Number of events seen. More...
 

Detailed Description

Definition at line 38 of file HitSelector_module.cc.

Member Typedef Documentation

using HitSelector::HitPtrVector = std::vector<art::Ptr<recob::Hit>>
private

Definition at line 54 of file HitSelector_module.cc.

Constructor & Destructor Documentation

HitSelector::HitSelector ( fhicl::ParameterSet const &  pset)
explicit

Constructor.

Arguments:

pset - Fcl parameters.

Definition at line 77 of file HitSelector_module.cc.

77  : EDProducer{pset},
78 fNumEvent(0)
79 {
80  reconfigure(pset);
81 
82  // let HitCollectionCreator declare that we are going to produce
83  // hits and associations with wires and raw digits
84  // (with no particular product label)
86 
87  // Report.
88  mf::LogInfo("HitSelector") << "HitSelector configured\n";
89 }
int fNumEvent
Number of events seen.
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
Definition: HitCreator.cxx:248
virtual void reconfigure(fhicl::ParameterSet const &pset)
HitSelector::~HitSelector ( )
virtual

Destructor.

Definition at line 93 of file HitSelector_module.cc.

94 {}

Member Function Documentation

void HitSelector::beginJob ( )
virtual

Begin job method.

Definition at line 115 of file HitSelector_module.cc.

116 {
117 // auto const* detp = lar::providerFrom<detinfo::DetectorPropertiesService>();
118 // auto const* geo = lar::providerFrom<geo::Geometry>();
119 // auto const* ts = lar::providerFrom<detinfo::DetectorClocksService>();
120 }
void HitSelector::endJob ( )
virtual

End job method.

Definition at line 240 of file HitSelector_module.cc.

241 {
242  mf::LogInfo("HitSelector")
243  << "HitSelector statistics:\n"
244  << " Number of events = " << fNumEvent;
245 }
int fNumEvent
Number of events seen.
void HitSelector::produce ( art::Event &  evt)
virtual

Produce method.

Arguments:

evt - Art event.

This is the primary method. The goal is to produce a list of recob::Hit objects which are a "clean" subset of all hits and which are believed to be due to a neutrino interaction. It does this by considering input CosmicTag objects, relating them to PFParticles/Tracks and removing the hits associated to those objects which are believed to be Cosmic Rays.

Definition at line 135 of file HitSelector_module.cc.

136 {
137  ++fNumEvent;
138 
139  // Start by looking up the original hits
140  art::Handle< std::vector<recob::Hit> > hitHandle;
141  evt.getByLabel(fHitProducerLabel, hitHandle);
142 
143  // also get the associated wires and raw digits;
144  // we assume they have been created by the same module as the hits
145  art::FindOneP<raw::RawDigit> hitToRawDigitAssns(hitHandle, evt, fHitProducerLabel);
146  art::FindOneP<recob::Wire> hitToWireAssns( hitHandle, evt, fHitProducerLabel);
147 
148  // this object contains the hit collection
149  // and its associations to wires and raw digits:
151  hitToWireAssns.isValid(),
152  hitToRawDigitAssns.isValid()
153  );
154 
155  // If there are no hits then there should be no output
156  if (hitHandle.isValid())
157  {
158  HitPtrVector hitPtrVec;
159  HitPtrVector hitSnippetVec;
160 
161  art::fill_ptr_vector(hitPtrVec, hitHandle);
162 
163  int lastHitIndex = 0;
164 
165  // Loop the hits and make some plots
166  for(const auto& curHitPtr : hitPtrVec)
167  {
168  // Have we collected all of the hits on the same snippet?
169  if (!hitSnippetVec.empty() && lastHitIndex >= curHitPtr->LocalIndex())
170  {
171  // Recover plane
172  int plane = hitSnippetVec.front()->WireID().Plane;
173 
174  // Only worried about multi hit snippets
175  if (hitSnippetVec.size() > 1)
176  {
177  // Sort in order of largest to smallest pulse height
178  std::sort(hitSnippetVec.begin(),hitSnippetVec.end(),[](const auto& left, const auto& right){return left->PeakAmplitude() > right->PeakAmplitude();});
179 
180  float maxPulseHeight = hitSnippetVec.front()->PeakAmplitude();
181 
182  // Require the largest pulse in the train to be above threshold
183  if (maxPulseHeight > fMinMaxPulseHeighMulti[plane])
184  {
185  // Loop over all hits...
186  for(size_t idx = 0; idx < hitSnippetVec.size(); idx++)
187  {
188  art::Ptr<recob::Hit> hitPtr = hitSnippetVec[idx];
189 
190  float pulseHeight = hitPtr->PeakAmplitude();
191  float pulseWid = hitPtr->RMS();
192  int numDOF = hitPtr->DegreesOfFreedom();
193 
194  // Watch for case of long pulse trains (numDOF == 1) and keep all of these no matter
195  // Also always keep the largest (first) pulse
196  // Otherwise, select on minimum pulse height and width
197  if (idx == 0 || numDOF == 1 || (pulseHeight > fMinPulseHeightMulti[plane] && pulseWid > fMinPulseWidthMulti[plane]))
198  {
199  art::Ptr<recob::Wire> wire = hitToWireAssns.at(hitPtr.key());
200  art::Ptr<raw::RawDigit> rawdigits = hitToRawDigitAssns.at(hitPtr.key());
201 
202  hcol.emplace_back(*hitPtr, wire, rawdigits);
203  }
204  }
205  }
206  }
207  // Here we handle the case of single hits
208  else
209  {
210  art::Ptr<recob::Hit> hitPtr = hitSnippetVec.front();
211 
212  float pulseHeight = hitPtr->PeakAmplitude();
213  float pulseWid = hitPtr->RMS();
214 
215  if (pulseHeight > fMinPulseHeightSingle[plane] && pulseWid > fMinPulseWidthSingle[plane])
216  {
217  art::Ptr<recob::Wire> wire = hitToWireAssns.at(hitPtr.key());
218  art::Ptr<raw::RawDigit> rawdigits = hitToRawDigitAssns.at(hitPtr.key());
219 
220  hcol.emplace_back(*hitPtr, wire, rawdigits);
221  }
222  }
223 
224  hitSnippetVec.clear();
225  }
226 
227  lastHitIndex = curHitPtr->LocalIndex();
228  hitSnippetVec.push_back(curHitPtr);
229  }
230  }
231 
232  // put the hit collection and associations into the event
233  hcol.put_into(evt);
234 
235  return;
236 }
std::vector< float > fMinPulseHeightMulti
Multi hit snippets, minimum pulse height per plane.
int fNumEvent
Number of events seen.
walls no right
Definition: selectors.fcl:105
art::InputTag fHitProducerLabel
The full collection of hits.
std::vector< float > fMinPulseWidthMulti
Multi hit snippets, minimum pulse width per plane.
A class handling a collection of hits and its associations.
Definition: HitCreator.h:508
std::vector< art::Ptr< recob::Hit >> HitPtrVector
std::vector< float > fMinPulseHeightSingle
Single hit snippets, minimum pulse height per plane.
std::vector< float > fMinPulseWidthSingle
Single hit snippets, minimum pulse width per plane.
walls no left
Definition: selectors.fcl:105
std::vector< float > fMinMaxPulseHeighMulti
Max pulse height of a pulse train must be this large.
TCEvent evt
Definition: DataStructs.cxx:8
void HitSelector::reconfigure ( fhicl::ParameterSet const &  pset)
virtual

Reconfigure method.

Arguments:

pset - Fcl parameter set.

Definition at line 103 of file HitSelector_module.cc.

104 {
105  fHitProducerLabel = pset.get<art::InputTag>("HitProducerLabel");
106  fMinMaxPulseHeighMulti = pset.get<std::vector<float>>("MinMaxPulseHeightMulti");
107  fMinPulseHeightMulti = pset.get<std::vector<float>>("MinPulseHeightMulti");
108  fMinPulseWidthMulti = pset.get<std::vector<float>>("MinPulseWidthMulti");
109  fMinPulseHeightSingle = pset.get<std::vector<float>>("MinPulseHeightSingle");
110  fMinPulseWidthSingle = pset.get<std::vector<float>>("MinPulseWidthSingle");
111 }
std::vector< float > fMinPulseHeightMulti
Multi hit snippets, minimum pulse height per plane.
art::InputTag fHitProducerLabel
The full collection of hits.
std::vector< float > fMinPulseWidthMulti
Multi hit snippets, minimum pulse width per plane.
std::vector< float > fMinPulseHeightSingle
Single hit snippets, minimum pulse height per plane.
std::vector< float > fMinPulseWidthSingle
Single hit snippets, minimum pulse width per plane.
std::vector< float > fMinMaxPulseHeighMulti
Max pulse height of a pulse train must be this large.

Member Data Documentation

art::InputTag HitSelector::fHitProducerLabel
private

The full collection of hits.

Definition at line 57 of file HitSelector_module.cc.

std::vector<float> HitSelector::fMinMaxPulseHeighMulti
private

Max pulse height of a pulse train must be this large.

Definition at line 58 of file HitSelector_module.cc.

std::vector<float> HitSelector::fMinPulseHeightMulti
private

Multi hit snippets, minimum pulse height per plane.

Definition at line 59 of file HitSelector_module.cc.

std::vector<float> HitSelector::fMinPulseHeightSingle
private

Single hit snippets, minimum pulse height per plane.

Definition at line 61 of file HitSelector_module.cc.

std::vector<float> HitSelector::fMinPulseWidthMulti
private

Multi hit snippets, minimum pulse width per plane.

Definition at line 60 of file HitSelector_module.cc.

std::vector<float> HitSelector::fMinPulseWidthSingle
private

Single hit snippets, minimum pulse width per plane.

Definition at line 62 of file HitSelector_module.cc.

int HitSelector::fNumEvent
private

Number of events seen.

Definition at line 65 of file HitSelector_module.cc.


The documentation for this class was generated from the following file: