#include <EgammaEcalRecHitIsolationProducer.h>
Public Member Functions | |
EgammaEcalRecHitIsolationProducer (const edm::ParameterSet &) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
~EgammaEcalRecHitIsolationProducer () | |
Private Attributes | |
edm::ParameterSet | conf_ |
edm::InputTag | ecalBarrelRecHitCollection_ |
edm::InputTag | ecalBarrelRecHitProducer_ |
edm::InputTag | ecalEndcapRecHitCollection_ |
edm::InputTag | ecalEndcapRecHitProducer_ |
double | egIsoConeSizeInBarrel_ |
double | egIsoConeSizeInEndcap_ |
double | egIsoConeSizeOut_ |
double | egIsoEMinBarrel_ |
double | egIsoEMinEndcap_ |
double | egIsoJurassicWidth_ |
double | egIsoPtMinBarrel_ |
double | egIsoPtMinEndcap_ |
edm::InputTag | emObjectProducer_ |
bool | subtract_ |
bool | tryBoth_ |
bool | useIsolEt_ |
bool | useNumCrystals_ |
bool | vetoClustered_ |
Definition at line 34 of file EgammaEcalRecHitIsolationProducer.h.
EgammaEcalRecHitIsolationProducer::EgammaEcalRecHitIsolationProducer | ( | const edm::ParameterSet & | config | ) | [explicit] |
Definition at line 28 of file EgammaEcalRecHitIsolationProducer.cc.
References conf_, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, emObjectProducer_, edm::ParameterSet::getParameter(), subtract_, tryBoth_, useIsolEt_, useNumCrystals_, and vetoClustered_.
: conf_(config) { // use configuration file to setup input/output collection names //inputs emObjectProducer_ = conf_.getParameter<edm::InputTag>("emObjectProducer"); ecalBarrelRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitProducer"); ecalBarrelRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitCollection"); ecalEndcapRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitProducer"); ecalEndcapRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitCollection"); //vetos egIsoPtMinBarrel_ = conf_.getParameter<double>("etMinBarrel"); egIsoEMinBarrel_ = conf_.getParameter<double>("eMinBarrel"); egIsoPtMinEndcap_ = conf_.getParameter<double>("etMinEndcap"); egIsoEMinEndcap_ = conf_.getParameter<double>("eMinEndcap"); egIsoConeSizeInBarrel_ = conf_.getParameter<double>("intRadiusBarrel"); egIsoConeSizeInEndcap_ = conf_.getParameter<double>("intRadiusEndcap"); egIsoConeSizeOut_ = conf_.getParameter<double>("extRadius"); egIsoJurassicWidth_ = conf_.getParameter<double>("jurassicWidth"); // options useIsolEt_ = conf_.getParameter<bool>("useIsolEt"); tryBoth_ = conf_.getParameter<bool>("tryBoth"); subtract_ = conf_.getParameter<bool>("subtract"); useNumCrystals_ = conf_.getParameter<bool>("useNumCrystals"); vetoClustered_ = conf_.getParameter<bool>("vetoClustered"); //register your products produces < edm::ValueMap<double> >(); }
EgammaEcalRecHitIsolationProducer::~EgammaEcalRecHitIsolationProducer | ( | ) |
Definition at line 62 of file EgammaEcalRecHitIsolationProducer.cc.
{}
void EgammaEcalRecHitIsolationProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 71 of file EgammaEcalRecHitIsolationProducer.cc.
References DetId::Ecal, ecalBarrelRecHitCollection_, ecalBarrelRecHitProducer_, ecalEndcapRecHitCollection_, ecalEndcapRecHitProducer_, egIsoConeSizeInBarrel_, egIsoConeSizeInEndcap_, egIsoConeSizeOut_, egIsoEMinBarrel_, egIsoEMinEndcap_, egIsoJurassicWidth_, egIsoPtMinBarrel_, egIsoPtMinEndcap_, emObjectProducer_, funct::exp(), edm::helper::Filler< Map >::fill(), edm::EventSetup::get(), edm::Ref< C, T, F >::get(), edm::Event::getByLabel(), EgammaRecHitIsolation::getEnergySum(), EgammaRecHitIsolation::getEtSum(), i, edm::helper::Filler< Map >::insert(), edm::InputTag::label(), edm::ESHandle< T >::product(), edm::Event::put(), EgammaRecHitIsolation::setUseNumCrystals(), EgammaRecHitIsolation::setVetoClustered(), funct::sin(), subtract_, tryBoth_, useIsolEt_, useNumCrystals_, and vetoClustered_.
{ // Get the filtered objects edm::Handle< edm::View<reco::Candidate> > emObjectHandle; iEvent.getByLabel(emObjectProducer_,emObjectHandle); // Next get Ecal hits barrel edm::Handle<EcalRecHitCollection> ecalBarrelRecHitHandle; //EcalRecHitCollection is a typedef to iEvent.getByLabel(ecalBarrelRecHitProducer_.label(),ecalBarrelRecHitCollection_.label(), ecalBarrelRecHitHandle); // Next get Ecal hits endcap edm::Handle<EcalRecHitCollection> ecalEndcapRecHitHandle; iEvent.getByLabel(ecalEndcapRecHitProducer_.label(), ecalEndcapRecHitCollection_.label(),ecalEndcapRecHitHandle); //create the meta hit collections inorder that we can pass them into the isolation objects EcalRecHitMetaCollection ecalBarrelHits(*ecalBarrelRecHitHandle); EcalRecHitMetaCollection ecalEndcapHits(*ecalEndcapRecHitHandle); //Get Calo Geometry edm::ESHandle<CaloGeometry> pG; iSetup.get<CaloGeometryRecord>().get(pG); const CaloGeometry* caloGeom = pG.product(); //reco::CandViewDoubleAssociations* isoMap = new reco::CandViewDoubleAssociations( reco::CandidateBaseRefProd( emObjectHandle ) ); std::auto_ptr<edm::ValueMap<double> > isoMap(new edm::ValueMap<double>()); edm::ValueMap<double>::Filler filler(*isoMap); std::vector<double> retV(emObjectHandle->size(),0); EgammaRecHitIsolation ecalBarrelIsol(egIsoConeSizeOut_,egIsoConeSizeInBarrel_,egIsoJurassicWidth_,egIsoPtMinBarrel_,egIsoEMinBarrel_,caloGeom,&ecalBarrelHits,DetId::Ecal); ecalBarrelIsol.setUseNumCrystals(useNumCrystals_); ecalBarrelIsol.setVetoClustered(vetoClustered_); EgammaRecHitIsolation ecalEndcapIsol(egIsoConeSizeOut_,egIsoConeSizeInEndcap_,egIsoJurassicWidth_,egIsoPtMinEndcap_,egIsoEMinEndcap_,caloGeom,&ecalEndcapHits,DetId::Ecal); ecalEndcapIsol.setUseNumCrystals(useNumCrystals_); ecalEndcapIsol.setVetoClustered(vetoClustered_); for( size_t i = 0 ; i < emObjectHandle->size(); ++i) { //i need to know if its in the barrel/endcap so I get the supercluster handle to find out the detector eta //this might not be the best way, are we guaranteed that eta<1.5 is barrel //this can be safely replaced by another method which determines where the emobject is //then we either get the isolation Et or isolation Energy depending on user selection double isoValue =0.; reco::SuperClusterRef superClus = emObjectHandle->at(i).get<reco::SuperClusterRef>(); if(tryBoth_){ //barrel + endcap if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i))); else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i))); } else if( fabs(superClus->eta())<1.479) { //barrel if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i))); else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i))); } else{ //endcap if(useIsolEt_) isoValue = ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i))); else isoValue = ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i))); } //we subtract off the electron energy here as well double subtractVal=0; if(useIsolEt_) subtractVal = superClus.get()->rawEnergy()*sin(2*atan(exp(-superClus.get()->eta()))); else subtractVal = superClus.get()->rawEnergy(); if(subtract_) isoValue-= subtractVal; retV[i]=isoValue; //all done, isolation is now in the map }//end of loop over em objects filler.insert(emObjectHandle,retV.begin(),retV.end()); filler.fill(); //std::auto_ptr<reco::CandViewDoubleAssociations> isolMap(isoMap); iEvent.put(isoMap); }
Definition at line 66 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer().
Definition at line 46 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
Definition at line 45 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
Definition at line 48 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
Definition at line 47 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
double EgammaEcalRecHitIsolationProducer::egIsoConeSizeInBarrel_ [private] |
Definition at line 55 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
double EgammaEcalRecHitIsolationProducer::egIsoConeSizeInEndcap_ [private] |
Definition at line 56 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
double EgammaEcalRecHitIsolationProducer::egIsoConeSizeOut_ [private] |
Definition at line 54 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
double EgammaEcalRecHitIsolationProducer::egIsoEMinBarrel_ [private] |
Definition at line 51 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
double EgammaEcalRecHitIsolationProducer::egIsoEMinEndcap_ [private] |
Definition at line 53 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
double EgammaEcalRecHitIsolationProducer::egIsoJurassicWidth_ [private] |
Definition at line 57 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
double EgammaEcalRecHitIsolationProducer::egIsoPtMinBarrel_ [private] |
Definition at line 50 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
double EgammaEcalRecHitIsolationProducer::egIsoPtMinEndcap_ [private] |
Definition at line 52 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
Definition at line 44 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
bool EgammaEcalRecHitIsolationProducer::subtract_ [private] |
Definition at line 61 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
bool EgammaEcalRecHitIsolationProducer::tryBoth_ [private] |
Definition at line 60 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
bool EgammaEcalRecHitIsolationProducer::useIsolEt_ [private] |
Definition at line 59 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
bool EgammaEcalRecHitIsolationProducer::useNumCrystals_ [private] |
Definition at line 63 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().
bool EgammaEcalRecHitIsolationProducer::vetoClustered_ [private] |
Definition at line 64 of file EgammaEcalRecHitIsolationProducer.h.
Referenced by EgammaEcalRecHitIsolationProducer(), and produce().