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::PMTFlashTriggerMaker Class Reference
Inheritance diagram for sbn::PMTFlashTriggerMaker:

Public Member Functions

 PMTFlashTriggerMaker (fhicl::ParameterSet const &p)
 
 PMTFlashTriggerMaker (PMTFlashTriggerMaker const &)=delete
 
 PMTFlashTriggerMaker (PMTFlashTriggerMaker &&)=delete
 
PMTFlashTriggerMakeroperator= (PMTFlashTriggerMaker const &)=delete
 
PMTFlashTriggerMakeroperator= (PMTFlashTriggerMaker &&)=delete
 
void produce (art::Event &e) override
 

Private Member Functions

std::vector
< sbn::FlashTriggerPrimitive
TriggerPrimitives (const std::vector< raw::OpDetWaveform > &waveforms, double tick_period, std::pair< double, double > &window, int thresh)
 

Private Attributes

art::InputTag fWaveformLabel
 
std::string fExperiment
 
std::pair< double, double > fTriggerWindow
 
int fTriggerThreshold
 
bool fOffsetTriggerTime
 
std::unique_ptr< opdet::PDMapAlgfPDMapAlgPtr
 

Detailed Description

Definition at line 41 of file PMTFlashTriggerMaker_module.cc.

Constructor & Destructor Documentation

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

Definition at line 73 of file PMTFlashTriggerMaker_module.cc.

74  : EDProducer{p},
75  fWaveformLabel(p.get<std::string>("WaveformLabel")),
76  fExperiment(p.get<std::string>("Experiment")),
77  fTriggerWindow({p.get<float>("TriggerStart"), p.get<float>("TriggerEnd")}),
pdgs p
Definition: selectors.fcl:22
std::pair< double, double > fTriggerWindow
sbn::PMTFlashTriggerMaker::PMTFlashTriggerMaker ( PMTFlashTriggerMaker const &  )
delete
sbn::PMTFlashTriggerMaker::PMTFlashTriggerMaker ( PMTFlashTriggerMaker &&  )
delete

Member Function Documentation

PMTFlashTriggerMaker& sbn::PMTFlashTriggerMaker::operator= ( PMTFlashTriggerMaker const &  )
delete
PMTFlashTriggerMaker& sbn::PMTFlashTriggerMaker::operator= ( PMTFlashTriggerMaker &&  )
delete
void sbn::PMTFlashTriggerMaker::produce ( art::Event &  e)
override

Definition at line 87 of file PMTFlashTriggerMaker_module.cc.

88 {
89  auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(e);
90 
91  std::unique_ptr<std::vector<sbn::FlashTriggerPrimitive>> trigs(new std::vector<sbn::FlashTriggerPrimitive>);
92 
93  art::Handle<std::vector<raw::OpDetWaveform>> waveform_handle;
94  e.getByLabel(fWaveformLabel, waveform_handle);
95 
96  std::pair<double, double> window = fTriggerWindow;
97  // don't apply offset in constructor in case time gets overwritten on input file open
98  if (fOffsetTriggerTime) {
99  float offset = clock_data.TriggerTime();
100  window.first += offset;
101  window.second += offset;
102  }
103 
104  if (waveform_handle.isValid()) {
105  const std::vector<raw::OpDetWaveform> &waveforms = *waveform_handle;
106  double tick_period = clock_data.OpticalClock().TickPeriod();
107  //bool is_sbnd = fExperiment == "SBND"; //replace with PDMapAlgPtr
108 
109  *trigs = TriggerPrimitives(waveforms, tick_period, window, fTriggerThreshold);
110  }
111 
112  e.put(std::move(trigs));
113 }
BEGIN_PROLOG TPC Trig offset(g4 rise time) ProjectToHeight
Definition: CORSIKAGen.fcl:7
std::vector< sbn::FlashTriggerPrimitive > TriggerPrimitives(const std::vector< raw::OpDetWaveform > &waveforms, double tick_period, std::pair< double, double > &window, int thresh)
std::pair< double, double > fTriggerWindow
do i e
int tick_period
Definition: constants.py:3
std::vector< sbn::FlashTriggerPrimitive > sbn::PMTFlashTriggerMaker::TriggerPrimitives ( const std::vector< raw::OpDetWaveform > &  waveforms,
double  tick_period,
std::pair< double, double > &  window,
int  thresh 
)
private

Definition at line 115 of file PMTFlashTriggerMaker_module.cc.

118  {
119  std::vector<sbn::FlashTriggerPrimitive> ret;
120 
121  for (const raw::OpDetWaveform &wvf: waveforms) {
122  // check if this is a PMT
123  bool is_pmt = fPDMapAlgPtr->pdType(wvf.ChannelNumber()) == "pmt";
124 
125  if (!is_pmt) continue;
126 
127  // look for any overlap with the enable window
128  double waveform_start = wvf.TimeStamp();
129  int waveform_index_start = std::max((int)((window.first - waveform_start) / tick_period), 0);
130  int waveform_index_end = std::min((int)((window.second - waveform_start) / tick_period), (int) wvf.size());
131 
132  if (waveform_index_start < waveform_index_end) {
134  prim.channel = wvf.ChannelNumber();
135  for (int i = waveform_index_start; i < waveform_index_end; i++) {
136  if (wvf[i] <= thresh) { // PMT waveforms go down
137  FlashTriggerPrimitive::Trig this_trig {wvf[i], i + (int)((waveform_start - window.first) / tick_period)};
138  prim.triggers.push_back(this_trig);
139  }
140  }
141  ret.push_back(prim);
142  }
143  }
144  return ret;
145 }
std::unique_ptr< opdet::PDMapAlg > fPDMapAlgPtr
int tick_period
Definition: constants.py:3

Member Data Documentation

std::string sbn::PMTFlashTriggerMaker::fExperiment
private

Definition at line 58 of file PMTFlashTriggerMaker_module.cc.

bool sbn::PMTFlashTriggerMaker::fOffsetTriggerTime
private

Definition at line 61 of file PMTFlashTriggerMaker_module.cc.

std::unique_ptr<opdet::PDMapAlg> sbn::PMTFlashTriggerMaker::fPDMapAlgPtr
private

Definition at line 63 of file PMTFlashTriggerMaker_module.cc.

int sbn::PMTFlashTriggerMaker::fTriggerThreshold
private

Definition at line 60 of file PMTFlashTriggerMaker_module.cc.

std::pair<double, double> sbn::PMTFlashTriggerMaker::fTriggerWindow
private

Definition at line 59 of file PMTFlashTriggerMaker_module.cc.

art::InputTag sbn::PMTFlashTriggerMaker::fWaveformLabel
private

Definition at line 57 of file PMTFlashTriggerMaker_module.cc.


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