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 &moduleLabel, std::string const &processName, std::string const &className, std::string const &friendlyClassName, std::string const &productInstanceName, std::string const &moduleName, ParameterSetID const &parameterSetID, TypeID const &theTypeID, bool produced=true, 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
 
WrapperInterfaceBase const * getInterface () const
 
void init () const
 
void initBranchName () const
 
void initFromDictionary () const
 
void initializeTransients () 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
 
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
 
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

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 35 of file BranchDescription.h.

Member Enumeration Documentation

Enumerator
Strict 
Permissive 

Definition at line 39 of file BranchDescription.h.

Constructor & Destructor Documentation

edm::BranchDescription::BranchDescription ( )

Definition at line 43 of file BranchDescription.cc.

43  :
45  moduleLabel_(),
46  processName_(),
47  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,
TypeID const &  theTypeID,
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 typeID().

67  :
71  branchID_(),
75  branchAliases_(aliases),
76  transient_() {
77  dropped() = false;
79  onDemand() = false;
82  typeID() = theTypeID;
83  init();
84  }
BranchType const & branchType() const
TypeID & typeID() 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 ( )
inline

Definition at line 56 of file BranchDescription.h.

56 {}

Member Function Documentation

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 100 of file BranchDescription.h.

References branchAliases_.

100 {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 346 of file BranchDescription.cc.

References wrappedName(), and wrapperInterfaceBase().

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

346  {
347  if(wrapperInterfaceBase() == 0) {
348  // This could be done in init(), but we only want to do it on demand, for performance reasons.
349  Reflex::Type type = Reflex::Type::ByName(wrappedName());
350  Reflex::Member getTheInterface = type.FunctionMemberByName(std::string("getInterface"));
351  getTheInterface.Invoke(wrapperInterfaceBase());
352  assert(wrapperInterfaceBase() != 0);
353  }
354  return wrapperInterfaceBase();
355  }
type
Definition: HCALResponse.h:22
WrapperInterfaceBase *& wrapperInterfaceBase() const
std::string & wrappedName() const
void edm::BranchDescription::init ( void  ) const
inline
void edm::BranchDescription::initBranchName ( ) const

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

87  {
88  if(!branchName().empty()) {
89  return; // already called
90  }
92 
93  char const underscore('_');
94  char const period('.');
95 
96  if(friendlyClassName_.find(underscore) != std::string::npos) {
97  throw cms::Exception("IllegalCharacter") << "Class name '" << friendlyClassName()
98  << "' contains an underscore ('_'), which is illegal in the name of a product.\n";
99  }
100 
101  if(moduleLabel_.find(underscore) != std::string::npos) {
102  throw cms::Exception("IllegalCharacter") << "Module label '" << moduleLabel()
103  << "' contains an underscore ('_'), which is illegal in a module label.\n";
104  }
105 
106  if(productInstanceName_.find(underscore) != std::string::npos) {
107  throw cms::Exception("IllegalCharacter") << "Product instance name '" << productInstanceName()
108  << "' contains an underscore ('_'), which is illegal in a product instance name.\n";
109  }
110 
111  if(processName_.find(underscore) != std::string::npos) {
112  throw cms::Exception("IllegalCharacter") << "Process name '" << processName()
113  << "' contains an underscore ('_'), which is illegal in a process name.\n";
114  }
115 
116  branchName().reserve(friendlyClassName().size() +
117  moduleLabel().size() +
119  processName().size() + 4);
121  branchName() += underscore;
122  branchName() += moduleLabel();
123  branchName() += underscore;
125  branchName() += underscore;
126  branchName() += processName();
127  branchName() += period;
128 
129  if(!branchID_.isValid()) {
131  }
132  }
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 135 of file BranchDescription.cc.

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

Referenced by init().

135  {
136  Reflex::Type null;
137 
138  if(type() != null) {
139  return; // already initialized;
140  }
141 
142  throwIfInvalid_();
143 
145 
146  Reflex::Type t = Reflex::Type::ByName(fullClassName());
147  if(t == null) {
150  transient() = false;
151  return;
152  }
153  typeID() = TypeID(t.TypeInfo()); // unwrapped type.
154  type() = Reflex::Type::ByName(wrappedName());
155  if(type() == null) {
158  return;
159  }
160  Reflex::PropertyList wp = type().Properties();
161  transient() = (wp.HasProperty("persistent") ? wp.PropertyAsString("persistent") == std::string("false") : false);
162  if(transient()) {
165  return;
166  }
167  if(wp.HasProperty("splitLevel")) {
168  splitLevel() = strtol(wp.PropertyAsString("splitLevel").c_str(), 0, 0);
169  if(splitLevel() < 0) {
170  throw cms::Exception("IllegalSplitLevel") << "' An illegal ROOT split level of " <<
171  splitLevel() << " is specified for class " << wrappedName() << ".'\n";
172  }
173  ++splitLevel(); //Compensate for wrapper
174  } else {
176  }
177  if(wp.HasProperty("basketSize")) {
178  basketSize() = strtol(wp.PropertyAsString("basketSize").c_str(), 0, 0);
179  if(basketSize() <= 0) {
180  throw cms::Exception("IllegalBasketSize") << "' An illegal ROOT basket size of " <<
181  basketSize() << " is specified for class " << wrappedName() << "'.\n";
182  }
183  } else {
185  }
186  }
TypeID & typeID() const
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)
void edm::BranchDescription::initializeTransients ( ) const
inline
bool edm::BranchDescription::isPsetIDUnique ( ) const
inline

