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