FairRoot/PandaRoot
Public Member Functions | Private Attributes | List of all members
PndEmcHighLowPSA Class Reference

Wrapping class to manage two independent PSAs for high, resp. low gain. More...

#include <PndEmcHighLowPSA.h>

Inheritance diagram for PndEmcHighLowPSA:
PndEmcAbsPSA

Public Member Functions

 PndEmcHighLowPSA (Int_t verbose=0)
 
virtual void Init (PndEmcPSAFPGASampleAnalyser *highgainPSA, PndEmcPSAFPGASampleAnalyser *lowgainPSA, Double_t overflowThreshold, Int_t highgainWfIndex=0, Int_t lowgainWfIndex=1)
 
virtual ~PndEmcHighLowPSA ()
 
virtual void SetVerbose (Int_t verbose=0)
 
virtual Int_t Process (const PndEmcWaveform *waveform)
 Find Hits in Waveform. More...
 
virtual void Reset ()
 reset found hits More...
 
virtual void GetHit (Int_t i, Double_t &energy, Double_t &time)
 Get energy and time of hit. More...
 
virtual Int_t GetWaveformIdx (Int_t i)
 
virtual void Process (const PndEmcWaveform *waveform, Double_t &amplitude, Double_t &time)
 Deprecated. Do not use. More...
 
 ClassDef (PndEmcAbsPSA, 1)
 

Private Attributes

PndEmcPSAFPGASampleAnalyser * fHighgainPSA
 
PndEmcPSAFPGASampleAnalyser * fLowgainPSA
 
Int_t fIdx_high
 
Int_t fIdx_low
 
std::vector< std::pair
< PndEmcPSAFPGASampleAnalyser
*, int > > 
fHitsInFE
 
Double_t fOverflowThreshold
 
Int_t fVerbose
 

Detailed Description

Wrapping class to manage two independent PSAs for high, resp. low gain.

Author
Ph. Mahlberg mahlb.nosp@m.erg@.nosp@m.hiskp.nosp@m..uni.nosp@m.-bonn.nosp@m..de

Definition at line 24 of file PndEmcHighLowPSA.h.

Constructor & Destructor Documentation

PndEmcHighLowPSA::PndEmcHighLowPSA ( Int_t  verbose = 0)

Definition at line 9 of file PndEmcHighLowPSA.cxx.

9  : fHighgainPSA(NULL), fLowgainPSA(NULL),fVerbose(verbose) {
10 };
PndEmcPSAFPGASampleAnalyser * fHighgainPSA
#define verbose
PndEmcPSAFPGASampleAnalyser * fLowgainPSA
virtual PndEmcHighLowPSA::~PndEmcHighLowPSA ( )
inlinevirtual

Definition at line 29 of file PndEmcHighLowPSA.h.

29 {}

Member Function Documentation

PndEmcAbsPSA::ClassDef ( PndEmcAbsPSA  ,
1   
)
inherited
void PndEmcHighLowPSA::GetHit ( Int_t  i,
Double_t &  energy,
Double_t &  time 
)
virtual

Get energy and time of hit.

Parameters
Int_tIndex of Hit
Double_tEnergy of Hit
Double_tTime of Hit
Returns

Implements PndEmcAbsPSA.

Definition at line 145 of file PndEmcHighLowPSA.cxx.

References fHitsInFE, PndEmcPSAFPGASampleAnalyser::GetHit(), and i.

Referenced by PndEmcFWEndcapDigi::Exec().

145  {
146 
148  if(psa!=NULL) {
149  psa->GetHit(fHitsInFE[i].second, energy, time);
150  } else {
151  //std::cerr << "-E PndEmcHighLowPSA::GetHit: No suitable PSA available" << std::cout;
152  energy = 0;
153  time = 0;
154  }
155 
156 }
std::vector< std::pair< PndEmcPSAFPGASampleAnalyser *, int > > fHitsInFE
Int_t i
Definition: run_full.C:25
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
Int_t PndEmcHighLowPSA::GetWaveformIdx ( Int_t  i)
virtual

