CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
edm::BranchDescription Class Reference

#include <BranchDescription.h>

Classes

struct  Transients
 

Public Types

enum  MatchMode { Strict = 0, Permissive }
 

Public Member Functions

int & basketSize () const
 
std::set< std::string > const & branchAliases () const
 
std::set< std::string > & branchAliases ()
 
 BranchDescription ()
 
 BranchDescription (BranchType const &branchType, std::string const &mdLabel, std::string const &procName, std::string const &name, std::string const &fName, std::string const &pin, ModuleDescription const &modDesc, TypeID const &theTypeID, std::set< std::string > const &aliases=std::set< std::string >())
 
BranchID const & branchID () const
 
std::string & branchName () const
 
BranchType const & branchType () const
 
std::string const & className () const
 
bool & dropped () const
 
std::string const & friendlyClassName () const
 
std::string const & fullClassName () const
 
void init () const
 
void initBranchName () const
 
void initFromDictionary () const
 
bool isPsetIDUnique () const
 
void merge (BranchDescription const &other)
 
std::string const & moduleLabel () const
 
std::string const & moduleName () const
 
std::map
< ProcessConfigurationID,
std::string > & 
moduleNames () const
 
ProductID const & oldProductID () const
 
bool & onDemand () const
 
ParameterSetID const & parameterSetID () const
 
std::map
< ProcessConfigurationID,
ParameterSetID > & 
parameterSetIDs () const
 
bool present () const
 
std::string const & processName () const
 
bool & produced () const
 
std::string const & productInstanceName () const
 
ParameterSetID const & psetID () const
 
void setDropped () const
 
void setOnDemand () const
 
int & splitLevel () const
 
bool & transient () const
 
Reflex::Type & type () const
 
TypeIDtypeID () const
 
void updateFriendlyClassName ()
 
std::string & wrappedName () const
 
void write (std::ostream &os) const
 
 ~BranchDescription ()
 

Static Public Attributes

static int const invalidBasketSize = 0
 
static int const invalidSplitLevel = -1
 

Private Member Functions

void throwIfInvalid_ () const
 

Private Attributes

std::set< std::string > branchAliases_
 
BranchID branchID_
 
BranchType branchType_
 
std::string friendlyClassName_
 
std::string fullClassName_
 
std::string moduleLabel_
 
std::string processName_
 
ProductID productID_
 
std::string productInstanceName_
 
Transient< Transientstransients_
 

Detailed Description

Definition at line 34 of file BranchDescription.h.

Member Enumeration Documentation

Enumerator
Strict 
Permissive 

Definition at line 38 of file BranchDescription.h.

Constructor & Destructor Documentation

edm::BranchDescription::BranchDescription ( )

Definition at line 33 of file BranchDescription.cc.

33  :
35  moduleLabel_(),
36  processName_(),
37  branchID_(),
38  productID_(),
43  transients_() {
44  // do not call init here! It will result in an exception throw.
45  }
std::set< std::string > branchAliases_
Transient< Transients > transients_
edm::BranchDescription::BranchDescription ( BranchType const &  branchType,
std::string const &  mdLabel,
std::string const &  procName,
std::string const &  name,
std::string const &  fName,
std::string const &  pin,
ModuleDescription const &  modDesc,
TypeID const &  theTypeID,
std::set< std::string > const &  aliases = std::set<std::string>() 
)

Definition at line 47 of file BranchDescription.cc.

References dropped(), init(), edm::ModuleDescription::moduleName(), onDemand(), edm::ModuleDescription::parameterSetID(), produced(), transients_, and typeID().

56  :
58  moduleLabel_(mdLabel),
59  processName_(procName),
60  branchID_(),
61  productID_(),
63  friendlyClassName_(fName),
65  branchAliases_(aliases),
66  transients_() {
67  dropped() = false;
68  produced() = true;
69  onDemand() = false;
70  typeID() = theTypeID;
71  transients_.get().parameterSetID_ = modDesc.parameterSetID();
72  transients_.get().moduleName_ = modDesc.moduleName();
73  init();
74  }
BranchType const & branchType() const
TypeID & typeID() const
bool & produced() const
bool & onDemand() const
std::set< std::string > branchAliases_
Transient< Transients > transients_
edm::BranchDescription::~BranchDescription ( )
inline

