CMS 3D CMS Logo

Public Member Functions | Private Attributes

EleIsoDetIdCollectionProducer Class Reference

#include <EleIsoDetIdCollectionProducer.h>

Inheritance diagram for EleIsoDetIdCollectionProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void beginJob ()
 EleIsoDetIdCollectionProducer (const edm::ParameterSet &)
 ctor
virtual void produce (edm::Event &, const edm::EventSetup &)
 producer
 ~EleIsoDetIdCollectionProducer ()

Private Attributes

edm::InputTag emObjectLabel_
double energyCut_
double etCandCut_
double etCut_
double innerRadius_
std::string interestingDetIdCollection_
double outerRadius_
edm::InputTag recHitsLabel_
int severityLevelCut_
float severityRecHitThreshold_
EcalSeverityLevelAlgo::SpikeId spId_
std::string spIdString_
float spIdThreshold_
std::vector< int > v_chstatus_

Detailed Description

Original author: Matthew LeBourgeois PH/CMG Modified from : RecoEcal/EgammaClusterProducers/{src,interface}/InterestingDetIdCollectionProducer.{h,cc} by Paolo Meridiani PH/CMG

Implementation: <Notes on="" implementation>="">

Definition at line 37 of file EleIsoDetIdCollectionProducer.h.


Constructor & Destructor Documentation

EleIsoDetIdCollectionProducer::EleIsoDetIdCollectionProducer ( const edm::ParameterSet iConfig) [explicit]

ctor

Definition at line 28 of file EleIsoDetIdCollectionProducer.cc.

References interestingDetIdCollection_, EcalSeverityLevelAlgo::kE1OverE9, EcalSeverityLevelAlgo::kSwissCross, EcalSeverityLevelAlgo::kSwissCrossBordersIncluded, spId_, and spIdString_.

                                                                                           :
            recHitsLabel_(iConfig.getParameter< edm::InputTag > ("recHitsLabel")),
            emObjectLabel_(iConfig.getParameter< edm::InputTag > ("emObjectLabel")),
            energyCut_(iConfig.getParameter<double>("energyCut")),
            etCut_(iConfig.getParameter<double>("etCut")),
            etCandCut_(iConfig.getParameter<double> ("etCandCut")),
            outerRadius_(iConfig.getParameter<double>("outerRadius")),
            innerRadius_(iConfig.getParameter<double>("innerRadius")),
            interestingDetIdCollection_(iConfig.getParameter<std::string>("interestingDetIdCollection")),
            severityLevelCut_(iConfig.getParameter<int>("severityLevelCut")),
            severityRecHitThreshold_(iConfig.getParameter<double>("severityRecHitThreshold")),
            spIdString_(iConfig.getParameter<std::string>("spikeIdString")),
            spIdThreshold_(iConfig.getParameter<double>("spikeIdThreshold")),
            v_chstatus_(iConfig.getParameter<std::vector<int> >("recHitFlagsToBeExcluded")) {


    if     ( !spIdString_.compare("kE1OverE9") )                  spId_ = EcalSeverityLevelAlgo::kE1OverE9;
    else if( !spIdString_.compare("kSwissCross") )                spId_ = EcalSeverityLevelAlgo::kSwissCross;
    else if( !spIdString_.compare("kSwissCrossBordersIncluded") ) spId_ = EcalSeverityLevelAlgo::kSwissCrossBordersIncluded;
    else                                                          spId_ = EcalSeverityLevelAlgo::kSwissCross;
    
    //register your products
    produces< DetIdCollection > (interestingDetIdCollection_) ;
}
EleIsoDetIdCollectionProducer::~EleIsoDetIdCollectionProducer ( )

Definition at line 53 of file EleIsoDetIdCollectionProducer.cc.

{}

Member Function Documentation

void EleIsoDetIdCollectionProducer::beginJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 55 of file EleIsoDetIdCollectionProducer.cc.

{}
void EleIsoDetIdCollectionProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

producer

Implements edm::EDProducer.

Definition at line 60 of file EleIsoDetIdCollectionProducer.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, emObjectLabel_, energyCut_, ExpressReco_HICollisions_FallBack::et, etCandCut_, etCut_, spr::find(), edm::EventSetup::get(), edm::Event::getByLabel(), innerRadius_, edm::InputTag::instance(), interestingDetIdCollection_, mag(), outerRadius_, perp(), edm::Event::put(), recHitsLabel_, EcalSeverityLevelAlgo::severityLevel(), severityLevelCut_, severityRecHitThreshold_, spId_, spIdThreshold_, and v_chstatus_.

{
    using namespace edm;
    using namespace std;

    //Get EM Object
    Handle<reco::GsfElectronCollection> emObjectH;
    iEvent.getByLabel(emObjectLabel_,emObjectH);

    // take EcalRecHits
    Handle<EcalRecHitCollection> recHitsH;
    iEvent.getByLabel(recHitsLabel_,recHitsH);
    std::auto_ptr<CaloRecHitMetaCollectionV> recHits_(0); 
    recHits_ = std::auto_ptr<CaloRecHitMetaCollectionV>(new EcalRecHitMetaCollection(*recHitsH));

    edm::ESHandle<CaloGeometry> pG;
    iSetup.get<CaloGeometryRecord>().get(pG);    
    const CaloGeometry* caloGeom = pG.product();

    //Get the channel status from the db
    edm::ESHandle<EcalChannelStatus> chStatus;
    iSetup.get<EcalChannelStatusRcd>().get(chStatus);

    CaloDualConeSelector *doubleConeSel_ = 0;
    if(recHitsLabel_.instance() == "EcalRecHitsEB")
        doubleConeSel_= new CaloDualConeSelector(innerRadius_,outerRadius_, &*pG, DetId::Ecal, EcalBarrel);
    else if(recHitsLabel_.instance() == "EcalRecHitsEE")
        doubleConeSel_= new CaloDualConeSelector(innerRadius_,outerRadius_, &*pG, DetId::Ecal, EcalEndcap);

    //Create empty output collections
    std::auto_ptr< DetIdCollection > detIdCollection (new DetIdCollection() ) ;

    reco::GsfElectronCollection::const_iterator emObj;
    if(doubleConeSel_) { //if cone selector was created
        for (emObj = emObjectH->begin(); emObj != emObjectH->end();  emObj++) { //Loop over candidates

            if(emObj->et() < etCandCut_) continue; //don't calculate if object hasn't enough energy
            
            GlobalPoint pclu (emObj->caloPosition().x(),emObj->caloPosition().y(),emObj->caloPosition().z());
            std::auto_ptr<CaloRecHitMetaCollectionV> chosen = doubleConeSel_->select(pclu,*recHits_);

            CaloRecHitMetaCollectionV::const_iterator recIt;
            for (recIt = chosen->begin(); recIt!= chosen->end () ; ++recIt) { // Select RecHits 

                if ( fabs(recIt->energy()) < energyCut_) continue;  //dont fill if below E noise value


                double et = recIt->energy() * 
                            caloGeom->getPosition(recIt->detid()).perp() / 
                            caloGeom->getPosition(recIt->detid()).mag();

                if ( fabs(et) < etCut_) continue;  //dont fill if below ET noise value

                if(recHitsLabel_.instance() == "EcalRecHitsEB" && //make sure we have a barrel rechit
                   EcalSeverityLevelAlgo::severityLevel(          //call the severity level method
                       EBDetId(recIt->detid()),                   //passing the EBDetId
                       *recHitsH,                                 //the rechit collection in order to calculate the swiss crss
                       *chStatus,                                 //and the EcalChannelRecHitRcd
                        severityRecHitThreshold_,                 //only consider rechits with ET >
                        spId_,                                    //the SpikeId method (currently kE1OverE9 or kSwissCross)
                        spIdThreshold_                            //cut value for above
                   ) >= severityLevelCut_) continue;              //then if the severity level is too high, we continue to the next rechit

                //Check based on flags to protect from recovered channels from non-read towers
                //Assumption is that v_chstatus_ is empty unless doFlagChecks() has been called
                std::vector<int>::const_iterator vit = std::find( v_chstatus_.begin(), v_chstatus_.end(),  ((EcalRecHit*)(&*recIt))->recoFlag() );
                if ( vit != v_chstatus_.end() ) continue; // the recHit has to be excluded from the iso sum


                if(std::find(detIdCollection->begin(),detIdCollection->end(),recIt->detid()) == detIdCollection->end()) 
                            detIdCollection->push_back(recIt->detid()); 
            } //end rechits

        } //end candidates

        delete doubleConeSel_;
    } //end if cone selector was created
    
    iEvent.put( detIdCollection, interestingDetIdCollection_ );
}

Member Data Documentation

Definition at line 49 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

Definition at line 50 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

Definition at line 52 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

Definition at line 51 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

Definition at line 54 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

Definition at line 55 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

Definition at line 53 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

Definition at line 48 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

Definition at line 56 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

Definition at line 57 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

Definition at line 60 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

Definition at line 58 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer().

Definition at line 59 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

std::vector<int> EleIsoDetIdCollectionProducer::v_chstatus_ [private]

Definition at line 61 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().