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...
 
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 46 of file RootAuxDynDefs.h.

47 {
48  std::string branch_name = baseBranchName;
49  if( !branch_name.empty() and branch_name.back() == '.' ) branch_name.pop_back();
50  branch_name += RootAuxDynIO::AUXDYN_POSTFIX + attr_name;
51  return branch_name;
52 }

◆ 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 55 of file RootAuxDynDefs.h.

56 {
57  std::string field_name = baseName;
58  if( field_name.back() == '.' ) field_name.pop_back();
59  field_name += ":" + attr_name; // MN TODO <- find a good delimiter
60  return field_name;
61 }

◆ endsWithAuxPostfix()

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

Check if a string ends with AUX_POSTFIX.

check if a string ends with AUX_POSTFIX

Parameters
strthe string to check

Definition at line 40 of file RootAuxDynDefs.h.

40  {
41  return str.size() >= AUX_POSTFIX_LEN and
42  str.compare(str.size()-AUX_POSTFIX_LEN, AUX_POSTFIX_LEN, AUX_POSTFIX) == 0;
43 }

◆ 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  }
52  if( endsWithAuxPostfix(key) ) key.erase( key.size()-AUX_POSTFIX_LEN );
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  }

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 10 of file RootAuxDynDefs.h.

◆ AUX_POSTFIX_LEN

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

Definition at line 11 of file RootAuxDynDefs.h.

◆ AUXDYN_POSTFIX

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

Definition at line 12 of file RootAuxDynDefs.h.

◆ AUXDYN_POSTFIX_LEN

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

Definition at line 13 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:10
RootAuxDynIO::AUXDYN_POSTFIX
constexpr char AUXDYN_POSTFIX[]
Definition: RootAuxDynDefs.h:12
tree
TChain * tree
Definition: tile_monitor.h:30
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:40
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:11
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