CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

pf2pat::PFIsoDepositAlgo Class Reference

#include <PFIsoDepositAlgo.h>

List of all members.

Public Types

typedef std::vector
< reco::IsoDeposit
IsoDeposits
typedef reco::PFCandidate Particle
typedef std::vector< ParticleParticleCollection

Public Member Functions

 PFIsoDepositAlgo (const edm::ParameterSet &)
const IsoDepositsproduce (const ParticleCollection &toBeIsolated, const ParticleCollection &forIsolation)
 ~PFIsoDepositAlgo ()

Private Member Functions

reco::IsoDeposit buildIsoDeposit (const Particle &particle, const ParticleCollection &forIsolation) const
 build the IsoDeposit for "particle"
bool sameParticle (const Particle &particle1, const Particle &particle2) const
 checks if the 2 particles are in fact the same

Private Attributes

IsoDeposits isoDeposits_
 IsoDeposits computed in the produce function.
bool verbose_

Detailed Description

Definition at line 26 of file PFIsoDepositAlgo.h.


Member Typedef Documentation

Definition at line 34 of file PFIsoDepositAlgo.h.

Definition at line 30 of file PFIsoDepositAlgo.h.

Definition at line 31 of file PFIsoDepositAlgo.h.


Constructor & Destructor Documentation

PFIsoDepositAlgo::PFIsoDepositAlgo ( const edm::ParameterSet iConfig) [explicit]

Definition at line 16 of file PFIsoDepositAlgo.cc.

                                                                : 
  verbose_ ( iConfig.getUntrackedParameter<bool>("verbose",false) )

{}
PFIsoDepositAlgo::~PFIsoDepositAlgo ( )

Definition at line 23 of file PFIsoDepositAlgo.cc.

{ }

Member Function Documentation

IsoDeposit PFIsoDepositAlgo::buildIsoDeposit ( const Particle particle,
const ParticleCollection forIsolation 
) const [private]

build the IsoDeposit for "particle"

Definition at line 52 of file PFIsoDepositAlgo.cc.

References gather_cfg::cout, reco::isodeposit::Direction::deltaR(), reco::LeafCandidate::eta(), i, reco::LeafCandidate::p4(), reco::LeafCandidate::phi(), sameParticle(), and verbose_.

Referenced by produce().

                                                                                             {
  

  reco::isodeposit::Direction pfDir(particle.eta(), 
                                    particle.phi());
//   reco::IsoDeposit::Veto veto;
//   veto.vetoDir = pfDir;
//   veto.dR = 0.05; 

  IsoDeposit isoDep( pfDir );
  
  for( unsigned i=0; i<forIsolation.size(); i++ ) {
    
    const reco::PFCandidate& pfc = forIsolation[i];

    // need to remove "particle"!

    if( sameParticle( particle, pfc ) ) continue; 


    XYZTLorentzVector pvi(pfc.p4());
    reco::isodeposit::Direction dirPfc(pfc.eta(), pfc.phi());
    double dR = pfDir.deltaR(dirPfc);

    //COLIN make a parameter
    double maxDeltaRForIsoDep_ = 1;
    if(dR > maxDeltaRForIsoDep_) {
      //      if( verbose_ ) cout<<"OUT OF CONE"<<endl;
      continue;
    }
    //    else if(verbose_) cout<<endl;

    if(verbose_ ) 
      cout<<"\t"<<pfc<<endl;

    double pt = pvi.Pt();
    isoDep.addDeposit(dirPfc, pt); 
  }

  return isoDep;
}
const PFIsoDepositAlgo::IsoDeposits & PFIsoDepositAlgo::produce ( const ParticleCollection toBeIsolated,
const ParticleCollection forIsolation 
)

all the filtering is done before could gain in performance by having a single loop, and by producing all isodeposits at the same time? however, would not gain in ease of maintenance, and in flexibility.

Definition at line 27 of file PFIsoDepositAlgo.cc.

References buildIsoDeposit(), gather_cfg::cout, i, isoDeposits_, and verbose_.

                                                                   {
  

  isoDeposits_.clear();
  isoDeposits_.reserve( toBeIsolated.size() );

  for( unsigned i=0; i<toBeIsolated.size(); i++ ) {
    const reco::PFCandidate& toBeIso = toBeIsolated[i];

    if(verbose_ ) 
      cout<<"to be isolated: "<<toBeIso<<endl;

    isoDeposits_.push_back( buildIsoDeposit( toBeIso, forIsolation ) ); 
  }
  

  if(verbose_) {
    cout<<"PFIsoDepositAlgo "<<endl;
  }

  return isoDeposits_;
}
bool PFIsoDepositAlgo::sameParticle ( const Particle particle1,
const Particle particle2 
) const [private]

checks if the 2 particles are in fact the same

Definition at line 96 of file PFIsoDepositAlgo.cc.

References alignCSCRings::e, reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), and reco::PFCandidate::particleId().

Referenced by buildIsoDeposit().

                                                                       {

  double smallNumber = 1e-15;
  
  if( particle1.particleId() != particle2.particleId() ) return false;
  else if( fabs( particle1.energy() - particle2.energy() ) > smallNumber ) return false;
  else if( fabs( particle1.eta() - particle2.eta() ) > smallNumber ) return false;
  else if( fabs( particle1.eta() - particle2.eta() ) > smallNumber ) return false;
  else return true; 
  
}

Member Data Documentation

IsoDeposits computed in the produce function.

Definition at line 59 of file PFIsoDepositAlgo.h.

Referenced by produce().

Definition at line 61 of file PFIsoDepositAlgo.h.

Referenced by buildIsoDeposit(), and produce().