Definition at line 53 of file BranchDescription.h.

53 {}

Member Function Documentation

int& edm::BranchDescription::basketSize ( ) const
inline

Definition at line 84 of file BranchDescription.h.

References transients_.

Referenced by edm::PoolOutputModule::fillSelectedItemList(), initFromDictionary(), and merge().

84 {return transients_.get().basketSize_;}
Transient< Transients > transients_
std::set<std::string> const& edm::BranchDescription::branchAliases ( ) const
inline
std::set<std::string>& edm::BranchDescription::branchAliases ( )
inline

Definition at line 98 of file BranchDescription.h.

References branchAliases_.

98 {return branchAliases_;}
std::set< std::string > branchAliases_
BranchID const& edm::BranchDescription::branchID ( ) const
inline
std::string& edm::BranchDescription::branchName ( ) const
inline
BranchType const& edm::BranchDescription::branchType ( ) const
inline
std::string const& edm::BranchDescription::className ( ) const
inline
bool& edm::BranchDescription::dropped ( ) const
inline

Definition at line 78 of file BranchDescription.h.

References transients_.

Referenced by BranchDescription(), edm::match(), edm::operator==(), and setDropped().

78 {return transients_.get().dropped_;}
Transient< Transients > transients_
std::string const& edm::BranchDescription::friendlyClassName ( ) const
inline
std::string const& edm::BranchDescription::fullClassName ( ) const
inline
void edm::BranchDescription::init ( void  ) const
inline
void edm::BranchDescription::initBranchName ( ) const

Definition at line 77 of file BranchDescription.cc.

References branchID_, branchName(), relativeConstraints::empty, edm::hlt::Exception, friendlyClassName(), friendlyClassName_, edm::BranchID::isValid(), moduleLabel(), moduleLabel_, L1TDQM_cfg::period, processName(), processName_, productInstanceName(), productInstanceName_, edm::BranchID::setID(), findQualityFiles::size, and throwIfInvalid_().

Referenced by init(), and updateFriendlyClassName().

77  {
78  if (!branchName().empty()) {
79  return; // already called
80  }
82 
83  char const underscore('_');
84  char const period('.');
85 
86  if (friendlyClassName_.find(underscore) != std::string::npos) {
87  throw cms::Exception("IllegalCharacter") << "Class name '" << friendlyClassName()
88  << "' contains an underscore ('_'), which is illegal in the name of a product.\n";
89  }
90 
91  if (moduleLabel_.find(underscore) != std::string::npos) {
92  throw cms::Exception("IllegalCharacter") << "Module label '" << moduleLabel()
93  << "' contains an underscore ('_'), which is illegal in a module label.\n";
94  }
95 
96  if (productInstanceName_.find(underscore) != std::string::npos) {
97  throw cms::Exception("IllegalCharacter") << "Product instance name '" << productInstanceName()
98  << "' contains an underscore ('_'), which is illegal in a product instance name.\n";
99  }
100 
101  if (processName_.find(underscore) != std::string::npos) {
102  throw cms::Exception("IllegalCharacter") << "Process name '" << processName()
103  << "' contains an underscore ('_'), which is illegal in a process name.\n";
104  }
105 
106  branchName().reserve(friendlyClassName().size() +
107  moduleLabel().size() +
109  processName().size() + 4);
111  branchName() += underscore;
112  branchName() += moduleLabel();
113  branchName() += underscore;
115  branchName() += underscore;
116  branchName() += processName();
117  branchName() += period;
118 
119  if (!branchID_.isValid()) {
121  }
122  }
tuple period
Definition: L1TDQM_cfg.py:67
std::string & branchName() const
std::string const & processName() const
bool isValid() const
Definition: BranchID.h:24
std::string const & moduleLabel() const
std::string const & productInstanceName() const
std::string const & friendlyClassName() const
tuple size
Write out results.
void setID(std::string const &branchName)
Definition: BranchID.h:22
void edm::BranchDescription::initFromDictionary ( ) const

Definition at line 125 of file BranchDescription.cc.

