test
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
 
 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 const & branchName () const
 
BranchType const & branchType () const
 
std::string const & className () const
 
void clearBranchName ()
 
bool dropped () const
 
std::string const & friendlyClassName () const
 
std::string const & fullClassName () const
 
void init ()
 
void initBranchName ()
 
void initFromDictionary ()
 
void initializeTransients ()
 
void insertBranchAlias (std::string const &alias)
 
bool isAlias () const
 
void merge (BranchDescription const &other)
 
std::string const & moduleLabel () const
 
std::string const & moduleName () const
 
bool onDemand () const
 
BranchID const & originalBranchID () const
 
ParameterSetID const & parameterSetID () const
 
bool present () const
 
std::string const & processName () const
 
bool produced () const
 
std::string const & productInstanceName () const
 
void setBasketSize (int size)
 
void setDropped (bool isDropped)
 
void setOnDemand (bool isOnDemand)
 
void setProduced (bool isProduced)
 
void setSplitLevel (int level)
 
void setTransient (bool isTransient)
 
void setUnwrappedType (TypeWithDict const &type)
 
void setWrappedName (std::string const &name)
 
void setWrappedType (TypeWithDict const &type)
 
int splitLevel () const
 
bool transient () const
 
TypeWithDict const & unwrappedType () const
 
TypeID unwrappedTypeID () const
 
void updateFriendlyClassName ()
 
std::string const & wrappedName () const
 
TypeWithDict const & wrappedType () const
 
TypeID wrappedTypeID () 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 32 of file BranchDescription.h.

Member Enumeration Documentation

Enumerator
Strict 
Permissive 

Definition at line 36 of file BranchDescription.h.

Constructor & Destructor Documentation

edm::BranchDescription::BranchDescription ( )

Definition at line 39 of file BranchDescription.cc.

39  :
41  moduleLabel_(),
42  processName_(),
43  branchID_(),
49  transient_() {
50  // do not call init here! It will result in an exception throw.
51  }
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 53 of file BranchDescription.cc.

References init(), moduleName(), edm::BranchDescription::Transients::moduleName_, parameterSetID(), edm::BranchDescription::Transients::parameterSetID_, setDropped(), setOnDemand(), setProduced(), setUnwrappedType(), and transient_.

64  :
68  branchID_(),
73  transient_() {
74  setDropped(false);
76  setOnDemand(false);
79  setUnwrappedType(theTypeWithDict);
80  init();
81  }
dictionary aliases
Definition: autoCond.py:48
BranchType const & branchType() const
void setOnDemand(bool isOnDemand)
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
void setDropped(bool isDropped)
std::string const & moduleName() const
ParameterSetID const & parameterSetID() const
std::set< std::string > branchAliases_
void setUnwrappedType(TypeWithDict const &type)
void setProduced(bool isProduced)
edm::BranchDescription::BranchDescription ( BranchDescription const &  aliasForBranch,
std::string const &  moduleLabelAlias,
std::string const &  poruductInstanceAlias 
)

Definition at line 83 of file BranchDescription.cc.

References init(), moduleName(), edm::BranchDescription::Transients::moduleName_, onDemand(), parameterSetID(), edm::BranchDescription::Transients::parameterSetID_, produced(), setDropped(), setOnDemand(), setProduced(), setUnwrappedType(), transient_, and unwrappedType().

86  :
87  branchType_(aliasForBranch.branchType()),
88  moduleLabel_(moduleLabelAlias),
89  processName_(aliasForBranch.processName()),
90  branchID_(),
91  fullClassName_(aliasForBranch.className()),
92  friendlyClassName_(aliasForBranch.friendlyClassName()),
93  productInstanceName_(productInstanceAlias),
94  branchAliases_(aliasForBranch.branchAliases()),
95  aliasForBranchID_(aliasForBranch.branchID()),
96  transient_() {
97  setDropped(false);
98  setProduced(aliasForBranch.produced());
99  setOnDemand(aliasForBranch.onDemand());
100  transient_.moduleName_ = aliasForBranch.moduleName();
101  transient_.parameterSetID_ = aliasForBranch.parameterSetID();
102  setUnwrappedType(aliasForBranch.unwrappedType());
103  init();
104  }
void setOnDemand(bool isOnDemand)
void setDropped(bool isDropped)
std::set< std::string > branchAliases_
void setUnwrappedType(TypeWithDict const &type)
void setProduced(bool isProduced)
edm::BranchDescription::~BranchDescription ( )
inline

