CbmRoot
Loading...
Searching...
No Matches
CbmTrdDigiRec.cxx
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 Horia Hulubei National Institute of Physics and Nuclear Engineering, Bucharest
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Alexandru Bercuci[committer] */
4
5#include "CbmTrdDigiRec.h"
6
7#include "CbmTrdFASP.h"
8
10
11 //_____________________________________________________________________________
13 : CbmTrdDigi()
14 , fStatus(0)
15{
16 fG[0] = 1.;
17 fG[1] = 1.;
18 memset(fT, 0, 3 * sizeof(Double_t));
19}
20
21//_____________________________________________________________________________
22CbmTrdDigiRec::CbmTrdDigiRec(const CbmTrdDigi& d, Double_t* G, Double_t* T) : CbmTrdDigi(d), fStatus(0)
23{
24 if (G) {
25 fG[0] = G[0];
26 fG[1] = G[1];
27 }
28 else {
29 fG[0] = 1.;
30 fG[1] = 1.;
31 }
32 if (T)
33 memcpy(fT, T, 3 * sizeof(Double_t));
34 else
35 memset(fT, 0, 3 * sizeof(Double_t));
36
37 Int_t dt;
38 Double_t t, r = CbmTrdDigi::GetCharge(t, dt);
39 if (t > 4094) SETBIT(fStatus, 0);
40 if (r > 4094) SETBIT(fStatus, 1);
41}
42
43//_____________________________________________________________________________
44CbmTrdDigiRec::CbmTrdDigiRec(const CbmTrdDigi& d, const CbmTrdDigi& dr, Double_t* G, Double_t* T)
45 : CbmTrdDigi(d)
46 , fStatus(0)
47{
50 if (G) {
51 fG[0] = G[0];
52 fG[1] = G[1];
53 }
54 else {
55 fG[0] = 1.;
56 fG[1] = 1.;
57 }
58 if (T)
59 memcpy(fT, T, 3 * sizeof(Double_t));
60 else
61 memset(fT, 0, 3 * sizeof(Double_t));
62
63 Int_t dt;
64 Double_t t, r = dr.GetCharge(t, dt);
65 if (r > 4094) SETBIT(fStatus, 1);
67 if (t > 4094) SETBIT(fStatus, 0);
68 dt = dr.GetTimeDAQ() - GetTimeDAQ();
69 SetCharge(t, r, dt);
70 Int_t rtrg(dr.GetTriggerType() & 2), ttrg(GetTriggerType() & 1);
71 SetTriggerType(rtrg | ttrg); //merge the triggers
72}
73
74//_____________________________________________________________________________
75Double_t CbmTrdDigiRec::GetCharge(Int_t typ, Bool_t& on) const
76{
77 Int_t dT;
78 Double_t T, R = CbmTrdDigi::GetCharge(T, dT);
79 on = kTRUE;
80 if (typ) { // rectangular pairing
81 if (R > 0) {
83 return fG[1] * R;
84 }
85 else
86 on = kFALSE;
87 }
88 else { // tilt pairing
89 if (T > 0) {
91 return fG[0] * T;
92 }
93 else
94 on = kFALSE;
95 }
96 return 0.;
97}
98
99//_____________________________________________________________________________
100Double_t CbmTrdDigiRec::GetTime(Int_t typ) const
101{
102 Int_t dT;
103 Double_t T, R = CbmTrdDigi::GetCharge(T, dT);
104 if (typ) { // rectangular pairing
105 Double_t R0 = R - fT[2];
106 return GetTimeDAQ() + dT + fT[0] * R0 * R0 + fT[1] * R0;
107 }
108 else { // tilt pairing
109 Double_t T0 = T - fT[2];
110 return GetTimeDAQ() + fT[0] * T0 * T0 + fT[1] * T0;
111 }
112}
113
114//_____________________________________________________________________________
115void CbmTrdDigiRec::Init(Double_t g[2], Double_t t[3])
116{
117 fG[0] = g[0];
118 fG[1] = g[1];
119 memcpy(fT, t, 3 * sizeof(Double_t));
120}
ClassImp(CbmTrdDigiRec) CbmTrdDigiRec
#define SETBIT(n, i)
Definition RTypes.h:15
Extend the TRD(2D) digi class to incorporate FEE calibration.
void Init(Double_t g[2], Double_t t[3])
Init FEE gain and time walk corrections.
Double_t fG[2]
Double_t fT[3]
CbmTrdDigiRec()
Default constructor.
void SetTriggerType(const eTriggerType triggerType)
Set digi trigger type.
int32_t GetTriggerType() const
Channel trigger type. SPADIC specific see CbmTrdTriggerType.
Definition CbmTrdDigi.h:163
uint64_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:158
double GetTime() const
Getter for physical time [ns]. Accounts for clock representation of each ASIC. In SPADIC case physica...
Definition CbmTrdDigi.h:153
double GetCharge() const
Common purpose charge getter.
void SetCharge(float c)
Charge setter for SPADIC ASIC.
static Float_t GetBaselineCorr()
Return the baseline value in ADC ch.
Definition CbmTrdFASP.h:44