CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ----------------------------------------------------------------------*/
18 
19 #include <iosfwd>
20 #include <map>
21 #include <set>
22 #include <string>
23 
24 /*
25  BranchDescription
26 
27  definitions:
28  The event-independent description of an EDProduct.
29 
30 */
31 
32 namespace edm {
33  class WrapperInterfaceBase;
35  public:
36  static int const invalidSplitLevel = -1;
37  static int const invalidBasketSize = 0;
38  enum MatchMode { Strict = 0,
40 
42 
44  std::string const& moduleLabel,
45  std::string const& processName,
46  std::string const& className,
49  std::string const& moduleName,
51  TypeWithDict const& theTypeWithDict,
52  bool produced = true,
53  std::set<std::string> const& aliases = std::set<std::string>());
54 
55  BranchDescription(BranchDescription const& aliasForBranch,
56  std::string const& moduleLabelAlias,
57  std::string const& poruductInstanceAlias);
58 
60 
61  void init() const {
64  }
65 
66  void initBranchName() const;
67 
68  void initFromDictionary() const;
69 
70  void write(std::ostream& os) const;
71 
72  void merge(BranchDescription const& other);
73 
74  std::string const& moduleLabel() const {return moduleLabel_;}
75  std::string const& processName() const {return processName_;}
76  BranchID const& branchID() const {return branchID_;}
77  BranchID const& aliasForBranchID() const {return aliasForBranchID_;}
78  bool isAlias() const {return aliasForBranchID_.isValid() && produced();}
80  std::string const& fullClassName() const {return fullClassName_;}
81  std::string const& className() const {return fullClassName();}
84  bool& produced() const {return transient_.produced_;}
85  bool present() const {return !transient_.dropped_;}
86  bool& dropped() const {return transient_.dropped_;}
87  bool& onDemand() const {return transient_.onDemand_;}
88  bool& transient() const {return transient_.transient_;}
93  int& splitLevel() const {return transient_.splitLevel_;}
94  int& basketSize() const {return transient_.basketSize_;}
95 
97  std::string const& moduleName() const {return transient_.moduleName_;}
98 
99  std::map<ProcessConfigurationID, ParameterSetID>& parameterSetIDs() const {
101  }
102  std::map<ProcessConfigurationID, std::string>& moduleNames() const {
103  return transient_.moduleNames_;
104  }
105  ParameterSetID const& psetID() const;
106  bool isPsetIDUnique() const {return parameterSetIDs().size() == 1;}
107  std::set<std::string> const& branchAliases() const {return branchAliases_;}
108  std::set<std::string>& branchAliases() {return branchAliases_;}
110  BranchType const& branchType() const {return branchType_;}
113 
114  WrapperInterfaceBase const* getInterface() const;
115  void setDropped() const {dropped() = true;}
116  void setOnDemand() const {onDemand() = true;}
118 
120 
121  struct Transients {
122  Transients();
123 
124  void reset();
125 
126  // The parameter set id of the producer.
127  // This is set if and only if produced_ is true.
129 
130  // The module name of the producer.
131  // This is set if and only if produced_ is true.
133 
134  // The branch name, which is currently derivable fron the other attributes.
136 
137  // The wrapped class name, which is currently derivable fron the other attributes.
139 
140  // Was this branch produced in this process rather than in a previous process
141  bool produced_;
142 
143  // Was this branch produced in this current process and by unscheduled production
144  // This item is set only in the framework, not by FWLite.
145  bool onDemand_;
146 
147  // Has the branch been dropped from the product tree in this file
148  // (or if this is a merged product registry, in the first file).
149  // This item is set only in the framework, not by FWLite.
150  bool dropped_;
151 
152  // ID's of process configurations for products on this branch
153  // with corresponding parameter set IDs,
154  // This is initialized if and only if produced_ is false.
155  mutable std::map<ProcessConfigurationID, ParameterSetID> parameterSetIDs_;
156 
157  // ID's of process configurations for products on this branch
158  // with corresponding module names
159  // This is initialized if and only if produced_ is false.
160  mutable std::map<ProcessConfigurationID, std::string> moduleNames_;
161 
162  // Is the class of the branch marked as transient
163  // in the data dictionary
165 
166  // A TypeWithDict object for the wrapped object
168 
169  // A TypeWithDict object for the unwrapped object
171 
172  // A pointer to a polymorphic object to obtain typed Wrapper.
174 
175  // The split level of the branch, as marked
176  // in the data dictionary.
178 
179  // The basket size of the branch, as marked
180  // in the data dictionary.
182  };
183 
184  private:
185  void throwIfInvalid_() const;
186 
187  // What tree is the branch in?
189 
190  // A human friendly string that uniquely identifies the EDProducer
191  // and becomes part of the identity of a product that it produces
193 
194  // the physical process that this program was part of (e.g. production)
196 
197  // An ID uniquely identifying the branch
199 
200  // the full name of the type of product this is
202 
203  // a readable name of the type of product this is
205 
206  // a user-supplied name to distinguish multiple products of the same type
207  // that are produced by the same producer
209 
210  // The branch ROOT alias(es), which are settable by the user.
211  std::set<std::string> branchAliases_;
212 
213  // If this branch *is* an EDAlias, this field is the BranchID
214  // of the branch for which this branch is an alias.
215  // If this branch is not an EDAlias, the normal case, this field is 0.
217 
219  };
220 
221  inline
222  std::ostream&
223  operator<<(std::ostream& os, BranchDescription const& p) {
224  p.write(os);
225  return os;
226  }
227 
228  bool operator<(BranchDescription const& a, BranchDescription const& b);
229 
230  bool operator==(BranchDescription const& a, BranchDescription const& b);
231 
232  bool combinable(BranchDescription const& a, BranchDescription const& b);
233 
234  std::string match(BranchDescription const& a,
235  BranchDescription const& b,
236  std::string const& fileName,
238 }
239 #endif
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:91
dictionary aliases
Definition: autoCond.py:22
BranchType const & branchType() const
TypeWithDict & wrappedType() const
static int const invalidSplitLevel
std::string & branchName() const
TypeWithDict & unwrappedType() const
static int const invalidBasketSize
std::map< ProcessConfigurationID, std::string > & moduleNames() const
bool & produced() const
void initializeTransients() const
bool & onDemand() const
std::string const & processName() const
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName, BranchDescription::MatchMode m)
std::map< ProcessConfigurationID, std::string > moduleNames_
bool isValid() const
Definition: BranchID.h:24
ParameterSetID const & psetID() const
void write(std::ostream &os) const
BranchType
Definition: BranchType.h:11
void initFromDictionary() const
std::string const & className() const
std::string const & moduleLabel() const
std::string const & productInstanceName() const
bool combinable(BranchDescription const &a, BranchDescription const &b)
std::map< ProcessConfigurationID, ParameterSetID > parameterSetIDs_
WrapperInterfaceBase * wrapperInterfaceBase_
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
TypeID unwrappedTypeID() const
WrapperInterfaceBase *& wrapperInterfaceBase() const
std::string const & friendlyClassName() const
BranchID const & branchID() const
WrapperInterfaceBase const * getInterface() const
std::type_info const & typeInfo() const
std::string & wrappedName() const
std::string const & moduleName() const
std::string const & fullClassName() const
ParameterSetID const & parameterSetID() const
std::set< std::string > & branchAliases()
double b
Definition: hdecay.h:120
std::set< std::string > const & branchAliases() const
std::map< ProcessConfigurationID, ParameterSetID > & parameterSetIDs() const
std::set< std::string > branchAliases_
BranchID const & aliasForBranchID() const
double a
Definition: hdecay.h:121
BranchID const & originalBranchID() const
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
void merge(BranchDescription const &other)
TypeID wrappedTypeID() const