References basketSize(), edm::hlt::Exception, fullClassName(), invalidBasketSize, invalidSplitLevel, L1TEmulatorMonitor_cff::p, splitLevel(), matplotRender::t, throwIfInvalid_(), type(), edm::wrappedClassName(), and wrappedName().

Referenced by init().

125  {
126  Reflex::Type null;
127 
128  if (type() != null) {
129  return; // already initialized;
130  }
131 
132  throwIfInvalid_();
133 
135 
136  Reflex::Type t = Reflex::Type::ByName(fullClassName());
137  if (t == null) {
140  transient() = false;
141  return;
142  }
143  Reflex::PropertyList p = t.Properties();
144  transient() = (p.HasProperty("persistent") ? p.PropertyAsString("persistent") == std::string("false") : false);
145  if (transient()) {
148  type() = t;
149  return;
150  }
151  type() = Reflex::Type::ByName(wrappedName());
152  if (type() == null) {
155  return;
156  }
157  Reflex::PropertyList wp = type().Properties();
158  if (wp.HasProperty("splitLevel")) {
159  splitLevel() = strtol(wp.PropertyAsString("splitLevel").c_str(), 0, 0);
160  if (splitLevel() < 0) {
161  throw cms::Exception("IllegalSplitLevel") << "' An illegal ROOT split level of " <<
162  splitLevel() << " is specified for class " << wrappedName() << ".'\n";
163  }
164  ++splitLevel(); //Compensate for wrapper
165  } else {
167  }
168  if (wp.HasProperty("basketSize")) {
169  basketSize() = strtol(wp.PropertyAsString("basketSize").c_str(), 0, 0);
170  if (basketSize() <= 0) {
171  throw cms::Exception("IllegalBasketSize") << "' An illegal ROOT basket size of " <<
172  basketSize() << " is specified for class " << wrappedName() << "'.\n";
173  }
174  } else {
176  }
177  }
Reflex::Type & type() const
static int const invalidSplitLevel
static int const invalidBasketSize
std::string & wrappedName() const
std::string const & fullClassName() const
std::string wrappedClassName(std::string const &iFullName)
bool edm::BranchDescription::isPsetIDUnique ( ) const
inline

Definition at line 96 of file BranchDescription.h.

References parameterSetIDs().

96 {return parameterSetIDs().size() == 1;}
std::map< ProcessConfigurationID, ParameterSetID > & parameterSetIDs() const
void edm::BranchDescription::merge ( BranchDescription const &  other)

Definition at line 192 of file BranchDescription.cc.

References basketSize(), branchAliases(), branchAliases_, invalidBasketSize, invalidSplitLevel, moduleNames(), parameterSetIDs(), and splitLevel().

192  {
193  parameterSetIDs().insert(other.parameterSetIDs().begin(), other.parameterSetIDs().end());
194  moduleNames().insert(other.moduleNames().begin(), other.moduleNames().end());
195  branchAliases_.insert(other.branchAliases().begin(), other.branchAliases().end());
196  if (splitLevel() == invalidSplitLevel) splitLevel() = other.splitLevel();
197  if (basketSize() == invalidBasketSize) basketSize() = other.basketSize();
198  }
static int const invalidSplitLevel
static int const invalidBasketSize
std::map< ProcessConfigurationID, std::string > & moduleNames() const
std::map< ProcessConfigurationID, ParameterSetID > & parameterSetIDs() const
std::set< std::string > branchAliases_
std::string const& edm::BranchDescription::moduleLabel ( ) const
inline
std::string const& edm::BranchDescription::moduleName ( ) const
inline

Definition at line 87 of file BranchDescription.h.

References transients_.

Referenced by edm::Provenance::moduleName().

87 {return transients_.get().moduleName_;}
Transient< Transients > transients_
std::map<ProcessConfigurationID, std::string>& edm::BranchDescription::moduleNames ( ) const
inline

Definition at line 92 of file BranchDescription.h.

References transients_.

Referenced by edm::fillProductRegistryTransients(), merge(), edm::Provenance::moduleNames(), edm::operator<(), and edm::operator==().

