CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/RecoEgamma/EgammaHLTProducers/src/EgammaHLTClusterShapeProducer.cc

Go to the documentation of this file.
00001 
00009 #include "RecoEgamma/EgammaHLTProducers/interface/EgammaHLTClusterShapeProducer.h"
00010 
00011 // Framework
00012 #include "FWCore/Framework/interface/Event.h"
00013 #include "FWCore/Framework/interface/EventSetup.h"
00014 #include "DataFormats/Common/interface/Handle.h"
00015 #include "FWCore/Framework/interface/ESHandle.h"
00016 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00017 #include "FWCore/Utilities/interface/Exception.h"
00018 
00019 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
00020 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateIsolation.h"
00021 
00022 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00023 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
00024 
00025 EgammaHLTClusterShapeProducer::EgammaHLTClusterShapeProducer(const edm::ParameterSet& config) : conf_(config)
00026 {
00027  // use configuration file to setup input/output collection names
00028   recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer");
00029 
00030   ecalRechitEBTag_ = conf_.getParameter< edm::InputTag > ("ecalRechitEB");
00031   ecalRechitEETag_ = conf_.getParameter< edm::InputTag > ("ecalRechitEE");
00032   EtaOrIeta_ = conf_.getParameter< bool > ("isIeta");
00033 
00034   //register your products
00035   produces < reco::RecoEcalCandidateIsolationMap >();
00036 }
00037 
00038 
00039 EgammaHLTClusterShapeProducer::~EgammaHLTClusterShapeProducer(){}
00040 
00041 
00042 //
00043 // member functions
00044 //
00045 
00046 // ------------ method called to produce the data  ------------
00047 void
00048 EgammaHLTClusterShapeProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00049 {
00050   
00051   // Get the HLT filtered objects
00052   edm::Handle<reco::RecoEcalCandidateCollection> recoecalcandHandle;
00053   iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);
00054 
00055   EcalClusterLazyTools lazyTools( iEvent, iSetup, ecalRechitEBTag_, ecalRechitEETag_ );
00056   
00057   reco::RecoEcalCandidateIsolationMap clshMap;
00058    
00059   for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
00060     
00061     reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin());
00062     
00063     std::vector<float> vCov ; 
00064     double sigmaee;
00065     if (EtaOrIeta_) {
00066       vCov = lazyTools.localCovariances( *(recoecalcandref->superCluster()->seed()) );
00067       sigmaee = sqrt(vCov[0]);
00068     } else {
00069       vCov = lazyTools.covariances( *(recoecalcandref->superCluster()->seed()) );
00070       sigmaee = sqrt(vCov[0]);
00071       double EtaSC = recoecalcandref->eta();
00072       if (EtaSC > 1.479) sigmaee = sigmaee - 0.02*(EtaSC - 2.3); 
00073     }
00074 
00075     clshMap.insert(recoecalcandref, sigmaee);
00076     
00077   }
00078 
00079   std::auto_ptr<reco::RecoEcalCandidateIsolationMap> clushMap(new reco::RecoEcalCandidateIsolationMap(clshMap));
00080   iEvent.put(clushMap);
00081 
00082 }
00083 
00084 //define this as a plug-in
00085 //DEFINE_FWK_MODULE(EgammaHLTClusterShapeProducer);