ATLAS Offline Software
MdtCalibJsonDumpAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 #pragma once
5 
11 
14 
15 #include "nlohmann/json.hpp"
16 
17 namespace Muon{
18 
20  public:
22 
24 
25  virtual StatusCode initialize() override final;
26  virtual StatusCode execute() override final;
27  virtual StatusCode finalize() override final;
28  private:
31  using RtGrouper = std::map<const MuonCalib::MdtRtRelation*, std::set<Identifier>, CalibParamSorter>;
33  using T0Grouper = std::map<Identifier, T0PerChamb>;
34 
35  std::string dump(const std::vector<double>& values) const;
36  std::string dump(const double v) const;
37  std::string toString(const EventIDRange& range) const;
38 
40  StatusCode dumpRtRelations(const EventContext& ctx, const RtGrouper& rtRelMap, const EventIDRange& eventRange);
41 
42  StatusCode dumpTubeT0s(const EventContext& ctx,
43  const T0Grouper& t0Map, const EventIDRange& eventRange);
44 
45  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
47  "Conditions object containing the calibrations"};
48 
49  Gaudi::Property<std::string> m_rtJSON{this, "RtJSON", "RtRelations.json"};
50  Gaudi::Property<std::string> m_t0JSON{this, "TubeT0JSON", "TubeT0.json"};
51  Gaudi::Property<bool> m_savePerIOV{this, "JsonPerIOV", true};
52 
53  Gaudi::Property<unsigned> m_whiteSpace{this, "WhiteSpaces", 2};
54  Gaudi::Property<unsigned> m_precision{this, "FloatPrecision", 4};
55 
56 
57  std::vector<EventIDRange> m_seenIDs{};
58 
59  MuonVal::MuonTesterTree m_rtDumpTree{"RtCalibConstants", "MDTRTCALIBDUMP"};
84 
85  MuonVal::MuonTesterTree m_t0DumpTree{"T0CalibConstants", "MDTT0CALIBDUMP"};
89 
93 
101 
102 
103  };
104 }
Muon::MdtCalibJsonDumpAlg::m_rtDumpTree
MuonVal::MuonTesterTree m_rtDumpTree
Definition: MdtCalibJsonDumpAlg.h:59
AthHistogramAlgorithm::AthHistogramAlgorithm
AthHistogramAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Definition: AthHistogramAlgorithm.cxx:31
CalibParamSorter.h
Muon::MdtCalibJsonDumpAlg::m_t0_tubeLayer
MuonVal::VectorBranch< unsigned short > & m_t0_tubeLayer
Definition: MdtCalibJsonDumpAlg.h:95
Muon::MdtCalibJsonDumpAlg::dumpRtRelations
StatusCode dumpRtRelations(const EventContext &ctx, const RtGrouper &rtRelMap, const EventIDRange &eventRange)
writes the RT relations into the JSON & output root file
Definition: MdtCalibJsonDumpAlg.cxx:141
Muon::MdtCalibJsonDumpAlg::m_rt_pars
MuonVal::VectorBranch< double > & m_rt_pars
parameters of the rt-function
Definition: MdtCalibJsonDumpAlg.h:63
Muon::MdtCalibJsonDumpAlg::m_tr_pars
MuonVal::VectorBranch< double > & m_tr_pars
parameters of the tr-function
Definition: MdtCalibJsonDumpAlg.h:67
Muon::MdtCalibJsonDumpAlg::m_rt_stName
MuonVal::VectorBranch< std::string > & m_rt_stName
Station name string of the associated chambers.
Definition: MdtCalibJsonDumpAlg.h:73
MuonCalib::CalibParamSorter
Helper struct to group Mdt calibration constants which are equivalent within the target precision.
Definition: CalibParamSorter.h:12
MdtCalibDataContainer.h
Muon::MdtCalibJsonDumpAlg::m_readKey
SG::ReadCondHandleKey< MuonCalib::MdtCalibDataContainer > m_readKey
Definition: MdtCalibJsonDumpAlg.h:46
Muon::MdtCalibJsonDumpAlg
Definition: MdtCalibJsonDumpAlg.h:19
Muon::MdtCalibJsonDumpAlg::T0Grouper
std::map< Identifier, T0PerChamb > T0Grouper
Definition: MdtCalibJsonDumpAlg.h:33
Muon::MdtCalibJsonDumpAlg::m_t0_adc
MuonVal::ScalarBranch< float > & m_t0_adc
Definition: MdtCalibJsonDumpAlg.h:91
Muon::MdtCalibJsonDumpAlg::m_rt_stPhi
MuonVal::VectorBranch< unsigned short > & m_rt_stPhi
Station phi of the associated chamber.
Definition: MdtCalibJsonDumpAlg.h:77
Muon::MdtCalibJsonDumpAlg::m_t0_multiLayer
MuonVal::VectorBranch< unsigned short > & m_t0_multiLayer
Definition: MdtCalibJsonDumpAlg.h:94
EventIDBranch.h
MuonVal::VectorBranch< double >
MuonTesterTree.h
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::MdtCalibJsonDumpAlg::m_whiteSpace
Gaudi::Property< unsigned > m_whiteSpace
Definition: MdtCalibJsonDumpAlg.h:53
Muon::MdtCalibJsonDumpAlg::m_rt_iov_end
MuonVal::EventIDBranch m_rt_iov_end
Data mebmers to save the IOV range (End point)
Definition: MdtCalibJsonDumpAlg.h:83
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:808
AthHistogramAlgorithm.h
Muon::MdtCalibJsonDumpAlg::m_t0_stName
MuonVal::ScalarBranch< std::string > & m_t0_stName
Definition: MdtCalibJsonDumpAlg.h:86
Muon::MdtCalibJsonDumpAlg::m_tr_type
MuonVal::ScalarBranch< std::string > & m_tr_type
String defining the type of the tr function.
Definition: MdtCalibJsonDumpAlg.h:65
Muon::MdtCalibJsonDumpAlg::m_t0_code
MuonVal::ScalarBranch< unsigned short > & m_t0_code
Definition: MdtCalibJsonDumpAlg.h:92
Muon::MdtCalibJsonDumpAlg::T0PerChamb
std::map< const SingleTubeCalib *, std::set< Identifier >, CalibParamSorter > T0PerChamb
Definition: MdtCalibJsonDumpAlg.h:32
Muon::MdtCalibJsonDumpAlg::m_t0_stEta
MuonVal::ScalarBranch< short > & m_t0_stEta
Definition: MdtCalibJsonDumpAlg.h:87
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
Muon::MdtCalibJsonDumpAlg::m_savePerIOV
Gaudi::Property< bool > m_savePerIOV
Definition: MdtCalibJsonDumpAlg.h:51
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
Muon::MdtCalibJsonDumpAlg::m_t0DumpTree
MuonVal::MuonTesterTree m_t0DumpTree
Definition: MdtCalibJsonDumpAlg.h:85
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
Muon::MdtCalibJsonDumpAlg::m_precision
Gaudi::Property< unsigned > m_precision
Definition: MdtCalibJsonDumpAlg.h:54
MuonVal::MuonTesterTree::newVector
VectorBranch< T > & newVector(const std::string &name)
Creates new branches and returns their reference.
AthHistogramAlgorithm
Definition: AthHistogramAlgorithm.h:32
Muon::MdtCalibJsonDumpAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MdtCalibJsonDumpAlg.h:45
Muon::MdtCalibJsonDumpAlg::m_t0_t0
MuonVal::ScalarBranch< float > & m_t0_t0
Definition: MdtCalibJsonDumpAlg.h:90
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
ReadCondHandleKey.h
Muon::MdtCalibJsonDumpAlg::m_t0_tube
MuonVal::VectorBranch< unsigned short > & m_t0_tube
Definition: MdtCalibJsonDumpAlg.h:96
Muon::MdtCalibJsonDumpAlg::~MdtCalibJsonDumpAlg
virtual ~MdtCalibJsonDumpAlg()
Muon::MdtCalibJsonDumpAlg::dump
std::string dump(const std::vector< double > &values) const
Definition: MdtCalibJsonDumpAlg.cxx:205
MuonVal::ScalarBranch< std::string >
MuonVal::EventIDBranch
Branch class to dump a EventIDBase object into a MuonTesterTree format.
Definition: EventIDBranch.h:21
MuonVal::MuonTesterTree::newScalar
ScalarBranch< T > & newScalar(const std::string &name)
Muon::MdtCalibJsonDumpAlg::m_t0_iov_end
MuonVal::EventIDBranch m_t0_iov_end
Data mebmers to save the IOV range (End point)
Definition: MdtCalibJsonDumpAlg.h:100
Muon::MdtCalibJsonDumpAlg::m_t0_stPhi
MuonVal::ScalarBranch< unsigned short > & m_t0_stPhi
Definition: MdtCalibJsonDumpAlg.h:88
Muon::MdtCalibJsonDumpAlg::finalize
virtual StatusCode finalize() override final
Definition: MdtCalibJsonDumpAlg.cxx:75
Muon::MdtCalibJsonDumpAlg::m_rt_stMl
MuonVal::VectorBranch< unsigned short > & m_rt_stMl
Multi layer of the associated chamber.
Definition: MdtCalibJsonDumpAlg.h:79
SG::ReadCondHandleKey< MuonCalib::MdtCalibDataContainer >
python.PyAthena.v
v
Definition: PyAthena.py:154
Muon::MdtCalibJsonDumpAlg::RtGrouper
std::map< const MuonCalib::MdtRtRelation *, std::set< Identifier >, CalibParamSorter > RtGrouper
Definition: MdtCalibJsonDumpAlg.h:31
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:27
Muon::MdtCalibJsonDumpAlg::execute
virtual StatusCode execute() override final
Definition: MdtCalibJsonDumpAlg.cxx:80
Muon::MdtCalibJsonDumpAlg::m_rt_resoPars
MuonVal::VectorBranch< double > & m_rt_resoPars
parameters of the rt resolution function
Definition: MdtCalibJsonDumpAlg.h:71
private
#define private
Definition: xAODTruthCnvAlg.h:20
MuonCalib::MdtTubeCalibContainer::SingleTubeCalib
Definition: MdtTubeCalibContainer.h:19
Muon::MdtCalibJsonDumpAlg::initialize
virtual StatusCode initialize() override final
Definition: MdtCalibJsonDumpAlg.cxx:59
Muon::MdtCalibJsonDumpAlg::m_t0_iov_start
MuonVal::EventIDBranch m_t0_iov_start
Data mebmers to save the IOV range (Start point)
Definition: MdtCalibJsonDumpAlg.h:98
Muon::MdtCalibJsonDumpAlg::m_rt_stEta
MuonVal::VectorBranch< short > & m_rt_stEta
Station eta of the associated chambers.
Definition: MdtCalibJsonDumpAlg.h:75
Muon::MdtCalibJsonDumpAlg::toString
std::string toString(const EventIDRange &range) const
Definition: MdtCalibJsonDumpAlg.cxx:296
Muon::MdtCalibJsonDumpAlg::m_rtJSON
Gaudi::Property< std::string > m_rtJSON
Definition: MdtCalibJsonDumpAlg.h:49
Muon::MdtCalibJsonDumpAlg::m_rt_resoType
MuonVal::ScalarBranch< std::string > & m_rt_resoType
string defining the type of the rt resolution function
Definition: MdtCalibJsonDumpAlg.h:69
Muon::MdtCalibJsonDumpAlg::m_seenIDs
std::vector< EventIDRange > m_seenIDs
Definition: MdtCalibJsonDumpAlg.h:57
Muon::MdtCalibJsonDumpAlg::m_t0JSON
Gaudi::Property< std::string > m_t0JSON
Definition: MdtCalibJsonDumpAlg.h:50
IMuonIdHelperSvc.h
Muon::MdtCalibJsonDumpAlg::m_rt_type
MuonVal::ScalarBranch< std::string > & m_rt_type
string defining the type of the rt function
Definition: MdtCalibJsonDumpAlg.h:61
Muon::MdtCalibJsonDumpAlg::m_rt_iov_start
MuonVal::EventIDBranch m_rt_iov_start
Data mebmers to save the IOV range (Start point)
Definition: MdtCalibJsonDumpAlg.h:81
Muon::MdtCalibJsonDumpAlg::dumpTubeT0s
StatusCode dumpTubeT0s(const EventContext &ctx, const T0Grouper &t0Map, const EventIDRange &eventRange)
Definition: MdtCalibJsonDumpAlg.cxx:224
ServiceHandle
Definition: ClusterMakerTool.h:37
Identifier
Definition: IdentifierFieldParser.cxx:14