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 present() const { return !transient_.dropped_; }
85  bool dropped() const { return transient_.dropped_; }
86  void setDropped(bool isDropped) { transient_.dropped_ = isDropped; }
87  //returns true if unscheduled (produced()==true) or using delayed reader (produced()==false)
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; }
93  TypeWithDict const& wrappedType() const { return transient_.wrappedType_; }
99  int splitLevel() const { return transient_.splitLevel_; }
101  int basketSize() const { return transient_.basketSize_; }
103 
104  bool isSwitchAlias() const { return not transient_.switchAliasModuleLabel_.empty(); }
108  void setSwitchAliasForBranch(BranchDescription const& aliasForBranch);
109 
110  bool isAnyAlias() const { return isAlias() or isSwitchAlias(); }
111 
114 
116  std::string const& moduleName() const { return transient_.moduleName_; }
117 
118  std::set<std::string> const& branchAliases() const { return branchAliases_; }
120  std::string const& branchName() const { return transient_.branchName_; }
122  BranchType const& branchType() const { return branchType_; }
123  std::string const& wrappedName() const { return transient_.wrappedName_; }
125 
126  bool isMergeable() const { return transient_.isMergeable_; }
128 
130 
132 
133  struct Transients {
134  Transients();
135 
136  void reset();
137 
138  // The parameter set id of the producer.
139  // This is set if and only if produced_ is true.
141 
142  // The module name of the producer.
143  // This is set if and only if produced_ is true.
145 
146  // The branch name, which is currently derivable from the other attributes.
148 
149  // The wrapped class name, which is currently derivable from the other attributes.
151 
152  // For SwitchProducer alias, the label of the aliased-for label; otherwise empty
154 
155  // Need a separate (transient) BranchID for switch, because
156  // otherwise originalBranchID() gives wrong answer when reading
157  // from a file (leading to wrong ProductProvenance to be retrieved)
159 
160  // A TypeWithDict object for the wrapped object
162 
163  // A TypeWithDict object for the unwrapped object
165 
166  // The split level of the branch, as marked
167  // in the data dictionary.
169 
170  // The basket size of the branch, as marked
171  // in the data dictionary.
173 
174  // Was this branch produced in this process rather than in a previous process
175  bool produced_;
176 
177  // Was this branch produced in this current process and by unscheduled production
178  // This item is set only in the framework, not by FWLite.
179  bool onDemand_;
180 
181  // Has the branch been dropped from the product tree in this file
182  // (or if this is a merged product registry, in the first file).
183  // This item is set only in the framework, not by FWLite.
184  bool dropped_;
185 
186  // Is the class of the branch marked as transient
187  // in the data dictionary
189 
190  // if Run or Lumi based, can only get at end transition
192 
193  // True if the product definition has a mergeProduct function
194  // and the branchType is Run or Lumi
196 
197  // True if provenance is set on call from input on read
199  };
200 
201  private:
202  void throwIfInvalid_() const;
203 
204  // What tree is the branch in?
206 
207  // A human friendly string that uniquely identifies the EDProducer
208  // and becomes part of the identity of a product that it produces
210 
211  // the physical process that this program was part of (e.g. production)
213 
214  // An ID uniquely identifying the branch
216 
217  // the full name of the type of product this is
219 
220  // a readable name of the type of product this is
222 
223  // a user-supplied name to distinguish multiple products of the same type
224  // that are produced by the same producer
226 
227  // The branch ROOT alias(es), which are settable by the user.
228  std::set<std::string> branchAliases_;
229 
230  // If this branch *is* an EDAlias, this field is the BranchID
231  // of the branch for which this branch is an alias.
232  // If this branch is not an EDAlias, the normal case, this field is 0.
234 
236  };
237 
238  inline std::ostream& operator<<(std::ostream& os, BranchDescription const& p) {
239  p.write(os);
240  return os;
241  }
242 
243  bool operator<(BranchDescription const& a, BranchDescription const& b);
244 
245  bool operator==(BranchDescription const& a, BranchDescription const& b);
246 
247  bool combinable(BranchDescription const& a, BranchDescription const& b);
248 
249  std::string match(BranchDescription const& a, BranchDescription const& b, std::string const& fileName);
250 } // namespace edm
251 #endif
edm::BranchDescription::availableOnlyAtEndTransition
bool availableOnlyAtEndTransition() const
Definition: BranchDescription.h:90
personalPlayback.level
level
Definition: personalPlayback.py:22
edm::BranchDescription::fullClassName
std::string const & fullClassName() const
Definition: BranchDescription.h:78
edm::BranchDescription::branchID_
BranchID branchID_
Definition: BranchDescription.h:215
edm::BranchDescription::Transients::onDemand_
bool onDemand_
Definition: BranchDescription.h:179
ProvenanceFwd.h
edm::BranchDescription::Transients::splitLevel_
int splitLevel_
Definition: BranchDescription.h:168
edm::BranchDescription::productInstanceName
std::string const & productInstanceName() const
Definition: BranchDescription.h:81
edm::BranchDescription::setBasketSize
void setBasketSize(int size)
Definition: BranchDescription.h:102
edm::BranchDescription::setSplitLevel
void setSplitLevel(int level)
Definition: BranchDescription.h:100
edm::BranchDescription::Transients::availableOnlyAtEndTransition_
bool availableOnlyAtEndTransition_
Definition: BranchDescription.h:191
edm::BranchDescription::basketSize
int basketSize() const
Definition: BranchDescription.h:101
edm::BranchDescription::moduleLabel_
std::string moduleLabel_
Definition: BranchDescription.h:209
edm::BranchDescription::Transients::unwrappedType_
TypeWithDict unwrappedType_
Definition: BranchDescription.h:164
edm::BranchDescription::isSwitchAlias
bool isSwitchAlias() const
Definition: BranchDescription.h:104
edm::BranchDescription::unwrappedType
TypeWithDict const & unwrappedType() const
Definition: BranchDescription.h:95
edm::BranchDescription::setWrappedType
void setWrappedType(TypeWithDict const &type)
Definition: BranchDescription.h:94
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::BranchDescription::wrappedType
TypeWithDict const & wrappedType() const
Definition: BranchDescription.h:93
edm::BranchDescription::splitLevel
int splitLevel() const
Definition: BranchDescription.h:99
BranchID.h
edm::BranchDescription::Transients::produced_
bool produced_
Definition: BranchDescription.h:175
TypeID.h
edm::BranchDescription::parameterSetID
ParameterSetID const & parameterSetID() const
Definition: BranchDescription.h:115
edm::combinable
bool combinable(BranchDescription const &a, BranchDescription const &b)
Definition: BranchDescription.cc:340
TypeWithDict.h
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
edm::BranchDescription::Strict
Definition: BranchDescription.h:36
findQualityFiles.v
v
Definition: findQualityFiles.py:179
watchdog.const
const
Definition: watchdog.py:83
edm::BranchDescription::branchAliases_
std::set< std::string > branchAliases_
Definition: BranchDescription.h:228
edm::BranchDescription::Transients::isMergeable_
bool isMergeable_
Definition: BranchDescription.h:195
edm::BranchDescription::~BranchDescription
~BranchDescription()
Definition: BranchDescription.h:57
edm::BranchType
BranchType
Definition: BranchType.h:11
edm::BranchDescription::clearBranchName
void clearBranchName()
Definition: BranchDescription.h:121
edm::BranchDescription::setWrappedName
void setWrappedName(std::string const &name)
Definition: BranchDescription.h:124
edm::BranchDescription::write
void write(std::ostream &os) const
Definition: BranchDescription.cc:257
edm::BranchDescription::present
bool present() const
Definition: BranchDescription.h:84
edm::BranchDescription::friendlyClassName_
std::string friendlyClassName_
Definition: BranchDescription.h:221
edm::BranchDescription::Permissive
Definition: BranchDescription.h:36
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition: HLTGlobalStatus.h:106
edm::BranchDescription::BranchDescription
BranchDescription()
Definition: BranchDescription.cc:37
edm::BranchDescription::setOnDemand
void setOnDemand(bool isOnDemand)
Definition: BranchDescription.h:89
edm::BranchDescription::setProduced
void setProduced(bool isProduced)
Definition: BranchDescription.h:83
edm::BranchDescription::onDemand
bool onDemand() const
Definition: BranchDescription.h:88
edm::BranchDescription::initializeTransients
void initializeTransients()
Definition: BranchDescription.h:131
edm::BranchDescription::aliasForBranchID
BranchID const & aliasForBranchID() const
Definition: BranchDescription.h:75
edm::BranchDescription::isAlias
bool isAlias() const
Definition: BranchDescription.h:76
edm::BranchDescription::Transients::switchAliasForBranchID_
BranchID switchAliasForBranchID_
Definition: BranchDescription.h:158
edm::BranchDescription::insertBranchAlias
void insertBranchAlias(std::string const &alias)
Definition: BranchDescription.h:119
edm::BranchDescription::setDropped
void setDropped(bool isDropped)
Definition: BranchDescription.h:86
edm::BranchDescription::processName
std::string const & processName() const
Definition: BranchDescription.h:73
edm::operator==
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
Definition: debugging_allocator.h:72
edm::BranchDescription::setUnwrappedType
void setUnwrappedType(TypeWithDict const &type)
Definition: BranchDescription.h:96
edm::BranchDescription::invalidSplitLevel
static const int invalidSplitLevel
Definition: BranchDescription.h:34
edm::BranchDescription::initBranchName
void initBranchName()
Definition: BranchDescription.cc:105
edm::BranchID
Definition: BranchID.h:14
edm::operator<
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:89
edm::BranchDescription::Transients::wrappedType_
TypeWithDict wrappedType_
Definition: BranchDescription.h:161
edm::BranchDescription::Transients::transient_
bool transient_
Definition: BranchDescription.h:188
edm::BranchDescription::originalBranchID
BranchID const & originalBranchID() const
Definition: BranchDescription.h:77
ProductID.h
edm::BranchDescription::wrappedName
std::string const & wrappedName() const
Definition: BranchDescription.h:123
edm::BranchDescription::unwrappedTypeID
TypeID unwrappedTypeID() const
Definition: BranchDescription.h:98
edm::BranchDescription::transient_
Transients transient_
Definition: BranchDescription.h:235
edm::BranchDescription::setSwitchAliasForBranch
void setSwitchAliasForBranch(BranchDescription const &aliasForBranch)
Definition: BranchDescription.cc:235
edm::BranchDescription::MatchMode
MatchMode
Definition: BranchDescription.h:36
edm::Hash
Definition: Hash.h:43
trackingPlots.other
other
Definition: trackingPlots.py:1460
edm::BranchDescription::friendlyClassName
std::string const & friendlyClassName() const
Definition: BranchDescription.h:80
edm::BranchDescription::Transients::wrappedName_
std::string wrappedName_
Definition: BranchDescription.h:150
edm::BranchDescription::dropped
bool dropped() const
Definition: BranchDescription.h:85
b
double b
Definition: hdecay.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::TypeWithDict
Definition: TypeWithDict.h:38
edm::BranchDescription::isMergeable
bool isMergeable() const
Definition: BranchDescription.h:126
a
double a
Definition: hdecay.h:119
edm::BranchDescription::branchType_
BranchType branchType_
Definition: BranchDescription.h:205
edm::BranchDescription::setSwitchAliasModuleLabel
void setSwitchAliasModuleLabel(std::string label)
Definition: BranchDescription.h:106
edm::TypeWithDict::typeInfo
std::type_info const & typeInfo() const
Definition: TypeWithDict.cc:357
edm::BranchDescription::Transients::branchName_
std::string branchName_
Definition: BranchDescription.h:147
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
edm::BranchDescription::fullClassName_
std::string fullClassName_
Definition: BranchDescription.h:218
edm::BranchDescription::isProvenanceSetOnRead
bool isProvenanceSetOnRead() const noexcept
Definition: BranchDescription.h:112
value
Definition: value.py:1
BranchType.h
edm::BranchDescription::switchAliasModuleLabel
std::string const & switchAliasModuleLabel() const
Definition: BranchDescription.h:105
edm::BranchDescription::Transients::parameterSetID_
ParameterSetID parameterSetID_
Definition: BranchDescription.h:140
edm::BranchDescription::branchType
BranchType const & branchType() const
Definition: BranchDescription.h:122
edm::BranchDescription::branchName
std::string const & branchName() const
Definition: BranchDescription.h:120
edm::BranchDescription::Transients::basketSize_
int basketSize_
Definition: BranchDescription.h:172
edm::BranchDescription::initFromDictionary
void initFromDictionary()
Definition: BranchDescription.cc:154
edm::BranchDescription::produced
bool produced() const
Definition: BranchDescription.h:82
edm::BranchDescription::Transients
Definition: BranchDescription.h:133
edm::BranchDescription::Transients::isProvenanceSetOnRead_
bool isProvenanceSetOnRead_
Definition: BranchDescription.h:198
edm::BranchDescription::updateFriendlyClassName
void updateFriendlyClassName()
Definition: BranchDescription.cc:294
edm::BranchDescription::moduleName
std::string const & moduleName() const
Definition: BranchDescription.h:116
edm::BranchDescription::productInstanceName_
std::string productInstanceName_
Definition: BranchDescription.h:225
edm::BranchDescription::processName_
std::string processName_
Definition: BranchDescription.h:212
edm::TypeID
Definition: TypeID.h:22
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::match
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)
Definition: BranchDescription.cc:351
edm::BranchDescription::Transients::moduleName_
std::string moduleName_
Definition: BranchDescription.h:144
edm::BranchDescription::Transients::Transients
Transients()
Definition: BranchDescription.cc:19
edm::BranchDescription::Transients::switchAliasModuleLabel_
std::string switchAliasModuleLabel_
Definition: BranchDescription.h:153
edm::BranchDescription::moduleLabel
std::string const & moduleLabel() const
Definition: BranchDescription.h:72
edm::BranchDescription::merge
void merge(BranchDescription const &other)
Definition: BranchDescription.cc:227
relativeConstraints.value
value
Definition: relativeConstraints.py:53
SiStripOfflineCRack_cfg.alias
alias
Definition: SiStripOfflineCRack_cfg.py:128
edm::BranchDescription::setIsMergeable
void setIsMergeable(bool v)
Definition: BranchDescription.h:127
edm::BranchDescription::setTransient
void setTransient(bool isTransient)
Definition: BranchDescription.h:92
edm::BranchDescription::branchAliases
std::set< std::string > const & branchAliases() const
Definition: BranchDescription.h:118
edm::BranchDescription::invalidBasketSize
static const int invalidBasketSize
Definition: BranchDescription.h:35
edm::BranchID::isValid
bool isValid() const
Definition: BranchID.h:22
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
or
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
edm::BranchDescription::isAnyAlias
bool isAnyAlias() const
Definition: BranchDescription.h:110
edm::BranchDescription::init
void init()
Definition: BranchDescription.h:59
edm::BranchDescription
Definition: BranchDescription.h:32
ParameterSetID.h
edm::BranchDescription::className
std::string const & className() const
Definition: BranchDescription.h:79
edm::BranchDescription::switchAliasForBranchID
BranchID const & switchAliasForBranchID() const
Definition: BranchDescription.h:107
edm::BranchDescription::Transients::reset
void reset()
Definition: BranchDescription.cc:35
edm::BranchDescription::Transients::dropped_
bool dropped_
Definition: BranchDescription.h:184
edm::BranchDescription::aliasForBranchID_
BranchID aliasForBranchID_
Definition: BranchDescription.h:233
edm::BranchDescription::wrappedTypeID
TypeID wrappedTypeID() const
Definition: BranchDescription.h:97
edm::BranchDescription::setIsProvenanceSetOnRead
void setIsProvenanceSetOnRead(bool value=true) noexcept
Definition: BranchDescription.h:113
edm::BranchDescription::branchID
BranchID const & branchID() const
Definition: BranchDescription.h:74
label
const char * label
Definition: PFTauDecayModeTools.cc:11
edm::BranchDescription::throwIfInvalid_
void throwIfInvalid_() const
Definition: BranchDescription.cc:274
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443