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

BranchID const & aliasForBranchID () const
 
int & basketSize () const
 
std::set< std::string > const & branchAliases () const
 
std::set< std::string > & branchAliases ()
 
 BranchDescription ()
 
 BranchDescription (BranchType const &branchType, std::string const &moduleLabel, std::string const &processName, std::string const &className, std::string const &friendlyClassName, std::string const &productInstanceName, std::string const &moduleName, ParameterSetID const &parameterSetID, TypeWithDict const &theTypeWithDict, bool produced=true, std::set< std::string > const &aliases=std::set< std::string >())
 
 BranchDescription (BranchDescription const &aliasForBranch, std::string const &moduleLabelAlias, std::string const &poruductInstanceAlias)
 
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
 
WrapperInterfaceBase const * getInterface () const
 
void init () const
 
void initBranchName () const
 
void initFromDictionary () const
 
void initializeTransients () const
 
bool isAlias () 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
 
bool & onDemand () const
 
BranchID const & originalBranchID () 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
 
TypeWithDictunwrappedType () const
 
TypeID unwrappedTypeID () const
 
void updateFriendlyClassName ()
 
std::string & wrappedName () const
 
TypeWithDictwrappedType () const
 
TypeID wrappedTypeID () const
 
WrapperInterfaceBase *& wrapperInterfaceBase () 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

BranchID aliasForBranchID_
 
std::set< std::string > branchAliases_
 
BranchID branchID_
 
BranchType branchType_
 
std::string friendlyClassName_
 
std::string fullClassName_
 
std::string moduleLabel_
 
std::string processName_
 
std::string productInstanceName_
 
Transients transient_
 

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 42 of file BranchDescription.cc.

42  :
44  moduleLabel_(),
45  processName_(),
46  branchID_(),
52  transient_() {
53  // do not call init here! It will result in an exception throw.
54  }
std::set< std::string > branchAliases_
edm::BranchDescription::BranchDescription ( BranchType const &  branchType,
std::string const &  moduleLabel,
std::string const &  processName,
std::string const &  className,
std::string const &  friendlyClassName,
std::string const &  productInstanceName,
std::string const &  moduleName,
ParameterSetID const &  parameterSetID,
TypeWithDict const &  theTypeWithDict,
bool  produced = true,
std::set< std::string > const &  aliases = std::set<std::string>() 
)

Definition at line 56 of file BranchDescription.cc.

References dropped(), init(), moduleName(), edm::BranchDescription::Transients::moduleName_, onDemand(), parameterSetID(), edm::BranchDescription::Transients::parameterSetID_, produced(), edm::BranchDescription::Transients::produced_, transient_, and unwrappedType().

67  :
71  branchID_(),
76  transient_() {
77  dropped() = false;
79  onDemand() = false;
82  unwrappedType() = theTypeWithDict;
83  init();
84  }
dictionary aliases
Definition: autoCond.py:22
BranchType const & branchType() const
TypeWithDict & unwrappedType() const
bool & produced() const
bool & onDemand() const
std::string const & processName() const
std::string const & className() const
std::string const & moduleLabel() const
std::string const & productInstanceName() const
std::string const & friendlyClassName() const
std::string const & moduleName() const
ParameterSetID const & parameterSetID() const
std::set< std::string > branchAliases_
edm::BranchDescription::BranchDescription ( BranchDescription const &  aliasForBranch,
std::string const &  moduleLabelAlias,
std::string const &  poruductInstanceAlias 
)

Definition at line 86 of file BranchDescription.cc.

References dropped(), init(), moduleName(), edm::BranchDescription::Transients::moduleName_, onDemand(), parameterSetID(), edm::BranchDescription::Transients::parameterSetID_, produced(), edm::BranchDescription::Transients::produced_, transient_, and unwrappedType().

