FairRoot/PandaRoot
PndEmcPSAMatchedDigiFilter.cxx
Go to the documentation of this file.
1 //-----------------------------------------------------------
2 //
3 // Description:
4 // Pulseshape analysis for ADC waveforms
5 // Matched digital filter
6 // Dima Melnychuk
7 //
8 //-----------------------------------------------------------
9 
10 
11 // This Class' Header ------------------
13 #include "PndEmcWaveform.h"
14 #include "PndEmcFadcFilter.h"
15 #include "PndEmcAbsPulseshape.h"
16 
17 // Class Member definitions -----------
18 
19 PndEmcPSAMatchedDigiFilter::PndEmcPSAMatchedDigiFilter(const std::vector<Double_t> params, PndEmcAbsPulseshape *pulseshape):
20 fParams(params),
21 fPulseshape(pulseshape)
22 {}
23 
25  Process(waveform,lAmplitude,lTime);
26  if(lAmplitude > 0){
27  return 1;
28  }else{
29  return 0;
30  }
31 }
32 void PndEmcPSAMatchedDigiFilter::GetHit(Int_t , Double_t &energy, Double_t &time){ // i //[R.K.03/2017] unused variable(s)
33  energy = lAmplitude;
34  time = lTime;
35 }
36 
37 void PndEmcPSAMatchedDigiFilter::Process(const PndEmcWaveform *waveform, Double_t &amplitude, Double_t &time)
38 {
39  const std::vector<Double_t> signal=waveform->GetSignal();
40  std::vector<Double_t> output;
41 
42  Int_t width=(Int_t) fParams[0]; // width of the filter
43  Double_t sampleRate=(Double_t) fParams[1]; // sample rate of ADC
44 
46  flt->SetupMatchedFilter(width,fPulseshape,sampleRate);
47  flt->Filter(signal, output);
48  delete flt;
49 
50  // Extraction of energy and time information
51  std::vector<Double_t>::iterator p;
52  p=max_element(output.begin(),output.end());
53  Int_t pPosition = distance(output.begin(),p);
54 
55  amplitude = *p;
56  time = pPosition;
57 
58  return;
59 }
60 
virtual void Filter(const std::vector< Double_t > &in, std::vector< Double_t > &out) const
virtual std::vector< double > GetSignal() const
virtual Int_t Process(const PndEmcWaveform *waveform)
Find Hits in Waveform.
Double_t p
Definition: anasim.C:58
FairParRootFileIo * output
Definition: sim_emc_apd.C:120
FADC FIR (finite impulse response) filter.
void SetupMatchedFilter(Int_t i_width, PndEmcAbsPulseshape *pulseshape, Double_t sampleRate)
Double_t
PndEmcPSAMatchedDigiFilter(const std::vector< Double_t > params, PndEmcAbsPulseshape *pulseshape)
represents a simulated waveform in an emc crystal
pulseshape interface
virtual void GetHit(Int_t i, Double_t &energy, Double_t &time)
Get energy and time of hit.
Double_t energy
Definition: plot_dirc.C:15