CMS 3D CMS Logo

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 override
 
getObject objects (const edm::Event &iEvent) const
 
 TwoObjectVariable (const CachingVariableFactoryArg &arg, edm::ConsumesCollector &iC)
 
- Public Member Functions inherited from CachingVariable
void addDescriptionLine (const std::string &s)
 
 CachingVariable (std::string m, std::string n, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
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::EDGetTokenT< std::vector< LHS > > srcLhs_
 
edm::InputTag srcLhsTag_
 
edm::EDGetTokenT< std::vector< RHS > > srcRhs_
 
edm::InputTag srcRhsTag_
 

Additional Inherited Members

- Public Types inherited from CachingVariable
typedef std::pair< bool, valueTypeevalType
 
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 444 of file CachingVariable.h.

Constructor & Destructor Documentation

◆ TwoObjectVariable()

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

Definition at line 446 of file CachingVariable.h.

447  : CachingVariable(Calculator::calculationType() + std::string(lLHS) + std::string(lRHS), arg.n, arg.iConfig, iC),
448  srcLhsTag_(edm::Service<InputTagDistributorService>()->retrieve("srcLhs", arg.iConfig)),
449  srcLhs_(iC.consumes<std::vector<LHS> >(srcLhsTag_)),
450  indexLhs_(arg.iConfig.getParameter<unsigned int>("indexLhs")),
451  srcRhsTag_(edm::Service<InputTagDistributorService>()->retrieve("srcRhs", arg.iConfig)),
452  srcRhs_(iC.consumes<std::vector<RHS> >(srcRhsTag_)),
453  indexRhs_(arg.iConfig.getParameter<unsigned int>("indexRhs")) {
454  std::stringstream ss;
456  ss << "with Obj1 at index: " << indexLhs_ << " of: " << srcLhs_;
457  addDescriptionLine(ss.str());
458  ss.str("");
459  ss << "with Obj2 at index: " << indexRhs_ << " of: " << srcRhs_;
460  addDescriptionLine(ss.str());
461  ss.str("");
462  arg.m[arg.n] = this;
463  }

References CachingVariable::addDescriptionLine(), edmLumisInFiles::description, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexLhs_, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexRhs_, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcLhs_, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcRhs_, and contentValuesCheck::ss.

Member Function Documentation

◆ calculate()

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

Definition at line 508 of file CachingVariable.h.

508  {
509  Calculator calc;
510  return calc(*o.lhs, *o.rhs);
511  }

References EcalTangentSkim_cfg::o.

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

◆ eval()

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
inlineoverridevirtual

Reimplemented from CachingVariable.

Definition at line 512 of file CachingVariable.h.

512  {
514  if (!o.test)
515  return std::make_pair(false, 0);
516  return std::make_pair(true, calculate(o));
517  }

References TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::calculate(), iEvent, EcalTangentSkim_cfg::o, and TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::objects().

◆ objects()

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 472 of file CachingVariable.h.

472  {
475  iEvent.getByToken(srcLhs_, lhsH);
476  if (lhsH.failedToGet()) {
477  LogDebug("TwoObjectVariable") << name() << " could not get a collection with label: " << srcLhsTag_;
478  return failed;
479  }
480  if (indexLhs_ >= lhsH->size()) {
481  LogDebug("TwoObjectVariable") << name() << " tries to access index: " << indexLhs_ << " of: " << srcLhsTag_
482  << " with: " << lhsH->size() << " entries.";
483  return failed;
484  }
485  const LHS& lhs = (*lhsH)[indexLhs_];
486 
488  iEvent.getByToken(srcRhs_, rhsH);
489  if (rhsH.failedToGet()) {
490  LogDebug("TwoObjectVariable") << name() << " could not get a collection with label: " << srcLhsTag_;
491  return failed;
492  }
493 
494  if (indexRhs_ >= rhsH->size()) {
495  LogDebug("TwoObjectVariable") << name() << " tries to access index: " << indexRhs_ << " of: " << srcRhsTag_
496  << " with: " << rhsH->size() << " entries.";
497  return failed;
498  }
499  const RHS& rhs = (*rhsH)[indexRhs_];
500 
501  failed.test = true;
502  failed.lhs = &lhs;
503  failed.rhs = &rhs;
504  return failed;
505  }

References runEdmFileComparison::failed, edm::HandleBase::failedToGet(), iEvent, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexLhs_, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexRhs_, LogDebug, CachingVariable::name(), TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcLhs_, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcLhsTag_, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcRhs_, and TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcRhsTag_.

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

Member Data Documentation

◆ indexLhs_

template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
unsigned int TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexLhs_
private

◆ indexRhs_

template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
unsigned int TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexRhs_
private

◆ srcLhs_

template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
edm::EDGetTokenT<std::vector<LHS> > TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcLhs_
private

◆ srcLhsTag_

template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
edm::InputTag TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcLhsTag_
private

◆ srcRhs_

template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
edm::EDGetTokenT<std::vector<RHS> > TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcRhs_
private

◆ srcRhsTag_

template<typename LHS , const char * lLHS, typename RHS , const char * lRHS, typename Calculator >
edm::InputTag TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcRhsTag_
private
CachingVariable::addDescriptionLine
void addDescriptionLine(const std::string &s)
Definition: CachingVariable.h:69
TwoObjectVariable::srcLhs_
edm::EDGetTokenT< std::vector< LHS > > srcLhs_
Definition: CachingVariable.h:521
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
getObject
TObject * getObject(TDirectory *fDir, const std::vector< std::string > &fObjectName)
Definition: compareHists.cc:44
runEdmFileComparison.failed
failed
Definition: runEdmFileComparison.py:225
TwoObjectVariable::objects
getObject objects(const edm::Event &iEvent) const
Definition: CachingVariable.h:472
edm::Handle
Definition: AssociativeIterator.h:50
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TwoObjectVariable::srcLhsTag_
edm::InputTag srcLhsTag_
Definition: CachingVariable.h:520
edm::HandleBase::failedToGet
bool failedToGet() const
Definition: HandleBase.h:72
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
CachingVariable::CachingVariable
CachingVariable(std::string m, std::string n, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
Definition: CachingVariable.h:55
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
TwoObjectVariable::indexLhs_
unsigned int indexLhs_
Definition: CachingVariable.h:522
TwoObjectVariable::srcRhsTag_
edm::InputTag srcRhsTag_
Definition: CachingVariable.h:523
TwoObjectVariable::calculate
virtual CachingVariable::valueType calculate(getObject &o) const
Definition: CachingVariable.h:508
TwoObjectVariable::srcRhs_
edm::EDGetTokenT< std::vector< RHS > > srcRhs_
Definition: CachingVariable.h:524
CachingVariable::name
const std::string & name() const
Definition: CachingVariable.h:66
funct::arg
A arg
Definition: Factorize.h:31
TwoObjectVariable::indexRhs_
unsigned int indexRhs_
Definition: CachingVariable.h:525