Definition at line 158 of file PndEmcHighLowPSA.cxx.

References fHighgainPSA, fHitsInFE, fIdx_high, fIdx_low, fLowgainPSA, and i.

Referenced by PndEmcFWEndcapDigi::Exec().

158  {
159 
160  if(i<(int)fHitsInFE.size() && i>=0) {
162  if(psa==fHighgainPSA) return fIdx_high;
163  else if(psa==fLowgainPSA) return fIdx_low;
164  }
165 
166  return -1; //error
167 }
PndEmcPSAFPGASampleAnalyser * fHighgainPSA
std::vector< std::pair< PndEmcPSAFPGASampleAnalyser *, int > > fHitsInFE
Int_t i
Definition: run_full.C:25
PndEmcPSAFPGASampleAnalyser * fLowgainPSA
void PndEmcHighLowPSA::Init ( PndEmcPSAFPGASampleAnalyser *  highgainPSA,
PndEmcPSAFPGASampleAnalyser *  lowgainPSA,
Double_t  overflowThreshold,
Int_t  highgainWfIndex = 0,
Int_t  lowgainWfIndex = 1 
)
virtual

Definition at line 12 of file PndEmcHighLowPSA.cxx.

References fHighgainPSA, fIdx_high, fIdx_low, fLowgainPSA, and fOverflowThreshold.

Referenced by PndEmcFWEndcapDigi::Init().

12  {
13  fHighgainPSA = highgainPSA;
14  fLowgainPSA = lowgainPSA;
15  fIdx_high = highgainWfIndex;
16  fIdx_low = lowgainWfIndex;
17  fOverflowThreshold = overflowThreshold;
18 }
PndEmcPSAFPGASampleAnalyser * fHighgainPSA
Double_t fOverflowThreshold
PndEmcPSAFPGASampleAnalyser * fLowgainPSA
Int_t PndEmcHighLowPSA::Process ( const PndEmcWaveform *  waveform)
virtual

Find Hits in Waveform.

Parameters
PndEmcWaveform
Returns
Return number of hits, negative if an error occurred

Implements PndEmcAbsPSA.

Definition at line 28 of file PndEmcHighLowPSA.cxx.

References fHighgainPSA, fHitsInFE, fIdx_high, fIdx_low, fLowgainPSA, fOverflowThreshold, fVerbose, PndEmcMultiWaveform::GetActiveWaveform(), PndEmcWaveform::GetSignal(), PndEmcPSAFPGASampleAnalyser::GetStatus(), PndEmcPSAFPGASampleAnalyser::kPileupFinished, PndEmcPSAFPGASampleAnalyser::kPulseDetected, PndEmcPSAFPGASampleAnalyser::kPulseFinished, PndEmcPSAFPGASampleAnalyser::put(), Reset(), and PndEmcMultiWaveform::SetActiveWaveform().

Referenced by PndEmcFWEndcapDigi::Exec().

