ATLAS Offline Software
Loading...
Searching...
No Matches
OutputConditionsAlg Class Reference

#include <OutputConditionsAlg.h>

Inheritance diagram for OutputConditionsAlg:
Collaboration diagram for OutputConditionsAlg:

Public Member Functions

 ~OutputConditionsAlg ()
StatusCode initialize ()
StatusCode execute (const EventContext &ctx)
 Execute method.
StatusCode finalize ()
 AthAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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.

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

void buildDescription (const std::string &identifier, const std::string &value, std::string &description) const
StatusCode splitAddress (const std::string &address, std::string &address_header, std::string &address_data) const
uint64_t timeToNano (unsigned long int timesec) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< IClassIDSvc > p_clidsvc {this,"ClassIDSvc","ClassIDSvc"}
ServiceHandle< IIOVRegistrationSvc > p_regsvc {this, "IOVRegistrationSvc","IOVRegistrationSvc"}
ServiceHandle< IAddressCreator > m_persSvc {this,"EventPersistencySvc","EventPersistencySvc"}
ToolHandle< IAthenaOutputStreamTool > m_streamer {this,"StreamName","AthenaOutputStreamTool/ConditionsAlgStream"}
Gaudi::Property< std::vector< std::string > > m_objectList {this,"ObjectList",{},"List of object to be written","OrderedSet<std::string>"}
Gaudi::Property< bool > m_par_writeIOV {this,"WriteIOV",true}
Gaudi::Property< std::string > m_par_crestDir {this,"CrestDir",""}
Gaudi::Property< unsigned int > m_par_run1 {this,"Run1",IOVTime::MINRUN,"IOV start (run-number)"}
Gaudi::Property< unsigned int > m_par_lumib1 {this,"LB1",IOVTime::MINEVENT,"IOV start (LB-number)"}
Gaudi::Property< unsigned int > m_par_run2 {this,"Run2",IOVTime::MAXRUN,"IOV end (run-number),ignored in CREST mode"}
Gaudi::Property< unsigned int > m_par_lumib2 {this,"LB2",IOVTime::MAXEVENT,"IOV end (LB-number), ignored in CREST mode"}
UnsignedLongProperty m_par_time1 {this,"Time1",IOVTime::MINTIMESTAMP,"IOV start (timestamp)"}
UnsignedLongProperty m_par_time2 {this,"Time2",IOVTime::MAXEVENT,"IOV end (timestamp), ignored in CREST mode"}
Gaudi::Property< bool > m_par_timestamp {this,"UseTime",false,"IOV in second or Run/LB"}
Gaudi::Property< std::vector< std::string > > m_par_iovtags {this,"IOVTagList",{},"List of Tags to be written","OrderedSet<std::string>"}
Gaudi::Property< std::vector< std::string > > m_par_tagDescr {this,"TagDescriptionList",{},"Human-readable description for each tag (only for CREST)","OrderedSet<std::string>"}
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 25 of file OutputConditionsAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~OutputConditionsAlg()

OutputConditionsAlg::~OutputConditionsAlg ( )

Definition at line 28 of file OutputConditionsAlg.cxx.

29{}

Member Function Documentation

◆ AthAlgorithm()

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

Constructor.

Definition at line 31 of file AthAlgorithm.cxx.

11 :
12 AthCommonAlgorithm<Gaudi::Algorithm>( name, pSvcLocator )
13{
14 // default cardinality for non-reentrant algorithms
15 setProperty( "Cardinality", 1 ).orThrow("Unable to set property 'Cardinality'", name);
16}
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
AthCommonAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)

◆ buildDescription()

void OutputConditionsAlg::buildDescription ( const std::string & identifier,
const std::string & value,
std::string & description ) const
private

Definition at line 383 of file OutputConditionsAlg.cxx.

383 {
384
385 std::string fragment="<"+identifier+">"+value+"<\\"+identifier+">";
386 description.insert(0,fragment);
387 return;
388}
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:93

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

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

◆ evtStore()

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.

◆ execute()

StatusCode OutputConditionsAlg::execute ( const EventContext & ctx)
virtual

Execute method.

Implements AthAlgorithm.