Definition at line 57 of file BranchDescription.h.

57 {}

Member Function Documentation

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

Definition at line 75 of file BranchDescription.h.

References aliasForBranchID_.

75 {return aliasForBranchID_;}
int edm::BranchDescription::basketSize ( ) const
inline
std::set<std::string> const& edm::BranchDescription::branchAliases ( ) const
inline
BranchID const& edm::BranchDescription::branchID ( ) const
inline
std::string const& edm::BranchDescription::branchName ( ) const
inline
BranchType const& edm::BranchDescription::branchType ( ) const
inline
std::string const& edm::BranchDescription::className ( ) const
inline
void edm::BranchDescription::clearBranchName ( )
inline
bool edm::BranchDescription::dropped ( ) const
inline
std::string const& edm::BranchDescription::friendlyClassName ( ) const
inline
std::string const& edm::BranchDescription::fullClassName ( ) const
inline
void edm::BranchDescription::init ( void  )
inline
void edm::BranchDescription::initBranchName ( )

Definition at line 107 of file BranchDescription.cc.

References branchID_, branchName(), edm::BranchDescription::Transients::branchName_, relativeConstraints::empty, Exception, friendlyClassName(), friendlyClassName_, edm::BranchID::isValid(), moduleLabel(), moduleLabel_, l1tstage2_dqm_sourceclient-live_cfg::period, processName(), processName_, productInstanceName(), productInstanceName_, edm::BranchID::setID(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, throwIfInvalid_(), and transient_.

Referenced by init(), edm::StreamedProduct::StreamedProduct(), and updateFriendlyClassName().

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

Definition at line 156 of file BranchDescription.cc.

References cms::Exception::addContext(), basketSize(), branchName(), edm::TypeWithDict::byName(), Exception, fullClassName(), edm::TypeWithDict::getClass(), invalidBasketSize, invalidSplitLevel, setBasketSize(), setSplitLevel(), setTransient(), setUnwrappedType(), setWrappedName(), setWrappedType(), splitLevel(), AlCaHLTBitMon_QueryRunRegistry::string, throwIfInvalid_(), unwrappedType(), edm::wrappedClassName(), wrappedName(), and wrappedType().

Referenced by init().

156  {
157  if(bool(wrappedType())) {
158  return; // already initialized;
159  }
160 
161  throwIfInvalid_();
162 
163  try {
165  // unwrapped type.
167  if(!bool(unwrappedType())) {
170  setTransient(false);
171  return;
172  }
173  } catch( edm::Exception& caughtException) {
174  caughtException.addContext(std::string{"While initializing meta data for branch: "}+branchName());
175  throw;
176  }
177 
179  try {
180  setWrappedType(wrType);
181  if(!bool(wrappedType())) {
184  return;
185  }
186  } catch( edm::Exception& caughtException) {
187  caughtException.addContext(std::string{"While initializing meta data for branch: "}+branchName());
188  throw;
189  }
190 
191  setTransient(false);
194  TDictAttributeMap* wp = wrappedType().getClass()->GetAttributeMap();
195  if (wp && wp->HasKey("persistent") && !strcmp(wp->GetPropertyAsString("persistent"), "false")) {
196  // Set transient if persistent == "false".
197  setTransient(true);
198  return;
199  }
200  if (wp && wp->HasKey("splitLevel")) {
201  setSplitLevel(strtol(wp->GetPropertyAsString("splitLevel"), 0, 0));
202  if (splitLevel() < 0) {
203  throw cms::Exception("IllegalSplitLevel") << "' An illegal ROOT split level of " <<
204  splitLevel() << " is specified for class " << wrappedName() << ".'\n";
205  }
206  setSplitLevel(splitLevel() + 1); //Compensate for wrapper
207  }
208  if (wp && wp->HasKey("basketSize")) {
209  setBasketSize(strtol(wp->GetPropertyAsString("basketSize"), 0, 0));
210  if (basketSize() <= 0) {
211  throw cms::Exception("IllegalBasketSize") << "' An illegal ROOT basket size of " <<
212  basketSize() << " is specified for class " << wrappedName() << "'.\n";
213  }
214  }
215  }
std::string const & branchName() const
static int const invalidSplitLevel
static int const invalidBasketSize
void setWrappedType(TypeWithDict const &type)
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:60
void setTransient(bool isTransient)
TClass * getClass() const
void setWrappedName(std::string const &name)
void setSplitLevel(int level)
TypeWithDict const & unwrappedType() const
std::string const & fullClassName() const
std::string wrappedClassName(std::string const &iFullName)
void addContext(std::string const &context)
Definition: Exception.cc:227
void setUnwrappedType(TypeWithDict const &type)
void setBasketSize(int size)
std::string const & wrappedName() const
TypeWithDict const & wrappedType() const
void edm::BranchDescription::initializeTransients ( )
inline
void edm::BranchDescription::insertBranchAlias ( std::string const &  alias)
inline

Definition at line 106 of file BranchDescription.h.

References branchAliases_.

106  {
107  branchAliases_.insert(alias);
108  }
std::set< std::string > branchAliases_
bool edm::BranchDescription::isAlias ( ) const
inline
void edm::BranchDescription::merge ( BranchDescription const &  other)

Definition at line 218 of file BranchDescription.cc.

References basketSize(), branchAliases(), branchAliases_, invalidBasketSize, invalidSplitLevel, setBasketSize(), setSplitLevel(), and splitLevel().

218  {
219  branchAliases_.insert(other.branchAliases().begin(), other.branchAliases().end());
220  if(splitLevel() == invalidSplitLevel) setSplitLevel(other.splitLevel());
221  if(basketSize() == invalidBasketSize) setBasketSize(other.basketSize());
222  }
static int const invalidSplitLevel
static int const invalidBasketSize
void setSplitLevel(int level)
std::set< std::string > branchAliases_
void setBasketSize(int size)
std::string const& edm::BranchDescription::moduleLabel ( ) const
inline

Definition at line 72 of file BranchDescription.h.

References moduleLabel_.

Referenced by edm::SignallingProductRegistry::addCalled(), edm::ProductRegistry::addLabelAlias(), edm::Principal::addProduct_(), edm::Principal::addProductOrThrow(), edm::ProductSelectorRules::Rule::appliesTo(), edm::combinable(), edm::DaqProvenanceHelper::DaqProvenanceHelper(), FWLiteJobMetadataManager::doUpdate(), FWFFMetadataManager::doUpdate(), ShallowTree::eat(), edm::EventContentAnalyzer::EventContentAnalyzer(), edm::LHEProvenanceHelper::fillCommonProcessParameterSet(), fwlite::DataGetterHelper::getByBranchDescription(), edm::HadronizerFilter< HAD, DEC >::HadronizerFilter(), FWFFMetadataManager::hasModuleLabel(), initBranchName(), edm::OutputModule::keepThisBranch(), edm::one::OutputModuleBase::keepThisBranch(), edm::global::OutputModuleBase::keepThisBranch(), L3TkMuonProducer::L3TkMuonProducer(), edm::Provenance::moduleLabel(), edm::ProductHolderBase::moduleLabel(), edm::ModuleLabelMatch::operator()(), edm::InputTagMatch::operator()(), edm::WillGetIfMatch< T >::operator()(), l1t::L1TGlobalUtilHelper::operator()(), L1GtUtilsHelper::operator()(), edm::operator<(), edm::Principal::Principal(), edm::ThinningProducer< Collection, Selector >::registerThinnedAssociations(), edm::RootOutputFile::RootOutputFile(), edm::RootOutputFile::setBranchAliases(), edm::HiMixingModule::verifyRegistry(), and write().

72 {return moduleLabel_;}
std::string const& edm::BranchDescription::moduleName ( ) const
inline
bool edm::BranchDescription::onDemand ( ) const
inline
BranchID const& edm::BranchDescription::originalBranchID ( ) const
inline
ParameterSetID const& edm::BranchDescription::parameterSetID ( ) 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
void edm::BranchDescription::setBasketSize ( int  size)
inline
void edm::BranchDescription::setDropped ( bool  isDropped)
inline
void edm::BranchDescription::setOnDemand ( bool  isOnDemand)
inline
void edm::BranchDescription::setProduced ( bool  isProduced)
inline
void edm::BranchDescription::setSplitLevel ( int  level)
inline
void edm::BranchDescription::setTransient ( bool  isTransient)
inline
void edm::BranchDescription::setUnwrappedType ( TypeWithDict const &  type)
inline
void edm::BranchDescription::setWrappedName ( std::string const &  name)
inline
void edm::BranchDescription::setWrappedType ( TypeWithDict const &  type)
inline
int edm::BranchDescription::splitLevel ( ) const
inline
void edm::BranchDescription::throwIfInvalid_ ( ) const
private

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

244  {
246  throwExceptionWithText("Illegal BranchType detected");
247 
248  if(moduleLabel_.empty())
249  throwExceptionWithText("Module label is not allowed to be empty");
250 
251  if(processName_.empty())
252  throwExceptionWithText("Process name is not allowed to be empty");
253 
254  if(fullClassName_.empty())
255  throwExceptionWithText("Full class name is not allowed to be empty");
256 
257  if(friendlyClassName_.empty())
258  throwExceptionWithText("Friendly class name is not allowed to be empty");
259 
260  if(produced() && !parameterSetID().isValid())
261  throwExceptionWithText("Invalid ParameterSetID detected");
262  }
void throwExceptionWithText(char const *txt)
ParameterSetID const & parameterSetID() const
bool isValid() const
Definition: Hash.h:150
bool edm::BranchDescription::transient ( ) const
inline
TypeWithDict const& edm::BranchDescription::unwrappedType ( ) const
inline
TypeID edm::BranchDescription::unwrappedTypeID ( ) const
inline
void edm::BranchDescription::updateFriendlyClassName ( )
std::string const& edm::BranchDescription::wrappedName ( ) const
inline
TypeWithDict const& edm::BranchDescription::wrappedType ( ) const
inline
TypeID edm::BranchDescription::wrappedTypeID ( ) const
inline
void edm::BranchDescription::write ( std::ostream &  os) const

Definition at line 225 of file BranchDescription.cc.

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

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

225  {
226  os << "Branch Type = " << branchType() << std::endl;
227  os << "Process Name = " << processName() << std::endl;
228  os << "ModuleLabel = " << moduleLabel() << std::endl;
229  os << "Branch ID = " << branchID() << '\n';
230  os << "Class Name = " << fullClassName() << '\n';
231  os << "Friendly Class Name = " << friendlyClassName() << '\n';
232  os << "Product Instance Name = " << productInstanceName() << std::endl;
233  }
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_
private

Definition at line 201 of file BranchDescription.h.

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

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

Definition at line 196 of file BranchDescription.h.

Referenced by branchAliases(), insertBranchAlias(), and merge().

BranchID edm::BranchDescription::branchID_
private

Definition at line 183 of file BranchDescription.h.

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

BranchType edm::BranchDescription::branchType_
private

Definition at line 173 of file BranchDescription.h.

Referenced by branchType(), and throwIfInvalid_().

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

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

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

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

Definition at line 193 of file BranchDescription.h.

Referenced by initBranchName(), and productInstanceName().

Transients edm::BranchDescription::transient_
private