28  {
29 
30  Reset();
31 
32  PndEmcMultiWaveform* multiWf = const_cast<PndEmcMultiWaveform*>(dynamic_cast<const PndEmcMultiWaveform*>(waveform));
33 
34  if(!multiWf) {
35  std::cerr << "passed waveform is not of type PndEmcMultiwaveform" << std::endl;
36  return -1;
37  }
38 
39  //active method
40 
41  Int_t activeWf = multiWf->GetActiveWaveform();
42 
43  multiWf->SetActiveWaveform(fIdx_low);
44  std::vector<double> signal_low = waveform->GetSignal();
45  std::vector<double>::iterator it_low=signal_low.begin();
46 
47  multiWf->SetActiveWaveform(fIdx_high);
48  std::vector<double> signal_high = waveform->GetSignal();
49  std::vector<double>::iterator it_high=signal_high.begin();
50 
51  multiWf->SetActiveWaveform(activeWf);
52 
53  bool active_high = false;
54  bool active_low = false;
55 
56  Int_t counter_low=0;
57  Int_t counter_high=0;
58 
61 
62  std::set<Int_t> hits_lowgain;
63  bool overflow = false;
64 
65  while(it_low!=signal_low.end() && it_high!=signal_high.end()) {
66 
67  fHighgainPSA->put(*it_high);
68  fLowgainPSA->put(*it_low);
69  status_high = fHighgainPSA->GetStatus();
70  status_low = fLowgainPSA->GetStatus();
71 
73  active_high = false;
74  if(!overflow) {
75  fHitsInFE.push_back(std::make_pair(fHighgainPSA, counter_high));
76  if(fVerbose>=2) {
77  std::cout << "I- PndEmcHighLowPSA: adding highgain hit: #:"<< counter_high << std::endl;
78  }
79  }
80  counter_high++;
81  } else if(status_high==PndEmcPSAFPGASampleAnalyser::kPileupFinished) {
82  active_high = false;
83  if(!overflow) {
84  fHitsInFE.push_back(std::make_pair(fHighgainPSA, counter_high));
85  fHitsInFE.push_back(std::make_pair(fHighgainPSA, counter_high+1));
86  if(fVerbose>=2) {
87  //std::cout << "I- PndEmcHighLowPSA: adding highgain hits #:" << counter_high << "," << counter_high++ << std::endl; //FIXME Implicit operation is bad style!
88  std::cout << "I- PndEmcHighLowPSA: adding highgain hits #:" << counter_high << ",";
89  counter_high++; // [R.K. 9/2018] made implicit operation explicit
90  std::cout << counter_high << std::endl;
91  }
92  }
93  counter_high+=2;
94  } else if(status_high==PndEmcPSAFPGASampleAnalyser::kPulseDetected) {
95  active_high = true;
96  }
97 
98  if(active_high && ((*it_high) > fOverflowThreshold) && !overflow) {
99  if(fVerbose>=2) {
100  std::cout << "I- PndEmcHighLowPSA: overflow detected" << std::endl;
101  }
102  overflow = true;
103  }
104 
106  hits_lowgain.insert(counter_low);
107  counter_low++;
108  active_low = false;
109  } else if(status_low==PndEmcPSAFPGASampleAnalyser::kPileupFinished) {
110  if(fVerbose>=3) {
111  std::cout << "I- PndEmcHighLowPSA: pileup in lowgain candidate: #" << counter_low << ", #" << counter_low+1 << std::endl;
112  }
113  hits_lowgain.insert(counter_low);
114  hits_lowgain.insert(counter_low+1);
115  counter_low+=2;
116  active_low = false;
117  } else if(status_low==PndEmcPSAFPGASampleAnalyser::kPulseDetected) {
118  active_low = true;
119  }
120 
121  if((!active_high) && (!active_low)) {
122  if(overflow) {
123  if(fVerbose>=2) {
124  std::cout << "I- PndEmcHighLowPSA: adding lowgain hit(s) #:";
125  for(std::set<Int_t>::iterator it=hits_lowgain.begin(); it!=hits_lowgain.end(); ++it) {
126  std::cout << *it << ",";
127  }
128  std::cout << "\b\n" << std::flush;
129  }
130  for(std::set<Int_t>::iterator it=hits_lowgain.begin(); it!=hits_lowgain.end(); ++it) {
131  fHitsInFE.push_back(std::make_pair(fLowgainPSA, *it));
132  }
133  }
134  hits_lowgain.clear();
135  overflow = false;
136  }
137  it_low++;
138  it_high++;
139  }
140 
141  return fHitsInFE.size();
142 }
PndEmcPSAFPGASampleAnalyser * fHighgainPSA
std::vector< std::pair< PndEmcPSAFPGASampleAnalyser *, int > > fHitsInFE
virtual std::vector< double > GetSignal() const
virtual void put(float valueToStore)=0
virtual void Reset()
reset found hits
Class to hold multiple waveforms from one Emc Hit / ADC readout.
Int_t GetActiveWaveform() const
Double_t fOverflowThreshold
void SetActiveWaveform(Int_t active=1)
PndEmcPSAFPGASampleAnalyser * fLowgainPSA
void PndEmcAbsPSA::Process ( const PndEmcWaveform *  waveform,
Double_t &  amplitude,
Double_t &  time 
)
virtualinherited

