CMS 3D CMS Logo

Public Member Functions | Private Attributes

IsoTracks Class Reference

Inheritance diagram for IsoTracks:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void endJob ()
 IsoTracks (const edm::ParameterSet &iConfig)
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual ~IsoTracks ()

Private Attributes

double coneRadius_
edm::InputTag src_
double threshold_

Detailed Description

Definition at line 21 of file IsoTracks.cc.


Constructor & Destructor Documentation

IsoTracks::IsoTracks ( const edm::ParameterSet iConfig)

Definition at line 46 of file IsoTracks.cc.

Referenced by produce().

  : src_       (iConfig.getParameter<edm::InputTag>("src"))
  , coneRadius_(iConfig.getParameter<double>("radius"))
  , threshold_ (iConfig.getParameter<double>("SumPtFraction"))
{
  produces<std::vector<reco::Track> >();
}
IsoTracks::~IsoTracks ( ) [virtual]

Definition at line 55 of file IsoTracks.cc.

{}

Member Function Documentation

void IsoTracks::endJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 99 of file IsoTracks.cc.

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

Implements edm::EDProducer.

Definition at line 62 of file IsoTracks.cc.

References coneRadius_, deltaR(), eta(), edm::Event::getByLabel(), IsoTracks(), phi, edm::Event::put(), src_, and threshold_.

{

  std::auto_ptr<std::vector<reco::Track> > IsoTracks(new std::vector<reco::Track >);
  
  edm::Handle< std::vector<reco::Track> > dirtyTracks;
  iEvent.getByLabel(src_,dirtyTracks);
  
  if( dirtyTracks->size() == 0 ) 
  {
    iEvent.put(IsoTracks);
    return ;
  }
  
  std::vector<reco::Track>::const_iterator dirtyTrackIt    ;
  std::vector<reco::Track>::const_iterator dirtyTrackIt2   ;
//  typename std::vector<reco::Track>::const_iterator dirtyTrackIt    ;
//  typename std::vector<reco::Track>::const_iterator dirtyTrackIt2   ;
  double   sumPtInCone = 0 ;

  for ( dirtyTrackIt = dirtyTracks->begin(); dirtyTrackIt != dirtyTracks->end(); ++dirtyTrackIt ) {
    for ( dirtyTrackIt2 = dirtyTracks->begin(); dirtyTrackIt2 != dirtyTracks->end(); ++dirtyTrackIt2 ) {
      if ( dirtyTrackIt == dirtyTrackIt2) continue ;
      if ( deltaR(dirtyTrackIt  -> eta() , 
                  dirtyTrackIt  -> phi() , 
                  dirtyTrackIt2 -> eta() , 
                  dirtyTrackIt2 -> phi() ) < coneRadius_ ){
        sumPtInCone = sumPtInCone + dirtyTrackIt2 -> pt() ;
      }
        }
        if ( sumPtInCone <= threshold_*(dirtyTrackIt->pt()) ){
          IsoTracks -> push_back( *dirtyTrackIt ) ; 
        }
  }
  iEvent.put(IsoTracks);
}

Member Data Documentation

double IsoTracks::coneRadius_ [private]

Definition at line 35 of file IsoTracks.cc.

Referenced by produce().

Definition at line 34 of file IsoTracks.cc.

Referenced by produce().

double IsoTracks::threshold_ [private]

Definition at line 36 of file IsoTracks.cc.

Referenced by produce().