ATLAS Offline Software
Loading...
Searching...
No Matches
MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MdtCalibDbAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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
34public:
35 MdtCalibDbAlg(const std::string& name, ISvcLocator* pSvcLocator);
36 virtual ~MdtCalibDbAlg() = default;
37 virtual StatusCode initialize() override;
38 virtual StatusCode execute(const EventContext& ctx) const override;
39
40private:
41 StatusCode declareDependency(const EventContext& ctx,
43 StatusCode loadRt(const EventContext& ctx, MuonCalib::MdtCalibDataContainer& writeCdo) const;
44 StatusCode loadTube(const EventContext& ctx, MuonCalib::MdtCalibDataContainer& writeCdo) const;
45
46 StatusCode defaultT0s(MuonCalib::MdtCalibDataContainer& writeCdoTube) const;
47
49 using LoadedRtMap = std::map<Identifier, RtRelationPtr>;
50
51 StatusCode defaultRt(MuonCalib::MdtCalibDataContainer& writeCdoRt,
52 LoadedRtMap& loadedRts) const;
53
54 std::optional<double> getInnerTubeRadius(const Identifier& id) const;
55
57 StatusCode legacyRtPayloadToJSON(const coral::AttributeList& attr, nlohmann::json & json) const;
59 StatusCode legacyTubePayloadToJSON(const coral::AttributeList& attr,nlohmann::json & json) const;
60
61
62 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
63 ToolHandle<MuonCalib::IIdToFixedIdTool> m_idToFixedIdTool{this, "IdToFixedIdTool", "MuonCalib::IdToFixedIdTool"};
64
67
68 Gaudi::Property<bool> m_useNewGeo{this, "UseR4DetMgr", false,
69 "Switch between the legacy and the new geometry"};
70
72
73 Gaudi::Property<bool> m_checkTubes{this, "checkTubes", true,"If true the number of tubes must agree between the conditions DB & geometry"};
74 // new conditions format 2020
75 Gaudi::Property<bool> m_newFormat2020{this, "NewFormat2020", false, "Use the new calibration data format "};
76
77 // like MdtCalibrationDbSvc
78 // for corData in loadRt
79 Gaudi::Property<bool> m_create_b_field_function{this, "CreateBFieldFunctions", false,
80 "If set to true, the B-field correction functions are initialized for each rt-relation that is loaded."};
81
82 Gaudi::Property<bool> m_createSlewingFunction{this, "CreateSlewingFunctions", false,
83 "If set to true, the slewing correction functions are initialized for each rt-relation that is loaded."};
84
85
86 // if m_TimeSlewingCorrection is set to true then it is assumed that the
87 // time slewing correction is applied. If false not. If this flag does
88 // not match the bit in the creation parameters, the rt-relation and t0
89 // will be corrected.
90 // NOTE: This was a preliminary solution for 17.2. In principle each
91 // MdtDriftCircleOnTrackCreator could decide individually if it wants to
92 // have TS-correction. In the default reco-jobs however, this is
93 // configured by one muonRecFlag, that will be used to set this job-option.
94 Gaudi::Property<bool> m_TimeSlewingCorrection{this, "TimeSlewingCorrection", false};
95 Gaudi::Property<bool> m_UseMLRt{this, "UseMLRt", false, "Enable use of ML-RTs from COOL"};
96
97 Gaudi::Property<std::vector<float>> m_MeanCorrectionVsR{this, "MeanCorrectionVsR", {}};
98
99 Gaudi::Property<double> m_TsCorrectionT0{this, "TimeSlewCorrectionT0", 0.};
100
101 Gaudi::Property<double> m_defaultT0{this, "defaultT0", 40., "default T0 value to be used in absence of DB information"};
102 Gaudi::Property<double> m_t0Shift{this, "T0Shift", 0., "for simulation: common shift of all T0s, in ns"};
103 Gaudi::Property<double> m_t0Spread{this, "T0Spread", 0., "for simulation: sigma for random smeraing of T0s, in ns"};
104
105 Gaudi::Property<double> m_rtShift{this, "RTShift", 0., "for simulations: maximum RT distortion, in mm"};
106 Gaudi::Property<double> m_rtScale{this, "RTScale", 1., "for simulations: a muliplicitive scale to the drift r"};
107 Gaudi::Property<double> m_prop_beta{this, "PropagationSpeedBeta", 1., "Speed of the signal propagation"};
108
109 ServiceHandle<IAthRNGSvc> m_AthRNGSvc{this, "AthRNGSvc", "AthRNGSvc"};
110 StringProperty m_randomStream{this, "RandomStream", "MDTCALIBDBALG"};
112
113 StringProperty m_RTfileName{this, "RT_InputFile", "MuonCondAlg/Muon_RT_default.data",
114 "single input ascii file for default RT to be applied in absence of DB information"}; // temporary!!!
115
116 static std::unique_ptr<MuonCalib::RtResolutionLookUp> getRtResolutionInterpolation(const std::vector<MuonCalib::SamplePoint>& sample_points);
117
118 SG::ReadCondHandleKey<CondAttrListCollection> m_readKeyRt{this, "ReadKeyRt", "/MDT/RTBLOB", "DB folder containing the RT calibrations"};
119 SG::ReadCondHandleKey<CondAttrListCollection> m_readKeyTube{this, "ReadKeyTube", "/MDT/T0BLOB", "DB folder containing the tube constants"};
121 "Conditions object containing the calibrations"};
122
123 SG::ReadCondHandleKey<MdtCondDbData> m_readKeyDCS{this, "ReadKeyDCS", "MdtCondDbData", "Key of the input DCS data"};
124};
125
126#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.
MdtCalibDbAlg(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< bool > m_checkTubes
only needed to retrieve information on number of tubes etc. (no alignment needed)
virtual ~MdtCalibDbAlg()=default
SG::WriteCondHandleKey< MuonCalib::MdtCalibDataContainer > m_writeKey
static std::unique_ptr< MuonCalib::RtResolutionLookUp > getRtResolutionInterpolation(const std::vector< MuonCalib::SamplePoint > &sample_points)
ToolHandle< MuonCalib::IIdToFixedIdTool > m_idToFixedIdTool
StatusCode loadTube(const EventContext &ctx, MuonCalib::MdtCalibDataContainer &writeCdo) const
StatusCode defaultT0s(MuonCalib::MdtCalibDataContainer &writeCdoTube) const
StatusCode declareDependency(const EventContext &ctx, SG::WriteCondHandle< MuonCalib::MdtCalibDataContainer > &writeHandle) const
std::optional< double > getInnerTubeRadius(const Identifier &id) const
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyRt
StatusCode loadRt(const EventContext &ctx, MuonCalib::MdtCalibDataContainer &writeCdo) const
StatusCode defaultRt(MuonCalib::MdtCalibDataContainer &writeCdoRt, LoadedRtMap &loadedRts) const
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyTube
StatusCode legacyRtPayloadToJSON(const coral::AttributeList &attr, nlohmann::json &json) const
Parses the legacy payload for the RT functions to a json format.
StatusCode legacyTubePayloadToJSON(const coral::AttributeList &attr, nlohmann::json &json) const
virtual StatusCode execute(const EventContext &ctx) const override
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
GeoModel::TransientConstSharedPtr< MdtRtRelation > RtRelationPtr