CbmRoot
CbmTrdDigi.h
Go to the documentation of this file.
1 #ifndef CBMTRDDIGI_H
2 #define CBMTRDDIGI_H
3 
4 #include <Rtypes.h> // for ClassDef
5 #include <RtypesCore.h> // for Int_t, Float_t, Double_t, Bool_t, ULong64_t
6 
7 #include <string> // for string
8 
9 #include "CbmDefs.h" // for kTrd
10 
11 #include <boost/serialization/access.hpp>
12 #include <boost/serialization/base_object.hpp>
13 
14 class CbmTrdDigi {
15 public:
23  kNTrg
24  };
26  kFlag1 = 0 //<
27  ,
28  kFlag2 //< in case of FASP simulations define pileup
29  ,
30  kFlag3 //< in case of FASP simulations define masked
31  ,
32  kNflags
33  };
37  CbmTrdDigi();
45  CbmTrdDigi(Int_t padChNr, Float_t chargeT, Float_t chargeR, ULong64_t time);
54  CbmTrdDigi(Int_t padChNr,
55  Int_t uniqueModuleId,
56  Float_t charge,
57  ULong64_t time,
58  Int_t triggerType,
59  Int_t errClass /*nrSamples*/);
60 
65  CbmTrdDigi(Int_t /*address*/,
66  Double_t /*fullTime*/,
67  Int_t /*triggerType*/,
68  Int_t /*infoType*/,
69  Int_t /*stopType*/,
70  Int_t /*nrSamples*/,
71  Float_t* /*samples*/)
72  : fInfo(0), fCharge(0), fTime(0) {
73  ;
74  }
75 
80  void AddCharge(CbmTrdDigi* sd, Double_t f);
85  void AddCharge(Double_t c, Double_t f = 1);
87  static Float_t Clk(CbmTrdAsicType ty) {
88  return (ty == kNTypes ? 0 : fgClk[ty]);
89  }
92  Int_t GetAddress() const { return (fInfo >> fgkRoOffset) & 0x7fffff; }
96  Int_t GetAddressChannel() const;
100  Int_t GetAddressModule() const;
102  Double_t GetCharge() const;
108  Double_t GetCharge(Double_t& tilt, Int_t& dt) const;
110  Double_t GetChargeError() const;
112  Int_t GetErrorClass() const { return (fInfo >> fgkErrOffset) & 0x7; }
113 
118 
119 
123  static const char* GetClassName() { return "CbmTrdDigi"; }
124 
125 
127  Double_t GetTime() const {
128  return (GetType() == kFASP) ? fTime * fgClk[GetType()] : fTime;
129  }
131  ULong64_t GetTimeDAQ() const {
132  return (GetType() == kFASP) ? fTime : fTime / fgClk[GetType()];
133  }
135  Int_t GetTriggerType() const { return (fInfo >> fgkTrgOffset) & 0x3; }
138  return ((fInfo >> fgkTypOffset) & 0x1) ? kFASP : kSPADIC;
139  }
140 
142  Bool_t IsMasked() const { return (GetType() == kFASP) && IsFlagged(kFlag3); }
144  Bool_t IsPileUp() const { return (GetType() == kFASP) && IsFlagged(kFlag2); }
146  Bool_t IsFlagged(const Int_t iflag) const;
147  Int_t Layer() const { return (fInfo >> fgkLyOffset) & 0xf; }
148  Int_t Module() const { return (fInfo >> fgkModOffset) & 0x7f; }
149 
153  void SetAddress(const Int_t a);
155  void SetAddressModule(const Int_t a) { SetAddress(a); }
156 
157  void SetAsic(CbmTrdAsicType ty = kSPADIC);
161  void SetCharge(Float_t c);
167  void SetCharge(Float_t cT, Float_t cR, Int_t dt = 0);
169  void SetFlag(const Int_t iflag, Bool_t set = kTRUE);
171  void SetMasked(Bool_t set = kTRUE) {
172  if (GetType() == kFASP) SetFlag(kFlag3, set);
173  }
175  void SetPileUp(Bool_t set = kTRUE) {
176  if (GetType() == kFASP) SetFlag(kFlag2, set);
177  }
179  void SetTime(Double_t t);
181  void SetTimeDAQ(ULong64_t t) { fTime = t; }
183  void SetTimeOffset(Char_t t);
185  void SetTriggerType(const Int_t ttype);
187  void SetErrorClass(const Int_t n) {
188  fInfo &= ~(0x7 << fgkErrOffset);
189  fInfo |= ((n & 0x7) << fgkErrOffset);
190  }
192  std::string ToString() const;
193 
194  // TEMPORARY ADDED WITHOUT PROVIDING FUNCTIONALITY ! TODO should be removed
195  // keep backward compatible compilation of CbmTrdSPADIC
196  void SetStopType(Int_t /*stopType*/) { ; }
197  Int_t GetStopType() { return 0; }
198  void SetPulseShape(Float_t /*pulse*/[45]) { ; }
199  // keep backward compatible compilation of fles/reader/tasks [/tools]
200  Double_t GetChargeTR() const { return 0.; }
201  void SetInfoType(Int_t /*infoType*/) { ; }
202  Int_t GetNrSamples() { return 0; }
203  Float_t* GetSamples() { return nullptr; }
204 
205 protected:
206  void SetChannel(const Int_t a) {
207  fInfo &= ~(0xfff << fgkRoOffset);
208  fInfo |= (a & 0xfff) << fgkRoOffset;
209  }
210  void SetLayer(const Int_t a) {
211  fInfo &= ~(0xf << fgkLyOffset);
212  fInfo |= ((a & 0xf) << fgkLyOffset);
213  }
214  void SetModule(const Int_t a) {
215  fInfo &= ~(0x7f << fgkModOffset);
216  fInfo |= ((a & 0x7f) << fgkModOffset);
217  }
218 
219  UInt_t fInfo; //< pad address and extra information
220  UInt_t
221  fCharge; //< measured charge. For SPADIC is Int_t(charge*1eN) where N is the precission while
222  //< for FASP it contains the R and T charges each on 12bits and the time difference between R and T pads in CLK (8 bits).
223  ULong64_t
224  fTime; //< global time of the digi: For SPADIC in ns, for FASP in ASIC clock
225 
226  static Double_t fgClk[kNTypes]; //< clock length in ns for acquisition
227  static Float_t fgPrecission[kNTypes]; //< no. of digits stored for ASIC
228 
229 private:
230  static const Int_t fgkRoOffset = 0;
231  static const Int_t fgkModOffset = 12;
232  static const Int_t fgkLyOffset = 19;
233  static const Int_t fgkErrOffset = 23;
234  static const Int_t fgkFlgOffset = 26;
235  static const Int_t fgkTrgOffset = 29;
236  static const Int_t fgkTypOffset = 31;
237 
240  template<class Archive>
241  void serialize(Archive& ar, const unsigned int /*version*/) {
242  ar& fInfo;
243  ar& fCharge;
244  ar& fTime;
245  }
246 
247  ClassDefNV(CbmTrdDigi, 3); // Production ready TRD digit
248 };
249 
250 #endif
CbmTrdDigi::kBeginTriggerTypes
@ kBeginTriggerTypes
Definition: CbmTrdDigi.h:18
CbmTrdDigi::GetTimeDAQ
ULong64_t GetTimeDAQ() const
Getter for global DAQ time [clk]. Differs for each ASIC. In FASP case DAQ time is already stored in f...
Definition: CbmTrdDigi.h:131
CbmTrdDigi::GetChargeError
Double_t GetChargeError() const
Charge error parametrisation. SPADIC specific see GetErrorClass()
Definition: CbmTrdDigi.cxx:162
CbmTrdDigi::GetNrSamples
Int_t GetNrSamples()
Definition: CbmTrdDigi.h:202
CbmTrdDigi::fCharge
UInt_t fCharge
Definition: CbmTrdDigi.h:221
CbmTrdDigi::GetAddress
Int_t GetAddress() const
Address getter for module in the format defined by CbmTrdDigi (format of CbmTrdAddress can be accesse...
Definition: CbmTrdDigi.h:92
CbmTrdDigi::IsPileUp
Bool_t IsPileUp() const
Query digi pile-up (FASP only)
Definition: CbmTrdDigi.h:144
f
float f
Definition: L1/vectors/P4_F32vec4.h:24
CbmTrdDigi::SetTimeOffset
void SetTimeOffset(Char_t t)
Set time offset of rectangular to tilt pads for FASP (clk)
Definition: CbmTrdDigi.cxx:229
CbmTrdDigi::IsFlagged
Bool_t IsFlagged(const Int_t iflag) const
Query flag status (generic)
Definition: CbmTrdDigi.cxx:165
CbmTrdDigi::GetErrorClass
Int_t GetErrorClass() const
Channel status. SPADIC specific see LUT.
Definition: CbmTrdDigi.h:112
CbmTrdDigi::fgkErrOffset
static const Int_t fgkErrOffset
Definition: CbmTrdDigi.h:233
CbmTrdDigi::fgClk
static Double_t fgClk[kNTypes]
Definition: CbmTrdDigi.h:226
CbmTrdDigi::kNeighbor
@ kNeighbor
Definition: CbmTrdDigi.h:20
CbmTrdDigi::GetStopType
Int_t GetStopType()
Definition: CbmTrdDigi.h:197
CbmTrdDigi::SetCharge
void SetCharge(Float_t c)
Charge setter for SPADIC ASIC.
Definition: CbmTrdDigi.cxx:206
CbmTrdDigi::SetTimeDAQ
void SetTimeDAQ(ULong64_t t)
Set global digi time (clk)
Definition: CbmTrdDigi.h:181
CbmTrdDigi::fgkRoOffset
static const Int_t fgkRoOffset
Definition: CbmTrdDigi.h:230
CbmTrdDigi::GetAddressChannel
Int_t GetAddressChannel() const
Getter read-out id.
Definition: CbmTrdDigi.cxx:119
CbmTrdDigi::kFlag3
@ kFlag3
Definition: CbmTrdDigi.h:30
CbmTrdDigi::fTime
ULong64_t fTime
Definition: CbmTrdDigi.h:224
CbmTrdDigi::kSelf
@ kSelf
Definition: CbmTrdDigi.h:19
CbmTrdDigi::SetFlag
void SetFlag(const Int_t iflag, Bool_t set=kTRUE)
Generic flag status setter.
Definition: CbmTrdDigi.cxx:215
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
CbmTrdDigi::kFASP
@ kFASP
Definition: CbmTrdDigi.h:16
CbmTrdDigi::kFlag1
@ kFlag1
Definition: CbmTrdDigi.h:26
CbmTrdDigi::AddCharge
void AddCharge(CbmTrdDigi *sd, Double_t f)
Charge addition in case of pile-up (FASP simulation only)
Definition: CbmTrdDigi.cxx:79
CbmTrdDigi::SetLayer
void SetLayer(const Int_t a)
Definition: CbmTrdDigi.h:210
CbmTrdDigi::SetAddress
void SetAddress(const Int_t a)
Module address setter for digi.
Definition: CbmTrdDigi.cxx:171
CbmTrdDigi::CbmTrdDigi
CbmTrdDigi(Int_t, Double_t, Int_t, Int_t, Int_t, Int_t, Float_t *)
Constructor for backward compatibillity. Does not do anything.
Definition: CbmTrdDigi.h:65
CbmTrdDigi::SetPulseShape
void SetPulseShape(Float_t[45])
Definition: CbmTrdDigi.h:198
CbmTrdDigi::fgkFlgOffset
static const Int_t fgkFlgOffset
Definition: CbmTrdDigi.h:234
CbmTrdDigi::fgPrecission
static Float_t fgPrecission[kNTypes]
Definition: CbmTrdDigi.h:227
CbmTrdDigi::fgkLyOffset
static const Int_t fgkLyOffset
Definition: CbmTrdDigi.h:232
CbmTrdDigi::Clk
static Float_t Clk(CbmTrdAsicType ty)
DAQ clock accessor for each ASIC.
Definition: CbmTrdDigi.h:87
CbmTrdDigi::CbmTrdDigiDef
CbmTrdDigiDef
Definition: CbmTrdDigi.h:25
CbmTrdDigi::CbmTrdDigi
CbmTrdDigi()
Default constructor.
Definition: CbmTrdDigi.cxx:30
CbmTrdDigi::serialize
void serialize(Archive &ar, const unsigned int)
Definition: CbmTrdDigi.h:241
CbmTrdDigi::GetSamples
Float_t * GetSamples()
Definition: CbmTrdDigi.h:203
CbmTrdDigi::GetClassName
static const char * GetClassName()
Class name (static)
Definition: CbmTrdDigi.h:123
CbmTrdDigi::SetInfoType
void SetInfoType(Int_t)
Definition: CbmTrdDigi.h:201
CbmTrdDigi::access
friend class boost::serialization::access
BOOST serialization interface.
Definition: CbmTrdDigi.h:239
CbmTrdDigi::ClassDefNV
ClassDefNV(CbmTrdDigi, 3)
CbmTrdDigi::SetAddressModule
void SetAddressModule(const Int_t a)
Alias for SetAddress()
Definition: CbmTrdDigi.h:155
CbmTrdDigi::kNTrg
@ kNTrg
Definition: CbmTrdDigi.h:23
CbmTrdDigi::IsMasked
Bool_t IsMasked() const
Query digi mask (FASP only)
Definition: CbmTrdDigi.h:142
ECbmModuleId::kTrd
@ kTrd
Transition Radiation Detector.
CbmTrdDigi::GetType
CbmTrdAsicType GetType() const
Channel FEE SPADIC/FASP according to CbmTrdAsicType.
Definition: CbmTrdDigi.h:137
CbmTrdDigi::fgkTrgOffset
static const Int_t fgkTrgOffset
Definition: CbmTrdDigi.h:235
CbmTrdDigi::kTrg2
@ kTrg2
Definition: CbmTrdDigi.h:22
CbmTrdDigi::SetTriggerType
void SetTriggerType(const Int_t ttype)
Set digi trigger type (SPADIC only)
Definition: CbmTrdDigi.cxx:237
CbmTrdDigi::GetChargeTR
Double_t GetChargeTR() const
Definition: CbmTrdDigi.h:200
CbmTrdDigi::SetStopType
void SetStopType(Int_t)
Definition: CbmTrdDigi.h:196
CbmTrdDigi::kSPADIC
@ kSPADIC
Definition: CbmTrdDigi.h:16
CbmTrdDigi::GetSystem
static ECbmModuleId GetSystem()
Definition: CbmTrdDigi.h:117
CbmTrdDigi::SetPileUp
void SetPileUp(Bool_t set=kTRUE)
Set digi pile-up (FASP only)
Definition: CbmTrdDigi.h:175
CbmTrdDigi::GetTriggerType
Int_t GetTriggerType() const
Channel trigger type. SPADIC specific see CbmTrdTriggerType.
Definition: CbmTrdDigi.h:135
CbmTrdDigi::Layer
Int_t Layer() const
Definition: CbmTrdDigi.h:147
CbmTrdDigi::fInfo
UInt_t fInfo
Definition: CbmTrdDigi.h:219
CbmTrdDigi::kMulti
@ kMulti
Definition: CbmTrdDigi.h:21
CbmTrdDigi::Module
Int_t Module() const
Definition: CbmTrdDigi.h:148
CbmTrdDigi::fgkModOffset
static const Int_t fgkModOffset
Definition: CbmTrdDigi.h:231
CbmTrdDigi
Definition: CbmTrdDigi.h:14
CbmTrdDigi::GetTime
Double_t GetTime() const
Getter for physical time [ns]. Accounts for clock representation of each ASIC. In SPADIC case physica...
Definition: CbmTrdDigi.h:127
CbmTrdDigi::kNTypes
@ kNTypes
Definition: CbmTrdDigi.h:16
CbmTrdDigi::fgkTypOffset
static const Int_t fgkTypOffset
Definition: CbmTrdDigi.h:236
CbmTrdDigi::SetModule
void SetModule(const Int_t a)
Definition: CbmTrdDigi.h:214
CbmTrdDigi::kNflags
@ kNflags
Definition: CbmTrdDigi.h:32
CbmTrdDigi::CbmTrdAsicType
CbmTrdAsicType
Definition: CbmTrdDigi.h:16
CbmTrdDigi::SetAsic
void SetAsic(CbmTrdAsicType ty=kSPADIC)
Definition: CbmTrdDigi.cxx:177
CbmTrdDigi::SetTime
void SetTime(Double_t t)
Set global digi time (ns)
Definition: CbmTrdDigi.cxx:224
CbmTrdDigi::SetChannel
void SetChannel(const Int_t a)
Definition: CbmTrdDigi.h:206
CbmTrdDigi::GetCharge
Double_t GetCharge() const
Charge getter for SPADIC.
Definition: CbmTrdDigi.cxx:133
CbmTrdDigi::SetMasked
void SetMasked(Bool_t set=kTRUE)
Set digi mask (FASP only)
Definition: CbmTrdDigi.h:171
CbmTrdDigi::kFlag2
@ kFlag2
Definition: CbmTrdDigi.h:28
CbmTrdDigi::SetErrorClass
void SetErrorClass(const Int_t n)
Set digi error class (SPADIC only)
Definition: CbmTrdDigi.h:187
CbmTrdDigi::GetAddressModule
Int_t GetAddressModule() const
Getter module address in the experiment.
Definition: CbmTrdDigi.cxx:126
CbmTrdDigi::ECbmTrdTriggerType
ECbmTrdTriggerType
Definition: CbmTrdDigi.h:17
CbmDefs.h
CbmTrdDigi::ToString
std::string ToString() const
String representation of a TRD digi. Account for digi type and specific information.
Definition: CbmTrdDigi.cxx:243