20#define BIT(n) (1ULL << (n))
21#define SETBIT(n, i) ((n) |= BIT(i))
22#define CLRBIT(n, i) ((n) &= ~BIT(i))
23#define TESTBIT(n, i) ((Bool_t)(((n) &BIT(i)) != 0))
28using std::stringstream;
98 LOG(warn) <<
"CbmTrdDigi::AddCharge(CbmTrdDigi*, double) : Only available for "
99 "FASP. Use AddCharge(double, double) instead.";
103 uint32_t t = ((
fCharge & 0xfff000) >> 12), r = (
fCharge & 0xfff), ts = ((sd->
fCharge & 0xfff000) >> 12),
111 if (t + ts < 0xfff) t += ts;
114 if (r + rs < 0xfff) r += rs;
126 LOG(warn) <<
"CbmTrdDigi::AddCharge(double, double) : Only available "
127 "for SPADIC. Use AddCharge(CbmTrdDigi*, double) instead.";
170 LOG(warn) <<
"CbmTrdDigi::GetCharge(double &) : Use double GetCharge() "
190 bool isMultihit =
static_cast<bool>((triggerValue >> 1) & 1);
192 return std::make_pair(type, isMultihit);
198 if (iflag < 0 || iflag >=
kNflags)
return false;
229 if (dt > 127) toff = 127;
232 if (r > 0xfff) r = 0xfff;
233 if (t > 0xfff) t = 0xfff;
248 if (iflag < 0 || iflag >=
kNflags)
return;
263 fTime =
static_cast<uint64_t
>(t);
282 if (triggerType < eTriggerType::kBeginTriggerTypes || triggerType >=
eTriggerType::kNTrg)
return;
283 const int32_t ttype =
static_cast<int32_t
>(triggerType);
307 bool ttrg(trg & 1), rtrg((trg & 2) >> 1);
308 ss <<
" | pu=" << (
IsPileUp() ?
"y" :
"n") <<
" | mask=" << (
IsMasked() ?
"y" :
"n") <<
" |charge=" << std::fixed
309 << std::setw(6) << std::setprecision(1) << t << (!ttrg && t > 0 ?
'*' :
' ') <<
"/" << r
310 << (!rtrg && r > 0 ?
'*' :
' ') <<
"[" << dt <<
"]";
ClassImp(CbmConverterManager)
Helper class to convert unique channel ID back and forth.
static uint32_t GetModuleId(uint32_t address)
Return module ID from address.
static uint32_t GetLayerId(uint32_t address)
Return layer ID from address.
static uint32_t GetAddress(int32_t layerId, int32_t moduleId, int32_t sectorId, int32_t rowId, int32_t columnId)
Return address from system ID, layer, module, sector, column and row IDs.
int32_t GetAddressModule() const
Getter module address in the experiment.
static const int32_t fgkTypOffset
void SetAsic(eCbmTrdAsicType ty=eCbmTrdAsicType::kSPADIC)
CbmTrdDigi()
Default constructor.
void SetTriggerType(const eTriggerType triggerType)
Set digi trigger type.
void SetAddress(const int32_t a)
Module address setter for digi.
static std::pair< eTriggerType, bool > GetTriggerPair(const int32_t triggerValue)
Get the trigger combination, i.e. St or Nt and is multihit or not (true/false)
int32_t GetTriggerType() const
Channel trigger type. SPADIC specific see CbmTrdTriggerType.
static const int32_t fgkTrgOffset
static const double fgClk[static_cast< size_t >(eCbmTrdAsicType::kNTypes)+1]
clock length in ns for acquisition
static const int32_t fgkRoOffset
void SetFlag(const int32_t iflag, bool set=true)
Generic flag status setter.
double GetChargeError() const
Charge error parametrisation. SPADIC specific see GetErrorClass()
void SetModule(const int32_t a)
bool IsPileUp() const
Query digi pile-up (FASP only)
std::string ToString() const
String representation of a TRD digi. Account for digi type and specific information.
void SetChannel(const int32_t a)
int32_t GetAddressChannel() const
Getter read-out id.
bool IsFlagged(const int32_t iflag) const
Query flag status (generic)
bool IsMasked() const
Query digi mask (FASP only)
static float Clk(eCbmTrdAsicType ty)
DAQ clock accessor for each ASIC.
static const int32_t fgkFlgOffset
void SetErrorClass(const int32_t n)
Set digi error class (SPADIC only)
eCbmTrdAsicType GetType() const
Channel FEE SPADIC/FASP according to CbmTrdAsicType.
void AddCharge(CbmTrdDigi *sd, double f)
Charge addition in case of pile-up (FASP simulation only)
int32_t GetErrorClass() const
Channel status. SPADIC specific see LUT.
void SetTimeOffset(int8_t t)
Set time offset of rectangular to tilt pads for FASP (clk)
double GetTime() const
Getter for physical time [ns]. Accounts for clock representation of each ASIC. In SPADIC case physica...
double GetCharge() const
Common purpose charge getter.
void SetCharge(float c)
Charge setter for SPADIC ASIC.
void SetTime(double t)
Set global digi time (ns)
static const float fgPrecission[static_cast< size_t >(eCbmTrdAsicType::kNTypes)+1]
Nr. of digits stored for ASIC.
void SetLayer(const int32_t a)