#include <PhysicsTools/UtilAlgos/interface/CachingVariable.h>
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 (CachingVariableFactoryArg arg) | |
Private Attributes | |
uint | indexLhs_ |
uint | indexRhs_ |
edm::InputTag | srcLhs_ |
edm::InputTag | srcRhs_ |
Classes | |
class | getObject |
Definition at line 410 of file CachingVariable.h.
TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::TwoObjectVariable | ( | CachingVariableFactoryArg | arg | ) | [inline] |
Definition at line 412 of file CachingVariable.h.
References CachingVariable::addDescriptionLine(), 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_, TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcRhs_, and ss.
00412 : 00413 CachingVariable(Calculator::calculationType()+std::string(lLHS)+std::string(lRHS),arg.n,arg.iConfig), 00414 srcLhs_(edm::Service<InputTagDistributorService>()->retrieve("srcLhs",arg.iConfig)), 00415 indexLhs_(arg.iConfig.getParameter<uint>("indexLhs")), 00416 srcRhs_(edm::Service<InputTagDistributorService>()->retrieve("srcRhs",arg.iConfig)), 00417 indexRhs_(arg.iConfig.getParameter<uint>("indexRhs")) 00418 { 00419 std::stringstream ss; 00420 addDescriptionLine(Calculator::description()); 00421 ss<<"with Obj1 at index: "<<indexLhs_<<" of: "<<srcLhs_; 00422 addDescriptionLine(ss.str()); ss.str(""); 00423 ss<<"with Obj2 at index: "<<indexRhs_<<" of: "<<srcRhs_; 00424 addDescriptionLine(ss.str()); ss.str(""); 00425 arg.m[arg.n]=this; 00426 }
virtual CachingVariable::valueType TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::calculate | ( | getObject & | o | ) | const [inline, virtual] |
Definition at line 465 of file CachingVariable.h.
References TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::getObject::lhs, and TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::getObject::rhs.
Referenced by TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::eval().
CachingVariable::evalType TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::eval | ( | const edm::Event & | iEvent | ) | const [inline, virtual] |
Reimplemented from CachingVariable.
Definition at line 469 of file CachingVariable.h.
References TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::calculate(), TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::objects(), and TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::getObject::test.
00469 { 00470 getObject o=objects(iEvent); 00471 if (!o.test) return std::make_pair(false,0); 00472 return std::make_pair(true,calculate(o)); 00473 }
getObject TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::objects | ( | const edm::Event & | iEvent | ) | const [inline] |
Definition at line 435 of file CachingVariable.h.
References edm::Handle< T >::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().
00435 { 00436 getObject failed; 00437 edm::Handle<std::vector<LHS> > lhsH; 00438 iEvent.getByLabel(srcLhs_, lhsH); 00439 if (lhsH.failedToGet()){ 00440 LogDebug("TwoObjectVariable")<<name()<<" could not get a collection with label: "<<srcLhs_; 00441 return failed;} 00442 if (indexLhs_>=lhsH->size()){ 00443 LogDebug("TwoObjectVariable")<<name()<<" tries to access index: "<<indexLhs_<<" of: "<<srcLhs_<<" with: "<<lhsH->size()<<" entries."; 00444 return failed;} 00445 const LHS & lhs = (*lhsH)[indexLhs_]; 00446 00447 edm::Handle<std::vector<RHS> > rhsH; 00448 iEvent.getByLabel(srcRhs_, rhsH); 00449 if (rhsH.failedToGet()){ 00450 LogDebug("TwoObjectVariable")<<name()<<" could not get a collection with label: "<<srcLhs_; 00451 return failed;} 00452 00453 if (indexRhs_>=rhsH->size()){ 00454 LogDebug("TwoObjectVariable")<<name()<<" tries to access index: "<<indexRhs_<<" of: "<<srcRhs_<<" with: "<<rhsH->size()<<" entries."; 00455 return failed;} 00456 const RHS & rhs = (*rhsH)[indexRhs_]; 00457 00458 failed.test=true; 00459 failed.lhs=&lhs; 00460 failed.rhs=&rhs; 00461 return failed; 00462 }
uint TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexLhs_ [private] |
Definition at line 476 of file CachingVariable.h.
Referenced by TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::objects(), and TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::TwoObjectVariable().
uint TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::indexRhs_ [private] |
Definition at line 478 of file CachingVariable.h.
Referenced by TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::objects(), and TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::TwoObjectVariable().
edm::InputTag TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcLhs_ [private] |
Definition at line 475 of file CachingVariable.h.
Referenced by TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::objects(), and TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::TwoObjectVariable().
edm::InputTag TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::srcRhs_ [private] |
Definition at line 477 of file CachingVariable.h.
Referenced by TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::objects(), and TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >::TwoObjectVariable().