Definition at line 71 of file OutputConditionsAlg.cxx.

71 {
72
73 return StatusCode::SUCCESS;
74}

◆ 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 & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ finalize()

StatusCode OutputConditionsAlg::finalize ( )

Definition at line 76 of file OutputConditionsAlg.cxx.

76 {
77 ATH_MSG_INFO ("Finalize: preparing to write conditions objects ");
78
79 StatusCode sc = m_streamer->connectOutput();
80 if (sc.isFailure()) {
81 ATH_MSG_ERROR ("Could not connect stream to output");
82 return( StatusCode::FAILURE);
83 }
84 // create list of objects
85
86 struct obj_t{
87 std::string type;
88 std::string key;
89 std::string folder;
90 std::string tag;
91 std::string tagDescr;
92 SG::DataProxy* proxy=nullptr;
93 };
94
95 std::vector<obj_t> objs;
96 //Use old-style indexed-based loop because the string-vector properties m_objectList, m_par_iovtags and are index-parallel
97 for (unsigned int iobj = 0; iobj < m_objectList.size(); ++iobj) {
98 //add a new element and keep reference to it
99 obj_t& objt=objs.emplace_back();
100 const std::string& objStr = m_objectList[iobj];
101 objt.tag = iobj < m_par_iovtags.size() ? m_par_iovtags[iobj] : "";
102 objt.tagDescr = iobj < m_par_tagDescr.size() ? m_par_tagDescr[iobj] : "";
103
104 //Object-string definition: typename#key#folder (where key and folder are optional)
105 //split object-string by '#'
106 auto hashSplit = std::ranges::views::split(objStr,std::string_view("#"));
107 for (const auto [iHash, ss] : std::views::enumerate(hashSplit)) {
108 switch(iHash) {
109 case 0:
110 objt.type=std::string_view(ss);
111 break;
112 case 1:
113 objt.key=std::string_view(ss);
114 break;
115 case 2:
116 objt.folder=std::string_view(ss);
117 break;
118 default:
119 ATH_MSG_ERROR("Ill-formed object list " << objStr);
120 ATH_MSG_ERROR("Expect format typename#key#folder (where key and folder are optional)");
121 return StatusCode::FAILURE;
122 }
123 }
124
125 CLID clid;
126 ATH_CHECK(p_clidsvc->getIDOfTypeName(objt.type, clid));
127 if (objt.key.empty()) {
128 //Try to get Key from proxy:
129 objt.proxy = detStore()->proxy(clid);
130 if (!objt.proxy) {
131 ATH_MSG_ERROR("Could not get default proxy for CLID {}, typename {}",clid,objt.type);
132 return StatusCode::FAILURE;
133 }
134 objt.key = objt.proxy->name();
135 }
136 else {
137 objt.proxy = detStore()->proxy(clid, objt.key);
138 if (!objt.proxy) {
139 ATH_MSG_ERROR("Could not get proxy for CLID {}, typename {}, key {}",clid,objt.type,objt.key);
140 return StatusCode::FAILURE;
141 }
142
143 }
144
145 if (objt.folder.empty()) {
146 objt.folder=objt.key;
147 }
148
149 } //end loop over m_objectList
150
151 // list out all typename/key pairs to be written and construct TypeKeyPairs for the streamer
152 const size_t nObjects = objs.size();
154 ATH_MSG_INFO("Identified a total of " << nObjects << " objects to write out:");
155 // leave now if nothing to write
156 if (nObjects == 0)
157 return StatusCode::SUCCESS;
158
159 for (unsigned i=1;const obj_t& objt : objs) {
160 typeKeys.emplace_back(std::make_pair(objt.type, objt.key));
161 ATH_MSG_INFO("{}: {}#{}#{}",i++,objt.type,objt.key,objt.folder);
162 }
163
164
165 // stream output (write objects)
166 sc = m_streamer->streamObjects(typeKeys);
167 if (sc.isFailure()) {
168 ATH_MSG_ERROR("Could not stream out objects");
169 return StatusCode::FAILURE;
170 }
171 // commit output
172 sc = m_streamer->commitOutput();
173 if (sc.isFailure()) {
174 ATH_MSG_ERROR("Could not commit output stream");
175 return StatusCode::FAILURE;
176 }
177 ATH_MSG_INFO("Written {} objects to output stream",nObjects);
178
179 if (m_par_writeIOV) {
180 // ======== COOL writing part (legacy) ===========:
181
182 if (m_par_crestDir.empty()) {
183 msg() << MSG::INFO << "Register objects in IOV database, interval of validity ";
184 if (m_par_timestamp) {
185 msg() << std::format("[time] from [ {} ] to [ {} ]", m_par_time1.value(), m_par_time2.value()) << endmsg;
186 } else {
187 msg() << std::format("[run,LB] from [ {}, {} ] to [ {}, {} ]",m_par_run1.value(),m_par_lumib1.value(),m_par_run2.value(), m_par_lumib2.value()) << endmsg;
188 }
189 int nreg = 0;
190 for (const obj_t& objt : objs) {
191 ATH_MSG_INFO("Register object {}#{} in IOV database folder {} {}", objt.type, objt.key, objt.folder,
192 objt.tag.size() ? "with tag " + objt.tag : "without tagging");
193 if (m_par_timestamp) {
194 sc = p_regsvc->registerIOV(objt.type, objt.key, objt.folder, objt.tag, timeToNano(m_par_time1), timeToNano(m_par_time2));
195 } else {
196 sc = p_regsvc->registerIOV(objt.type, objt.key, objt.folder, objt.tag, m_par_run1, m_par_run2, m_par_lumib1, m_par_lumib2);
197 }
198 if (sc == StatusCode::SUCCESS) {
199 ++nreg;
200 } else {
201 ATH_MSG_ERROR("Registration failed!");
202 }
203 }
204 ATH_MSG_INFO("Registered " << nreg << " objects in COOL IOV database");
205 } else {
206 // ======== CREST writing part ===========:
207
208 ATH_MSG_INFO("Opening crest local directroy " << m_par_crestDir);
209 chai::Database db = chai::Database("crest_fs:" + m_par_crestDir);
210 // Create a global tag. Simplifes reading this local crest dir by athena
211 const std::string globalTagName = "GlobalTestTag";
212 chai::GlobalTagPtr gt;
213 std::vector<std::string> existingGlobalTags;
214 try {
215 existingGlobalTags = db.findGlobalTags(globalTagName);
216 }
217 catch (std::exception& e) {
218 //no global tag exists, not a problem
219 }
220 if (existingGlobalTags.empty()) {
221 gt = db.createGlobalTag("GlobalTestTag", "test", "test");
222 ATH_MSG_INFO("Created Global Tag for testing (" << globalTagName << ") in " << m_par_crestDir);
223 } else {
224 gt = db.getGlobalTag(globalTagName);
225 ATH_MSG_INFO("Global Tag for testing (" << globalTagName << ") exists already in " << m_par_crestDir);
226 }
227
228 // Some of the code here is taken from RegistrationSvc. Once we deprecate COOL, we can also delete (I)RegistrationSvc
229 std::string address_data;
230 // Loop over objects ....
231 for (const obj_t& objt : objs) {
232 chai::TagIovType iovType;
234 if (m_par_timestamp) {
235 iovType = chai::Tag::IovType::Time;
237 } else {
238 iovType = chai::Tag::IovType::RunNumberLumiBlock;
239 since = (static_cast<std::uint64_t>(m_par_run1.value()) << 32 )+ m_par_lumib1;
240 }
241 const CLID clid = objt.proxy->clID();
242
243 //ATH_MSG_INFO("Working on object clid " << clid << ", " << objt.folder << " " << objt.type << " " << objt.key);
244 ATH_MSG_INFO("Working on object clid {}, type {}, folder {}",clid, objt.type, objt.folder);
245 // First, deal with teh folder description:
246 std::string description;
247 if (clid == 40774348 || clid == 1238547719) {
248 // AthenaAttibuteList or CondAttrListCollection. The description can be build by chai ...
249 description = chai::Tag::buildNodeDescription(iovType, objt.type, clid);
250 } else {
251 // Pool referenced storage, need to build the node description by ourselves
252 IOpaqueAddress* addr = objt.proxy->address();
253 if (!addr) {
254 ATH_MSG_ERROR("No IOpaqueAddress from Type/Key [{}/{}]",objt.type,objt.key);
255 return StatusCode::FAILURE;
256 }
257 std::string saddr;
258 ATH_CHECK(m_persSvc->convertAddress(addr, saddr));
259 // Split the string address into header and data parts
260 std::string address_header;
261
262 if (splitAddress(saddr, address_header, address_data).isFailure()) {
263 ATH_MSG_ERROR("Could not split address: {}\n hdr: {}\n data: {}",saddr,address_header,address_data);
264 return StatusCode::FAILURE;
265 }
266 ATH_MSG_DEBUG("split address: {}\n hdr: {}\n data: {}",saddr,address_header,address_data);
267 // We store extra information in the folder description.
268 // This info is:
269 // typeName - required information
270 // symlinks - the extra StoreGate keys, if any
271 // key - optional, only needed if key != folder name
272 // timeStamp - either run-lumi (default) or time
273 // address_header - added by convention
274 //
275 //
276 // The convention is that the address_header is stored
277 // in the description, and the IOV interval data
278 // payload is just the pool reference in string form.
279 // The address_header and address_data can be obtained
280 // from the string address returned from the
281 // persistency service, using splitAddress
282
283 // Add symlinks (actually base-class types):
284 std::string symLinkTypes;
285 for (const CLID& c : objt.proxy->transientID()) {
286 if (c != clid) {
287 std::string symType;
288 ATH_CHECK(p_clidsvc->getTypeNameOfID(c, symType));
289 if (!symLinkTypes.empty())
290 symLinkTypes += ":"; // Separate type names by colons
291 symLinkTypes.append(symType);
292 }
293 } // end loop over transientIDs
294 if (!symLinkTypes.empty()) {
295 buildDescription("symLink", symLinkTypes, description);
296 }
297
298 // IOV type:
299 if (iovType == chai::Tag::IovType::Time) {
300 buildDescription("timeStamp", "time", description);
301 } else {
302 buildDescription("timeStamp", "run-lumi", description);
303 }
304
305 // Address header:
306 buildDescription("addrHeader", address_header, description);
307
308 // SG key if needed:
309 if (objt.key != objt.folder) {
310 buildDescription("key", objt.key, description);
311 }
312 } // end if POOL referenced storage
313 static const std::string crestObjTypeStr{"crest-json-single-iov"};
314 chai::Tag::Metadata chaiMD{.iovType = iovType,
315 .objectType = crestObjTypeStr,
316 .synchronization = chai::Tag::Synchronization::All,
317 .status = chai::Tag::Status::Unlocked,
318 .nodeDescription = std::move(description)};
319
320
321
322 // Description and metadat ready, now deal with the payload
323 IOpaqueAddress* addr = objt.proxy->address();
324
325 CondAttrListCollAddress* collAddr = dynamic_cast<CondAttrListCollAddress*>(addr);
326 if (collAddr) {
327
328 // Multi-channel inline storage or multi-channel POOL storage
329 const CondAttrListCollection* attrListColl = collAddr->attrListColl();
330 // convert to multi-channel chai::container and ....
331 chai::Container chaiCont=ChaiCoralConverter::toContainer(*attrListColl);
332 ATH_MSG_INFO("Created chai container with " << chaiCont.numChannels() << " channels.");
333 const chai::PayloadSpec& chaiSpec=chaiCont.payloadSpec();
334 auto chaiTag=db.createTag(objt.tag, objt.tagDescr, chaiSpec,chaiMD);
335 chaiTag->addPayload(chaiCont,since);
336
337
338 } else if (clid == 40774348) {
339 // Attribute list (single-channel inline).. retrieve from detStore
340
341 const AthenaAttributeList* attrList;
342 ATH_CHECK(detStore()->retrieve(attrList, objt.key));
343 // convert to single-channel chai::container
344 chai::Container chaiCont=ChaiCoralConverter::toContainer(*attrList);
345 const chai::PayloadSpec& chaiSpec=chaiCont.payloadSpec();
346 auto chaiTag=db.createTag(objt.tag, objt.tagDescr, chaiSpec,chaiMD);
347 gt->addTag(objt.folder,objt.tag);
348 chaiTag->addPayload(chaiCont,since);
349 } else {
350
351 //Single channel pool storage case:
352 chai::PayloadSpec spec(chai::FieldSpec({{"PoolRef", chai::Type::String}}), chai::ChannelSpec({{0, ""}}));
353 auto tag = db.createTag(objt.tag, objt.tagDescr, spec,chaiMD);
354 gt->addTag(objt.folder, objt.tag);
355 chai::Container container = tag->buildContainer();
356 container[0].push(address_data);
357 //With chai 3.0.0 the line above becomes:
358 //container.set(0,"PoolRef",address_data);
359 tag->addPayload(container, since);
360
361 } // end else single-channel pool storage
362 } // end loop over objects
363 ATH_MSG_INFO("Registered " << objs.size() << " objects in CREST IOV database");
364 } // end if write crest
365 } // end doWriteIOV
366 else {
367 ATH_MSG_INFO("Objects NOT registered in IOV database");
368 }
369 return StatusCode::SUCCESS;
370}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_INFO(x,...)
uint32_t CLID
The Class ID type.
static Double_t ss
static Double_t sc
const ServiceHandle< StoreGateSvc > & detStore() const
static chai::Container toContainer(const AthenaAttributeList &attrList, uint64_t channelId=0, const std::string &channelName="")
Convert an AthenaAttributeList to a single-channel chai::Container.
CondAttrListCollection * attrListColl()
Access to AttributeList.
std::vector< TypeKeyPair > TypeKeyPairs
uint64_t timeToNano(unsigned long int timesec) const
UnsignedLongProperty m_par_time2
ServiceHandle< IClassIDSvc > p_clidsvc
Gaudi::Property< std::vector< std::string > > m_par_tagDescr
Gaudi::Property< bool > m_par_writeIOV
void buildDescription(const std::string &identifier, const std::string &value, std::string &description) const
ServiceHandle< IIOVRegistrationSvc > p_regsvc
Gaudi::Property< unsigned int > m_par_lumib2
Gaudi::Property< std::vector< std::string > > m_par_iovtags
Gaudi::Property< bool > m_par_timestamp
ToolHandle< IAthenaOutputStreamTool > m_streamer
StatusCode splitAddress(const std::string &address, std::string &address_header, std::string &address_data) const
ServiceHandle< IAddressCreator > m_persSvc
Gaudi::Property< std::vector< std::string > > m_objectList
Gaudi::Property< unsigned int > m_par_run2
UnsignedLongProperty m_par_time1
Gaudi::Property< unsigned int > m_par_lumib1
Gaudi::Property< unsigned int > m_par_run1
Gaudi::Property< std::string > m_par_crestDir
::StatusCode StatusCode
StatusCode definition for legacy code.
const SG::AuxVectorData * container() const
Return the container holding this element.