Deprecated. Do not use.

Parameters
PndEmcWaveform
Double_t
Double_t
Returns

Reimplemented in PndEmcPSAMatchedDigiFilter, PndEmcPSAParabolic, PndEmcPSAParabolicBaseline, and PndEmcPSATrapDigiFilter.

Definition at line 2 of file PndEmcAbsPSA.cxx.

References PndEmcAbsPSA::GetHit(), and PndEmcAbsPSA::Process().

2  {
3  if(Process(waveform)>0){
4  GetHit(0,amplitude,time);
5  }else{
6  amplitude = 0.;
7  time = 0.;
8  }
9  }; //deprecated do not use
virtual Int_t Process(const PndEmcWaveform *waveform)=0
Find Hits in Waveform.
virtual void GetHit(Int_t i, Double_t &energy, Double_t &time)=0
Get energy and time of hit.
void PndEmcHighLowPSA::Reset ( )
virtual

reset found hits

Returns

Reimplemented from PndEmcAbsPSA.

Definition at line 20 of file PndEmcHighLowPSA.cxx.

References fHighgainPSA, fHitsInFE, fLowgainPSA, and PndEmcPSAFPGASampleAnalyser::Reset().

Referenced by Process().

20  {
21  //fActivePSA=0;
22  fHitsInFE.clear();
24  fLowgainPSA->Reset();
25 }
PndEmcPSAFPGASampleAnalyser * fHighgainPSA
std::vector< std::pair< PndEmcPSAFPGASampleAnalyser *, int > > fHitsInFE
virtual void Reset()
reset found hits
PndEmcPSAFPGASampleAnalyser * fLowgainPSA
virtual void PndEmcHighLowPSA::SetVerbose ( Int_t  verbose = 0)
inlinevirtual

Definition at line 31 of file PndEmcHighLowPSA.h.

References fVerbose, and verbose.

31 { fVerbose = verbose; };
#define verbose

Member Data Documentation

PndEmcPSAFPGASampleAnalyser* PndEmcHighLowPSA::fHighgainPSA
private

Definition at line 38 of file PndEmcHighLowPSA.h.

Referenced by GetWaveformIdx(), Init(), Process(), and Reset().

std::vector< std::pair<PndEmcPSAFPGASampleAnalyser*, int> > PndEmcHighLowPSA::fHitsInFE
private

Definition at line 44 of file PndEmcHighLowPSA.h.

Referenced by GetHit(), GetWaveformIdx(), Process(), and Reset().

Int_t PndEmcHighLowPSA::fIdx_high
private

Definition at line 41 of file PndEmcHighLowPSA.h.

Referenced by GetWaveformIdx(), Init(), and Process().

Int_t PndEmcHighLowPSA::fIdx_low
private

Definition at line 42 of file PndEmcHighLowPSA.h.

Referenced by GetWaveformIdx(), Init(), and Process().

PndEmcPSAFPGASampleAnalyser* PndEmcHighLowPSA::fLowgainPSA
private

Definition at line 39 of file PndEmcHighLowPSA.h.

Referenced by GetWaveformIdx(), Init(), Process(), and Reset().

Double_t PndEmcHighLowPSA::fOverflowThreshold
private

Definition at line 45 of file PndEmcHighLowPSA.h.

Referenced by Init(), and Process().

Int_t PndEmcHighLowPSA::fVerbose
private

Definition at line 47 of file PndEmcHighLowPSA.h.

Referenced by Process(), and SetVerbose().


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