Public Member Functions | Private Attributes | List of all members
hit::NumberOfHitsFilter Class Reference
Inheritance diagram for hit::NumberOfHitsFilter:
art::EDFilter art::detail::Filter art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 NumberOfHitsFilter (fhicl::ParameterSet const &pset)
 
virtual ~NumberOfHitsFilter ()
 
void beginJob () override
 
bool filter (art::Event &evt) override
 
bool beginRun (art::Run &r) override
 
void endJob () override
 
- Public Member Functions inherited from art::EDFilter
 EDFilter (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDFilter (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Filter
virtual ~Filter () noexcept
 
 Filter (fhicl::ParameterSet const &)
 
 Filter (Filter const &)=delete
 
 Filter (Filter &&)=delete
 
Filteroperator= (Filter const &)=delete
 
Filteroperator= (Filter &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

bool fLimitPerTPC
 
unsigned int fHitLimit
 
std::string fHitModule
 
bool fScaleThresholdForReadoutWindow
 

Additional Inherited Members

- Public Types inherited from art::EDFilter
using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
- Public Types inherited from art::detail::Filter
template<typename UserConfig >
using Table = Modifier::Table< UserConfig >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Attributes inherited from art::detail::Filter
static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 29 of file NumberOfHitsFilter_module.cc.

Constructor & Destructor Documentation

hit::NumberOfHitsFilter::NumberOfHitsFilter ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 49 of file NumberOfHitsFilter_module.cc.

49  :
50  EDFilter(pset)
51 {
52  fLimitPerTPC = pset.get<bool>("LimitPerTPC");
53  fHitLimit = pset.get<unsigned int>("HitLimit");
54  fHitModule = pset.get<std::string>("HitModule");
55  fScaleThresholdForReadoutWindow = pset.get<bool>("ScaleThresholdForReadoutWindow");
56 }
std::string string
Definition: nybbler.cc:12
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21
hit::NumberOfHitsFilter::~NumberOfHitsFilter ( )
virtual

Definition at line 59 of file NumberOfHitsFilter_module.cc.

59 {}

Member Function Documentation

void hit::NumberOfHitsFilter::beginJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 62 of file NumberOfHitsFilter_module.cc.

62 {}
bool hit::NumberOfHitsFilter::beginRun ( art::Run r)
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 64 of file NumberOfHitsFilter_module.cc.

64  {
66  unsigned int fSize = art::ServiceHandle<detinfo::DetectorPropertiesService const>{}->DataForJob().ReadOutWindowSize();
67  fHitLimit = (unsigned int)(fHitLimit*fSize/6000.);
68  std::cout<<"Scale HitLimit based on readout window size "<<fSize<<std::endl;
69  std::cout<<"HitLimit = "<<fHitLimit<<std::endl;
70  }
71  return true;
72 }
QTextStream & endl(QTextStream &s)
void hit::NumberOfHitsFilter::endJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 107 of file NumberOfHitsFilter_module.cc.

107 {}
bool hit::NumberOfHitsFilter::filter ( art::Event evt)
overridevirtual

Implements art::EDFilter.

Definition at line 74 of file NumberOfHitsFilter_module.cc.

74  {
75 
76  // Get the hit collection from the event
77  auto allHits = evt.getValidHandle<std::vector<recob::Hit> >(fHitModule);
78 
79  bool result = true;
80 
81  if(fLimitPerTPC){
82  // Find the number of hits per TPC and then filter based on a large value
83  std::map<unsigned int,unsigned int> hitsPerTPC;
84 
85  for(auto const hit : *allHits){
86  hitsPerTPC[hit.WireID().TPC]++;
87  }
88 
89  for(auto const m: hitsPerTPC){
90  if(m.second > fHitLimit){
91  result = false;
92  break;
93  }
94  }
95  }
96  else{
97  // This is the simplest thing we can do, just cut on the total number of hits
98  if (allHits->size() > fHitLimit){
99  result = false;
100  }
101  }
102 
103 
104  return result;
105 }
static QCString result
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
Detector simulation of raw signals on wires.

Member Data Documentation

unsigned int hit::NumberOfHitsFilter::fHitLimit
private

Definition at line 43 of file NumberOfHitsFilter_module.cc.

std::string hit::NumberOfHitsFilter::fHitModule
private

Definition at line 44 of file NumberOfHitsFilter_module.cc.

bool hit::NumberOfHitsFilter::fLimitPerTPC
private

Definition at line 42 of file NumberOfHitsFilter_module.cc.

bool hit::NumberOfHitsFilter::fScaleThresholdForReadoutWindow
private

Definition at line 45 of file NumberOfHitsFilter_module.cc.


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