◆ initialize()

StatusCode OutputConditionsAlg::initialize ( )

Definition at line 32 of file OutputConditionsAlg.cxx.

32 {
33 ATH_MSG_DEBUG ("in initialize()");
34
35 // get pointer to ClassIDSvc
36 if (StatusCode::SUCCESS!= p_clidsvc.retrieve()) {
37 ATH_MSG_FATAL ("ClassIDSvc not found");
38 return StatusCode::FAILURE;
39 }
40 if (m_par_writeIOV && m_par_crestDir.empty()) {
41 // get pointer to IOVRegistrationSvc
42 if (StatusCode::SUCCESS!=p_regsvc.retrieve()) {
43 ATH_MSG_FATAL ("IOVRegistrationSvc not found");
44 return StatusCode::FAILURE;
45 }
46 }
47
48 StatusCode sc = m_streamer.retrieve();
49 if (sc.isFailure()) {
50 ATH_MSG_ERROR ("Unable to retrieve AthenaOutputStreamTool " << m_streamer);
51 return StatusCode::FAILURE;
52 }
53
54 if (!m_par_crestDir.empty()) {
55 //CREST mode:
56 ATH_CHECK(m_persSvc.retrieve());
57 //Sanity check of properties, m_object list and m_par_iovtags need to be index parallel
58 if (m_objectList.size() > m_par_iovtags.size()) {
59 ATH_MSG_ERROR("CREST mode: Database tag required for each object");
60 for (size_t i= m_objectList.size()-m_par_iovtags.size();i<m_objectList.size();++i) {
61 ATH_MSG_ERROR (" No database tag set for object " << m_objectList[i]);
62 }
63 return StatusCode::FAILURE;
64 }
65 }
66
67 return StatusCode::SUCCESS;
68}
#define ATH_MSG_FATAL(x,...)

