#include <InterestingDetIdCollectionProducer.h>
Public Member Functions | |
void | beginRun (edm::Run &, const edm::EventSetup &) |
InterestingDetIdCollectionProducer (const edm::ParameterSet &) | |
ctor | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
producer | |
~InterestingDetIdCollectionProducer () | |
Private Attributes | |
edm::InputTag | basicClusters_ |
const CaloTopology * | caloTopology_ |
std::string | interestingDetIdCollection_ |
bool | keepNextToBoundary_ |
bool | keepNextToDead_ |
int | minimalEtaSize_ |
int | minimalPhiSize_ |
edm::InputTag | recHitsLabel_ |
const EcalSeverityLevelAlgo * | severity_ |
int | severityLevel_ |
Original author: Paolo Meridiani PH/CMG
Make a collection of detids to be kept tipically in a AOD rechit collection
The following classes of "interesting id" are considered
1.in a region around the seed of the cluster collection specified by paramter basicClusters. The size of the region is specified by minimalEtaSize_, minimalPhiSize_
2. if the severity of the hit is >= severityLevel_ If severityLevel=0 this class is ignored
3. Channels next to dead ones, keepNextToDead_ is true 4. Channels next to the EB/EE transition if keepNextToBoundary_ is true
Definition at line 45 of file InterestingDetIdCollectionProducer.h.
InterestingDetIdCollectionProducer::InterestingDetIdCollectionProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
ctor
Definition at line 26 of file InterestingDetIdCollectionProducer.cc.
References basicClusters_, edm::ParameterSet::getParameter(), interestingDetIdCollection_, keepNextToBoundary_, keepNextToDead_, minimalEtaSize_, minimalPhiSize_, recHitsLabel_, and severityLevel_.
{ recHitsLabel_ = iConfig.getParameter< edm::InputTag > ("recHitsLabel"); basicClusters_ = iConfig.getParameter< edm::InputTag > ("basicClustersLabel"); interestingDetIdCollection_ = iConfig.getParameter<std::string>("interestingDetIdCollection"); minimalEtaSize_ = iConfig.getParameter<int> ("etaSize"); minimalPhiSize_ = iConfig.getParameter<int> ("phiSize"); if ( minimalPhiSize_ % 2 == 0 || minimalEtaSize_ % 2 == 0) edm::LogError("InterestingDetIdCollectionProducerError") << "Size of eta/phi should be odd numbers"; //register your products produces< DetIdCollection > (interestingDetIdCollection_) ; severityLevel_ = iConfig.getParameter<int>("severityLevel"); keepNextToDead_ = iConfig.getParameter<bool>("keepNextToDead"); keepNextToBoundary_ = iConfig.getParameter<bool>("keepNextToBoundary"); }
InterestingDetIdCollectionProducer::~InterestingDetIdCollectionProducer | ( | ) |
Definition at line 48 of file InterestingDetIdCollectionProducer.cc.
{}
void InterestingDetIdCollectionProducer::beginRun | ( | edm::Run & | run, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 51 of file InterestingDetIdCollectionProducer.cc.
References caloTopology_, edm::EventSetup::get(), edm::ESHandle< T >::product(), and severity_.
{ edm::ESHandle<CaloTopology> theCaloTopology; iSetup.get<CaloTopologyRecord>().get(theCaloTopology); caloTopology_ = &(*theCaloTopology); edm::ESHandle<EcalSeverityLevelAlgo> sevLv; iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevLv); severity_ = sevLv.product(); }
void InterestingDetIdCollectionProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
producer
Implements edm::EDProducer.
Definition at line 64 of file InterestingDetIdCollectionProducer.cc.
References abs, basicClusters_, caloTopology_, DetId::det(), EcalBarrel, jptDQMConfig_cff::eMax, CaloRecHit::energy(), first, edm::Event::getByLabel(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), interestingDetIdCollection_, EcalTools::isNextToDead(), EEDetId::isNextToRingBoundary(), keepNextToBoundary_, keepNextToDead_, EcalRecHit::kTPSaturated, minimalEtaSize_, minimalPhiSize_, DetId::null(), edm::Event::put(), recHitsLabel_, severity_, EcalSeverityLevelAlgo::severityLevel(), severityLevel_, python::multivaluedict::sort(), and DetId::subdetId().
{ using namespace edm; using namespace std; // take BasicClusters Handle<reco::BasicClusterCollection> pClusters; iEvent.getByLabel(basicClusters_, pClusters); // take EcalRecHits Handle<EcalRecHitCollection> recHitsHandle; iEvent.getByLabel(recHitsLabel_,recHitsHandle); //Create empty output collections std::vector<DetId> indexToStore; indexToStore.reserve(1000); reco::BasicClusterCollection::const_iterator clusIt; std::vector<DetId> xtalsToStore; xtalsToStore.reserve(50); for (clusIt=pClusters->begin(); clusIt!=pClusters->end(); clusIt++) { //PG barrel float eMax=0.; DetId eMaxId(0); std::vector<std::pair<DetId,float> > clusterDetIds = (*clusIt).hitsAndFractions(); std::vector<std::pair<DetId,float> >::iterator posCurrent; EcalRecHit testEcalRecHit; for(posCurrent = clusterDetIds.begin(); posCurrent != clusterDetIds.end(); posCurrent++) { EcalRecHitCollection::const_iterator itt = recHitsHandle->find((*posCurrent).first); if ((!((*posCurrent).first.null())) && (itt != recHitsHandle->end()) && ((*itt).energy() > eMax) ) { eMax = (*itt).energy(); eMaxId = (*itt).id(); } } if (eMaxId.null()) continue; const CaloSubdetectorTopology* topology = caloTopology_->getSubdetectorTopology(eMaxId.det(),eMaxId.subdetId()); xtalsToStore=topology->getWindow(eMaxId,minimalEtaSize_,minimalPhiSize_); std::vector<std::pair<DetId,float > > xtalsInClus=(*clusIt).hitsAndFractions(); for (unsigned int ii=0;ii<xtalsInClus.size();ii++) { xtalsToStore.push_back(xtalsInClus[ii].first); } indexToStore.insert(indexToStore.end(),xtalsToStore.begin(),xtalsToStore.end()); } for (EcalRecHitCollection::const_iterator it = recHitsHandle->begin(); it != recHitsHandle->end(); ++it) { // also add recHits of dead TT if the corresponding TP is saturated if ( it->checkFlag(EcalRecHit::kTPSaturated) ) { indexToStore.push_back(it->id()); } // add hits for severities above a threshold if ( severityLevel_>=0 && severity_->severityLevel(*it) >=severityLevel_){ indexToStore.push_back(it->id()); } if (keepNextToDead_) { // also keep channels next to dead ones if (EcalTools::isNextToDead(it->id(), iSetup)) { indexToStore.push_back(it->id()); } } if (keepNextToBoundary_){ // keep channels around EB/EE boundary if (it->id().subdetId() == EcalBarrel){ EBDetId ebid(it->id()); if (abs(ebid.ieta())== 85) indexToStore.push_back(it->id()); } else { if (EEDetId::isNextToRingBoundary(it->id())) indexToStore.push_back(it->id()); } } } //unify the vector std::sort(indexToStore.begin(),indexToStore.end()); std::unique(indexToStore.begin(),indexToStore.end()); std::auto_ptr< DetIdCollection > detIdCollection (new DetIdCollection(indexToStore) ) ; iEvent.put( detIdCollection, interestingDetIdCollection_ ); }
Definition at line 57 of file InterestingDetIdCollectionProducer.h.
Referenced by InterestingDetIdCollectionProducer(), and produce().
const CaloTopology* InterestingDetIdCollectionProducer::caloTopology_ [private] |
Definition at line 61 of file InterestingDetIdCollectionProducer.h.
Referenced by beginRun(), and produce().
std::string InterestingDetIdCollectionProducer::interestingDetIdCollection_ [private] |
Definition at line 58 of file InterestingDetIdCollectionProducer.h.
Referenced by InterestingDetIdCollectionProducer(), and produce().
bool InterestingDetIdCollectionProducer::keepNextToBoundary_ [private] |
Definition at line 66 of file InterestingDetIdCollectionProducer.h.
Referenced by InterestingDetIdCollectionProducer(), and produce().
bool InterestingDetIdCollectionProducer::keepNextToDead_ [private] |
Definition at line 65 of file InterestingDetIdCollectionProducer.h.
Referenced by InterestingDetIdCollectionProducer(), and produce().
int InterestingDetIdCollectionProducer::minimalEtaSize_ [private] |
Definition at line 59 of file InterestingDetIdCollectionProducer.h.
Referenced by InterestingDetIdCollectionProducer(), and produce().
int InterestingDetIdCollectionProducer::minimalPhiSize_ [private] |
Definition at line 60 of file InterestingDetIdCollectionProducer.h.
Referenced by InterestingDetIdCollectionProducer(), and produce().
Definition at line 56 of file InterestingDetIdCollectionProducer.h.
Referenced by InterestingDetIdCollectionProducer(), and produce().
const EcalSeverityLevelAlgo* InterestingDetIdCollectionProducer::severity_ [private] |
Definition at line 64 of file InterestingDetIdCollectionProducer.h.
Referenced by beginRun(), and produce().
int InterestingDetIdCollectionProducer::severityLevel_ [private] |
Definition at line 63 of file InterestingDetIdCollectionProducer.h.
Referenced by InterestingDetIdCollectionProducer(), and produce().