LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
BranchType.cc
Go to the documentation of this file.
2 
3 #include <vector>
4 
5 namespace art {
6 
7  namespace {
8 
9  std::string const undefinedType = "UNDEFINED";
10 
11  // Suffixes
12  std::string const auxiliary = "Auxiliary";
13  std::string const productProvenance = "BranchEntryInfo";
14  std::string const majorIndex = ".id_.run_";
15  std::string const metaData = "MetaData";
16  std::string const productStatus = "ProductStatus";
17  std::string const statusInformation = "StatusInformation";
18 
19  // Prefixes
20  std::string const run = "Run";
21  std::string const subRun = "SubRun";
22  std::string const event = "Event";
23  std::string const results = "Results";
24 
25  // Trees, branches, indices
26  std::string const runs = run + 's';
27  std::string const subRuns = subRun + 's';
28  std::string const events = event + 's';
29  std::string const resultsTree = results + "Tree";
30 
31  std::string const runMeta = run + metaData;
32  std::string const subRunMeta = subRun + metaData;
33  std::string const eventMeta = event + metaData;
34  std::string const resultsMeta = results + metaData;
35 
36  std::string const runAuxiliary = run + auxiliary;
37  std::string const subRunAuxiliary = subRun + auxiliary;
38  std::string const eventAuxiliary = event + auxiliary;
39  std::string const resultsAuxiliary = results + auxiliary;
40 
41  std::string const runProductProvenance = run + productProvenance;
42  std::string const subRunProductProvenance = subRun + productProvenance;
43  std::string const eventProductProvenance = event + productProvenance;
44  std::string const resultsProductProvenance = results + productProvenance;
45 
46  std::string const runMajorIndex = runAuxiliary + majorIndex;
47  std::string const subRunMajorIndex = subRunAuxiliary + majorIndex;
48  std::string const eventMajorIndex = eventAuxiliary + majorIndex;
49 
50  std::string const runMinorIndex; // Empty.
51  std::string const subRunMinorIndex = subRunAuxiliary + ".id_.subRun_";
52  std::string const eventMinorIndex = eventAuxiliary + ".id_.event_";
53 
54  inline std::string const&
55  select(BranchType const bt, std::vector<std::string const*> const& strs)
56  {
57  return (static_cast<size_t>(bt) < strs.size()) ? *strs[bt] :
58  undefinedType;
59  }
60 
61  } // namespace
62 
63  // Ordering muust match that in art/Persistency/Provenance/BranchType.h.
64  std::string const&
66  {
67  return select(bt, {&event, &subRun, &run, &results});
68  }
69 
70  std::string const&
72  {
73  return select(bt, {&events, &subRuns, &runs, &resultsTree});
74  }
75 
76  std::string const&
78  {
79  return select(bt, {&eventMeta, &subRunMeta, &runMeta, &resultsMeta});
80  }
81 
82  std::string const&
84  {
85  return select(
86  bt,
87  {&eventAuxiliary, &subRunAuxiliary, &runAuxiliary, &resultsAuxiliary});
88  }
89 
90  std::string const&
92  {
93  return select(bt,
94  {&eventProductProvenance,
95  &subRunProductProvenance,
96  &runProductProvenance,
97  &resultsProductProvenance});
98  }
99 
100  std::string const&
102  {
103  return select(bt, {&eventMajorIndex, &subRunMajorIndex, &runMajorIndex});
104  }
105 
106  std::string const&
108  {
109  return select(bt, {&eventMinorIndex, &subRunMinorIndex, &runMinorIndex});
110  }
111 
112 } // art
113 
114 // ======================================================================
std::string const & BranchTypeToProductTreeName(BranchType const bt)
Definition: BranchType.cc:71
std::string const & productProvenanceBranchName(BranchType const bt)
Definition: BranchType.cc:91
std::string const & BranchTypeToMajorIndexName(BranchType const bt)
Definition: BranchType.cc:101
std::string const & BranchTypeToMinorIndexName(BranchType const bt)
Definition: BranchType.cc:107
std::string const & BranchTypeToMetaDataTreeName(BranchType const bt)
Definition: BranchType.cc:77
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const bt)
Definition: BranchType.cc:83
std::string const & BranchTypeToString(BranchType const bt)
Definition: BranchType.cc:65
BranchType
Definition: BranchType.h:20
Definition: MVAAlg.h:12
Event finding and building.