CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

InterestingTrackEcalDetIdProducer Class Reference

#include <Producers/InterestingTrackEcalDetIdProducer/src/InterestingTrackEcalDetIdProducer.cc>

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

List of all members.

Public Member Functions

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

Private Member Functions

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

Private Attributes

const CaloTopologycaloTopology_
double minTrackPt_
TrackDetectorAssociator trackAssociator_
TrackAssociatorParameters trackAssociatorParameters_
edm::ParameterSet trackAssociatorPS_
edm::InputTag trackCollection_

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 50 of file InterestingTrackEcalDetIdProducer.cc.


Constructor & Destructor Documentation

InterestingTrackEcalDetIdProducer::InterestingTrackEcalDetIdProducer ( const edm::ParameterSet iConfig) [explicit]
InterestingTrackEcalDetIdProducer::~InterestingTrackEcalDetIdProducer ( )

Definition at line 100 of file InterestingTrackEcalDetIdProducer.cc.

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

}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 165 of file InterestingTrackEcalDetIdProducer.cc.

{
}
void InterestingTrackEcalDetIdProducer::beginRun ( edm::Run run,
const edm::EventSetup iSetup 
) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 156 of file InterestingTrackEcalDetIdProducer.cc.

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

{
  edm::ESHandle<CaloTopology> theCaloTopology;
  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
  caloTopology_ = &(*theCaloTopology); 
}
void InterestingTrackEcalDetIdProducer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 171 of file InterestingTrackEcalDetIdProducer.cc.

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

Implements edm::EDProducer.

Definition at line 115 of file InterestingTrackEcalDetIdProducer.cc.

References TrackDetectorAssociator::associate(), caloTopology_, DetId::Ecal, TrackDetMatchInfo::EcalRecHits, spr::find(), TrackDetMatchInfo::findMaxDeposition(), edm::Event::getByLabel(), TrackDetectorAssociator::getFreeTrajectoryState(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), info, minTrackPt_, edm::Event::put(), DetId::rawId(), DetId::subdetId(), trackAssociator_, trackAssociatorParameters_, trackCollection_, and testEve_cfg::tracks.

{
   using namespace edm;

   std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ;

   // Get tracks from event
   edm::Handle<reco::TrackCollection> tracks;
   iEvent.getByLabel(trackCollection_,tracks);

   // Loop over tracks
   for(reco::TrackCollection::const_iterator tkItr = tracks->begin(); tkItr != tracks->end(); ++tkItr)
   {
     if(tkItr->pt() < minTrackPt_)
       continue;

     TrackDetMatchInfo info = trackAssociator_.associate( iEvent, iSetup, 
         trackAssociator_.getFreeTrajectoryState(iSetup, *tkItr),
         trackAssociatorParameters_ );

     DetId centerId = info.findMaxDeposition(TrackDetMatchInfo::EcalRecHits);

     if(centerId.rawId()==0)
       continue;

     // Find 5x5 around max
     const CaloSubdetectorTopology* topology = caloTopology_->getSubdetectorTopology(DetId::Ecal,centerId.subdetId());
     const std::vector<DetId>& ids = topology->getWindow(centerId, 5, 5);
     for(std::vector<DetId>::const_iterator idItr = ids.begin(); idItr != ids.end(); ++idItr)
     {
       if(std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *idItr)
           == interestingDetIdCollection->end())
         interestingDetIdCollection->push_back(*idItr);
     }

   }

   iEvent.put(interestingDetIdCollection);

}

Member Data Documentation

Definition at line 68 of file InterestingTrackEcalDetIdProducer.cc.

Referenced by beginRun(), and produce().

Definition at line 66 of file InterestingTrackEcalDetIdProducer.cc.

Referenced by produce().

Definition at line 63 of file InterestingTrackEcalDetIdProducer.cc.

Referenced by produce().