CMS 3D CMS Logo

EgammaHLTRemoveDuplicatedSC Class Reference

#include <RecoEgamma/EgammaHLTProducers/interface/EgammaHLTRemoveDuplicatedSC.h>

Inheritance diagram for EgammaHLTRemoveDuplicatedSC:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 EgammaHLTRemoveDuplicatedSC (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~EgammaHLTRemoveDuplicatedSC ()

Private Attributes

edm::InputTag alreadyExistingSC_
std::string outputCollection_
edm::InputTag sCInputProducer_


Detailed Description

Definition at line 25 of file EgammaHLTRemoveDuplicatedSC.h.


Constructor & Destructor Documentation

EgammaHLTRemoveDuplicatedSC::EgammaHLTRemoveDuplicatedSC ( const edm::ParameterSet ps  )  [explicit]

Definition at line 14 of file EgammaHLTRemoveDuplicatedSC.cc.

References alreadyExistingSC_, edm::ParameterSet::getParameter(), outputCollection_, and sCInputProducer_.

00015 {
00016  
00017  
00018   // the input producers
00019 
00020   sCInputProducer_ = ps.getParameter<edm::InputTag>("L1NonIsoUskimmedSC");
00021   alreadyExistingSC_= ps.getParameter<edm::InputTag>("L1IsoSC");
00022   // set the producer parameters
00023   outputCollection_ = ps.getParameter<std::string>("L1NonIsoSkimmedCollection");
00024   produces<reco::SuperClusterCollection>(outputCollection_);
00025 
00026   
00027 }

EgammaHLTRemoveDuplicatedSC::~EgammaHLTRemoveDuplicatedSC (  ) 

Definition at line 29 of file EgammaHLTRemoveDuplicatedSC.cc.

00030 {
00031   ;
00032 }


Member Function Documentation

void EgammaHLTRemoveDuplicatedSC::produce ( edm::Event evt,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 35 of file EgammaHLTRemoveDuplicatedSC.cc.

References alreadyExistingSC_, edm::Event::getByLabel(), outputCollection_, edm::Event::put(), and sCInputProducer_.

00036 {
00037   using namespace edm;
00038 
00039  
00040   // Get raw SuperClusters from the event    
00041   Handle<reco::SuperClusterCollection> UnskimmedSuperCluster;
00042   evt.getByLabel(sCInputProducer_, UnskimmedSuperCluster);
00043   Handle<reco::SuperClusterCollection> L1IsoSuperCluster;
00044   evt.getByLabel(alreadyExistingSC_, L1IsoSuperCluster);
00045   /*
00046     edm::LogError("EgammaHLTRemoveDuplicatedSCError") 
00047       << "Error! can't get the rawSuperClusters " 
00048       << sCInputProducer_.label() ;
00049   */
00050   
00051 
00052   // Create a pointer to the existing SuperClusters
00053     const reco::SuperClusterCollection *UnskimmedL1NonIsoSC = UnskimmedSuperCluster.product();
00054     const reco::SuperClusterCollection *L1IsoSC = L1IsoSuperCluster.product();
00055 
00056     /*
00057     for(reco::SuperClusterCollection::const_iterator it = L1IsoSC->begin(); it != L1IsoSC->end(); it++){
00058       std::cout<<"L1 iso  E, eta, phi: "<<it->energy()<<" "<<it->eta()<<" "<<it->phi()<<std::endl;
00059     }
00060     std::cout<<std::endl;
00061     for(reco::SuperClusterCollection::const_iterator it = UnskimmedL1NonIsoSC->begin(); it != UnskimmedL1NonIsoSC->end(); it++){
00062       std::cout<<"L1 Non iso (not skimmed) E, eta, phi: "<<it->energy()<<" "<<it->eta()<<" "<<it->phi()<<std::endl;
00063     }
00064     std::cout<<std::endl;
00065     */
00066 
00067   // Define a collection of corrected SuperClusters to put back into the event
00068   std::auto_ptr<reco::SuperClusterCollection> corrClusters(new reco::SuperClusterCollection);
00069   
00070   //  Loop over raw clusters and make corrected ones
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       //reco::SuperCluster newClus;
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       // if(AlreadyThere){std::cout<<"AAAA: SC removed: "<<aClus->energy()<<" "<<aClus->eta()<<" "<<aClus->phi()<<std::endl;}
00087       if(!AlreadyThere){corrClusters->push_back(*aClus);}
00088     }
00089 
00090   // Put collection of corrected SuperClusters into the event
00091   evt.put(corrClusters, outputCollection_);   
00092   
00093 }


Member Data Documentation

edm::InputTag EgammaHLTRemoveDuplicatedSC::alreadyExistingSC_ [private]

Definition at line 35 of file EgammaHLTRemoveDuplicatedSC.h.

Referenced by EgammaHLTRemoveDuplicatedSC(), and produce().

std::string EgammaHLTRemoveDuplicatedSC::outputCollection_ [private]

Definition at line 36 of file EgammaHLTRemoveDuplicatedSC.h.

Referenced by EgammaHLTRemoveDuplicatedSC(), and produce().

edm::InputTag EgammaHLTRemoveDuplicatedSC::sCInputProducer_ [private]

Definition at line 34 of file EgammaHLTRemoveDuplicatedSC.h.

Referenced by EgammaHLTRemoveDuplicatedSC(), and produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:11 2009 for CMSSW by  doxygen 1.5.4