31const char*
const Event::EVENT_RNTUPLE_NAME =
"EventData";
33const char*
const Event::EVENT_TREE_NAME =
"CollectionTree";
35const char*
const Event::METADATA_OBJECT_NAME =
"MetaData";
46 auto event = std::make_unique<Experimental::REvent>();
47 if (event->readFrom(inFile).isFailure()) {
48 ANA_MSG_ERROR(
"Could not read RNTuple from: " << inFile.GetName());
54 auto event = std::make_unique<TEvent>();
55 if (event->readFrom(inFile).isFailure()) {
56 ANA_MSG_ERROR(
"Could not read TTree from: " << inFile.GetName());
61 ANA_MSG_ERROR(
"Could not recognize file: " << inFile.GetName());
78 ATH_MSG_DEBUG(
"Copying objects matching pattern \"" << pattern
79 <<
"\" to the output");
82 std::set<std::string>
keys;
85 std::regex
re{pattern};
94 if (std::regex_match(key,
re) ==
false) {
98 if (key.ends_with(
"Aux.")) {
102 if (efe.parentName() !=
"") {
106 static const bool SILENT =
true;
122 if (std::regex_match(newname,
re) ==
false) {
126 static const bool SILENT =
true;
132 keys.insert(newname);
136 for (
const std::string& key :
keys) {
139 std::string keyToUse = key;
144 keyToUse = remap_itr->second;
148 static const bool SILENT =
false;
155 return StatusCode::FAILURE;
159 if (objMgr ==
nullptr) {
161 return StatusCode::FAILURE;
163 static const bool METADATA =
false;
165 SILENT, METADATA) ==
nullptr) {
167 return StatusCode::FAILURE;
171 static const bool OVERWRITE =
true;
172 static const bool IS_OWNER =
true;
174 key, OVERWRITE, METADATA, IS_OWNER));
178 const std::string auxKey = keyToUse +
"Aux.";
186 return StatusCode::SUCCESS;
202 bool metadata)
const {
208 auto itr = objects.find(key);
209 if (itr == objects.end()) {
215 if ((!store) || (!store->contains(key, ti)) || store->isConst(key, ti)) {
220 void*
result = store->getObject(key, ti);
229 if (itr->second->isSet() ==
false) {
236 if (mgr ==
nullptr) {
237 ATH_MSG_ERROR(
"Object of wrong type found for key \"" << key <<
"\"");
242 void*
result = mgr->holder()->getAs(ti);
266 const std::type_info& ti,
bool silent,
270 std::string keyToUse = key;
275 keyToUse = remap_itr->second;
281 if (store && store->contains(keyToUse, ti) && store->isConst(keyToUse, ti)) {
282 const void*
result = store->getConstObject(keyToUse, ti);
288 if (silent ==
false) {
297 if (
sc.isSuccess() ==
false) {
305 auto itr = objects.find(keyToUse);
306 if (itr == objects.end()) {
307 ATH_MSG_FATAL(
"There is an internal logic error in the code...");
314 if (mgr ==
nullptr) {
315 if (key == keyToUse) {
316 ATH_MSG_ERROR(
"Object of wrong type found for key \"" << key <<
"\"");
319 << key <<
"\"/\"" << keyToUse <<
"\"");
325 if (metadata ==
false) {
326 const Int_t readBytes = mgr->getEntry();
331 static const bool IS_METADATA =
false;
332 if (
setAuxStore(key, *mgr, IS_METADATA).isSuccess() ==
false) {
334 << mgr->holder()->getClass()->GetName() <<
"/"
338 }
else if (readBytes < 0) {
340 << mgr->holder()->getClass()->GetName() <<
"/" << keyToUse);
346 const void*
result = mgr->holder()->getAsConst(ti, silent);
350 << keyToUse <<
"\" as \""
369::Bool_t
Event::contains(
const std::string& key,
const std::type_info& ti,
372 static const bool SILENT =
true;
373 return ((getOutputObject(key, ti, metadata) !=
nullptr) ||
374 (getInputObject(key, ti, SILENT, metadata) !=
nullptr));
388::Bool_t Event::transientContains(
const std::string& key,
389 const std::type_info& ti,
390 ::Bool_t metadata)
const {
392 return (getOutputObject(key, ti, metadata) !=
nullptr);
const boost::regex re(r_e)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Manager for EDM objects created by ROOT.
const THolder * holder() const
Accessor to the Holder object.
virtual bool hasInput() const =0
Check if an input file is connected to the object.
EventFormat m_inputEventFormat
Format of the current input file.
virtual StatusCode recordAux(TVirtualManager &mgr, const std::string &key, bool metadata)=0
Record an auxiliary store into a connected output file.
static std::unique_ptr< Event > createAndReadFrom(TFile &file)
static method to create an Event object and readFrom a file, given by a TFile.
bool contains(const std::string &key)
Function checking if an object is available from the store.
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 StatusCode connectObject(const std::string &key, bool silent)=0
Function setting up access to a particular object.
Object_t m_inputObjects
Collection of all the managed input objects.
static const char *const EVENT_TREE_NAME
Default name of the event TTree.
StatusCode copy(const std::string &pattern=".*")
Copy an object directly from the input to the output.
std::unordered_map< std::string, std::unique_ptr< TVirtualManager > > Object_t
Definition of the internal data structure type.
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 connectMetaObject(const std::string &key, bool silent)=0
Function setting up access to a particular metadata object.
virtual StatusCode setAuxStore(const std::string &key, Details::IObjectManager &mgr, bool metadata)=0
Function connecting a DV object to its auxiliary store.
StatusCode record(T *obj, const std::string &key)
Add an output object to the event.
StatusCode keys(std::vector< std::string > &vkeys, bool metadata) const
Provide a list of all data object keys associated with a specific type.
static const char *const EVENT_RNTUPLE_NAME
Name of the event RNTuple.
std::unordered_map< std::string, std::string > m_nameRemapping
Container name re-mapping rules.
Object_t m_inputMetaObjects
Collection of all the managed input meta-objects.
Object_t m_outputObjects
Collection of all the managed output object.
Object_t m_outputMetaObjects
Collection of all the managed output meta-objects.
static TStore * store()
Access the currently active TStore object.
const ::TClass * getClass() const
A relatively simple transient store for objects created in analysis.
virtual const void * object() const =0
Function getting a const pointer to the object being handled.
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...
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Convert a type_info to a normalized string representation (matching the names used in the root dictio...