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

Public Member Functions

 PMTFlashTriggerFilter (fhicl::ParameterSet const &p)
 
 PMTFlashTriggerFilter (PMTFlashTriggerFilter const &)=delete
 
 PMTFlashTriggerFilter (PMTFlashTriggerFilter &&)=delete
 
PMTFlashTriggerFilteroperator= (PMTFlashTriggerFilter const &)=delete
 
PMTFlashTriggerFilteroperator= (PMTFlashTriggerFilter &&)=delete
 
bool filter (art::Event &e) override
 

Private Member Functions

bool HasTrigger (const std::vector< FlashTriggerPrimitive > &primitives, int threshold, unsigned n_above_threshold)
 

Private Attributes

art::InputTag fFlashTriggerPrimitiveLabel
 
unsigned fNPMTAboveThreshold
 
int fPMTTriggerThreshold
 
bool fStoreDataProduct
 

Detailed Description

Definition at line 32 of file PMTFlashTriggerFilter_module.cc.

Constructor & Destructor Documentation

sbn::PMTFlashTriggerFilter::PMTFlashTriggerFilter ( fhicl::ParameterSet const &  p)
explicit

Definition at line 58 of file PMTFlashTriggerFilter_module.cc.

59  : EDFilter{p},
60  fFlashTriggerPrimitiveLabel(p.get<std::string>("FlashTriggerPrimitiveLabel")),
61  fNPMTAboveThreshold(p.get<unsigned>("NPMTAboveThreshold")),
62  fPMTTriggerThreshold(p.get<int>("PMTTriggerThreshold")),
63  fStoreDataProduct(p.get<bool>("StoreDataProduct", false))
64  // More initializers here.
65 {
66 
67  if (fStoreDataProduct) produces<bool>();
68 }
pdgs p
Definition: selectors.fcl:22
sbn::PMTFlashTriggerFilter::PMTFlashTriggerFilter ( PMTFlashTriggerFilter const &  )
delete
sbn::PMTFlashTriggerFilter::PMTFlashTriggerFilter ( PMTFlashTriggerFilter &&  )
delete

Member Function Documentation

bool sbn::PMTFlashTriggerFilter::filter ( art::Event &  e)
override

Definition at line 70 of file PMTFlashTriggerFilter_module.cc.

71 {
72  art::Handle<std::vector<sbn::FlashTriggerPrimitive>> flashtrig_handle;
73  e.getByLabel(fFlashTriggerPrimitiveLabel, flashtrig_handle);
74 
75  bool ret = false;
76  if (flashtrig_handle.isValid()) {
77  ret = HasTrigger(*flashtrig_handle, fPMTTriggerThreshold, fNPMTAboveThreshold);
78  }
79 
80  if (fStoreDataProduct) {
81  std::unique_ptr<bool> store(new bool);
82  *store = ret;
83  e.put(std::move(store));
84  return true;
85  }
86  return ret;
87 }
process_name opflash opflashana store
bool HasTrigger(const std::vector< FlashTriggerPrimitive > &primitives, int threshold, unsigned n_above_threshold)
do i e
bool sbn::PMTFlashTriggerFilter::HasTrigger ( const std::vector< FlashTriggerPrimitive > &  primitives,
int  threshold,
unsigned  n_above_threshold 
)
private

Definition at line 89 of file PMTFlashTriggerFilter_module.cc.

89  {
90  if (n_above_threshold == 0) return true;
91 
92  std::map<int, std::vector<unsigned>> above_threshold;
93 
94  for (const sbn::FlashTriggerPrimitive &primitive: primitives) {
95  for (const sbn::FlashTriggerPrimitive::Trig &trig: primitive.triggers) {
96  if (trig.adc <= threshold) {
97  above_threshold[trig.tdc].push_back(primitive.channel);
98  }
99  }
100  }
101 
102  for (auto const &pair: above_threshold) {
103  if (pair.second.size() >= n_above_threshold) {
104  return true;
105  }
106  }
107 
108  return false;
109 }
PMTFlashTriggerFilter& sbn::PMTFlashTriggerFilter::operator= ( PMTFlashTriggerFilter const &  )
delete
PMTFlashTriggerFilter& sbn::PMTFlashTriggerFilter::operator= ( PMTFlashTriggerFilter &&  )
delete

Member Data Documentation

art::InputTag sbn::PMTFlashTriggerFilter::fFlashTriggerPrimitiveLabel
private

Definition at line 49 of file PMTFlashTriggerFilter_module.cc.

unsigned sbn::PMTFlashTriggerFilter::fNPMTAboveThreshold
private

Definition at line 50 of file PMTFlashTriggerFilter_module.cc.

int sbn::PMTFlashTriggerFilter::fPMTTriggerThreshold
private

Definition at line 51 of file PMTFlashTriggerFilter_module.cc.

bool sbn::PMTFlashTriggerFilter::fStoreDataProduct
private

Definition at line 52 of file PMTFlashTriggerFilter_module.cc.


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