ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
MuonCalibR4::MdtCalibDbAlg Class Reference

#include <MdtCalibDbAlg.h>

Inheritance diagram for MuonCalibR4::MdtCalibDbAlg:
Collaboration diagram for MuonCalibR4::MdtCalibDbAlg:

Public Member Functions

virtual ~MdtCalibDbAlg ()=default
 
virtual StatusCode initialize () override
 
virtual StatusCode execute (const EventContext &ctx) const override
 
virtual bool isReEntrant () const override
 
 AthReentrantAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters: More...
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual bool isClonable () const override
 Specify if the algorithm is clonable. More...
 
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
 
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
virtual bool filterPassed (const EventContext &ctx) const
 
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

using CorrectionPtr = MuonCalib::MdtCalibDataContainer::CorrectionPtr
 
using RtRelationPtr = MuonCalib::MdtCalibDataContainer::RtRelationPtr
 
using TubeContainerPtr = MuonCalib::MdtCalibDataContainer::TubeContainerPtr
 
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode parseRtPayload (const nlohmann::json &rtBlob, MuonCalib::MdtCalibDataContainer &outContainer) const
 
StatusCode parseRtPayload (TTree &rtTree, MuonCalib::MdtCalibDataContainer &outContainer) const
 Reads a r-t ROOT tree and stores its content in the calibration constant container. More...
 
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. More...
 
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. More...
 
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. More...
 
StatusCode parseT0Payload (const nlohmann::json &t0Blob, MuonCalib::MdtCalibDataContainer &outContainer) const
 Trnaslates a t0 - JSON payload into transient memory. More...
 
StatusCode parseT0Payload (TTree &t0Tree, MuonCalib::MdtCalibDataContainer &outContainer) const
 Translates a T0 TTree payload into transient memory. More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 
SG::WriteCondHandleKey< MuonCalib::MdtCalibDataContainerm_writeKey
 
Gaudi::Property< std::string > m_rtJSON {this, "RtJSON", ""}
 External Rt & T0 JSON files. More...
 
Gaudi::Property< std::string > m_t0JSON {this, "TubeT0JSON", ""}
 
Gaudi::Property< std::string > m_rtRootFile
 
Gaudi::Property< std::string > m_t0RootFile
 
Gaudi::Property< std::string > m_rtTreeName {this, "RtTreeName", "RtCalibConstants"}
 
Gaudi::Property< std::string > m_t0TreeName {this, "T0TreeName", "T0CalibConstants"}
 
SG::ReadCondHandleKey< CondAttrListCollectionm_readKeyRt {this, "ReadKeyRt", "/MDT/RTJSON", "DB folder containing the RT calibrations"}
 
SG::ReadCondHandleKey< CondAttrListCollectionm_readKeyTube {this, "ReadKeyTube", "/MDT/T0JSON", "DB folder containing the tube constants"}
 
Gaudi::Property< std::string > m_dbPayloadType {this, "dbPayloadType","TTree", "specify the format of the payload in the database. Can be TTree or JSON"}
 
Gaudi::Property< double > m_prop_beta {this, "PropagationSpeedBeta", 1., "Speed of the signal propagation"}
 
Gaudi::Property< unsigned > m_t0CalibPrec {this, "T0CalibPrecision", 4}
 Precision cut off to treat 2 t0 constants as equivalent. More...
 
Gaudi::Property< bool > m_create_b_field_function
 
Gaudi::Property< bool > m_createSlewingFunction
 
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 28 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h.

Member Typedef Documentation

◆ CorrectionPtr

◆ RtRelationPtr

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

◆ TubeContainerPtr

Constructor & Destructor Documentation

◆ ~MdtCalibDbAlg()

virtual MuonCalibR4::MdtCalibDbAlg::~MdtCalibDbAlg ( )
virtualdefault

Member Function Documentation

◆ AthReentrantAlgorithm()

AthReentrantAlgorithm::AthReentrantAlgorithm

Constructor with parameters:

Definition at line 90 of file AthReentrantAlgorithm.cxx.

22  :
24 {
25 
26  // Set up to run AthAlgorithmDHUpdate in sysInitialize before
27  // merging depedency lists. This extends the output dependency
28  // list with any symlinks implied by inheritance relations.
29  m_updateDataHandles =
30  std::make_unique<AthenaBaseComps::AthAlgorithmDHUpdate>
32  std::move (m_updateDataHandles));
33 }

◆ cardinality()

unsigned int AthReentrantAlgorithm::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Override this to return 0 for reentrant algorithms.

Definition at line 55 of file AthReentrantAlgorithm.cxx.

