CbmRoot
CbmTrdRawToDigiR.h
Go to the documentation of this file.
1 #ifndef CBMTRDRAWTODIGI_H
2 #define CBMTRDRAWTODIGI_H
3 
4 #include "CbmTrdCheckUtil.h"
5 #include "CbmTrdDigi.h"
6 //#include "CbmSpadicRawMessage22.h"
7 
8 #include <map>
9 #include <string>
10 #include <vector>
11 
12 #include <FairRootManager.h>
13 #include <TFile.h>
14 #include <TH1D.h>
15 #include <TH2D.h>
16 
17 class CbmTrdRawToDigiR : public TObject {
18 
19 
20 public:
24 
25  CbmTrdRawToDigiR(std::string readfile);
26 
29  CbmTrdRawToDigiR(Double_t cal, Double_t tau, Int_t mode);
30 
33  CbmTrdRawToDigiR(Double_t cal, Double_t tau, std::vector<Int_t> mask);
34 
36  virtual ~CbmTrdRawToDigiR() { ; }
37 
38  // CbmTrdDigi* MakeDigi(CbmSpadicRawMessage22* raw);
39  CbmTrdDigi* MakeDigi(std::vector<Int_t> samples,
40  Int_t channel,
41  Int_t uniqueModuleId,
42  ULong64_t time,
43  Bool_t FN = false);
44 
45  Float_t GetTimeShift(std::vector<Int_t> samples);
46  Double_t GetCharge(std::vector<Int_t> samples, Int_t shift = -1);
47 
48  void SetCalibration(Double_t cal) { fCalibration = cal; }
49  void SetTau(Double_t tau) { fTau = tau; }
50  void SetRecoMode(Int_t mode) { fRecoMode = mode; }
51  void SetShapingOrder(Int_t order) { fShapingOrder = order; }
52  void SetRecoMask(std::vector<Int_t> mask) { fSampleMask = mask; }
53  void SetSetter(Bool_t set) { fSet = set; }
54  void SetReadFile(std::string file) { fReadFile = file; }
55  void SetWriteFile(std::string file) { fWriteFile = file; }
56  void SetMaxBin(Int_t bin) { fMaxBin = bin; }
57  void SetMinBin(Int_t bin) { fMinBin = bin; }
58  void SetPresamples(Int_t pre) { fPresamples = pre; }
59  void SetLookup(Int_t mode) { fLookUp = mode; }
60  void SetPars(Int_t mode, Double_t cal, Double_t tau, std::vector<Int_t> mask);
61  void Init();
62  void FillLookUps(std::string write = "");
63  void WriteMaps(std::string file = "") { (void) file; } //dummy for now
64  void ReadMaps(std::string file = "");
65  void SetDebug(Bool_t debug) { fDebug = debug; }
66  void SetQA(CbmTrdCheckUtil* qa) { fQA = qa; }
67 
68 
69  Bool_t GetSetter() { return fSet; }
70 
71 private:
74 
75  Double_t fCalibration =
76  35. / 1.1107 / 0.8; // calibrating pulse height to MIP
77  Double_t fEReco =
78  0.; // calibrating energy reconstruction to the amount and position of used samples of the pulse
79  Double_t fTau = 120; // peaking time of the pulse
80  Int_t fRecoMode = 1; // pre defined mode for reconstruction samples
81  Int_t fShapingOrder = 1; // shaping order in analytic response calculation
82  Int_t fDynamicRange = 500; // maximum of ADC range to identiefy time shift
83  Int_t fHighBin =
84  3; // additional sample position for lookup table to identiefy time shift
85  Int_t fPresamples =
86  2; // additional sample position for lookup table to identiefy time shift
87  Int_t fMaxBin = 2 + fPresamples; // expected maximum position for the pulse
88  Int_t fMinBin =
89  1 + fPresamples; // additional sample position for lookup table
90  Float_t fExtrapolate =
91  .2; // percentage extrapolation range for analytical solution
92  std::vector<Int_t> fSampleMask; // reconstruction mask
93  Double_t CalcResponse(Double_t t);
94 
95  Int_t fLookUp = 3;
96 
97  Bool_t fDebug =
98  false; // Debug switch to output calculation time of the lookup
99  Bool_t fSet = false; // Boolean for module initialisation in simulation
100  std::string fReadFile = ""; // filepath to existing lookup table
101  std::string fWriteFile =
102  ""; // filepath to write newly calculated lookup table into
103 
105 
106  std::map<Int_t, std::map<Int_t, Float_t>> fElookupSmall;
107  std::map<Int_t, std::map<Int_t, std::map<Int_t, Int_t>>> fElookupAsym;
108  std::map<Int_t, std::map<Int_t, Int_t>> fElookupA;
109  std::map<Int_t, std::map<Int_t, std::map<Int_t, Int_t>>> fElookupBig;
110  std::map<Int_t, Float_t> fElookup;
111 
113 };
114 
115 #endif
CbmTrdRawToDigiR::SetCalibration
void SetCalibration(Double_t cal)
Definition: CbmTrdRawToDigiR.h:48
CbmTrdRawToDigiR::SetMaxBin
void SetMaxBin(Int_t bin)
Definition: CbmTrdRawToDigiR.h:56
CbmTrdRawToDigiR::CbmTrdRawToDigiR
CbmTrdRawToDigiR(const CbmTrdRawToDigiR &)
CbmTrdRawToDigiR::fDynamicRange
Int_t fDynamicRange
Definition: CbmTrdRawToDigiR.h:82
CbmTrdRawToDigiR::SetShapingOrder
void SetShapingOrder(Int_t order)
Definition: CbmTrdRawToDigiR.h:51
CbmTrdRawToDigiR::SetPresamples
void SetPresamples(Int_t pre)
Definition: CbmTrdRawToDigiR.h:58
CbmTrdRawToDigiR::fRecoMode
Int_t fRecoMode
Definition: CbmTrdRawToDigiR.h:80
CbmTrdRawToDigiR::SetRecoMode
void SetRecoMode(Int_t mode)
Definition: CbmTrdRawToDigiR.h:50
CbmTrdRawToDigiR::fPresamples
Int_t fPresamples
Definition: CbmTrdRawToDigiR.h:85
CbmTrdRawToDigiR::CbmTrdRawToDigiR
CbmTrdRawToDigiR()
default Constructor with messages
Definition: CbmTrdRawToDigiR.cxx:21
CbmTrdRawToDigiR::fElookupAsym
std::map< Int_t, std::map< Int_t, std::map< Int_t, Int_t > > > fElookupAsym
Definition: CbmTrdRawToDigiR.h:107
CbmTrdRawToDigiR::SetQA
void SetQA(CbmTrdCheckUtil *qa)
Definition: CbmTrdRawToDigiR.h:66
CbmTrdRawToDigiR::SetMinBin
void SetMinBin(Int_t bin)
Definition: CbmTrdRawToDigiR.h:57
CbmTrdRawToDigiR::SetDebug
void SetDebug(Bool_t debug)
Definition: CbmTrdRawToDigiR.h:65
CbmTrdRawToDigiR::fElookupSmall
std::map< Int_t, std::map< Int_t, Float_t > > fElookupSmall
Definition: CbmTrdRawToDigiR.h:106
CbmTrdRawToDigiR::fExtrapolate
Float_t fExtrapolate
Definition: CbmTrdRawToDigiR.h:90
CbmTrdRawToDigiR::fElookup
std::map< Int_t, Float_t > fElookup
Definition: CbmTrdRawToDigiR.h:110
CbmTrdRawToDigiR::fLookUp
Int_t fLookUp
Definition: CbmTrdRawToDigiR.h:95
CbmTrdRawToDigiR::fEReco
Double_t fEReco
Definition: CbmTrdRawToDigiR.h:77
CbmTrdRawToDigiR::SetPars
void SetPars(Int_t mode, Double_t cal, Double_t tau, std::vector< Int_t > mask)
Definition: CbmTrdRawToDigiR.cxx:77
CbmTrdRawToDigiR::GetCharge
Double_t GetCharge(std::vector< Int_t > samples, Int_t shift=-1)
Definition: CbmTrdRawToDigiR.cxx:551
CbmTrdRawToDigiR::fWriteFile
std::string fWriteFile
Definition: CbmTrdRawToDigiR.h:101
CbmTrdRawToDigiR::fQA
CbmTrdCheckUtil * fQA
Definition: CbmTrdRawToDigiR.h:104
CbmTrdRawToDigiR::fSet
Bool_t fSet
Definition: CbmTrdRawToDigiR.h:99
CbmTrdDigi.h
CbmTrdRawToDigiR::GetSetter
Bool_t GetSetter()
Definition: CbmTrdRawToDigiR.h:69
CbmTrdRawToDigiR::GetTimeShift
Float_t GetTimeShift(std::vector< Int_t > samples)
Definition: CbmTrdRawToDigiR.cxx:533
CbmTrdRawToDigiR::fSampleMask
std::vector< Int_t > fSampleMask
Definition: CbmTrdRawToDigiR.h:92
CbmTrdRawToDigiR::Init
void Init()
Definition: CbmTrdRawToDigiR.cxx:143
CbmTrdRawToDigiR::fHighBin
Int_t fHighBin
Definition: CbmTrdRawToDigiR.h:83
CbmTrdRawToDigiR::SetLookup
void SetLookup(Int_t mode)
Definition: CbmTrdRawToDigiR.h:59
CbmTrdRawToDigiR::fTau
Double_t fTau
Definition: CbmTrdRawToDigiR.h:79
CbmTrdRawToDigiR::SetWriteFile
void SetWriteFile(std::string file)
Definition: CbmTrdRawToDigiR.h:55
CbmTrdRawToDigiR
Definition: CbmTrdRawToDigiR.h:17
CbmTrdRawToDigiR::fElookupBig
std::map< Int_t, std::map< Int_t, std::map< Int_t, Int_t > > > fElookupBig
Definition: CbmTrdRawToDigiR.h:109
CbmTrdCheckUtil
Definition: CbmTrdCheckUtil.h:19
CbmTrdRawToDigiR::WriteMaps
void WriteMaps(std::string file="")
Definition: CbmTrdRawToDigiR.h:63
CbmTrdRawToDigiR::~CbmTrdRawToDigiR
virtual ~CbmTrdRawToDigiR()
Destructor.
Definition: CbmTrdRawToDigiR.h:36
CbmTrdRawToDigiR::fDebug
Bool_t fDebug
Definition: CbmTrdRawToDigiR.h:97
CbmTrdRawToDigiR::fShapingOrder
Int_t fShapingOrder
Definition: CbmTrdRawToDigiR.h:81
CbmTrdRawToDigiR::fCalibration
Double_t fCalibration
Definition: CbmTrdRawToDigiR.h:75
CbmTrdRawToDigiR::ReadMaps
void ReadMaps(std::string file="")
Definition: CbmTrdRawToDigiR.cxx:423
CbmTrdDigi
Definition: CbmTrdDigi.h:14
CbmTrdRawToDigiR::SetTau
void SetTau(Double_t tau)
Definition: CbmTrdRawToDigiR.h:49
CbmTrdRawToDigiR::CalcResponse
Double_t CalcResponse(Double_t t)
Definition: CbmTrdRawToDigiR.cxx:599
CbmTrdRawToDigiR::fReadFile
std::string fReadFile
Definition: CbmTrdRawToDigiR.h:100
CbmTrdRawToDigiR::fElookupA
std::map< Int_t, std::map< Int_t, Int_t > > fElookupA
Definition: CbmTrdRawToDigiR.h:108
CbmTrdRawToDigiR::SetSetter
void SetSetter(Bool_t set)
Definition: CbmTrdRawToDigiR.h:53
CbmTrdRawToDigiR::MakeDigi
CbmTrdDigi * MakeDigi(std::vector< Int_t > samples, Int_t channel, Int_t uniqueModuleId, ULong64_t time, Bool_t FN=false)
Definition: CbmTrdRawToDigiR.cxx:492
CbmTrdRawToDigiR::SetReadFile
void SetReadFile(std::string file)
Definition: CbmTrdRawToDigiR.h:54
CbmTrdRawToDigiR::fMaxBin
Int_t fMaxBin
Definition: CbmTrdRawToDigiR.h:87
CbmTrdRawToDigiR::SetRecoMask
void SetRecoMask(std::vector< Int_t > mask)
Definition: CbmTrdRawToDigiR.h:52
CbmTrdRawToDigiR::ClassDef
ClassDef(CbmTrdRawToDigiR, 1)
CbmTrdRawToDigiR::FillLookUps
void FillLookUps(std::string write="")
Definition: CbmTrdRawToDigiR.cxx:172
CbmTrdRawToDigiR::operator=
CbmTrdRawToDigiR operator=(const CbmTrdRawToDigiR &)
CbmTrdRawToDigiR::fMinBin
Int_t fMinBin
Definition: CbmTrdRawToDigiR.h:88
CbmTrdCheckUtil.h