#include <RecoHI/HiSpikeCleaner/src/HiSpikeCleaner.cc>
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_ |
Description: [one line class summary]
Implementation: [Notes on implementation]
Definition at line 50 of file HiSpikeCleaner.cc.
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.) }
void HiSpikeCleaner::beginJob | ( | void | ) | [private, virtual] |
void HiSpikeCleaner::endJob | ( | void | ) | [private, virtual] |
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::EventSetup::get(), edm::Event::getByLabel(), EcalClusterLazyTools::getMaximum(), edm::InputTag::label(), outputCollection_, edm::Event::put(), HI_PhotonSkim_cff::rechits, rHInputProducerB_, rHInputProducerE_, sCInputProducer_, EcalTools::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); edm::ESHandle<EcalSeverityLevelAlgo> ecalSevLvlAlgoHndl; iSetup.get<EcalSeverityLevelAlgoRcd>().get(ecalSevLvlAlgoHndl); // 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; 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() ) { ecalSevLvlAlgoHndl->severityLevel(id, rechits); swissCrx = EcalTools::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_); }
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().