ATLAS Offline Software
Classes | Typedefs | Functions | Variables
RootAuxDynIO Namespace Reference

Specialization of RootAuxDynStore for reading Aux Dynamic attributes from RNTuple. More...

Classes

struct  AuxInfo
 
class  IRNTupleAuxDynWriter
 Interface for a RNTuple-based Writer that handles AuxDyn attributes Works in conjuction with the generic writer. More...
 
class  IRootAuxDynReader
 
class  IRootAuxDynWriter
 Interface for an AuxDyn Writer - TTree based. More...
 
class  RNTupleAuxDynReader
 
class  RNTupleAuxDynWriter
 
class  TBranchAuxDynWriter
 

Typedefs

typedef std::tuple< std::string, std::string, void * > attrDataTuple
 

Functions

bool endsWithAuxPostfix (std::string_view str)
 Check if a string ends with AUX_POSTFIX. More...
 
bool removeAuxPostfix (std::string &str)
 if a string ends with AUX_POSTFIX then remove it More...
 
std::string auxBranchName (const std::string &attr_name, const std::string &baseBranchName)
 Construct branch name for a given dynamic attribute. More...
 
std::string auxFieldName (const std::string &attr_name, const std::string &baseName)
 Construct field name for a given dynamic attribute. More...
 
bool hasAuxStore (std::string_view fieldname, TClass *tc)
 check if a field/branch with fieldname and type tc has IAuxStore interface More...
 
bool isAuxDynBranch (TBranch *branch)
 Check is a branch holds AuxStore objects. More...
 
std::string getKeyFromBranch (TBranch *branch)
 Exctract the Aux object SG Key from the branch name. More...
 
std::unique_ptr< IRootAuxDynReadergetBranchAuxDynReader (TTree *, TBranch *)
 
std::unique_ptr< IRootAuxDynWritergetBranchAuxDynWriter (TTree *tree, int bufferSize, int splitLevel, int offsettab_len, bool do_branch_fill)
 generate TBranchAuxDynWriter tree -> destination tree do_branch_fill -> flag telling to Fill each TBranch immediately More...
 
std::unique_ptr< IRootAuxDynReadergetNTupleAuxDynReader (const std::string &field_name, const std::string &field_type, RNTupleReader *reader)
 
std::unique_ptr< IRNTupleAuxDynWritergetNTupleAuxDynWriter ()
 
std::unique_ptr< IRNTupleWriter > getNTupleWriter (TFile *, const std::string &ntupleName, bool enableBufferedWrite, bool enableMetrics)
 

Variables

constexpr char AUX_POSTFIX [] = "Aux."
 Common post-fix for the names of auxiliary containers in StoreGate. More...
 
constexpr size_t AUX_POSTFIX_LEN = sizeof(AUX_POSTFIX)-1
 
constexpr char AUXDYN_POSTFIX [] = "Dyn."
 
constexpr size_t AUXDYN_POSTFIX_LEN = sizeof(AUXDYN_POSTFIX)-1
 

Detailed Description

Specialization of RootAuxDynStore for reading Aux Dynamic attributes from RNTuple.

Author
Marcin Nowak

Typedef Documentation

◆ attrDataTuple

typedef std::tuple<std::string, std::string, void*> RootAuxDynIO::attrDataTuple

Definition at line 62 of file RootAuxDynIO.h.

Function Documentation

◆ auxBranchName()

std::string RootAuxDynIO::auxBranchName ( const std::string &  attr_name,
const std::string &  baseBranchName 
)
inline

Construct branch name for a given dynamic attribute.

Parameters
attr_namethe name of the attribute
baseBranchNamebranch name for the main AuxStore object

Definition at line 60 of file RootAuxDynDefs.h.

61 {
62  std::string branch_name = baseBranchName;
63  if( !branch_name.empty() and branch_name.back() == '.' ) branch_name.pop_back();
64  branch_name += RootAuxDynIO::AUXDYN_POSTFIX + attr_name;
65  return branch_name;
66 }

◆ auxFieldName()

std::string RootAuxDynIO::auxFieldName ( const std::string &  attr_name,
const std::string &  baseName 
)
inline

Construct field name for a given dynamic attribute.

Parameters
attr_namethe name of the attribute
baseBranchNamebranch name for the main AuxStore object

