CMS 3D CMS Logo

InterestingDetIdCollectionProducer Class Reference

Original author: Paolo Meridiani PH/CMG. More...

#include <RecoEcal/EgammaClusterProducers/interface/InterestingDetIdCollectionProducer.h>

Inheritance diagram for InterestingDetIdCollectionProducer:

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

List of all members.

Public Member Functions

void beginJob (const edm::EventSetup &)
 InterestingDetIdCollectionProducer (const edm::ParameterSet &)
 ctor
virtual void produce (edm::Event &, const edm::EventSetup &)
 producer
 ~InterestingDetIdCollectionProducer ()

Private Attributes

edm::InputTag basicClusters_
const CaloTopologycaloTopology_
std::string interestingDetIdCollection_
int minimalEtaSize_
int minimalPhiSize_
edm::InputTag recHitsLabel_


Detailed Description

Original author: Paolo Meridiani PH/CMG.

Implementation: <Notes on="" implementation>="">

Definition at line 33 of file InterestingDetIdCollectionProducer.h.


Constructor & Destructor Documentation

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

ctor

Definition at line 22 of file InterestingDetIdCollectionProducer.cc.

References basicClusters_, edm::ParameterSet::getParameter(), interestingDetIdCollection_, minimalEtaSize_, minimalPhiSize_, and recHitsLabel_.

00023 {
00024 
00025   recHitsLabel_ = iConfig.getParameter< edm::InputTag > ("recHitsLabel");
00026   basicClusters_ = iConfig.getParameter< edm::InputTag > ("basicClustersLabel");
00027 
00028   interestingDetIdCollection_ = iConfig.getParameter<std::string>("interestingDetIdCollection");
00029   
00030   minimalEtaSize_ = iConfig.getParameter<int> ("etaSize");
00031   minimalPhiSize_ = iConfig.getParameter<int> ("phiSize");
00032   if ( minimalPhiSize_ % 2 == 0 ||  minimalEtaSize_ % 2 == 0)
00033     edm::LogError("InterestingDetIdCollectionProducerError") << "Size of eta/phi should be odd numbers";
00034  
00035    //register your products
00036   produces< DetIdCollection > (interestingDetIdCollection_) ;
00037   
00038 }

InterestingDetIdCollectionProducer::~InterestingDetIdCollectionProducer (  ) 

Definition at line 41 of file InterestingDetIdCollectionProducer.cc.

00042 {}


Member Function Documentation

void InterestingDetIdCollectionProducer::beginJob ( const edm::EventSetup iSetup  )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 44 of file InterestingDetIdCollectionProducer.cc.

References caloTopology_, and edm::EventSetup::get().

00045 {
00046   edm::ESHandle<CaloTopology> theCaloTopology;
00047   iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
00048   caloTopology_ = &(*theCaloTopology); 
00049 }

void InterestingDetIdCollectionProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

producer

Implements edm::EDProducer.

Definition at line 53 of file InterestingDetIdCollectionProducer.cc.

References basicClusters_, caloTopology_, DetId::det(), find(), edm::Event::getByLabel(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), interestingDetIdCollection_, minimalEtaSize_, minimalPhiSize_, DetId::null(), edm::Event::put(), recHitsLabel_, std, and DetId::subdetId().

00055 {
00056    using namespace edm;
00057    using namespace std;
00058 
00059    // take BasicClusters
00060   Handle<reco::BasicClusterCollection> pClusters;
00061   iEvent.getByLabel(basicClusters_, pClusters);
00062   
00063   // take EcalRecHits
00064   Handle<EcalRecHitCollection> recHitsHandle;
00065   iEvent.getByLabel(recHitsLabel_,recHitsHandle);
00066 
00067   //Create empty output collections
00068   std::auto_ptr< DetIdCollection > detIdCollection (new DetIdCollection() ) ;
00069   
00070   reco::BasicClusterCollection::const_iterator clusIt;
00071   
00072   for (clusIt=pClusters->begin(); clusIt!=pClusters->end(); clusIt++) {
00073     //PG barrel
00074     
00075     float eMax=0.;
00076     DetId eMaxId(0);
00077 
00078     std::vector<DetId> clusterDetIds = (*clusIt).getHitsByDetId();
00079     std::vector<DetId>::iterator posCurrent;
00080 
00081     EcalRecHit testEcalRecHit;
00082     
00083     for(posCurrent = clusterDetIds.begin(); posCurrent != clusterDetIds.end(); posCurrent++)
00084       {
00085         EcalRecHitCollection::const_iterator itt = recHitsHandle->find(*posCurrent);
00086         if ((!((*posCurrent).null())) && (itt != recHitsHandle->end()) && ((*itt).energy() > eMax) )
00087           {
00088             eMax = (*itt).energy();
00089             eMaxId = (*itt).id();
00090           }
00091       }
00092     
00093     if (eMaxId.null())
00094     continue;
00095     
00096     const CaloSubdetectorTopology* topology  = caloTopology_->getSubdetectorTopology(eMaxId.det(),eMaxId.subdetId());
00097     std::vector<DetId> xtalsToStore=topology->getWindow(eMaxId,minimalEtaSize_,minimalPhiSize_);
00098     std::vector<DetId> xtalsInClus=(*clusIt).getHitsByDetId();
00099     
00100     for (unsigned int ii=0;ii<xtalsInClus.size();ii++)
00101       {
00102         if (std::find(xtalsToStore.begin(),xtalsToStore.end(),xtalsInClus[ii]) == xtalsToStore.end())
00103           xtalsToStore.push_back(xtalsInClus[ii]);
00104       }
00105     
00106     for (unsigned int iCry=0;iCry<xtalsToStore.size();iCry++)
00107       {
00108         if ( 
00109             std::find(detIdCollection->begin(),detIdCollection->end(),xtalsToStore[iCry]) == detIdCollection->end()
00110             )
00111           detIdCollection->push_back(xtalsToStore[iCry]);
00112       }     
00113   }
00114   
00115   //  std::cout << "Interesting DetId Collection size is " << detIdCollection->size() <<  " BCs are " << pClusters->size() << std::endl;
00116   iEvent.put( detIdCollection, interestingDetIdCollection_ );
00117 
00118 }


Member Data Documentation

edm::InputTag InterestingDetIdCollectionProducer::basicClusters_ [private]

Definition at line 45 of file InterestingDetIdCollectionProducer.h.

Referenced by InterestingDetIdCollectionProducer(), and produce().

const CaloTopology* InterestingDetIdCollectionProducer::caloTopology_ [private]

Definition at line 49 of file InterestingDetIdCollectionProducer.h.

Referenced by beginJob(), and produce().

std::string InterestingDetIdCollectionProducer::interestingDetIdCollection_ [private]

Definition at line 46 of file InterestingDetIdCollectionProducer.h.

Referenced by InterestingDetIdCollectionProducer(), and produce().

int InterestingDetIdCollectionProducer::minimalEtaSize_ [private]

Definition at line 47 of file InterestingDetIdCollectionProducer.h.

Referenced by InterestingDetIdCollectionProducer(), and produce().

int InterestingDetIdCollectionProducer::minimalPhiSize_ [private]

Definition at line 48 of file InterestingDetIdCollectionProducer.h.

Referenced by InterestingDetIdCollectionProducer(), and produce().

edm::InputTag InterestingDetIdCollectionProducer::recHitsLabel_ [private]

Definition at line 44 of file InterestingDetIdCollectionProducer.h.

Referenced by InterestingDetIdCollectionProducer(), and produce().


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