89  :
90  branchType_(aliasForBranch.branchType()),
91  moduleLabel_(moduleLabelAlias),
92  processName_(aliasForBranch.processName()),
93  branchID_(),
94  fullClassName_(aliasForBranch.className()),
95  friendlyClassName_(aliasForBranch.friendlyClassName()),
96  productInstanceName_(productInstanceAlias),
97  branchAliases_(aliasForBranch.branchAliases()),
98  aliasForBranchID_(aliasForBranch.branchID()),
99  transient_() {
100  dropped() = false;
101  transient_.produced_ = aliasForBranch.produced(),
102  onDemand() = aliasForBranch.onDemand();
103  transient_.moduleName_ = aliasForBranch.moduleName();
104  transient_.parameterSetID_ = aliasForBranch.parameterSetID();
105  unwrappedType() = aliasForBranch.unwrappedType();
106  init();
107  }
TypeWithDict & unwrappedType() const
bool & onDemand() const
std::set< std::string > branchAliases_
edm::BranchDescription::~BranchDescription ( )
inline

Definition at line 59 of file BranchDescription.h.

59 {}

Member Function Documentation

BranchID const& edm::BranchDescription::aliasForBranchID ( ) const
inline

Definition at line 77 of file BranchDescription.h.

References aliasForBranchID_.

77 {return aliasForBranchID_;}
int& edm::BranchDescription::basketSize ( ) const
inline
std::set<std::string> const& edm::BranchDescription::branchAliases ( ) const
inline
std::set<std::string>& edm::BranchDescription::branchAliases ( )
inline

Definition at line 108 of file BranchDescription.h.

References branchAliases_.

