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 ----------------------------------------------------------------------*/
10 #include <iosfwd>
11 #include <string>
12 #include <map>
13 #include <set>
14 
23 
24 #include "Reflex/Type.h"
25 /*
26  BranchDescription
27 
28  definitions:
29  The event-independent description of an EDProduct.
30 
31 */
32 
33 namespace edm {
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& mdLabel,
45  std::string const& procName,
46  std::string const& name,
47  std::string const& fName,
48  std::string const& pin,
49  ModuleDescription const& modDesc,
50  TypeID const& theTypeID,
51  std::set<std::string> const& aliases = std::set<std::string>());
52 
54 
55  void init() const {
58  }
59 
60  void initBranchName() const;
61 
62  void initFromDictionary() const;
63 
64  void write(std::ostream& os) const;
65 
66  void merge(BranchDescription const& other);
67 
68  std::string const& moduleLabel() const {return moduleLabel_;}
69  std::string const& processName() const {return processName_;}
70  BranchID const& branchID() const {return branchID_;}
71  ProductID const& oldProductID() const {return productID_;}
72  std::string const& fullClassName() const {return fullClassName_;}
73  std::string const& className() const {return fullClassName();}
74  std::string const& friendlyClassName() const {return friendlyClassName_;}
75  std::string const& productInstanceName() const {return productInstanceName_;}
76  bool& produced() const {return transients_.get().produced_;}
77  bool present() const {return !transients_.get().dropped_;}
78  bool& dropped() const {return transients_.get().dropped_;}
79  bool& onDemand() const {return transients_.get().onDemand_;}
80  bool& transient() const {return transients_.get().transient_;}
81  Reflex::Type& type() const {return transients_.get().type_;}
82  TypeID& typeID() const {return transients_.get().typeID_;}
83  int& splitLevel() const {return transients_.get().splitLevel_;}
84  int& basketSize() const {return transients_.get().basketSize_;}
85 
86  ParameterSetID const& parameterSetID() const {return transients_.get().parameterSetID_;}
87  std::string const& moduleName() const {return transients_.get().moduleName_;}
88 
89  std::map<ProcessConfigurationID, ParameterSetID>& parameterSetIDs() const {
90  return transients_.get().parameterSetIDs_;
91  }
92  std::map<ProcessConfigurationID, std::string>& moduleNames() const {
93  return transients_.get().moduleNames_;
94  }
95  ParameterSetID const& psetID() const;
96  bool isPsetIDUnique() const {return parameterSetIDs().size() == 1;}
97  std::set<std::string> const& branchAliases() const {return branchAliases_;}
98  std::set<std::string>& branchAliases() {return branchAliases_;}
99  std::string& branchName() const {return transients_.get().branchName_;}
100  BranchType const& branchType() const {return branchType_;}
101  std::string& wrappedName() const {return transients_.get().wrappedName_;}
102 
103  void setDropped() const {dropped() = true;}
104  void setOnDemand() const {onDemand() = true;}
106 
107  struct Transients {
108  Transients();
109 
110  // The parameter set id of the producer.
111  // This is set if and only if produced_ is true.
113 
114  // The module name of the producer.
115  // This is set if and only if produced_ is true.
116  std::string moduleName_;
117 
118  // The branch name, which is currently derivable fron the other attributes.
119  std::string branchName_;
120 
121  // The wrapped class name, which is currently derivable fron the other attributes.
122  std::string wrappedName_;
123 
124  // Was this branch produced in this process rather than in a previous process
125  bool produced_;
126 
127  // Was this branch produced in this current process and by unscheduled production
128  // This item is set only in the framework, not by FWLite.
129  bool onDemand_;
130 
131  // Has the branch been dropped from the product tree in this file
132  // (or if this is a merged product registry, in the first file).
133  // This item is set only in the framework, not by FWLite.
134  bool dropped_;
135 
136  // ID's of process configurations for products on this branch
137  // with corresponding parameter set IDs,
138  // This is initialized if and only if produced_ is false.
139  mutable std::map<ProcessConfigurationID, ParameterSetID> parameterSetIDs_;
140 
141  // ID's of process configurations for products on this branch
142  // with corresponding module names
143  // This is initialized if and only if produced_ is false.
144  mutable std::map<ProcessConfigurationID, std::string> moduleNames_;
145 
146  // Is the class of the branch marked as transient
147  // in the data dictionary
149 
150  // The Reflex Type of the wrapped object
151  // in the data dictionary
153 
154  // A TypeID object for the unwrapped object
155  // This is set if and only if produced_ is true.
157 
158  // The split level of the branch, as marked
159  // in the data dictionary.
161 
162  // The basket size of the branch, as marked
163  // in the data dictionary.
165  };
166 
167  private:
168  void throwIfInvalid_() const;
169 
170  // What tree is the branch in?
172 
173  // A human friendly string that uniquely identifies the EDProducer
174  // and becomes part of the identity of a product that it produces
175  std::string moduleLabel_;
176 
177  // the physical process that this program was part of (e.g. production)
178  std::string processName_;
179 
180  // An ID uniquely identifying the branch
182 
183  // An ID uniquely identifying the branch
184  // This field is obsolete and is needed only for backward compatibility
185  // with file format 7 and earlier.
187 
188  // the full name of the type of product this is
189  std::string fullClassName_;
190 
191  // a readable name of the type of product this is
192  std::string friendlyClassName_;
193 
194  // a user-supplied name to distinguish multiple products of the same type
195  // that are produced by the same producer
196  std::string productInstanceName_;
197 
198  // The branch ROOT alias(es), which are settable by the user.
199  std::set<std::string> branchAliases_;
200 
202  };
203 
204  inline
205  std::ostream&
206  operator<<(std::ostream& os, BranchDescription const& p) {
207  p.write(os);
208  return os;
209  }
210 
211  bool operator<(BranchDescription const& a, BranchDescription const& b);
212 
213  bool operator==(BranchDescription const& a, BranchDescription const& b);
214 
215  bool combinable(BranchDescription const& a, BranchDescription const& b);
216 
217  std::string match(BranchDescription const& a,
218  BranchDescription const& b,
219  std::string const& fileName,
221 }
222 #endif
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:77
ProductID const & oldProductID() const
BranchType const & branchType() const
TypeID & typeID() const
Reflex::Type & type() const
static int const invalidSplitLevel
std::string & branchName() const
static int const invalidBasketSize
bool isPsetIDUnique() const
std::map< ProcessConfigurationID, std::string > & moduleNames() const
bool & produced() 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_
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_
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
std::string const & friendlyClassName() const
BranchID const & branchID() 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_
double a
Definition: hdecay.h:121
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
void merge(BranchDescription const &other)
Transient< Transients > transients_