ATLAS Offline Software
Loading...
Searching...
No Matches
TRTToTCondAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "TRTToTCondAlg.h"
7#include "CoralBase/AttributeListSpecification.h"
8
9
10const std::vector<std::string> TRTToTCondAlg::m_dictNamesOldDB = {"resolution","resolution_e","para_long_corrRZ_MC",
11 "para_short_corrRZ_MC","para_end_corrRZ_MC","para_long_corrRZL_MC",
12 "para_short_corrRZL_MC","para_end_corrRZL_MC"};
13const std::vector<std::string> TRTToTCondAlg::m_dictNamesNewDB = {"para_end_corrRZLXe","para_end_corrRZ_Xe","para_end_mimicToXeXe",
14 "para_long_corrRZLXe","para_long_corrRZ_Xe","para_long_mimicToXeXe","para_short_corrRZLXe",
15 "para_short_corrRZ_Xe","para_short_mimicToXeXe","resolution_Xe","resolution_e_Xe","para_end_corrRZLAr",
16 "para_end_corrRZ_Ar","para_end_mimicToXeAr","para_long_corrRZLAr","para_long_corrRZ_Ar",
17 "para_long_mimicToXeAr","para_short_corrRZLAr","para_short_corrRZ_Ar","para_short_mimicToXeAr",
18 "resolution_Ar","resolution_e_Ar","para_end_corrRZLKr","para_end_corrRZ_Kr","para_end_mimicToXeKr",
19 "para_long_corrRZLKr","para_long_corrRZ_Kr","para_long_mimicToXeKr","para_short_corrRZLKr",
20 "para_short_corrRZ_Kr","para_short_mimicToXeKr","resolution_Kr","resolution_e_Kr",
21 "HitOccPar", "TrackOccPar0", "TrackOccPar0_noHT", "TrackOccPar1", "TrackOccPar1_noHT", "TrackOccPar2", "TrackOccPar2_noHT"};
22
23TRTToTCondAlg::TRTToTCondAlg(const std::string& name
24 , ISvcLocator* pSvcLocator )
25 : ::AthCondAlgorithm(name,pSvcLocator)
26{}
28
30{
31 // Read key
32 ATH_CHECK( m_VecReadKey.initialize() );
33 ATH_CHECK( m_ValReadKey.initialize() );
34
35 // Register write handle
36 ATH_CHECK( m_WriteKey.initialize() );
37
38 return StatusCode::SUCCESS;
39}
40
41StatusCode TRTToTCondAlg::execute(const EventContext& ctx) const
42{
43 ATH_MSG_DEBUG("execute " << name());
44
45 // ____________ Construct Write Cond Handle and check its validity ____________
46
48
49 // Do we have a valid Write Cond Handle for current time?
50 if(writeHandle.isValid()) {
51 ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
52 << ". In theory this should not be called, but may happen"
53 << " if multiple concurrent events are being processed out of order.");
54
55 return StatusCode::SUCCESS;
56 }
57
58
59
60 // ____________ Compute the Write Cond Object (Dedxcorrections) ____________
62 const CondAttrListVec* channel_values{*readVecHandle};
63 if(channel_values==nullptr) {
64 ATH_MSG_ERROR(" Problem reading TRT/Calib/ToT/ToTVectors cond object");
65 return StatusCode::FAILURE;
66 }
67
68 // ____________ Construct new Write Cond Object ____________
69 auto Dedxcorrection = std::make_unique<TRTDedxcorrection>();
70
71 ATH_CHECK( update1( *Dedxcorrection, channel_values ) );
72
74 const CondAttrListCollection* attrListColl{*readValHandle};
75 if(attrListColl==nullptr) {
76 ATH_MSG_ERROR(" Problem reading TRT/Calib/ToT/ToTValue cond object");
77 return StatusCode::FAILURE;
78 }
79 ATH_CHECK( update2( *Dedxcorrection, attrListColl ) );
80
81
82 //__________ Assign range of Dedxcorrection to that of the ReadHandle___________
83 EventIDRange rangeW;
84
85 if(!readVecHandle.range(rangeW)) {
86 ATH_MSG_ERROR("Failed to retrieve validity range for " << readVecHandle.key());
87 return StatusCode::FAILURE;
88 }
89
90 // Record CDO
91 if(writeHandle.record(rangeW,std::move(Dedxcorrection)).isFailure()) {
92 ATH_MSG_ERROR("Could not record " << writeHandle.key()
93 << " with EventRange " << rangeW
94 << " into Conditions Store");
95 return StatusCode::FAILURE;
96 }
97
98
99 return StatusCode::SUCCESS;
100}
101
103{
104 ATH_MSG_DEBUG("finalize " << name());
105 return StatusCode::SUCCESS;
106}
107
108StatusCode TRTToTCondAlg::update1( TRTDedxcorrection& Dedxcorrection, const CondAttrListVec* channel_values) const {
109 // Determine which version of DB constants to use based on the length
110 ATH_MSG_DEBUG("Size of channel_values[]="<<channel_values->size()<<"");
111 int dataBaseType = kNewDB;
112 if(channel_values->size()<19695) {
113 dataBaseType = kOldDB;
114 } else if (channel_values->size()>19695) {
115 dataBaseType = kNewDBOccCorr;
116 }
117 const std::vector<std::string>& dictNames = (dataBaseType==kOldDB) ? m_dictNamesOldDB : m_dictNamesNewDB;
118
119 std::map<std::string,std::vector<float> > resultDict;
120 // Read all vectors of values from DB entries and store by name in map
121 CondAttrListVec::const_iterator channel = channel_values->begin();
122 unsigned int channelIndex = 0;
123 std::vector<float> currentArrayValues = {};
124 for (; channel != channel_values->end(); ++channel) {
125 if (channelIndex != channel->first){
126 if(!currentArrayValues.empty()) resultDict[dictNames[channelIndex]] = currentArrayValues;
127 channelIndex = channel->first;
128 currentArrayValues.clear();
129 }
130 currentArrayValues.push_back(channel->second["array_value"].data<float>());
131 }
132 resultDict[dictNames[channelIndex]] = std::move(currentArrayValues);
133
134 // update dEdx corrections from dictionary depending on the DB version
135 if(dataBaseType==kNewDB or dataBaseType==kNewDBOccCorr) {
137 ATH_MSG_DEBUG ("update():: Reading new database is done!");
138 if (dataBaseType==kNewDBOccCorr) {
140 ATH_MSG_DEBUG ("update():: Reading new database with occupancy correction is done!");
141 }
142 return StatusCode::SUCCESS;
143 } else if(dataBaseType==kOldDB) {
144 ATH_MSG_WARNING ("update():: Old COOL database tag!");
146 ATH_MSG_DEBUG ("update():: Reading old database is done!");
147 return StatusCode::SUCCESS;
148 }
149 return StatusCode::FAILURE;
150}
151
152void TRTToTCondAlg::updateOccupancyCorrectionParameters(TRTDedxcorrection & Dedxcorrection, std::map<std::string,std::vector<float> > &result_dict) {
153 // fill occupancy calibration parameters
154 for (unsigned int ind=0; ind < TRTDedxcorrection::nParametersHitBaseddEdx; ++ind) {
155 Dedxcorrection.hitOccPar[ind]=result_dict["HitOccPar"][ind];
156 }
157 for (unsigned int ind=0; ind < TRTDedxcorrection::nParametersTrackBaseddEdx; ++ind) {
158 Dedxcorrection.trackOccPar0NoHt[ind]=result_dict["TrackOccPar0_noHT"][ind];
159 Dedxcorrection.trackOccPar1NoHt[ind]=result_dict["TrackOccPar1_noHT"][ind];
160 Dedxcorrection.trackOccPar2NoHt[ind]=result_dict["TrackOccPar2_noHT"][ind];
161
162 Dedxcorrection.trackOccPar0[ind]=result_dict["TrackOccPar0"][ind];
163 Dedxcorrection.trackOccPar1[ind]=result_dict["TrackOccPar1"][ind];
164 Dedxcorrection.trackOccPar2[ind]=result_dict["TrackOccPar2"][ind];
165 }
166}
167
168void TRTToTCondAlg::updateNewDBParameters(TRTDedxcorrection & Dedxcorrection, std::map<std::string,std::vector<float> > &result_dict) {
169 // fill Xenon +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
170 for (unsigned int ind=0; ind < 4; ++ind) {
171 Dedxcorrection.resolution[0][ind]=result_dict["resolution_Xe"][ind];
172 }
173
174 for (unsigned int ind=0; ind < 4; ++ind) {
175 Dedxcorrection.resolutionElectron[0][ind]=result_dict["resolution_e_Xe"][ind];
176 }
177
178 for (unsigned int ind=0; ind < 3240; ++ind) {
179 Dedxcorrection.paraLongCorrRZMC[0][ind]=result_dict["para_long_corrRZ_Xe"][ind];
180 }
181
182 for (unsigned int ind=0; ind < 216; ++ind) {
183 Dedxcorrection.paraShortCorrRZMC[0][ind]=result_dict["para_short_corrRZ_Xe"][ind];
184 }
185
186 for (unsigned int ind=0; ind < 630; ++ind) {
187 Dedxcorrection.paraLongCorrRZDivideByLengthMC[0][ind]=result_dict["para_long_corrRZLXe"][ind];
188 }
189
190 for (unsigned int ind=0; ind < 63; ++ind) {
191 Dedxcorrection.paraShortCorrRZDivideByLengthMC[0][ind]=result_dict["para_short_corrRZLXe"][ind];
192 }
193
194 for (unsigned int ind=0; ind < 252; ++ind) {
195 Dedxcorrection.paraEndCorrRZDivideByLengthMC[0][ind]=result_dict["para_end_corrRZLXe"][ind];
196 }
197
198 for (unsigned int ind=0; ind < 3240; ++ind) {
199 Dedxcorrection.paraLongCorrRZ[0][ind]=result_dict["para_long_corrRZ_Xe"][ind];
200 }
201
202 for (unsigned int ind=0; ind < 216; ++ind) {
203 Dedxcorrection.paraShortCorrRZ[0][ind]=result_dict["para_short_corrRZ_Xe"][ind];
204 }
205
206 for (unsigned int ind=0; ind < 630; ++ind) {
207 Dedxcorrection.paraLongCorrRZDivideByLengthDATA[0][ind]=result_dict["para_long_corrRZLXe"][ind];
208 }
209
210 for (unsigned int ind=0; ind < 63; ++ind) {
211 Dedxcorrection.paraShortCorrRZDivideByLengthDATA[0][ind]=result_dict["para_short_corrRZLXe"][ind];
212 }
213
214 for (unsigned int ind=0; ind < 252; ++ind) {
215 Dedxcorrection.paraEndCorrRZDivideByLengthDATA[0][ind]=result_dict["para_end_corrRZLXe"][ind];
216 }
217
218 for (unsigned int ind=0; ind < 336; ++ind) {
219 Dedxcorrection.paraEndCorrRZ[0][ind]=result_dict["para_end_corrRZ_Xe"][ind];
220 }
221
222 for (unsigned int ind=0; ind < 336; ++ind) {
223 Dedxcorrection.paraEndCorrRZMC[0][ind]=result_dict["para_end_corrRZ_Xe"][ind];
224 }
225
226
227
228 for (unsigned int ind=0; ind < 560; ++ind) {
229 Dedxcorrection.paraEndMimicToXeDATA[0][ind]=result_dict["para_end_mimicToXeXe"][ind];
230 }
231 for (unsigned int ind=0; ind < 560; ++ind) {
232 Dedxcorrection.paraEndMimicToXeMC[0][ind]=result_dict["para_end_mimicToXeXe"][ind];
233 }
234 for (unsigned int ind=0; ind < 180; ++ind) {
235 Dedxcorrection.paraShortMimicToXeDATA[0][ind]=result_dict["para_short_mimicToXeXe"][ind];
236 }
237 for (unsigned int ind=0; ind < 180; ++ind) {
238 Dedxcorrection.paraShortMimicToXeMC[0][ind]=result_dict["para_short_mimicToXeXe"][ind];
239 }
240 for (unsigned int ind=0; ind < 1080; ++ind) {
241 Dedxcorrection.paraLongMimicToXeDATA[0][ind]=result_dict["para_long_mimicToXeXe"][ind];
242 }
243 for (unsigned int ind=0; ind < 1080; ++ind) {
244 Dedxcorrection.paraLongMimicToXeMC[0][ind]=result_dict["para_long_mimicToXeXe"][ind];
245 }
246
247 // fill Argon +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
248 for (unsigned int ind=0; ind < 4; ++ind) {
249 Dedxcorrection.resolution[1][ind]=result_dict["resolution_Ar"][ind];
250 }
251
252 for (unsigned int ind=0; ind < 4; ++ind) {
253 Dedxcorrection.resolutionElectron[1][ind]=result_dict["resolution_e_Ar"][ind];
254 }
255
256 for (unsigned int ind=0; ind < 3240; ++ind) {
257 Dedxcorrection.paraLongCorrRZMC[1][ind]=result_dict["para_long_corrRZ_Ar"][ind];
258 }
259
260 for (unsigned int ind=0; ind < 216; ++ind) {
261 Dedxcorrection.paraShortCorrRZMC[1][ind]=result_dict["para_short_corrRZ_Ar"][ind];
262 }
263
264 for (unsigned int ind=0; ind < 630; ++ind) {
265 Dedxcorrection.paraLongCorrRZDivideByLengthMC[1][ind]=result_dict["para_long_corrRZLAr"][ind];
266 }
267
268 for (unsigned int ind=0; ind < 63; ++ind) {
269 Dedxcorrection.paraShortCorrRZDivideByLengthMC[1][ind]=result_dict["para_short_corrRZLAr"][ind];
270 }
271
272 for (unsigned int ind=0; ind < 252; ++ind) {
273 Dedxcorrection.paraEndCorrRZDivideByLengthMC[1][ind]=result_dict["para_end_corrRZLAr"][ind];
274 }
275
276 for (unsigned int ind=0; ind < 3240; ++ind) {
277 Dedxcorrection.paraLongCorrRZ[1][ind]=result_dict["para_long_corrRZ_Ar"][ind];
278 }
279
280 for (unsigned int ind=0; ind < 216; ++ind) {
281 Dedxcorrection.paraShortCorrRZ[1][ind]=result_dict["para_short_corrRZ_Ar"][ind];
282 }
283
284 for (unsigned int ind=0; ind < 630; ++ind) {
285 Dedxcorrection.paraLongCorrRZDivideByLengthDATA[1][ind]=result_dict["para_long_corrRZLAr"][ind];
286 }
287
288 for (unsigned int ind=0; ind < 63; ++ind) {
289 Dedxcorrection.paraShortCorrRZDivideByLengthDATA[1][ind]=result_dict["para_short_corrRZLAr"][ind];
290 }
291
292 for (unsigned int ind=0; ind < 252; ++ind) {
293 Dedxcorrection.paraEndCorrRZDivideByLengthDATA[1][ind]=result_dict["para_end_corrRZLAr"][ind];
294 }
295
296 for (unsigned int ind=0; ind < 336; ++ind) {
297 Dedxcorrection.paraEndCorrRZ[1][ind]=result_dict["para_end_corrRZ_Ar"][ind];
298 }
299
300 for (unsigned int ind=0; ind < 336; ++ind) {
301 Dedxcorrection.paraEndCorrRZMC[1][ind]=result_dict["para_end_corrRZ_Ar"][ind];
302 }
303
304
305
306 for (unsigned int ind=0; ind < 560; ++ind) {
307 Dedxcorrection.paraEndMimicToXeDATA[1][ind]=result_dict["para_end_mimicToXeAr"][ind];
308 }
309 for (unsigned int ind=0; ind < 560; ++ind) {
310 Dedxcorrection.paraEndMimicToXeMC[1][ind]=result_dict["para_end_mimicToXeAr"][ind];
311 }
312 for (unsigned int ind=0; ind < 180; ++ind) {
313 Dedxcorrection.paraShortMimicToXeDATA[1][ind]=result_dict["para_short_mimicToXeAr"][ind];
314 }
315 for (unsigned int ind=0; ind < 180; ++ind) {
316 Dedxcorrection.paraShortMimicToXeMC[1][ind]=result_dict["para_short_mimicToXeAr"][ind];
317 }
318 for (unsigned int ind=0; ind < 1080; ++ind) {
319 Dedxcorrection.paraLongMimicToXeDATA[1][ind]=result_dict["para_long_mimicToXeAr"][ind];
320 }
321 for (unsigned int ind=0; ind < 1080; ++ind) {
322 Dedxcorrection.paraLongMimicToXeMC[1][ind]=result_dict["para_long_mimicToXeAr"][ind];
323 }
324
325 // fill Krypton +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
326 for (unsigned int ind=0; ind < 4; ++ind) {
327 Dedxcorrection.resolution[2][ind]=result_dict["resolution_Kr"][ind];
328 }
329
330 for (unsigned int ind=0; ind < 4; ++ind) {
331 Dedxcorrection.resolutionElectron[2][ind]=result_dict["resolution_e_Kr"][ind];
332 }
333
334 for (unsigned int ind=0; ind < 3240; ++ind) {
335 Dedxcorrection.paraLongCorrRZMC[2][ind]=result_dict["para_long_corrRZ_Kr"][ind];
336 }
337
338 for (unsigned int ind=0; ind < 216; ++ind) {
339 Dedxcorrection.paraShortCorrRZMC[2][ind]=result_dict["para_short_corrRZ_Kr"][ind];
340 }
341
342 for (unsigned int ind=0; ind < 630; ++ind) {
343 Dedxcorrection.paraLongCorrRZDivideByLengthMC[2][ind]=result_dict["para_long_corrRZLKr"][ind];
344 }
345
346 for (unsigned int ind=0; ind < 63; ++ind) {
347 Dedxcorrection.paraShortCorrRZDivideByLengthMC[2][ind]=result_dict["para_short_corrRZLKr"][ind];
348 }
349
350 for (unsigned int ind=0; ind < 252; ++ind) {
351 Dedxcorrection.paraEndCorrRZDivideByLengthMC[2][ind]=result_dict["para_end_corrRZLKr"][ind];
352 }
353
354 for (unsigned int ind=0; ind < 3240; ++ind) {
355 Dedxcorrection.paraLongCorrRZ[2][ind]=result_dict["para_long_corrRZ_Kr"][ind];
356 }
357
358 for (unsigned int ind=0; ind < 216; ++ind) {
359 Dedxcorrection.paraShortCorrRZ[2][ind]=result_dict["para_short_corrRZ_Kr"][ind];
360 }
361
362 for (unsigned int ind=0; ind < 630; ++ind) {
363 Dedxcorrection.paraLongCorrRZDivideByLengthDATA[2][ind]=result_dict["para_long_corrRZLKr"][ind];
364 }
365
366 for (unsigned int ind=0; ind < 63; ++ind) {
367 Dedxcorrection.paraShortCorrRZDivideByLengthDATA[2][ind]=result_dict["para_short_corrRZLKr"][ind];
368 }
369
370 for (unsigned int ind=0; ind < 252; ++ind) {
371 Dedxcorrection.paraEndCorrRZDivideByLengthDATA[2][ind]=result_dict["para_end_corrRZLKr"][ind];
372 }
373
374 for (unsigned int ind=0; ind < 336; ++ind) {
375 Dedxcorrection.paraEndCorrRZ[2][ind]=result_dict["para_end_corrRZ_Kr"][ind];
376 }
377
378 for (unsigned int ind=0; ind < 336; ++ind) {
379 Dedxcorrection.paraEndCorrRZMC[2][ind]=result_dict["para_end_corrRZ_Kr"][ind];
380 }
381
382
383
384 for (unsigned int ind=0; ind < 560; ++ind) {
385 Dedxcorrection.paraEndMimicToXeDATA[2][ind]=result_dict["para_end_mimicToXeKr"][ind];
386 }
387 for (unsigned int ind=0; ind < 560; ++ind) {
388 Dedxcorrection.paraEndMimicToXeMC[2][ind]=result_dict["para_end_mimicToXeKr"][ind];
389 }
390 for (unsigned int ind=0; ind < 180; ++ind) {
391 Dedxcorrection.paraShortMimicToXeDATA[2][ind]=result_dict["para_short_mimicToXeKr"][ind];
392 }
393 for (unsigned int ind=0; ind < 180; ++ind) {
394 Dedxcorrection.paraShortMimicToXeMC[2][ind]=result_dict["para_short_mimicToXeKr"][ind];
395 }
396 for (unsigned int ind=0; ind < 1080; ++ind) {
397 Dedxcorrection.paraLongMimicToXeDATA[2][ind]=result_dict["para_long_mimicToXeKr"][ind];
398 }
399 for (unsigned int ind=0; ind < 1080; ++ind) {
400 Dedxcorrection.paraLongMimicToXeMC[2][ind]=result_dict["para_long_mimicToXeKr"][ind];
401 }
402}
403
404
405
406void TRTToTCondAlg::updateOldDBParameters(TRTDedxcorrection & Dedxcorrection, std::map<std::string,std::vector<float> > &result_dict) {
407 for(int gasType = 0; gasType<3; gasType++) { // loop over gas types
408 for (unsigned int ind=0; ind < 4; ++ind) {
409 Dedxcorrection.resolution[gasType][ind]=result_dict["resolution"][ind];
410 }
411
412 for (unsigned int ind=0; ind < 4; ++ind) {
413 Dedxcorrection.resolutionElectron[gasType][ind]=result_dict["resolution_e"][ind];
414 }
415
416 for (unsigned int ind=0; ind < 3240; ++ind) {
417 Dedxcorrection.paraLongCorrRZMC[gasType][ind]=result_dict["para_long_corrRZ_MC"][ind];
418 }
419
420 for (unsigned int ind=0; ind < 216; ++ind) {
421 Dedxcorrection.paraShortCorrRZMC[gasType][ind]=result_dict["para_short_corrRZ_MC"][ind];
422 }
423
424 for (unsigned int ind=0; ind < 630; ++ind) {
425 Dedxcorrection.paraLongCorrRZDivideByLengthMC[gasType][ind]=result_dict["para_long_corrRZL_MC"][ind];
426 }
427
428 for (unsigned int ind=0; ind < 63; ++ind) {
429 Dedxcorrection.paraShortCorrRZDivideByLengthMC[gasType][ind]=result_dict["para_short_corrRZL_MC"][ind];
430 }
431
432 for (unsigned int ind=0; ind < 252; ++ind) {
433 Dedxcorrection.paraEndCorrRZDivideByLengthMC[gasType][ind]=result_dict["para_end_corrRZL_MC"][ind];
434 }
435
436 for (unsigned int ind=0; ind < 3240; ++ind) {
437 Dedxcorrection.paraLongCorrRZ[gasType][ind]=result_dict["para_long_corrRZ_MC"][ind];
438 }
439
440 for (unsigned int ind=0; ind < 216; ++ind) {
441 Dedxcorrection.paraShortCorrRZ[gasType][ind]=result_dict["para_short_corrRZ_MC"][ind];
442 }
443
444 for (unsigned int ind=0; ind < 630; ++ind) {
445 Dedxcorrection.paraLongCorrRZDivideByLengthDATA[gasType][ind]=result_dict["para_long_corrRZL_MC"][ind];
446 }
447
448 for (unsigned int ind=0; ind < 63; ++ind) {
449 Dedxcorrection.paraShortCorrRZDivideByLengthDATA[gasType][ind]=result_dict["para_short_corrRZL_MC"][ind];
450 }
451
452 for (unsigned int ind=0; ind < 252; ++ind) {
453 Dedxcorrection.paraEndCorrRZDivideByLengthDATA[gasType][ind]=result_dict["para_end_corrRZL_MC"][ind];
454 }
455
456 for (unsigned int ind=0; ind < 336; ++ind) {
457 Dedxcorrection.paraEndCorrRZ[gasType][ind]=result_dict["para_end_corrRZ_MC"][ind];
458 }
459
460 for (unsigned int ind=0; ind < 336; ++ind) {
461 Dedxcorrection.paraEndCorrRZMC[gasType][ind]=result_dict["para_end_corrRZ_MC"][ind];
462 }
463
464 // Setting aditional corrections
465 for (unsigned int ind=0; ind < 560; ++ind) {
466 Dedxcorrection.paraEndMimicToXeMC[gasType][ind] = 1.;
467 Dedxcorrection.paraEndMimicToXeDATA[gasType][ind] = 1.;
468 }
469
470 for (unsigned int ind=0; ind < 180; ++ind) {
471 Dedxcorrection.paraShortMimicToXeMC[gasType][ind] = 1.;
472 Dedxcorrection.paraShortMimicToXeDATA[gasType][ind] = 1.;
473 }
474
475 for (unsigned int ind=0; ind < 1080; ++ind) {
476 Dedxcorrection.paraLongMimicToXeMC[gasType][ind] = 1.;
477 Dedxcorrection.paraLongMimicToXeDATA[gasType][ind] = 1.;
478 }
479 }
480}
481
483
484 int dataBaseType = kNewDB;
485 if(attrListColl->size() < 2) dataBaseType = kOldDB;
486
487 CondAttrListCollection::const_iterator first = attrListColl->begin();
488 CondAttrListCollection::const_iterator last = attrListColl->end();
489
490 if(dataBaseType==kNewDB) {
491 for (int index=0; first != last; ++first,++index) {
492 const coral::AttributeList& attrList = (*first).second;
493 Dedxcorrection.paraDivideByLengthDedxP1[index] = attrList["paraL_dEdx_p1"].data<float>();
494 Dedxcorrection.paraDivideByLengthDedxP2[index] = attrList["paraL_dEdx_p2"].data<float>();
495 Dedxcorrection.paraDivideByLengthDedxP3[index] = attrList["paraL_dEdx_p3"].data<float>();
496 Dedxcorrection.paraDivideByLengthDedxP4[index] = attrList["paraL_dEdx_p4"].data<float>();
497 Dedxcorrection.paraDivideByLengthDedxP5[index] = attrList["paraL_dEdx_p5"].data<float>();
498
499 Dedxcorrection.paraDedxP1[index] = attrList["para_dEdx_p1"].data<float>();
500 Dedxcorrection.paraDedxP2[index] = attrList["para_dEdx_p2"].data<float>();
501 Dedxcorrection.paraDedxP3[index] = attrList["para_dEdx_p3"].data<float>();
502 Dedxcorrection.paraDedxP4[index] = attrList["para_dEdx_p4"].data<float>();
503 Dedxcorrection.paraDedxP5[index] = attrList["para_dEdx_p5"].data<float>();
504
505 Dedxcorrection.normOffsetData[index] = attrList["norm_offset_data"].data<float>();
506 Dedxcorrection.normSlopeTot[index] = attrList["norm_slope_tot"].data<float>();
507 Dedxcorrection.normSlopeTotDivideByLength[index] = attrList["norm_slope_totl"].data<float>();
508 Dedxcorrection.normOffsetTot[index] = attrList["norm_offset_tot"].data<float>();
509 Dedxcorrection.normOffsetTotDivideByLength[index] = attrList["norm_offset_totl"].data<float>();
510 Dedxcorrection.normNzero[index]=attrList["norm_nzero"].data<int>();
511 }
512 } else {
513 ATH_MSG_WARNING ("update2():: Old COOL database tag!");
514 // return update2_Old();
515 for (; first != last; ++first) {
516 const coral::AttributeList& attrList = (*first).second;
517 for(int gasType=0; gasType<3; gasType++) {
518 Dedxcorrection.paraDivideByLengthDedxP1[gasType] = attrList["paraL_dEdx_p1"].data<float>();
519 Dedxcorrection.paraDivideByLengthDedxP2[gasType] = attrList["paraL_dEdx_p2"].data<float>();
520 Dedxcorrection.paraDivideByLengthDedxP3[gasType] = attrList["paraL_dEdx_p3"].data<float>();
521 Dedxcorrection.paraDivideByLengthDedxP4[gasType] = attrList["paraL_dEdx_p4"].data<float>();
522 Dedxcorrection.paraDivideByLengthDedxP5[gasType] = attrList["paraL_dEdx_p5"].data<float>();
523
524 Dedxcorrection.paraDedxP1[gasType] = attrList["para_dEdx_p1"].data<float>();
525 Dedxcorrection.paraDedxP2[gasType] = attrList["para_dEdx_p2"].data<float>();
526 Dedxcorrection.paraDedxP3[gasType] = attrList["para_dEdx_p3"].data<float>();
527 Dedxcorrection.paraDedxP4[gasType] = attrList["para_dEdx_p4"].data<float>();
528 Dedxcorrection.paraDedxP5[gasType] = attrList["para_dEdx_p5"].data<float>();
529
530 Dedxcorrection.normOffsetData[gasType] = attrList["norm_offset_data"].data<float>();
531 Dedxcorrection.normSlopeTot[gasType] = attrList["norm_slope_tot"].data<float>();
532 Dedxcorrection.normSlopeTotDivideByLength[gasType] = attrList["norm_slope_totl"].data<float>();
533 Dedxcorrection.normOffsetTot[gasType] = attrList["norm_offset_tot"].data<float>();
534 Dedxcorrection.normOffsetTotDivideByLength[gasType] = attrList["norm_offset_totl"].data<float>();
535 Dedxcorrection.normNzero[gasType]=attrList["norm_nzero"].data<int>();
536 }
537 }
538 }
539
540 return StatusCode::SUCCESS;
541}
542
543
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Base class for conditions algorithms.
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
size_type size() const
number of Chan/AttributeList pairs
ChanAttrListMap::const_iterator const_iterator
AttrListVec::const_iterator const_iterator
const_iterator end() const
const_iterator begin() const
size_type size() const
bool range(EventIDRange &r)
const std::string & key() const
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
static void updateOccupancyCorrectionParameters(TRTDedxcorrection &Dedxcorrection, std::map< std::string, std::vector< float > > &result_dict)
StatusCode update2(TRTDedxcorrection &Dedxcorrection, const CondAttrListCollection *attrListColl) const
static const std::vector< std::string > m_dictNamesNewDB
SG::ReadCondHandleKey< CondAttrListCollection > m_ValReadKey
virtual StatusCode finalize() override
static const std::vector< std::string > m_dictNamesOldDB
TRTToTCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode update1(TRTDedxcorrection &Dedxcorrection, const CondAttrListVec *channel_values) const
SG::ReadCondHandleKey< CondAttrListVec > m_VecReadKey
virtual ~TRTToTCondAlg() override
static void updateNewDBParameters(TRTDedxcorrection &Dedxcorrection, std::map< std::string, std::vector< float > > &result_dict)
virtual StatusCode initialize() override
virtual StatusCode execute(const EventContext &ctx) const override
static void updateOldDBParameters(TRTDedxcorrection &Dedxcollection, std::map< std::string, std::vector< float > > &result_dict)
SG::WriteCondHandleKey< TRTDedxcorrection > m_WriteKey
Definition index.py:1
static constexpr int nParametersTrackBaseddEdx
static constexpr int nParametersHitBaseddEdx