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 77 of file OverlapTest.h.

Constructor & Destructor Documentation

◆ OverlapBySuperClusterSeed()

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

Definition at line 80 of file OverlapTest.h.

81  : OverlapTest(name, iConfig, iC) {}

Member Function Documentation

◆ fillOverlapsForItem()

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.

53  {
54  const reco::RecoCandidate *input = dynamic_cast<const reco::RecoCandidate *>(&item);
55  if (input == nullptr)
56  throw cms::Exception("Type Error") << "Input to OverlapBySuperClusterSeed is not a RecoCandidate. "
57  << "It's a " << typeid(item).name() << "\n";
58  reco::SuperClusterRef mySC = input->superCluster();
59  if (mySC.isNull() || !mySC.isAvailable()) {
60  throw cms::Exception("Bad Reference")
61  << "Input to OverlapBySuperClusterSeed has a null or dangling superCluster reference\n";
62  }
63  const reco::CaloClusterPtr &mySeed = mySC->seed();
64  if (mySeed.isNull()) {
65  throw cms::Exception("Bad Reference")
66  << "Input to OverlapBySuperClusterSeed has a null superCluster seed reference\n";
67  }
68  bool hasOverlaps = false;
69  size_t idx = 0;
70  // for (edm::View<reco::RecoCandidate>::const_iterator it = others_->begin(); it != others_->end(); ++it, ++idx) {
71  for (reco::CandidateView::const_iterator it = others_->begin(); it != others_->end(); ++it, ++idx) {
72  const reco::RecoCandidate *other = dynamic_cast<const reco::RecoCandidate *>(&*it);
73  reco::SuperClusterRef otherSc = other->superCluster();
74  if (otherSc.isNull() || !otherSc.isAvailable()) {
75  throw cms::Exception("Bad Reference")
76  << "One item in the OverlapBySuperClusterSeed input list has a null or dangling superCluster reference\n";
77  }
78  if (mySeed == otherSc->seed()) {
79  overlapsToFill.push_back(others_->ptrAt(idx));
80  hasOverlaps = true;
81  }
82  }
83  return hasOverlaps;
84 }

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

◆ readInput()

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 83 of file OverlapTest.h.

83  {
84  iEvent.getByToken(srcToken_, others_);
85  }

References iEvent, others_, and pat::helper::OverlapTest::srcToken_.

Member Data Documentation

◆ others_

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

Definition at line 91 of file OverlapTest.h.

Referenced by fillOverlapsForItem(), and readInput().

input
static const std::string input
Definition: EdmProvDump.cc:48
edm::Ref::isAvailable
bool isAvailable() const
Definition: Ref.h:537
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition: Ref.h:235
training_settings.idx
idx
Definition: training_settings.py:16
ecalTB2006H4_GenSimDigiReco_cfg.mySeed
mySeed
Definition: ecalTB2006H4_GenSimDigiReco_cfg.py:8
edm::Ref< SuperClusterCollection >
pat::helper::OverlapTest::OverlapTest
OverlapTest(const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
constructor: reads 'src' and 'requireNoOverlaps' parameters
Definition: OverlapTest.h:22
pat::helper::OverlapBySuperClusterSeed::others_
edm::Handle< reco::CandidateView > others_
Definition: OverlapTest.h:91
trackingPlots.other
other
Definition: trackingPlots.py:1465
edm::PtrVector::push_back
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
pat::helper::OverlapTest::name
const std::string & name() const
Definition: OverlapTest.h:37
iEvent
int iEvent
Definition: GenABIO.cc:224
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
pat::helper::OverlapTest::srcToken_
edm::EDGetTokenT< reco::CandidateView > srcToken_
Definition: OverlapTest.h:41
reco::RecoCandidate
Definition: RecoCandidate.h:20
edm::Ptr< CaloCluster >
Exception
Definition: hltDiff.cc:246
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86