CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Attributes
TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator > Class Template Reference

#include <CachingVariable.h>

Inheritance diagram for TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >:
CachingVariable

Classes

class  getObject
 

Public Member Functions

virtual CachingVariable::valueType calculate (getObject &o) const
 
CachingVariable::evalType eval (const edm::Event &iEvent) const
 
getObject objects (const edm::Event &iEvent) const
 
 TwoObjectVariable (const CachingVariableFactoryArg &arg)
 
- Public Member Functions inherited from CachingVariable
void addDescriptionLine (const std::string &s)
 
 CachingVariable (std::string m, std::string n, const edm::ParameterSet &iConfig)
 
bool compute (const edm::Event &iEvent) const
 
const Descriptiondescription () const
 
const std::string & holderName () const
 
const std::string & method () const
 
const std::string & name () const
 
valueType operator() (const edm::Event &iEvent) const
 
void print () const
 
void setHolder (std::string hn) const
 
virtual ~CachingVariable ()
 

Private Attributes

unsigned int indexLhs_
 
unsigned int indexRhs_
 
edm::InputTag srcLhs_
 
edm::InputTag srcRhs_
 

Additional Inherited Members

- Public Types inherited from CachingVariable
typedef std::pair< bool,
valueType
evalType
 
typedef double valueType
 
typedef std::map< std::string,
const CachingVariable * > 
vMap
 
- Protected Member Functions inherited from CachingVariable
evalTypebaseEval (const edm::Event &iEvent) const
 
bool notSeenThisEventAlready (const edm::Event &iEvent) const
 
void setCache (valueType &v) const
 
void setNotCompute () const
 
- Protected Attributes inherited from CachingVariable
evalType cache_
 
edm::ParameterSet conf_
 
Description d_
 
edm::Event::CacheIdentifier_t eventCacheID_ =0
 
std::string holderName_
 
std::string method_
 
std::string name_
 

Detailed Description

template<typename LHS, const char * lLHS, typename RHS, const char * lRHS, typename Calculator>
class TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >

Definition at line 430 of file CachingVariable.h.

Constructor & Destructor Documentation

template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::TwoObjectVariable ( const CachingVariableFactoryArg arg)
inline

Definition at line 432 of file CachingVariable.h.

References CachingVariable::addDescriptionLine(), idDealer::description, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexLhs_, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexRhs_, CachingVariable::CachingVariableFactoryArg::m, CachingVariable::CachingVariableFactoryArg::n, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcLhs_, and TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcRhs_.

432  :
433  CachingVariable(Calculator::calculationType()+std::string(lLHS)+std::string(lRHS),arg.n,arg.iConfig),
434  srcLhs_(edm::Service<InputTagDistributorService>()->retrieve("srcLhs",arg.iConfig)),
435  indexLhs_(arg.iConfig.getParameter<unsigned int>("indexLhs")),
436  srcRhs_(edm::Service<InputTagDistributorService>()->retrieve("srcRhs",arg.iConfig)),
437  indexRhs_(arg.iConfig.getParameter<unsigned int>("indexRhs"))
438  {
439  std::stringstream ss;
441  ss<<"with Obj1 at index: "<<indexLhs_<<" of: "<<srcLhs_;
442  addDescriptionLine(ss.str()); ss.str("");
443  ss<<"with Obj2 at index: "<<indexRhs_<<" of: "<<srcRhs_;
444  addDescriptionLine(ss.str()); ss.str("");
445  arg.m[arg.n]=this;
446  }
edm::InputTag srcRhs_
A arg
Definition: Factorize.h:36
unsigned int indexLhs_
void addDescriptionLine(const std::string &s)
edm::InputTag srcLhs_
tuple description
Definition: idDealer.py:66
unsigned int indexRhs_
CachingVariable(std::string m, std::string n, const edm::ParameterSet &iConfig)

Member Function Documentation

template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
virtual CachingVariable::valueType TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::calculate ( getObject o) const
inlinevirtual
template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
CachingVariable::evalType TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::eval ( const edm::Event iEvent) const
inlinevirtual

Reimplemented from CachingVariable.

Definition at line 489 of file CachingVariable.h.

References TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::calculate(), python.connectstrParser::o, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::objects(), and TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::getObject::test.

489  {
490  getObject o=objects(iEvent);
491  if (!o.test) return std::make_pair(false,0);
492  return std::make_pair(true,calculate(o));
493  }
TObject * getObject(TDirectory *fDir, const std::vector< std::string > &fObjectName)
Definition: compareHists.cc:44
getObject objects(const edm::Event &iEvent) const
virtual CachingVariable::valueType calculate(getObject &o) const
template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
getObject TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::objects ( const edm::Event iEvent) const
inline

Definition at line 455 of file CachingVariable.h.

References edm::HandleBase::failedToGet(), edm::Event::getByLabel(), TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexLhs_, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexRhs_, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::getObject::lhs, LogDebug, CachingVariable::name(), TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::getObject::rhs, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcLhs_, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcRhs_, and TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::getObject::test.

Referenced by TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::eval().

455  {
456  getObject failed;
458  iEvent.getByLabel(srcLhs_, lhsH);
459  if (lhsH.failedToGet()){
460  LogDebug("TwoObjectVariable")<<name()<<" could not get a collection with label: "<<srcLhs_;
461  return failed;}
462  if (indexLhs_>=lhsH->size()){
463  LogDebug("TwoObjectVariable")<<name()<<" tries to access index: "<<indexLhs_<<" of: "<<srcLhs_<<" with: "<<lhsH->size()<<" entries.";
464  return failed;}
465  const LHS & lhs = (*lhsH)[indexLhs_];
466 
468  iEvent.getByLabel(srcRhs_, rhsH);
469  if (rhsH.failedToGet()){
470  LogDebug("TwoObjectVariable")<<name()<<" could not get a collection with label: "<<srcLhs_;
471  return failed;}
472 
473  if (indexRhs_>=rhsH->size()){
474  LogDebug("TwoObjectVariable")<<name()<<" tries to access index: "<<indexRhs_<<" of: "<<srcRhs_<<" with: "<<rhsH->size()<<" entries.";
475  return failed;}
476  const RHS & rhs = (*rhsH)[indexRhs_];
477 
478  failed.test=true;
479  failed.lhs=&lhs;
480  failed.rhs=&rhs;
481  return failed;
482  }
#define LogDebug(id)
TObject * getObject(TDirectory *fDir, const std::vector< std::string > &fObjectName)
Definition: compareHists.cc:44
edm::InputTag srcRhs_
unsigned int indexLhs_
edm::InputTag srcLhs_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
bool failedToGet() const
Definition: HandleBase.h:80
unsigned int indexRhs_
const std::string & name() const

Member Data Documentation

template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
unsigned int TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexLhs_
private
template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
unsigned int TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexRhs_
private
template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
edm::InputTag TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcLhs_
private
template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
edm::InputTag TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcRhs_
private