ATLAS Offline Software
Loading...
Searching...
No Matches
NswCalibDbAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include "TTree.h"
8#include "TFile.h"
10#include "CoralBase/Blob.h"
18#include "GeoModelKernel/throwExcept.h"
19
20#include<ctime>
21
22// Initialize
23StatusCode
25
26 // retrievals
27 ATH_MSG_DEBUG( "initializing " << name() );
28 ATH_CHECK(m_condSvc .retrieve());
29 ATH_CHECK(m_idHelperSvc.retrieve());
30
31 // initialize read keys
44 m_loadMmT0Data = m_loadMmT0Data && m_idHelperSvc->hasMM() && (!m_mmT0FilePath.empty() || !m_readKey_mm_t0.empty());
45 m_loadsTgcT0Data = m_loadsTgcT0Data && m_idHelperSvc->hasSTGC() && (!m_stgcT0FilePath.empty() || !m_readKey_stgc_t0.empty()) ;
46
49
50 // write key for time/charge data
51 ATH_CHECK(m_writeKey_tdopdo.initialize());
52
53 // write key for threshold data
55
57
58 return StatusCode::SUCCESS;
59}
60
61
62// execute
63StatusCode
64NswCalibDbAlg::execute(const EventContext& ctx) const {
65
66 ATH_MSG_DEBUG( "execute " << name() );
67
68 if(processTdoPdoData(ctx).isFailure()) return StatusCode::FAILURE;
69 if(processThrData (ctx).isFailure()) return StatusCode::FAILURE;
71
72 return StatusCode::SUCCESS;
73
74}
75
76// processTdoPdoData
77StatusCode
78NswCalibDbAlg::processTdoPdoData(const EventContext& ctx) const {
79
80 // set up write handles for time/charge data
82 if (wrHdl.isValid()) {
83 ATH_MSG_DEBUG("CondHandle " << wrHdl.fullKey() << " is already valid."
84 << " In theory this should not be called, but may happen"
85 << " if multiple concurrent events are being processed out of order.");
86 return StatusCode::SUCCESS;
87 }
88 ATH_MSG_DEBUG("Range of time/charge output is " << wrHdl.getRange());
89 std::unique_ptr<NswCalibDbTimeChargeData> wrCdo{std::make_unique<NswCalibDbTimeChargeData>(m_idHelperSvc.get())};
90
91 // MM
92 if(!m_readKey_mm_sidea_tdo.empty()) {
93 ATH_CHECK(loadTimeChargeData(ctx, m_readKey_mm_sidea_tdo , TimeChargeTech::MM , TimeChargeType::TDO, wrHdl, wrCdo.get()));
94 }
95 if(!m_readKey_mm_sidec_tdo.empty()) {
96 ATH_CHECK(loadTimeChargeData(ctx, m_readKey_mm_sidec_tdo , TimeChargeTech::MM , TimeChargeType::TDO, wrHdl, wrCdo.get()));
97 }
98 if(!m_readKey_mm_sidea_pdo.empty()) {
99 ATH_CHECK(loadTimeChargeData(ctx, m_readKey_mm_sidea_pdo , TimeChargeTech::MM , TimeChargeType::PDO, wrHdl, wrCdo.get()));
100 }
101 if(!m_readKey_mm_sidec_pdo.empty()) {
102 ATH_CHECK(loadTimeChargeData(ctx, m_readKey_mm_sidec_pdo , TimeChargeTech::MM , TimeChargeType::PDO, wrHdl, wrCdo.get()));
103 }
104
105 // sTGC
106 if(!m_readKey_stgc_sidea_tdo.empty()) {
107 ATH_CHECK(loadTimeChargeData(ctx, m_readKey_stgc_sidea_tdo, TimeChargeTech::STGC, TimeChargeType::TDO, wrHdl, wrCdo.get()));
108 }
109 if(!m_readKey_stgc_sidec_tdo.empty()) {
110 ATH_CHECK(loadTimeChargeData(ctx, m_readKey_stgc_sidec_tdo, TimeChargeTech::STGC, TimeChargeType::TDO, wrHdl, wrCdo.get()));
111 }
112 if(!m_readKey_stgc_sidea_pdo.empty()) {
113 ATH_CHECK(loadTimeChargeData(ctx, m_readKey_stgc_sidea_pdo, TimeChargeTech::STGC, TimeChargeType::PDO, wrHdl, wrCdo.get()));
114 }
115 if(!m_readKey_stgc_sidec_pdo.empty()) {
116 ATH_CHECK(loadTimeChargeData(ctx, m_readKey_stgc_sidec_pdo, TimeChargeTech::STGC, TimeChargeType::PDO, wrHdl, wrCdo.get()));
117 }
118
119 // insert/write data for time/charge data
120 if (wrHdl.record(std::move(wrCdo)).isFailure()) {
121 ATH_MSG_FATAL("Could not record " << wrHdl.key()
122 << " with EventRange " << wrHdl.getRange()
123 << " into Conditions Store");
124 return StatusCode::FAILURE;
125 }
126 ATH_MSG_DEBUG("Recorded new " << wrHdl.key() << " with range " << wrHdl.getRange() << " into Conditions Store");
127
128 return StatusCode::SUCCESS; // nothing to do
129
130}
131
132
133// processThrData
134StatusCode
135NswCalibDbAlg::processThrData(const EventContext& ctx) const {
136
137 if(m_isData || !m_processThresholds) return StatusCode::SUCCESS; // nothing to do
138
139 // set up write handles for threshold data
141 if (wrHdl.isValid()) {
142 ATH_MSG_DEBUG("CondHandle " << wrHdl.fullKey() << " is already valid."
143 << " In theory this should not be called, but may happen"
144 << " if multiple concurrent events are being processed out of order.");
145 return StatusCode::SUCCESS;
146 }
147 ATH_MSG_DEBUG("Range of threshold output is " << wrHdl.getRange());
148 std::unique_ptr<NswCalibDbThresholdData> wrCdo{std::make_unique<NswCalibDbThresholdData>(m_idHelperSvc.get())};
149
150 if(!m_readKey_mm_sidea_thr.empty()) {
151 ATH_CHECK(loadThresholdData(ctx, m_readKey_mm_sidea_thr , ThresholdTech::MM , wrHdl, wrCdo.get()));
152 }
153 if(!m_readKey_mm_sidec_thr.empty()) {
154 ATH_CHECK(loadThresholdData(ctx, m_readKey_mm_sidec_thr , ThresholdTech::MM , wrHdl, wrCdo.get()));
155 }
156 if(!m_readKey_stgc_sidea_thr.empty()) {
157 ATH_CHECK(loadThresholdData(ctx, m_readKey_stgc_sidea_thr, ThresholdTech::STGC, wrHdl, wrCdo.get()));
158 }
159 if(!m_readKey_stgc_sidec_thr.empty()) {
160 ATH_CHECK(loadThresholdData(ctx, m_readKey_stgc_sidec_thr, ThresholdTech::STGC, wrHdl, wrCdo.get()));
161 }
162
163 // insert/write data for threshold data
164 if (wrHdl.record(std::move(wrCdo)).isFailure()) {
165 ATH_MSG_FATAL("Could not record " << wrHdl.key()
166 << " with EventRange " << wrHdl.getRange()
167 << " into Conditions Store");
168 return StatusCode::FAILURE;
169 }
170 ATH_MSG_DEBUG("Recorded new " << wrHdl.key() << " with range " << wrHdl.getRange() << " into Conditions Store");
171
172 return StatusCode::SUCCESS;
173}
174
175// processMmT0Data
176StatusCode
177NswCalibDbAlg::processNSWT0Data(const EventContext& ctx) const {
178 // set up write handles for MmT0 data
180 if (wrHdl.isValid()) {
181 ATH_MSG_DEBUG("CondHandle " << wrHdl.fullKey() << " is already valid."
182 << " In theory this should not be called, but may happen"
183 << " if multiple concurrent events are being processed out of order.");
184 return StatusCode::SUCCESS;
185 }
186 ATH_MSG_DEBUG("Range of MmT0 output is " << wrHdl.getRange());
187 std::unique_ptr<NswT0Data> wrCdo{std::make_unique<NswT0Data>(m_idHelperSvc.get())};
188 if(m_loadMmT0Data){
189 if(!m_mmT0FilePath.empty() ){ // let's read the constants from a file
190 ATH_MSG_INFO("processing MM T0 from file " << m_mmT0FilePath);
191 wrHdl.addDependency(EventIDRange(IOVInfiniteRange::infiniteTime()));
192 std::unique_ptr<TFile> file (TFile::Open(m_mmT0FilePath.value().c_str()));
193 if(!file || file->IsZombie()){
194 ATH_MSG_FATAL("Failed to open file containing the MM T0Data. Filepath: "<<m_mmT0FilePath);
195 return StatusCode::FAILURE;
196 }
197 std::unique_ptr<TTree> tree{(TTree*)file->Get("tree_ch")};
198 if(!tree){
199 ATH_MSG_FATAL("Failed to load tree containing the NswT0Data.");
200 return StatusCode::FAILURE;
201 }
202 ATH_CHECK(loadT0Data(tree, wrCdo.get(), T0Tech::MM));
203
204 } else if(!m_readKey_mm_t0.empty()){
205 ATH_MSG_DEBUG("LOAD NSW MM T0 FROM DB");
206 std::unique_ptr<TTree> tree;
208 ATH_CHECK(loadT0Data(tree, wrCdo.get(), T0Tech::MM));
209
210 } else {
211 ATH_MSG_ERROR("Neither a database folder nor a file have been provided to read the MM T0 constants");
212 return StatusCode::FAILURE;
213 }
214 }
216 if(!m_stgcT0FilePath.empty() ){ // let's read the constants from a file
217 ATH_MSG_INFO("processing sTGC T0 from file " << m_stgcT0FilePath);
218 wrHdl.addDependency(EventIDRange(IOVInfiniteRange::infiniteTime()));
219 std::unique_ptr<TFile> file (TFile::Open(m_stgcT0FilePath.value().c_str()));
220 if(!file || file->IsZombie()){
221 ATH_MSG_FATAL("Failed to open file containing the sTGC T0Data. Filepath: "<<m_stgcT0FilePath);
222 return StatusCode::FAILURE;
223 }
224 std::unique_ptr<TTree> tree{(TTree*)file->Get("tree_ch")};
225 if(!tree){
226 ATH_MSG_FATAL("Failed to load tree containing the NswT0Data.");
227 return StatusCode::FAILURE;
228 }
229 ATH_CHECK(loadT0Data(tree, wrCdo.get(), T0Tech::STGC));
230
231 } else if(!m_readKey_stgc_t0.empty()){
232 ATH_MSG_DEBUG("LOAD NSW sTGC T0 FROM DB");
233 std::unique_ptr<TTree> tree;
235 ATH_CHECK(loadT0Data(tree, wrCdo.get(), T0Tech::STGC));
236
237 } else {
238 ATH_MSG_ERROR("Neither a database folder nor a file have been provided to read the sTGC T0 constants");
239 return StatusCode::FAILURE;
240 }
241 }
242
243 // insert/write data for NswT0Data data
244 ATH_CHECK(wrHdl.record(std::move(wrCdo)));
245 ATH_MSG_DEBUG("Recorded new " << wrHdl.key() << " with range " << wrHdl.getRange() << " into Conditions Store");
246
247 return StatusCode::SUCCESS;
248}
249
250StatusCode NswCalibDbAlg::loadT0ToTree(const EventContext& ctx, const readKey_t& readKey, writeHandleT0_t& writeHandle, std::unique_ptr<TTree>& tree) const{
251 // set up read handle
252 SG::ReadCondHandle<CondAttrListCollection> readHandle{readKey, ctx};
253 const CondAttrListCollection* readCdo{*readHandle};
254 if(!readCdo){
255 ATH_MSG_ERROR("Null pointer to the read conditions object");
256 return StatusCode::FAILURE;
257 }
258 writeHandle.addDependency(readHandle);
259 ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
260 ATH_MSG_DEBUG("Range of input is " << readHandle.getRange() << ", range of output is " << writeHandle.getRange());
261
262 // iterate through data
264 for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
265
266 // retrieve blob
267 const coral::AttributeList& atr = itr->second;
268 if(atr["data"].specification().type() != typeid(coral::Blob)) {
269 ATH_MSG_FATAL( "Data column is not of type blob!" );
270 return StatusCode::FAILURE;
271 }
272 coral::Blob blob = atr["data"].data<coral::Blob>();
274 ATH_MSG_FATAL( "Cannot retrieve data from coral blob!" );
275 return StatusCode::FAILURE;
276 }
277 }
278 return StatusCode::SUCCESS;
279}
280
281StatusCode NswCalibDbAlg::loadT0Data(const std::unique_ptr<TTree>& tree, NswT0Data* writeCdo, const T0Tech tech) const{
282 int sector{0}, layer{0}, channel{0}, channelType{0}, stationEta{0};
283 double time{0};
284 tree->SetBranchAddress("sector" , &sector );
285 tree->SetBranchAddress("layer" , &layer );
286 tree->SetBranchAddress("channel", &channel );
287 tree->SetBranchAddress("mean" , &time );
288 tree->SetBranchAddress("stationEta" , &stationEta);
289 tree->SetBranchAddress("channel_type", &channelType);
290 if (msgLvl(MSG::VERBOSE)) {
291 tree->Print();
292 }
293
294 ATH_MSG_DEBUG("NSW t0 calibration tree has "<< tree->GetEntries() <<" entries for tech " << (tech==T0Tech::MM ? "MM" : "sTGC"));
295
296 for(uint i_channel=0; i_channel<tree->GetEntries(); i_channel++){
297 tree->GetEntry(i_channel);
298
299 int stationPhi = ((std::abs(sector)-1)/2)+1;
300 uint multilayer = (layer<4 ? 1:2); // multilayer 1 corresponds to layers 0-3, ML 2 to layers 4-7
301 uint gasGap = layer - (multilayer-1)*4 + 1;
302
303 Identifier id{0};
304
305 if(tech==T0Tech::MM){
306 std::string stationName = (sector%2==1 ? "MML" : "MMS");
307 bool isValid{true};
308 id = m_idHelperSvc->mmIdHelper().channelID(stationName, stationEta, stationPhi,multilayer,gasGap, channel
309 // checking the validity of the identifier in production code is too expensiv, therefore only check it in debug build
310 #ifndef NDEBUG
311 , isValid
312 #endif
313 );
314
315 if(!isValid){
316 ATH_MSG_ERROR("MM sector "<< sector <<" layer " << layer<< " channel "<< channel << " mean "<< time << " stationEta " << stationEta << " stationPhi " << stationPhi <<" stationName "<< stationName << " multilayer " << multilayer << " gas gap "<< gasGap << " channel " << channel);
317 ATH_MSG_ERROR("Failed to build identifier");
318 return StatusCode::FAILURE;
319 }
320 } else {
321 std::string stationName = (sector%2==1 ? "STL" : "STS");
322 bool isValid{true};
323 id = m_idHelperSvc->stgcIdHelper().channelID(stationName, stationEta, stationPhi, multilayer, gasGap, channelType, channel
324 // checking the validity of the identifier in production code is too expensiv, therefore only check it in debug build
325 #ifndef NDEBUG
326 , isValid
327 #endif
328 );
329 if(!isValid){
330 ATH_MSG_ERROR("Failed to build identifier");
331 ATH_MSG_DEBUG("STG sector "<< sector <<" layer " << layer<< " channel "<< channel << " mean "<< time << " stationEta " << stationEta << " stationPhi " << stationPhi <<" stationName "<< stationName << " multilayer " << multilayer << " gas gap "<< gasGap << " channel " << channel << " channel type" << channelType);
332 return StatusCode::FAILURE;
333 }
334 }
335
336 writeCdo->setData(id, time);
337 }
338 return StatusCode::SUCCESS;
339
340}
341
342
343// loadThresholdData
344StatusCode
345NswCalibDbAlg::loadThresholdData(const EventContext& ctx, const readKey_t& readKey, const ThresholdTech tech, writeHandleThr_t& writeHandle, NswCalibDbThresholdData* writeCdo) const {
346
347 // set up read handle
348 SG::ReadCondHandle<CondAttrListCollection> readHandle{readKey, ctx};
349 const CondAttrListCollection* readCdo{*readHandle};
350 if(!readCdo){
351 ATH_MSG_ERROR("Null pointer to the read conditions object");
352 return StatusCode::FAILURE;
353 }
354 writeHandle.addDependency(readHandle);
355 ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
356 ATH_MSG_DEBUG("Range of input is " << readHandle.getRange() << ", range of output is " << writeHandle.getRange());
357
358 // iterate through data
360 unsigned int nObjs = 0;
361 for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
362
363 // retrieve blob
364 const coral::AttributeList& atr = itr->second;
365 if(atr["data"].specification().type() != typeid(coral::Blob)) {
366 ATH_MSG_FATAL( "Data column is not of type blob!" );
367 return StatusCode::FAILURE;
368 }
369 coral::Blob blob = atr["data"].data<coral::Blob>();
370 std::unique_ptr<TTree> tree;
372 ATH_MSG_FATAL( "Cannot retrieve data from coral blob!" );
373 return StatusCode::FAILURE;
374 }
375
376 // parse tree
377 unsigned int elinkId{0}, vmm{0}, channel{0};
378 float threshold{0.};
379 tree->SetBranchAddress("vmm" , &vmm );
380 tree->SetBranchAddress("channel" , &channel );
381 tree->SetBranchAddress("elinkId" , &elinkId );
382 tree->SetBranchAddress("threshold" , &threshold );
383
384 // loop over channels
385 unsigned int nChns = 0;
386 for(unsigned int iEvt=0; iEvt<tree->GetEntries(); ++iEvt){
387 tree->GetEntry(iEvt);
388 Identifier channelId;
389 if(!buildChannelId(channelId, elinkId, vmm, channel)){
390 ATH_MSG_DEBUG("Could not find valid channelId for elink "<<elinkId<<" This is either caused by calibration data of a channel that is known to be not connected to the detector or might point to some issues in the identifier used for the calibration constants");
391 continue;
392 }
393 if(channelId.get_compact()==0){
394 writeCdo->setZero(tech, threshold);
395 ++nChns;
396 continue;
397 }
398 writeCdo->setData(channelId, threshold);
399 ++nChns;
400 }
401 ATH_MSG_VERBOSE("Retrieved data for "<<nChns<<" channels.");
402 ++nObjs;
403 }
404 ATH_MSG_VERBOSE("Retrieved data for "<<nObjs<<" objects.");
405
406 return StatusCode::SUCCESS;
407}
408
409
410
411// loadTimeChargeData
412StatusCode
413NswCalibDbAlg::loadTimeChargeData(const EventContext& ctx, const readKey_t& readKey, const TimeChargeTech tech, const TimeChargeType type, writeHandleTdoPdo_t& writeHandle, NswCalibDbTimeChargeData* writeCdo) const {
414
415 // set up read handle
416 SG::ReadCondHandle<CondAttrListCollection> readHandle{readKey, ctx};
417 const CondAttrListCollection* readCdo{*readHandle};
418 if(!readCdo){
419 ATH_MSG_ERROR("Null pointer to the read conditions object");
420 return StatusCode::FAILURE;
421 }
422 writeHandle.addDependency(readHandle);
423 ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
424 ATH_MSG_DEBUG("Range of input is " << readHandle.getRange() << ", range of output is " << writeHandle.getRange());
425
426 // iterate through data
428 unsigned int nObjs = 0;
429 for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
430
431 // retrieve blob
432 const coral::AttributeList& atr = itr->second;
433 if(atr["data"].specification().type() != typeid(coral::Blob)) {
434 ATH_MSG_FATAL( "Data column is not of type blob!" );
435 return StatusCode::FAILURE;
436 }
437 coral::Blob blob = atr["data"].data<coral::Blob>();
438 std::unique_ptr<TTree> tree;
440 ATH_MSG_FATAL( "Cannot retrieve data from coral blob!" );
441 return StatusCode::FAILURE;
442 }
443 // parse tree
444 unsigned int elinkId{0}, vmm{0}, channel{0};
445 float slope{0}, intercept{0};
446 //float slope{0}, slopeError{0}, intercept{0},interceptError{0};
447
448 tree->SetBranchAddress("vmm" , &vmm );
449 tree->SetBranchAddress("channel" , &channel );
450 tree->SetBranchAddress("elinkId" , &elinkId );
451 tree->SetBranchAddress("slope" , &slope );
452 //tree->SetBranchAddress("slopeError" , &slopeError ); // keep for later
453 tree->SetBranchAddress("intercept" , &intercept );
454 //tree->SetBranchAddress("interceptError", &interceptError);
455
456
457 // loop over channels
458 unsigned int nChns = 0;
459 for(unsigned int iEvt=0; iEvt<tree->GetEntries(); ++iEvt){
460 tree->GetEntry(iEvt);
461 Identifier channelId{0};
462 if(!buildChannelId(channelId, elinkId, vmm, channel)){
463 ATH_MSG_DEBUG("Could not find valid channelId for elink "<<elinkId<<" This is either caused by calibration data of a channel that is known to be not connected to the detector or might point to some issues in the identifier used for the calibration constants");
464 continue;
465 }
466
468 calib_data.slope = slope;
469 //calib_data.slopeError = slopeError; // keep for later
470 calib_data.intercept = intercept;
471 //calib_data.interceptError = interceptError;
472
473 if(!channelId.get_compact()){
474 writeCdo->setZero(type, tech, calib_data);
475 ++nChns;
476 continue;
477 }
478
479 writeCdo->setData(type, channelId, calib_data);
480 ++nChns;
481 }
482 ATH_MSG_VERBOSE("Retrieved data for "<<nChns<<" channels. "<<tree->GetName()<<" "<<tree->GetEntries());
483 ++nObjs;
484 }
485 ATH_MSG_VERBOSE("Retrieved data for "<<nObjs<<" objects.");
486
487 return StatusCode::SUCCESS;
488}
489
490
491// buildChannelId
492bool
493NswCalibDbAlg::buildChannelId(Identifier& channelId, unsigned int elinkId, unsigned int vmm, unsigned int channel) const {
494
495 // return dummy Identifier
496 if(elinkId==0){
497 channelId = Identifier(0);
498 return true;
499 }
500
501 // build NSWOfflineHelper
502 std::unique_ptr<Muon::nsw::NSWResourceId> resId = std::make_unique<Muon::nsw::NSWResourceId>((uint32_t) elinkId);
503 Muon::nsw::helper::NSWOfflineHelper helper(resId.get(), vmm, channel);
504
505 std::string stationName;
506 if(resId->detId() == eformat::MUON_MMEGA_ENDCAP_A_SIDE || resId->detId() == eformat::MUON_MMEGA_ENDCAP_C_SIDE) {
507 stationName = resId->is_large_station () ? "MML" : "MMS";
508 } else if(resId->detId() == eformat::MUON_STGC_ENDCAP_A_SIDE || resId->detId() == eformat::MUON_STGC_ENDCAP_C_SIDE) {
509 stationName = resId->is_large_station () ? "STL" : "STS";
510 } else {
511 ATH_MSG_ERROR("NSWResource Id "<< elinkId << " does not yield detID that is either sTGC or MMG");
512 THROW_EXCEPTION("NSWCalibDbAlg buildChannelId called with detID that is neither sTGC or MMG");
513 }
514
515 int8_t stationEta = resId->station_eta ();
516 uint8_t stationPhi = resId->station_phi ();
517 uint8_t multiLayer = resId->multi_layer ();
518 uint8_t gasGap = resId->gas_gap ();
519
520 uint8_t channelType = helper.channel_type ();
521 uint16_t channelNumber = helper.channel_number();
522
523 ATH_MSG_VERBOSE("Station name=" << stationName
524 << " Station eta=" << static_cast <int> (stationEta)
525 << " Station phi=" << static_cast <unsigned int> (stationPhi)
526 << " Multilayer=" << static_cast <unsigned int> (multiLayer)
527 << " Gas gap=" << static_cast <unsigned int> (gasGap)
528 << " Channel type=" << static_cast <unsigned int> (channelType)
529 << " Channel Number=" << channelNumber );
530
531
532 // MM
533 if(resId->detId() == eformat::MUON_MMEGA_ENDCAP_A_SIDE || resId->detId() == eformat::MUON_MMEGA_ENDCAP_C_SIDE){
534 bool isValid {false};
535 Identifier chnlId = m_idHelperSvc->mmIdHelper().channelID(stationName, static_cast<int>(stationEta), static_cast<int>(stationPhi), static_cast<int>(multiLayer), static_cast<int>(gasGap), static_cast<int>(channelNumber), isValid);
536 if(!isValid){
537 ATH_MSG_DEBUG("Could not extract valid channelId for MM elink "<<elinkId);
538 return false;
539 }
540 channelId = chnlId;
541 }
542 // sTGC
543 else if(resId->detId() == eformat::MUON_STGC_ENDCAP_A_SIDE || resId->detId() == eformat::MUON_STGC_ENDCAP_C_SIDE){
544 bool isValid {false};
545 Identifier chnlId = m_idHelperSvc->stgcIdHelper().channelID(stationName, static_cast<int>(stationEta), static_cast<int>(stationPhi), static_cast<int>(multiLayer), static_cast<int>(gasGap), static_cast<int>(channelType), static_cast<int>(channelNumber), isValid);
546 if(!isValid){
547 ATH_MSG_DEBUG("Could not extract valid channelId for STGC elink "<<elinkId);
548 return false;
549 }
550 channelId = chnlId;
551 }
552
553 return true;
554}
555
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
unsigned int uint
static const Attributes_t empty
bool msgLvl(const MSG::Level lvl) const
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
static EventIDRange infiniteTime()
Produces an EventIDRange that is inifinite in Time and invalid in RunLumi.
writeKeyTdoPdo_t m_writeKey_tdopdo
readKey_t m_readKey_mm_sidea_pdo
StatusCode loadT0ToTree(const EventContext &ctx, const readKey_t &readKey, writeHandleT0_t &writeHandle, std::unique_ptr< TTree > &tree) const
SG::ReadCondHandleKey< CondAttrListCollection > readKey_t
NswCalibDbThresholdData::ThrsldTechType ThresholdTech
Gaudi::Property< bool > m_processThresholds
readKey_t m_readKey_stgc_sidec_tdo
readKey_t m_readKey_mm_sidec_tdo
Gaudi::Property< std::string > m_mmT0FilePath
virtual StatusCode initialize() override
StatusCode loadThresholdData(const EventContext &, const readKey_t &, const ThresholdTech, writeHandleThr_t &, NswCalibDbThresholdData *) const
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
ServiceHandle< ICondSvc > m_condSvc
readKey_t m_readKey_mm_sidea_thr
readKey_t m_readKey_stgc_sidec_pdo
readKey_t m_readKey_stgc_sidec_thr
readKey_t m_readKey_stgc_sidea_tdo
Gaudi::Property< std::string > m_stgcT0FilePath
readKey_t m_readKey_mm_sidea_tdo
readKey_t m_readKey_mm_sidec_pdo
StatusCode loadT0Data(const std::unique_ptr< TTree > &tree, NswT0Data *writeCdo, const T0Tech tech) const
Gaudi::Property< bool > m_loadsTgcT0Data
readKey_t m_readKey_mm_sidec_thr
readKey_t m_readKey_stgc_sidea_thr
bool buildChannelId(Identifier &channelId, unsigned int elinkId, unsigned int vmm, unsigned int channel) const
readKey_t m_readKey_stgc_t0
NswCalibDbTimeChargeData::CalibDataType TimeChargeType
Gaudi::Property< bool > m_loadMmT0Data
SG::WriteCondHandle< NswCalibDbTimeChargeData > writeHandleTdoPdo_t
StatusCode processThrData(const EventContext &ctx) const
virtual StatusCode execute(const EventContext &) const override
MuonCond::CalibTechType TimeChargeTech
StatusCode processTdoPdoData(const EventContext &ctx) const
StatusCode loadTimeChargeData(const EventContext &ctx, const readKey_t &readKey, const TimeChargeTech, const TimeChargeType type, writeHandleTdoPdo_t &writeHandle, NswCalibDbTimeChargeData *writeCdo) const
StatusCode processNSWT0Data(const EventContext &ctx) const
readKey_t m_readKey_stgc_sidea_pdo
writeKeyMmT0_t m_writeKey_nswT0
SG::WriteCondHandle< NswCalibDbThresholdData > writeHandleThr_t
readKey_t m_readKey_mm_t0
Gaudi::Property< bool > m_isData
writeKeyThr_t m_writeKey_thr
SG::WriteCondHandle< NswT0Data > writeHandleT0_t
MuonCond::CalibTechType T0Tech
void setData(const Identifier &, const float)
void setZero(ThrsldTechType, const float)
void setZero(CalibDataType type, MuonCond::CalibTechType tech, CalibConstants constants)
void setData(CalibDataType type, const Identifier &chnlId, CalibConstants constants)
void setData(const Identifier &channelId, const float channelT0)
Definition NswT0Data.cxx:42
const DataObjID & fullKey() const
const EventIDRange & getRange()
const std::string & key() const
void addDependency(const EventIDRange &range)
const EventIDRange & getRange() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
bool readBlobAsTTree(const coral::Blob &blob, std::unique_ptr< TTree > &tree, const std::string_view name="tree")
Interprets the coral::Blob as a TTree instance.
Helper struct to cache all calibration constants in a common place of the memory.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10
TChain * tree
TFile * file