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

#include <CalibrationDataUpdater.h>

Inheritance diagram for Analysis::CalibrationDataUpdater:
Collaboration diagram for Analysis::CalibrationDataUpdater:

Public Member Functions

 CalibrationDataUpdater (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Athena-Algorithm Constructor. More...
 
virtual ~CalibrationDataUpdater ()=default
 Default Destructor. More...
 
StatusCode initialize () override
 standard Athena-Algorithm method More...
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
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

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

void setDefaultResults (const std::string &Name, TFile *fOut) const
 auxiliary functions More...
 
void copyResults (const std::string &from, const std::string &to, TFile *fIn, TFile *fOut) const
 
bool isValidName (const std::string &Name) const
 
void writeOutput (TObject *in, const std::string &Name, TFile *fOut) const
 
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

std::string m_inputRootFile = ""
 input ROOT file containing new results More...
 
std::string m_DbRootFile = ""
 ROOT file to be entered in COOL. More...
 
std::vector< std::string > m_paramNames
 names of input and output parametrisations More...
 
Gaudi::Property m_overrideDefaults = false
 flag if these results are to be used as defaults (they will anyway if no other results exist for the particular combination of jet collection / tagging algorithm / operating point) More...
 
DataObjIDColl m_extendedExtraObjects
 
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

This algorithm is meant to be used in a stand-alone fashion, to update a ROOT file containing results to be entered in COOL with fresh (but possibly partial) information. Alternatively, it can be used to change the default algorithm that is used (if multiple alternatives are available).

Author
Frank Filthaut F.Fil.nosp@m.thau.nosp@m.t@sci.nosp@m.ence.nosp@m..ru.n.nosp@m.l

Definition at line 37 of file CalibrationDataUpdater.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CalibrationDataUpdater()

Analysis::CalibrationDataUpdater::CalibrationDataUpdater ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Standard Athena-Algorithm Constructor.

Definition at line 19 of file CalibrationDataUpdater.cxx.

20  :
21  AthAlgorithm(name,pSvcLocator)
22 {
23  // property declarations
24  declareProperty("inputRootFile", m_inputRootFile, "ROOT file containing new parametrisations");
25  declareProperty("DbRootFile", m_DbRootFile, "ROOT file to be entered in COOL");
26  declareProperty("paramNames", m_paramNames, "list of input and output parametrisation names");
27  declareProperty("overrideDefaults", m_overrideDefaults, "true if new results are to be used as default");
28 
29 }

◆ ~CalibrationDataUpdater()

virtual Analysis::CalibrationDataUpdater::~CalibrationDataUpdater ( )
virtualdefault

Default Destructor.

Member Function Documentation

◆ copyResults()

void Analysis::CalibrationDataUpdater::copyResults ( const std::string &  from,
const std::string &  to,
TFile *  fIn,
TFile *  fOut 
) const
private

Definition at line 136 of file CalibrationDataUpdater.cxx.

138 {
139  if (! isValidName(to)) {
140  ATH_MSG_WARNING( name() << ": invalid parametrisation name: " << to );
141  return;
142  }
143 
144  // copy the parametrisation itself
145  TObject* in = fIn->Get(from.c_str());
146  if (! in) {
147  ATH_MSG_WARNING( name() << ": input parametrisation name not found: "
148  << from );
149  return;
150  }
151  writeOutput(in, to, fOut);
152 
153  // copy the corresponding covariance matrix
154  std::string fromCov(from); fromCov += "_stat";
155  std::string toCov(to); toCov += "_stat";
156  in = fIn->Get(fromCov.c_str());
157  if (! in) {
158  ATH_MSG_WARNING( name() << ": input parametrisation covariance matrix name not found: "
159  << fromCov );
160  return;
161  }
162  writeOutput(in, toCov, fOut);
163 
164  // copy the corresponding covariance matrix
165  std::string fromSyst(from); fromSyst += "_syst";
166  std::string toSyst(to); toSyst += "_syst";
167  in = fIn->Get(fromSyst.c_str());
168  if (! in) {
169  ATH_MSG_WARNING( name() << ": input parametrisation systematics name not found: "
170  << fromSyst );
171  return;
172  }
173  writeOutput(in, toSyst, fOut);
174 
175 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< 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< 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< 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< 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< 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< 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< 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< 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< 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< 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< 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< 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< 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; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< 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 & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 50 of file AthAlgorithm.cxx.

51 {
52  // If we didn't find any symlinks to add, just return the collection
53  // from the base class. Otherwise, return the extended collection.
54  if (!m_extendedExtraObjects.empty()) {
56  }
57  return Algorithm::extraOutputDeps();
58 }

◆ initialize()

StatusCode Analysis::CalibrationDataUpdater::initialize ( )
override

standard Athena-Algorithm method

Definition at line 33 of file CalibrationDataUpdater.cxx.

34 {
35  // Code entered here will be executed once at program start.
36 
37  ATH_MSG_INFO( name() << " initialize()" );
38 
39  // basic sanity and consistency checks
40 
41  TFile* fIn = 0;
42  bool newInput = (m_inputRootFile.empty());
43  if (newInput) {
44  fIn = new TFile(m_inputRootFile.c_str());
45  if (fIn->IsZombie()) {
46  ATH_MSG_FATAL( name() << ": requested input ROOT file invalid: "
47  << m_inputRootFile );
48  return StatusCode::FAILURE;
49  }
50  } else if (! m_overrideDefaults) {
51  ATH_MSG_FATAL( name() << ": no input ROOT file given and no defaults to be modified:"
52  << " no action to be taken" );
53  return StatusCode::FAILURE;
54  }
55  if (m_DbRootFile.empty()) {
56  ATH_MSG_FATAL( name() << ": no DB ROOT file given" );
57  return StatusCode::FAILURE;
58  }
59  TFile* fOut = new TFile(m_DbRootFile.c_str(), "UPDATE");
60  if (fOut->IsZombie()) {
61  ATH_MSG_FATAL( name() << ": DB ROOT file invalid: "
62  << m_DbRootFile );
63  return StatusCode::FAILURE;
64  }
65 
66  for (const std::string& itname : m_paramNames){
67  string to = *itname;
68  // 1. determine whether to insert new results
69  if (newInput) {
70  // if no "->" is found, assume that the input and output object names are identical
71  const string::size_type delim = itname->find("->");
72  string from = (delim == string::npos) ? *itname : itname->substr(0, delim);
73  if (delim != string::npos) to = itname->substr(delim+2);
74  copyResults(from, to, fIn, fOut);
75  } else if (! isValidName(to)) {
76  ATH_MSG_WARNING( name() << ": invalid parametrisation name: " << to );
77  continue;
78  }
79  // 2. make these new results the default (if requested or if no default exists yet)
81  }
82  ATH_MSG_DEBUG( name() << ": all done" );
83 
84  if (fIn) fIn->Close();
85  fOut->Close();
86 
87  ATH_MSG_DEBUG( "initialize() successful in " << name() );
88  return StatusCode::SUCCESS;
89 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< 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.

◆ isValidName()

bool Analysis::CalibrationDataUpdater::isValidName ( const std::string &  Name) const
private

Definition at line 177 of file CalibrationDataUpdater.cxx.

178 {
179  // this is a very basic check: the name should contain four slashes
180  // and should end either in "_SF" or "_Eff"
181  int slashes = 0;
182  string::size_type delim = Name.find("/");
183  while (delim != string::npos) {
184  ++slashes;
185  Name = Name.substr(delim+1);
186  delim = Name.find("/");
187  }
188  if (slashes != 4) return false;
189 
190  delim = Name.rfind("_");
191  if (delim == string::npos) return false;
192  Name = Name.substr(delim+1);
193  return (Name == "SF" || Name == "Eff");
194 }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

MsgStream& AthCommonMsg< 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< 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< 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.

◆ 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< 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< 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  }

◆ setDefaultResults()

void Analysis::CalibrationDataUpdater::setDefaultResults ( const std::string &  Name,
TFile *  fOut 
) const
private

auxiliary functions

Definition at line 91 of file CalibrationDataUpdater.cxx.

92 {
93  fOut->cd("/");
94  TObject* obj = fOut->Get(Name.c_str());
95  if (! obj) {
96  ATH_MSG_WARNING( name() << ": nonexistent parametrisation name: " << Name );
97  return;
98  }
99 
100  string::size_type delim = Name.rfind("/");
101  string dir = Name.substr(0, delim);
102  TDirectory* newdir = fOut->GetDirectory(dir.c_str());
103  if (! newdir->cd()) {
104  // This should never happen, given that the object above apparently exists...
105  ATH_MSG_WARNING( name() << ": Name now: " << Name << "; pwd: "
106  << gDirectory->GetPath() << "; cd() to subdir "
107  << dir << " failed!" );
108  };
109 
110  // if no change of defaults is requested to begin with, check whether a default
111  // exists already
112  delim = Name.rfind("_");
113  string defaultName("default"); defaultName += Name.substr(delim);
114  if (! m_overrideDefaults) {
115  string fullName(dir); fullName += "/"; fullName += defaultName;
116  if (fOut->Get(fullName.c_str())) return;
117  }
118 
119  ATH_MSG_INFO( name() << ": copying parametrisation name: "
120  << Name << " (+ stat., syst.) as default" );
121 
122  // do the actual copying for the parametrisation itself
123  obj->Write(defaultName.c_str());
124 
125  // and for the parameter covariance matrix
126  string nameCov(Name); nameCov += "_stat";
127  string defaultNameCov(defaultName); defaultNameCov += "_stat";
128  fOut->Get(nameCov.c_str())->Write(defaultNameCov.c_str());
129 
130  // and for the systematic uncertainty
131  string nameSyst(Name); nameSyst += "_syst";
132  string defaultNameSyst(defaultName); defaultNameSyst += "_syst";
133  fOut->Get(nameSyst.c_str())->Write(defaultNameSyst.c_str());
134 }

◆ sysInitialize()

StatusCode AthAlgorithm::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< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, PyAthena::Alg, and AthHistogramAlgorithm.

Definition at line 66 of file AthAlgorithm.cxx.

66  {
68 
69  if (sc.isFailure()) {
70  return sc;
71  }
72  ServiceHandle<ICondSvc> cs("CondSvc",name());
73  for (auto h : outputHandles()) {
74  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75  // do this inside the loop so we don't create the CondSvc until needed
76  if ( cs.retrieve().isFailure() ) {
77  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78  return StatusCode::SUCCESS;
79  }
80  if (cs->regHandle(this,*h).isFailure()) {
81  sc = StatusCode::FAILURE;
82  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83  << " with CondSvc");
84  }
85  }
86  }
87  return sc;
88 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< 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< 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  }

