CbmRoot
CbmMcbm2018TofPar.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- CbmMcbm2018TofPar source file -----
3 // ----- Created 09/09/18 by P.-A. Loizeau -----
4 // -------------------------------------------------------------------------
5 
6 #include "CbmMcbm2018TofPar.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  , fiNrOfGdpb(-1)
24  , fiGdpbIdArray()
25  , fiNrOfFeesPerGdpb(-1)
26  , fiNrOfGet4PerFee(-1)
27  , fiNrOfChannelsPerGet4(-1)
28  , fiNrOfGbtx(-1)
29  , fiNrOfModule(-1)
30  , fiNrOfRpc()
31  , fiRpcType()
32  , fiRpcSide()
33  , fiModuleId()
34  , fiNbMsTot(0)
35  , fiNbMsOverlap(0)
36  , fdSizeMsInNs(0.0)
37  , fdStarTriggerDeadtime()
38  , fdStarTriggerDelay()
39  , fdStarTriggerWinSize()
40  , fdTsDeadtimePeriod(0.0) {
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 =
50  kuThrMeasCode[uPadiPoint + 1] - kuThrMeasCode[uPadiPoint];
51  Double_t dValStep =
52  (kdThrMeasVal[uPadiPoint + 1] - kdThrMeasVal[uPadiPoint]) / uNbSteps;
53  UInt_t uCode = kuThrMeasCode[uPadiPoint];
54  for (UInt_t uStep = 1; uStep < uNbSteps; ++uStep) {
55  uCode++;
56  fvdPadiThrCodeToValue[uCode] =
57  kdThrMeasVal[uPadiPoint] + dValStep * uStep;
58  } // for( UInt_t uStep = 1; uStep < uNbSteps; ++uStep)
59  } // if( uPadiPoint + 1 < kuNbThrMeasPoints )
60  } // for( UInt_t uPadiPoint = 0; uPadiPoint < kuNbThrMeasPoints; ++uPadiPoint )
61 }
62 // -------------------------------------------------------------------------
63 
64 
65 // ----- Destructor ----------------------------------------------------
67 // -------------------------------------------------------------------------
68 
69 
70 // ----- Public method clear -------------------------------------------
72  status = kFALSE;
73  resetInputVersions();
74 }
75 // -------------------------------------------------------------------------
76 
77 // -------------------------------------------------------------------------
78 
79 void CbmMcbm2018TofPar::putParams(FairParamList* l) {
80  if (!l) return;
81  l->add("NrOfGdpbs", fiNrOfGdpb);
82  l->add("GdpbIdArray", fiGdpbIdArray);
83  l->add("NrOfFeesPerGdpb", fiNrOfFeesPerGdpb);
84  l->add("NrOfGet4PerFee", fiNrOfGet4PerFee);
85  l->add("NrOfChannelsPerGet4", fiNrOfChannelsPerGet4);
86  l->add("NrOfGbtx", fiNrOfGbtx);
87  l->add("NrOfModule", fiNrOfModule);
88  l->add("NrOfRpcs", fiNrOfRpc);
89  l->add("RpcType", fiRpcType);
90  l->add("RpcSide", fiRpcSide);
91  l->add("ModuleId", fiModuleId);
92  l->add("NbMsTot", fiNbMsTot);
93  l->add("NbMsOverlap", fiNbMsOverlap);
94  l->add("SizeMsInNs", fdSizeMsInNs);
95  l->add("StarTriggerDeadtime", fdStarTriggerDeadtime);
96  l->add("StarTriggerDelay", fdStarTriggerDelay);
97  l->add("StarTriggerWinSize", fdStarTriggerWinSize);
98  l->add("TsDeadtimePeriod", fdTsDeadtimePeriod);
99 }
100 
101 //------------------------------------------------------
102 
103 Bool_t CbmMcbm2018TofPar::getParams(FairParamList* l) {
104 
105  if (!l) 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("NrOfFeesPerGdpb", &fiNrOfFeesPerGdpb)) return kFALSE;
113  if (!l->fill("NrOfGet4PerFee", &fiNrOfGet4PerFee)) return kFALSE;
114  if (!l->fill("NrOfChannelsPerGet4", &fiNrOfChannelsPerGet4)) return kFALSE;
115 
116  if (!l->fill("NrOfGbtx", &fiNrOfGbtx)) return kFALSE;
117 
118  if (!l->fill("NrOfModule", &fiNrOfModule)) return kFALSE;
119 
120  fiNrOfRpc.Set(fiNrOfGbtx);
121  if (!l->fill("NrOfRpc", &fiNrOfRpc)) return kFALSE;
122 
123  fiRpcType.Set(fiNrOfGbtx);
124  if (!l->fill("RpcType", &fiRpcType)) return kFALSE;
125 
126  fiRpcSide.Set(fiNrOfGbtx);
127  if (!l->fill("RpcSide", &fiRpcSide)) return kFALSE;
128 
129  fiModuleId.Set(fiNrOfGbtx);
130  if (!l->fill("ModuleId", &fiModuleId)) return kFALSE;
131 
132  if (!l->fill("NbMsTot", &fiNbMsTot)) return kFALSE;
133  if (!l->fill("NbMsOverlap", &fiNbMsOverlap)) return kFALSE;
134  if (!l->fill("SizeMsInNs", &fdSizeMsInNs)) return kFALSE;
135 
139  if (!l->fill("StarTriggerDeadtime", &fdStarTriggerDeadtime)) return kFALSE;
140  if (!l->fill("StarTriggerDelay", &fdStarTriggerDelay)) return kFALSE;
141  if (!l->fill("StarTriggerWinSize", &fdStarTriggerWinSize)) return kFALSE;
142  if (!l->fill("TsDeadtimePeriod", &fdTsDeadtimePeriod)) return kFALSE;
143 
144  return kTRUE;
145 }
146 // -------------------------------------------------------------------------
147 Int_t CbmMcbm2018TofPar::Get4ChanToPadiChan(UInt_t uChannelInFee) {
148  if (uChannelInFee < kuNbChannelsPerFee)
149  return kuGet4topadi[uChannelInFee];
150  else {
151  LOG(fatal)
152  << "CbmMcbm2018TofPar::Get4ChanToPadiChan => Index out of bound, "
153  << uChannelInFee << " vs "
154  << static_cast<const uint32_t>(kuNbChannelsPerFee)
155  << ", returning crazy value!";
156  return -1;
157  } // else of if( uChannelInFee < kuNbChannelsPerFee )
158 }
159 Int_t CbmMcbm2018TofPar::PadiChanToGet4Chan(UInt_t uChannelInFee) {
160  if (uChannelInFee < kuNbChannelsPerFee)
161  return kuPaditoget4[uChannelInFee];
162  else {
163  LOG(fatal)
164  << "CbmMcbm2018TofPar::PadiChanToGet4Chan => Index out of bound, "
165  << uChannelInFee << " vs "
166  << static_cast<const uint32_t>(kuNbChannelsPerFee)
167  << ", returning crazy value!";
168  return -1;
169  } // else of if( uChannelInFee < kuNbChannelsPerFee )
170 }
171 // -------------------------------------------------------------------------
173  if (gdpbv100::kuChipIdMergedEpoch == uElink)
174  return uElink;
175  else if (uElink < kuNbGet4PerGdpb)
176  return kuElinkToGet4[uElink % kuNbGet4PerGbtx]
177  + kuNbGet4PerGbtx * (uElink / kuNbGet4PerGbtx);
178  else {
179  LOG(fatal) << "CbmMcbm2018TofPar::ElinkIdxToGet4Idx => Index out of bound, "
180  << uElink << " vs "
181  << static_cast<const uint32_t>(kuNbGet4PerGdpb)
182  << ", returning crazy value!";
183  return -1;
184  } // else of if( uElink < kuNbGet4PerGbtx )
185 }
187  if (gdpbv100::kuChipIdMergedEpoch == uGet4)
188  return uGet4;
189  else if (uGet4 < kuNbGet4PerGdpb)
190  return kuGet4ToElink[uGet4 % kuNbGet4PerGbtx]
191  + kuNbGet4PerGbtx * (uGet4 / kuNbGet4PerGbtx);
192  else {
193  LOG(fatal) << "CbmMcbm2018TofPar::Get4IdxToElinkIdx => Index out of bound, "
194  << uGet4 << " vs "
195  << static_cast<const uint32_t>(kuNbGet4PerGdpb)
196  << ", returning crazy value!";
197  return -1;
198  } // else of if( uElink < kuNbGet4PerGbtx )
199 }
200 // -------------------------------------------------------------------------
202  if (uCode < GetNrOfPadiThrCodes())
203  return fvdPadiThrCodeToValue[uCode];
204  else {
205  LOG(error)
206  << "CbmStar2019TofPar::GetPadiThresholdVal => Code out of bound, "
207  << uCode << " vs " << GetNrOfPadiThrCodes() << ", returning crazy value!";
208  return 1e9;
209  } // else of if( uCode < GetNrOfPadiThrCodes() )
210 }
211 // -------------------------------------------------------------------------
212 
213 
CbmMcbm2018TofPar::PadiChanToGet4Chan
Int_t PadiChanToGet4Chan(UInt_t uChannelInFee)
Definition: CbmMcbm2018TofPar.cxx:159
CbmMcbm2018TofPar::fdStarTriggerDelay
TArrayD fdStarTriggerDelay
Definition: CbmMcbm2018TofPar.h:178
CbmMcbm2018TofPar::fiNrOfFeesPerGdpb
Int_t fiNrOfFeesPerGdpb
Definition: CbmMcbm2018TofPar.h:157
CbmMcbm2018TofPar::ElinkIdxToGet4Idx
Int_t ElinkIdxToGet4Idx(UInt_t uElink)
Definition: CbmMcbm2018TofPar.cxx:172
CbmMcbm2018TofPar::fvdPadiThrCodeToValue
std::vector< Double_t > fvdPadiThrCodeToValue
Definition: CbmMcbm2018TofPar.h:152
CbmMcbm2018TofPar::fdTsDeadtimePeriod
Double_t fdTsDeadtimePeriod
Definition: CbmMcbm2018TofPar.h:182
CbmMcbm2018TofPar.h
CbmMcbm2018TofPar::kdThrMeasVal
const Double_t kdThrMeasVal[kuNbThrMeasPoints]
Definition: CbmMcbm2018TofPar.h:143
CbmMcbm2018TofPar::kuThrMeasCode
const UInt_t kuThrMeasCode[kuNbThrMeasPoints]
Definition: CbmMcbm2018TofPar.h:136
CbmMcbm2018TofPar::fiModuleId
TArrayI fiModuleId
Definition: CbmMcbm2018TofPar.h:168
CbmMcbm2018TofPar::fiNrOfGdpb
Int_t fiNrOfGdpb
Definition: CbmMcbm2018TofPar.h:154
CbmMcbm2018TofPar::kuNbGet4PerGdpb
static const uint32_t kuNbGet4PerGdpb
Definition: CbmMcbm2018TofPar.h:110
CbmMcbm2018TofPar::fiNbMsTot
Int_t fiNbMsTot
Definition: CbmMcbm2018TofPar.h:170
CbmMcbm2018TofPar::fiGdpbIdArray
TArrayI fiGdpbIdArray
Definition: CbmMcbm2018TofPar.h:155
CbmMcbm2018TofPar::fdStarTriggerWinSize
TArrayD fdStarTriggerWinSize
Definition: CbmMcbm2018TofPar.h:180
CbmMcbm2018TofPar::fdStarTriggerDeadtime
TArrayD fdStarTriggerDeadtime
Definition: CbmMcbm2018TofPar.h:176
CbmMcbm2018TofPar::getParams
Bool_t getParams(FairParamList *)
Definition: CbmMcbm2018TofPar.cxx:103
CbmMcbm2018TofPar::clear
virtual void clear()
Definition: CbmMcbm2018TofPar.cxx:71
CbmMcbm2018TofPar::fdSizeMsInNs
Double_t fdSizeMsInNs
Definition: CbmMcbm2018TofPar.h:173
CbmMcbm2018TofPar::kuNbThrMeasPoints
static const uint32_t kuNbThrMeasPoints
Definition: CbmMcbm2018TofPar.h:135
CbmMcbm2018TofPar::kuGet4ToElink
const UInt_t kuGet4ToElink[kuNbGet4PerGbtx]
Definition: CbmMcbm2018TofPar.h:128
CbmMcbm2018TofPar::Get4IdxToElinkIdx
Int_t Get4IdxToElinkIdx(UInt_t uGet4)
Definition: CbmMcbm2018TofPar.cxx:186
CbmMcbm2018TofPar::fiNrOfChannelsPerGet4
Int_t fiNrOfChannelsPerGet4
Definition: CbmMcbm2018TofPar.h:160
CbmMcbm2018TofPar::fiNrOfGbtx
Int_t fiNrOfGbtx
Definition: CbmMcbm2018TofPar.h:162
gdpbv100::kuChipIdMergedEpoch
const uint32_t kuChipIdMergedEpoch
Definition: gDpbMessv100.h:51
CbmMcbm2018TofPar::fiNrOfGet4PerFee
Int_t fiNrOfGet4PerFee
Definition: CbmMcbm2018TofPar.h:159
CbmMcbm2018TofPar::kuNbChannelsPerFee
static const uint32_t kuNbChannelsPerFee
Definition: CbmMcbm2018TofPar.h:103
CbmMcbm2018TofPar::GetNrOfPadiThrCodes
static constexpr UInt_t GetNrOfPadiThrCodes()
Definition: CbmMcbm2018TofPar.h:44
CbmMcbm2018TofPar::kuGet4topadi
const UInt_t kuGet4topadi[kuNbChannelsPerFee]
Mapping in Readout chain PCBs.
Definition: CbmMcbm2018TofPar.h:114
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmMcbm2018TofPar::fiNrOfRpc
TArrayI fiNrOfRpc
Definition: CbmMcbm2018TofPar.h:164
CbmMcbm2018TofPar::fiNrOfModule
Int_t fiNrOfModule
Definition: CbmMcbm2018TofPar.h:163
CbmMcbm2018TofPar::fiRpcSide
TArrayI fiRpcSide
Definition: CbmMcbm2018TofPar.h:166
gDpbMessv100.h
CbmMcbm2018TofPar
Definition: CbmMcbm2018TofPar.h:18
CbmMcbm2018TofPar::CbmMcbm2018TofPar
CbmMcbm2018TofPar(const char *name="CbmMcbm2018TofPar", const char *title="Tof unpacker parameters", const char *context="Default")
Definition: CbmMcbm2018TofPar.cxx:18
CbmMcbm2018TofPar::~CbmMcbm2018TofPar
virtual ~CbmMcbm2018TofPar()
Definition: CbmMcbm2018TofPar.cxx:66
CbmMcbm2018TofPar::putParams
void putParams(FairParamList *)
Definition: CbmMcbm2018TofPar.cxx:79
CbmMcbm2018TofPar::Get4ChanToPadiChan
Int_t Get4ChanToPadiChan(UInt_t uChannelInFee)
Definition: CbmMcbm2018TofPar.cxx:147
CbmMcbm2018TofPar::kuNbGet4PerGbtx
static const uint32_t kuNbGet4PerGbtx
Definition: CbmMcbm2018TofPar.h:109
CbmMcbm2018TofPar::fiNbMsOverlap
Int_t fiNbMsOverlap
Definition: CbmMcbm2018TofPar.h:171
CbmMcbm2018TofPar::fiRpcType
TArrayI fiRpcType
Definition: CbmMcbm2018TofPar.h:165
CbmMcbm2018TofPar::kuPaditoget4
const UInt_t kuPaditoget4[kuNbChannelsPerFee]
Map from GET4 channel to PADI channel.
Definition: CbmMcbm2018TofPar.h:120
CbmMcbm2018TofPar::kuElinkToGet4
const UInt_t kuElinkToGet4[kuNbGet4PerGbtx]
Map from PADI channel to GET4 channel.
Definition: CbmMcbm2018TofPar.h:124
CbmMcbm2018TofPar::GetPadiThresholdVal
Double_t GetPadiThresholdVal(UInt_t uCode)
Definition: CbmMcbm2018TofPar.cxx:201