◆ 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()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 47 of file AthAlgorithm.h.

47{ return false; }

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

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

◆ 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 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
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()

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

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ splitAddress()

StatusCode OutputConditionsAlg::splitAddress ( const std::string & address,
std::string & address_header,
std::string & address_data ) const
private

Definition at line 390 of file OutputConditionsAlg.cxx.

390 {
391 // Deals with address of form
392 // <address_header service_type="256" clid="1238547719" /> POOLContainer_CondAttrListCollection][CLID=x
393 // return header as part up to and including />, trailer as rest
394
395 std::string::size_type p1 = address.find(" />");
396 if (p1 != std::string::npos) {
397 address_header = address.substr(0, p1 + 3);
398 address_data = address.substr(p1 + 4);
399 return StatusCode::SUCCESS;
400 } else {
401 return StatusCode::FAILURE;
402 }
403}

◆ sysExecute()

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

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::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 AthAnalysisAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
#define ATH_MSG_WARNING(x,...)
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

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

◆ timeToNano()

uint64_t OutputConditionsAlg::timeToNano ( unsigned long int timesec) const
private

Definition at line 372 of file OutputConditionsAlg.cxx.

373{
374 // convert time specified in seconds to ns used by COOL
375 // use the magic value MAXEVENT to signal full range
376 if (timesec==IOVTime::MAXEVENT) {
378 } else {
379 return static_cast<uint64_t>(timesec)*1000000000;
380 }
381}
static constexpr uint64_t MAXTIMESTAMP
Definition IOVTime.h:59
static constexpr uint32_t MAXEVENT
Definition IOVTime.h:52

