/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
DataFormats/Provenance/interface/BranchDescription.h
215 строк
8 KB
Matti Kortelainen
Remove SwitchProducer
16 сен 2025, 19:13
16 сен 2025, 19:13
c2c7612
Код
Авторство
О чём код?
#ifndef DataFormats_Provenance_BranchDescription_h #define DataFormats_Provenance_BranchDescription_h /*---------------------------------------------------------------------- BranchDescription: The full description of a Branch. This description also applies to every product instance on the branch. ----------------------------------------------------------------------*/ #include "DataFormats/Provenance/interface/BranchID.h" #include "DataFormats/Provenance/interface/BranchType.h" #include "DataFormats/Provenance/interface/ProvenanceFwd.h" #include "FWCore/Utilities/interface/TypeID.h" #include "FWCore/Reflection/interface/TypeWithDict.h" #include <iosfwd> #include <map> #include <set> #include <string> #if (not defined __INCLUDE_LEVEL__ or __INCLUDE_LEVEL__ > 0) and \ not defined(DataFormats_Provenance_ProductDescription_h) #error The name BranchDescription is deprecated, please use ProductDescription instead. #endif /* BranchDescription definitions: The event-independent description of an EDProduct. */ namespace edm { class BranchDescription { public: static int const invalidSplitLevel = -1; static int const invalidBasketSize = 0; enum MatchMode { Strict = 0, Permissive, FromInputToCurrent }; BranchDescription(); BranchDescription(BranchType const& branchType, std::string const& moduleLabel, std::string const& processName, std::string const& productInstanceName, edm::TypeID const& theType, bool produced = true, bool availableOnlyAtEndTransition = false, std::set<std::string> const& aliases = std::set<std::string>()); BranchDescription(BranchDescription const& aliasForBranch, std::string const& moduleLabelAlias, std::string const& productInstanceAlias); ~BranchDescription() {} void init() { initBranchName(); initFromDictionary(); } void initBranchName(); void initFromDictionary(); void write(std::ostream& os) const; void merge(BranchDescription const& other); std::string const& moduleLabel() const { return moduleLabel_; } std::string const& processName() const { return processName_; } BranchID const& branchID() const { return branchID_; } BranchID const& aliasForBranchID() const { return aliasForBranchID_; } bool isAlias() const { return aliasForBranchID_.isValid() && produced(); } BranchID const& originalBranchID() const { return aliasForBranchID_.isValid() ? aliasForBranchID_ : branchID_; } std::string const& fullClassName() const { return fullClassName_; } std::string const& className() const { return fullClassName(); } std::string const& friendlyClassName() const { return friendlyClassName_; } std::string const& productInstanceName() const { return productInstanceName_; } bool produced() const { return transient_.produced_; } void setProduced(bool isProduced) { transient_.produced_ = isProduced; } bool isTransform() const { return transient_.isTransform_; } void setIsTransform(bool isTransform) { transient_.isTransform_ = isTransform; } bool present() const { return !transient_.dropped_; } bool dropped() const { return transient_.dropped_; } void setDropped(bool isDropped) { transient_.dropped_ = isDropped; } //returns true if unscheduled (produced()==true) or using delayed reader (produced()==false) bool onDemand() const { return transient_.onDemand_; } void setOnDemand(bool isOnDemand) { transient_.onDemand_ = isOnDemand; } bool availableOnlyAtEndTransition() const { return transient_.availableOnlyAtEndTransition_; } bool transient() const { return transient_.transient_; } void setTransient(bool isTransient) { transient_.transient_ = isTransient; } TypeWithDict const& wrappedType() const { return transient_.wrappedType_; } TypeWithDict const& unwrappedType() const { return transient_.unwrappedType_; } TypeID wrappedTypeID() const { return TypeID(transient_.wrappedType_.typeInfo()); } TypeID unwrappedTypeID() const { return TypeID(transient_.unwrappedType_.typeInfo()); } bool isProvenanceSetOnRead() const noexcept { return transient_.isProvenanceSetOnRead_; } void setIsProvenanceSetOnRead(bool value = true) noexcept { transient_.isProvenanceSetOnRead_ = value; } std::set<std::string> const& branchAliases() const { return branchAliases_; } void insertBranchAlias(std::string const& alias) { branchAliases_.insert(alias); } std::string const& branchName() const { return transient_.branchName_; } void clearBranchName() { transient_.branchName_.clear(); } BranchType const& branchType() const { return branchType_; } std::string const& wrappedName() const { return transient_.wrappedName_; } void setWrappedName(std::string const& name) { transient_.wrappedName_ = name; } bool isMergeable() const { return transient_.isMergeable_; } void setIsMergeable(bool v) { transient_.isMergeable_ = v; } void updateFriendlyClassName(); void initializeTransients() { transient_.reset(); } struct Transients { Transients(); void reset(); // The branch name, which is currently derivable from the other attributes. std::string branchName_; // The wrapped class name, which is currently derivable from the other attributes. std::string wrappedName_; // A TypeWithDict object for the wrapped object // This is set if and only if the dropped_ is false TypeWithDict wrappedType_; // A TypeWithDict object for the unwrapped object // This is set if and only if the dropped_ is false TypeWithDict unwrappedType_; // Was this branch produced in this process rather than in a previous process bool produced_; // Was this branch produced in this current process and by unscheduled production // This item is set only in the framework, not by FWLite. bool onDemand_; // Was this branch produced in this current process via the transform ability bool isTransform_; // Has the branch been dropped from the product tree in this file // (or if this is a merged product registry, in the first file). // This item is set only in the framework, not by FWLite. bool dropped_; // Is the class of the branch marked as transient // in the data dictionary bool transient_; // if Run or Lumi based, can only get at end transition bool availableOnlyAtEndTransition_; // True if the product definition has a mergeProduct function // and the branchType is Run or Lumi bool isMergeable_; // True if provenance is set on call from input on read bool isProvenanceSetOnRead_ = false; }; private: void throwIfInvalid_() const; // What tree is the branch in? BranchType branchType_; // A human friendly string that uniquely identifies the EDProducer // and becomes part of the identity of a product that it produces std::string moduleLabel_; // the physical process that this program was part of (e.g. production) std::string processName_; // An ID uniquely identifying the branch BranchID branchID_; // the full name of the type of product this is std::string fullClassName_; // a readable name of the type of product this is std::string friendlyClassName_; // a user-supplied name to distinguish multiple products of the same type // that are produced by the same producer std::string productInstanceName_; // The branch ROOT alias(es), which are settable by the user. std::set<std::string> branchAliases_; // If this branch *is* an EDAlias, this field is the BranchID // of the branch for which this branch is an alias. // If this branch is not an EDAlias, the normal case, this field is 0. BranchID aliasForBranchID_; Transients transient_; }; inline std::ostream& operator<<(std::ostream& os, BranchDescription const& p) { p.write(os); return os; } bool operator<(BranchDescription const& a, BranchDescription const& b); bool operator==(BranchDescription const& a, BranchDescription const& b); bool combinable(BranchDescription const& a, BranchDescription const& b); std::string match(BranchDescription const& a, BranchDescription const& b, std::string const& fileName); } // namespace edm #endif