ATLAS Offline Software
RNTupleAuxDynReader.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef RNTUPLEAUXDYNREADER_H
6 #define RNTUPLEAUXDYNREADER_H
7 
11 
12 #include "ROOT/RNTupleView.hxx"
13 
14 #include <map>
15 #include <string>
16 
17 namespace ROOT::Experimental {
18  class RNTupleReader;
19 }
20 class TClass;
21 
22 namespace RootAuxDynIO
23 {
25  using ROOT::Experimental::RNTupleView;
26 
28  {
29  public :
30 
31  struct FieldInfo
32  {
34 
35  TClass* tclass = 0;
36  TClass* SE_tclass = 0;
37 
38  bool isPackedContainer = false;
39  bool needsSE = false;
41 
43  std::string attribName;
44  std::string fieldName;
45 #if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 33, 0 )
46  std::unique_ptr< RNTupleView<void> > view_p; // pointer because lack of default xtor
47 #else
48  std::unique_ptr< RNTupleView<void, true> > view_p; // pointer because lack of default xtor
49 #endif
50  };
51 
52 
54  RNTupleAuxDynReader(const std::string& field_name, const std::string& field_type, RNTupleReader* reader);
55 
57  void init(bool standalone);
58 
60  virtual void addReaderToObject(void* object, size_t row, std::recursive_mutex* iomtx = nullptr ) override final;
61 
63  virtual const SG::auxid_set_t& auxIDs() const override final;
64 
65  void addBytes(size_t bytes);
66 
67  virtual size_t getBytesRead() const override final;
68 
69  virtual void resetBytesRead() override final;
70 
72  const FieldInfo& getFieldInfo(const SG::auxid_t& auxid, const SG::AuxStoreInternal& store);
73 
75 
76  virtual ~RNTupleAuxDynReader() {}
77 
78  protected:
79  // auxids that could be found in registry for attribute names from the file
81 
82  std::string m_storeFieldName;
83  // counter for bytes read
84  size_t m_bytesRead = 0;
85  // offset of the AxuStoreHolder base class in the objects read by the Reader
87  bool m_initialized = false;
88  std::string m_key;
89 
90  // map auxid -> fieldInfo.
91  std::map<SG::auxid_t, FieldInfo> m_fieldInfos;
92 
93  // not owned
95  };
96 
97 
98 
99  inline void RNTupleAuxDynReader::addBytes(size_t bytes) {
100  m_bytesRead += bytes;
101  }
102 
103  inline size_t RNTupleAuxDynReader::getBytesRead() const {
104  return m_bytesRead;
105  }
106 
108  m_bytesRead = 0;
109  }
110 
112  return m_auxids;
113  }
114 
116  return m_ntupleReader;
117  }
118 
119 } //namespace
120 #endif
121 
query_example.row
row
Definition: query_example.py:24
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:71
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::TypeError
@ TypeError
Definition: RNTupleAuxDynReader.h:33
RootAuxDynIO::RNTupleAuxDynReader
Definition: RNTupleAuxDynReader.h:28
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
L1CaloPhase1Monitoring.standalone
standalone
Definition: L1CaloPhase1Monitoring.py:112
RootAuxDynIO::RNTupleAuxDynReader::RNTupleAuxDynReader
RNTupleAuxDynReader(const std::string &field_name, const std::string &field_type, RNTupleReader *reader)
create Reader for Aux attributes of an AuxContainer object stored in a given field
Definition: RNTupleAuxDynReader.cxx:157
RootAuxDynIO::RNTupleAuxDynReader::m_ntupleReader
RNTupleReader * m_ntupleReader
Definition: RNTupleAuxDynReader.h:94
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::Status
Status
Definition: RNTupleAuxDynReader.h:33
RootAuxDynIO::RNTupleAuxDynReader::m_storeHolderOffset
int m_storeHolderOffset
Definition: RNTupleAuxDynReader.h:86
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo
Definition: RNTupleAuxDynReader.h:32
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::Initialized
@ Initialized
Definition: RNTupleAuxDynReader.h:33
pool::RootCollection::RNTupleReader
ROOT::Experimental::RNTupleReader RNTupleReader
Definition: RNTCollection.h:38
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::SE_tclass
TClass * SE_tclass
Definition: RNTupleAuxDynReader.h:36
RootAuxDynIO::RNTupleAuxDynReader::getFieldInfo
const FieldInfo & getFieldInfo(const SG::auxid_t &auxid, const SG::AuxStoreInternal &store)
get field informatino for auxid
Definition: RNTupleAuxDynReader.cxx:228
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
RootAuxDynIO::RNTupleAuxDynReader::m_key
std::string m_key
Definition: RNTupleAuxDynReader.h:88
RootAuxDynIO::RNTupleAuxDynReader::m_auxids
SG::auxid_set_t m_auxids
Definition: RNTupleAuxDynReader.h:80
RootAuxDynIO::RNTupleAuxDynReader::addReaderToObject
virtual void addReaderToObject(void *object, size_t row, std::recursive_mutex *iomtx=nullptr) override final
attach RNTupleAuxStore to the current Aux container @object
Definition: RNTupleAuxDynReader.cxx:293
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::NotFound
@ NotFound
Definition: RNTupleAuxDynReader.h:33
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::view_p
std::unique_ptr< RNTupleView< void > > view_p
Definition: RNTupleAuxDynReader.h:46
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
RootAuxDynIO::RNTupleAuxDynReader::m_bytesRead
size_t m_bytesRead
Definition: RNTupleAuxDynReader.h:84
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::attribName
std::string attribName
Definition: RNTupleAuxDynReader.h:43
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::fieldName
std::string fieldName
Definition: RNTupleAuxDynReader.h:44
RNTupleReader
ROOT::Experimental::RNTupleReader RNTupleReader
Definition: RNTCollectionSchemaEditor.h:21
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::auxid
SG::auxid_t auxid
Definition: RNTupleAuxDynReader.h:42
RootAuxDynIO::RNTupleAuxDynReader::resetBytesRead
virtual void resetBytesRead() override final
Definition: RNTupleAuxDynReader.h:107
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::status
enum Status status
Definition: RNTupleAuxDynReader.h:40
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::needsSE
bool needsSE
Definition: RNTupleAuxDynReader.h:39
RootAuxDynIO::RNTupleAuxDynReader::init
void init(bool standalone)
initialize once the mode of the Aux store is known
Definition: RNTupleAuxDynReader.cxx:188
RootAuxDynIO::RNTupleAuxDynReader::m_initialized
bool m_initialized
Definition: RNTupleAuxDynReader.h:87
RootAuxDynIO::RNTupleAuxDynReader::auxIDs
virtual const SG::auxid_set_t & auxIDs() const override final
Aux IDs of all the Aux attributes belonging to the Aux container being read.
Definition: RNTupleAuxDynReader.h:111
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::isPackedContainer
bool isPackedContainer
Definition: RNTupleAuxDynReader.h:38
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::tclass
TClass * tclass
Definition: RNTupleAuxDynReader.h:35
RootAuxDynIO::RNTupleAuxDynReader::m_fieldInfos
std::map< SG::auxid_t, FieldInfo > m_fieldInfos
Definition: RNTupleAuxDynReader.h:91
RootAuxDynIO::IRootAuxDynReader
Definition: RootAuxDynIO.h:65
RootAuxDynIO
Specialization of RootAuxDynStore for reading Aux Dynamic attributes from RNTuple.
Definition: RNTupleContainer.h:25
RootAuxDynIO::RNTupleAuxDynReader::getBytesRead
virtual size_t getBytesRead() const override final
Definition: RNTupleAuxDynReader.h:103
AthMessaging.h
RootAuxDynIO.h
RootAuxDynIO::RNTupleAuxDynReader::FieldInfo::NotInitialized
@ NotInitialized
Definition: RNTupleAuxDynReader.h:33
SG::auxid_set_t
A set of aux data identifiers.
Definition: AuxTypes.h:47
ROOT::Experimental
Definition: RNTCollection.h:28
RootAuxDynIO::RNTupleAuxDynReader::m_storeFieldName
std::string m_storeFieldName
Definition: RNTupleAuxDynReader.h:82
collisions.reader
reader
read the goodrunslist xml file(s)
Definition: collisions.py:22
RootAuxDynIO::RNTupleAuxDynReader::getNativeReader
RNTupleReader * getNativeReader()
Definition: RNTupleAuxDynReader.h:115
AuxStoreInternal.h
An auxiliary data store that holds data internally.
RootAuxDynIO::RNTupleAuxDynReader::addBytes
void addBytes(size_t bytes)
Definition: RNTupleAuxDynReader.h:99