Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 72 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 78 of file RootAuxDynIO.cxx.

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

◆ 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 93 of file RootAuxDynIO.cxx.

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

◆ 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 38 of file RootAuxDynIO.cxx.

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

◆ getNTupleAuxDynReader()

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

Definition at line 83 of file RootAuxDynIO.cxx.

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

◆ getNTupleAuxDynWriter()

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

Definition at line 98 of file RootAuxDynIO.cxx.

98  {
99  return std::make_unique<RNTupleAuxDynWriter>();
100  }

◆ 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 28 of file RootAuxDynIO.cxx.

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

◆ isAuxDynBranch()

bool RootAuxDynIO::isAuxDynBranch ( TBranch *  branch)

Check is a branch holds AuxStore objects.

Parameters
branchTBranch to check

Definition at line 58 of file RootAuxDynIO.cxx.

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

◆ 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
TrigInDetValidation_menu_test.tc
tc
Definition: TrigInDetValidation_menu_test.py:8
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
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
collListGuids.attr_name
attr_name
Definition: collListGuids.py:72
EFTrackingXrtAlgorithmConfig.bufferSize
bufferSize
Definition: EFTrackingXrtAlgorithmConfig.py:77
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:28
RTTAlgmain.branch
branch
Definition: RTTAlgmain.py:61
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