56 {
57  return 0;
58 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode MdtCalibDbAlg::execute ( const EventContext &  ctx) const
overridevirtual

Load the t0 blob

Parse the constants from the database

Definition at line 93 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx.

93  {
94  ATH_MSG_VERBOSE("Executing MdtCalibDbAlgR4");
95  SG::WriteCondHandle writeHandle{m_writeKey, ctx};
96  if(writeHandle.isValid()) {
97  ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid.");
98  return StatusCode::SUCCESS;
99  }
100  writeHandle.addDependency(EventIDRange(IOVInfiniteRange::infiniteRunLB()));
101  auto writeCdo = std::make_unique<MdtCalibDataContainer>(m_idHelperSvc.get(), RegionGranularity::OnePerMultiLayer);
103  writeCdo->setInversePropSpeed(1./ (m_prop_beta * Gaudi::Units::c_light));
104 
106  if (!m_readKeyRt.empty()) {
107  SG::ReadCondHandle readHandle{m_readKeyRt, ctx};
108  ATH_CHECK(readHandle.isValid());
109  writeHandle.addDependency(readHandle);
110  for(CondAttrListCollection::const_iterator itr = readHandle->begin();
111  itr != readHandle->end(); ++itr) {
112  const coral::AttributeList& atr = itr->second;
113  if(atr["data"].specification().type() != typeid(coral::Blob)) {
114  ATH_MSG_FATAL( "Data column is not of type blob!" );
115  return StatusCode::FAILURE;
116  }
117 
118  coral::Blob blob = atr["data"].data<coral::Blob>();
119 
120  if(m_dbPayloadType =="TTree"){
121  std::unique_ptr<TTree> tree;
122  if(!CoralUtilities::readBlobAsTTree(blob, tree, "RtCalibConstants")) {
123  ATH_MSG_FATAL( "Cannot retrieve data from coral blob!");
124  return StatusCode::FAILURE;
125  }
126  ATH_CHECK(parseRtPayload(*tree, *writeCdo));
127  } else if (m_dbPayloadType=="JSON") {
128  ATH_MSG_VERBOSE("Loading data as a BLOB, uncompressing...");
129  std::string data{};
130  if (!CoralUtilities::readBlobAsString(atr["data"].data<coral::Blob>(), data)) {
131  ATH_MSG_FATAL("Cannot uncompress BLOB! Aborting...");
132  return StatusCode::FAILURE;
133  }
135  ATH_CHECK(parseRtPayload(std::move(rtBlob),*writeCdo));
136  } else {
137  ATH_MSG_FATAL("Payload type " << m_dbPayloadType << " not understood. Options are: TTree or JSON");
138  return StatusCode::FAILURE;
139  }
140  }
141 
142  } else if (!m_rtRootFile.value().empty()) {
143  std::unique_ptr<TFile> inFile{TFile::Open(m_rtRootFile.value().c_str(), "READ")};
144  if(!inFile || inFile->IsZombie()) {
145  ATH_MSG_FATAL("Failed to open file "<<m_rtRootFile);
146  return StatusCode::FAILURE;
147  }
148  TTree* tree{nullptr};
149  inFile->GetObject(m_rtTreeName.value().c_str(), tree);
150  if (!tree) {
151  ATH_MSG_FATAL("The object "<<m_rtRootFile<<" does not contain "<<m_rtTreeName);
152  return StatusCode::FAILURE;
153  }
154  ATH_CHECK(parseRtPayload(*tree, *writeCdo));
155  } else if (!m_rtJSON.value().empty()) {
156  std::ifstream inFile{m_rtJSON};
157  if (!inFile.good()) {
158  ATH_MSG_FATAL("Failed to open "<<m_rtJSON);
159  return StatusCode::FAILURE;
160  }
161  nlohmann::json rtBlob{};
162  inFile >> rtBlob;
163  ATH_CHECK(parseRtPayload(std::move(rtBlob),*writeCdo));
164  }
165  if (!m_readKeyTube.empty()) {
166  SG::ReadCondHandle readHandle{m_readKeyTube, ctx};
167  ATH_CHECK(readHandle.isValid());
168  writeHandle.addDependency(readHandle);
169  for(CondAttrListCollection::const_iterator itr = readHandle->begin();
170  itr != readHandle->end(); ++itr) {
171  const coral::AttributeList& atr = itr->second;
172  if(atr["data"].specification().type() != typeid(coral::Blob)) {
173  ATH_MSG_FATAL( "Data column is not of type blob!" );
174  return StatusCode::FAILURE;
175  }
176 
177  coral::Blob blob = atr["data"].data<coral::Blob>();
178 
179  if(m_dbPayloadType =="TTree"){
180  std::unique_ptr<TTree> tree;
181  if(!CoralUtilities::readBlobAsTTree(blob, tree, "T0CalibConstants")) {
182  ATH_MSG_FATAL( "Cannot retrieve data from coral blob!");
183  return StatusCode::FAILURE;
184  }
185  ATH_CHECK(parseT0Payload(*tree, *writeCdo));
186  } else if (m_dbPayloadType=="JSON") {
187  ATH_MSG_VERBOSE("Loading data as a BLOB, uncompressing...");
188  std::string data{};
189  if (!CoralUtilities::readBlobAsString(atr["data"].data<coral::Blob>(), data)) {
190  ATH_MSG_FATAL("Cannot uncompress BLOB! Aborting...");
191  return StatusCode::FAILURE;
192  }
194  ATH_CHECK(parseT0Payload(std::move(rtBlob),*writeCdo));
195  } else {
196  ATH_MSG_FATAL("Payload type " << m_dbPayloadType << " not understood. Options are: TTree or JSON");
197  return StatusCode::FAILURE;
198  }
199 
200  }
201  } else if (!m_t0RootFile.value().empty()) {
202  std::unique_ptr<TFile> inFile{TFile::Open(m_t0RootFile.value().c_str(), "READ")};
203  if(!inFile || inFile->IsZombie()) {
204  ATH_MSG_FATAL("Failed to open file "<<m_t0RootFile);
205  return StatusCode::FAILURE;
206  }
207  TTree* tree{nullptr};
208  inFile->GetObject(m_t0TreeName.value().c_str(), tree);
209  if (!tree) {
210  ATH_MSG_FATAL("The object "<<m_rtRootFile<<" does not contain "<<m_t0TreeName);
211  return StatusCode::FAILURE;
212  }
213  ATH_CHECK(parseT0Payload(*tree, *writeCdo));
214  } else {
215  std::ifstream inFile{m_t0JSON};
216  if (!inFile.good()) {
217  ATH_MSG_FATAL("Failed to open "<<m_t0JSON);
218  return StatusCode::FAILURE;
219  }
220  nlohmann::json t0Blob{};
221  inFile >> t0Blob;
222  ATH_CHECK(parseT0Payload(std::move(t0Blob), *writeCdo));
223  }
224 
225  ATH_CHECK(writeHandle.record(std::move(writeCdo)));
226  ATH_MSG_INFO("Recorded succesfully "<<m_writeKey.fullKey()<<" "<<writeHandle.getRange());
227  return StatusCode::SUCCESS;
228 }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthReentrantAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 79 of file AthReentrantAlgorithm.cxx.

80 {
81  // If we didn't find any symlinks to add, just return the collection
82  // from the base class. Otherwise, return the extended collection.
83  if (!m_extendedExtraObjects.empty()) {
85  }
86  return Algorithm::extraOutputDeps();
87 }

◆ filterPassed()

virtual bool AthReentrantAlgorithm::filterPassed ( const EventContext &  ctx) const
inlinevirtualinherited

Definition at line 135 of file AthReentrantAlgorithm.h.

135  {
136  return execState( ctx ).filterPassed();
137  }

◆ initialize()

StatusCode MdtCalibDbAlg::initialize ( )
overridevirtual

If not trees names are given, then there's no need to try accessing the ROOT file

Definition at line 57 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx.

57  {
58  ATH_MSG_VERBOSE("Initialize...");
59  ATH_CHECK(m_idHelperSvc.retrieve());
61 
63  if (m_t0TreeName.value().empty()) {
64  m_t0RootFile.value().clear();
65  }
66  if (m_rtTreeName.value().empty()) {
67  m_rtRootFile.value().clear();
68  }
69  const bool initRt = (m_rtJSON.value().empty() && m_rtRootFile.value().empty());
70  const bool initT0 = (m_t0JSON.value().empty() && m_t0RootFile.value().empty());
73 
74  if (m_rtRootFile.value().size()) {
75  ATH_MSG_INFO("Load RT - calibration constants from ROOT File "<<m_rtRootFile);
76  m_rtJSON.clear();
77  } else if (m_rtJSON.value().size()) {
78  ATH_MSG_INFO("Load the RT- calibration constants from JSON file "<<m_rtJSON);
79  m_rtTreeName.clear();
80  } else {
81  ATH_MSG_INFO("Load RT - calibration constants from COOL: "<<m_readKeyRt.fullKey());
82  }
83  if (m_t0RootFile.value().size()) {
84  ATH_MSG_INFO("Load T0 - calibration constants from ROOT File "<<m_t0RootFile);
85  m_t0JSON.clear();
86  } else if (m_t0JSON.value().size()) {
87  ATH_MSG_INFO("Load the T0 - calibration constants from JSON file "<<m_t0JSON);
88  m_t0TreeName.clear();
89  }
90  return StatusCode::SUCCESS;
91 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

bool AthReentrantAlgorithm::isClonable ( ) const
overridevirtualinherited

◆ isReEntrant()

virtual bool MuonCalibR4::MdtCalibDbAlg::isReEntrant ( ) const
inlineoverridevirtual

Definition at line 36 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h.

36 { return false; }

◆ makeReso()

IRtResolutionPtr MdtCalibDbAlg::makeReso ( const std::string &  resoType,
const std::vector< double > &  pars,
MuonCalib::IRtRelationPtr  rt 
) const
private

Creates a new resoltuion function from the typeName & the list of parameters.

Parameters
trTypeTr-relation type to create
parsParameter vector to parse to the Tr-relation
rtPoint to the rt relation created before.

Definition at line 319 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx.

320  {
321  IRtResolutionPtr rtReso{};
322  if (resoType == "RtResolutionLookUp") {
323  rtReso = std::make_unique<RtResolutionLookUp>(resoParams);
324  } else if (resoType == "RtResolutionChebyshev") {
325  rtReso = std::make_unique<RtResolutionChebyshev>(resoParams);
326  } else if (resoType == "RadiusResolutionChebyshev") {
327  rtReso = std::make_unique<RadiusResolutionChebyshev>(resoParams, rt);
328  } else {
329  ATH_MSG_FATAL("The rt resolution type <"<<resoType<<"> is not yet supported.");
330  }
331  return rtReso;
332 }

◆ makeRt()

IRtRelationPtr MdtCalibDbAlg::makeRt ( const std::string &  rtType,
const std::vector< double > &  pars 
) const
private

Creates a new rt function from the typeName & the list of parameters.

Parameters
rtTypeRt-relation type to create
parsParameter vector to parse to the Rt-relation

Definition at line 285 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx.

285  {
286  IRtRelationPtr rtRel{};
287  if (rtType == "RtRelationLookUp") {
288  rtRel = std::make_unique<RtRelationLookUp>(rtParams);
289  } else if (rtType == "RtLegendre"){
290  rtRel = std::make_unique<RtLegendre>(rtParams);
291  } else if (rtType == "RtChebyshev") {
292  rtRel = std::make_unique<RtChebyshev>(rtParams);
293  }
294  if (rtRel) {
295  ATH_MSG_VERBOSE("Fetched new rt-relation <"<<rtType<<"> valid for drift times ranging from "
296  <<rtRel->tLower()<<"-"<<rtRel->tUpper()<<".");
297  } else {
298  ATH_MSG_FATAL("The rt-relation function type <"<<rtType<<"> is not yet supported.");
299  }
300  return rtRel;
301 }

◆ makeTr()

ITrRelationPtr MdtCalibDbAlg::makeTr ( const std::string &  trType,
const std::vector< double > &  pars 
) const
private

Creates a new tr function from the typeName & the list of parameters.

Parameters
trTypeTr-relation type to create
parsParameter vector to parse to the Tr-relation

Definition at line 303 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx.

303  {
304  ITrRelationPtr trRel{};
305  if (trType == "TrChebyshev") {
306  trRel = std::make_unique<TrChebyshev>(trParams);
307  } else if(trType == "TrLegendre") {
308  trRel = std::make_unique<TrLegendre>(trParams);
309  }
310  if (trRel) {
311  ATH_MSG_VERBOSE("Fetched new tr-relation <"<<trType<<"> valid for drift radii ranging from "
312  <<trRel->minRadius()<<"-"<<trRel->maxRadius()<<".");
313  } else {
314  ATH_MSG_FATAL("The rt-relation function type <"<<trType<<"> is not yet supported.");
315  }
316  return trRel;
317 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Gaudi::Algorithm >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ parseRtPayload() [1/2]

StatusCode MdtCalibDbAlg::parseRtPayload ( const nlohmann::json rtBlob,
MuonCalib::MdtCalibDataContainer outContainer 
) const
private

Loop over the R-T blob payload

Fetch the associated detector elements

Defining constants of the rt-relation

Defining constants of the rt-resolution

Load the rt constants to the assigned detector elements

Definition at line 333 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx.

334  {
335  const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
336 
338  for (auto& payload : rtBlob.items()) {
339  std::vector<Identifier> detIds{};
340 
341  const nlohmann::json calibConstants = payload.value();
343  for (auto& chambList : calibConstants["chambers"].items()) {
344  const nlohmann::json chambPayload = chambList.value();
345  const std::string station = chambPayload["station"];
346  const int eta = chambPayload["eta"];
347  const int phi = chambPayload["phi"];
348  const int ml = chambPayload["ml"];
349  const Identifier mlId{idHelper.channelID(station, eta, phi, ml, 1, 1)};
350  detIds.emplace_back(mlId);
351  }
352 
354  const nlohmann::json rtPayload = calibConstants["rtRelation"];
355  ITrRelationPtr trRel{};
356  IRtRelationPtr rtRel = makeRt(rtPayload["type"], rtPayload["params"]);
357  if (!rtRel) {
358  return StatusCode::FAILURE;
359  }
360  if (calibConstants.find("trRelation") != calibConstants.end()) {
361  const nlohmann::json trPayload = calibConstants["trRelation"];
362  trRel = makeTr(trPayload["type"], trPayload["params"]);
363  if (!trRel) {
364  return StatusCode::FAILURE;
365  }
366  }
368  const nlohmann::json resoPayload = calibConstants["rtReso"];
369  IRtResolutionPtr rtReso =makeReso(resoPayload["type"], resoPayload["params"], rtRel);
370  if (!rtReso) {
371  return StatusCode::FAILURE;
372  }
374  std::make_unique<MdtRtRelation>(std::move(rtRel), std::move(rtReso), std::move(trRel));
375 
376 
378  for (const Identifier& mlId : detIds) {
379  if (outContainer.hasDataForChannel(mlId,msgStream()) &&
380  outContainer.getCalibData(mlId, msgStream())->rtRelation) {
381  continue;
382  }
383  if (!outContainer.storeData(mlId, mdtRel, msgStream())) {
384  return StatusCode::FAILURE;
385  }
386  }
387  }
388  return StatusCode::SUCCESS;
389 }

◆ parseRtPayload() [2/2]

StatusCode MdtCalibDbAlg::parseRtPayload ( TTree &  rtTree,
MuonCalib::MdtCalibDataContainer outContainer 
) const
private

Reads a r-t ROOT tree and stores its content in the calibration constant container.

Parameters
rtTreeTTree to read the data from
outContainerOutput container append the Rt relations

Definition at line 231 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx.

232  {
233  const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
234 
235  std::string* rtType{nullptr}, *trType{nullptr}, *resoType{nullptr};
236 
237  std::vector<double>* rtParams{nullptr}, *trParams{nullptr}, *resoParams{nullptr};
238 
239  std::vector<std::string>* stationName{nullptr};
240  std::vector<short>* stationEta{nullptr};
241  std::vector<unsigned short>* stationPhi{nullptr}, *multiLayer{nullptr};
242 
243  SET_BRANCHADDRESS(rtTree, rtType);
244  SET_BRANCHADDRESS(rtTree, trType);
245  SET_BRANCHADDRESS(rtTree, resoType);
246  SET_BRANCHADDRESS(rtTree, rtParams);
247  SET_BRANCHADDRESS(rtTree, trParams);
248  SET_BRANCHADDRESS(rtTree, resoParams);
250  SET_BRANCHADDRESS(rtTree, stationEta);
251  SET_BRANCHADDRESS(rtTree, stationPhi);
252  SET_BRANCHADDRESS(rtTree, multiLayer);
253 
254  for (Long64_t e = 0; e< rtTree.GetEntries(); ++e) {
255  rtTree.GetEntry(e);
256  ATH_MSG_VERBOSE("Load "<<e<<"-th calibration constant Valid for "<<stationName->size()<< " det elements.");
257  std::vector<Identifier> detIds{};
258  for (unsigned ch = 0; ch < stationName->size(); ++ch){
259  const Identifier detElId = idHelper.channelID(stationName->at(ch), stationEta->at(ch), stationPhi->at(ch),
260  multiLayer->at(ch), 1, 1);
261  detIds.emplace_back(detElId);
262  }
263  IRtRelationPtr rtRel{makeRt(*rtType, *rtParams)};
264  if(!rtRel) {
265  return StatusCode::FAILURE;
266  }
267  ITrRelationPtr trRel = (*trType).size() ? makeTr(*trType, *trParams) : nullptr;
268  if ((*trType).size() && !trRel) {
269  return StatusCode::FAILURE;
270  }
271  IRtResolutionPtr rtReso = makeReso(*resoType, *resoParams, rtRel);
272  if (!rtReso) {
273  return StatusCode::FAILURE;
274  }
276  std::make_unique<MdtRtRelation>(std::move(rtRel), std::move(rtReso), std::move(trRel));
277  for (const Identifier& detId : detIds) {
278  if (!outContainer.storeData(detId, mdtRel, msgStream())){
279  return StatusCode::FAILURE;
280  }
281  }
282  }
283  return StatusCode::SUCCESS;
284 }

◆ parseT0Payload() [1/2]

StatusCode MdtCalibDbAlg::parseT0Payload ( const nlohmann::json t0Blob,
MuonCalib::MdtCalibDataContainer outContainer 
) const
private

Trnaslates a t0 - JSON payload into transient memory.

Parameters
t0BlobJSON payload to be translated
outContainerContainer into which the t0 constants are stored

Loop over the R-T blob payload

Definition at line 448 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx.

449  {
450  const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
452  using SingleTubeCalibPtr = MdtTubeCalibContainer::SingleTubeCalibPtr;
453 
454  std::set<SingleTubeCalibPtr, CalibParamSorter> t0Constants{CalibParamSorter{std::pow(0.1, m_t0CalibPrec)}};
456  for (auto& dbEntry : t0Blob.items()) {
457  const nlohmann::json payload = dbEntry.value();
458  const std::string station = payload["station"];
459  const int eta = payload["eta"];
460  const int phi = payload["phi"];
461  bool isValid{false};
462  const Identifier detId = idHelper.elementID(station, eta, phi, isValid);
463  if (!isValid) {
464  ATH_MSG_FATAL("Failed to create a valid identifier from "<<station<<", "<<eta<<", "<<phi);
465  return StatusCode::FAILURE;
466  }
467  TubeContainerPtr calibChannels = std::make_unique<MdtTubeCalibContainer>(m_idHelperSvc.get(), detId);
468 
469  for (auto& calibEntry : payload["calibConstants"].items()){
470  const nlohmann::json calibPayload = calibEntry.value();
471  SingleTubeCalibPtr calibConstant{std::make_unique<SingleTubeCalib>()};
472  calibConstant->t0 = calibPayload["t0"];
473  calibConstant->adcCal = calibPayload["adc"];
474  calibConstant->statusCode = calibPayload["code"];
475  calibConstant = *t0Constants.insert(calibConstant).first;
476  for (auto& tubeEntry : calibPayload["tubes"].items()) {
477  const nlohmann::json tubePayload = tubeEntry.value();
478  const int ml = tubePayload["ml"];
479  const int tubeLayer = tubePayload["tl"];
480  const std::string tubeStr = tubePayload["no"];
481  const std::vector<std::string> tubeTokens{CxxUtils::tokenize(tubeStr, ";")};
482  std::vector<int> tubes{};
483  for (const std::string& token: tubeTokens) {
484  if (token.find("-") == std::string::npos) {
485  tubes.emplace_back(CxxUtils::atoi(token));
486  } else {
487  const std::vector<std::string> rangeToken{CxxUtils::tokenize(token,"-")};
488  if (rangeToken.size() != 2) {
489  ATH_MSG_FATAL("No valid tube range token: "<<token);
490  return StatusCode::FAILURE;
491  }
492  const int tubeLow{CxxUtils::atoi(rangeToken[0])}, tubeHigh{CxxUtils::atoi(rangeToken[1])};
493  if (tubeLow >= tubeHigh){
494  ATH_MSG_FATAL("Invalid range "<<tubeLow<<"-"<<tubeHigh
495  <<". The lower end must be strictly smaller than the upper one");
496  return StatusCode::FAILURE;
497  }
498  for (int tube = tubeLow; tube<=tubeHigh; ++tube) {
499  tubes.push_back(tube);
500  }
501  }
502  }
503  for (const int tube : tubes) {
504  const Identifier tubeId = idHelper.channelID(detId,ml, tubeLayer, tube, isValid);
505  if (!isValid) {
506  ATH_MSG_FATAL("No valid tube identifier from "<<m_idHelperSvc->toStringDetEl(detId)
507  <<", layer: "<<tubeLayer<<", tube: "<<tube);
508  return StatusCode::FAILURE;
509  }
510  if (!calibChannels->setCalib(calibConstant, tubeId, msgStream())){
511  return StatusCode::FAILURE;
512  }
513  }
514  }
515  }
516  if (!outContainer.storeData(detId, std::move(calibChannels), msgStream())) {
517  return StatusCode::FAILURE;
518  }
519  }
520 
521  return StatusCode::SUCCESS;
522 }

◆ parseT0Payload() [2/2]

StatusCode MdtCalibDbAlg::parseT0Payload ( TTree &  t0Tree,
MuonCalib::MdtCalibDataContainer outContainer 
) const
private

Translates a T0 TTree payload into transient memory.

Parameters
t0TreeReference to the TTree to translate
outContainerContainer into which the t0 constants are stored

Definition at line 391 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx.

392  {
393 
394  std::string* stationName{nullptr};
395  short stationEta{0};
396  unsigned short stationPhi{0}, code{0};
397  float t0{0.f}, adc{0.f};
398  std::vector<unsigned short>* multiLayer{nullptr}, *tubeLayer{nullptr}, *tube{nullptr};
399 
401  SET_BRANCHADDRESS(t0Tree, stationEta);
402  SET_BRANCHADDRESS(t0Tree, stationPhi);
403  SET_BRANCHADDRESS(t0Tree, code);
404  SET_BRANCHADDRESS(t0Tree, t0);
405  SET_BRANCHADDRESS(t0Tree, adc);
406  SET_BRANCHADDRESS(t0Tree, multiLayer);
407  SET_BRANCHADDRESS(t0Tree, tubeLayer);
408  SET_BRANCHADDRESS(t0Tree, tube);
409 
411  using SingleTubeCalibPtr = MdtTubeCalibContainer::SingleTubeCalibPtr;
412  const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
413 
414  std::set<SingleTubeCalibPtr, CalibParamSorter> t0Constants{CalibParamSorter{std::pow(0.1, m_t0CalibPrec)}};
415  for (Long64_t e = 0 ; e <t0Tree.GetEntries(); ++e) {
416  t0Tree.GetEntry(e);
417  bool isValid{false};
418  const Identifier detId = idHelper.elementID(*stationName, stationEta, stationPhi, isValid);
419  if (!isValid) {
420  ATH_MSG_FATAL("Failed to create a valid Identifier from "<<(*stationName)<<", "<<stationEta<<", "
421  <<stationPhi);
422  return StatusCode::FAILURE;
423  }
424  TubeContainerPtr calibChannels = std::make_unique<MdtTubeCalibContainer>(m_idHelperSvc.get(), detId);
425  SingleTubeCalibPtr t0Calib = std::make_unique<SingleTubeCalib>();
426  t0Calib->adcCal = adc;
427  t0Calib->t0 = t0;
428  t0Calib->statusCode = code;
429  t0Calib = (*t0Constants.insert(t0Calib).first);
430  for (unsigned int ch = 0; ch < multiLayer->size(); ++ch){
431  const Identifier tubeId{idHelper.channelID(detId, multiLayer->at(ch),
432  tubeLayer->at(ch), tube->at(ch), isValid)};
433  if (!isValid) {
434  ATH_MSG_FATAL("Failed to get a valid tube Identifier for "<<m_idHelperSvc->toStringChamber(detId)
435  <<", ml: "<<multiLayer->at(ch)<<", tl: "<<tubeLayer->at(ch)<<", tube: "<<tube->at(ch));
436  return StatusCode::FAILURE;
437  }
438  if (!calibChannels->setCalib(t0Calib, tubeId, msgStream())) {
439  return StatusCode::FAILURE;
440  }
441  }
442  if (!outContainer.storeData(detId, calibChannels, msgStream())){
443  return StatusCode::FAILURE;
444  }
445  }
446  return StatusCode::SUCCESS;
447 }

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ setFilterPassed()

virtual void AthReentrantAlgorithm::setFilterPassed ( bool  state,
const EventContext &  ctx 
) const
inlinevirtualinherited

Definition at line 139 of file AthReentrantAlgorithm.h.

139  {
140  execState( ctx ).setFilterPassed( state );
141  }

◆ sysExecute()

StatusCode AthReentrantAlgorithm::sysExecute ( const EventContext &  ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 67 of file AthReentrantAlgorithm.cxx.

68 {
69  return Gaudi::Algorithm::sysExecute (ctx);
70 }

◆ sysInitialize()

StatusCode AthReentrantAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in InputMakerBase, and HypoBase.

Definition at line 96 of file AthReentrantAlgorithm.cxx.

96  {
98 
99  if (sc.isFailure()) {
100  return sc;
101  }
102 
103  ServiceHandle<ICondSvc> cs("CondSvc",name());
104  for (auto h : outputHandles()) {
105  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
106  // do this inside the loop so we don't create the CondSvc until needed
107  if ( cs.retrieve().isFailure() ) {
108  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
109  return StatusCode::SUCCESS;
110  }
111  if (cs->regHandle(this,*h).isFailure()) {
112  sc = StatusCode::FAILURE;
113  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
114  << " with CondSvc");
115  }
116  }
117  }
118  return sc;
119 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_create_b_field_function

Gaudi::Property<bool> MuonCalibR4::MdtCalibDbAlg::m_create_b_field_function
private
Initial value:
{this, "CreateBFieldFunctions", false,
"If set to true, the B-field correction functions are initialized for each rt-relation that is loaded."}

Definition at line 109 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h.

◆ m_createSlewingFunction

Gaudi::Property<bool> MuonCalibR4::MdtCalibDbAlg::m_createSlewingFunction
private
Initial value:
{this, "CreateSlewingFunctions", false,
"If set to true, the slewing correction functions are initialized for each rt-relation that is loaded."}

Definition at line 112 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h.

◆ m_dbPayloadType

Gaudi::Property<std::string> MuonCalibR4::MdtCalibDbAlg::m_dbPayloadType {this, "dbPayloadType","TTree", "specify the format of the payload in the database. Can be TTree or JSON"}
private

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthReentrantAlgorithm::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 153 of file AthReentrantAlgorithm.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> MuonCalibR4::MdtCalibDbAlg::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

◆ m_prop_beta

Gaudi::Property<double> MuonCalibR4::MdtCalibDbAlg::m_prop_beta {this, "PropagationSpeedBeta", 1., "Speed of the signal propagation"}
private

◆ m_readKeyRt

SG::ReadCondHandleKey<CondAttrListCollection> MuonCalibR4::MdtCalibDbAlg::m_readKeyRt {this, "ReadKeyRt", "/MDT/RTJSON", "DB folder containing the RT calibrations"}
private

◆ m_readKeyTube

SG::ReadCondHandleKey<CondAttrListCollection> MuonCalibR4::MdtCalibDbAlg::m_readKeyTube {this, "ReadKeyTube", "/MDT/T0JSON", "DB folder containing the tube constants"}
private

◆ m_rtJSON

Gaudi::Property<std::string> MuonCalibR4::MdtCalibDbAlg::m_rtJSON {this, "RtJSON", ""}
private

External Rt & T0 JSON files.

Definition at line 90 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h.

◆ m_rtRootFile

Gaudi::Property<std::string> MuonCalibR4::MdtCalibDbAlg::m_rtRootFile
private
Initial value:
{this, "RtROOT", "",
"Path to an external root file to read the Rt relation from"}

Definition at line 93 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h.

◆ m_rtTreeName

Gaudi::Property<std::string> MuonCalibR4::MdtCalibDbAlg::m_rtTreeName {this, "RtTreeName", "RtCalibConstants"}
private

◆ m_t0CalibPrec

Gaudi::Property<unsigned> MuonCalibR4::MdtCalibDbAlg::m_t0CalibPrec {this, "T0CalibPrecision", 4}
private

Precision cut off to treat 2 t0 constants as equivalent.

Definition at line 107 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h.

◆ m_t0JSON

Gaudi::Property<std::string> MuonCalibR4::MdtCalibDbAlg::m_t0JSON {this, "TubeT0JSON", ""}
private

◆ m_t0RootFile

Gaudi::Property<std::string> MuonCalibR4::MdtCalibDbAlg::m_t0RootFile
private
Initial value:
{this, "TubeT0ROOT", "",
"Path to an external root file to read the T0 constants from"}

Definition at line 95 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h.

◆ m_t0TreeName

Gaudi::Property<std::string> MuonCalibR4::MdtCalibDbAlg::m_t0TreeName {this, "T0TreeName", "T0CalibConstants"}
private

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_writeKey

SG::WriteCondHandleKey<MuonCalib::MdtCalibDataContainer> MuonCalibR4::MdtCalibDbAlg::m_writeKey
private
Initial value:
{this, "WriteKey", "MdtCalibConstants",
"Conditions object containing the calibrations"}

Definition at line 86 of file MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
test_pyathena.eta
eta
Definition: test_pyathena.py:10
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Muon::nsw::STGTPSegments::moduleIDBits::stationPhi
constexpr uint8_t stationPhi
station Phi 1 to 8
Definition: NSWSTGTPDecodeBitmaps.h:161
GeoModel::TransientConstSharedPtr< IRtResolution >
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
MuonCalibR4::MdtCalibDbAlg::m_rtTreeName
Gaudi::Property< std::string > m_rtTreeName
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:98
SingleTubeCalib
MuonCalib::MdtTubeCalibContainer::SingleTubeCalib SingleTubeCalib
Definition: MdtCalibrationTool.cxx:29
MuonCalibR4::MdtCalibDbAlg::parseT0Payload
StatusCode parseT0Payload(const nlohmann::json &t0Blob, MuonCalib::MdtCalibDataContainer &outContainer) const
Trnaslates a t0 - JSON payload into transient memory.
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx:448
MuonCalibR4::MdtCalibDbAlg::parseRtPayload
StatusCode parseRtPayload(const nlohmann::json &rtBlob, MuonCalib::MdtCalibDataContainer &outContainer) const
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx:333
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
MuonCalibR4::MdtCalibDbAlg::m_t0TreeName
Gaudi::Property< std::string > m_t0TreeName
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:99
MuonCalibR4::MdtCalibDbAlg::m_t0RootFile
Gaudi::Property< std::string > m_t0RootFile
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:95
json
nlohmann::json json
Definition: HistogramDef.cxx:9
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
MuonCalib::MdtCalibDataContainer::storeData
bool storeData(const Identifier &mlID, CorrectionPtr corrFuncSet, MsgStream &msg)
Definition: MdtCalibDataContainer.cxx:52
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CxxUtils::tokenize
std::vector< std::string > tokenize(const std::string &the_str, std::string_view delimiters)
Splits the string into smaller substrings.
Definition: Control/CxxUtils/Root/StringUtils.cxx:15
MuonCalib::CalibParamSorter
Helper struct to group Mdt calibration constants which are equivalent within the target precision.
Definition: CalibParamSorter.h:12
makeTOC.inFile
string inFile
Definition: makeTOC.py:5
parse
std::map< std::string, std::string > parse(const std::string &list)
Definition: egammaLayerRecalibTool.cxx:1082
tree
TChain * tree
Definition: tile_monitor.h:30
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
AthCommonDataStore::renounce
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
Definition: AthCommonDataStore.h:380
MuonCalibR4::MdtCalibDbAlg::m_readKeyTube
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyTube
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:102
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
isValid
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition: AtlasPID.h:778
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
MuonCalibR4::MdtCalibDbAlg::m_t0JSON
Gaudi::Property< std::string > m_t0JSON
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:91
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
MuonCalibR4::MdtCalibDbAlg::m_dbPayloadType
Gaudi::Property< std::string > m_dbPayloadType
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:103
MuonCalibR4::MdtCalibDbAlg::makeReso
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.
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx:319
histSizes.code
code
Definition: histSizes.py:129
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
dumpNswErrorDb.calibEntry
calibEntry
Definition: dumpNswErrorDb.py:29
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
CoralUtilities::readBlobAsString
bool readBlobAsString(const coral::Blob &, std::string &)
Definition: blobaccess.cxx:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
IOVInfiniteRange::infiniteRunLB
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
Definition: IOVInfiniteRange.h:39
MdtIdHelper
Definition: MdtIdHelper.h:61
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonCalibR4::MdtCalibDbAlg::m_readKeyRt
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyRt
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:101
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
AthReentrantAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Definition: AthReentrantAlgorithm.h:153
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AthReentrantAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthReentrantAlgorithm.cxx:96
MuonCalibR4::MdtCalibDbAlg::m_rtRootFile
Gaudi::Property< std::string > m_rtRootFile
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:93
MuonCalibR4::MdtCalibDbAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:85
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:71
python.PhysicalConstants.c_light
float c_light
Definition: PhysicalConstants.py:63
MuonCalib::MdtCalibDataContainer::getCalibData
const MdtFullCalibData * getCalibData(const Identifier &measId, MsgStream &msg) const
Returns the calibration data associated with this station
Definition: MdtCalibDataContainer.cxx:41
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
MuonCalib::MdtTubeCalibContainer::setCalib
bool setCalib(SingleTubeCalibPtr val, const Identifier &tubeId, MsgStream &msg)
set the calibration constants of a single tube
Definition: MdtTubeCalibContainer.cxx:19
MuonCalibR4::MdtCalibDbAlg::m_prop_beta
Gaudi::Property< double > m_prop_beta
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:105
a
TList * a
Definition: liststreamerinfos.cxx:10
h
MuonCalibR4::MdtCalibDbAlg::makeRt
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.
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx:285
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MuonCalibR4::MdtCalibDbAlg::m_writeKey
SG::WriteCondHandleKey< MuonCalib::MdtCalibDataContainer > m_writeKey
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:86
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
MuonCalibR4::MdtCalibDbAlg::makeTr
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.
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx:303
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
MuonCalib::MdtCalibDataContainer::hasDataForChannel
bool hasDataForChannel(const Identifier &measId, MsgStream &msg) const
Checks whether a calibration data object is already present.
Definition: MdtCalibDataContainer.cxx:36
MuonCalib::MdtTubeCalibContainer::SingleTubeCalib
Definition: MdtTubeCalibContainer.h:19
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
SET_BRANCHADDRESS
#define SET_BRANCHADDRESS(tree, branchName)
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.cxx:43
Muon::nsw::STGTPSegments::moduleIDBits::stationEta
constexpr uint8_t stationEta
1 to 3
Definition: NSWSTGTPDecodeBitmaps.h:159
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
sTgcDigitEffiDump.multiLayer
int multiLayer
Definition: sTgcDigitEffiDump.py:36
MuonCalibR4::MdtCalibDbAlg::m_rtJSON
Gaudi::Property< std::string > m_rtJSON
External Rt & T0 JSON files.
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:90
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
CoralUtilities::readBlobAsTTree
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.
Definition: blobaccess.cxx:107
calibdata.tube
tube
Definition: calibdata.py:31
MuonCalibR4::MdtCalibDbAlg::m_t0CalibPrec
Gaudi::Property< unsigned > m_t0CalibPrec
Precision cut off to treat 2 t0 constants as equivalent.
Definition: MuonPhaseII/MuonConditions/MuonCondAlgR4/src/MdtCalibDbAlg.h:107
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96
fitman.k
k
Definition: fitman.py:528
ServiceHandle< ICondSvc >
Identifier
Definition: IdentifierFieldParser.cxx:14