CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual bool fillOverlapsForItem (const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const
 Check for overlaps. More...
 
 OverlapBySuperClusterSeed (const std::string &name, const edm::ParameterSet &iConfig)
 
virtual void readInput (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 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)
 constructor: reads 'src' and 'requireNoOverlaps' parameters More...
 
bool requireNoOverlaps () const
 
virtual ~OverlapTest ()
 destructor, does nothing More...
 

Protected Attributes

edm::Handle< edm::View
< reco::RecoCandidate > > 
others_
 
- Protected Attributes inherited from pat::helper::OverlapTest
std::string name_
 
bool requireNoOverlaps_
 
edm::InputTag src_
 

Detailed Description

Definition at line 73 of file OverlapTest.h.

Constructor & Destructor Documentation

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

Definition at line 76 of file OverlapTest.h.

76 : OverlapTest(name, iConfig) {}
OverlapTest(const std::string &name, const edm::ParameterSet &iConfig)
constructor: reads &#39;src&#39; and &#39;requireNoOverlaps&#39; parameters
Definition: OverlapTest.h:20
const std::string & name() const
Definition: OverlapTest.h:35

Member Function Documentation

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

Check for overlaps.

Implements pat::helper::OverlapTest.

Definition at line 52 of file OverlapTest.cc.

References edm::hlt::Exception, collect_tpl::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(), others_, edm::PtrVector< T >::push_back(), and reco::RecoCandidate::superCluster().

53 {
54  const reco::RecoCandidate * input = dynamic_cast<const reco::RecoCandidate *>(&item);
55  if (input == 0) 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  reco::SuperClusterRef otherSc = it->superCluster();
69  if (otherSc.isNull() || !otherSc.isAvailable()) {
70  throw cms::Exception("Bad Reference") << "One item in the OverlapBySuperClusterSeed input list has a null or dangling superCluster reference\n";
71  }
72  if (mySeed == otherSc->seed()) {
73  overlapsToFill.push_back(others_->ptrAt(idx));
74  hasOverlaps = true;
75  }
76  }
77  return hasOverlaps;
78 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:135
bool isAvailable() const
Definition: Ref.h:278
edm::Handle< edm::View< reco::RecoCandidate > > others_
Definition: OverlapTest.h:84
bool isNull() const
Checks for null.
Definition: Ref.h:244
tuple input
Definition: collect_tpl.py:10
const std::string & name() const
Definition: OverlapTest.h:35
bool isNull() const
Checks for null.
Definition: Ptr.h:152
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster
virtual void pat::helper::OverlapBySuperClusterSeed::readInput ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlinevirtual

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

Implements pat::helper::OverlapTest.

Definition at line 78 of file OverlapTest.h.

References edm::Event::getByLabel(), others_, and pat::helper::OverlapTest::src_.

Referenced by parserPerfsuiteMetadata.parserPerfsuiteMetadata::readCmsScimarkTest().

78  {
79  iEvent.getByLabel(src_, others_);
80  }
edm::Handle< edm::View< reco::RecoCandidate > > others_
Definition: OverlapTest.h:84
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359

Member Data Documentation

edm::Handle<edm::View<reco::RecoCandidate> > pat::helper::OverlapBySuperClusterSeed::others_
protected

Definition at line 84 of file OverlapTest.h.

Referenced by fillOverlapsForItem(), and readInput().