CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HiSpikeCleaner Class Reference

#include <RecoHI/HiSpikeCleaner/src/HiSpikeCleaner.cc>

Inheritance diagram for HiSpikeCleaner:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 HiSpikeCleaner (const edm::ParameterSet &)
 ~HiSpikeCleaner ()

Private Member Functions

virtual void beginJob ()
virtual void endJob ()
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

double etCut_
std::string outputCollection_
edm::InputTag rHInputProducerB_
edm::InputTag rHInputProducerE_
edm::InputTag sCInputProducer_
double swissCutThr_
double TimingCut_

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 50 of file HiSpikeCleaner.cc.


Constructor & Destructor Documentation

HiSpikeCleaner::HiSpikeCleaner ( const edm::ParameterSet iConfig) [explicit]

Definition at line 85 of file HiSpikeCleaner.cc.

References etCut_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), outputCollection_, rHInputProducerB_, rHInputProducerE_, sCInputProducer_, swissCutThr_, and TimingCut_.

{
   //register your products
/* Examples
   produces<ExampleData2>();

   //if do put with a label
   produces<ExampleData2>("label");
*/
   //now do what ever other initialization is needed
   
   rHInputProducerB_  = iConfig.getParameter<edm::InputTag>("recHitProducerBarrel");
   rHInputProducerE_  = iConfig.getParameter<edm::InputTag>("recHitProducerEndcap");

   sCInputProducer_  = iConfig.getParameter<edm::InputTag>("originalSuperClusterProducer");
   TimingCut_      = iConfig.getUntrackedParameter<double>  ("TimingCut",4.0);
   swissCutThr_      = iConfig.getUntrackedParameter<double>("swissCutThr",0.95);
   etCut_            = iConfig.getParameter<double>("etCut");
   
   outputCollection_ = iConfig.getParameter<std::string>("outputColl");
   produces<reco::SuperClusterCollection>(outputCollection_);
   
   
   
}
HiSpikeCleaner::~HiSpikeCleaner ( )

Definition at line 112 of file HiSpikeCleaner.cc.

{
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)
}

Member Function Documentation

void HiSpikeCleaner::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 234 of file HiSpikeCleaner.cc.

{
}
void HiSpikeCleaner::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 240 of file HiSpikeCleaner.cc.

                       {
}
void HiSpikeCleaner::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 125 of file HiSpikeCleaner.cc.

References etCut_, funct::false, edm::SortedCollection< T, SORT >::find(), edm::EventSetup::get(), edm::Event::getByLabel(), EcalClusterLazyTools::getMaximum(), edm::InputTag::label(), outputCollection_, edm::Event::put(), rHInputProducerB_, rHInputProducerE_, sCInputProducer_, EcalSeverityLevelAlgo::severityLevel(), EcalSeverityLevelAlgo::swissCross(), swissCutThr_, and TimingCut_.

{
   using namespace edm;


   // Get raw SuperClusters from the event    
   Handle<reco::SuperClusterCollection> pRawSuperClusters;
   try { 
      iEvent.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> pRecHitsB;
   try { 
      iEvent.getByLabel(rHInputProducerB_, pRecHitsB);
   } catch ( cms::Exception& ex ) {
      edm::LogError("EgammaSCCorrectionMakerError") 
         << "Error! can't get the RecHits " 
         << rHInputProducerB_.label();
   }    
   // Get the RecHits from the event                                                                                                            
   Handle<EcalRecHitCollection> pRecHitsE;
   try {
      iEvent.getByLabel(rHInputProducerE_, pRecHitsE);
   } catch ( cms::Exception& ex ) {
      edm::LogError("EgammaSCCorrectionMakerError")
         << "Error! can't get the RecHits "
         << rHInputProducerE_.label();
   }

   
   // get the channel status from the DB                                                                                                     
   edm::ESHandle<EcalChannelStatus> chStatus;
   iSetup.get<EcalChannelStatusRcd>().get(chStatus);
   
   
   
   // Create a pointer to the RecHits and raw SuperClusters
   const reco::SuperClusterCollection *rawClusters = pRawSuperClusters.product();
   
   
   EcalClusterLazyTools lazyTool(iEvent, iSetup, rHInputProducerB_,rHInputProducerE_);

   // 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++)
      {
         double theEt = aClus->energy()/cosh( aClus->eta() ) ;
         //      std::cout << " et of SC = " << theEt << std::endl;

         if ( theEt < etCut_ )  continue;   // cut off low pT superclusters 
         
         bool flagS = true;
         int severity(-100);
         float swissCrx(0);
         
         const reco::CaloClusterPtr seed = aClus->seed();
         DetId id = lazyTool.getMaximum(*seed).first;
         const EcalRecHitCollection & rechits = *pRecHitsB;
         EcalRecHitCollection::const_iterator it = rechits.find( id );
         
         if( it != rechits.end() ) {
            severity = EcalSeverityLevelAlgo::severityLevel(id, rechits, *chStatus );
            swissCrx = EcalSeverityLevelAlgo::swissCross   (id, rechits, 0.,true);
            //      std::cout << "swissCross = " << swissCrx <<std::endl;
            // std::cout << " timing = " << it->time() << std::endl;
         }
         
         if ( fabs(it->time()) > TimingCut_ ) {
            flagS = false;
            //      std::cout << " timing = " << it->time() << std::endl;
            //   std::cout << " timing is bad........" << std::endl; 
         }
         if ( swissCrx > (float)swissCutThr_ ) {
            flagS = false ;     // swissCross cut
            //      std::cout << "swissCross = " << swissCrx <<std::endl;   
            //   std::cout << " removed by swiss cross cut" << std::endl;
         }
         // - kGood        --> good channel
         // - kProblematic --> problematic (e.g. noisy)
         // - kRecovered   --> recovered (e.g. an originally dead or saturated)
         // - kTime        --> the channel is out of time (e.g. spike)
         // - kWeird       --> weird (e.g. spike)
         // - kBad         --> bad, not suitable to be used in the reconstruction
         //   enum EcalSeverityLevel { kGood=0, kProblematic, kRecovered, kTime, kWeird, kBad };
            
         
         reco::SuperCluster newClus;
         if ( flagS == true)
            newClus=*aClus;
         else
            continue;
         corrClusters->push_back(newClus);
      }
   
   // Put collection of corrected SuperClusters into the event
   iEvent.put(corrClusters, outputCollection_);   
   
}

Member Data Documentation

double HiSpikeCleaner::etCut_ [private]

Definition at line 69 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

std::string HiSpikeCleaner::outputCollection_ [private]

Definition at line 66 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

Definition at line 63 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

Definition at line 64 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

Definition at line 62 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

double HiSpikeCleaner::swissCutThr_ [private]

Definition at line 68 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

double HiSpikeCleaner::TimingCut_ [private]

Definition at line 67 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().