Definition at line 98 of file BranchDescription.h.

References parameterSetIDs().

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

Definition at line 201 of file BranchDescription.cc.

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

201  {
202  parameterSetIDs().insert(other.parameterSetIDs().begin(), other.parameterSetIDs().end());
203  moduleNames().insert(other.moduleNames().begin(), other.moduleNames().end());
204  branchAliases_.insert(other.branchAliases().begin(), other.branchAliases().end());
205  if(splitLevel() == invalidSplitLevel) splitLevel() = other.splitLevel();
206  if(basketSize() == invalidBasketSize) basketSize() = other.basketSize();
207  }
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
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 189 of file BranchDescription.cc.

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

Referenced by EcalTrigPrimProducer::beginJob().

189  {
190  assert(!parameterSetIDs().empty());
191  if(parameterSetIDs().size() != 1) {
192  throw cms::Exception("Ambiguous")
193  << "Your application requires all events on Branch '" << branchName()
194  << "'\n to have the same provenance. This file has events with mixed provenance\n"
195  << "on this branch. Use a different input file.\n";
196  }
197  return parameterSetIDs().begin()->second;
198  }
std::string & branchName() const
std::map< ProcessConfigurationID, ParameterSetID > & parameterSetIDs() const
tuple size
Write out results.
void edm::BranchDescription::setDropped ( ) const
inline

Definition at line 107 of file BranchDescription.h.

References dropped().

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

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

Definition at line 108 of file BranchDescription.h.

References onDemand().

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

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

229  {
231  throwExceptionWithText("Illegal BranchType detected");
232 
233  if(moduleLabel_.empty())
234  throwExceptionWithText("Module label is not allowed to be empty");
235 
236  if(processName_.empty())
237  throwExceptionWithText("Process name is not allowed to be empty");
238 
239  if(fullClassName_.empty())
240  throwExceptionWithText("Full class name is not allowed to be empty");
241 
242  if(friendlyClassName_.empty())
243  throwExceptionWithText("Friendly class name is not allowed to be empty");
244 
245  if(produced() && !parameterSetID().isValid())
246  throwExceptionWithText("Invalid ParameterSetID detected");
247  }
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
Reflex::Type& edm::BranchDescription::type ( ) const
inline
TypeID& edm::BranchDescription::typeID ( ) const
inline
void edm::BranchDescription::updateFriendlyClassName ( )

Definition at line 250 of file BranchDescription.cc.

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

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

250  {
252  branchName().clear();
253  initBranchName();
254  }
std::string & branchName() const
std::string friendlyName(std::string const &iFullName)
std::string const & fullClassName() const
std::string& edm::BranchDescription::wrappedName ( ) const
inline
WrapperInterfaceBase*& edm::BranchDescription::wrapperInterfaceBase ( ) const
inline
void edm::BranchDescription::write ( std::ostream &  os) const

Definition at line 210 of file BranchDescription.cc.

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

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

210  {
211  os << "Branch Type = " << branchType() << std::endl;
212  os << "Process Name = " << processName() << std::endl;
213  os << "ModuleLabel = " << moduleLabel() << std::endl;
214  os << "Branch ID = " << branchID() << '\n';
215  os << "Class Name = " << fullClassName() << '\n';
216  os << "Friendly Class Name = " << friendlyClassName() << '\n';
217  os << "Product Instance Name = " << productInstanceName() << std::endl;
218  }
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 204 of file BranchDescription.h.

Referenced by branchAliases(), and merge().

BranchID edm::BranchDescription::branchID_
mutableprivate

Definition at line 191 of file BranchDescription.h.

Referenced by branchID(), and initBranchName().

BranchType edm::BranchDescription::branchType_
private

Definition at line 181 of file BranchDescription.h.

Referenced by branchType(), and throwIfInvalid_().

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

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

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

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

Definition at line 201 of file BranchDescription.h.

Referenced by initBranchName(), and productInstanceName().

Transients edm::BranchDescription::transient_
mutableprivate