Go to the documentation of this file.00001 #include "RecoEgamma/EgammaHLTProducers/interface/EgammaHLTRemoveDuplicatedSC.h"
00002 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00003 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00004 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00005 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
00006 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00007
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 #include "FWCore/Utilities/interface/Exception.h"
00010 #include "DataFormats/Common/interface/Handle.h"
00011
00012 #include <string>
00013
00014 EgammaHLTRemoveDuplicatedSC::EgammaHLTRemoveDuplicatedSC(const edm::ParameterSet& ps)
00015 {
00016
00017
00018
00019
00020 sCInputProducer_ = ps.getParameter<edm::InputTag>("L1NonIsoUskimmedSC");
00021 alreadyExistingSC_= ps.getParameter<edm::InputTag>("L1IsoSC");
00022
00023 outputCollection_ = ps.getParameter<std::string>("L1NonIsoSkimmedCollection");
00024 produces<reco::SuperClusterCollection>(outputCollection_);
00025
00026
00027 }
00028
00029 EgammaHLTRemoveDuplicatedSC::~EgammaHLTRemoveDuplicatedSC()
00030 {
00031 ;
00032 }
00033
00034 void
00035 EgammaHLTRemoveDuplicatedSC::produce(edm::Event& evt, const edm::EventSetup& es)
00036 {
00037 using namespace edm;
00038
00039
00040
00041 Handle<reco::SuperClusterCollection> UnskimmedSuperCluster;
00042 evt.getByLabel(sCInputProducer_, UnskimmedSuperCluster);
00043 Handle<reco::SuperClusterCollection> L1IsoSuperCluster;
00044 evt.getByLabel(alreadyExistingSC_, L1IsoSuperCluster);
00045
00046
00047
00048
00049
00050
00051
00052
00053 const reco::SuperClusterCollection *UnskimmedL1NonIsoSC = UnskimmedSuperCluster.product();
00054 const reco::SuperClusterCollection *L1IsoSC = L1IsoSuperCluster.product();
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 std::auto_ptr<reco::SuperClusterCollection> corrClusters(new reco::SuperClusterCollection);
00069
00070
00071 reco::SuperClusterCollection::const_iterator aClus;
00072 reco::SuperClusterCollection::const_iterator cit;
00073 for(aClus = UnskimmedL1NonIsoSC->begin(); aClus != UnskimmedL1NonIsoSC->end(); aClus++)
00074 {
00075 bool AlreadyThere = false;
00076
00077 for(cit = L1IsoSC->begin(); cit != L1IsoSC->end(); cit++){
00078 if( fabs(aClus->energy()- cit->energy()) < 0.5 && fabs(aClus->eta()- cit->eta()) < 0.0175 ){
00079 float deltaphi=fabs( aClus->phi() - cit->phi() );
00080 if(deltaphi>6.283185308) deltaphi -= 6.283185308;
00081 if(deltaphi>3.141592654) deltaphi = 6.283185308-deltaphi;
00082
00083 if( deltaphi < 0.035 ){AlreadyThere = true; break;}
00084 }
00085 }
00086
00087 if(!AlreadyThere){corrClusters->push_back(*aClus);}
00088 }
00089
00090
00091 evt.put(corrClusters, outputCollection_);
00092
00093 }
00094
00095
00096