CbmRoot
CbmStar2019TofPar.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- CbmStar2019TofPar source file -----
3 // ----- Created 09/09/18 by P.-A. Loizeau -----
4 // -------------------------------------------------------------------------
5 
6 #include "CbmStar2019TofPar.h"
7 
8 #include "gDpbMessv100.h"
9 
10 #include "FairDetParIo.h"
11 #include "FairLogger.h"
12 #include "FairParIo.h"
13 #include "FairParamList.h"
14 
15 #include "TString.h"
16 
17 // ----- Standard constructor ------------------------------------------
19  const char* title,
20  const char* context)
21  : FairParGenericSet(name, title, context)
22  , fvdPadiThrCodeToValue(GetNrOfPadiThrCodes(), 0.0)
23  , fiMonitorMode(0)
24  , fiDebugMonitorMode(0)
25  , fiNrOfGdpb(-1)
26  , fiGdpbIdArray()
27  , fiNrOfGbtx(-1)
28  , fiNrOfModule(-1)
29  , fiNrOfRpc()
30  , fiRpcType()
31  , fiRpcSide()
32  , fiModuleId()
33  , fdSizeMsInNs(0.0)
34  , fdStarTriggAllowedSpread(0.0)
35  , fdStarTriggerDeadtime()
36  , fdStarTriggerDelay()
37  , fdStarTriggerWinSize() {
38  detName = "Tof";
39 
41  for (UInt_t uPadiPoint = 0; uPadiPoint < kuNbThrMeasPoints; ++uPadiPoint) {
42  fvdPadiThrCodeToValue[kuThrMeasCode[uPadiPoint]] = kdThrMeasVal[uPadiPoint];
43 
45  if (uPadiPoint + 1 < kuNbThrMeasPoints) {
46  UInt_t uNbSteps =
47  kuThrMeasCode[uPadiPoint + 1] - kuThrMeasCode[uPadiPoint];
48  Double_t dValStep =
49  (kdThrMeasVal[uPadiPoint + 1] - kdThrMeasVal[uPadiPoint]) / uNbSteps;
50  UInt_t uCode = kuThrMeasCode[uPadiPoint];
51  for (UInt_t uStep = 1; uStep < uNbSteps; ++uStep) {
52  uCode++;
53  fvdPadiThrCodeToValue[uCode] =
54  kdThrMeasVal[uPadiPoint] + dValStep * uStep;
55  } // for( UInt_t uStep = 1; uStep < uNbSteps; ++uStep)
56  } // if( uPadiPoint + 1 < kuNbThrMeasPoints )
57  } // for( UInt_t uPadiPoint = 0; uPadiPoint < kuNbThrMeasPoints; ++uPadiPoint )
58 }
59 // -------------------------------------------------------------------------
60 
61 
62 // ----- Destructor ----------------------------------------------------
64 // -------------------------------------------------------------------------
65 
66 
67 // ----- Public method clear -------------------------------------------
69  status = kFALSE;
70  resetInputVersions();
71 }
72 // -------------------------------------------------------------------------
73 
74 // -------------------------------------------------------------------------
75 
76 void CbmStar2019TofPar::putParams(FairParamList* l) {
77  if (!l) return;
78  l->add("MonitorMode", fiMonitorMode);
79  l->add("DebugMonitorMode", fiDebugMonitorMode);
80  l->add("NrOfGdpbs", fiNrOfGdpb);
81  l->add("GdpbIdArray", fiGdpbIdArray);
82  l->add("NrOfGbtx", fiNrOfGbtx);
83  l->add("NrOfModule", fiNrOfModule);
84  l->add("NrOfRpcs", fiNrOfRpc);
85  l->add("RpcType", fiRpcType);
86  l->add("RpcSide", fiRpcSide);
87  l->add("ModuleId", fiModuleId);
88  l->add("SizeMsInNs", fdSizeMsInNs);
89  l->add("SizeMsInNs", fdSizeMsInNs);
90  l->add("StarTriggAllowedSpread", fdStarTriggAllowedSpread);
91  l->add("StarTriggerDelay", fdStarTriggerDelay);
92  l->add("StarTriggerWinSize", fdStarTriggerWinSize);
93 }
94 
95 //------------------------------------------------------
96 
97 Bool_t CbmStar2019TofPar::getParams(FairParamList* l) {
98 
99  LOG(info) << "CbmStar2019TofPar::getParams";
100 
101  if (!l) return kFALSE;
102 
103  if (!l->fill("MonitorMode", &fiMonitorMode)) return kFALSE;
104 
105  if (!l->fill("DebugMonitorMode", &fiDebugMonitorMode)) return kFALSE;
106 
107  if (!l->fill("NrOfGdpbs", &fiNrOfGdpb)) return kFALSE;
108 
110  if (!l->fill("GdpbIdArray", &fiGdpbIdArray)) return kFALSE;
111 
112  if (!l->fill("NrOfGbtx", &fiNrOfGbtx)) return kFALSE;
113 
114  if (!l->fill("NrOfModule", &fiNrOfModule)) return kFALSE;
115 
116  fiNrOfRpc.Set(fiNrOfGbtx);
117  if (!l->fill("NrOfRpc", &fiNrOfRpc)) return kFALSE;
118 
119  fiRpcType.Set(fiNrOfGbtx);
120  if (!l->fill("RpcType", &fiRpcType)) return kFALSE;
121 
122  fiRpcSide.Set(fiNrOfGbtx);
123  if (!l->fill("RpcSide", &fiRpcSide)) return kFALSE;
124 
125  fiModuleId.Set(fiNrOfGbtx);
126  if (!l->fill("ModuleId", &fiModuleId)) return kFALSE;
127 
128  if (!l->fill("SizeMsInNs", &fdSizeMsInNs)) return kFALSE;
129 
130  if (!l->fill("StarTriggAllowedSpread", &fdStarTriggAllowedSpread))
131  return kFALSE;
132 
136  if (!l->fill("StarTriggerDeadtime", &fdStarTriggerDeadtime)) return kFALSE;
137  if (!l->fill("StarTriggerDelay", &fdStarTriggerDelay)) return kFALSE;
138  if (!l->fill("StarTriggerWinSize", &fdStarTriggerWinSize)) return kFALSE;
139 
140  LOG(info) << "CbmStar2019TofPar::getParams DONE!";
141 
142  return kTRUE;
143 }
144 
145 // -------------------------------------------------------------------------
146 Int_t CbmStar2019TofPar::Get4ChanToPadiChan(UInt_t uChannelInFee) {
147  if (uChannelInFee < GetNrOfChannelsPerFee())
148  return kuGet4topadi[uChannelInFee] - 1;
149  else {
150  LOG(fatal)
151  << "CbmStar2019TofPar::Get4ChanToPadiChan => Index out of bound, "
152  << uChannelInFee << " vs " << GetNrOfChannelsPerFee()
153  << ", returning crazy value!";
154  return -1;
155  } // else of if( uChannelInFee < GetNrOfChannelsPerFee() )
156 }
157 Int_t CbmStar2019TofPar::PadiChanToGet4Chan(UInt_t uChannelInFee) {
158  if (uChannelInFee < GetNrOfChannelsPerFee())
159  return kuPaditoget4[uChannelInFee] - 1;
160  else {
161  LOG(fatal)
162  << "CbmStar2019TofPar::PadiChanToGet4Chan => Index out of bound, "
163  << uChannelInFee << " vs " << GetNrOfChannelsPerFee()
164  << ", returning crazy value!";
165  return -1;
166  } // else of if( uChannelInFee < GetNrOfChannelsPerFee() )
167 }
168 // -------------------------------------------------------------------------
170  if (gdpbv100::kuChipIdMergedEpoch == uElink)
171  return uElink;
172  else if (uElink < GetNrOfGet4PerGdpb())
173  return kuElinkToGet4[uElink % kuNbGet4PerGbtx]
174  + kuNbGet4PerGbtx * (uElink / kuNbGet4PerGbtx);
175  else {
176  LOG(fatal) << "CbmStar2019TofPar::ElinkIdxToGet4Idx => Index out of bound, "
177  << uElink << " vs " << GetNrOfGet4PerGdpb()
178  << ", returning crazy value!";
179  return -1;
180  } // else of if( uElink < kuNbGet4PerGbtx )
181 }
183  if (gdpbv100::kuChipIdMergedEpoch == uGet4)
184  return uGet4;
185  else if (uGet4 < GetNrOfGet4PerGdpb())
186  return kuGet4ToElink[uGet4 % kuNbGet4PerGbtx]
187  + kuNbGet4PerGbtx * (uGet4 / kuNbGet4PerGbtx);
188  else {
189  LOG(fatal) << "CbmStar2019TofPar::Get4IdxToElinkIdx => Index out of bound, "
190  << uGet4 << " vs " << GetNrOfGet4PerGdpb()
191  << ", returning crazy value!";
192  return -1;
193  } // else of if( uElink < kuNbGet4PerGbtx )
194 }
195 // -------------------------------------------------------------------------
197  if (uCode < GetNrOfPadiThrCodes())
198  return fvdPadiThrCodeToValue[uCode];
199  else {
200  LOG(error)
201  << "CbmStar2019TofPar::GetPadiThresholdVal => Code out of bound, "
202  << uCode << " vs " << GetNrOfPadiThrCodes() << ", returning crazy value!";
203  return 1e9;
204  } // else of if( uCode < GetNrOfPadiThrCodes() )
205 }
206 // -------------------------------------------------------------------------
207 Int_t CbmStar2019TofPar::GetNrOfRpc(UInt_t uGbtx) {
208  // safe to cast as anyway Nb of GBTx cannot exceed Int limits
209  if (static_cast<Int_t>(uGbtx) < fiNrOfGbtx)
210  return fiNrOfRpc[uGbtx];
211  else {
212  LOG(fatal) << "CbmStar2019TofPar::GetNrOfRpc => Index out of bound, "
213  << uGbtx << " vs " << fiNrOfGbtx << ", returning crazy value!";
214  return -1;
215  } // else of if( static_cast< Int_t >( uGbtx ) < fiNrOfGbtx )
216 }
217 Int_t CbmStar2019TofPar::GetRpcType(UInt_t uGbtx) {
218  // safe to cast as anyway Nb of GBTx cannot exceed Int limits
219  if (static_cast<Int_t>(uGbtx) < fiNrOfGbtx)
220  return fiRpcType[uGbtx];
221  else {
222  LOG(fatal) << "CbmStar2019TofPar::GetRpcType => Index out of bound, "
223  << uGbtx << " vs " << fiNrOfGbtx << ", returning crazy value!";
224  return -1;
225  } // else of if( static_cast< Int_t >( uGbtx ) < fiNrOfGbtx )
226 }
227 Int_t CbmStar2019TofPar::GetRpcSide(UInt_t uGbtx) {
228  // safe to cast as anyway Nb of GBTx cannot exceed Int limits
229  if (static_cast<Int_t>(uGbtx) < fiNrOfGbtx)
230  return fiRpcSide[uGbtx];
231  else {
232  LOG(fatal) << "CbmStar2019TofPar::GetRpcSide => Index out of bound, "
233  << uGbtx << " vs " << fiNrOfGbtx << ", returning crazy value!";
234  return -1;
235  } // else of if( static_cast< Int_t >( uGbtx ) < fiNrOfGbtx )
236 }
237 Int_t CbmStar2019TofPar::GetModuleId(UInt_t uGbtx) {
238  // safe to cast as anyway Nb of GBTx cannot exceed Int limits
239  if (static_cast<Int_t>(uGbtx) < fiNrOfGbtx)
240  return fiModuleId[uGbtx];
241  else {
242  LOG(fatal) << "CbmStar2019TofPar::GetModuleId => Index out of bound, "
243  << uGbtx << " vs " << fiNrOfGbtx << ", returning crazy value!";
244  return -1;
245  } // else of if( static_cast< Int_t >( uGbtx ) < fiNrOfGbtx )
246 }
247 // -------------------------------------------------------------------------
249  // safe to cast as anyway Nb of gDPB cannot exceed Int limits
250  if (static_cast<Int_t>(uGdpb) < fiNrOfGdpb)
251  return fdStarTriggerDeadtime[uGdpb];
252  else {
253  LOG(fatal)
254  << "CbmStar2019TofPar::GetStarTriggDeadtime => Index out of bound, "
255  << uGdpb << " vs " << fiNrOfGdpb << ", returning crazy value!";
256  return -1;
257  } // else of if( static_cast< Int_t >( uGdpb ) < fiNrOfGdpb )
258 }
259 Double_t CbmStar2019TofPar::GetStarTriggDelay(UInt_t uGdpb) {
260  // safe to cast as anyway Nb of gDPB cannot exceed Int limits
261  if (static_cast<Int_t>(uGdpb) < fiNrOfGdpb)
262  return fdStarTriggerDelay[uGdpb];
263  else {
264  LOG(fatal) << "CbmStar2019TofPar::GetStarTriggDelay => Index out of bound, "
265  << uGdpb << " vs " << fiNrOfGdpb << ", returning crazy value!";
266  return -1;
267  } // else of if( static_cast< Int_t >( uGdpb ) < fiNrOfGdpb )
268 }
270  // safe to cast as anyway Nb of gDPB cannot exceed Int limits
271  if (static_cast<Int_t>(uGdpb) < fiNrOfGdpb)
272  return fdStarTriggerWinSize[uGdpb];
273  else {
274  LOG(fatal)
275  << "CbmStar2019TofPar::GetStarTriggWinSize => Index out of bound, "
276  << uGdpb << " vs " << fiNrOfGdpb << ", returning crazy value!";
277  return -1;
278  } // else of if( static_cast< Int_t >( uGdpb ) < fiNrOfGdpb )
279 }
280 // -------------------------------------------------------------------------
281 
CbmStar2019TofPar::GetNrOfGet4PerGdpb
static constexpr UInt_t GetNrOfGet4PerGdpb()
Definition: CbmStar2019TofPar.h:59
CbmStar2019TofPar::GetNrOfRpc
Int_t GetNrOfRpc(UInt_t uGbtx)
Definition: CbmStar2019TofPar.cxx:207
CbmStar2019TofPar::putParams
void putParams(FairParamList *)
Definition: CbmStar2019TofPar.cxx:76
CbmStar2019TofPar::fvdPadiThrCodeToValue
std::vector< Double_t > fvdPadiThrCodeToValue
Definition: CbmStar2019TofPar.h:175
CbmStar2019TofPar::CbmStar2019TofPar
CbmStar2019TofPar(const char *name="CbmStar2019TofPar", const char *title="Tof unpacker parameters", const char *context="Default")
Definition: CbmStar2019TofPar.cxx:18
CbmStar2019TofPar::fdStarTriggerWinSize
TArrayD fdStarTriggerWinSize
Definition: CbmStar2019TofPar.h:202
CbmStar2019TofPar::fiRpcType
TArrayI fiRpcType
Definition: CbmStar2019TofPar.h:187
CbmStar2019TofPar::getParams
Bool_t getParams(FairParamList *)
Definition: CbmStar2019TofPar.cxx:97
CbmStar2019TofPar::GetNrOfPadiThrCodes
static constexpr UInt_t GetNrOfPadiThrCodes()
Definition: CbmStar2019TofPar.h:76
CbmStar2019TofPar::GetNrOfChannelsPerFee
static constexpr UInt_t GetNrOfChannelsPerFee()
Definition: CbmStar2019TofPar.h:51
CbmStar2019TofPar::clear
virtual void clear()
Definition: CbmStar2019TofPar.cxx:68
CbmStar2019TofPar::PadiChanToGet4Chan
Int_t PadiChanToGet4Chan(UInt_t uChannelInFee)
Definition: CbmStar2019TofPar.cxx:157
CbmStar2019TofPar::fiNrOfGbtx
Int_t fiNrOfGbtx
Definition: CbmStar2019TofPar.h:184
CbmStar2019TofPar::ElinkIdxToGet4Idx
Int_t ElinkIdxToGet4Idx(UInt_t uElink)
Definition: CbmStar2019TofPar.cxx:169
CbmStar2019TofPar::fiNrOfModule
Int_t fiNrOfModule
Definition: CbmStar2019TofPar.h:185
CbmStar2019TofPar::kuNbThrMeasPoints
static const uint32_t kuNbThrMeasPoints
Definition: CbmStar2019TofPar.h:158
CbmStar2019TofPar::Get4ChanToPadiChan
Int_t Get4ChanToPadiChan(UInt_t uChannelInFee)
Definition: CbmStar2019TofPar.cxx:146
CbmStar2019TofPar::kuElinkToGet4
const UInt_t kuElinkToGet4[kuNbGet4PerGbtx]
Map from PADI channel to GET4 channel.
Definition: CbmStar2019TofPar.h:145
CbmStar2019TofPar::GetStarTriggDelay
Double_t GetStarTriggDelay(UInt_t uGdpb)
Definition: CbmStar2019TofPar.cxx:259
CbmStar2019TofPar::~CbmStar2019TofPar
virtual ~CbmStar2019TofPar()
Definition: CbmStar2019TofPar.cxx:63
CbmStar2019TofPar::Get4IdxToElinkIdx
Int_t Get4IdxToElinkIdx(UInt_t uGet4)
Definition: CbmStar2019TofPar.cxx:182
CbmStar2019TofPar::GetModuleId
Int_t GetModuleId(UInt_t uGbtx)
Definition: CbmStar2019TofPar.cxx:237
gdpbv100::kuChipIdMergedEpoch
const uint32_t kuChipIdMergedEpoch
Definition: gDpbMessv100.h:51
CbmStar2019TofPar::fdStarTriggAllowedSpread
Double_t fdStarTriggAllowedSpread
Definition: CbmStar2019TofPar.h:196
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmStar2019TofPar::fiNrOfRpc
TArrayI fiNrOfRpc
Definition: CbmStar2019TofPar.h:186
CbmStar2019TofPar.h
CbmStar2019TofPar::GetStarTriggWinSize
Double_t GetStarTriggWinSize(UInt_t uGdpb)
Definition: CbmStar2019TofPar.cxx:269
CbmStar2019TofPar::GetRpcType
Int_t GetRpcType(UInt_t uGbtx)
Definition: CbmStar2019TofPar.cxx:217
CbmStar2019TofPar
Definition: CbmStar2019TofPar.h:18
gDpbMessv100.h
CbmStar2019TofPar::kuGet4topadi
const UInt_t kuGet4topadi[kuNbChannelsPerFee]
Mapping in Readout chain PCBs.
Definition: CbmStar2019TofPar.h:133
CbmStar2019TofPar::fiNrOfGdpb
Int_t fiNrOfGdpb
Definition: CbmStar2019TofPar.h:182
CbmStar2019TofPar::fiDebugMonitorMode
Int_t fiDebugMonitorMode
Definition: CbmStar2019TofPar.h:181
CbmStar2019TofPar::kuPaditoget4
const UInt_t kuPaditoget4[kuNbChannelsPerFee]
Map from GET4 channel to PADI channel.
Definition: CbmStar2019TofPar.h:140
CbmStar2019TofPar::fiGdpbIdArray
TArrayI fiGdpbIdArray
Definition: CbmStar2019TofPar.h:183
CbmStar2019TofPar::fiModuleId
TArrayI fiModuleId
Definition: CbmStar2019TofPar.h:190
CbmStar2019TofPar::kuThrMeasCode
const UInt_t kuThrMeasCode[kuNbThrMeasPoints]
Definition: CbmStar2019TofPar.h:159
CbmStar2019TofPar::kuNbGet4PerGbtx
static const uint32_t kuNbGet4PerGbtx
Definition: CbmStar2019TofPar.h:117
CbmStar2019TofPar::GetStarTriggDeadtime
Double_t GetStarTriggDeadtime(UInt_t uGdpb)
Definition: CbmStar2019TofPar.cxx:248
CbmStar2019TofPar::kuGet4ToElink
const UInt_t kuGet4ToElink[kuNbGet4PerGbtx]
Definition: CbmStar2019TofPar.h:149
CbmStar2019TofPar::fdSizeMsInNs
Double_t fdSizeMsInNs
Definition: CbmStar2019TofPar.h:193
CbmStar2019TofPar::kdThrMeasVal
const Double_t kdThrMeasVal[kuNbThrMeasPoints]
Definition: CbmStar2019TofPar.h:166
CbmStar2019TofPar::GetPadiThresholdVal
Double_t GetPadiThresholdVal(UInt_t uCode)
Definition: CbmStar2019TofPar.cxx:196
CbmStar2019TofPar::GetRpcSide
Int_t GetRpcSide(UInt_t uGbtx)
Definition: CbmStar2019TofPar.cxx:227
CbmStar2019TofPar::fiMonitorMode
Int_t fiMonitorMode
Variables.
Definition: CbmStar2019TofPar.h:179
CbmStar2019TofPar::fdStarTriggerDelay
TArrayD fdStarTriggerDelay
Definition: CbmStar2019TofPar.h:200
CbmStar2019TofPar::fdStarTriggerDeadtime
TArrayD fdStarTriggerDeadtime
Definition: CbmStar2019TofPar.h:198
CbmStar2019TofPar::fiRpcSide
TArrayI fiRpcSide
Definition: CbmStar2019TofPar.h:188