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, Permissive };
37 
39 
41  std::string const& moduleLabel,
42  std::string const& processName,
43  std::string const& className,
46  std::string const& moduleName,
48  TypeWithDict const& theTypeWithDict,
49  bool produced = true,
50  bool availableOnlyAtEndTransition = false,
51  std::set<std::string> const& aliases = std::set<std::string>());
52 
53  BranchDescription(BranchDescription const& aliasForBranch,
54  std::string const& moduleLabelAlias,
55  std::string const& productInstanceAlias);
56 
58 
59  void init() {
62  }
63 
64  void initBranchName();
65 
66  void initFromDictionary();
67 
68  void write(std::ostream& os) const;
69 
70  void merge(BranchDescription const& other);
71 
72  std::string const& moduleLabel() const { return moduleLabel_; }
73  std::string const& processName() const { return processName_; }
74  BranchID const& branchID() const { return branchID_; }
75  BranchID const& aliasForBranchID() const { return aliasForBranchID_; }
76  bool isAlias() const { return aliasForBranchID_.isValid() && produced(); }
78  std::string const& fullClassName() const { return fullClassName_; }
79  std::string const& className() const { return fullClassName(); }
82  bool produced() const { return transient_.produced_; }
83  void setProduced(bool isProduced) { transient_.produced_ = isProduced; }
84  bool isTransform() const { return transient_.isTransform_; }
86  bool present() const { return !transient_.dropped_; }
87  bool dropped() const { return transient_.dropped_; }
88  void setDropped(bool isDropped) { transient_.dropped_ = isDropped; }
89  //returns true if unscheduled (produced()==true) or using delayed reader (produced()==false)
90  bool onDemand() const { return transient_.onDemand_; }
91  void setOnDemand(bool isOnDemand) { transient_.onDemand_ = isOnDemand; }
93  bool transient() const { return transient_.transient_; }
94  void setTransient(bool isTransient) { transient_.transient_ = isTransient; }
95  TypeWithDict const& wrappedType() const { return transient_.wrappedType_; }
101  int splitLevel() const { return transient_.splitLevel_; }
103  int basketSize() const { return transient_.basketSize_; }
104  void setBasketSize(int size) { transient_.basketSize_ = size; }
105 
106  bool isSwitchAlias() const { return not transient_.switchAliasModuleLabel_.empty(); }
110  void setSwitchAliasForBranch(BranchDescription const& aliasForBranch);
111 
112  bool isAnyAlias() const { return isAlias() or isSwitchAlias(); }
113 
116 
118  std::string const& moduleName() const { return transient_.moduleName_; }
119 
120  std::set<std::string> const& branchAliases() const { return branchAliases_; }
122  std::string const& branchName() const { return transient_.branchName_; }
124  BranchType const& branchType() const { return branchType_; }
125  std::string const& wrappedName() const { return transient_.wrappedName_; }
127 
128  bool isMergeable() const { return transient_.isMergeable_; }
130 
132 
134 
135  struct Transients {
136  Transients();
137 
138  void reset();
139 
140  // The parameter set id of the producer.
141  // This is set if and only if produced_ is true.
143 
144  // The module name of the producer.
145  // This is set if and only if produced_ is true.
147 
148  // The branch name, which is currently derivable from the other attributes.
150 
151  // The wrapped class name, which is currently derivable from the other attributes.
153 
154  // For SwitchProducer alias, the label of the aliased-for label; otherwise empty
156 
157  // Need a separate (transient) BranchID for switch, because
158  // otherwise originalBranchID() gives wrong answer when reading
159  // from a file (leading to wrong ProductProvenance to be retrieved)
161 
162  // A TypeWithDict object for the wrapped object
163  // This is set if and only if the dropped_ is false
165 
166  // A TypeWithDict object for the unwrapped object
167  // This is set if and only if the dropped_ is false
169 
170  // The split level of the branch, as marked
171  // in the data dictionary.
173 
174  // The basket size of the branch, as marked
175  // in the data dictionary.
177 
178  // Was this branch produced in this process rather than in a previous process
179  bool produced_;
180 
181  // Was this branch produced in this current process and by unscheduled production
182  // This item is set only in the framework, not by FWLite.
183  bool onDemand_;
184 
185  // Was this branch produced in this current process via the transform ability
187 
188  // Has the branch been dropped from the product tree in this file
189  // (or if this is a merged product registry, in the first file).
190  // This item is set only in the framework, not by FWLite.
191  bool dropped_;
192 
193  // Is the class of the branch marked as transient
194  // in the data dictionary
196 
197  // if Run or Lumi based, can only get at end transition
199 
200  // True if the product definition has a mergeProduct function
201  // and the branchType is Run or Lumi
203 
204  // True if provenance is set on call from input on read
206  };
207 
208  private:
209  void throwIfInvalid_() const;
210 
211  // What tree is the branch in?
213 
214  // A human friendly string that uniquely identifies the EDProducer
215  // and becomes part of the identity of a product that it produces
217 
218  // the physical process that this program was part of (e.g. production)
220 
221  // An ID uniquely identifying the branch
223 
224  // the full name of the type of product this is
226 
227  // a readable name of the type of product this is
229 
230  // a user-supplied name to distinguish multiple products of the same type
231  // that are produced by the same producer
233 
234  // The branch ROOT alias(es), which are settable by the user.
235  std::set<std::string> branchAliases_;
236 
237  // If this branch *is* an EDAlias, this field is the BranchID
238  // of the branch for which this branch is an alias.
239  // If this branch is not an EDAlias, the normal case, this field is 0.
241 
243  };
244 
245  inline std::ostream& operator<<(std::ostream& os, BranchDescription const& p) {
246  p.write(os);
247  return os;
248  }
249 
250  bool operator<(BranchDescription const& a, BranchDescription const& b);
251 
252  bool operator==(BranchDescription const& a, BranchDescription const& b);
253 
254  bool combinable(BranchDescription const& a, BranchDescription const& b);
255 
256  std::string match(BranchDescription const& a, BranchDescription const& b, std::string const& fileName);
257 } // namespace edm
258 #endif
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:89
constexpr bool operator==(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
BranchID const & switchAliasForBranchID() const
ParameterSetID const & parameterSetID() const
void setIsProvenanceSetOnRead(bool value=true) noexcept
static int const invalidSplitLevel
BranchID const & branchID() const
Definition: Hash.h:43
static int const invalidBasketSize
BranchType const & branchType() const
void setOnDemand(bool isOnDemand)
std::string const & fullClassName() const
std::string const & moduleName() const
TypeID unwrappedTypeID() const
std::string const & processName() const
TypeWithDict const & unwrappedType() const
std::string const & friendlyClassName() const
BranchType
Definition: BranchType.h:11
void setWrappedType(TypeWithDict const &type)
bool isValid() const
Definition: BranchID.h:22
void setTransient(bool isTransient)
char const * label
std::string const & switchAliasModuleLabel() const
std::string const & className() const
TypeID wrappedTypeID() const
std::string const & branchName() const
bool combinable(BranchDescription const &a, BranchDescription const &b)
void setIsTransform(bool isTransform)
std::string const & productInstanceName() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void setWrappedName(std::string const &name)
void setSplitLevel(int level)
BranchID const & aliasForBranchID() const
void setDropped(bool isDropped)
Definition: value.py:1
std::string const & wrappedName() const
std::type_info const & typeInfo() const
double b
Definition: hdecay.h:120
void write(std::ostream &os) const
void setSwitchAliasModuleLabel(std::string label)
bool isProvenanceSetOnRead() const noexcept
std::set< std::string > branchAliases_
bool availableOnlyAtEndTransition() const
HLT enums.
double a
Definition: hdecay.h:121
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 table.
void setSwitchAliasForBranch(BranchDescription const &aliasForBranch)
std::string const & moduleLabel() const
void insertBranchAlias(std::string const &alias)
TypeWithDict const & wrappedType() const
def move(src, dest)
Definition: eostools.py:511
std::set< std::string > const & branchAliases() const
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)
void merge(BranchDescription const &other)
BranchID const & originalBranchID() const