CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
pat::helper::OverlapBySuperClusterSeed Class Reference

#include <OverlapTest.h>

Inheritance diagram for pat::helper::OverlapBySuperClusterSeed:
pat::helper::OverlapTest

Public Member Functions

bool fillOverlapsForItem (const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const override
 Check for overlaps. More...
 
 OverlapBySuperClusterSeed (const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 
void readInput (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 initializer for each event. to be implemented in child classes. More...
 
- Public Member Functions inherited from pat::helper::OverlapTest
virtual void done ()
 end of event method. does nothing More...
 
const std::string & name () const
 
 OverlapTest (const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 constructor: reads 'src' and 'requireNoOverlaps' parameters More...
 
bool requireNoOverlaps () const
 
virtual ~OverlapTest ()
 destructor, does nothing More...
 

Protected Attributes

edm::Handle< reco::CandidateViewothers_
 
- Protected Attributes inherited from pat::helper::OverlapTest
std::string name_
 
bool requireNoOverlaps_
 
edm::EDGetTokenT< reco::CandidateViewsrcToken_
 

Detailed Description

Definition at line 74 of file OverlapTest.h.

Constructor & Destructor Documentation

pat::helper::OverlapBySuperClusterSeed::OverlapBySuperClusterSeed ( const std::string &  name,
const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 77 of file OverlapTest.h.

77 : OverlapTest(name, iConfig, iC) {}
const std::string & name() const
Definition: OverlapTest.h:36
OverlapTest(const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
constructor: reads &#39;src&#39; and &#39;requireNoOverlaps&#39; parameters
Definition: OverlapTest.h:21

Member Function Documentation

bool OverlapBySuperClusterSeed::fillOverlapsForItem ( const reco::Candidate item,
reco::CandidatePtrVector overlapsToFill 
) const
overridevirtual

Check for overlaps.

Implements pat::helper::OverlapTest.

Definition at line 52 of file OverlapTest.cc.

References Exception, training_settings::idx, input, edm::Ref< C, T, F >::isAvailable(), edm::Ptr< T >::isNull(), edm::Ref< C, T, F >::isNull(), ecalTB2006H4_GenSimDigiReco_cfg::mySeed, pat::helper::OverlapTest::name(), trackingPlots::other, edm::PtrVector< T >::push_back(), and reco::RecoCandidate::superCluster().

53 {
54  const reco::RecoCandidate * input = dynamic_cast<const reco::RecoCandidate *>(&item);
55  if (input == nullptr) throw cms::Exception("Type Error") << "Input to OverlapBySuperClusterSeed is not a RecoCandidate. "
56  << "It's a " << typeid(item).name() << "\n";
57  reco::SuperClusterRef mySC = input->superCluster();
58  if (mySC.isNull() || !mySC.isAvailable()) {
59  throw cms::Exception("Bad Reference") << "Input to OverlapBySuperClusterSeed has a null or dangling superCluster reference\n";
60  }
61  const reco::CaloClusterPtr & mySeed = mySC->seed();
62  if (mySeed.isNull()) {
63  throw cms::Exception("Bad Reference") << "Input to OverlapBySuperClusterSeed has a null superCluster seed reference\n";
64  }
65  bool hasOverlaps = false;
66  size_t idx = 0;
67 // for (edm::View<reco::RecoCandidate>::const_iterator it = others_->begin(); it != others_->end(); ++it, ++idx) {
68  for (reco::CandidateView::const_iterator it = others_->begin(); it != others_->end(); ++it, ++idx) {
69  const reco::RecoCandidate * other = dynamic_cast<const reco::RecoCandidate *>(&*it);
70  reco::SuperClusterRef otherSc = other->superCluster();
71  if (otherSc.isNull() || !otherSc.isAvailable()) {
72  throw cms::Exception("Bad Reference") << "One item in the OverlapBySuperClusterSeed input list has a null or dangling superCluster reference\n";
73  }
74  if (mySeed == otherSc->seed()) {
75  overlapsToFill.push_back(others_->ptrAt(idx));
76  hasOverlaps = true;
77  }
78  }
79  return hasOverlaps;
80 }
bool isAvailable() const
Definition: Ref.h:575
Ptr< value_type > ptrAt(size_type i) const
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:140
static std::string const input
Definition: EdmProvDump.cc:48
const_iterator begin() const
bool isNull() const
Checks for null.
Definition: Ptr.h:164
bool isNull() const
Checks for null.
Definition: Ref.h:248
const std::string & name() const
Definition: OverlapTest.h:36
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::Handle< reco::CandidateView > others_
Definition: OverlapTest.h:86
const_iterator end() const
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster
void pat::helper::OverlapBySuperClusterSeed::readInput ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlineoverridevirtual

initializer for each event. to be implemented in child classes.

Implements pat::helper::OverlapTest.

Definition at line 79 of file OverlapTest.h.

References pat::helper::OverlapTest::fillOverlapsForItem(), edm::Event::getByToken(), and pat::helper::OverlapTest::srcToken_.

Referenced by parserPerfsuiteMetadata.parserPerfsuiteMetadata::readCmsScimarkTest().

79  {
80  iEvent.getByToken(srcToken_, others_);
81  }
edm::EDGetTokenT< reco::CandidateView > srcToken_
Definition: OverlapTest.h:39
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::Handle< reco::CandidateView > others_
Definition: OverlapTest.h:86

Member Data Documentation

edm::Handle<reco::CandidateView> pat::helper::OverlapBySuperClusterSeed::others_
protected

Definition at line 86 of file OverlapTest.h.