◆ updateVHKA()

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

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }

Member Data Documentation

◆ m_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 381 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 378 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

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

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_objectList

Gaudi::Property<std::vector<std::string> > OutputConditionsAlg::m_objectList {this,"ObjectList",{},"List of object to be written","OrderedSet<std::string>"}
private

Definition at line 45 of file OutputConditionsAlg.h.

45{this,"ObjectList",{},"List of object to be written","OrderedSet<std::string>"};

◆ m_par_crestDir

Gaudi::Property<std::string> OutputConditionsAlg::m_par_crestDir {this,"CrestDir",""}
private

Definition at line 47 of file OutputConditionsAlg.h.

47{this,"CrestDir",""};

◆ m_par_iovtags

Gaudi::Property<std::vector<std::string> > OutputConditionsAlg::m_par_iovtags {this,"IOVTagList",{},"List of Tags to be written","OrderedSet<std::string>"}
private

Definition at line 55 of file OutputConditionsAlg.h.

55{this,"IOVTagList",{},"List of Tags to be written","OrderedSet<std::string>"};

◆ m_par_lumib1

Gaudi::Property<unsigned int> OutputConditionsAlg::m_par_lumib1 {this,"LB1",IOVTime::MINEVENT,"IOV start (LB-number)"}
private

Definition at line 49 of file OutputConditionsAlg.h.

