Public Member Functions | Private Attributes | List of all members
protoana::ProtoDUNEEmptyEventFinder Class Reference

#include <ProtoDUNEEmptyEventFinder.h>

Public Member Functions

 ProtoDUNEEmptyEventFinder (const fhicl::ParameterSet &pset)
 
bool IsEmptyEvent (const art::Event &evt) const
 

Private Attributes

std::string fSpacePointLabel
 
unsigned int fNHitsThreshold
 
std::vector< float > fMinCoordsData
 
std::vector< float > fMaxCoordsData
 
std::vector< float > fMinCoordsSim
 
std::vector< float > fMaxCoordsSim
 

Detailed Description

Definition at line 12 of file ProtoDUNEEmptyEventFinder.h.

Constructor & Destructor Documentation

protoana::ProtoDUNEEmptyEventFinder::ProtoDUNEEmptyEventFinder ( const fhicl::ParameterSet pset)

Definition at line 12 of file ProtoDUNEEmptyEventFinder.cxx.

12  :
13  fSpacePointLabel(pset.get<std::string>("SpacePointLabel","reco3d")),
14  fNHitsThreshold(pset.get<unsigned int>("NHitsThreshold",10)),
15  fMinCoordsData(pset.get<std::vector<float>>("MinCoordValuesData")),
16  fMaxCoordsData(pset.get<std::vector<float>>("MaxCoordValuesData")),
17  fMinCoordsSim(pset.get<std::vector<float>>("MinCoordValuesSim")),
18  fMaxCoordsSim(pset.get<std::vector<float>>("MaxCoordValuesSim"))
19 {
20 }
std::string string
Definition: nybbler.cc:12
T get(std::string const &key) const
Definition: ParameterSet.h:271

Member Function Documentation

bool protoana::ProtoDUNEEmptyEventFinder::IsEmptyEvent ( const art::Event evt) const

Definition at line 22 of file ProtoDUNEEmptyEventFinder.cxx.

23 {
24  // Get the space points
25  auto spacePointHandle = evt.getValidHandle<std::vector<recob::SpacePoint>>(fSpacePointLabel);
26  std::vector<art::Ptr<recob::SpacePoint>> spacePoints;
27  if(spacePointHandle.isValid())
28  art::fill_ptr_vector(spacePoints,spacePointHandle);
29 
30  const std::vector<float> minValues{evt.isRealData() ? fMinCoordsData : fMinCoordsSim};
31  const std::vector<float> maxValues{evt.isRealData() ? fMaxCoordsData : fMaxCoordsSim};
32 
33  // Now count the number of space points
34  unsigned int nBeamRegionSpacePoints{0};
35  for (const art::Ptr<recob::SpacePoint> &sp : spacePoints)
36  {
37  const double *xyz{sp->XYZ()};
38 
39  if(xyz[0] < minValues.at(0) || xyz[0] > maxValues.at(0)) continue;
40  if(xyz[1] < minValues.at(1) || xyz[1] > maxValues.at(1)) continue;
41  if(xyz[2] < minValues.at(2) || xyz[2] > maxValues.at(2)) continue;
42 
43  ++nBeamRegionSpacePoints;
44 
45  // If we reach the threshold then there is no point continuing
46  if (nBeamRegionSpacePoints >= fNHitsThreshold) return false;
47  }
48 
49  // If we get here then we didn't meet the threshold
50  return true;
51 }
bool isRealData() const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297

Member Data Documentation

std::vector<float> protoana::ProtoDUNEEmptyEventFinder::fMaxCoordsData
private

Definition at line 33 of file ProtoDUNEEmptyEventFinder.h.

std::vector<float> protoana::ProtoDUNEEmptyEventFinder::fMaxCoordsSim
private

Definition at line 35 of file ProtoDUNEEmptyEventFinder.h.

std::vector<float> protoana::ProtoDUNEEmptyEventFinder::fMinCoordsData
private

Definition at line 32 of file ProtoDUNEEmptyEventFinder.h.

std::vector<float> protoana::ProtoDUNEEmptyEventFinder::fMinCoordsSim
private

Definition at line 34 of file ProtoDUNEEmptyEventFinder.h.

unsigned int protoana::ProtoDUNEEmptyEventFinder::fNHitsThreshold
private

Definition at line 29 of file ProtoDUNEEmptyEventFinder.h.

std::string protoana::ProtoDUNEEmptyEventFinder::fSpacePointLabel
private

Definition at line 25 of file ProtoDUNEEmptyEventFinder.h.


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