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