49{this,"LB1",IOVTime::MINEVENT,"IOV start (LB-number)"};
static constexpr uint32_t MINEVENT
Definition IOVTime.h:51

◆ m_par_lumib2

Gaudi::Property<unsigned int> OutputConditionsAlg::m_par_lumib2 {this,"LB2",IOVTime::MAXEVENT,"IOV end (LB-number), ignored in CREST mode"}
private

Definition at line 51 of file OutputConditionsAlg.h.

51{this,"LB2",IOVTime::MAXEVENT,"IOV end (LB-number), ignored in CREST mode"};

◆ m_par_run1

Gaudi::Property<unsigned int> OutputConditionsAlg::m_par_run1 {this,"Run1",IOVTime::MINRUN,"IOV start (run-number)"}
private

Definition at line 48 of file OutputConditionsAlg.h.

48{this,"Run1",IOVTime::MINRUN,"IOV start (run-number)"};
static constexpr uint32_t MINRUN
Definition IOVTime.h:45

◆ m_par_run2

Gaudi::Property<unsigned int> OutputConditionsAlg::m_par_run2 {this,"Run2",IOVTime::MAXRUN,"IOV end (run-number),ignored in CREST mode"}
private

Definition at line 50 of file OutputConditionsAlg.h.

50{this,"Run2",IOVTime::MAXRUN,"IOV end (run-number),ignored in CREST mode"};
static constexpr uint32_t MAXRUN
Definition IOVTime.h:49

