CMS 3D CMS Logo

BranchDescription.h
Go to the documentation of this file.
1 #ifndef DataFormats_Provenance_BranchDescription_h
2 #define DataFormats_Provenance_BranchDescription_h
3 
4 /*----------------------------------------------------------------------
5 
6 BranchDescription: The full description of a Branch.
7 This description also applies to every product instance on the branch.
8 
9 ----------------------------------------------------------------------*/
17 
18 #include <iosfwd>
19 #include <map>
20 #include <set>
21 #include <string>
22 
23 /*
24  BranchDescription
25 
26  definitions:
27  The event-independent description of an EDProduct.
28 
29 */
30 
31 namespace edm {
33  public:
34  static int const invalidSplitLevel = -1;
35  static int const invalidBasketSize = 0;
36  enum MatchMode { Strict = 0,
38 
40 
42  std::string const& moduleLabel,
43  std::string const& processName,
44  std::string const& className,
47  std::string const& moduleName,
49  TypeWithDict const& theTypeWithDict,
50  bool produced = true,
51  bool availableOnlyAtEndTransition = false,
52  std::set<std::string> const& aliases = std::set<std::string>());
53 
54  BranchDescription(BranchDescription const& aliasForBranch,
55  std::string const& moduleLabelAlias,
56  std::string const& poruductInstanceAlias);
57 
59 
60  void init() {
63  }
64 
65  void initBranchName();
66 
67  void initFromDictionary();
68 
69  void write(std::ostream& os) const;
70 
71  void merge(BranchDescription const& other);
72 
73  std::string const& moduleLabel() const {return moduleLabel_;}
74  std::string const& processName() const {return processName_;}
75  BranchID const& branchID() const {return branchID_;}
76  BranchID const& aliasForBranchID() const {return aliasForBranchID_;}
77  bool isAlias() const {return aliasForBranchID_.isValid() && produced();}
79  std::string const& fullClassName() const {return fullClassName_;}
80  std::string const& className() const {return fullClassName();}
83  bool produced() const {return transient_.produced_;}
84  void setProduced(bool isProduced) {transient_.produced_ = isProduced;}
85  bool present() const {return !transient_.dropped_;}
86  bool dropped() const {return transient_.dropped_;}
87  void setDropped(bool isDropped) {transient_.dropped_ = isDropped;}
88  bool onDemand() const {return transient_.onDemand_;}
89  void setOnDemand(bool isOnDemand) {transient_.onDemand_ = isOnDemand;}
91  bool transient() const {return transient_.transient_;}
92  void setTransient(bool isTransient) {transient_.transient_ = isTransient;}
99  int splitLevel() const {return transient_.splitLevel_;}
101  int basketSize() const {return transient_.basketSize_;}
103 
105  std::string const& moduleName() const {return transient_.moduleName_;}
106 
107  std::set<std::string> const& branchAliases() const {return branchAliases_;}
109  branchAliases_.insert(alias);
110  }
111  std::string const& branchName() const {return transient_.branchName_;}
113  BranchType const& branchType() const {return branchType_;}
116 
117  bool isMergeable() const { return transient_.isMergeable_; }
119 
121 
123 
124  struct Transients {
125  Transients();
126 
127  void reset();
128 
129  // The parameter set id of the producer.
130  // This is set if and only if produced_ is true.
132 
133  // The module name of the producer.
134  // This is set if and only if produced_ is true.
136 
137  // The branch name, which is currently derivable fron the other attributes.
139 
140  // The wrapped class name, which is currently derivable fron the other attributes.
142 
143  // A TypeWithDict object for the wrapped object
145 
146  // A TypeWithDict object for the unwrapped object
148 
149  // The split level of the branch, as marked
150  // in the data dictionary.
152 
153  // The basket size of the branch, as marked
154  // in the data dictionary.
156 
157  // Was this branch produced in this process rather than in a previous process
158  bool produced_;
159 
160  // Was this branch produced in this current process and by unscheduled production
161  // This item is set only in the framework, not by FWLite.
162  bool onDemand_;
163 
164  // Has the branch been dropped from the product tree in this file
165  // (or if this is a merged product registry, in the first file).
166  // This item is set only in the framework, not by FWLite.
167  bool dropped_;
168 
169  // Is the class of the branch marked as transient
170  // in the data dictionary
172 
173  // if Run or Lumi based, can only get at end transition
175 
176  // True if the product definition has a mergeProduct function
177  // and the branchType is Run or Lumi
179  };
180 
181  private:
182  void throwIfInvalid_() const;
183 
184  // What tree is the branch in?
186 
187  // A human friendly string that uniquely identifies the EDProducer
188  // and becomes part of the identity of a product that it produces
190 
191  // the physical process that this program was part of (e.g. production)
193 
194  // An ID uniquely identifying the branch
196 
197  // the full name of the type of product this is
199 
200  // a readable name of the type of product this is
202 
203  // a user-supplied name to distinguish multiple products of the same type
204  // that are produced by the same producer
206 
207  // The branch ROOT alias(es), which are settable by the user.
208  std::set<std::string> branchAliases_;
209 
210  // If this branch *is* an EDAlias, this field is the BranchID
211  // of the branch for which this branch is an alias.
212  // If this branch is not an EDAlias, the normal case, this field is 0.
214 
216  };
217 
218  inline
219  std::ostream&
220  operator<<(std::ostream& os, BranchDescription const& p) {
221  p.write(os);
222  return os;
223  }
224 
225  bool operator<(BranchDescription const& a, BranchDescription const& b);
226 
227  bool operator==(BranchDescription const& a, BranchDescription const& b);
228 
229  bool combinable(BranchDescription const& a, BranchDescription const& b);
230 
232  BranchDescription const& b,
233  std::string const& fileName);
234 }
235 #endif
size
Write out results.
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:90
type
Definition: HCALResponse.h:21
std::string const & branchName() const
BranchType const & branchType() const
static int const invalidSplitLevel
static int const invalidBasketSize
void setOnDemand(bool isOnDemand)
std::string const & processName() const
bool isValid() const
Definition: BranchID.h:24
void write(std::ostream &os) const
BranchType
Definition: BranchType.h:11
void setWrappedType(TypeWithDict const &type)
void setTransient(bool isTransient)
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
std::string const & className() const
std::string const & moduleLabel() const
std::string const & productInstanceName() const
bool combinable(BranchDescription const &a, BranchDescription const &b)
TypeID unwrappedTypeID() const
void setWrappedName(std::string const &name)
void setSplitLevel(int level)
std::string const & friendlyClassName() const
BranchID const & branchID() const
TypeWithDict const & unwrappedType() const
void setDropped(bool isDropped)
std::type_info const & typeInfo() const
std::string const & moduleName() const
std::string const & fullClassName() const
ParameterSetID const & parameterSetID() const
double b
Definition: hdecay.h:120
std::set< std::string > const & branchAliases() const
std::set< std::string > branchAliases_
BranchID const & aliasForBranchID() const
HLT enums.
double a
Definition: hdecay.h:121
BranchID const & originalBranchID() const
bool availableOnlyAtEndTransition() const
void setUnwrappedType(TypeWithDict const &type)
void setBasketSize(int size)
void setProduced(bool isProduced)
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
std::string const & wrappedName() const
void insertBranchAlias(std::string const &alias)
TypeWithDict const & wrappedType() const
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)
void merge(BranchDescription const &other)
TypeID wrappedTypeID() const