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