CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes

edm::BranchDescription Class Reference

#include <BranchDescription.h>

List of all members.

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 (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)
 BranchDescription ()
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.

                   { Strict = 0,
                     Permissive };

Constructor & Destructor Documentation

edm::BranchDescription::BranchDescription ( )

Definition at line 42 of file BranchDescription.cc.

                                       :
    branchType_(InEvent),
    moduleLabel_(),
    processName_(),
    branchID_(),
    fullClassName_(),
    friendlyClassName_(),
    productInstanceName_(),
    branchAliases_(),
    aliasForBranchID_(),
    transient_() {
    // do not call init here! It will result in an exception throw.
  }
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>() 
)
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().

                                                               :
      branchType_(aliasForBranch.branchType()),
      moduleLabel_(moduleLabelAlias),
      processName_(aliasForBranch.processName()),
      branchID_(),
      fullClassName_(aliasForBranch.className()),
      friendlyClassName_(aliasForBranch.friendlyClassName()),
      productInstanceName_(productInstanceAlias),
      branchAliases_(aliasForBranch.branchAliases()),
      aliasForBranchID_(aliasForBranch.branchID()),
      transient_() {
    dropped() = false;
    transient_.produced_ = aliasForBranch.produced(),
    onDemand() = aliasForBranch.onDemand();
    transient_.moduleName_ = aliasForBranch.moduleName();
    transient_.parameterSetID_ = aliasForBranch.parameterSetID();
    unwrappedType() = aliasForBranch.unwrappedType();
    init();
  }
edm::BranchDescription::~BranchDescription ( ) [inline]

Definition at line 59 of file BranchDescription.h.

{}

Member Function Documentation

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

Definition at line 77 of file BranchDescription.h.

References 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_.

