#include <Producers/InterestingTrackEcalDetIdProducer/src/InterestingTrackEcalDetIdProducer.cc>
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 CaloTopology * | caloTopology_ |
double | minTrackPt_ |
TrackDetectorAssociator | trackAssociator_ |
TrackAssociatorParameters | trackAssociatorParameters_ |
edm::ParameterSet | trackAssociatorPS_ |
edm::InputTag | trackCollection_ |
Description: [one line class summary]
Implementation: [Notes on implementation]
Definition at line 50 of file InterestingTrackEcalDetIdProducer.cc.
InterestingTrackEcalDetIdProducer::InterestingTrackEcalDetIdProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 87 of file InterestingTrackEcalDetIdProducer.cc.
References TrackAssociatorParameters::loadParameters(), trackAssociator_, trackAssociatorParameters_, trackAssociatorPS_, and TrackDetectorAssociator::useDefaultPropagator().
: trackCollection_ (iConfig.getParameter<edm::InputTag>("TrackCollection")), trackAssociatorPS_ (iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters")), minTrackPt_ (iConfig.getParameter<double>("MinTrackPt")) { trackAssociator_.useDefaultPropagator(); trackAssociatorParameters_.loadParameters(trackAssociatorPS_); produces<DetIdCollection>(); }
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.) }
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); }
const CaloTopology* InterestingTrackEcalDetIdProducer::caloTopology_ [private] |
Definition at line 68 of file InterestingTrackEcalDetIdProducer.cc.
Referenced by beginRun(), and produce().
double InterestingTrackEcalDetIdProducer::minTrackPt_ [private] |
Definition at line 66 of file InterestingTrackEcalDetIdProducer.cc.
Referenced by produce().
Definition at line 69 of file InterestingTrackEcalDetIdProducer.cc.
Referenced by InterestingTrackEcalDetIdProducer(), and produce().
Definition at line 70 of file InterestingTrackEcalDetIdProducer.cc.
Referenced by InterestingTrackEcalDetIdProducer(), and produce().
Definition at line 64 of file InterestingTrackEcalDetIdProducer.cc.
Referenced by InterestingTrackEcalDetIdProducer().
Definition at line 63 of file InterestingTrackEcalDetIdProducer.cc.
Referenced by produce().