108 {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
std::string const& edm::BranchDescription::friendlyClassName ( ) const
inline
std::string const& edm::BranchDescription::fullClassName ( ) const
inline
WrapperInterfaceBase const * edm::BranchDescription::getInterface ( ) const

Definition at line 368 of file BranchDescription.cc.

References edm::TypeWithDict::byName(), edm::TypeWithDict::invokeByName(), wrappedName(), and wrapperInterfaceBase().

Referenced by BareRootProductGetter::createNewBuffer(), edm::RootFile::dropOnInput(), edm::ProductData::getInterface(), edm::root::FWLiteDelayedReader::getProduct_(), and edm::RootOutputFile::RootOutputFile().

368  {
369  if(wrapperInterfaceBase() == 0) {
370  // This could be done in init(), but we only want to do it on demand, for performance reasons.
371  TypeWithDict type = TypeWithDict::byName(wrappedName());
372  type.invokeByName(wrapperInterfaceBase(), "getInterface");
373  assert(wrapperInterfaceBase() != 0);
374  }
375  return wrapperInterfaceBase();
376  }
type
Definition: HCALResponse.h:21
static TypeWithDict byName(std::string const &className)
WrapperInterfaceBase *& wrapperInterfaceBase() const
std::string & wrappedName() const
void edm::BranchDescription::init ( void  ) const
inline
void edm::BranchDescription::initBranchName ( ) const

Definition at line 110 of file BranchDescription.cc.

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

Referenced by init(), and updateFriendlyClassName().

110  {
111  if(!branchName().empty()) {
112  return; // already called
113  }
114  throwIfInvalid_();
115 
116  char const underscore('_');
117  char const period('.');
118 
119  if(friendlyClassName_.find(underscore) != std::string::npos) {
120  throw cms::Exception("IllegalCharacter") << "Class name '" << friendlyClassName()
121  << "' contains an underscore ('_'), which is illegal in the name of a product.\n";
122  }
123 
124  if(moduleLabel_.find(underscore) != std::string::npos) {
125  throw cms::Exception("IllegalCharacter") << "Module label '" << moduleLabel()
126  << "' contains an underscore ('_'), which is illegal in a module label.\n";
127  }
128 
129  if(productInstanceName_.find(underscore) != std::string::npos) {
130  throw cms::Exception("IllegalCharacter") << "Product instance name '" << productInstanceName()
131  << "' contains an underscore ('_'), which is illegal in a product instance name.\n";
132  }
133 
134  if(processName_.find(underscore) != std::string::npos) {
135  throw cms::Exception("IllegalCharacter") << "Process name '" << processName()
136  << "' contains an underscore ('_'), which is illegal in a process name.\n";
137  }
138 
139  branchName().reserve(friendlyClassName().size() +
140  moduleLabel().size() +
142  processName().size() + 4);
144  branchName() += underscore;
145  branchName() += moduleLabel();
146  branchName() += underscore;
148  branchName() += underscore;
149  branchName() += processName();
150  branchName() += period;
151 
152  if(!branchID_.isValid()) {
154  }
155  }
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 158 of file BranchDescription.cc.

References basketSize(), edm::TypeWithDict::byName(), edm::hlt::Exception, fullClassName(), invalidBasketSize, invalidSplitLevel, splitLevel(), AlCaHLTBitMon_QueryRunRegistry::string, throwIfInvalid_(), unwrappedType(), edm::wrappedClassName(), wrappedName(), and wrappedType().

Referenced by init().

158  {
159  if(bool(wrappedType())) {
160  return; // already initialized;
161  }
162 
163  throwIfInvalid_();
164 
166 
167  // unwrapped type.
169  if(!bool(unwrappedType())) {
172  transient() = false;
173  return;
174  }
175 
177  if(!bool(wrappedType())) {
180  return;
181  }
182  Reflex::PropertyList wp = Reflex::Type::ByTypeInfo(wrappedType().typeInfo()).Properties();
183  transient() = (wp.HasProperty("persistent") ? wp.PropertyAsString("persistent") == std::string("false") : false);
184  if(transient()) {
187  return;
188  }
189  if(wp.HasProperty("splitLevel")) {
190  splitLevel() = strtol(wp.PropertyAsString("splitLevel").c_str(), 0, 0);
191  if(splitLevel() < 0) {
192  throw cms::Exception("IllegalSplitLevel") << "' An illegal ROOT split level of " <<
193  splitLevel() << " is specified for class " << wrappedName() << ".'\n";
194  }
195  ++splitLevel(); //Compensate for wrapper
196  } else {
198  }
199  if(wp.HasProperty("basketSize")) {
200  basketSize() = strtol(wp.PropertyAsString("basketSize").c_str(), 0, 0);
201  if(basketSize() <= 0) {
202  throw cms::Exception("IllegalBasketSize") << "' An illegal ROOT basket size of " <<
203  basketSize() << " is specified for class " << wrappedName() << "'.\n";
204  }
205  } else {
207  }
208  }
static TypeWithDict byName(std::string const &className)
TypeWithDict & wrappedType() const
static int const invalidSplitLevel
TypeWithDict & unwrappedType() const
static int const invalidBasketSize
std::string & wrappedName() const
std::string const & fullClassName() const
std::string wrappedClassName(std::string const &iFullName)
void edm::BranchDescription::initializeTransients ( ) const
inline
bool edm::BranchDescription::isAlias ( ) const
inline
bool edm::BranchDescription::isPsetIDUnique ( ) const
inline

Definition at line 106 of file BranchDescription.h.

References parameterSetIDs().

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

Definition at line 223 of file BranchDescription.cc.

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

223  {
224  parameterSetIDs().insert(other.parameterSetIDs().begin(), other.parameterSetIDs().end());
225  moduleNames().insert(other.moduleNames().begin(), other.moduleNames().end());
226  branchAliases_.insert(other.branchAliases().begin(), other.branchAliases().end());
227  if(splitLevel() == invalidSplitLevel) splitLevel() = other.splitLevel();
228  if(basketSize() == invalidBasketSize) basketSize() = other.basketSize();
229  }
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
std::map<ProcessConfigurationID, std::string>& edm::BranchDescription::moduleNames ( ) const
inline
bool& edm::BranchDescription::onDemand ( ) const
inline
BranchID const& edm::BranchDescription::originalBranchID ( ) const
inline
ParameterSetID const& edm::BranchDescription::parameterSetID ( ) const
inline
std::map<ProcessConfigurationID, ParameterSetID>& edm::BranchDescription::parameterSetIDs ( ) const
inline
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 211 of file BranchDescription.cc.

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

Referenced by EcalTrigPrimProducer::beginJob().

211  {
212  assert(!parameterSetIDs().empty());
213  if(parameterSetIDs().size() != 1) {
214  throw cms::Exception("Ambiguous")
215  << "Your application requires all events on Branch '" << branchName()
216  << "'\n to have the same provenance. This file has events with mixed provenance\n"
217  << "on this branch. Use a different input file.\n";
218  }
219  return parameterSetIDs().begin()->second;
220  }
std::string & branchName() const
std::map< ProcessConfigurationID, ParameterSetID > & parameterSetIDs() const
tuple size
Write out results.
void edm::BranchDescription::setDropped ( ) const
inline

Definition at line 115 of file BranchDescription.h.

References dropped().

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

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

Definition at line 116 of file BranchDescription.h.

References onDemand().

116 {onDemand() = true;}
bool & onDemand() const
int& edm::BranchDescription::splitLevel ( ) const
inline
void edm::BranchDescription::throwIfInvalid_ ( ) const
private

Definition at line 251 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().

251  {
253  throwExceptionWithText("Illegal BranchType detected");
254 
255  if(moduleLabel_.empty())
256  throwExceptionWithText("Module label is not allowed to be empty");
257 
258  if(processName_.empty())
259  throwExceptionWithText("Process name is not allowed to be empty");
260 
261  if(fullClassName_.empty())
262  throwExceptionWithText("Full class name is not allowed to be empty");
263 
264  if(friendlyClassName_.empty())
265  throwExceptionWithText("Friendly class name is not allowed to be empty");
266 
267  if(produced() && !parameterSetID().isValid())
268  throwExceptionWithText("Invalid ParameterSetID detected");
269  }
bool & produced() const
void throwExceptionWithText(char const *txt)
ParameterSetID const & parameterSetID() const
bool isValid() const
Definition: Hash.h:146
bool& edm::BranchDescription::transient ( ) const
inline
TypeWithDict& edm::BranchDescription::unwrappedType ( ) const
inline
TypeID edm::BranchDescription::unwrappedTypeID ( ) const
inline
void edm::BranchDescription::updateFriendlyClassName ( )

Definition at line 272 of file BranchDescription.cc.

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

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

272  {
274  branchName().clear();
275  initBranchName();
276  }
std::string & branchName() const
std::string friendlyName(std::string const &iFullName)
std::string const & fullClassName() const
std::string& edm::BranchDescription::wrappedName ( ) const
inline
TypeWithDict& edm::BranchDescription::wrappedType ( ) const
inline
TypeID edm::BranchDescription::wrappedTypeID ( ) const
inline
WrapperInterfaceBase*& edm::BranchDescription::wrapperInterfaceBase ( ) const
inline
void edm::BranchDescription::write ( std::ostream &  os) const

Definition at line 232 of file BranchDescription.cc.

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

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

232  {
233  os << "Branch Type = " << branchType() << std::endl;
234  os << "Process Name = " << processName() << std::endl;
235  os << "ModuleLabel = " << moduleLabel() << std::endl;
236  os << "Branch ID = " << branchID() << '\n';
237  os << "Class Name = " << fullClassName() << '\n';
238  os << "Friendly Class Name = " << friendlyClassName() << '\n';
239  os << "Product Instance Name = " << productInstanceName() << std::endl;
240  }
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

BranchID edm::BranchDescription::aliasForBranchID_
mutableprivate

Definition at line 216 of file BranchDescription.h.

Referenced by aliasForBranchID(), isAlias(), and originalBranchID().

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

Definition at line 211 of file BranchDescription.h.

Referenced by branchAliases(), and merge().

BranchID edm::BranchDescription::branchID_
mutableprivate

Definition at line 198 of file BranchDescription.h.

Referenced by branchID(), initBranchName(), and originalBranchID().

BranchType edm::BranchDescription::branchType_
private

Definition at line 188 of file BranchDescription.h.

Referenced by branchType(), and throwIfInvalid_().

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

Definition at line 201 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 195 of file BranchDescription.h.

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

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

Definition at line 208 of file BranchDescription.h.

Referenced by initBranchName(), and productInstanceName().

Transients edm::BranchDescription::transient_
mutableprivate