◆ writeOutput()

void Analysis::CalibrationDataUpdater::writeOutput ( TObject *  in,
const std::string &  Name,
TFile *  fOut 
) const
private

Definition at line 196 of file CalibrationDataUpdater.cxx.

197 {
198  // first check whether the output directory exists, and if not, create it
199  fOut->cd("/");
200  TDirectory* tdir = dynamic_cast<TDirectory*>(fOut);
201  string::size_type delim = Name.find("/");
202  while (delim != string::npos) {
203  string dir = Name.substr(0, delim);
204  TDirectory* newdir = tdir->GetDirectory(dir.c_str());
205  if (! newdir) newdir = tdir->mkdir(dir.c_str());
206  if (! newdir->cd()) {
207  ATH_MSG_WARNING( name() << ": Name now: " << Name << "; pwd: "
208  << gDirectory->GetPath() << "; cd() to subdir "
209  << dir << " failed!" );
210  };
211  tdir = newdir;
212  Name = Name.substr(delim+1, string::npos);
213  delim = Name.find("/");
214  }
215 
216  // then write the named object
217  ATH_MSG_INFO( name() << ": writing object " << Name << " to directory "
218  << gDirectory->GetPath() );
219  in->Write(Name.c_str());
220 }

Member Data Documentation

◆ m_DbRootFile

std::string Analysis::CalibrationDataUpdater::m_DbRootFile = ""
private

ROOT file to be entered in COOL.

Definition at line 64 of file CalibrationDataUpdater.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< 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< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_inputRootFile

std::string Analysis::CalibrationDataUpdater::m_inputRootFile = ""
private

input ROOT file containing new results

Definition at line 61 of file CalibrationDataUpdater.h.

◆ m_overrideDefaults

Gaudi::Property Analysis::CalibrationDataUpdater::m_overrideDefaults = false
private

flag if these results are to be used as defaults (they will anyway if no other results exist for the particular combination of jet collection / tagging algorithm / operating point)

Definition at line 72 of file CalibrationDataUpdater.h.

◆ m_paramNames

std::vector<std::string> Analysis::CalibrationDataUpdater::m_paramNames
private

names of input and output parametrisations

Definition at line 67 of file CalibrationDataUpdater.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Analysis::CalibrationDataUpdater::writeOutput
void writeOutput(TObject *in, const std::string &Name, TFile *fOut) const
Definition: CalibrationDataUpdater.cxx:196
WriteCellNoiseToCool.fullName
fullName
Definition: WriteCellNoiseToCool.py:461
Analysis::CalibrationDataUpdater::m_overrideDefaults
Gaudi::Property m_overrideDefaults
flag if these results are to be used as defaults (they will anyway if no other results exist for the ...
Definition: CalibrationDataUpdater.h:72
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
Analysis::CalibrationDataUpdater::m_DbRootFile
std::string m_DbRootFile
ROOT file to be entered in COOL.
Definition: CalibrationDataUpdater.h:64
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Analysis::CalibrationDataUpdater::isValidName
bool isValidName(const std::string &Name) const
Definition: CalibrationDataUpdater.cxx:177
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Analysis::CalibrationDataUpdater::setDefaultResults
void setDefaultResults(const std::string &Name, TFile *fOut) const
auxiliary functions
Definition: CalibrationDataUpdater.cxx:91
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthAlgorithm.cxx:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
ParseInputs.gDirectory
gDirectory
Definition: Final2012/ParseInputs.py:133
Analysis::CalibrationDataUpdater::m_paramNames
std::vector< std::string > m_paramNames
names of input and output parametrisations
Definition: CalibrationDataUpdater.h:67
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
Analysis::CalibrationDataUpdater::m_inputRootFile
std::string m_inputRootFile
input ROOT file containing new results
Definition: CalibrationDataUpdater.h:61
makeTOC.fOut
fOut
Definition: makeTOC.py:37
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
beamspotman.dir
string dir
Definition: beamspotman.py:623
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:221
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:39
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
Name
JetDumper::Name Name
Definition: JetDumper.cxx:19
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
python.PyAthena.obj
obj
Definition: PyAthena.py:132
MooRTT_summarizeCPU.fIn
fIn
Definition: MooRTT_summarizeCPU.py:11
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
ServiceHandle< ICondSvc >
Analysis::CalibrationDataUpdater::copyResults
void copyResults(const std::string &from, const std::string &to, TFile *fIn, TFile *fOut) const
Definition: CalibrationDataUpdater.cxx:136