ATLAS Offline Software
RootAuxDynDefs.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef ROOTAUXDYN_DEFS_H
5 #define ROOTAUXDYN_DEFS_H
6 
7 namespace RootAuxDynIO
8 {
10  constexpr char AUX_POSTFIX[] = "Aux.";
11  constexpr size_t AUX_POSTFIX_LEN = sizeof(AUX_POSTFIX)-1;
12  constexpr char AUXDYN_POSTFIX[] = "Dyn.";
13  constexpr size_t AUXDYN_POSTFIX_LEN = sizeof(AUXDYN_POSTFIX)-1;
14 
19  bool endsWithAuxPostfix(std::string_view str);
20 
26  std::string auxBranchName(const std::string& attr_name, const std::string& baseBranchName);
27 
33  std::string auxFieldName(const std::string& attr_name, const std::string& baseName);
34 
35 } // namespace
36 
37 
39 inline bool
41  return str.size() >= AUX_POSTFIX_LEN and
42  str.compare(str.size()-AUX_POSTFIX_LEN, AUX_POSTFIX_LEN, AUX_POSTFIX) == 0;
43 }
44 
45 inline std::string
46 RootAuxDynIO::auxBranchName(const std::string& attr_name, const std::string& baseBranchName)
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 }
53 
54 inline std::string
55 RootAuxDynIO::auxFieldName(const std::string& attr_name, const std::string& baseName)
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 }
62 
63 #endif
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
RootAuxDynIO::auxBranchName
std::string auxBranchName(const std::string &attr_name, const std::string &baseBranchName)
Construct branch name for a given dynamic attribute.
Definition: RootAuxDynDefs.h:46
collListGuids.attr_name
attr_name
Definition: collListGuids.py:72
RootAuxDynIO::auxFieldName
std::string auxFieldName(const std::string &attr_name, const std::string &baseName)
Construct field name for a given dynamic attribute.
Definition: RootAuxDynDefs.h:55
RootAuxDynIO::endsWithAuxPostfix
bool endsWithAuxPostfix(std::string_view str)
Check if a string ends with AUX_POSTFIX.
Definition: RootAuxDynDefs.h:40
RootAuxDynIO
Specialization of RootAuxDynStore for reading Aux Dynamic attributes from RNTuple.
Definition: RNTupleContainer.h:25
RootAuxDynIO::AUXDYN_POSTFIX_LEN
constexpr size_t AUXDYN_POSTFIX_LEN
Definition: RootAuxDynDefs.h:13
str
Definition: BTagTrackIpAccessor.cxx:11
RootAuxDynIO::AUX_POSTFIX_LEN
constexpr size_t AUX_POSTFIX_LEN
Definition: RootAuxDynDefs.h:11