Definition at line 69 of file RootAuxDynDefs.h.

70 {
71  // RNTuple field names cannot contain dot characters '.'
72  // Therefore, for now, we're using a colon instead ':'
73  // This can be changed in the future
74  std::string field_name = baseName;
75  if (field_name.ends_with(':')) {
76  field_name.pop_back();
77  }
78  field_name = std::format("{}Dyn:{}", field_name, attr_name);
79  return field_name;
80 }

◆ endsWithAuxPostfix()

bool RootAuxDynIO::endsWithAuxPostfix ( std::string_view  str)
inline

Check if a string ends with AUX_POSTFIX.

Parameters
strthe string to check

Definition at line 21 of file RootAuxDynDefs.h.

21  {
22  return str.ends_with(AUX_POSTFIX);
23  }

◆ getBranchAuxDynReader()

std::unique_ptr< RootAuxDynIO::IRootAuxDynReader > RootAuxDynIO::getBranchAuxDynReader ( TTree *  tree,
TBranch *  branch 
)

Definition at line 80 of file RootAuxDynIO.cxx.

80  {
81  return std::make_unique<TBranchAuxDynReader>(tree, branch);
82  }

◆ getBranchAuxDynWriter()

std::unique_ptr< RootAuxDynIO::IRootAuxDynWriter > RootAuxDynIO::getBranchAuxDynWriter ( TTree *  tree,
int  bufferSize,
int  splitLevel,
int  offsettab_len,
bool  do_branch_fill 
)

generate TBranchAuxDynWriter tree -> destination tree do_branch_fill -> flag telling to Fill each TBranch immediately

Definition at line 95 of file RootAuxDynIO.cxx.

95  {
96  return std::make_unique<TBranchAuxDynWriter>(tree, bufferSize, splitLevel, offsettab_len, do_branch_fill);
97  }

◆ getKeyFromBranch()

std::string RootAuxDynIO::getKeyFromBranch ( TBranch *  branch)

Exctract the Aux object SG Key from the branch name.

Parameters
branchTBranch with Key in its name

Definition at line 40 of file RootAuxDynIO.cxx.

41  {
42  TClass *tc = 0;
43  EDataType type;
44  if( branch->GetExpectedType(tc, type) == 0 && tc != nullptr) {
45  const char* brname = branch->GetName();
46  const char* clname = tc->GetName();
47  size_t namelen = strlen (clname);
48  std::string key = brname;
49  if( strncmp(brname, clname, namelen) == 0 && brname[namelen] == '_' ) {
50  key.erase (0, namelen+1);
51  }
53  return key;
54  }
55  return "";
56  }

◆ getNTupleAuxDynReader()

std::unique_ptr< RootAuxDynIO::IRootAuxDynReader > RootAuxDynIO::getNTupleAuxDynReader ( const std::string &  field_name,
const std::string &  field_type,
RNTupleReader reader 
)

Definition at line 85 of file RootAuxDynIO.cxx.

85  {
86  return std::make_unique<RNTupleAuxDynReader>(field_name, field_type, reader);
87  }

◆ getNTupleAuxDynWriter()

std::unique_ptr< RootAuxDynIO::IRNTupleAuxDynWriter > RootAuxDynIO::getNTupleAuxDynWriter ( )

Definition at line 100 of file RootAuxDynIO.cxx.

100  {
101  return std::make_unique<RNTupleAuxDynWriter>();
102  }

◆ getNTupleWriter()

std::unique_ptr<IRNTupleWriter> RootAuxDynIO::getNTupleWriter ( TFile *  ,
const std::string &  ntupleName,
bool  enableBufferedWrite,
bool  enableMetrics 
)

◆ hasAuxStore()

bool RootAuxDynIO::hasAuxStore ( std::string_view  fieldname,
TClass *  tc 
)

check if a field/branch with fieldname and type tc has IAuxStore interface

Definition at line 30 of file RootAuxDynIO.cxx.

30  {
31  // check the name first, and only if it does not match AUX_POSTFIX ask TClass
32  return endsWithAuxPostfix(fieldname)
33  or ( tc and ( tc->GetBaseClass("SG::IAuxStore")
34  // the IAuxStore property is used in DataModelTests
35  or RootType(tc).Properties().HasProperty("IAuxStore") ));
36  }

