 |
ATLAS Offline Software
|
Tool for accessing xAOD files outside of Athena.
More...
#include <TEvent.h>
|
| StatusCode | initStats () |
| | Function to initialise the statistics for all Tree content. More...
|
| |
| StatusCode | record (std::unique_ptr< TAuxStore > store, const std::string &key) |
| | Internal function for adding an auxiliary store object to the output. More...
|
| |
| StatusCode | setUpDynamicStore (TObjectManager &mgr, ::TTree *tree) |
| | Function adding dynamic variable reading capabilities to an auxiliary store object. More...
|
| |
| StatusCode | putAux (::TTree &outTree, TVirtualManager &mgr, bool metadata) |
| | Function saving the dynamically created auxiliary properties. More...
|
| |
| StatusCode | recordAux (TAuxStore *store, const std::string &key) |
| | Function setting up an existing auxiliary store for writing. More...
|
| |
| bool | contains (const std::string &key, const std::type_info &ti, bool metadata) |
| | Internal function checking if an object is in the input. More...
|
| |
| bool | transientContains (const std::string &key, const std::type_info &ti, bool metadata) const |
| | Internal function checking if an object is already in memory. More...
|
| |
| void * | getOutputObject (const std::string &key, const std::type_info &ti, bool metadata) const |
| | Function for retrieving an output object in a non-template way. More...
|
| |
| const void * | getInputObject (const std::string &key, const std::type_info &ti, bool silent, bool metadata) |
| | Function for retrieving an input object in a non-template way. More...
|
| |
| StatusCode | recordTypeless (void *obj, const std::string &typeName, const std::string &key, bool overwrite=false, bool metadata=true, bool isOwner=true) |
| | Internal function for recording an object into the output. More...
|
| |
|
| std::string | m_nm |
| | Message source name. More...
|
| |
| boost::thread_specific_ptr< MsgStream > | m_msg_tls |
| | MsgStream instance (a std::cout like with print-out levels) More...
|
| |
| std::atomic< IMessageSvc * > | m_imsg { nullptr } |
| | MessageSvc pointer. More...
|
| |
| std::atomic< MSG::Level > | m_lvl { MSG::NIL } |
| | Current logging level. More...
|
| |
Tool for accessing xAOD files outside of Athena.
Proper access to xAOD files in ROOT (outside of Athena) needs to be done through such an object. It takes care of reading and writing xAOD files together with their file format metadata, setting up smart pointers correctly, etc.
For a detailed description of the usage of this class, see: <Link to be added here...>
- Author
- Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h
Definition at line 57 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.
◆ Object_t
Definition of the internal data structure type.
Definition at line 304 of file Event.h.
◆ sgkey_t
◆ upgrade_mutex_t
Mutex type for multithread synchronization.
Definition at line 349 of file Event.h.
◆ upgrading_lock_t
Lock type for multithread synchronization.
Definition at line 351 of file Event.h.
◆ EAuxMode
Auxiliary store "mode".
| Enumerator |
|---|
| kBranchAccess | Access auxiliary data branch-by-branch.
|
| kClassAccess | Access auxiliary data using the aux containers.
|
| kAthenaAccess | Access containers/objects like Athena does.
|
Definition at line 69 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.
◆ TEvent() [1/3]
◆ TEvent() [2/3]
◆ TEvent() [3/3]
◆ ~TEvent()
| xAOD::TEvent::~TEvent |
( |
| ) |
|
|
virtual |
◆ addListener()
Register an incident listener object.
This function works pretty much like IIncidentSvc::addListener does in Athena.
It tells the TEvent object that when certain "interesting
incidents" happen, a given object should be notified about it.
- Parameters
-
| listener | Pointer to the object that should be notified |
- Returns
- The usual
StatusCode types
Definition at line 97 of file EventCore.cxx.
100 if (listener ==
nullptr) {
102 return StatusCode::FAILURE;
109 <<
" is already registered");
110 return StatusCode::SUCCESS;
117 return StatusCode::SUCCESS;
◆ addNameRemap()
| StatusCode Event::addNameRemap |
( |
const std::string & |
onfile, |
|
|
const std::string & |
newName |
|
) |
| |
|
inherited |
Add a name re-mapping rule.
The names of containers can change during the lifetime of the experiment.
One such change happened after the DC14 exercise, when many containers got a new name. (Like "ElectronCollection" became simply "Electrons".)
This function allows us to create aliases with which certain containers should be accessible. So that the analyser would be able to access older files, while using the latest container name(s).
- Parameters
-
| onfile | The name of the container as it was saved into the input file |
| newName | The alias with which the object/container should be accessible |
- Returns
- The usual
StatusCode types
Save the new name association:
Definition at line 162 of file EventCore.cxx.
169 << onfile <<
"\" -> \"" <<
newName
171 return StatusCode::FAILURE;
178 << itr->second <<
"\" -> \"" << itr->first <<
"\" with: \""
179 << onfile <<
"\" -> \"" <<
newName <<
"\"");
186 return StatusCode::SUCCESS;
◆ addToStore()
|
|
overrideprotectedinherited |
Add a new proxy to the store.
Smart pointers to objects that don't exist in the input event, can end up calling this function.
In this case warn the user that something fishy is happening, and take posession of the received proxy.
- Parameters
-
| clid | The CLID of the type. Not taken into account. |
| proxy | The proxy to take posession of. Not used for anything useful. |
Definition at line 251 of file EventIProxyDict.cxx.
259 "Function should only be called through an invalid ElementLink");
263 const ::TString uniqueKey =
266 bi.m_proxy.reset(
proxy);
269 std::make_pair(
stringToKey(uniqueKey.Data(), clid), std::move(bi)));
272 return StatusCode::SUCCESS;
◆ auxMode()
◆ clearListeners()
| void Event::clearListeners |
( |
| ) |
|
|
inherited |
Remove all listeners from the object.
This function can be used to remove all the listeners from the internal list.
Should not be necessary under regular circumstances.
Definition at line 143 of file EventCore.cxx.
◆ clearNameRemap()
| void Event::clearNameRemap |
( |
| ) |
|
|
inherited |
Clear the current name re-mapping.
This function simply clears out any existing name remapping declarations.
In case the remapping rules need to be changed in the code in some complicated way.
Definition at line 193 of file EventCore.cxx.
◆ connectAux()
| StatusCode xAOD::TEvent::connectAux |
( |
const std::string & |
prefix, |
|
|
bool |
standalone |
|
) |
| |
|
overrideprotectedvirtual |
Function setting up access to a set of auxiliary branches.
This function is used internally to connect an auxiliary object to the input.
Based on the configuration of the object it will either use TAuxStore, or the EDM object that was used to write the auxiliary information in Athena.
- Parameters
-
| prefix | The prefix (main branch name) of the auxiliary data |
| standalone | Type of the auxiliary store that should be created |
- Returns
- The usual
StatusCode types
Implements xAOD::Event.
Definition at line 1329 of file Control/xAODRootAccess/Root/TEvent.cxx.
1334 return StatusCode::FAILURE;
1342 return StatusCode::SUCCESS;
1347 return StatusCode::SUCCESS;
1355 static constexpr
bool SILENT =
false;
1359 return StatusCode::SUCCESS;
1365 static constexpr
bool TOP_STORE =
true;
1366 auto store = std::make_unique<TAuxStore>(
1379 static constexpr
bool IS_OWNER =
true;
1381 std::make_unique<TAuxManager>(
store.release(), IS_OWNER);
1384 return StatusCode::SUCCESS;
1389 return StatusCode::FAILURE;
◆ connectMetaAux()
| StatusCode xAOD::TEvent::connectMetaAux |
( |
const std::string & |
prefix, |
|
|
bool |
standalone |
|
) |
| |
|
overrideprotectedvirtual |
Function setting up access to a set of auxiliary branches for a metadata object.
This function is used internally to connect an auxiliary metadata object to the input.
Based on the configuration of the object it will either use TAuxStore, or the EDM object that was used to write the auxiliary information in Athena.
- Parameters
-
| prefix | The prefix (main branch name) of the auxiliary data |
| standalone | Type of the auxiliary store that should be created |
- Returns
- The usual
StatusCode types
Implements xAOD::Event.
Definition at line 1401 of file Control/xAODRootAccess/Root/TEvent.cxx.
1405 return StatusCode::SUCCESS;
1411 return StatusCode::FAILURE;
1419 static constexpr
bool SILENT =
false;
1423 return StatusCode::SUCCESS;
1429 static constexpr
bool TOP_STORE =
true;
1430 auto store = std::make_unique<TAuxStore>(
1443 static constexpr
bool IS_OWNER =
true;
1445 std::make_unique<TAuxManager>(
store.release(), IS_OWNER);
1448 return StatusCode::SUCCESS;
1453 return StatusCode::FAILURE;
◆ connectMetaObject()
| StatusCode xAOD::TEvent::connectMetaObject |
( |
const std::string & |
key, |
|
|
bool |
silent |
|
) |
| |
|
overrideprotectedvirtual |
Function setting up access to a particular metadata object.
This is the function doing the heavy lifting with creating metadata objects in memory out of the payload of the input file.
- Parameters
-
| key | The key (branch name) of the metadata object to retrieve |
| silent | Set to kTRUE to make the code fail silently in case the branch can't be connected to |
- Returns
- The usual
StatusCode types
Implements xAOD::Event.
Definition at line 1228 of file Control/xAODRootAccess/Root/TEvent.cxx.
1233 return StatusCode::FAILURE;
1238 return StatusCode::SUCCESS;
1243 if (
br ==
nullptr) {
1246 <<
"\" not available on input");
1248 return StatusCode::RECOVERABLE;
1252 if (
br->GetEntries() == 0) {
1255 <<
"\" doesn't hold any data");
1257 return StatusCode::RECOVERABLE;
1261 br->SetMakeClass(0);
1265 ::EDataType
dt = kOther_t;
1266 if (
br->GetExpectedType(
cl,
dt) || (!
cl)) {
1269 return StatusCode::FAILURE;
1273 void*
ptr =
cl->New();
1275 auto mgr = std::make_unique<TObjectManager>(
1276 nullptr, std::make_unique<THolder>(
ptr,
cl), renewOnRead);
1280 key.c_str(),
mgr->holder()->getPtr(),
mgr->branchPtr(),
cl,
dt, kTRUE);
1283 <<
cl->GetName() <<
"\" to input branch \"" <<
key
1284 <<
"\". Return code: " <<
status);
1286 *(
mgr->holder()->getPtr()) = 0;
1288 return StatusCode::FAILURE;
1292 TObjectManager* mgrPtr =
mgr.get();
1296 if (mgrPtr->getEntry() < 0) {
1299 return StatusCode::FAILURE;
1312 static constexpr
bool METADATA =
true;
1317 return StatusCode::SUCCESS;
◆ connectObject()
| StatusCode xAOD::TEvent::connectObject |
( |
const std::string & |
key, |
|
|
bool |
silent |
|
) |
| |
|
overrideprotectedvirtual |
Function setting up access to a particular object.
This is one of the more important functions of the class.
It connects the event object to a given branch of the input TTree.
The type that is read in to memory is not actually determined by the type written to the tree itself, but from the xAOD::EventFormat object. Which is there to make it possible to possibly use ROOT read rules in the future to read a different type than what's on disk.
Everything else is fairly basic ROOT stuff, the code just has to make sure that the memory management is set up correctly for the created object.
- Parameters
-
| key | The name of the branch to connect to |
| silent | Set to true to make the code fail silently in case the branch can't be connected to |
- Returns
- The usual
StatusCode types
Implements xAOD::Event.
Definition at line 1059 of file Control/xAODRootAccess/Root/TEvent.cxx.
1064 return StatusCode::FAILURE;
1072 return StatusCode::SUCCESS;
1079 return StatusCode::RECOVERABLE;
1094 if (
br ==
nullptr) {
1099 return StatusCode::RECOVERABLE;
1103 br->SetMakeClass(0);
1115 "Couldn't find an appropriate type with a dictionary for branch \""
1117 return StatusCode::FAILURE;
1120 ::TClass* realClass = ::TClass::GetClass(
className.c_str());
1121 if (((!realClass) || (!realClass->IsLoaded())) &&
ef) {
1126 realClass = ::TClass::GetClass(
className.c_str());
1128 if ((!realClass) || (!realClass->IsLoaded())) {
1131 "Couldn't find an appropriate type with a dictionary for branch \""
1133 return StatusCode::FAILURE;
1140 static const ::EDataType
dataType = kOther_t;
1146 void*
ptr =
nullptr;
1150 TObjectManager*
mgr =
dynamic_cast<TObjectManager*
>(out_itr->second.get());
1151 if (
mgr ==
nullptr) {
1153 return StatusCode::FAILURE;
1156 ptr =
mgr->holder()->get();
1162 if (
ptr ==
nullptr) {
1163 ptr = realClass->New();
1168 auto mgr = std::make_unique<TObjectManager>(
1169 nullptr, std::make_unique<THolder>(
ptr, realClass), renewOnRead);
1178 <<
key <<
"\" is " <<
br->GetSplitLevel()
1179 <<
". This can only be read in kAthenaAccess mode.");
1181 *(
mgr->holder()->getPtr()) =
nullptr;
1183 return StatusCode::FAILURE;
1193 <<
"\". Return code: " <<
status);
1195 *(
mgr->holder()->getPtr()) = 0;
1197 return StatusCode::FAILURE;
1201 TObjectManager* mgrPtr =
mgr.get();
1217 return StatusCode::SUCCESS;
◆ contains() [1/2]
template<typename T >
| bool xAOD::Event::contains |
( |
const std::string & |
key | ) |
|
|
inherited |
Function checking if an object is available from the store.
◆ contains() [2/2]
| bool xAOD::Event::contains |
( |
const std::string & |
key, |
|
|
const std::type_info & |
ti, |
|
|
bool |
metadata |
|
) |
| |
|
protectedinherited |
Internal function checking if an object is in the input.
◆ containsMeta()
template<typename T >
| bool xAOD::Event::containsMeta |
( |
const std::string & |
key | ) |
|
|
inherited |
Function checking if a meta-object is available from the store.
◆ copy()
| StatusCode Event::copy |
( |
const std::string & |
pattern = ".*" | ) |
|
|
inherited |
Copy an object directly from the input to the output.
This function can be used to easily copy a given (set of) object/container(s) to the output, without modifying the contents of it/them.
It only needs to be called on the interface object/container(s), the copying of the auxiliary data is done automatically, and is steered by the xAOD::Event::setAuxItemList function.
- Parameters
-
| pattern | Regular expression for the key(s)/name(s) of the object(s)/container(s) to copy |
Definition at line 28 of file EventIO.cxx.
32 <<
"\" to the output");
35 std::set<std::string>
keys;
47 if (std::regex_match(
key,
re) ==
false) {
51 if (
key.ends_with(
"Aux.")) {
55 if (efe.parentName() !=
"") {
59 static const bool SILENT =
true;
75 if (std::regex_match(
newname,
re) ==
false) {
79 static const bool SILENT =
true;
89 for (
const std::string&
key :
keys) {
92 std::string keyToUse =
key;
97 keyToUse = remap_itr->second;
101 static const bool SILENT =
false;
108 return StatusCode::FAILURE;
110 Details::IObjectManager* objMgr =
111 dynamic_cast<Details::IObjectManager*
>(vobjMgr->second.get());
112 if (objMgr ==
nullptr) {
114 return StatusCode::FAILURE;
116 static const bool METADATA =
false;
117 if (
getInputObject(keyToUse, *(objMgr->holder()->getClass()->GetTypeInfo()),
118 SILENT, METADATA) ==
nullptr) {
120 return StatusCode::FAILURE;
125 static const bool IS_OWNER =
true;
126 ATH_CHECK(
record(objMgr->object(), objMgr->holder()->getClass()->GetName(),
127 key, OVERWRITE, METADATA, IS_OWNER));
131 const std::string auxKey = keyToUse +
"Aux.";
139 return StatusCode::SUCCESS;
◆ dump()
| std::string Event::dump |
( |
| ) |
|
|
inherited |
Function creating a user-readable dump of the current input.
This function behaves exactly like StoreGateSvc::dump().
It doesn't actually print anything to the screen, it just returns a user readable dump of the contents of the current input file/chain.
It is a pretty dumb implementation for the moment. Should be made nicer later on.
- Returns
- The user-readable contents of the current input file/chain
Definition at line 250 of file EventCore.cxx.
253 std::ostringstream
ost;
254 ost <<
"<<<<<<<<<<<<<<<<<<<< xAOD::TEvent Dump >>>>>>>>>>>>>>>>>>>>\n";
260 ::TClass*
cl = ::TClass::GetClass(element.className().c_str());
261 const std::type_info* ti = (
cl ?
cl->GetTypeInfo() :
nullptr);
262 if ((
cl ==
nullptr) || (
cl->IsLoaded() ==
false) || (ti ==
nullptr)) {
264 <<
") found in the event format");
269 static const bool METADATA =
false;
270 if (!
contains(element.branchName(), *ti, METADATA)) {
275 ost <<
" Hash: 0x" << std::setw(8) << std::setfill(
'0') << std::hex
276 << element.hash() <<
" Key: \"" << element.branchName() <<
"\"\n";
278 ost <<
" type: " << element.className() <<
"\n";
279 const bool isNonConst =
281 ost <<
" isConst: " << (isNonConst ?
"No" :
"Yes") <<
"\n";
282 static const bool SILENT =
false;
291 ost <<
"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
◆ fill()
| Int_t xAOD::TEvent::fill |
( |
| ) |
|
Function filling one event into the output tree.
This function needs to be called by the user at the end of processing each event that is meant to be written out.
- Returns
- The number of bytes written if successful, a negative number if not
Definition at line 814 of file Control/xAODRootAccess/Root/TEvent.cxx.
841 std::string unsetObjects;
842 std::vector<std::pair<std::string, TVirtualManager*>> outputObjectsCopy;
845 outputObjectsCopy.emplace_back(
key,
mgr.get());
847 for (
auto& [
key,
mgr] : outputObjectsCopy) {
849 if (!
mgr->create()) {
852 if (unsetObjects.size()) {
853 unsetObjects +=
", ";
855 unsetObjects.append(
"\"" +
key +
"\"");
861 static constexpr
bool METADATA =
false;
864 "Failed to put dynamic auxiliary variables "
865 "in the output for object \""
872 if (unsetObjects.size()) {
873 ATH_MSG_ERROR(
"The following objects were not set in the current event: "
881 ATH_MSG_ERROR(
"Output tree filling failed with return value: " << ret);
◆ finishWritingTo()
| StatusCode xAOD::TEvent::finishWritingTo |
( |
::TFile * |
file | ) |
|
Finish writing to an output file.
This function needs to be called when the user is done writing events to a file, before (s)he would close the file itself.
- Parameters
-
| file | The file that the event data is written to |
- Returns
- The usual
StatusCode tyoes
Definition at line 447 of file Control/xAODRootAccess/Root/TEvent.cxx.
451 ATH_MSG_ERROR(
"The object doesn't seem to be connected to an output file!");
452 return StatusCode::FAILURE;
460 const TIncident incident(IncidentType::MetaDataStop);
462 listener->handle(incident);
474 if (
file->Get(METADATA_TREE_NAME)) {
476 return StatusCode::SUCCESS;
481 std::make_unique<TTree>(METADATA_TREE_NAME,
"xAOD metadata tree");
482 metatree->SetAutoSave(10000);
483 metatree->SetAutoFlush(-30000000);
484 metatree->SetDirectory(
file);
493 ::Error(
"xAOD::TEvent::finishWritingTo",
494 XAOD_MESSAGE(
"Class name parsing fails for %s ! "),
e.what());
495 return StatusCode::FAILURE;
501 std::vector<std::pair<std::string, TObjectManager*>> outputMetaObjects;
504 TObjectManager* objMgr =
dynamic_cast<TObjectManager*
>(
mgr.get());
505 if (objMgr ==
nullptr) {
507 return StatusCode::FAILURE;
509 outputMetaObjects.emplace_back(
key, objMgr);
514 for (
auto& [
key,
mgr] : outputMetaObjects) {
518 const ::Int_t splitLevel = (
key.ends_with(
"Aux.") ? 1 : 0);
520 *(
mgr->branchPtr()) =
521 metatree->Branch(
key.c_str(),
mgr->holder()->getClass()->GetName(),
522 mgr->holder()->getPtr(), 32000, splitLevel);
523 if (!
mgr->branch()) {
525 <<
mgr->holder()->getClass()->GetName() <<
"/" <<
key
527 return StatusCode::FAILURE;
531 static constexpr
bool METADATA =
true;
536 if (metatree->Fill() <= 0) {
537 ATH_MSG_ERROR(
"Failed to write event format metadata into the output");
538 metatree->SetDirectory(
nullptr);
539 return StatusCode::FAILURE;
544 metatree->SetDirectory(
nullptr);
550 return StatusCode::SUCCESS;
◆ getBranchInfo()
Get the object describing one object/branch.
Definition at line 347 of file EventIProxyDict.cxx.
356 auto it = m_branches.find(
sgkey);
357 if (
it != m_branches.end()) {
358 return &(
it->second);
371 static const bool SILENT =
true;
372 static const bool METADATA =
false;
384 static const std::type_info&
dummy =
typeid(
Event);
385 nc_this->getInputObject(
name,
dummy, SILENT, METADATA);
394 const Details::IObjectManager*
mgr =
395 dynamic_cast<const Details::IObjectManager*
>(itr->second.get());
400 bi.m_class =
mgr->holder()->getClass();
405 #ifndef XAOD_STANDALONE
407 auto taddr = std::make_unique<SG::TransientAddress>(
408 CLID_NULL, efe->
branchName(),
new GenericAddress());
409 taddr->setSGKey(
sgkey);
412 bi.m_proxy = std::make_unique<SG::DataProxy>(std::move(taddr), loader);
413 loader->
setProxy(*bi.m_proxy.get());
414 #endif // not XAOD_STANDALONE
419 auto ret = m_branches.insert(std::make_pair(
sgkey, std::move(bi)));
422 return &(ret.first->second);
◆ getEntries()
| Long64_t xAOD::TEvent::getEntries |
( |
| ) |
const |
◆ getEntry()
| Int_t xAOD::TEvent::getEntry |
( |
::Long64_t |
entry, |
|
|
::Int_t |
getall = 0 |
|
) |
| |
Function loading a given entry of the input TTree.
This function is used to move to looking at a new entry from the input tree.
It doesn't do any I/O operation at this point, it just remembers which entry the objects should be loaded from later on.
Unless one calls the function with getall==1. In that case all input is force-read. This is necessary when writing out an event that was processed in a load-on-request manner.
- Parameters
-
| entry | The entry from the input tree to load |
| getall | Parameter deciding if partial reading should be used or not. |
- Returns
- The number of bytes read, or a negative number in case of an error
Definition at line 650 of file Control/xAODRootAccess/Root/TEvent.cxx.
664 <<
" from the input chain");
678 static constexpr
bool USE_TREE_CACHE =
false;
703 <<
" from the input file");
719 static const std::string dynStorePostfix =
"Aux.Dynamic";
720 if (
key.ends_with(dynStorePostfix)) {
728 static constexpr
bool SILENT =
true;
729 static constexpr
bool METADATA =
false;
742 const TIncident incident(IncidentType::BeginEvent);
744 listener->handle(incident);
◆ getEventFormatElement()
Get the metadata object for a given "SG key".
Definition at line 321 of file EventIProxyDict.cxx.
325 static const bool QUIET =
true;
336 if (missingSGKeys.emplace(
sgkey).second) {
339 "Can't find EventFormatElement for hashed SG key: " <<
sgkey);
◆ getFile()
| Int_t xAOD::TEvent::getFile |
( |
::Long64_t |
file, |
|
|
::Int_t |
getall = 0 |
|
) |
| |
Load the first event for a given file from the input TChain.
This function can be used to iterate over the input files specified for the object.
It should be most useful for collecting metadata about a set of input files, if there's no regular event loop done to process them.
- Parameters
-
| file | The file number to load |
| getall | If set to 1, all connected branches are loaded |
- Returns
- The number of read bytes on success, or a negative number on failure
Definition at line 780 of file Control/xAODRootAccess/Root/TEvent.cxx.
799 ::Long64_t
entry = 0;
800 for (::Long64_t
i = 0;
i <
file; ++
i) {
◆ getFiles()
| Long64_t xAOD::TEvent::getFiles |
( |
| ) |
const |
Get how many files are available on the currently defined input.
This function can be used to get the number of input files that the object currently knows about.
This is meant to be used to collect the metadata from each of the input files, or to access the metadata using a transient tree. (xAOD::TMetaTree)
- Returns
- The number of input files when reading from a TChain, 1 when reading from a TFile, and 0 if the object is not connected to any input
Definition at line 760 of file Control/xAODRootAccess/Root/TEvent.cxx.
763 return m_inChain->GetListOfFiles()->GetEntries();
◆ getHash()
Function returning the hash describing an object name.
This helper function is mostly needed by the smart pointers of the xAOD EDM.
Right now it very simply just calculates the hash just based on the key given to the function. But later on it might be good to do some tests here, checking if the event format knows about the specified key or not. This is why it's not made to be a static function
- Parameters
-
| key | String key to turn into a hash |
- Returns
- A hash corresponding to the specified string key
Implements xAOD::TVirtualEvent.
Definition at line 27 of file EventTVirtualEvent.cxx.
◆ getInputObject() [1/2]
| const void * Event::getInputObject |
( |
const std::string & |
key, |
|
|
const std::type_info & |
ti, |
|
|
bool |
silent, |
|
|
bool |
metadata |
|
) |
| |
|
protectedinherited |
Function for retrieving an input object in a non-template way.
This is the function doing the heavy lifting to retrieve objects from the input file.
- Parameters
-
| key | The key (branch name) of the object to retrieve |
| ti | The type as which the object is to be retrieved |
| silent | Set to kTRUE to make the code fail silently in case the object can't be retrieved |
| metadata | Flag deciding whether we're looking for a metadata or event data object |
- Returns
- A pointer to the input object if successful, or a null pointer if not
Definition at line 218 of file EventIO.cxx.
223 std::string keyToUse =
key;
228 keyToUse = remap_itr->second;
234 if (
store &&
store->contains(keyToUse, ti) &&
store->isConst(keyToUse, ti)) {
235 const void*
result =
store->getConstObject(keyToUse, ti);
250 if (
sc.isSuccess() ==
false) {
258 auto itr =
objects.find(keyToUse);
260 ATH_MSG_FATAL(
"There is an internal logic error in the code...");
265 Details::IObjectManager*
mgr =
266 dynamic_cast<Details::IObjectManager*
>(itr->second.get());
267 if (
mgr ==
nullptr) {
268 if (
key == keyToUse) {
272 <<
key <<
"\"/\"" << keyToUse <<
"\"");
279 const Int_t readBytes =
mgr->getEntry();
284 static const bool IS_METADATA =
false;
287 <<
mgr->holder()->getClass()->GetName() <<
"/"
291 }
else if (readBytes < 0) {
293 <<
mgr->holder()->getClass()->GetName() <<
"/" << keyToUse);
303 << keyToUse <<
"\" as \""
◆ getInputObject() [2/2]
|
|
overrideprotectedvirtualinherited |
Function for retrieving an input object in a non-template way.
This function is used by the TVirtualEvent interface to access an input object with a given hashed key.
The function looks up the string key belonging to the hash, and then calls the other GetInputObject(...) function in the class with that parameter.
- Parameters
-
| key | The hashed key of the input object |
| ti | The type description of the object requested |
| silent | Switch for being silent about failures or not |
- Returns
- A pointer to the requested object, or a null pointer in case of failure
Implements xAOD::TVirtualEvent.
Definition at line 162 of file EventTVirtualEvent.cxx.
173 static const bool METADATA =
false;
◆ getKey()
Function returning the hash describing a known object.
This function is used by the smart pointer code to find the identifier of an object that's already in the event in some way.
- Parameters
-
| obj | Pointer to the object that we want to look up |
- Returns
- The hashed identifier of the object, or 0 if the object was not found in the event
Implements xAOD::TVirtualEvent.
Definition at line 51 of file EventTVirtualEvent.cxx.
◆ getName() [1/2]
| const std::string & Event::getName |
( |
const void * |
obj | ) |
const |
|
overridevirtualinherited |
Function returning the key describing a known object.
This function is used by the smart pointer code to find the identifier of an object that's already in the event in some way.
- Parameters
-
| obj | Pointer to the object that we want to look up |
- Returns
- The name of the object, or an empty string if the object was not found in the event
Implements xAOD::TVirtualEvent.
Definition at line 64 of file EventTVirtualEvent.cxx.
93 <<
"\" in the event");
94 static const std::string
dummy;
◆ getName() [2/2]
Function returning the key describing a known object.
This function is used primarily when getting the string key of a smart pointer that we read in from a file, or access it in memory.
- Parameters
-
| hash | The hashed key for the container/object |
- Returns
- The name of the object, or an empty string if the object was not found in the event
Implements xAOD::TVirtualEvent.
Definition at line 105 of file EventTVirtualEvent.cxx.
124 static const std::string
dummy;
◆ getNames()
| StatusCode xAOD::TEvent::getNames |
( |
const std::string & |
targetClassName, |
|
|
std::vector< std::string > & |
vkeys, |
|
|
bool |
metadata |
|
) |
| const |
|
overrideprotectedvirtual |
Function determining the list keys associated with a type name.
Implements xAOD::Event.
Definition at line 903 of file Control/xAODRootAccess/Root/TEvent.cxx.
907 std::set<std::string>
keys;
911 std::vector<TObjArray*> fullListOfBranches = {};
917 fullListOfBranches.push_back(
m_inMetaTree->GetListOfBranches());
923 fullListOfBranches.push_back(
m_inTree->GetListOfBranches());
928 TList* fList =
m_inTree->GetListOfFriends();
930 for (TObject* feObj : *fList) {
933 auto* pElement =
dynamic_cast<TFriendElement*
>(feObj);
934 if (pElement ==
nullptr) {
937 TTree* friendTree = pElement->GetTree();
939 fullListOfBranches.push_back(friendTree->GetListOfBranches());
947 for (
const TObjArray* in : fullListOfBranches) {
949 for (
const TObject*
obj : *in) {
951 if (
obj ==
nullptr) {
954 const TBranch* element =
dynamic_cast<const TBranch*
>(
obj);
957 return StatusCode::FAILURE;
959 const std::string objClassName = element->GetClassName();
960 std::string
key =
obj->GetName();
963 if (objClassName == targetClassName) {
973 ATH_MSG_DEBUG(
"Scanning input objects for \"" << targetClassName <<
"\"");
974 for (
const auto& [
key, vmgr] : inAux) {
976 const TObjectManager*
mgr =
dynamic_cast<const TObjectManager*
>(vmgr.get());
977 if (
mgr ==
nullptr) {
980 const std::string& objClassName =
mgr->holder()->getClass()->GetName();
983 if (objClassName == targetClassName) {
995 for (
const TObject*
obj : *
out) {
996 if (
obj ==
nullptr) {
999 const TBranch* element =
dynamic_cast<const TBranch*
>(
obj);
1000 if (element ==
nullptr) {
1002 return StatusCode::FAILURE;
1004 const std::string objClassName = element->GetClassName();
1005 std::string
key =
obj->GetName();
1008 if (objClassName == targetClassName) {
1019 ATH_MSG_DEBUG(
"Scanning output objects for \"" << targetClassName <<
"\"");
1020 for (
const auto& [
key, vmgr] : outAux) {
1022 TObjectManager*
mgr =
dynamic_cast<TObjectManager*
>(vmgr.get());
1023 if (
mgr ==
nullptr) {
1026 const std::string& objClassName =
mgr->holder()->getClass()->GetName();
1029 if (objClassName == targetClassName) {
1036 vkeys.insert(vkeys.end(),
keys.begin(),
keys.end());
1039 return StatusCode::SUCCESS;
◆ getOutputObject() [1/2]
| void * Event::getOutputObject |
( |
const std::string & |
key, |
|
|
const std::type_info & |
ti, |
|
|
bool |
metadata |
|
) |
| const |
|
protectedinherited |
Function for retrieving an output object in a non-template way.
This function does the heavy lifting of retrieving object from the list of output objects.
While it returns a typeless pointer, that pointer can be cast directly to the type described by the second parameter in the caller code.
- Parameters
-
| key | The key (branch name) of the object to retrieve |
| ti | The type as which the object is to be retrieved |
| metadata | Flag deciding whether we're looking for a metadata or event data object |
- Returns
- A pointer to the output object if successful, or a null pointer if not
Definition at line 154 of file EventIO.cxx.
182 if (itr->second->isSet() ==
false) {
187 Details::IObjectManager*
mgr =
188 dynamic_cast<Details::IObjectManager*
>(itr->second.get());
189 if (
mgr ==
nullptr) {
◆ getOutputObject() [2/2]
|
|
overrideprotectedvirtualinherited |
Function for retrieving an output object in a non-template way.
This function is used by the TVirtualEvent interface to access an output object with a given hashed key.
The function looks up the string key belonging to the hash, and then calls the other GetOutputObject(...) function in the class with that parameter.
- Parameters
-
| key | The hashed key of the output object |
| ti | The type description of the object requested |
- Returns
- A pointer to the requested object, or a null pointer in case of failure
Implements xAOD::TVirtualEvent.
Definition at line 138 of file EventTVirtualEvent.cxx.
147 static const bool METADATA =
false;
◆ hasInput()
| bool xAOD::TEvent::hasInput |
( |
| ) |
const |
|
overrideprotectedvirtual |
◆ hasOutput()
| bool xAOD::TEvent::hasOutput |
( |
| ) |
const |
|
overrideprotectedvirtual |
◆ initMessaging()
| void AthMessaging::initMessaging |
( |
| ) |
const |
|
privateinherited |
Initialize our message level and MessageSvc.
This method should only be called once.
Definition at line 39 of file AthMessaging.cxx.
◆ initStats()
| StatusCode xAOD::TEvent::initStats |
( |
| ) |
|
|
protected |
Function to initialise the statistics for all Tree content.
This function is used internally to initialise the reading of an input file.
It prepares the "monitoring information" in memory that gets filled while the code is running, with information about xAOD I/O.
- Returns
- The usual
StatusCode tyoes
Definition at line 1808 of file Control/xAODRootAccess/Root/TEvent.cxx.
1812 return StatusCode::SUCCESS;
1817 ATH_MSG_ERROR(
"Function called on an uninitialised object");
1818 return StatusCode::FAILURE;
1827 for (; itr !=
end; ++itr) {
1830 const std::string& branchName = itr->second.branchName();
1833 if (branchName.find(
"Aux.") != std::string::npos) {
1842 const std::string intName = branchName.substr(0, branchName.size() - 4);
1850 ::Bool_t auxFound = kFALSE;
1853 std::vector<TObjArray*> fullListOfBranches = {};
1855 fullListOfBranches.push_back(
m_inTree->GetListOfBranches());
1858 if (
m_inTree->GetListOfFriends()) {
1860 TList* fList =
m_inTree->GetListOfFriends();
1862 for (TObject* feObj : *fList) {
1865 auto* pElement =
dynamic_cast<TFriendElement*
>(feObj);
1868 TTree* friendTree = pElement->GetTree();
1870 fullListOfBranches.push_back(friendTree->GetListOfBranches());
1875 for (TObjArray*
branches : fullListOfBranches) {
1876 for (Int_t
i = 0;
i <
branches->GetEntriesFast(); ++
i) {
1881 if (
name.BeginsWith(branchName) ||
name.BeginsWith(dynName)) {
1889 << intName <<
"\" belonging to branch \""
1890 << branchName <<
"\"");
1897 ::TClass*
cl = ::TClass::GetClass(
el->className().c_str());
1898 if ((!
cl) || (!
cl->IsLoaded())) {
1900 <<
el->className() <<
"\"");
1907 static ::TClass*
const baseCl = ::TClass::GetClass(baseName.c_str());
1909 ATH_MSG_ERROR(
"Couldn't get dictionary for type \"" << baseName
1911 return StatusCode::FAILURE;
1921 static constexpr
bool TOP_STORE =
true;
1922 TAuxStore temp(branchName, TOP_STORE,
mode);
1923 static constexpr
bool PRINT_WARNINGS =
false;
1931 stats.branch(branchName,
id);
1935 stats.setBranchNum(
stats.branchNum() + temp.getAuxIDs().size());
1940 const ::TBranch* container =
m_inTree->GetBranch(branchName.c_str());
1949 return StatusCode::SUCCESS;
◆ inputEventFormat()
Get information about the input objects.
Definition at line 228 of file EventCore.cxx.
◆ keys()
template<typename T >
| StatusCode xAOD::Event::keys |
( |
std::vector< std::string > & |
vkeys, |
|
|
bool |
metadata |
|
) |
| const |
|
inherited |
Provide a list of all data object keys associated with a specific type.
◆ keyToString() [1/2]
|
|
overrideprotectedinherited |
◆ keyToString() [2/2]
|
|
overrideprotectedinherited |
◆ metaKeys()
template<typename T >
| StatusCode xAOD::Event::metaKeys |
( |
std::vector< std::string > & |
vkeys | ) |
const |
|
inherited |
Provide a list of all metadata object keys associated with a specific type.
◆ msg() [1/2]
| MsgStream & asg::AsgMessaging::msg |
( |
| ) |
const |
|
inherited |
The standard message stream.
- Returns
- A reference to the default message stream of this object.
Definition at line 49 of file AsgMessaging.cxx.
50 #ifndef XAOD_STANDALONE
52 #else // not XAOD_STANDALONE
54 #endif // not XAOD_STANDALONE
◆ msg() [2/2]
| MsgStream & asg::AsgMessaging::msg |
( |
const MSG::Level |
lvl | ) |
const |
|
inherited |
The standard message stream.
- Parameters
-
| lvl | The message level to set the stream to |
- Returns
- A reference to the default message stream, set to level "lvl"
Definition at line 57 of file AsgMessaging.cxx.
58 #ifndef XAOD_STANDALONE
60 #else // not XAOD_STANDALONE
63 #endif // not XAOD_STANDALONE
◆ msgLvl()
| bool asg::AsgMessaging::msgLvl |
( |
const MSG::Level |
lvl | ) |
const |
|
inherited |
Test the output level of the object.
- Parameters
-
| lvl | The message level to test against |
- Returns
- boolean Indicting if messages at given level will be printed
-
true If messages at level "lvl" will be printed
Definition at line 41 of file AsgMessaging.cxx.
42 #ifndef XAOD_STANDALONE
43 return ::AthMessaging::msgLvl( lvl );
44 #else // not XAOD_STANDALONE
45 return m_msg.msgLevel( lvl );
46 #endif // not XAOD_STANDALONE
◆ name()
| const std::string & Event::name |
( |
| ) |
const |
|
overrideprotectedinherited |
◆ outputEventFormat()
Get information about the output objects.
Definition at line 236 of file EventCore.cxx.
◆ printIOStats()
| void Event::printIOStats |
( |
| ) |
const |
|
inherited |
Function printing the I/O statistics of the current process.
This is a convenience function for printing basic I/O information about the current job.
It can be called at the end of a job to get an overview of what the job did exactly I/O-wise.
Definition at line 298 of file EventCore.cxx.
◆ printNameRemap()
| void Event::printNameRemap |
( |
| ) |
const |
|
inherited |
Print the current name re-mapping rules.
This function can be used for debugging, to check what container/object name remapping rules are in place for the current TEvent object.
Definition at line 201 of file EventCore.cxx.
◆ printProxyWarnings()
| void Event::printProxyWarnings |
( |
bool |
value = true | ) |
|
|
inherited |
Enable warnings associated with broken element links.
These appear harmless so long as you don't actually try to access the links.
Which will cause other errors anyway.
- Parameters
-
| value | The new value for the option |
Definition at line 223 of file EventCore.cxx.
◆ proxies()
|
|
overrideprotectedinherited |
return the list of all current proxies in store
Definition at line 275 of file EventIProxyDict.cxx.
279 std::vector<const SG::DataProxy*> ret;
280 for (
const auto&
p : m_branches) {
283 ret.push_back(
proxy);
◆ proxy() [1/2]
|
|
overrideprotectedinherited |
get proxy with given id and key. Returns 0 to flag failure
Definition at line 213 of file EventIProxyDict.cxx.
◆ proxy() [2/2]
|
|
overrideprotectedinherited |
get proxy for a given data object address in memory
Definition at line 185 of file EventIProxyDict.cxx.
196 static const bool QUIET =
true;
210 return bi->m_proxy.get();
◆ proxy_exact()
|
|
overrideprotectedinherited |
◆ putAux()
Function saving the dynamically created auxiliary properties.
This function is used internally to set up the writing of the auxiliary store variables that were dynamically created on an object.
(And not statically defined to be part of that object.)
- Parameters
-
| outTree | The TTree to put the auxiliary branches into |
| mgr | The object manager of the output object |
| metadata | Flag specifying whether the info written is metadata or not |
- Returns
- The usual
StatusCode types
Definition at line 2127 of file Control/xAODRootAccess/Root/TEvent.cxx.
2134 TObjectManager*
mgr =
dynamic_cast<TObjectManager*
>(&vmgr);
2137 return StatusCode::SUCCESS;
2141 if (!
mgr->holder()->getClass()->InheritsFrom(
"SG::IAuxStoreIO")) {
2142 return StatusCode::SUCCESS;
2150 return StatusCode::FAILURE;
2159 sel.selectAux(item_itr->second);
2170 if (auxids.
empty()) {
2171 return StatusCode::SUCCESS;
2175 const std::string dynNamePrefix =
2184 typedef std::pair<std::string, SG::auxid_t> AuxVarSort_t;
2185 std::vector<AuxVarSort_t> varsort;
2186 varsort.reserve(auxids.
size());
2188 varsort.emplace_back(
r.getName(
id),
id);
2190 std::sort(varsort.begin(), varsort.end());
2193 for (
const auto&
p : varsort) {
2199 const std::string
brName = dynNamePrefix +
p.first;
2208 const std::type_info* brType = aux->
getIOType(
id);
2211 return StatusCode::FAILURE;
2214 std::string brProperTypeName =
"<unknown>";
2220 if (strlen(brType->name()) == 1) {
2223 brProperTypeName = brTypeName;
2229 <<
brName <<
"\" of type \"" << brTypeName <<
"\"");
2230 return StatusCode::FAILURE;
2234 std::ostringstream leaflist;
2238 static constexpr
bool IS_OWNER =
false;
2239 auto auxmgr = std::make_unique<TPrimitiveAuxBranchManager>(
2240 id,
nullptr,
new THolder(aux->
getIOData(
id),
nullptr, IS_OWNER));
2243 static constexpr Int_t BASKET_SIZE = 32000;
2244 *(auxmgr->branchPtr()) =
2245 outTree.Branch(
brName.c_str(), auxmgr->holder()->get(),
2246 leaflist.str().c_str(), BASKET_SIZE);
2247 if (!auxmgr->branch()) {
2249 <<
brName <<
"\" out of type \"" << brProperTypeName
2252 *(auxmgr->holder()->getPtr()) = 0;
2253 return StatusCode::FAILURE;
2255 br = auxmgr->branch();
2263 static constexpr Bool_t LOAD_IF_NOT_FOUND = kTRUE;
2264 static constexpr Bool_t
SILENT = kTRUE;
2265 TClass*
cl = TClass::GetClass(*brType, LOAD_IF_NOT_FOUND, SILENT);
2266 if (
cl ==
nullptr) {
2269 cl = TClass::GetClass(brTypeName.c_str());
2271 if (
cl ==
nullptr) {
2273 <<
brName <<
"\" of type \"" << brTypeName <<
"\"");
2274 return StatusCode::FAILURE;
2279 brProperTypeName =
cl->GetName();
2282 static constexpr
bool IS_OWNER =
false;
2283 auto auxmgr = std::make_unique<TAuxBranchManager>(
2284 id,
nullptr,
new THolder(aux->
getIOData(
id),
cl, IS_OWNER));
2287 static constexpr Int_t BASKET_SIZE = 32000;
2288 static constexpr Int_t SPLIT_LEVEL = 0;
2289 *(auxmgr->branchPtr()) = outTree.Branch(
brName.c_str(),
cl->GetName(),
2290 auxmgr->holder()->getPtr(),
2291 BASKET_SIZE, SPLIT_LEVEL);
2292 if (!auxmgr->branch()) {
2294 <<
brName <<
"\" out of type \"" << brProperTypeName
2297 *(auxmgr->holder()->getPtr()) = 0;
2298 return StatusCode::FAILURE;
2300 br = auxmgr->branch();
2308 if (outTree.GetEntries()) {
2309 void*
ptr =
br->GetAddress();
2311 for (::Long64_t
i = 0;
i < outTree.GetEntries(); ++
i) {
2314 br->SetAddress(
ptr);
2321 mgr->branch()->GetName(),
2332 ATH_MSG_FATAL(
"There is an internal logic error in the code...");
2333 return StatusCode::FAILURE;
2339 const_cast<void*
>(
static_cast<const void*
>(aux->
getIOData(
id)));
2340 bmgr->second->setObject(nc_data);
2344 return StatusCode::SUCCESS;
◆ readFrom() [1/2]
| StatusCode xAOD::TEvent::readFrom |
( |
::TFile * |
file, |
|
|
bool |
useTreeCache = true, |
|
|
std::string_view |
treeName = EVENT_TREE_NAME |
|
) |
| |
Connect the object to a new input file.
This function takes care of connecting the event object to a new input file.
It reads in the metadata of the input file needed for reading the file.
- Parameters
-
| file | Pointer to the file being read |
| useTreeCache | Flag for turning on/off the usage of TTreeCache |
| treeName | Name of the input tree |
- Returns
- The usual
StatusCode tyoes
Definition at line 122 of file Control/xAODRootAccess/Root/TEvent.cxx.
126 if (
file ==
nullptr) {
128 return StatusCode::SUCCESS;
155 ATH_MSG_ERROR(
"Couldn't find metadata tree on input. Object is unusable!");
156 return StatusCode::FAILURE;
163 return StatusCode::FAILURE;
168 ATH_MSG_WARNING(
"Was expecting a metadata tree with size 1, instead of "
170 ATH_MSG_WARNING(
"The input file was most probably produced by hadd...");
176 static const std::string eventFormatTypeName =
178 ::TClass*
cl = ::TClass::GetClass(eventFormatTypeName.c_str());
185 auto readEventFormatMetadata = [&](std::string_view thisTreeName) ->
StatusCode {
187 TTree* metaTree =
file->Get<TTree>(thisTreeName.data());
188 if (metaTree ==
nullptr) {
189 ATH_MSG_ERROR(
"Couldn't find metadata tree \"" << thisTreeName
191 return StatusCode::FAILURE;
194 if (metaTree->LoadTree(0) < 0) {
195 ATH_MSG_ERROR(
"Failed to load entry 0 for metadata tree \"" << thisTreeName
197 return StatusCode::FAILURE;
201 const std::string eventFormatBranchName =
203 if (!metaTree->GetBranch(eventFormatBranchName.c_str())) {
207 ATH_MSG_INFO(
"Input file provides no event or metadata");
208 return StatusCode::RECOVERABLE;
215 metaTree->SetBranchAddress(eventFormatBranchName.c_str(), &
format, &
br);
217 ATH_MSG_ERROR(
"Failed to connect to xAOD::EventFormat object");
218 return StatusCode::FAILURE;
223 for (
const auto& [
key, element] : *
format) {
234 return StatusCode::SUCCESS;
239 const StatusCode sc = readEventFormatMetadata(METADATA_TREE_NAME);
240 if (
sc.isRecoverable()) {
243 return StatusCode::SUCCESS;
250 std::set<std::string> lOtherMetaTreeNames = {};
251 TList* lKeys =
file->GetListOfKeys();
254 for (
int iKey = 0; iKey < lKeys->GetEntries(); iKey++) {
256 std::string
keyName = lKeys->At(iKey)->GetName();
260 if ((
keyName != METADATA_TREE_NAME) &&
261 (
keyName.find(
"MetaData") != std::string::npos) &&
262 !(
keyName.find(
"MetaDataHdr") != std::string::npos)) {
264 const char*
className = ((::TKey*)lKeys->At(iKey))->GetClassName();
265 static constexpr Bool_t LOAD = kFALSE;
266 static constexpr Bool_t
SILENT = kTRUE;
267 ::TClass*
cl = ::TClass::GetClass(
className, LOAD, SILENT);
268 if ((
cl !=
nullptr) &&
cl->InheritsFrom(::TTree::Class())) {
270 lOtherMetaTreeNames.insert(std::move(
keyName));
277 for (
const std::string& metaTreeName : lOtherMetaTreeNames) {
278 ATH_CHECK(readEventFormatMetadata(metaTreeName));
305 const TIncident beginIncident(IncidentType::BeginInputFile);
306 for (TVirtualIncidentListener* listener :
m_listeners) {
307 listener->handle(beginIncident);
314 const TIncident endIncident(IncidentType::EndInputFile);
315 for (TVirtualIncidentListener* listener :
m_listeners) {
316 listener->handle(endIncident);
320 return StatusCode::SUCCESS;
◆ readFrom() [2/2]
| StatusCode xAOD::TEvent::readFrom |
( |
::TTree * |
tree, |
|
|
bool |
useTreeCache = true |
|
) |
| |
Connect the object to a new input tree/chain.
This version of the function sets up the object to read information from a tree/chain.
Using it with a TTree pointer makes not much sense, but using it with a TChain pointer could be a very valid usage mode.
- Parameters
-
| tree | The pointer to a TTree or a TChain |
| useTreeCache | Flag for switching TTreeCache usage on/off |
- Returns
- The usual
StatusCode tyoes
Definition at line 331 of file Control/xAODRootAccess/Root/TEvent.cxx.
343 if (useTreeCache && (!
m_inChain->GetCacheSize())) {
353 ATH_MSG_ERROR(
"Couldn't get the list of files from the input TChain");
354 return StatusCode::FAILURE;
356 if (!
files->GetEntries()) {
357 ATH_MSG_ERROR(
"No files are present in the received TChain");
358 return StatusCode::FAILURE;
360 const ::TChainElement* chEl =
361 dynamic_cast<const ::TChainElement*
>(
files->At(0));
364 return StatusCode::FAILURE;
367 std::unique_ptr<TFile> dummyFile{TFile::Open(chEl->GetTitle())};
370 return StatusCode::FAILURE;
385 return StatusCode::SUCCESS;
395 ::TFile*
file =
tree->GetCurrentFile();
◆ record() [1/7]
template<typename T >
| StatusCode xAOD::Event::record |
( |
typename T |
| ) |
|
Add an output object to the event, explicitly taking ownership of it.
◆ record() [2/7]
template<typename T >
| StatusCode xAOD::Event::record |
( |
std::unique_ptr< T > |
obj, |
|
|
const std::string & |
key |
|
) |
| |
|
inherited |
Add an output object to the event, explicitly taking ownership of it.
◆ record() [3/7]
| StatusCode xAOD::TEvent::record |
( |
std::unique_ptr< TAuxStore > |
store, |
|
|
const std::string & |
key |
|
) |
| |
|
protected |
Internal function for adding an auxiliary store object to the output.
This function is used internally when copying an object with its auxiliary store from the input file, and branch access mode is activated for the event object.
The assumption is that the store object already knows what prefix it should be using. The key parameter only specifies under what ID the object should be handled in the output object list.
- Parameters
-
| store | The store object to connect to the output |
| key | The "key" with which to record the object |
- Returns
- The usual
StatusCode tyoes
Definition at line 1964 of file Control/xAODRootAccess/Root/TEvent.cxx.
1970 "No output tree defined. Did you forget to call writeTo(...)?");
1971 return StatusCode::FAILURE;
1975 const std::set<std::string>*
filter = 0;
1978 filter = &(filter_itr->second);
1992 static constexpr
bool OWNS_STORE =
true;
1994 std::make_unique<TAuxManager>(
store.release(), OWNS_STORE);
1997 return StatusCode::SUCCESS;
2001 if (vitr->second->object() ==
store.get()) {
2003 return StatusCode::SUCCESS;
2011 TAuxManager*
mgr =
dynamic_cast<TAuxManager*
>(vitr->second.get());
2012 if (
mgr ==
nullptr) {
2014 <<
key <<
"\" already exists, and is not of type TAuxStore");
2015 return StatusCode::FAILURE;
2030 return StatusCode::SUCCESS;
◆ record() [4/7]
template<typename T >
| StatusCode xAOD::Event::record |
( |
typename T |
| ) |
|
Add an output object to the event.
◆ record() [5/7]
template<typename T >
| StatusCode xAOD::Event::record |
( |
T * |
obj, |
|
|
const std::string & |
key |
|
) |
| |
|
inherited |
Add an output object to the event.
◆ record() [6/7]
| StatusCode xAOD::TEvent::record |
( |
void * |
obj, |
|
|
const std::string & |
typeName, |
|
|
const std::string & |
key, |
|
|
bool |
overwrite, |
|
|
bool |
metadata, |
|
|
bool |
isOwner |
|
) |
| |
|
overrideprotectedvirtual |
Record an object into a connected output file.
This is the function doing the heavy lifting when recording a new object into the output tree/file.
It makes sure that the object is saved together with all of its dynamic auxiliary data if it has any.
- Parameters
-
| obj | A typeless pointer to the object that we want to record |
| typeName | The type name of the output object |
| key | The key (branch name) of the object to record |
| overwrite | Flag selecting if it is allowed to overwrite an already existing object (used internally) |
| metadata | Flag selecting if we are writing an event or a metadata object |
| isOwner | Flag selecting if we should take ownership of the object or not |
- Returns
- The usual
StatusCode tyoes
Implements xAOD::Event.
Definition at line 1638 of file Control/xAODRootAccess/Root/TEvent.cxx.
1645 "No output tree defined. Did you forget to call writeTo(...)?");
1646 return StatusCode::FAILURE;
1657 <<
"\" already recorded");
1658 return StatusCode::FAILURE;
1661 TClass*
cl = TClass::GetClass(
typeName.c_str());
1664 return StatusCode::FAILURE;
1669 nullptr, std::make_unique<THolder>(
obj,
cl, isOwner), renewOnRead);
1671 return StatusCode::SUCCESS;
1678 <<
"\" already accessed from the input, can't be "
1679 "overwritten in memory");
1680 return StatusCode::FAILURE;
1684 const Int_t splitLevel = (
key.ends_with(
"Aux.") ? 1 : 0);
1691 TClass*
cl = TClass::GetClass(
typeName.c_str());
1692 if (
cl ==
nullptr) {
1694 return StatusCode::FAILURE;
1705 auto mgr = std::make_unique<TObjectManager>(
1706 nullptr, std::make_unique<THolder>(
obj,
cl, isOwner), renewOnRead);
1707 TObjectManager* mgrPtr =
mgr.get();
1711 static constexpr Int_t basketSize = 32000;
1712 *(mgrPtr->branchPtr()) =
1714 mgrPtr->holder()->getPtr(), basketSize, splitLevel);
1715 if (!mgrPtr->branch()) {
1717 <<
cl->GetName() <<
"\"");
1719 mgrPtr->holder()->setOwner(kFALSE);
1720 return StatusCode::FAILURE;
1725 static constexpr
bool METADATA =
false;
1730 return StatusCode::SUCCESS;
1734 TObjectManager* omgr =
dynamic_cast<TObjectManager*
>(vitr->second.get());
1736 ATH_MSG_ERROR(
"Manager object of the wrong type encountered");
1737 return StatusCode::FAILURE;
1742 if (
typeName != omgr->holder()->getClass()->GetName()) {
1746 TClass*
cl = TClass::GetClass(
typeName.c_str());
1748 ::strcmp(
cl->GetName(), omgr->holder()->getClass()->GetName())) {
1750 <<
key <<
"\" the previous type was \""
1751 << omgr->holder()->getClass()->GetName()
1752 <<
"\", but the newly requested type is \"" <<
typeName
1754 return StatusCode::FAILURE;
1759 omgr->setObject(
obj);
1762 static constexpr
bool METADATA =
false;
1766 return StatusCode::SUCCESS;
◆ record() [7/7]
| virtual StatusCode xAOD::Event::record |
Record an object into a connected output file.
◆ recordAux() [1/3]
Add an auxiliary store object to the output.
This function can be used to create/retrieve a ROOT-specific auxiliary object container that can be used to write information in the output file.
Any auxiliary information written this way will however only be readable in ROOT, using the kBranchAccess option.
- Parameters
-
| key | The name/prefix of the auxiliary store object/branches |
| type | The type of the auxiliary store (object/container) |
- Returns
- An auxiliary store object that will write to the output
Definition at line 562 of file Control/xAODRootAccess/Root/TEvent.cxx.
589 static constexpr
bool TOP_STORE =
true;
592 ATH_MSG_ERROR(
"Couldn't connect TAuxStore object to the output");
606 TAuxManager*
mgr =
dynamic_cast<TAuxManager*
>(itr->second.get());
◆ recordAux() [2/3]
| StatusCode xAOD::TEvent::recordAux |
( |
TAuxStore * |
store, |
|
|
const std::string & |
key |
|
) |
| |
|
protected |
Function setting up an existing auxiliary store for writing.
Definition at line 2347 of file Control/xAODRootAccess/Root/TEvent.cxx.
2352 return StatusCode::FAILURE;
2356 const std::set<std::string>*
filter = 0;
2359 filter = &(filter_itr->second);
2373 static constexpr
bool OWNS_STORE =
false;
2377 return StatusCode::SUCCESS;
2381 if (vitr->second->object() ==
store) {
2383 return StatusCode::SUCCESS;
2391 TAuxManager*
mgr =
dynamic_cast<TAuxManager*
>(vitr->second.get());
2392 if (
mgr ==
nullptr) {
2394 <<
key <<
"\" already exists, and is not of type TAuxStore");
2395 return StatusCode::FAILURE;
2410 return StatusCode::SUCCESS;
◆ recordAux() [3/3]
Record an auxiliary store into a connected output file.
Implements xAOD::Event.
Definition at line 1769 of file Control/xAODRootAccess/Root/TEvent.cxx.
1773 Details::IObjectManager* iomgr =
dynamic_cast<Details::IObjectManager*
>(&
mgr);
1774 if (iomgr !=
nullptr) {
1777 static const bool IS_OWNER =
true;
1778 ATH_CHECK(
record(iomgr->object(), iomgr->holder()->getClass()->GetName(),
1780 return StatusCode::SUCCESS;
1784 TAuxManager* auxmgr =
dynamic_cast<TAuxManager*
>(&
mgr);
1785 if (auxmgr !=
nullptr) {
1789 "TAuxStore auxiliary objects can only be recorded for event data");
1790 return StatusCode::FAILURE;
1794 return StatusCode::SUCCESS;
1798 ATH_MSG_ERROR(
"Unknown auxiliary store manager type encountered");
1799 return StatusCode::FAILURE;
◆ recordMeta() [1/2]
template<typename T >
| StatusCode xAOD::Event::recordMeta |
( |
std::unique_ptr< T > |
obj, |
|
|
const std::string & |
key |
|
) |
| |
|
inherited |
Add an object to the output file's metadata, explicitly taking ownership of it.
◆ recordMeta() [2/2]
template<typename T >
| StatusCode xAOD::Event::recordMeta |
( |
T * |
obj, |
|
|
const std::string & |
key |
|
) |
| |
|
inherited |
Add an object to the output file's metadata.
◆ recordObject()
|
|
overrideprotectedinherited |
Record an object in the store.
Definition at line 309 of file EventIProxyDict.cxx.
312 throw std::runtime_error(
"xAOD::Event::recordObject is not implemented");
◆ recordTypeless()
| StatusCode xAOD::Event::recordTypeless |
( |
void * |
obj, |
|
|
const std::string & |
typeName, |
|
|
const std::string & |
key, |
|
|
bool |
overwrite = false, |
|
|
bool |
metadata = true, |
|
|
bool |
isOwner = true |
|
) |
| |
|
protectedinherited |
Internal function for recording an object into the output.
◆ registerKey()
|
|
overrideprotectedinherited |
◆ removeListener()
Remove an incident listener object.
This function allows us to remove a listener when for instance a metadata tool is deleted during a job.
- Parameters
-
| listener | Pointer to the listener that should be removed |
- Returns
- The usual
StatusCode types
Definition at line 126 of file EventCore.cxx.
131 ATH_MSG_ERROR(
"Listener " <<
static_cast<void*
>(listener) <<
" not known");
132 return StatusCode::FAILURE;
137 return StatusCode::SUCCESS;
◆ retrieve() [1/4]
template<typename T >
| StatusCode xAOD::Event::retrieve |
( |
const T *& |
obj, |
|
|
const std::string & |
key |
|
) |
| |
|
inherited |
Retrieve either an input or an output object from the event.
◆ retrieve() [2/4]
template<typename T >
| bool xAOD::TVirtualEvent::retrieve |
( |
const T *& |
obj, |
|
|
const std::string & |
key, |
|
|
bool |
silent = false |
|
) |
| |
|
inherited |
Function retrieving an object from the event (constant version)
◆ retrieve() [3/4]
Function retrieving an object from the event (constant version)
◆ retrieve() [4/4]
template<typename T >
| StatusCode xAOD::Event::retrieve |
( |
T *& |
obj, |
|
|
const std::string & |
key |
|
) |
| |
|
inherited |
Retrieve an output object from the event.
◆ retrieveMetaInput()
template<typename T >
| StatusCode xAOD::Event::retrieveMetaInput |
( |
const T *& |
obj, |
|
|
const std::string & |
key |
|
) |
| |
|
inherited |
Retrieve an input metadata object.
◆ retrieveMetaOutput() [1/2]
template<typename T >
| StatusCode xAOD::Event::retrieveMetaOutput |
( |
const T *& |
obj, |
|
|
const std::string & |
key |
|
) |
| |
|
inherited |
Retrieve an output metadata object.
◆ retrieveMetaOutput() [2/2]
template<typename T >
| StatusCode xAOD::Event::retrieveMetaOutput |
( |
T *& |
obj, |
|
|
const std::string & |
key |
|
) |
| |
|
inherited |
Retrieve an output metadata object.
◆ setActive()
| void Event::setActive |
( |
| ) |
const |
|
inherited |
Set this event object as the currently active one.
Definition at line 54 of file EventCore.cxx.
59 #ifndef XAOD_STANDALONE
61 #endif // not XAOD_STANDALONE
◆ setAuxItemList()
| void Event::setAuxItemList |
( |
const std::string & |
containerKey, |
|
|
const std::string & |
itemList |
|
) |
| |
|
inherited |
Configure which dynamic variables to write out for a given store.
This function receives the rules for selecting which dynamic auxiliary branches should be written for a given container, in the exact same format in which we need to set it in the Athena output ItemList.
- Parameters
-
| containerKey | The name of the auxiliary container in question |
| itemList | The variable list according to the formatting rules |
Definition at line 71 of file EventCore.cxx.
81 while (std::getline(
ss, attr,
'.')) {
◆ setAuxStore()
Function connecting a DV object to its auxiliary store.
Every time a DataVector is read in from the input for a new TTree entry, one needs to re-connect it with its auxiliary store.
This function takes care of this.
- Parameters
-
| mgr | The manager object of the DV container |
| metadata | Flag specifying whether we're dealing with a metadata or event data object |
- Returns
- The usual
StatusCode types
Implements xAOD::Event.
Definition at line 1465 of file Control/xAODRootAccess/Root/TEvent.cxx.
1474 return StatusCode::SUCCESS;
1481 TVirtualManager* auxMgr =
nullptr;
1491 return StatusCode::SUCCESS;
1493 auxMgr = itr->second.get();
1494 auxKey =
key +
"Aux.";
1499 const ::Int_t readBytes = auxMgr->getEntry();
1500 if (readBytes < 0) {
1502 "Couldn't load current entry for auxiliary object with key \""
1504 return StatusCode::FAILURE;
1509 const std::string dynAuxKey = auxKey +
"Dynamic";
1510 auto dynAuxMgr =
objects.find(dynAuxKey);
1512 if ((dynAuxMgr !=
objects.end()) &&
1518 dynAuxMgr->second->getEntry();
1529 auto dynAuxMgr =
objects.find(dynAuxKey);
1530 if (dynAuxMgr ==
objects.end()) {
1532 return StatusCode::FAILURE;
1534 dynAuxMgr->second->getEntry();
1541 return StatusCode::SUCCESS;
1547 switch (
mgr.holder()->typeKind()) {
1562 if (
vec && (!
vec->trackIndices())) {
1563 Details::forceTrackIndices(*
vec);
1567 if ((!
vec) && (!aux)) {
1569 <<
mgr.holder()->getClass()->GetName()
1570 <<
"\" as SG::AuxVectorBase or SG::AuxElement");
1571 return StatusCode::FAILURE;
1578 TAuxManager* amgr =
dynamic_cast<TAuxManager*
>(auxMgr);
1581 << auxKey <<
"\" is not of the right type");
1582 return StatusCode::FAILURE;
1584 store = amgr->getConstStore();
1586 if (amgr->getStore()->structMode() ==
1591 amgr->getStore()->setStructMode(
mode);
1595 TObjectManager* omgr =
dynamic_cast<TObjectManager*
>(auxMgr);
1598 << auxKey <<
"\" is not of the right type");
1599 return StatusCode::FAILURE;
1606 return StatusCode::FAILURE;
1616 return StatusCode::FAILURE;
1620 return StatusCode::SUCCESS;
◆ setLevel()
| void AthMessaging::setLevel |
( |
MSG::Level |
lvl | ) |
|
|
inherited |
◆ setUpDynamicStore()
| StatusCode xAOD::TEvent::setUpDynamicStore |
( |
TObjectManager & |
mgr, |
|
|
::TTree * |
tree |
|
) |
| |
|
protected |
Function adding dynamic variable reading capabilities to an auxiliary store object.
This function is used by connectBranch(...) and connectMetaBranch(...) to set up auxiliary store type objects correctly for accessing dynamic variables from the input file.
- Parameters
-
| mgr | The object manager of the auxiliary store object |
| tree | The tree to read dynamic variables from |
- Returns
- The usual
StatusCode types
Definition at line 2041 of file Control/xAODRootAccess/Root/TEvent.cxx.
2044 ::TMethodCall setNameCall;
2048 setNameCall.InitWithPrototype(
mgr.holder()->getClass(),
"setName",
2050 if (setNameCall.IsValid()) {
2055 const char* charParams =
params.Data();
2056 setNameCall.Execute(
mgr.holder()->get(), charParams);
2059 ATH_MSG_WARNING(
"Couldn't find setName(...) function for container \""
2060 <<
mgr.branch()->GetName() <<
"\" (type: "
2061 <<
mgr.holder()->getClass()->GetName() <<
")");
2066 static const TClass*
const holderClass =
2068 if (!
mgr.holder()->getClass()->InheritsFrom(holderClass)) {
2070 return StatusCode::SUCCESS;
2078 return StatusCode::FAILURE;
2085 static constexpr
bool TOP_STORE =
false;
2086 auto store = std::make_unique<TAuxStore>(
2087 mgr.branch()->GetName(), TOP_STORE,
2106 static constexpr
bool SHARED_OWNER =
false;
2108 std::make_unique<TAuxManager>(
store.get(), SHARED_OWNER);
2114 return StatusCode::SUCCESS;
◆ stringToKey()
|
|
overrideprotectedinherited |
◆ transientContains() [1/2]
template<typename T >
| bool xAOD::Event::transientContains |
( |
const std::string & |
key | ) |
const |
|
inherited |
Function checking if an object is already in memory.
◆ transientContains() [2/2]
| bool xAOD::Event::transientContains |
( |
const std::string & |
key, |
|
|
const std::type_info & |
ti, |
|
|
bool |
metadata |
|
) |
| const |
|
protectedinherited |
Internal function checking if an object is already in memory.
◆ transientContainsMeta()
template<typename T >
| bool xAOD::Event::transientContainsMeta |
( |
const std::string & |
key | ) |
const |
|
inherited |
Function checking if a meta-object is already in memory.
◆ writeTo()
| StatusCode xAOD::TEvent::writeTo |
( |
::TFile * |
file, |
|
|
int |
autoFlush = 200, |
|
|
std::string_view |
treeName = EVENT_TREE_NAME |
|
) |
| |
Connect the object to an output file.
This function should be called on a file opened be the user, before any event processing would occur.
It sets up the output event tree.
- Parameters
-
| file | The file that the event data should be written to |
| autoFlush | The auto-flush setting to use on the output TTree |
| treeName | Name of the output event tree |
- Returns
- The usual
StatusCode tyoes
Definition at line 408 of file Control/xAODRootAccess/Root/TEvent.cxx.
414 return StatusCode::FAILURE;
419 ATH_MSG_ERROR(
"Object already writing to a file. Close that file first!");
420 return StatusCode::FAILURE;
438 return StatusCode::SUCCESS;
◆ ::xAODTEventBranch
◆ ::xAODTMetaBranch
◆ CP::xAODWriterAlg
◆ MakeTransientTree
◆ xAOD::TFileMerger
◆ xAOD::TTreeMgr
◆ ATLAS_THREAD_SAFE
|
|
mutableprotectedinherited |
Map from hashed sgkey to BranchInfo.
Definition at line 358 of file Event.h.
◆ DEFAULT_KEY
| constexpr sgkey_t xAOD::TVirtualEvent::DEFAULT_KEY = ~static_cast<sgkey_t>(0) |
|
staticconstexprinherited |
Key for retrieving the "default" object of a given type.
Definition at line 35 of file TVirtualEvent.h.
◆ EVENT_TREE_NAME
◆ KEY_MASK
Mask for the keys, used mostly internally.
Definition at line 37 of file TVirtualEvent.h.
◆ m_auxItemList
| std::unordered_map<std::string, std::set<std::string> > xAOD::Event::m_auxItemList |
|
protectedinherited |
Rules for selecting which auxiliary branches to write.
Definition at line 326 of file Event.h.
◆ m_auxMode
◆ m_branchesMutex
|
|
mutableprotectedinherited |
Mutex for multithread synchronization.
Definition at line 354 of file Event.h.
◆ m_entry
| ::Long64_t xAOD::TEvent::m_entry = -1 |
|
protected |
◆ m_imsg
| std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr } |
|
mutableprivateinherited |
◆ m_inChain
| ::TChain* xAOD::TEvent::m_inChain = nullptr |
|
protected |
◆ m_inChainTracker
◆ m_inMetaTree
| ::TTree* xAOD::TEvent::m_inMetaTree = nullptr |
|
protected |
◆ m_inputEventFormat
Format of the current input file.
Definition at line 321 of file Event.h.
◆ m_inputMetaObjects
| Object_t xAOD::Event::m_inputMetaObjects |
|
protectedinherited |
Collection of all the managed input meta-objects.
Definition at line 316 of file Event.h.
◆ m_inputMissingObjects
| std::set<std::string> xAOD::Event::m_inputMissingObjects |
|
protectedinherited |
Objects that have been asked for, but were found to be missing in the current input.
Definition at line 311 of file Event.h.
◆ m_inputObjects
Collection of all the managed input objects.
Definition at line 308 of file Event.h.
◆ m_inTree
| ::TTree* xAOD::TEvent::m_inTree = nullptr |
|
protected |
◆ m_inTreeMissing
| bool xAOD::TEvent::m_inTreeMissing = false |
|
protected |
◆ m_inTreeNumber
| ::Int_t xAOD::TEvent::m_inTreeNumber = -1 |
|
protected |
◆ m_listeners
Listeners who should be notified when certain incidents happen.
Definition at line 329 of file Event.h.
◆ m_lvl
| std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL } |
|
mutableprivateinherited |
◆ m_msg_tls
| boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls |
|
mutableprivateinherited |
MsgStream instance (a std::cout like with print-out levels)
Definition at line 132 of file AthMessaging.h.
◆ m_nameRemapping
| std::unordered_map<std::string, std::string> xAOD::Event::m_nameRemapping |
|
protectedinherited |
Container name re-mapping rules.
Definition at line 332 of file Event.h.
◆ m_nm
| std::string AthMessaging::m_nm |
|
privateinherited |
◆ m_outputEventFormat
| EventFormat* xAOD::Event::m_outputEventFormat = nullptr |
|
protectedinherited |
Format of the current output file.
Definition at line 323 of file Event.h.
◆ m_outputMetaObjects
| Object_t xAOD::Event::m_outputMetaObjects |
|
protectedinherited |
Collection of all the managed output meta-objects.
Definition at line 318 of file Event.h.
◆ m_outputObjects
Collection of all the managed output object.
Definition at line 313 of file Event.h.
◆ m_outTree
| std::unique_ptr<::TTree> xAOD::TEvent::m_outTree |
|
protected |
◆ m_printEventProxyWarnings
| bool xAOD::Event::m_printEventProxyWarnings = false |
|
protectedinherited |
Option to silence common warnings that seem to be harmless.
Definition at line 335 of file Event.h.
The documentation for this class was generated from the following files:
::Int_t m_inTreeNumber
The number of the currently open tree in the input chain.
bool m_inTreeMissing
Internal status flag showing that an input file is open, but it doesn't contain an event tree.
JetConstituentVector::iterator iterator
StatusCode keys(std::vector< std::string > &vkeys, bool metadata) const
Provide a list of all data object keys associated with a specific type.
std::atomic< MSG::Level > m_lvl
Current logging level.
const xAOD::EventFormatElement * getEventFormatElement(SG::sgkey_t sgkey) const
Get the metadata object for a given "SG key".
@ AUXELEMENT
A type inheriting from SG::AuxElement.
std::unique_ptr< TChainStateTracker > m_inChainTracker
Optional object for tracking the state changes of an input TChain.
TEvent(EAuxMode mode=kClassAccess)
Default constructor.
SG::SGKeyMap< BranchInfo > m_branches ATLAS_THREAD_SAFE
Map from hashed sgkey to BranchInfo.
EAuxMode m_auxMode
The auxiliary access mode.
virtual AuxStoreType getStoreType() const =0
Return the type of the store object.
virtual StatusCode setAuxStore(const std::string &key, Details::IObjectManager &mgr, bool metadata)=0
Function connecting a DV object to its auxiliary store.
std::string find(const std::string &s)
return a remapped string
ReadStats & stats()
Access the object belonging to the current thread.
const std::string & name() const override
Get the name of the instance.
StatusCode record(void *obj, const std::string &typeName, const std::string &key, bool overwrite, bool metadata, bool isOwner) override
Record an object into a connected output file.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
@ SILENT
don't print anything and return success
static void setEvent(TVirtualEvent *ptr)
Set the active event pointer.
Object_t m_inputObjects
Collection of all the managed input objects.
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
Object_t m_outputMetaObjects
Collection of all the managed output meta-objects.
EventFormat m_inputEventFormat
Format of the current input file.
Base class for elements of a container that can have aux data.
@ DATAVECTOR
A DataVector container.
@ kAthenaAccess
Access containers/objects like Athena does.
void setActive() const
Set this event object as the currently active one.
void setProxy(SG::DataProxy &proxy)
::TChain * m_inChain
The (optional) chain provided as input.
Event(std::string_view name)
Constructor with a name.
void Print(::Option_t *option="") const
Print information about the collected statistics.
EStructMode
"Structural" modes of the object
static IProxyDict * setStore(IProxyDict *store)
Set the current store.
bool hasInput() const override
Check if an input file is connected to the object.
static TStore * store()
Access the currently active TStore object.
BranchStats * container(const std::string &name)
Access the description of a container. Creating it if necessary.
SG::sgkey_t stringToKey(const std::string &str, CLID clid) override
Find the string corresponding to a given key.
std::vector< size_t > vec
std::unordered_map< std::string, std::string > m_nameRemapping
Container name re-mapping rules.
#define ATH_MSG_VERBOSE(x)
@ kClassAccess
Access auxiliary data using the aux containers.
virtual const std::type_info * getIOType(SG::auxid_t auxid) const =0
Return the type of the data to be stored for one aux data item.
@ kObjectStore
The object describes a single object.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::vector< TVirtualIncidentListener * > m_listeners
Listeners who should be notified when certain incidents happen.
@ kContainerStore
The object describes an entire container.
Manage index tracking and synchronization of auxiliary data.
IMessageSvc * getMessageSvc(bool quiet=false)
::TTree * m_inMetaTree
Pointer to the metadata tree in the input file.
StatusCode connectAux(const std::string &prefix, bool standalone) override
Function setting up access to a set of auxiliary branches.
std::unordered_map< std::string, std::unique_ptr< TVirtualManager > > Object_t
Definition of the internal data structure type.
Object_t m_inputMetaObjects
Collection of all the managed input meta-objects.
Interface providing I/O for a generic auxiliary store.
std::string dynBranchPrefix(const std::string &key)
This function is used to figure out what to name dynamic auxiliary branches coming from a container c...
void nextEvent()
Function incrementing the processed event counter.
bool hasOutput() const override
Check if an output file is connected to the object.
StatusCode connectMetaAux(const std::string &prefix, bool standalone) override
Function setting up access to a set of auxiliary branches for a metadata object.
const std::string & getName(const void *obj) const override
Function returning the key describing a known object.
Handle mappings between names and auxid_t.
size_t auxid_t
Identifier for a particular aux data item.
bool m_printEventProxyWarnings
Option to silence common warnings that seem to be harmless.
bit_t size() const
Count the number of 1 bits in the set.
std::unordered_map< std::string, std::set< std::string > > m_auxItemList
Rules for selecting which auxiliary branches to write.
::TTree * m_inTree
The main tree that we are reading from.
std::string getTypeName(const std::type_info &ti)
This function is necessary in order to create type names that ROOT can understand.
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
AthContainers_detail::lock_guard< mutex_t > guard_t
Guard type for multithreaded synchronisation.
virtual StatusCode connectMetaObject(const std::string &key, bool silent)=0
Function setting up access to a particular metadata object.
::Long64_t getEntries() const
Get how many entries are available from the current input file(s)
::StatusCode StatusCode
StatusCode definition for legacy code.
::Int_t getEntry(::Long64_t entry, ::Int_t getall=0)
Function loading a given entry of the input TTree.
virtual SG::auxid_set_t getSelectedAuxIDs() const
Get a list of dynamic variables that need to be written out.
upgrade_mutex_t m_branchesMutex
Mutex for multithread synchronization.
void * getOutputObject(SG::sgkey_t key, const std::type_info &ti) override
Function for retrieving an output object in a non-template way.
virtual StatusCode recordAux(TVirtualManager &mgr, const std::string &key, bool metadata)=0
Record an auxiliary store into a connected output file.
bool isStandalone(const TClass &cl)
Helper function deciding if a given type "is a standalone object".
SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const override
Get proxy given a hashed key+clid.
void setBranchNum(::Int_t num)
Set the total number of branches on the input.
bool empty() const
Return true if there are no 1 bits in the set.
static IOStats & instance()
Singleton object accessor.
const void * getInputObject(SG::sgkey_t key, const std::type_info &ti, bool silent) override
Function for retrieving an input object in a non-template way.
virtual bool hasInput() const =0
Check if an input file is connected to the object.
@ OVERWRITE
create the directory as is, removing existing directories if needed
StatusCode record(T *obj, const std::string &key)
Add an output object to the event.
virtual void setStore(IAuxStore *store)=0
Give an auxiliary store object to the holder object.
std::unique_ptr<::TTree > m_outTree
The tree that we are writing to.
std::set< std::string > m_inputMissingObjects
Objects that have been asked for, but were found to be missing in the current input.
Class helping in dealing with dynamic branch selection.
Object_t m_outputObjects
Collection of all the managed output object.
AthContainers_detail::upgrading_lock< upgrade_mutex_t > upgrading_lock_t
Lock type for multithread synchronization.
std::unordered_set< sgkey_t > SGKeySet
A set of sgkey_t values.
StatusCode readFrom(::TFile *file, bool useTreeCache=true, std::string_view treeName=EVENT_TREE_NAME)
Connect the object to a new input file.
virtual StatusCode connectObject(const std::string &key, bool silent)=0
Function setting up access to a particular object.
void readContainer(const std::string &name)
Function incrementing the read counter on a specific container.
StatusCode initStats()
Function to initialise the statistics for all Tree content.
Manager for EDM objects created by ROOT.
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
virtual const void * getIOData(SG::auxid_t auxid) const =0
Return a pointer to the data to be stored for one aux data item.
bool contains(const std::string &key)
Function checking if an object is available from the store.
StatusCode putAux(::TTree &outTree, TVirtualManager &mgr, bool metadata)
Function saving the dynamically created auxiliary properties.
StatusCode setUpDynamicStore(TObjectManager &mgr, ::TTree *tree)
Function adding dynamic variable reading capabilities to an auxiliary store object.
::Long64_t getFiles() const
Get how many files are available on the currently defined input.
Exception to signal a malformed class name.
EventFormat * m_outputEventFormat
Format of the current output file.
def silent(func)
Redirect stdout/err to /dev/null Useful wrapper to get rid of ROOT verbosity...
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
#define ATH_MSG_WARNING(x)
AthContainers_detail::mutex mutex_t
Mutex type for multithread synchronization.
std::string getFirstBranchMatch(TTree *tree, const std::string &pre)
This function is used to search for a branch in a TTree that contains a given substring.
std::string m_nm
Message source name.
EventFormat_v1 EventFormat
Definition of the current event format version.
const boost::regex re(r_e)
::Long64_t m_entry
The entry to look at from the input tree.
StatusCode connectMetaObject(const std::string &key, bool silent) override
Function setting up access to a particular metadata object.
SG::IAuxStore * recordAux(const std::string &key, SG::IAuxStoreHolder::AuxStoreType type=SG::IAuxStoreHolder::AST_ContainerStore)
Add an auxiliary store object to the output.
StatusCode setAuxStore(const std::string &key, Details::IObjectManager &mgr, bool metadata) override
Function connecting a DV object to its auxiliary store.
@ kUndefinedStore
The structure mode is not defined.
SG::DataProxy * proxy(const void *const pTransient) const override
get proxy for a given data object address in memory
SG::sgkey_t getHash(const std::string &key) const override
Function returning the hash describing an object name.
A set of aux data identifiers.
bool hasAuxStore(const TClass &cl)
Helper function deciding if a given type "has an auxiliary store".
@ kBranchAccess
Access auxiliary data branch-by-branch.
const BranchInfo * getBranchInfo(SG::sgkey_t sgkey) const
Get the object describing one object/branch.
StatusCode connectObject(const std::string &key, bool silent) override
Function setting up access to a particular object.
Class describing the access statistics of a collection of branches.
Interface for const operations on an auxiliary store.
@ AST_ObjectStore
The store describes a single object.
Interface for objects taking part in direct ROOT I/O.
SG::sgkey_t hash(const std::string &name)
This function provides a hashed version of the key (branch) names used in the xAOD file,...
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
char rootType(char typeidType)
This function is used internally in the code when creating primitive dynamic auxiliary branches.
bool transientContains(const std::string &key) const
Function checking if an object is already in memory.
@ AST_ContainerStore
The store describes a container.
bool isAuxStore(const TClass &cl)
Helper function deciding if a given type "is an auxiliary store".