ATLAS Offline Software
Loading...
Searching...
No Matches
MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
8
9#ifndef MDTCALIBDBCOOLSTRTOOL_MDTCALIBDBALG_H
10#define MDTCALIBDBCOOLSTRTOOL_MDTCALIBDBALG_H
11
13
16#include "CLHEP/Random/RandomEngine.h"
17#include "CoralBase/Blob.h"
27
30#include "nlohmann/json.hpp"
31#include "zlib.h"
32
33
37namespace Muon{
39public:
40 using AthCondAlgorithm::AthCondAlgorithm;
41 virtual ~MdtCalibDbAlg() = default;
42 virtual StatusCode initialize() override;
43 virtual StatusCode execute(const EventContext& ctx) const override;
44private:
45 StatusCode declareDependency(const EventContext& ctx,
47 StatusCode loadRt(const EventContext& ctx, MuonCalib::MdtCalibDataContainer& writeCdo) const;
48 StatusCode loadTube(const EventContext& ctx, MuonCalib::MdtCalibDataContainer& writeCdo) const;
49
50 StatusCode defaultT0s(MuonCalib::MdtCalibDataContainer& writeCdoTube) const;
51
53 using LoadedRtMap = std::map<Identifier, RtRelationPtr>;
54
55 StatusCode defaultRt(MuonCalib::MdtCalibDataContainer& writeCdoRt,
56 LoadedRtMap& loadedRts) const;
57
58 std::optional<double> getInnerTubeRadius(const Identifier& id) const;
59
61 StatusCode legacyRtPayloadToJSON(const coral::AttributeList& attr, nlohmann::json & json) const;
63 StatusCode legacyTubePayloadToJSON(const coral::AttributeList& attr,nlohmann::json & json) const;
64
65
66 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
67 ToolHandle<MuonCalib::IIdToFixedIdTool> m_idToFixedIdTool{this, "IdToFixedIdTool", "MuonCalib::IdToFixedIdTool"};
68
71
72 Gaudi::Property<bool> m_useNewGeo{this, "UseR4DetMgr", false,
73 "Switch between the legacy and the new geometry"};
74
76
77 Gaudi::Property<bool> m_checkTubes{this, "checkTubes", true,"If true the number of tubes must agree between the conditions DB & geometry"};
78 // new conditions format 2020
79 Gaudi::Property<bool> m_newFormat2020{this, "NewFormat2020", false, "Use the new calibration data format "};
80
81 // like MdtCalibrationDbSvc
82 // for corData in loadRt
83 Gaudi::Property<bool> m_create_b_field_function{this, "CreateBFieldFunctions", false,
84 "If set to true, the B-field correction functions are initialized for each rt-relation that is loaded."};
85
86 Gaudi::Property<bool> m_createSlewingFunction{this, "CreateSlewingFunctions", false,
87 "If set to true, the slewing correction functions are initialized for each rt-relation that is loaded."};
88
89
90 // if m_TimeSlewingCorrection is set to true then it is assumed that the
91 // time slewing correction is applied. If false not. If this flag does
92 // not match the bit in the creation parameters, the rt-relation and t0
93 // will be corrected.
94 // NOTE: This was a preliminary solution for 17.2. In principle each
95 // MdtDriftCircleOnTrackCreator could decide individually if it wants to
96 // have TS-correction. In the default reco-jobs however, this is
97 // configured by one muonRecFlag, that will be used to set this job-option.
98 Gaudi::Property<bool> m_TimeSlewingCorrection{this, "TimeSlewingCorrection", false};
99 Gaudi::Property<bool> m_UseMLRt{this, "UseMLRt", false, "Enable use of ML-RTs from COOL"};
100
101 Gaudi::Property<std::vector<float>> m_MeanCorrectionVsR{this, "MeanCorrectionVsR", {}};
102
103 Gaudi::Property<double> m_TsCorrectionT0{this, "TimeSlewCorrectionT0", 0.};
104
105 Gaudi::Property<double> m_defaultT0{this, "defaultT0", 40., "default T0 value to be used in absence of DB information"};
106 Gaudi::Property<double> m_t0Shift{this, "T0Shift", 0., "for simulation: common shift of all T0s, in ns"};
107 Gaudi::Property<double> m_t0Spread{this, "T0Spread", 0., "for simulation: sigma for random smeraing of T0s, in ns"};
108
109 Gaudi::Property<double> m_rtShift{this, "RTShift", 0., "for simulations: maximum RT distortion, in mm"};
110 Gaudi::Property<double> m_rtScale{this, "RTScale", 1., "for simulations: a muliplicitive scale to the drift r"};
111 Gaudi::Property<double> m_prop_beta{this, "PropagationSpeedBeta", 1., "Speed of the signal propagation"};
112
113 ServiceHandle<IAthRNGSvc> m_AthRNGSvc{this, "AthRNGSvc", "AthRNGSvc"};
114 StringProperty m_randomStream{this, "RandomStream", "MDTCALIBDBALG"};
116
117 StringProperty m_RTfileName{this, "RT_InputFile", "MuonCondAlg/Muon_RT_default.data",
118 "single input ascii file for default RT to be applied in absence of DB information"}; // temporary!!!
119
120 static std::unique_ptr<MuonCalib::RtResolutionLookUp> getRtResolutionInterpolation(const std::vector<MuonCalib::SamplePoint>& sample_points);
121
122 SG::ReadCondHandleKey<CondAttrListCollection> m_readKeyRt{this, "ReadKeyRt", "/MDT/RTBLOB", "DB folder containing the RT calibrations"};
123 SG::ReadCondHandleKey<CondAttrListCollection> m_readKeyTube{this, "ReadKeyTube", "/MDT/T0BLOB", "DB folder containing the tube constants"};
125 "Conditions object containing the calibrations"};
126
127 SG::ReadCondHandleKey<MdtCondDbData> m_readKeyDCS{this, "ReadKeyDCS", "MdtCondDbData", "Key of the input DCS data"};
128};
129}
130#endif
Base class for conditions algorithms.
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
nlohmann::json json
A wrapper class for event-slot-local random engines.
Definition RNGWrapper.h:56
Base class for conditions algorithms.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
MuonCalib::MdtFullCalibData::RtRelationPtr RtRelationPtr
StatusCode legacyTubePayloadToJSON(const coral::AttributeList &attr, nlohmann::json &json) const
virtual ~MdtCalibDbAlg()=default
virtual StatusCode execute(const EventContext &ctx) const override
std::optional< double > getInnerTubeRadius(const Identifier &id) const
StatusCode declareDependency(const EventContext &ctx, SG::WriteCondHandle< MuonCalib::MdtCalibDataContainer > &writeHandle) const
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyTube
SG::WriteCondHandleKey< MuonCalib::MdtCalibDataContainer > m_writeKey
StatusCode defaultRt(MuonCalib::MdtCalibDataContainer &writeCdoRt, LoadedRtMap &loadedRts) const
Gaudi::Property< bool > m_checkTubes
only needed to retrieve information on number of tubes etc. (no alignment needed)
StatusCode loadTube(const EventContext &ctx, MuonCalib::MdtCalibDataContainer &writeCdo) const
ToolHandle< MuonCalib::IIdToFixedIdTool > m_idToFixedIdTool
StatusCode legacyRtPayloadToJSON(const coral::AttributeList &attr, nlohmann::json &json) const
Parses the legacy payload for the RT functions to a json format.
StatusCode defaultT0s(MuonCalib::MdtCalibDataContainer &writeCdoTube) const
static std::unique_ptr< MuonCalib::RtResolutionLookUp > getRtResolutionInterpolation(const std::vector< MuonCalib::SamplePoint > &sample_points)
StatusCode loadRt(const EventContext &ctx, MuonCalib::MdtCalibDataContainer &writeCdo) const
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyRt
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
GeoModel::TransientConstSharedPtr< MdtRtRelation > RtRelationPtr