◆ isAuxDynBranch()

bool RootAuxDynIO::isAuxDynBranch ( TBranch *  branch)

Check is a branch holds AuxStore objects.

Parameters
branchTBranch to check

Definition at line 60 of file RootAuxDynIO.cxx.

61  {
62  const std::string bname = branch->GetName();
63  TClass *tc = 0;
64  EDataType type;
65  if( branch->GetExpectedType(tc, type) ) {
66  // error - not expecting this to happen ever, but better report
67  errorcheck::ReportMessage msg (MSG::WARNING, ERRORCHECK_ARGS, "RootAuxDynIO::isAuxDynBranch");
68  msg << "GetExpectedType() failed for branch: " << bname;
69  return false;
70  }
71  if( hasAuxStore(bname, tc) ) {
72  return tc->GetBaseClass("SG::IAuxStoreHolder") != nullptr;
73  }
74  return false;
75  }

◆ removeAuxPostfix()

bool RootAuxDynIO::removeAuxPostfix ( std::string &  str)
inline

if a string ends with AUX_POSTFIX then remove it

Parameters
strthe string to modify

Definition at line 49 of file RootAuxDynDefs.h.

50 {
51  if( endsWithAuxPostfix(str) ) {
52  str.resize( str.size() - AUX_POSTFIX_LEN );
53  return true;
54  }
55  return false;
56 }

Variable Documentation

◆ AUX_POSTFIX

constexpr char RootAuxDynIO::AUX_POSTFIX[] = "Aux."
constexpr

Common post-fix for the names of auxiliary containers in StoreGate.

Definition at line 12 of file RootAuxDynDefs.h.

◆ AUX_POSTFIX_LEN

constexpr size_t RootAuxDynIO::AUX_POSTFIX_LEN = sizeof(AUX_POSTFIX)-1
constexpr

Definition at line 13 of file RootAuxDynDefs.h.

◆ AUXDYN_POSTFIX

constexpr char RootAuxDynIO::AUXDYN_POSTFIX[] = "Dyn."
constexpr

Definition at line 14 of file RootAuxDynDefs.h.

◆ AUXDYN_POSTFIX_LEN

constexpr size_t RootAuxDynIO::AUXDYN_POSTFIX_LEN = sizeof(AUXDYN_POSTFIX)-1
constexpr

Definition at line 15 of file RootAuxDynDefs.h.

RootAuxDynIO::AUX_POSTFIX
constexpr char AUX_POSTFIX[]
Common post-fix for the names of auxiliary containers in StoreGate.
Definition: RootAuxDynDefs.h:12
vtune_athena.format
format
Definition: vtune_athena.py:14
RootAuxDynIO::AUXDYN_POSTFIX
constexpr char AUXDYN_POSTFIX[]
Definition: RootAuxDynDefs.h:14
tree
TChain * tree
Definition: tile_monitor.h:30
RootAuxDynIO::removeAuxPostfix
bool removeAuxPostfix(std::string &str)
if a string ends with AUX_POSTFIX then remove it
Definition: RootAuxDynDefs.h:49
errorcheck::ReportMessage
Helper class to use to report a message.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:173
collListGuids.attr_name
attr_name
Definition: collListGuids.py:72
RootAuxDynIO::endsWithAuxPostfix
bool endsWithAuxPostfix(std::string_view str)
Check if a string ends with AUX_POSTFIX.
Definition: RootAuxDynDefs.h:21
RootAuxDynIO::hasAuxStore
bool hasAuxStore(std::string_view fieldname, TClass *tc)
check if a field/branch with fieldname and type tc has IAuxStore interface
Definition: RootAuxDynIO.cxx:30
RTTAlgmain.branch
branch
Definition: RTTAlgmain.py:61
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
str
Definition: BTagTrackIpAccessor.cxx:11
collisions.reader
reader
read the goodrunslist xml file(s)
Definition: collisions.py:22
RootAuxDynIO::AUX_POSTFIX_LEN
constexpr size_t AUX_POSTFIX_LEN
Definition: RootAuxDynDefs.h:13
ERRORCHECK_ARGS
#define ERRORCHECK_ARGS
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:323
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
TScopeAdapter
Definition: RootType.h:119