#include <EgammaSCCorrectionMaker/EgammaSCCorrectionMaker/src/EgammaSCCorrectionMaker.cc>
Public Member Functions | |
EgammaSCCorrectionMaker (const edm::ParameterSet &) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
~EgammaSCCorrectionMaker () | |
Private Attributes | |
bool | applyCrackCorrection_ |
bool | applyEnergyCorrection_ |
EcalClusterFunctionBaseClass * | crackCorrectionFunction_ |
EcalClusterFunctionBaseClass * | energyCorrectionFunction_ |
EgammaSCEnergyCorrectionAlgo * | energyCorrector_ |
double | etThresh_ |
std::string | outputCollection_ |
edm::InputTag | rHInputProducer_ |
reco::CaloCluster::AlgoId | sCAlgo_ |
edm::InputTag | sCInputProducer_ |
double | sigmaElectronicNoise_ |
EgammaSCEnergyCorrectionAlgo::VerbosityLevel | verbosity_ |
Description: Producer of corrected SuperClusters
Definition at line 35 of file EgammaSCCorrectionMaker.h.
EgammaSCCorrectionMaker::EgammaSCCorrectionMaker | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 24 of file EgammaSCCorrectionMaker.cc.
References applyCrackCorrection_, applyEnergyCorrection_, crackCorrectionFunction_, reco::CaloCluster::dynamicHybrid, energyCorrectionFunction_, energyCorrector_, etThresh_, reco::get(), edm::ParameterSet::getParameter(), reco::CaloCluster::hybrid, reco::CaloCluster::island, reco::CaloCluster::multi5x5, outputCollection_, EgammaSCEnergyCorrectionAlgo::pDEBUG, EgammaSCEnergyCorrectionAlgo::pERROR, EgammaSCEnergyCorrectionAlgo::pINFO, rHInputProducer_, sCAlgo_, sCInputProducer_, sigmaElectronicNoise_, and verbosity_.
{ // The verbosity level std::string debugString = ps.getParameter<std::string>("VerbosityLevel"); if (debugString == "DEBUG") verbosity_ = EgammaSCEnergyCorrectionAlgo::pDEBUG; else if (debugString == "INFO") verbosity_ = EgammaSCEnergyCorrectionAlgo::pINFO; else verbosity_ = EgammaSCEnergyCorrectionAlgo::pERROR; // the input producers rHInputProducer_ = ps.getParameter<edm::InputTag>("recHitProducer"); sCInputProducer_ = ps.getParameter<edm::InputTag>("rawSuperClusterProducer"); std::string sCAlgo_str = ps.getParameter<std::string>("superClusterAlgo"); // determine which BasicCluster algo we are correcting for //And obtain forrection parameters form cfg file edm::ParameterSet fCorrPset; if (sCAlgo_str=="Hybrid") { sCAlgo_= reco::CaloCluster::hybrid; fCorrPset = ps.getParameter<edm::ParameterSet>("hyb_fCorrPset"); } else if (sCAlgo_str=="Island") { sCAlgo_= reco::CaloCluster::island; fCorrPset = ps.getParameter<edm::ParameterSet>("isl_fCorrPset"); } else if (sCAlgo_str=="DynamicHybrid") { sCAlgo_ = reco::CaloCluster::dynamicHybrid; fCorrPset = ps.getParameter<edm::ParameterSet>("dyn_fCorrPset"); } else if (sCAlgo_str=="Multi5x5") { sCAlgo_ = reco::CaloCluster::multi5x5; fCorrPset = ps.getParameter<edm::ParameterSet>("fix_fCorrPset"); } else { edm::LogError("EgammaSCCorrectionMakerError") << "Error! SuperClusterAlgo in config file must be Hybrid or Island: " << sCAlgo_str << " Using Hybrid by default"; sCAlgo_=reco::CaloCluster::hybrid; } // set correction algo parameters applyEnergyCorrection_ = ps.getParameter<bool>("applyEnergyCorrection"); applyCrackCorrection_ = ps.getParameter<bool>("applyCrackCorrection"); sigmaElectronicNoise_ = ps.getParameter<double>("sigmaElectronicNoise"); etThresh_ = ps.getParameter<double>("etThresh"); // set the producer parameters outputCollection_ = ps.getParameter<std::string>("corectedSuperClusterCollection"); produces<reco::SuperClusterCollection>(outputCollection_); // instanciate the correction algo object energyCorrector_ = new EgammaSCEnergyCorrectionAlgo(sigmaElectronicNoise_, sCAlgo_, fCorrPset, verbosity_); // energy correction class if (applyEnergyCorrection_ ) energyCorrectionFunction_ = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyCorrection", ps); else energyCorrectionFunction_=0; if (applyCrackCorrection_ ) crackCorrectionFunction_ = EcalClusterFunctionFactory::get()->create("EcalClusterCrackCorrection", ps); else crackCorrectionFunction_=0; }
EgammaSCCorrectionMaker::~EgammaSCCorrectionMaker | ( | ) |
Definition at line 88 of file EgammaSCCorrectionMaker.cc.
References crackCorrectionFunction_, energyCorrectionFunction_, and energyCorrector_.
{ if (energyCorrectionFunction_) delete energyCorrectionFunction_; if (crackCorrectionFunction_) delete crackCorrectionFunction_; delete energyCorrector_; }
void EgammaSCCorrectionMaker::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 96 of file EgammaSCCorrectionMaker.cc.
References EgammaSCEnergyCorrectionAlgo::applyCorrection(), EgammaSCEnergyCorrectionAlgo::applyCrackCorrection(), applyCrackCorrection_, applyEnergyCorrection_, crackCorrectionFunction_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, reco::CaloCluster::energy(), energyCorrectionFunction_, energyCorrector_, etThresh_, geometry, edm::EventSetup::get(), edm::Event::getByLabel(), reco_application_2006_simpleTBanalysis_cfg::hitCollection, EcalClusterFunctionBaseClass::init(), edm::InputTag::instance(), edm::InputTag::label(), outputCollection_, reco::CaloCluster::position(), edm::Event::put(), rHInputProducer_, sCAlgo_, sCInputProducer_, and funct::sin().
{ using namespace edm; // initialize energy correction class if(applyEnergyCorrection_) energyCorrectionFunction_->init(es); // initialize energy correction class if(applyCrackCorrection_) crackCorrectionFunction_->init(es); // get the collection geometry: edm::ESHandle<CaloGeometry> geoHandle; es.get<CaloGeometryRecord>().get(geoHandle); const CaloGeometry& geometry = *geoHandle; const CaloSubdetectorGeometry *geometry_p; std::string rHInputCollection = rHInputProducer_.instance(); if(rHInputCollection == "EcalRecHitsEB") { geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); } else if(rHInputCollection == "EcalRecHitsEE") { geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap); } else if(rHInputCollection == "EcalRecHitsPS") { geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower); } else { std::string str = "\n\nSCCorrectionMaker encountered invalied ecalhitcollection type: " + rHInputCollection + ".\n\n"; throw(std::runtime_error( str.c_str() )); } // Get raw SuperClusters from the event Handle<reco::SuperClusterCollection> pRawSuperClusters; try { evt.getByLabel(sCInputProducer_, pRawSuperClusters); } catch ( cms::Exception& ex ) { edm::LogError("EgammaSCCorrectionMakerError") << "Error! can't get the rawSuperClusters " << sCInputProducer_.label() ; } // Get the RecHits from the event Handle<EcalRecHitCollection> pRecHits; try { evt.getByLabel(rHInputProducer_, pRecHits); } catch ( cms::Exception& ex ) { edm::LogError("EgammaSCCorrectionMakerError") << "Error! can't get the RecHits " << rHInputProducer_.label(); } // Create a pointer to the RecHits and raw SuperClusters const EcalRecHitCollection *hitCollection = pRecHits.product(); const reco::SuperClusterCollection *rawClusters = pRawSuperClusters.product(); // Define a collection of corrected SuperClusters to put back into the event std::auto_ptr<reco::SuperClusterCollection> corrClusters(new reco::SuperClusterCollection); // Loop over raw clusters and make corrected ones reco::SuperClusterCollection::const_iterator aClus; for(aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++) { reco::SuperCluster enecorrClus,crackcorrClus; if(applyEnergyCorrection_) enecorrClus = energyCorrector_->applyCorrection(*aClus, *hitCollection, sCAlgo_, geometry_p, energyCorrectionFunction_); else enecorrClus=*aClus; if(applyCrackCorrection_) crackcorrClus=energyCorrector_->applyCrackCorrection(enecorrClus,crackCorrectionFunction_); else crackcorrClus=enecorrClus; if(crackcorrClus.energy()*sin(crackcorrClus.position().theta())>etThresh_) { corrClusters->push_back(crackcorrClus); } } // Put collection of corrected SuperClusters into the event evt.put(corrClusters, outputCollection_); }
bool EgammaSCCorrectionMaker::applyCrackCorrection_ [private] |
Definition at line 57 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
bool EgammaSCCorrectionMaker::applyEnergyCorrection_ [private] |
Definition at line 56 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
Definition at line 45 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), produce(), and ~EgammaSCCorrectionMaker().
Definition at line 44 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), produce(), and ~EgammaSCCorrectionMaker().
Definition at line 51 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), produce(), and ~EgammaSCCorrectionMaker().
double EgammaSCCorrectionMaker::etThresh_ [private] |
Definition at line 61 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
std::string EgammaSCCorrectionMaker::outputCollection_ [private] |
Definition at line 68 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
Definition at line 64 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
Definition at line 67 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
Definition at line 65 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
double EgammaSCCorrectionMaker::sigmaElectronicNoise_ [private] |
Definition at line 60 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker().
Definition at line 48 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker().