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) {}
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:22
const std::string & name() const
Definition: OverlapTest.h:37

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.

References Exception, heavyIonCSV_trainingSettings::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().

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 }
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
static std::string const input
Definition: EdmProvDump.cc:47
bool isAvailable() const
Definition: Ref.h:537
bool isNull() const
Checks for null.
Definition: Ref.h:235
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::Handle< reco::CandidateView > others_
Definition: OverlapTest.h:91
const std::string & name() const
Definition: OverlapTest.h:37

◆ 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.

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

83  {
84  iEvent.getByToken(srcToken_, others_);
85  }
edm::EDGetTokenT< reco::CandidateView > srcToken_
Definition: OverlapTest.h:41
int iEvent
Definition: GenABIO.cc:224
edm::Handle< reco::CandidateView > others_
Definition: OverlapTest.h:91

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().