CMS 3D CMS Logo

Public Member Functions | Private Attributes

HighPtTrackEcalDetIdProducer Class Reference

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

List of all members.

Public Member Functions

void beginRun (edm::Run &, const edm::EventSetup &)
 HighPtTrackEcalDetIdProducer (const edm::ParameterSet &)
void produce (edm::Event &, const edm::EventSetup &)
 ~HighPtTrackEcalDetIdProducer ()

Private Attributes

const CaloTopologycaloTopology_
edm::InputTag inputCollection_
TrackAssociatorParameters parameters_
double ptcut_
TrackDetectorAssociator trackAssociator_

Detailed Description

Definition at line 58 of file HighPtTrackEcalDetIdProducer.cc.


Constructor & Destructor Documentation

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

Definition at line 99 of file HighPtTrackEcalDetIdProducer.cc.

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

}

Member Function Documentation

void HighPtTrackEcalDetIdProducer::beginRun ( edm::Run run,
const edm::EventSetup iSetup 
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 113 of file HighPtTrackEcalDetIdProducer.cc.

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

{
   edm::ESHandle<CaloTopology> theCaloTopology;
   iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
   caloTopology_ = &(*theCaloTopology); 
}
void HighPtTrackEcalDetIdProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 122 of file HighPtTrackEcalDetIdProducer.cc.

References TrackDetectorAssociator::associate(), caloTopology_, TrackDetMatchInfo::crossedEcalIds, DetId::Ecal, spr::find(), edm::Event::getByLabel(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), ExpressReco_HICollisions_FallBack::id, info, inputCollection_, TrackDetectorAssociator::InsideOut, ExpressReco_HICollisions_FallBack::interestingDetIdCollection, parameters_, ptcut_, edm::Event::put(), DetId::subdetId(), and trackAssociator_.

{
   using namespace edm;
   using reco::TrackCollection;
//   if(!iSetup) continue;
   Handle<TrackCollection> tkTracks;
   iEvent.getByLabel(inputCollection_,tkTracks);
   std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ;
   for(TrackCollection::const_iterator itTrack = tkTracks->begin();
       itTrack != tkTracks->end();                      
       ++itTrack) {
        if(itTrack->pt()>ptcut_){
           TrackDetMatchInfo info = trackAssociator_.associate(iEvent, iSetup, *itTrack, parameters_, TrackDetectorAssociator::InsideOut);
           if(info.crossedEcalIds.size()==0) break;

           if(info.crossedEcalIds.size()>0){
              DetId centerId = info.crossedEcalIds.front();

              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 id = ids.begin(); id != ids.end(); ++id )
                 if(std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *id) 
                    == interestingDetIdCollection->end()) 
                    interestingDetIdCollection->push_back(*id);            
           }
        }

   }
   iEvent.put(interestingDetIdCollection);

}

Member Data Documentation

Definition at line 67 of file HighPtTrackEcalDetIdProducer.cc.

Referenced by beginRun(), and produce().

Definition at line 66 of file HighPtTrackEcalDetIdProducer.cc.

Referenced by HighPtTrackEcalDetIdProducer(), and produce().

Definition at line 69 of file HighPtTrackEcalDetIdProducer.cc.

Referenced by HighPtTrackEcalDetIdProducer(), and produce().

Definition at line 70 of file HighPtTrackEcalDetIdProducer.cc.

Referenced by HighPtTrackEcalDetIdProducer(), and produce().

Definition at line 68 of file HighPtTrackEcalDetIdProducer.cc.

Referenced by HighPtTrackEcalDetIdProducer(), and produce().