CMS 3D CMS Logo

Public Member Functions | Protected Attributes

pat::helper::OverlapBySuperClusterSeed Class Reference

#include <OverlapTest.h>

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

List of all members.

Public Member Functions

virtual bool fillOverlapsForItem (const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const
 Check for overlaps.
 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.

Protected Attributes

edm::Handle< edm::View
< reco::RecoCandidate > > 
others_

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.

: OverlapTest(name, iConfig) {}

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 Exception, UserOptions_cff::idx, 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().

{
    const reco::RecoCandidate * input = dynamic_cast<const reco::RecoCandidate *>(&item);
    if (input == 0) throw cms::Exception("Type Error") << "Input to OverlapBySuperClusterSeed is not a RecoCandidate. " 
                                                       << "It's a " << typeid(item).name() << "\n";
    reco::SuperClusterRef mySC = input->superCluster();
    if (mySC.isNull() || !mySC.isAvailable()) {
        throw cms::Exception("Bad Reference") << "Input to OverlapBySuperClusterSeed has a null or dangling superCluster reference\n";
    }
    const reco::CaloClusterPtr & mySeed = mySC->seed();
    if (mySeed.isNull()) {
        throw cms::Exception("Bad Reference") << "Input to OverlapBySuperClusterSeed has a null superCluster seed reference\n";
    }
    bool hasOverlaps = false;
    size_t idx = 0;
    for (edm::View<reco::RecoCandidate>::const_iterator it = others_->begin(); it != others_->end(); ++it, ++idx) {
        reco::SuperClusterRef otherSc = it->superCluster();
        if (otherSc.isNull() || !otherSc.isAvailable()) {
            throw cms::Exception("Bad Reference") << "One item in the OverlapBySuperClusterSeed input list has a null or dangling superCluster reference\n";
        }
        if (mySeed == otherSc->seed()) {
            overlapsToFill.push_back(others_->ptrAt(idx));
            hasOverlaps = true;
        }
    }
    return hasOverlaps;
}
virtual void pat::helper::OverlapBySuperClusterSeed::readInput ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [inline, virtual]

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

                                                                                     { 
            iEvent.getByLabel(src_, others_); 
        }

Member Data Documentation

Definition at line 84 of file OverlapTest.h.

Referenced by fillOverlapsForItem(), and readInput().