![]() |
![]() |
#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 | applyEnergyCorrection_ |
EgammaSCEnergyCorrectionAlgo * | energyCorrector_ |
double | etThresh_ |
std::string | outputCollection_ |
edm::InputTag | rHInputProducer_ |
reco::AlgoId | sCAlgo_ |
edm::InputTag | sCInputProducer_ |
double | sigmaElectronicNoise_ |
EgammaSCEnergyCorrectionAlgo::VerbosityLevel | verbosity_ |
Definition at line 32 of file EgammaSCCorrectionMaker.h.
EgammaSCCorrectionMaker::EgammaSCCorrectionMaker | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 21 of file EgammaSCCorrectionMaker.cc.
References applyEnergyCorrection_, reco::dynamicHybrid, energyCorrector_, etThresh_, edm::ParameterSet::getParameter(), reco::hybrid, reco::island, reco::multi5x5, outputCollection_, EgammaSCEnergyCorrectionAlgo::pDEBUG, EgammaSCEnergyCorrectionAlgo::pERROR, EgammaSCEnergyCorrectionAlgo::pINFO, rHInputProducer_, sCAlgo_, sCInputProducer_, sigmaElectronicNoise_, and verbosity_.
00022 { 00023 00024 // The verbosity level 00025 std::string debugString = ps.getParameter<std::string>("VerbosityLevel"); 00026 if (debugString == "DEBUG") verbosity_ = EgammaSCEnergyCorrectionAlgo::pDEBUG; 00027 else if (debugString == "INFO") verbosity_ = EgammaSCEnergyCorrectionAlgo::pINFO; 00028 else verbosity_ = EgammaSCEnergyCorrectionAlgo::pERROR; 00029 00030 // the input producers 00031 rHInputProducer_ = ps.getParameter<edm::InputTag>("recHitProducer"); 00032 sCInputProducer_ = ps.getParameter<edm::InputTag>("rawSuperClusterProducer"); 00033 std::string sCAlgo_str = ps.getParameter<std::string>("superClusterAlgo"); 00034 00035 // determine which BasicCluster algo we are correcting for 00036 //And obtain forrection parameters form cfg file 00037 edm::ParameterSet fCorrPset; 00038 if (sCAlgo_str=="Hybrid") { 00039 sCAlgo_= reco::hybrid; 00040 fCorrPset = ps.getParameter<edm::ParameterSet>("hyb_fCorrPset"); 00041 } else if (sCAlgo_str=="Island") { 00042 sCAlgo_= reco::island; 00043 fCorrPset = ps.getParameter<edm::ParameterSet>("isl_fCorrPset"); 00044 } else if (sCAlgo_str=="DynamicHybrid") { 00045 sCAlgo_ = reco::dynamicHybrid; 00046 fCorrPset = ps.getParameter<edm::ParameterSet>("dyn_fCorrPset"); 00047 } else if (sCAlgo_str=="Multi5x5") { 00048 sCAlgo_ = reco::multi5x5; 00049 fCorrPset = ps.getParameter<edm::ParameterSet>("fix_fCorrPset"); 00050 } else { 00051 edm::LogError("EgammaSCCorrectionMakerError") 00052 << "Error! SuperClusterAlgo in config file must be Hybrid or Island: " 00053 << sCAlgo_str << " Using Hybrid by default"; 00054 sCAlgo_=reco::hybrid; 00055 } 00056 00057 // set correction algo parameters 00058 applyEnergyCorrection_ = ps.getParameter<bool>("applyEnergyCorrection"); 00059 sigmaElectronicNoise_ = ps.getParameter<double>("sigmaElectronicNoise"); 00060 00061 etThresh_ = ps.getParameter<double>("etThresh"); 00062 00063 // set the producer parameters 00064 outputCollection_ = ps.getParameter<std::string>("corectedSuperClusterCollection"); 00065 produces<reco::SuperClusterCollection>(outputCollection_); 00066 00067 // instanciate the correction algo object 00068 energyCorrector_ = new EgammaSCEnergyCorrectionAlgo(sigmaElectronicNoise_, sCAlgo_, fCorrPset, verbosity_); 00069 }
EgammaSCCorrectionMaker::~EgammaSCCorrectionMaker | ( | ) |
Definition at line 71 of file EgammaSCCorrectionMaker.cc.
References energyCorrector_.
00072 { 00073 delete energyCorrector_; 00074 }
void EgammaSCCorrectionMaker::produce | ( | edm::Event & | evt, | |
const edm::EventSetup & | es | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 77 of file EgammaSCCorrectionMaker.cc.
References EgammaSCEnergyCorrectionAlgo::applyCorrection(), applyEnergyCorrection_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, reco::CaloCluster::energy(), energyCorrector_, etThresh_, edm::EventSetup::get(), edm::Event::getByLabel(), CaloGeometry::getSubdetectorGeometry(), reco_application_tbsim_simpleTBanalysis_cfg::hitCollection, edm::InputTag::instance(), edm::InputTag::label(), outputCollection_, reco::CaloCluster::position(), edm::Event::put(), rHInputProducer_, sCAlgo_, sCInputProducer_, and funct::sin().
00078 { 00079 using namespace edm; 00080 00081 // get the collection geometry: 00082 edm::ESHandle<CaloGeometry> geoHandle; 00083 es.get<CaloGeometryRecord>().get(geoHandle); 00084 const CaloGeometry& geometry = *geoHandle; 00085 const CaloSubdetectorGeometry *geometry_p; 00086 00087 std::string rHInputCollection = rHInputProducer_.instance(); 00088 if(rHInputCollection == "EcalRecHitsEB") { 00089 geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); 00090 } else if(rHInputCollection == "EcalRecHitsEE") { 00091 geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap); 00092 } else if(rHInputCollection == "EcalRecHitsPS") { 00093 geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower); 00094 } else { 00095 std::string str = "\n\nSCCorrectionMaker encountered invalied ecalhitcollection type: " + rHInputCollection + ".\n\n"; 00096 throw(std::runtime_error( str.c_str() )); 00097 } 00098 00099 // Get raw SuperClusters from the event 00100 Handle<reco::SuperClusterCollection> pRawSuperClusters; 00101 try { 00102 evt.getByLabel(sCInputProducer_, pRawSuperClusters); 00103 } catch ( cms::Exception& ex ) { 00104 edm::LogError("EgammaSCCorrectionMakerError") 00105 << "Error! can't get the rawSuperClusters " 00106 << sCInputProducer_.label() ; 00107 } 00108 00109 // Get the RecHits from the event 00110 Handle<EcalRecHitCollection> pRecHits; 00111 try { 00112 evt.getByLabel(rHInputProducer_, pRecHits); 00113 } catch ( cms::Exception& ex ) { 00114 edm::LogError("EgammaSCCorrectionMakerError") 00115 << "Error! can't get the RecHits " 00116 << rHInputProducer_.label(); 00117 } 00118 00119 // Create a pointer to the RecHits and raw SuperClusters 00120 const EcalRecHitCollection *hitCollection = pRecHits.product(); 00121 const reco::SuperClusterCollection *rawClusters = pRawSuperClusters.product(); 00122 00123 // Define a collection of corrected SuperClusters to put back into the event 00124 std::auto_ptr<reco::SuperClusterCollection> corrClusters(new reco::SuperClusterCollection); 00125 00126 // Loop over raw clusters and make corrected ones 00127 reco::SuperClusterCollection::const_iterator aClus; 00128 for(aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++) 00129 { 00130 reco::SuperCluster newClus; 00131 if(applyEnergyCorrection_) { 00132 newClus = energyCorrector_->applyCorrection(*aClus, *hitCollection, sCAlgo_, geometry_p); 00133 } 00134 00135 if(newClus.energy()*sin(newClus.position().theta())>etThresh_) { 00136 //and corrected energy of SC before placing SCs in collection 00137 //std::cout << " Check 1 " << "\n" 00138 // << " Parameters of corrected SCs " << "\n" 00139 // << " energy = " << newClus.energy() <<"\n" 00140 // << " pw = " << newClus.phiWidth() << "\n" 00141 // << " ew = " << newClus.etaWidth() << std::endl; 00142 00143 corrClusters->push_back(newClus); 00144 } 00145 } 00146 // Put collection of corrected SuperClusters into the event 00147 evt.put(corrClusters, outputCollection_); 00148 00149 }
Definition at line 48 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
Definition at line 45 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), produce(), and ~EgammaSCCorrectionMaker().
double EgammaSCCorrectionMaker::etThresh_ [private] |
Definition at line 51 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
std::string EgammaSCCorrectionMaker::outputCollection_ [private] |
Definition at line 58 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
Definition at line 54 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
reco::AlgoId EgammaSCCorrectionMaker::sCAlgo_ [private] |
Definition at line 57 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
Definition at line 55 of file EgammaSCCorrectionMaker.h.
Referenced by EgammaSCCorrectionMaker(), and produce().
double EgammaSCCorrectionMaker::sigmaElectronicNoise_ [private] |