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 > const & branchAliases () const
std::set< std::string > & branchAliases ()
 BranchDescription (BranchType const &branchType, std::string const &mdLabel, std::string const &procName, std::string const &name, std::string const &fName, std::string const &pin, ModuleDescription const &modDesc, TypeID const &theTypeID, 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
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
ProductID const & oldProductID () 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_
ProductID productID_
std::string productInstanceName_
Transient< Transientstransients_

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

                                       :
    branchType_(InEvent),
    moduleLabel_(),
    processName_(),
    branchID_(),
    productID_(),
    fullClassName_(),
    friendlyClassName_(),
    productInstanceName_(),
    branchAliases_(),
    transients_() {
    // do not call init here! It will result in an exception throw.
  }
edm::BranchDescription::BranchDescription ( BranchType const &  branchType,
std::string const &  mdLabel,
std::string const &  procName,
std::string const &  name,
std::string const &  fName,
std::string const &  pin,
ModuleDescription const &  modDesc,
TypeID const &  theTypeID,
std::set< std::string > const &  aliases = std::set<std::string>() 
)

Definition at line 52 of file BranchDescription.cc.

References dropped(), edm::Transient< T >::get(), init(), edm::ModuleDescription::moduleName(), onDemand(), edm::ModuleDescription::parameterSetID(), produced(), transients_, and typeID().

                                                          :
      branchType_(branchType),
      moduleLabel_(mdLabel),
      processName_(procName),
      branchID_(),
      productID_(),
      fullClassName_(name),
      friendlyClassName_(fName),
      productInstanceName_(pin),
      branchAliases_(aliases),
      transients_() {
    dropped() = false;
    produced() = true;
    onDemand() = false;
    typeID() = theTypeID;
    transients_.get().parameterSetID_ = modDesc.parameterSetID();
    transients_.get().moduleName_ = modDesc.moduleName();
    init();
  }
edm::BranchDescription::~BranchDescription ( ) [inline]

Definition at line 54 of file BranchDescription.h.

{}

Member Function Documentation

int& edm::BranchDescription::basketSize ( ) const [inline]

Definition at line 85 of file BranchDescription.h.

References edm::Transient< T >::get(), and transients_.

Referenced by edm::PoolOutputModule::fillSelectedItemList(), initFromDictionary(), and merge().

{return transients_.get().basketSize_;}
std::set<std::string> const& edm::BranchDescription::branchAliases ( ) const [inline]
std::set<std::string>& edm::BranchDescription::branchAliases ( ) [inline]

Definition at line 99 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]

Definition at line 79 of file BranchDescription.h.

References edm::Transient< T >::get(), and transients_.

Referenced by BranchDescription(), edm::match(), edm::operator==(), and setDropped().

{return transients_.get().dropped_;}
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 341 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 82 of file BranchDescription.cc.

References branchID_, branchName(), relativeConstraints::empty, Exception, friendlyClassName(), friendlyClassName_, edm::BranchID::isValid(), moduleLabel(), moduleLabel_, L1TDQM_cfg::period, 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 130 of file BranchDescription.cc.

References basketSize(), Exception, fullClassName(), invalidBasketSize, invalidSplitLevel, splitLevel(), matplotRender::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;
    }
  }
bool edm::BranchDescription::isPsetIDUnique ( ) const [inline]

Definition at line 97 of file BranchDescription.h.

References parameterSetIDs().

{return parameterSetIDs().size() == 1;}
void edm::BranchDescription::merge ( BranchDescription const &  other)

Definition at line 196 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]

Definition at line 88 of file BranchDescription.h.

References edm::Transient< T >::get(), and transients_.

Referenced by edm::Provenance::moduleName().

{return transients_.get().moduleName_;}
std::map<ProcessConfigurationID, std::string>& edm::BranchDescription::moduleNames ( ) const [inline]
ProductID const& edm::BranchDescription::oldProductID ( ) const [inline]

Definition at line 72 of file BranchDescription.h.

References productID_.

{return productID_;}
bool& edm::BranchDescription::onDemand ( ) const [inline]

Definition at line 80 of file BranchDescription.h.

References edm::Transient< T >::get(), and transients_.

Referenced by BranchDescription(), and setOnDemand().

{return transients_.get().onDemand_;}
ParameterSetID const& edm::BranchDescription::parameterSetID ( ) const [inline]

Definition at line 87 of file BranchDescription.h.

References edm::Transient< T >::get(), and transients_.

Referenced by edm::Provenance::psetID(), and throwIfInvalid_().

{return transients_.get().parameterSetID_;}
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 184 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 106 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 107 of file BranchDescription.h.

References onDemand().

{onDemand() = true;}
int& edm::BranchDescription::splitLevel ( ) const [inline]

Definition at line 84 of file BranchDescription.h.

References edm::Transient< T >::get(), and transients_.

Referenced by edm::PoolOutputModule::fillSelectedItemList(), initFromDictionary(), and merge().

{return transients_.get().splitLevel_;}
void edm::BranchDescription::throwIfInvalid_ ( ) const [private]

Definition at line 224 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]

Definition at line 81 of file BranchDescription.h.

References edm::Transient< T >::get(), and transients_.

Referenced by edm::OutputModule::selectProducts().

{return transients_.get().transient_;}
Reflex::Type& edm::BranchDescription::type ( ) const [inline]

Definition at line 82 of file BranchDescription.h.

References edm::Transient< T >::get(), and transients_.

Referenced by initFromDictionary().

{return transients_.get().type_;}
TypeID& edm::BranchDescription::typeID ( ) const [inline]

Definition at line 83 of file BranchDescription.h.

References edm::Transient< T >::get(), and transients_.

Referenced by BranchDescription(), and initFromDictionary().

{return transients_.get().typeID_;}
void edm::BranchDescription::updateFriendlyClassName ( )
std::string& edm::BranchDescription::wrappedName ( ) const [inline]

Definition at line 102 of file BranchDescription.h.

References edm::Transient< T >::get(), and transients_.

Referenced by getInterface(), initFromDictionary(), and edm::RootOutputFile::RootOutputFile().

{return transients_.get().wrappedName_;}
WrapperInterfaceBase*& edm::BranchDescription::wrapperInterfaceBase ( ) const [inline]

Definition at line 103 of file BranchDescription.h.

References edm::Transient< T >::get(), and transients_.

Referenced by getInterface().

{return transients_.get().wrapperInterfaceBase_;}
void edm::BranchDescription::write ( std::ostream &  os) const

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

Referenced by branchID(), and initBranchName().

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

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

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

Definition at line 183 of file BranchDescription.h.

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

Definition at line 191 of file BranchDescription.h.

Referenced by oldProductID().

Definition at line 201 of file BranchDescription.h.

Referenced by initBranchName(), and productInstanceName().