{return 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::ProductData::getInterface(), BareRootProductGetter::getIt(), edm::root::FWLiteDelayedReader::getProduct_(), and edm::RootOutputFile::RootOutputFile().

                                        {
    if(wrapperInterfaceBase() == 0) {
      // This could be done in init(), but we only want to do it on demand, for performance reasons.
      TypeWithDict type = TypeWithDict::byName(wrappedName());
      type.invokeByName(wrapperInterfaceBase(), "getInterface");
      assert(wrapperInterfaceBase() != 0);
    }
    return wrapperInterfaceBase();
  }
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, Exception, friendlyClassName(), friendlyClassName_, edm::BranchID::isValid(), moduleLabel(), moduleLabel_, processName(), processName_, productInstanceName(), productInstanceName_, edm::BranchID::setID(), findQualityFiles::size, and throwIfInvalid_().

Referenced by init(), and updateFriendlyClassName().

                                          {
    if(!branchName().empty()) {
      return;  // already called
    }
    throwIfInvalid_();

    char const underscore('_');
    char const period('.');

    if(friendlyClassName_.find(underscore) != std::string::npos) {
      throw cms::Exception("IllegalCharacter") << "Class name '" << friendlyClassName()
      << "' contains an underscore ('_'), which is illegal in the name of a product.\n";
    }

    if(moduleLabel_.find(underscore) != std::string::npos) {
      throw cms::Exception("IllegalCharacter") << "Module label '" << moduleLabel()
      << "' contains an underscore ('_'), which is illegal in a module label.\n";
    }

    if(productInstanceName_.find(underscore) != std::string::npos) {
      throw cms::Exception("IllegalCharacter") << "Product instance name '" << productInstanceName()
      << "' contains an underscore ('_'), which is illegal in a product instance name.\n";
    }

    if(processName_.find(underscore) != std::string::npos) {
      throw cms::Exception("IllegalCharacter") << "Process name '" << processName()
      << "' contains an underscore ('_'), which is illegal in a process name.\n";
    }

    branchName().reserve(friendlyClassName().size() +
                         moduleLabel().size() +
                         productInstanceName().size() +
                         processName().size() + 4);
    branchName() += friendlyClassName();
    branchName() += underscore;
    branchName() += moduleLabel();
    branchName() += underscore;
    branchName() += productInstanceName();
    branchName() += underscore;
    branchName() += processName();
    branchName() += period;

    if(!branchID_.isValid()) {
      branchID_.setID(branchName());
    }
  }
void edm::BranchDescription::initFromDictionary ( ) const

Definition at line 158 of file BranchDescription.cc.

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

Referenced by init().

                                              {
    if(bool(wrappedType())) {
      return;  // already initialized;
    }

    throwIfInvalid_();

    wrappedName() = wrappedClassName(fullClassName());

    // unwrapped type.
    unwrappedType() = TypeWithDict::byName(fullClassName());
    if(!bool(unwrappedType())) {
      splitLevel() = invalidSplitLevel;
      basketSize() = invalidBasketSize;
      transient() = false;
      return;
    }

    wrappedType() = TypeWithDict::byName(wrappedName());
    if(!bool(wrappedType())) {
      splitLevel() = invalidSplitLevel;
      basketSize() = invalidBasketSize;
      return;
    }
    Reflex::PropertyList wp = Reflex::Type::ByTypeInfo(wrappedType().typeInfo()).Properties();
    transient() = (wp.HasProperty("persistent") ? wp.PropertyAsString("persistent") == std::string("false") : false);
    if(transient()) {
      splitLevel() = invalidSplitLevel;
      basketSize() = invalidBasketSize;
      return;
    }
    if(wp.HasProperty("splitLevel")) {
      splitLevel() = strtol(wp.PropertyAsString("splitLevel").c_str(), 0, 0);
      if(splitLevel() < 0) {
        throw cms::Exception("IllegalSplitLevel") << "' An illegal ROOT split level of " <<
        splitLevel() << " is specified for class " << wrappedName() << ".'\n";
      }
      ++splitLevel(); //Compensate for wrapper
    } else {
      splitLevel() = invalidSplitLevel;
    }
    if(wp.HasProperty("basketSize")) {
      basketSize() = strtol(wp.PropertyAsString("basketSize").c_str(), 0, 0);
      if(basketSize() <= 0) {
        throw cms::Exception("IllegalBasketSize") << "' An illegal ROOT basket size of " <<
        basketSize() << " is specified for class " << wrappedName() << "'.\n";
      }
    } else {
      basketSize() = invalidBasketSize;
    }
  }
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().

{return parameterSetIDs().size() == 1;}
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().

                                                         {
    parameterSetIDs().insert(other.parameterSetIDs().begin(), other.parameterSetIDs().end());
    moduleNames().insert(other.moduleNames().begin(), other.moduleNames().end());
    branchAliases_.insert(other.branchAliases().begin(), other.branchAliases().end());
    if(splitLevel() == invalidSplitLevel) splitLevel() = other.splitLevel();
    if(basketSize() == invalidBasketSize) basketSize() = other.basketSize();
  }
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, Exception, parameterSetIDs(), and findQualityFiles::size.

Referenced by EcalTrigPrimProducer::beginJob().

                                    {
    assert(!parameterSetIDs().empty());
    if(parameterSetIDs().size() != 1) {
      throw cms::Exception("Ambiguous")
        << "Your application requires all events on Branch '" << branchName()
        << "'\n to have the same provenance. This file has events with mixed provenance\n"
        << "on this branch.  Use a different input file.\n";
    }
    return parameterSetIDs().begin()->second;
  }
void edm::BranchDescription::setDropped ( ) const [inline]

Definition at line 115 of file BranchDescription.h.

References dropped().

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

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

Definition at line 116 of file BranchDescription.h.

References onDemand().

{onDemand() = true;}
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().

                                           {
    if(branchType_ >= NumBranchTypes)
      throwExceptionWithText("Illegal BranchType detected");

    if(moduleLabel_.empty())
      throwExceptionWithText("Module label is not allowed to be empty");

    if(processName_.empty())
      throwExceptionWithText("Process name is not allowed to be empty");

    if(fullClassName_.empty())
      throwExceptionWithText("Full class name is not allowed to be empty");

    if(friendlyClassName_.empty())
      throwExceptionWithText("Friendly class name is not allowed to be empty");

    if(produced() && !parameterSetID().isValid())
      throwExceptionWithText("Invalid ParameterSetID detected");
  }
bool& edm::BranchDescription::transient ( ) const [inline]
TypeWithDict& edm::BranchDescription::unwrappedType ( ) const [inline]
TypeID edm::BranchDescription::unwrappedTypeID ( ) const [inline]
void edm::BranchDescription::updateFriendlyClassName ( )
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 edm::operator<<(), and edm::Provenance::write().

                                               {
    os << "Branch Type = " << branchType() << std::endl;
    os << "Process Name = " << processName() << std::endl;
    os << "ModuleLabel = " << moduleLabel() << std::endl;
    os << "Branch ID = " << branchID() << '\n';
    os << "Class Name = " << fullClassName() << '\n';
    os << "Friendly Class Name = " << friendlyClassName() << '\n';
    os << "Product Instance Name = " << productInstanceName() << std::endl;
  }

Member Data Documentation

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().

Definition at line 198 of file BranchDescription.h.

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

Definition at line 188 of file BranchDescription.h.

Referenced by branchType(), and throwIfInvalid_().

Definition at line 201 of file BranchDescription.h.

Referenced by fullClassName(), and throwIfInvalid_().

std::string edm::BranchDescription::moduleLabel_ [private]

Definition at line 192 of file BranchDescription.h.

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

std::string edm::BranchDescription::processName_ [private]

Definition at line 195 of file BranchDescription.h.

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

Definition at line 208 of file BranchDescription.h.

Referenced by initBranchName(), and productInstanceName().