CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

IsolationProducerForTracks Class Reference

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

List of all members.

Public Member Functions

 IsolationProducerForTracks (const edm::ParameterSet &)

Private Member Functions

void produce (edm::Event &event, const edm::EventSetup &setup)

Private Attributes

double coneSize_
edm::InputTag highPtTracks_
edm::InputTag isoDeps_
double trackPtMin_
edm::InputTag tracks_

Detailed Description

Definition at line 7 of file IsolationProducerForTracks.cc.


Constructor & Destructor Documentation

IsolationProducerForTracks::IsolationProducerForTracks ( const edm::ParameterSet pset)

Definition at line 39 of file IsolationProducerForTracks.cc.

                                                                                : 
  tracks_( pset.getParameter<InputTag>( "tracks" ) ),
  highPtTracks_( pset.getParameter<InputTag>( "highPtTracks" ) ),
  isoDeps_( pset.getParameter<InputTag>( "isoDeps" ) ),
  trackPtMin_( pset.getParameter<double>( "trackPtMin" ) ),
  coneSize_( pset.getParameter<double>( "coneSize" ) )
 {
  produces<TkIsoMap>();
 }

Member Function Documentation

void IsolationProducerForTracks::produce ( edm::Event event,
const edm::EventSetup setup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 49 of file IsolationProducerForTracks.cc.

References coneSize_, reco::IsoDeposit::depositWithin(), edm::helper::Filler< Map >::fill(), highPtTracks_cfi::highPtTracks, highPtTracks_, i, edm::helper::Filler< Map >::insert(), isoDeps_, j, muon::overlap(), reco::Candidate::pt(), trackPtMin_, testEve_cfg::tracks, and tracks_.

                                                                                {
  std::auto_ptr<TkIsoMap> caloIsolations(new TkIsoMap);
  TkIsoMap::Filler filler(*caloIsolations);
  {
    Handle<CandidateView> tracks;
    event.getByLabel(tracks_, tracks);
    
    Handle<CandidateView> highPtTracks;
    event.getByLabel(highPtTracks_, highPtTracks);
    
    Handle<IsoDepositMap> isoDeps;
    event.getByLabel(isoDeps_, isoDeps);
    
    int nTracks = tracks->size();
    int nHighPtTracks = highPtTracks->size();
    std::vector<double> iso(nTracks);   

    OverlapChecker overlap;
    
    for(int i = 0; i < nTracks; ++i ) {
      const Candidate & tkCand = (*tracks)[ i ];
      double caloIso = - 1.0;
      if( tkCand.pt() > trackPtMin_) {
        for(int j = 0; j < nHighPtTracks; ++j ) {
          const Candidate & highPtTkCand = (*highPtTracks)[ j ];
          if(overlap(tkCand, highPtTkCand) ) {
            CandidateBaseRef tkRef = highPtTracks->refAt(j);
            const IsoDeposit &isoDep = (*isoDeps)[tkRef];
            caloIso = isoDep.depositWithin(coneSize_);
            break;
          }
        }
      } 
      iso[i] = caloIso;
    }
    filler.insert(tracks, iso.begin(), iso.end());
  }

  // really fill the association map
  filler.fill();
  event.put(caloIsolations);
}  

Member Data Documentation

Definition at line 17 of file IsolationProducerForTracks.cc.

Referenced by produce().

Definition at line 14 of file IsolationProducerForTracks.cc.

Referenced by produce().

Definition at line 15 of file IsolationProducerForTracks.cc.

Referenced by produce().

Definition at line 16 of file IsolationProducerForTracks.cc.

Referenced by produce().

Definition at line 13 of file IsolationProducerForTracks.cc.

Referenced by produce().