ATLAS Offline Software
Loading...
Searching...
No Matches
MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.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 "MdtCalibDbAlg.h"
6
9
15
20
22#include "GaudiKernel/PhysicalConstants.h"
23
24#include "CoralBase/Attribute.h"
25#include "CoralBase/AttributeListSpecification.h"
26#include "CoralBase/Blob.h"
28
29#include <unordered_map>
30#include <fstream>
31
32#include "TFile.h"
33#include "TTree.h"
34
35
36using namespace MuonCalib;
38
39
40
41#define SET_BRANCHADDRESS(tree, branchName) \
42 { \
43 if (!tree.GetBranch(#branchName)) { \
44 ATH_MSG_FATAL("The branch "<<#branchName<<" does not exist."); \
45 return StatusCode::FAILURE; \
46 } \
47 if (tree.SetBranchAddress(#branchName,&branchName) != 0){ \
48 ATH_MSG_FATAL("Failed to connect branch "<<#branchName<<"."); \
49 return StatusCode::FAILURE; \
50 } \
51 }
52
53namespace MuonCalibR4 {
54
56 ATH_MSG_VERBOSE("Initialize...");
57 ATH_CHECK(m_idHelperSvc.retrieve());
58 ATH_CHECK(m_writeKey.initialize());
59
61 if (m_t0TreeName.value().empty()) {
62 m_t0RootFile.value().clear();
63 }
64 if (m_rtTreeName.value().empty()) {
65 m_rtRootFile.value().clear();
66 }
67 const bool initRt = (m_rtJSON.value().empty() && m_rtRootFile.value().empty());
68 const bool initT0 = (m_t0JSON.value().empty() && m_t0RootFile.value().empty());
69 ATH_CHECK(m_readKeyRt.initialize(initRt));
70 ATH_CHECK(m_readKeyTube.initialize(initT0));
71
72 if (m_rtRootFile.value().size()) {
73 ATH_MSG_INFO("Load RT - calibration constants from ROOT File "<<m_rtRootFile);
74 m_rtJSON.clear();
75 } else if (m_rtJSON.value().size()) {
76 ATH_MSG_INFO("Load the RT- calibration constants from JSON file "<<m_rtJSON);
77 m_rtTreeName.clear();
78 } else {
79 ATH_MSG_INFO("Load RT - calibration constants from COOL: "<<m_readKeyRt.fullKey());
80 }
81 if (m_t0RootFile.value().size()) {
82 ATH_MSG_INFO("Load T0 - calibration constants from ROOT File "<<m_t0RootFile);
83 m_t0JSON.clear();
84 } else if (m_t0JSON.value().size()) {
85 ATH_MSG_INFO("Load the T0 - calibration constants from JSON file "<<m_t0JSON);
86 m_t0TreeName.clear();
87 }
88 return StatusCode::SUCCESS;
89}
90
91StatusCode MdtCalibDbAlg::execute(const EventContext& ctx) const {
92 ATH_MSG_VERBOSE("Executing MdtCalibDbAlgR4");
93 SG::WriteCondHandle writeHandle{m_writeKey, ctx};
94 if(writeHandle.isValid()) {
95 ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid.");
96 return StatusCode::SUCCESS;
97 }
98 writeHandle.addDependency(EventIDRange(IOVInfiniteRange::infiniteRunLB()));
99 auto writeCdo = std::make_unique<MdtCalibDataContainer>(m_idHelperSvc.get(), RegionGranularity::OnePerMultiLayer);
101 writeCdo->setInversePropSpeed(1./ (m_prop_beta * Gaudi::Units::c_light));
102
104 if (!m_readKeyRt.empty()) {
105 SG::ReadCondHandle readHandle{m_readKeyRt, ctx};
106 ATH_CHECK(readHandle.isValid());
107 writeHandle.addDependency(readHandle);
108 for(CondAttrListCollection::const_iterator itr = readHandle->begin();
109 itr != readHandle->end(); ++itr) {
110 const coral::AttributeList& atr = itr->second;
111 if(atr["data"].specification().type() != typeid(coral::Blob)) {
112 ATH_MSG_FATAL( "Data column is not of type blob!" );
113 return StatusCode::FAILURE;
114 }
115
116 coral::Blob blob = atr["data"].data<coral::Blob>();
117
118 if(m_dbPayloadType =="TTree"){
119 std::unique_ptr<TTree> tree;
120 if(!CoralUtilities::readBlobAsTTree(blob, tree, "RtCalibConstants")) {
121 ATH_MSG_FATAL( "Cannot retrieve data from coral blob!");
122 return StatusCode::FAILURE;
123 }
124 ATH_CHECK(parseRtPayload(*tree, *writeCdo));
125 } else if (m_dbPayloadType=="JSON") {
126 ATH_MSG_VERBOSE("Loading data as a BLOB, uncompressing...");
127 std::string data{};
129 ATH_MSG_FATAL("Cannot uncompress BLOB! Aborting...");
130 return StatusCode::FAILURE;
131 }
132 nlohmann::json rtBlob = nlohmann::json::parse(data);
133 ATH_CHECK(parseRtPayload(std::move(rtBlob),*writeCdo));
134 } else {
135 ATH_MSG_FATAL("Payload type " << m_dbPayloadType << " not understood. Options are: TTree or JSON");
136 return StatusCode::FAILURE;
137 }
138 }
139
140 } else if (!m_rtRootFile.value().empty()) {
141 std::unique_ptr<TFile> inFile{TFile::Open(m_rtRootFile.value().c_str(), "READ")};
142 if(!inFile || inFile->IsZombie()) {
143 ATH_MSG_FATAL("Failed to open file "<<m_rtRootFile);
144 return StatusCode::FAILURE;
145 }
146 TTree* tree{nullptr};
147 inFile->GetObject(m_rtTreeName.value().c_str(), tree);
148 if (!tree) {
149 ATH_MSG_FATAL("The object "<<m_rtRootFile<<" does not contain "<<m_rtTreeName);
150 return StatusCode::FAILURE;
151 }
152 ATH_CHECK(parseRtPayload(*tree, *writeCdo));
153 } else if (!m_rtJSON.value().empty()) {
154 std::ifstream inFile{m_rtJSON};
155 if (!inFile.good()) {
156 ATH_MSG_FATAL("Failed to open "<<m_rtJSON);
157 return StatusCode::FAILURE;
158 }
159 nlohmann::json rtBlob{};
160 inFile >> rtBlob;
161 ATH_CHECK(parseRtPayload(std::move(rtBlob),*writeCdo));
162 }
163 if (!m_readKeyTube.empty()) {
164 SG::ReadCondHandle readHandle{m_readKeyTube, ctx};
165 ATH_CHECK(readHandle.isValid());
166 writeHandle.addDependency(readHandle);
167 for(CondAttrListCollection::const_iterator itr = readHandle->begin();
168 itr != readHandle->end(); ++itr) {
169 const coral::AttributeList& atr = itr->second;
170 if(atr["data"].specification().type() != typeid(coral::Blob)) {
171 ATH_MSG_FATAL( "Data column is not of type blob!" );
172 return StatusCode::FAILURE;
173 }
174
175 coral::Blob blob = atr["data"].data<coral::Blob>();
176
177 if(m_dbPayloadType =="TTree"){
178 std::unique_ptr<TTree> tree;
179 if(!CoralUtilities::readBlobAsTTree(blob, tree, "T0CalibConstants")) {
180 ATH_MSG_FATAL( "Cannot retrieve data from coral blob!");
181 return StatusCode::FAILURE;
182 }
183 ATH_CHECK(parseT0Payload(*tree, *writeCdo));
184 } else if (m_dbPayloadType=="JSON") {
185 ATH_MSG_VERBOSE("Loading data as a BLOB, uncompressing...");
186 std::string data{};
188 ATH_MSG_FATAL("Cannot uncompress BLOB! Aborting...");
189 return StatusCode::FAILURE;
190 }
191 nlohmann::json rtBlob = nlohmann::json::parse(data);
192 ATH_CHECK(parseT0Payload(std::move(rtBlob),*writeCdo));
193 } else {
194 ATH_MSG_FATAL("Payload type " << m_dbPayloadType << " not understood. Options are: TTree or JSON");
195 return StatusCode::FAILURE;
196 }
197
198 }
199 } else if (!m_t0RootFile.value().empty()) {
200 std::unique_ptr<TFile> inFile{TFile::Open(m_t0RootFile.value().c_str(), "READ")};
201 if(!inFile || inFile->IsZombie()) {
202 ATH_MSG_FATAL("Failed to open file "<<m_t0RootFile);
203 return StatusCode::FAILURE;
204 }
205 TTree* tree{nullptr};
206 inFile->GetObject(m_t0TreeName.value().c_str(), tree);
207 if (!tree) {
208 ATH_MSG_FATAL("The object "<<m_rtRootFile<<" does not contain "<<m_t0TreeName);
209 return StatusCode::FAILURE;
210 }
211 ATH_CHECK(parseT0Payload(*tree, *writeCdo));
212 } else {
213 std::ifstream inFile{m_t0JSON};
214 if (!inFile.good()) {
215 ATH_MSG_FATAL("Failed to open "<<m_t0JSON);
216 return StatusCode::FAILURE;
217 }
218 nlohmann::json t0Blob{};
219 inFile >> t0Blob;
220 ATH_CHECK(parseT0Payload(std::move(t0Blob), *writeCdo));
221 }
222
223 ATH_CHECK(writeHandle.record(std::move(writeCdo)));
224 ATH_MSG_INFO("Recorded succesfully "<<m_writeKey.fullKey()<<" "<<writeHandle.getRange());
225 return StatusCode::SUCCESS;
226}
227
228
229StatusCode MdtCalibDbAlg::parseRtPayload(TTree& rtTree,
230 MdtCalibDataContainer& outContainer) const {
231 const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
232
233 std::string* rtType{nullptr}, *trType{nullptr}, *resoType{nullptr};
234
235 std::vector<double>* rtParams{nullptr}, *trParams{nullptr}, *resoParams{nullptr};
236
237 std::vector<std::string>* stationName{nullptr};
238 std::vector<short>* stationEta{nullptr};
239 std::vector<unsigned short>* stationPhi{nullptr}, *multiLayer{nullptr};
240
241 SET_BRANCHADDRESS(rtTree, rtType);
242 SET_BRANCHADDRESS(rtTree, trType);
243 SET_BRANCHADDRESS(rtTree, resoType);
244 SET_BRANCHADDRESS(rtTree, rtParams);
245 SET_BRANCHADDRESS(rtTree, trParams);
246 SET_BRANCHADDRESS(rtTree, resoParams);
247 SET_BRANCHADDRESS(rtTree, stationName);
248 SET_BRANCHADDRESS(rtTree, stationEta);
249 SET_BRANCHADDRESS(rtTree, stationPhi);
250 SET_BRANCHADDRESS(rtTree, multiLayer);
251
252 for (Long64_t e = 0; e< rtTree.GetEntries(); ++e) {
253 rtTree.GetEntry(e);
254 ATH_MSG_VERBOSE("Load "<<e<<"-th calibration constant Valid for "<<stationName->size()<< " det elements.");
255 std::vector<Identifier> detIds{};
256 for (unsigned ch = 0; ch < stationName->size(); ++ch){
257 const Identifier detElId = idHelper.channelID(stationName->at(ch), stationEta->at(ch), stationPhi->at(ch),
258 multiLayer->at(ch), 1, 1);
259 detIds.emplace_back(detElId);
260 }
261 IRtRelationPtr rtRel{makeRt(*rtType, *rtParams)};
262 if(!rtRel) {
263 return StatusCode::FAILURE;
264 }
265 ITrRelationPtr trRel = (*trType).size() ? makeTr(*trType, *trParams) : nullptr;
266 if ((*trType).size() && !trRel) {
267 return StatusCode::FAILURE;
268 }
269 IRtResolutionPtr rtReso = makeReso(*resoType, *resoParams, rtRel);
270 if (!rtReso) {
271 return StatusCode::FAILURE;
272 }
274 std::make_unique<MdtRtRelation>(std::move(rtRel), std::move(rtReso), std::move(trRel));
275 for (const Identifier& detId : detIds) {
276 if (!outContainer.storeData(detId, mdtRel, msgStream())){
277 return StatusCode::FAILURE;
278 }
279 }
280 }
281 return StatusCode::SUCCESS;
282}
283IRtRelationPtr MdtCalibDbAlg::makeRt(const std::string& rtType, const std::vector<double>& rtParams) const {
284 IRtRelationPtr rtRel{};
285 if (rtType == "RtRelationLookUp") {
286 rtRel = std::make_unique<RtRelationLookUp>(rtParams);
287 } else if (rtType == "RtLegendre"){
288 rtRel = std::make_unique<RtLegendre>(rtParams);
289 } else if (rtType == "RtChebyshev") {
290 rtRel = std::make_unique<RtChebyshev>(rtParams);
291 }
292 if (rtRel) {
293 ATH_MSG_VERBOSE("Fetched new rt-relation <"<<rtType<<"> valid for drift times ranging from "
294 <<rtRel->tLower()<<"-"<<rtRel->tUpper()<<".");
295 } else {
296 ATH_MSG_FATAL("The rt-relation function type <"<<rtType<<"> is not yet supported.");
297 }
298 return rtRel;
299}
300
301ITrRelationPtr MdtCalibDbAlg::makeTr(const std::string& trType, const std::vector<double>& trParams) const {
302 ITrRelationPtr trRel{};
303 if (trType == "TrChebyshev") {
304 trRel = std::make_unique<TrChebyshev>(trParams);
305 } else if(trType == "TrLegendre") {
306 trRel = std::make_unique<TrLegendre>(trParams);
307 }
308 if (trRel) {
309 ATH_MSG_VERBOSE("Fetched new tr-relation <"<<trType<<"> valid for drift radii ranging from "
310 <<trRel->minRadius()<<"-"<<trRel->maxRadius()<<".");
311 } else {
312 ATH_MSG_FATAL("The rt-relation function type <"<<trType<<"> is not yet supported.");
313 }
314 return trRel;
315}
316
317IRtResolutionPtr MdtCalibDbAlg::makeReso(const std::string& resoType, const std::vector<double>& resoParams,
318 IRtRelationPtr rt) const {
319 IRtResolutionPtr rtReso{};
320 if (resoType == "RtResolutionLookUp") {
321 rtReso = std::make_unique<RtResolutionLookUp>(resoParams);
322 } else if (resoType == "RtResolutionChebyshev") {
323 rtReso = std::make_unique<RtResolutionChebyshev>(resoParams);
324 } else if (resoType == "RadiusResolutionChebyshev") {
325 rtReso = std::make_unique<RadiusResolutionChebyshev>(resoParams, rt);
326 } else {
327 ATH_MSG_FATAL("The rt resolution type <"<<resoType<<"> is not yet supported.");
328 }
329 return rtReso;
330}
331StatusCode MdtCalibDbAlg::parseRtPayload(const nlohmann::json& rtBlob,
332 MdtCalibDataContainer& outContainer) const{
333 const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
334
336 for (auto& payload : rtBlob.items()) {
337 std::vector<Identifier> detIds{};
338
339 const nlohmann::json calibConstants = payload.value();
341 for (auto& chambList : calibConstants["chambers"].items()) {
342 const nlohmann::json chambPayload = chambList.value();
343 const std::string station = chambPayload["station"];
344 const int eta = chambPayload["eta"];
345 const int phi = chambPayload["phi"];
346 const int ml = chambPayload["ml"];
347 const Identifier mlId{idHelper.channelID(station, eta, phi, ml, 1, 1)};
348 detIds.emplace_back(mlId);
349 }
350
352 const nlohmann::json rtPayload = calibConstants["rtRelation"];
353 ITrRelationPtr trRel{};
354 IRtRelationPtr rtRel = makeRt(rtPayload["type"], rtPayload["params"]);
355 if (!rtRel) {
356 return StatusCode::FAILURE;
357 }
358 if (calibConstants.find("trRelation") != calibConstants.end()) {
359 const nlohmann::json trPayload = calibConstants["trRelation"];
360 trRel = makeTr(trPayload["type"], trPayload["params"]);
361 if (!trRel) {
362 return StatusCode::FAILURE;
363 }
364 }
366 const nlohmann::json resoPayload = calibConstants["rtReso"];
367 IRtResolutionPtr rtReso =makeReso(resoPayload["type"], resoPayload["params"], rtRel);
368 if (!rtReso) {
369 return StatusCode::FAILURE;
370 }
372 std::make_unique<MdtRtRelation>(std::move(rtRel), std::move(rtReso), std::move(trRel));
373
374
376 for (const Identifier& mlId : detIds) {
377 if (outContainer.hasDataForChannel(mlId,msgStream()) &&
378 outContainer.getCalibData(mlId, msgStream())->rtRelation) {
379 continue;
380 }
381 if (!outContainer.storeData(mlId, mdtRel, msgStream())) {
382 return StatusCode::FAILURE;
383 }
384 }
385 }
386 return StatusCode::SUCCESS;
387}
388
389StatusCode MdtCalibDbAlg::parseT0Payload(TTree& t0Tree,
390 MuonCalib::MdtCalibDataContainer& outContainer) const {
391
392 std::string* stationName{nullptr};
393 short stationEta{0};
394 unsigned short stationPhi{0}, code{0};
395 float t0{0.f}, adc{0.f};
396 std::vector<unsigned short>* multiLayer{nullptr}, *tubeLayer{nullptr}, *tube{nullptr};
397
398 SET_BRANCHADDRESS(t0Tree, stationName);
399 SET_BRANCHADDRESS(t0Tree, stationEta);
400 SET_BRANCHADDRESS(t0Tree, stationPhi);
401 SET_BRANCHADDRESS(t0Tree, code);
402 SET_BRANCHADDRESS(t0Tree, t0);
403 SET_BRANCHADDRESS(t0Tree, adc);
404 SET_BRANCHADDRESS(t0Tree, multiLayer);
405 SET_BRANCHADDRESS(t0Tree, tubeLayer);
406 SET_BRANCHADDRESS(t0Tree, tube);
407
409 const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
410
411 for (Long64_t e = 0 ; e <t0Tree.GetEntries(); ++e) {
412 t0Tree.GetEntry(e);
413 bool isValid{false};
414 const Identifier detId = idHelper.elementID(*stationName, stationEta, stationPhi, isValid);
415 if (!isValid) {
416 ATH_MSG_FATAL("Failed to create a valid Identifier from "<<(*stationName)<<", "<<stationEta<<", "
417 <<stationPhi);
418 return StatusCode::FAILURE;
419 }
420 TubeContainerPtr calibChannels = std::make_unique<MdtTubeCalibContainer>(m_idHelperSvc.get(), detId);
421 SingleTubeCalib t0Calib{};
422 t0Calib.adcCal = adc;
423 t0Calib.t0 = t0;
424 t0Calib.statusCode = code;
425
426 for (unsigned int ch = 0; ch < multiLayer->size(); ++ch){
427 const Identifier tubeId{idHelper.channelID(detId, multiLayer->at(ch),
428 tubeLayer->at(ch), tube->at(ch), isValid)};
429 if (!isValid) {
430 ATH_MSG_FATAL("Failed to get a valid tube Identifier for "<<m_idHelperSvc->toStringChamber(detId)
431 <<", ml: "<<multiLayer->at(ch)<<", tl: "<<tubeLayer->at(ch)<<", tube: "<<tube->at(ch));
432 return StatusCode::FAILURE;
433 }
434 if (!calibChannels->setCalib(t0Calib, tubeId, msgStream())) {
435 return StatusCode::FAILURE;
436 }
437 }
438 if (!outContainer.storeData(detId, calibChannels, msgStream())){
439 return StatusCode::FAILURE;
440 }
441 }
442 return StatusCode::SUCCESS;
443}
444StatusCode MdtCalibDbAlg::parseT0Payload(const nlohmann::json& t0Blob,
445 MdtCalibDataContainer& outContainer) const {
446 const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
448
450 for (auto& dbEntry : t0Blob.items()) {
451 const nlohmann::json payload = dbEntry.value();
452 const std::string station = payload["station"];
453 const int eta = payload["eta"];
454 const int phi = payload["phi"];
455 bool isValid{false};
456 const Identifier detId = idHelper.elementID(station, eta, phi, isValid);
457 if (!isValid) {
458 ATH_MSG_FATAL("Failed to create a valid identifier from "<<station<<", "<<eta<<", "<<phi);
459 return StatusCode::FAILURE;
460 }
461 TubeContainerPtr calibChannels = std::make_unique<MdtTubeCalibContainer>(m_idHelperSvc.get(), detId);
462
463 for (auto& calibEntry : payload["calibConstants"].items()){
464 const nlohmann::json calibPayload = calibEntry.value();
465 SingleTubeCalib calibConstant{};
466 calibConstant.t0 = calibPayload["t0"];
467 calibConstant.adcCal = calibPayload["adc"];
468 calibConstant.statusCode = calibPayload["code"];
469 for (auto& tubeEntry : calibPayload["tubes"].items()) {
470 const nlohmann::json tubePayload = tubeEntry.value();
471 const int ml = tubePayload["ml"];
472 const int tubeLayer = tubePayload["tl"];
473 const std::string tubeStr = tubePayload["no"];
474 const std::vector<std::string> tubeTokens{CxxUtils::tokenize(tubeStr, ";")};
475 std::vector<int> tubes{};
476 for (const std::string& token: tubeTokens) {
477 if (token.find("-") == std::string::npos) {
478 tubes.emplace_back(CxxUtils::atoi(token));
479 } else {
480 const std::vector<std::string> rangeToken{CxxUtils::tokenize(token,"-")};
481 if (rangeToken.size() != 2) {
482 ATH_MSG_FATAL("No valid tube range token: "<<token);
483 return StatusCode::FAILURE;
484 }
485 const int tubeLow{CxxUtils::atoi(rangeToken[0])}, tubeHigh{CxxUtils::atoi(rangeToken[1])};
486 if (tubeLow >= tubeHigh){
487 ATH_MSG_FATAL("Invalid range "<<tubeLow<<"-"<<tubeHigh
488 <<". The lower end must be strictly smaller than the upper one");
489 return StatusCode::FAILURE;
490 }
491 for (int tube = tubeLow; tube<=tubeHigh; ++tube) {
492 tubes.push_back(tube);
493 }
494 }
495 }
496 for (const int tube : tubes) {
497 const Identifier tubeId = idHelper.channelID(detId,ml, tubeLayer, tube, isValid);
498 if (!isValid) {
499 ATH_MSG_FATAL("No valid tube identifier from "<<m_idHelperSvc->toStringDetEl(detId)
500 <<", layer: "<<tubeLayer<<", tube: "<<tube);
501 return StatusCode::FAILURE;
502 }
503 if (!calibChannels->setCalib(calibConstant, tubeId, msgStream())){
504 return StatusCode::FAILURE;
505 }
506 }
507 }
508 }
509 if (!outContainer.storeData(detId, std::move(calibChannels), msgStream())) {
510 return StatusCode::FAILURE;
511 }
512 }
513
514 return StatusCode::SUCCESS;
515}
516
517}
518
519
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#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
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
MuonCalib::MdtTubeCalibContainer::SingleTubeCalib SingleTubeCalib
MdtCalibDataContainer::RegionGranularity RegionGranularity
ChanAttrListMap::const_iterator const_iterator
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
Identifier elementID(int stationName, int stationEta, int stationPhi) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
StatusCode parseRtPayload(const nlohmann::json &rtBlob, MuonCalib::MdtCalibDataContainer &outContainer) const
MuonCalib::IRtRelationPtr makeRt(const std::string &rtType, const std::vector< double > &pars) const
Creates a new rt function from the typeName & the list of parameters.
StatusCode parseT0Payload(const nlohmann::json &t0Blob, MuonCalib::MdtCalibDataContainer &outContainer) const
Trnaslates a t0 - JSON payload into transient memory.
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyTube
MuonCalib::MdtCalibDataContainer::TubeContainerPtr TubeContainerPtr
SG::WriteCondHandleKey< MuonCalib::MdtCalibDataContainer > m_writeKey
MuonCalib::IRtResolutionPtr makeReso(const std::string &resoType, const std::vector< double > &pars, MuonCalib::IRtRelationPtr rt) const
Creates a new resoltuion function from the typeName & the list of parameters.
Gaudi::Property< std::string > m_rtJSON
External Rt & T0 JSON files.
MuonCalib::ITrRelationPtr makeTr(const std::string &trType, const std::vector< double > &pars) const
Creates a new tr function from the typeName & the list of parameters.
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyRt
virtual StatusCode execute(const EventContext &ctx) const override
virtual double tLower() const =0
Returns the lower time covered by the r-t.
virtual double tUpper() const =0
Returns the upper time covered by the r-t.
virtual double maxRadius() const =0
Returns the maximum drift-radius.
virtual double minRadius() const =0
Returns the minimum drift-radius.
bool storeData(const Identifier &mlID, CorrectionPtr corrFuncSet, MsgStream &msg)
bool hasDataForChannel(const Identifier &measId, MsgStream &msg) const
Checks whether a calibration data object is already present.
const MdtFullCalibData * getCalibData(const Identifier &measId, MsgStream &msg) const
Returns the calibration data associated with this station.
bool setCalib(SingleTubeCalib val, const Identifier &tubeId, MsgStream &msg)
set the calibration constants of a single tube
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 readBlobAsString(const coral::Blob &, std::string &)
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.
std::vector< std::string > tokenize(const std::string &the_str, std::string_view delimiters)
Splits the string into smaller substrings.
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
GeoModel::TransientConstSharedPtr< IRtRelation > IRtRelationPtr
Definition IRtRelation.h:17
GeoModel::TransientConstSharedPtr< ITrRelation > ITrRelationPtr
Definition ITrRelation.h:16
GeoModel::TransientConstSharedPtr< IRtResolution > IRtResolutionPtr
GeoModel::TransientConstSharedPtr< MdtRtRelation > RtRelationPtr
float adcCal
quality flag for the SingleTubeCalib constants: 0 all ok, 1 no hits found, 2 too few hits,...
TChain * tree