92  {
93  return transients_.get().moduleNames_;
94  }
Transient< Transients > transients_
ProductID const& edm::BranchDescription::oldProductID ( ) const
inline

Definition at line 71 of file BranchDescription.h.

References productID_.

71 {return productID_;}
bool& edm::BranchDescription::onDemand ( ) const
inline

Definition at line 79 of file BranchDescription.h.

References transients_.

Referenced by BranchDescription(), and setOnDemand().

79 {return transients_.get().onDemand_;}
Transient< Transients > transients_
ParameterSetID const& edm::BranchDescription::parameterSetID ( ) const
inline

Definition at line 86 of file BranchDescription.h.

References transients_.

Referenced by edm::Provenance::psetID(), and throwIfInvalid_().

86 {return transients_.get().parameterSetID_;}
Transient< Transients > transients_
std::map<ProcessConfigurationID, ParameterSetID>& edm::BranchDescription::parameterSetIDs ( ) const
inline

Definition at line 89 of file BranchDescription.h.

References transients_.

Referenced by edm::fillProductRegistryTransients(), isPsetIDUnique(), edm::match(), merge(), edm::operator<(), edm::operator==(), edm::Provenance::parameterSetIDs(), and psetID().

89  {
90  return transients_.get().parameterSetIDs_;
91  }
Transient< Transients > transients_
bool edm::BranchDescription::present ( ) const
inline
std::string const& edm::BranchDescription::processName ( ) const
inline
bool& edm::BranchDescription::produced ( ) const
inline
std::string const& edm::BranchDescription::productInstanceName ( ) const
inline
ParameterSetID const & edm::BranchDescription::psetID ( ) const

Definition at line 180 of file BranchDescription.cc.

References branchName(), relativeConstraints::empty, edm::hlt::Exception, parameterSetIDs(), and findQualityFiles::size.

Referenced by EcalTrigPrimProducer::beginJob().

180  {
181  assert(!parameterSetIDs().empty());
182  if (parameterSetIDs().size() != 1) {
183  throw cms::Exception("Ambiguous")
184  << "Your application requires all events on Branch '" << branchName()
185  << "'\n to have the same provenance. This file has events with mixed provenance\n"
186  << "on this branch. Use a different input file.\n";
187  }
188  return parameterSetIDs().begin()->second;
189  }
std::string & branchName() const
std::map< ProcessConfigurationID, ParameterSetID > & parameterSetIDs() const
tuple size
Write out results.
void edm::BranchDescription::setDropped ( ) const
inline

Definition at line 103 of file BranchDescription.h.

References dropped().

Referenced by edm::RootTree::setPresence(), and TFWLiteSelectorBasic::setupNewFile().

103 {dropped() = true;}
void edm::BranchDescription::setOnDemand ( ) const
inline

Definition at line 104 of file BranchDescription.h.

References onDemand().

104 {onDemand() = true;}
bool & onDemand() const
int& edm::BranchDescription::splitLevel ( ) const
inline

Definition at line 83 of file BranchDescription.h.

References transients_.

Referenced by edm::PoolOutputModule::fillSelectedItemList(), initFromDictionary(), and merge().

83 {return transients_.get().splitLevel_;}
Transient< Transients > transients_
void edm::BranchDescription::throwIfInvalid_ ( ) const
private

Definition at line 220 of file BranchDescription.cc.

References branchType_, friendlyClassName_, fullClassName_, edm::Hash< I >::isValid(), moduleLabel_, edm::NumBranchTypes, parameterSetID(), processName_, produced(), and edm::throwExceptionWithText().

Referenced by initBranchName(), and initFromDictionary().

220  {
222  throwExceptionWithText("Illegal BranchType detected");
223 
224  if (moduleLabel_.empty())
225  throwExceptionWithText("Module label is not allowed to be empty");
226 
227  if (processName_.empty())
228  throwExceptionWithText("Process name is not allowed to be empty");
229 
230  if (fullClassName_.empty())
231  throwExceptionWithText("Full class name is not allowed to be empty");
232 
233  if (friendlyClassName_.empty())
234  throwExceptionWithText("Friendly class name is not allowed to be empty");
235 
236  if (produced() && !parameterSetID().isValid())
237  throwExceptionWithText("Invalid ParameterSetID detected");
238  }
bool & produced() const
void throwExceptionWithText(char const *txt)
ParameterSetID const & parameterSetID() const
bool isValid() const
Definition: Hash.h:136
bool& edm::BranchDescription::transient ( ) const
inline

