Public Member Functions | Protected Member Functions | Private Attributes | List of all members
TriggerPrimitiveFinderPass2 Class Reference
Inheritance diagram for TriggerPrimitiveFinderPass2:
TriggerPrimitiveFinderPass1 TriggerPrimitiveFinderTool

Public Member Functions

 TriggerPrimitiveFinderPass2 (fhicl::ParameterSet const &p)
 
virtual std::vector< TriggerPrimitiveFinderTool::HitfindHits (const std::vector< unsigned int > &channel_numbers, const std::vector< std::vector< short >> &collection_samples)
 
- Public Member Functions inherited from TriggerPrimitiveFinderPass1
 TriggerPrimitiveFinderPass1 (fhicl::ParameterSet const &p)
 
- Public Member Functions inherited from TriggerPrimitiveFinderTool
virtual ~TriggerPrimitiveFinderTool ()=default
 

Protected Member Functions

void hitFinding (const std::vector< short > &waveform, const std::vector< short > &iqr, std::vector< TriggerPrimitiveFinderTool::Hit > &hits, int channel)
 
- Protected Member Functions inherited from TriggerPrimitiveFinderPass1
std::vector< short > downSample (const std::vector< short > &orig)
 
std::vector< short > findPedestal (const std::vector< short > &orig)
 
std::vector< short > filter (const std::vector< short > &orig)
 
void hitFinding (const std::vector< short > &waveform, std::vector< TriggerPrimitiveFinderTool::Hit > &hits, int channel)
 

Private Attributes

float m_sigmaThreshold
 

Additional Inherited Members

- Protected Attributes inherited from TriggerPrimitiveFinderPass1
unsigned int m_threshold
 
bool m_useSignalKill
 
short m_signalKillLookahead
 
short m_signalKillThreshold
 
short m_signalKillNContig
 
short m_frugalNContig
 
bool m_doFiltering
 
unsigned int m_downsampleFactor
 
std::vector< short > m_filterTaps
 
int m_multiplier
 

Detailed Description

Definition at line 15 of file TriggerPrimitiveFinderPass2_tool.cc.

Constructor & Destructor Documentation

TriggerPrimitiveFinderPass2::TriggerPrimitiveFinderPass2 ( fhicl::ParameterSet const &  p)
explicit

Definition at line 37 of file TriggerPrimitiveFinderPass2_tool.cc.

39  m_sigmaThreshold(p.get<float>("ThresholdInSigma", 500))
40 // Initialize member data here.
41 {
42  std::cout << "Threshold in sigma is " << m_sigmaThreshold << " (ignore the Threshold = 10 on previous line)\n";
43 }
p
Definition: test.py:223
TriggerPrimitiveFinderPass1(fhicl::ParameterSet const &p)

Member Function Documentation

std::vector< TriggerPrimitiveFinderTool::Hit > TriggerPrimitiveFinderPass2::findHits ( const std::vector< unsigned int > &  channel_numbers,
const std::vector< std::vector< short >> &  collection_samples 
)
virtual

Reimplemented from TriggerPrimitiveFinderPass1.

Definition at line 83 of file TriggerPrimitiveFinderPass2_tool.cc.

85 {
86  auto hits=std::vector<TriggerPrimitiveFinderTool::Hit>();
87  std::cout << "findHits called with " << collection_samples.size()
88  << " channels. First chan has " << collection_samples[0].size() << " samples" << std::endl;
89  // std::cout << "First few samples: ";
90  // for(int i=0; i<10; ++i) std::cout << collection_samples[0][i] << " ";
91  // std::cout << std::endl;
92 
93  for(size_t ich=0; ich<collection_samples.size(); ++ich){
94  const std::vector<short>& waveformOrig=collection_samples[ich];
95  std::vector<short> waveform=downSample(waveformOrig);
96  std::vector<short> pedestal=findPedestal(waveform);
97  std::vector<short> pedsub(waveform.size(), 0);
98  for(size_t i=0; i<pedsub.size(); ++i){
99  pedsub[i]=waveform[i]-pedestal[i];
100  }
101  std::vector<short> iqr=frugal_iqr(waveform, pedestal, m_frugalNContig);
102  std::vector<short> filtered=filter(pedsub);
103  hitFinding(filtered, iqr, hits, channel_numbers[ich]);
104  }
105  std::cout << "Returning " << hits.size() << " hits" << std::endl;
106  std::cout << "hits/channel=" << float(hits.size())/collection_samples.size() << std::endl;
107  std::cout << "hits/tick=" << float(hits.size())/collection_samples[0].size() << std::endl;
108  return hits;
109 }
std::vector< short > downSample(const std::vector< short > &orig)
std::vector< short > findPedestal(const std::vector< short > &orig)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
std::vector< short > filter(const std::vector< short > &orig)
std::vector< short > frugal_iqr(const std::vector< short > &raw_in, const std::vector< short > &median, const int ncontig)
Definition: AlgParts.h:59
void hitFinding(const std::vector< short > &waveform, const std::vector< short > &iqr, std::vector< TriggerPrimitiveFinderTool::Hit > &hits, int channel)
QTextStream & endl(QTextStream &s)
void TriggerPrimitiveFinderPass2::hitFinding ( const std::vector< short > &  waveform,
const std::vector< short > &  iqr,
std::vector< TriggerPrimitiveFinderTool::Hit > &  hits,
int  channel 
)
protected

Definition at line 46 of file TriggerPrimitiveFinderPass2_tool.cc.

50 {
51  //---------------------------------------------
52  // Hit finding
53  //---------------------------------------------
54  bool is_hit=false;
55  bool was_hit=false;
57  for(size_t isample=0; isample<waveform.size()-1; ++isample){
58  // if(ich>11510) std::cout << isample << " " << std::flush;
59  int sample_time=isample*m_downsampleFactor;
60  short adc=waveform[isample];
61  is_hit=(float)adc>m_sigmaThreshold*iqr[isample];
62  if(is_hit && !was_hit){
63  // We just started a hit. Set the start time
64  hit.startTime=sample_time;
65  hit.charge=adc;
66  hit.timeOverThreshold=m_downsampleFactor;
67  }
68  if(is_hit && was_hit){
69  hit.charge+=adc*m_downsampleFactor;
70  hit.timeOverThreshold+=m_downsampleFactor;
71  }
72  if(!is_hit && was_hit){
73  // The hit is over. Push it to the output vector
74  hit.charge/=m_multiplier;
75  hits.push_back(hit);
76  }
77  was_hit=is_hit;
78  }
79 }
int16_t adc
Definition: CRTFragment.hh:202
uint8_t channel
Definition: CRTFragment.hh:201
Detector simulation of raw signals on wires.

Member Data Documentation

float TriggerPrimitiveFinderPass2::m_sigmaThreshold
private

Definition at line 33 of file TriggerPrimitiveFinderPass2_tool.cc.


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