PandaRoot
BSEmcWaveform.h
Go to the documentation of this file.
1 //==========================================================================
2 // BSEmcWaveform.h
3 //
4 // Class to hold waveforms created from Emc Hits
5 //
6 // Hits will be converted to waveforms using the standard
7 // formula for an exponential decay convoluted with CR-RC (or CR-2RC)
8 // shaping.
9 //
10 // Public functions:
11 //
12 // AddElecNoise(Double_t)
13 // Adds gaussian noise with width
14 // given by the Double_t parameter.
15 //
16 // Digitise(Double_t) Simple digitisation, given
17 // the value of one bit in energy
18 // equivalent units.
19 //
20 // AddElecNoiseAndDigitse(Double_t, Double_t) Do both
21 //
22 // AddShapedElecNoiseAndDigitse(Double_t, Double_t) Do both, but with
23 // noise tyhat is not just plain gaussian, but passed through the
24 // shaping. Only use for detailed studies- this is like
25 // adding a Hit to *every bin* and is very slow if you are doing
26 // a calorimiter's worth.
27 //
28 // GetScale() Return the maximum peak of a 1 GeV hit.
29 //
30 // Software developed for the BaBar Detector at the SLAC B-Factory.
31 // Adapted for the PANDA experiment at GSI
32 //
33 // P.D.Strother Imperial College
34 // Dima Melnichuk - adaption for PANDA
35 //=======================================================================
36 //#pragma once
37 #ifndef BSEMCWAVEFORM_HH
38 #define BSEMCWAVEFORM_HH
39 
40 #include <string>
41 #include <vector>
42 
43 #include "Rtypes.h"
44 #include "RtypesCore.h"
45 #include "TGraphErrors.h"
46 #include "TObject.h"
47 
48 #include "FairTimeStamp.h"
49 
50 #include "BSEmcDataBranchNames.h"
51 
52 class TBuffer;
53 class TClass;
54 class TGraphErrors;
55 class TMemberInspector;
56 
63 class BSEmcWaveform : public FairTimeStamp {
64 
66 
67  public:
68  BSEmcWaveform();
69  BSEmcWaveform(Int_t t_trackId, long t_detId, const std::vector<Double_t> &t_signal, Int_t t_hitIndex = -1);
70  virtual ~BSEmcWaveform();
71 
72  long GetDetectorId() const { return fDetectorId; }
73  Int_t GetTrackId() const { return fTrackId; }
74  Short_t GetModule() const { return (fDetectorId / 100000000); };
75  virtual std::vector<Double_t> GetSignal() const { return fSignal; };
76  virtual std::vector<Double_t> GetSignalError() const { return fSignalError; }
77 
78  Int_t GetHitIndex() const { return fHitIndex; }
79 
80  // Operators
81  virtual Bool_t operator==(const BSEmcWaveform &t_otherWave) const;
82  virtual Bool_t operator<(const BSEmcWaveform &t_otherWave) const;
83  virtual Bool_t operator!=(const BSEmcWaveform &t_otherWave) const;
84  virtual Bool_t equal(FairTimeStamp *t_data);
85  BSEmcWaveform &operator+=(const BSEmcWaveform &t_otherWave);
86 
87  Double_t GetSampleRate() const { return fSampleRate; } // in s^(-1)
88 
89  Int_t GetWaveformLength() const { return fWaveformLength; }
90 
91  // Modifiers
92  void SetSampleRate(Double_t t_rate) { fSampleRate = t_rate; }; // in s^(-1)
93 
94  void SetWaveform(std::vector<Double_t> &t_signal, Int_t t_length);
95  Double_t Max();
96 
97  virtual void clearAndReset();
98  virtual void Clear(Option_t * /*unused*/) { fSignal.clear(); };
99 
100  Double_t GetActiveTime() const { return GetTimeStamp() + (fWaveformLength - 1) / fSampleRate * 1.0e9; } // nano seconds
101  Int_t GetPileupCount() const { return fEvt.size() - 1; }
102 
103  void AddEvt(Int_t t_evtNo) { fEvt.push_back(t_evtNo); }
104  const std::vector<Int_t> &GetEvtList() const { return fEvt; }
105 
106  TGraphErrors *ToTGraph() const;
107 
108  Double_t GetBaseline() const { return fBaselineValue; }
109  Double_t Integral() const;
110 
111  void SetDetectorId(UInt_t t_detId) { fDetectorId = t_detId; }
112  void SetOverlapTime(const Double_t t_overlap) { fOverlapTime = t_overlap; }
113 
114  protected:
115  Int_t fTrackId{-1};
116  Int_t fDetectorId{-1};
117  Int_t fWaveformLength{-1};
118  std::vector<Double_t> fSignal{}; // Signal after FADC
119  std::vector<Double_t> fSignalError{}; // Signal after FADC
120  Int_t fHitIndex{-1};
121 
122  Double_t fSampleRate{-1}; // in s^(-1)
123  Double_t fBaselineValue{-1};
124 
125  std::vector<Int_t> fEvt{}; // combined waveforms from which events, for check.
126  Double_t fOverlapTime{};
127 
129 };
130 #endif /*BSEMCWAVEFORM_HH*/
virtual void clearAndReset()
represents a simulated waveform in an emc crystal
Definition: BSEmcWaveform.h:63
std::vector< Int_t > fEvt
Double_t GetActiveTime() const
void SetDetectorId(UInt_t t_detId)
virtual Bool_t operator!=(const BSEmcWaveform &t_otherWave) const
Double_t fBaselineValue
void SetWaveform(std::vector< Double_t > &t_signal, Int_t t_length)
Double_t fSampleRate
std::vector< Double_t > fSignalError
Short_t GetModule() const
Definition: BSEmcWaveform.h:74
interface for waveform modifiers
Double_t fOverlapTime
Int_t GetHitIndex() const
Definition: BSEmcWaveform.h:78
Int_t GetTrackId() const
Definition: BSEmcWaveform.h:73
Double_t Max()
virtual Bool_t operator==(const BSEmcWaveform &t_otherWave) const
virtual void Clear(Option_t *)
Definition: BSEmcWaveform.h:98
ClassDef(BSEmcAbsWaveformModifier, 1)
TGraphErrors * ToTGraph() const
Int_t fWaveformLength
Int_t GetWaveformLength() const
Definition: BSEmcWaveform.h:89
virtual ~BSEmcWaveform()
void SetSampleRate(Double_t t_rate)
Definition: BSEmcWaveform.h:92
const std::vector< Int_t > & GetEvtList() const
Double_t Integral() const
long GetDetectorId() const
Definition: BSEmcWaveform.h:72
virtual Bool_t operator<(const BSEmcWaveform &t_otherWave) const
virtual Bool_t equal(FairTimeStamp *t_data)
void SetOverlapTime(const Double_t t_overlap)
Int_t GetPileupCount() const
Double_t GetBaseline() const
void AddEvt(Int_t t_evtNo)
virtual std::vector< Double_t > GetSignal() const
Definition: BSEmcWaveform.h:75
BSEmcWaveform & operator+=(const BSEmcWaveform &t_otherWave)
Double_t GetSampleRate() const
Definition: BSEmcWaveform.h:87
std::vector< Double_t > fSignal
virtual std::vector< Double_t > GetSignalError() const
Definition: BSEmcWaveform.h:76