Definition at line 80 of file BranchDescription.h.

References transients_.

Referenced by edm::OutputModule::selectProducts().

80 {return transients_.get().transient_;}
Transient< Transients > transients_
Reflex::Type& edm::BranchDescription::type ( ) const
inline
TypeID& edm::BranchDescription::typeID ( ) const
inline

Definition at line 82 of file BranchDescription.h.

References transients_.

Referenced by BranchDescription().

82 {return transients_.get().typeID_;}
Transient< Transients > transients_
void edm::BranchDescription::updateFriendlyClassName ( )

Definition at line 241 of file BranchDescription.cc.

References branchName(), friendlyClassName_, edm::friendlyname::friendlyName(), fullClassName(), and initBranchName().

Referenced by edm::RootFile::RootFile(), and TFWLiteSelectorBasic::setupNewFile().

241  {
243  branchName().clear();
244  initBranchName();
245  }
std::string & branchName() const
std::string friendlyName(std::string const &iFullName)
std::string const & fullClassName() const
std::string& edm::BranchDescription::wrappedName ( ) const
inline

Definition at line 101 of file BranchDescription.h.

References transients_.

Referenced by edm::RootFile::dropOnInput(), initFromDictionary(), and edm::RootOutputFile::RootOutputFile().

101 {return transients_.get().wrappedName_;}
Transient< Transients > transients_
void edm::BranchDescription::write ( std::ostream &  os) const

Definition at line 201 of file BranchDescription.cc.

References branchID(), branchType(), friendlyClassName(), fullClassName(), moduleLabel(), processName(), and productInstanceName().

Referenced by edm::operator<<(), and edm::Provenance::write().

201  {
202  os << "Branch Type = " << branchType() << std::endl;
203  os << "Process Name = " << processName() << std::endl;
204  os << "ModuleLabel = " << moduleLabel() << std::endl;
205  os << "Branch ID = " << branchID() << '\n';
206  os << "Class Name = " << fullClassName() << '\n';
207  os << "Friendly Class Name = " << friendlyClassName() << '\n';
208  os << "Product Instance Name = " << productInstanceName() << std::endl;
209  }
BranchType const & branchType() const
std::string const & processName() const
std::string const & moduleLabel() const
std::string const & productInstanceName() const
std::string const & friendlyClassName() const
BranchID const & branchID() const
std::string const & fullClassName() const

Member Data Documentation

std::set<std::string> edm::BranchDescription::branchAliases_
private

Definition at line 199 of file BranchDescription.h.

Referenced by branchAliases(), and merge().

BranchID edm::BranchDescription::branchID_
mutableprivate

Definition at line 181 of file BranchDescription.h.

Referenced by branchID(), and initBranchName().

BranchType edm::BranchDescription::branchType_
private

Definition at line 171 of file BranchDescription.h.

Referenced by branchType(), and throwIfInvalid_().

std::string edm::BranchDescription::friendlyClassName_
private
std::string edm::BranchDescription::fullClassName_
private

Definition at line 189 of file BranchDescription.h.

Referenced by fullClassName(), and throwIfInvalid_().

int const edm::BranchDescription::invalidBasketSize = 0
static
int const edm::BranchDescription::invalidSplitLevel = -1
static
std::string edm::BranchDescription::moduleLabel_
private
std::string edm::BranchDescription::processName_
private

Definition at line 178 of file BranchDescription.h.

Referenced by initBranchName(), processName(), and throwIfInvalid_().

ProductID edm::BranchDescription::productID_
private

Definition at line 186 of file BranchDescription.h.

Referenced by oldProductID().

std::string edm::BranchDescription::productInstanceName_
private

Definition at line 196 of file BranchDescription.h.

Referenced by initBranchName(), and productInstanceName().

Transient<Transients> edm::BranchDescription::transients_
mutableprivate