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

int & basketSize () const
std::set< std::string > & branchAliases ()
std::set< std::string > const & branchAliases () const
 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 >())
 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 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.

                   { Strict = 0,
                     Permissive };

Constructor & Destructor Documentation

edm::BranchDescription::BranchDescription ( )

Definition at line 43 of file BranchDescription.cc.

                                       :
    branchType_(InEvent),
    moduleLabel_(),
    processName_(),
    branchID_(),
    fullClassName_(),
    friendlyClassName_(),
    productInstanceName_(),
    branchAliases_(),
    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,
TypeID const &  theTypeID,
bool  produced = true,
std::set< std::string > const &  aliases = std::set<std::string>() 
)
edm::BranchDescription::~BranchDescription ( ) [inline]

Definition at line 56 of file BranchDescription.h.

{}

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

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

References 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.
      Reflex::Type type = Reflex::Type::ByName(wrappedName());
      Reflex::Member getTheInterface = type.FunctionMemberByName(std::string("getInterface"));
      getTheInterface.Invoke(wrapperInterfaceBase());
      assert(wrapperInterfaceBase() != 0);
    }
    return wrapperInterfaceBase();
  }
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, 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 135 of file BranchDescription.cc.

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

Referenced by init().

                                              {
    Reflex::Type null;

    if(type() != null) {
      return;  // already initialized;
    }

    throwIfInvalid_();

    wrappedName() = wrappedClassName(fullClassName());

    Reflex::Type t = Reflex::Type::ByName(fullClassName());
    if(t == null) {
      splitLevel() = invalidSplitLevel;
      basketSize() = invalidBasketSize;
      transient() = false;
      return;
    }
    typeID() = TypeID(t.TypeInfo()); // unwrapped type.
    type() = Reflex::Type::ByName(wrappedName());
    if(type() == null) {
      splitLevel() = invalidSplitLevel;
      basketSize() = invalidBasketSize;
      return;
    }
    Reflex::PropertyList wp = type().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::isPsetIDUnique ( ) const [inline]

Definition at line 98 of file BranchDescription.h.

References parameterSetIDs().

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

                                                         {
    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]
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, 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 107 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 108 of file BranchDescription.h.

References onDemand().

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

                                           {
    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]
Reflex::Type& edm::BranchDescription::type ( ) const [inline]

Definition at line 83 of file BranchDescription.h.

References transient_, and edm::BranchDescription::Transients::type_.

Referenced by initFromDictionary().

{return transient_.type_;}
TypeID& edm::BranchDescription::typeID ( ) const [inline]
void edm::BranchDescription::updateFriendlyClassName ( )
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().

                                               {
    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

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

Definition at line 204 of file BranchDescription.h.

Referenced by branchAliases(), and merge().

Definition at line 191 of file BranchDescription.h.

Referenced by branchID(), and initBranchName().

Definition at line 181 of file BranchDescription.h.

Referenced by branchType(), and throwIfInvalid_().

Definition at line 194 of file BranchDescription.h.

Referenced by fullClassName(), and throwIfInvalid_().

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

Definition at line 185 of file BranchDescription.h.

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

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

Definition at line 188 of file BranchDescription.h.

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

Definition at line 201 of file BranchDescription.h.

Referenced by initBranchName(), and productInstanceName().