◆ m_par_tagDescr

Gaudi::Property<std::vector<std::string> > OutputConditionsAlg::m_par_tagDescr {this,"TagDescriptionList",{},"Human-readable description for each tag (only for CREST)","OrderedSet<std::string>"}
private

Definition at line 56 of file OutputConditionsAlg.h.

56{this,"TagDescriptionList",{},"Human-readable description for each tag (only for CREST)","OrderedSet<std::string>"};

◆ m_par_time1

UnsignedLongProperty OutputConditionsAlg::m_par_time1 {this,"Time1",IOVTime::MINTIMESTAMP,"IOV start (timestamp)"}
private

Definition at line 52 of file OutputConditionsAlg.h.

52{this,"Time1",IOVTime::MINTIMESTAMP,"IOV start (timestamp)"};
static constexpr uint64_t MINTIMESTAMP
Definition IOVTime.h:57

◆ m_par_time2

UnsignedLongProperty OutputConditionsAlg::m_par_time2 {this,"Time2",IOVTime::MAXEVENT,"IOV end (timestamp), ignored in CREST mode"}
private

Definition at line 53 of file OutputConditionsAlg.h.

53{this,"Time2",IOVTime::MAXEVENT,"IOV end (timestamp), ignored in CREST mode"};

◆ m_par_timestamp

Gaudi::Property<bool> OutputConditionsAlg::m_par_timestamp {this,"UseTime",false,"IOV in second or Run/LB"}
private

Definition at line 54 of file OutputConditionsAlg.h.

54{this,"UseTime",false,"IOV in second or Run/LB"};

◆ m_par_writeIOV

Gaudi::Property<bool> OutputConditionsAlg::m_par_writeIOV {this,"WriteIOV",true}
private

Definition at line 46 of file OutputConditionsAlg.h.

46{this,"WriteIOV",true};

◆ m_persSvc

ServiceHandle<IAddressCreator> OutputConditionsAlg::m_persSvc {this,"EventPersistencySvc","EventPersistencySvc"}
private

Definition at line 40 of file OutputConditionsAlg.h.

40{this,"EventPersistencySvc","EventPersistencySvc"};

◆ m_streamer

ToolHandle<IAthenaOutputStreamTool> OutputConditionsAlg::m_streamer {this,"StreamName","AthenaOutputStreamTool/ConditionsAlgStream"}
private

Definition at line 43 of file OutputConditionsAlg.h.

43{this,"StreamName","AthenaOutputStreamTool/ConditionsAlgStream"};

◆ m_varHandleArraysDeclared

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

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.

◆ p_clidsvc

ServiceHandle<IClassIDSvc> OutputConditionsAlg::p_clidsvc {this,"ClassIDSvc","ClassIDSvc"}
private

Definition at line 38 of file OutputConditionsAlg.h.

38{this,"ClassIDSvc","ClassIDSvc"};

◆ p_regsvc

ServiceHandle<IIOVRegistrationSvc> OutputConditionsAlg::p_regsvc {this, "IOVRegistrationSvc","IOVRegistrationSvc"}
private

Definition at line 39 of file OutputConditionsAlg.h.

39{this, "IOVRegistrationSvc","IOVRegistrationSvc"};

The documentation for this class was generated from the following files: