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.
More...
#include <CalibrationDataUpdater.h>
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.
◆ StoreGateSvc_t
◆ CalibrationDataUpdater()
| Analysis::CalibrationDataUpdater::CalibrationDataUpdater |
( |
const std::string & | name, |
|
|
ISvcLocator * | pSvcLocator ) |
Standard Athena-Algorithm Constructor.
Definition at line 19 of file CalibrationDataUpdater.cxx.
20 :
22{
23
28
29}
std::string m_inputRootFile
input ROOT file containing new results
std::string m_DbRootFile
ROOT file to be entered in COOL.
Gaudi::Property m_overrideDefaults
flag if these results are to be used as defaults (they will anyway if no other results exist for the ...
std::vector< std::string > m_paramNames
names of input and output parametrisations
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
◆ ~CalibrationDataUpdater()
| virtual Analysis::CalibrationDataUpdater::~CalibrationDataUpdater |
( |
| ) |
|
|
virtualdefault |
◆ 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{
141 return;
142 }
143
144
145 TObject* in = fIn->Get(from.c_str());
146 if (! in) {
148 << from );
149 return;
150 }
152
153
154 std::string fromCov(from); fromCov += "_stat";
155 std::string toCov(to); toCov += "_stat";
156 in = fIn->Get(fromCov.c_str());
157 if (! in) {
159 << fromCov );
160 return;
161 }
163
164
165 std::string fromSyst(from); fromSyst += "_syst";
166 std::string toSyst(to); toSyst += "_syst";
167 in = fIn->Get(fromSyst.c_str());
168 if (! in) {
170 << fromSyst );
171 return;
172 }
174
175}
#define ATH_MSG_WARNING(x)
void writeOutput(TObject *in, const std::string &Name, TFile *fOut) const
bool isValidName(const std::string &Name) const
◆ declareGaudiProperty()
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
158 {
161 hndl.documentation());
162
163 }
◆ declareProperty()
Definition at line 145 of file AthCommonDataStore.h.
145 {
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
◆ detStore()
◆ evtStore()
◆ extraDeps_update_handler()
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
53
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects
◆ initialize()
| StatusCode Analysis::CalibrationDataUpdater::initialize |
( |
| ) |
|
|
override |
standard Athena-Algorithm method
Definition at line 33 of file CalibrationDataUpdater.cxx.
34{
35
36
38
39
40
41 TFile* fIn = 0;
43 if (newInput) {
45 if (fIn->IsZombie()) {
48 return StatusCode::FAILURE;
49 }
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 }
57 return StatusCode::FAILURE;
58 }
60 if (
fOut->IsZombie()) {
63 return StatusCode::FAILURE;
64 }
65
68
69 if (newInput) {
70
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);
77 continue;
78 }
79
81 }
83
84 if (fIn) fIn->Close();
86
88 return StatusCode::SUCCESS;
89}
void copyResults(const std::string &from, const std::string &to, TFile *fIn, TFile *fOut) const
void setDefaultResults(const std::string &Name, TFile *fOut) const
auxiliary functions
◆ inputHandles()
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
180
181 int slashes = 0;
182 string::size_type delim =
Name.find(
"/");
183 while (delim != string::npos) {
184 ++slashes;
186 delim =
Name.find(
"/");
187 }
188 if (slashes != 4) return false;
189
190 delim =
Name.rfind(
"_");
191 if (delim == string::npos) return false;
193 return (
Name ==
"SF" ||
Name ==
"Eff");
194}
◆ msg()
◆ msgLvl()
| bool AthCommonMsg< Algorithm >::msgLvl |
( |
const MSG::Level | lvl | ) |
const |
|
inlineinherited |
◆ outputHandles()
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()
Definition at line 380 of file AthCommonDataStore.h.
381 {
384 }
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)
◆ renounceArray()
◆ setDefaultResults()
| void Analysis::CalibrationDataUpdater::setDefaultResults |
( |
const std::string & | Name, |
|
|
TFile * | fOut ) const |
|
private |
auxiliary functions
Definition at line 91 of file CalibrationDataUpdater.cxx.
92{
95 if (! obj) {
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
106 <<
gDirectory->GetPath() <<
"; cd() to subdir "
107 << dir << " failed!" );
108 };
109
110
111
112 delim =
Name.rfind(
"_");
113 string defaultName(
"default"); defaultName +=
Name.substr(delim);
117 }
118
120 <<
Name <<
" (+ stat., syst.) as default" );
121
122
123 obj->Write(defaultName.c_str());
124
125
126 string nameCov(
Name); nameCov +=
"_stat";
127 string defaultNameCov(defaultName); defaultNameCov += "_stat";
128 fOut->Get(nameCov.c_str())->Write(defaultNameCov.c_str());
129
130
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, AthHistogramAlgorithm, and PyAthena::Alg.
Definition at line 66 of file AthAlgorithm.cxx.
66 {
68
71 }
72 ServiceHandle<ICondSvc> cs(
"CondSvc",
name());
74 if (
h->isCondition() &&
h->mode() == Gaudi::DataHandle::Writer) {
75
76 if ( cs.retrieve().isFailure() ) {
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 }
88}
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
Definition at line 308 of file AthCommonDataStore.h.
308 {
309
310
313 for (
auto k :
keys) {
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka
◆ 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
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()) {
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
219 in->Write(
Name.c_str());
220}
◆ m_DbRootFile
| std::string Analysis::CalibrationDataUpdater::m_DbRootFile = "" |
|
private |
◆ m_detStore
◆ m_evtStore
◆ m_extendedExtraObjects
| DataObjIDColl AthAlgorithm::m_extendedExtraObjects |
|
privateinherited |
◆ m_inputRootFile
| std::string Analysis::CalibrationDataUpdater::m_inputRootFile = "" |
|
private |
◆ 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 |
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files: