#include <GamIsoDetIdCollectionProducer.h>
Public Member Functions | |
void | beginJob () |
GamIsoDetIdCollectionProducer (const edm::ParameterSet &) | |
ctor | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
producer | |
~GamIsoDetIdCollectionProducer () | |
Private Attributes | |
edm::InputTag | emObjectLabel_ |
double | energyCut_ |
double | etCandCut_ |
double | etCut_ |
std::vector< int > | flagsexclEB_ |
std::vector< int > | flagsexclEE_ |
double | innerRadius_ |
std::string | interestingDetIdCollection_ |
double | outerRadius_ |
edm::InputTag | recHitsLabel_ |
std::vector< int > | severitiesexclEB_ |
std::vector< int > | severitiesexclEE_ |
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 GamIsoDetIdCollectionProducer.h.
GamIsoDetIdCollectionProducer::GamIsoDetIdCollectionProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
ctor
Definition at line 32 of file GamIsoDetIdCollectionProducer.cc.
References flagsexclEB_, flagsexclEE_, edm::ParameterSet::getParameter(), interestingDetIdCollection_, severitiesexclEB_, and severitiesexclEE_.
: 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")) { const std::vector<std::string> flagnamesEB = iConfig.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEB"); const std::vector<std::string> flagnamesEE = iConfig.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEE"); flagsexclEB_= StringToEnumValue<EcalRecHit::Flags>(flagnamesEB); flagsexclEE_= StringToEnumValue<EcalRecHit::Flags>(flagnamesEE); const std::vector<std::string> severitynamesEB = iConfig.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEB"); severitiesexclEB_= StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB); const std::vector<std::string> severitynamesEE = iConfig.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEE"); severitiesexclEE_= StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE); //register your products produces< DetIdCollection > (interestingDetIdCollection_) ; }
GamIsoDetIdCollectionProducer::~GamIsoDetIdCollectionProducer | ( | ) |
Definition at line 71 of file GamIsoDetIdCollectionProducer.cc.
{}
void GamIsoDetIdCollectionProducer::beginJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 74 of file GamIsoDetIdCollectionProducer.cc.
{}
void GamIsoDetIdCollectionProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
producer
Implements edm::EDProducer.
Definition at line 79 of file GamIsoDetIdCollectionProducer.cc.
References DetId::Ecal, EcalBarrel, EcalEndcap, emObjectLabel_, energyCut_, eta, etCandCut_, etCut_, spr::find(), flagsexclEB_, flagsexclEE_, edm::EventSetup::get(), edm::Event::getByLabel(), innerRadius_, edm::InputTag::instance(), interestingDetIdCollection_, EcalRecHit::kGood, mag(), outerRadius_, perp(), edm::Event::put(), recHitsLabel_, severitiesexclEB_, and severitiesexclEE_.
{ using namespace edm; using namespace std; //Get EM Object Handle<reco::PhotonCollection> 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(); edm::ESHandle<EcalSeverityLevelAlgo> sevlv; iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv); const EcalSeverityLevelAlgo* sevLevel = sevlv.product(); 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::PhotonCollection::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; 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 ( (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 ( et < etCut_) continue; //dont fill if below ET noise value bool isBarrel = false; if (fabs(caloGeom->getPosition(recIt->detid()).eta() < 1.479)) isBarrel = true; int severityFlag = sevLevel->severityLevel(recIt->detid(), *recHitsH); std::vector<int>::const_iterator sit; if (isBarrel) { sit = std::find(severitiesexclEB_.begin(), severitiesexclEB_.end(), severityFlag); if (sit!= severitiesexclEB_.end()) continue; } else { sit = std::find(severitiesexclEE_.begin(), severitiesexclEE_.end(), severityFlag); if (sit!= severitiesexclEE_.end()) continue; } std::vector<int>::const_iterator vit; if (isBarrel) { // new rechit flag checks //vit = std::find(flagsexclEB_.begin(), flagsexclEB_.end(), ((EcalRecHit*)(&*recIt))->recoFlag()); //if (vit != flagsexclEB_.end()) // continue; if (!((EcalRecHit*)(&*recIt))->checkFlag(EcalRecHit::kGood)) { if (((EcalRecHit*)(&*recIt))->checkFlags(flagsexclEB_)) { continue; } } } else { // new rechit flag checks //vit = std::find(flagsexclEE_.begin(), flagsexclEE_.end(), ((EcalRecHit*)(&*recIt))->recoFlag()); //if (vit != flagsexclEE_.end()) // continue; if (!((EcalRecHit*)(&*recIt))->checkFlag(EcalRecHit::kGood)) { if (((EcalRecHit*)(&*recIt))->checkFlags(flagsexclEE_)) { continue; } } } 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_ ); }
Definition at line 49 of file GamIsoDetIdCollectionProducer.h.
Referenced by produce().
double GamIsoDetIdCollectionProducer::energyCut_ [private] |
Definition at line 50 of file GamIsoDetIdCollectionProducer.h.
Referenced by produce().
double GamIsoDetIdCollectionProducer::etCandCut_ [private] |
Definition at line 52 of file GamIsoDetIdCollectionProducer.h.
Referenced by produce().
double GamIsoDetIdCollectionProducer::etCut_ [private] |
Definition at line 51 of file GamIsoDetIdCollectionProducer.h.
Referenced by produce().
std::vector<int> GamIsoDetIdCollectionProducer::flagsexclEB_ [private] |
Definition at line 59 of file GamIsoDetIdCollectionProducer.h.
Referenced by GamIsoDetIdCollectionProducer(), and produce().
std::vector<int> GamIsoDetIdCollectionProducer::flagsexclEE_ [private] |
Definition at line 60 of file GamIsoDetIdCollectionProducer.h.
Referenced by GamIsoDetIdCollectionProducer(), and produce().
double GamIsoDetIdCollectionProducer::innerRadius_ [private] |
Definition at line 54 of file GamIsoDetIdCollectionProducer.h.
Referenced by produce().
std::string GamIsoDetIdCollectionProducer::interestingDetIdCollection_ [private] |
Definition at line 55 of file GamIsoDetIdCollectionProducer.h.
Referenced by GamIsoDetIdCollectionProducer(), and produce().
double GamIsoDetIdCollectionProducer::outerRadius_ [private] |
Definition at line 53 of file GamIsoDetIdCollectionProducer.h.
Referenced by produce().
Definition at line 48 of file GamIsoDetIdCollectionProducer.h.
Referenced by produce().
std::vector<int> GamIsoDetIdCollectionProducer::severitiesexclEB_ [private] |
Definition at line 57 of file GamIsoDetIdCollectionProducer.h.
Referenced by GamIsoDetIdCollectionProducer(), and produce().
std::vector<int> GamIsoDetIdCollectionProducer::severitiesexclEE_ [private] |
Definition at line 58 of file GamIsoDetIdCollectionProducer.h.
Referenced by GamIsoDetIdCollectionProducer(), and produce().