CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends

reco::PFCandidate Class Reference

Particle reconstructed by the particle flow algorithm. More...

#include <PFCandidate.h>

Inheritance diagram for reco::PFCandidate:
reco::CompositeCandidate reco::LeafCandidate reco::Candidate pat::PATObject< reco::PFCandidate > reco::IsolatedPFCandidate reco::PileUpPFCandidate pat::PFParticle

List of all members.

Public Types

typedef edm::RefVector
< reco::PFBlockCollection
Blocks
typedef std::pair
< reco::PFBlockRef, unsigned > 
ElementInBlock
 return indices of elements used in the block
typedef std::vector< unsigned > Elements
typedef std::vector
< ElementInBlock
ElementsInBlocks
enum  Flags {
  NORMAL = 0, E_PHI_SMODULES, E_ETA_0, E_ETA_MODULES,
  E_BARREL_ENDCAP, E_PRESHOWER_EDGE, E_PRESHOWER, E_ENDCAP_EDGE,
  H_ETA_0, H_BARREL_ENDCAP, H_ENDCAP_VFCAL, H_VFCAL_EDGE,
  T_TO_DISP, T_FROM_DISP, T_FROM_V0, T_FROM_GAMMACONV,
  GAMMA_TO_GAMMACONV
}
enum  ParticleType {
  X = 0, h, e, mu,
  gamma, h0, h_HF, egamma_HF
}
 

particle types

More...
enum  PFVertexType {
  kCandVertex = 0, kTrkVertex = 1, kComMuonVertex = 2, kSAMuonVertex = 3,
  kTrkMuonVertex = 4, kGSFVertex = 5
}

Public Member Functions

void addElementInBlock (const reco::PFBlockRef &blockref, unsigned elementIndex)
 add an element to the current PFCandidate
virtual PFCandidateclone () const
 return a clone
reco::ConversionRef conversionRef () const
 return a reference to the original conversion
double deltaP () const
 uncertainty on 3-momentum
reco::PFDisplacedVertexRef displacedVertexRef (Flags type) const
double ecalEnergy () const
 return corrected Ecal energy
reco::PFCandidateElectronExtraRef electronExtraRef () const
 return a reference to the electron extra
const ElementsInBlockselementsInBlocks () const
bool flag (Flags theFlag) const
 return a given flag
reco::GsfElectronRef gsfElectronRef () const
 return a reference to the corresponding GsfElectron if any
reco::GsfTrackRef gsfTrackRef () const
double hcalEnergy () const
 return corrected Hcal energy
double hoEnergy () const
 return corrected Hcal energy
reco::MuonRef muonRef () const
float mva_e_mu () const
 mva for electron-muon discrimination
float mva_e_pi () const
 mva for electron-pion discrimination
float mva_gamma_nh () const
 mva for neutral hadron - gamma discrimination
float mva_nothing_gamma () const
 mva for gamma detection
float mva_nothing_nh () const
 mva for neutral hadron detection
float mva_pi_mu () const
 mva for pi-muon discrimination
size_t numberOfSourceCandidatePtrs () const
virtual ParticleType particleId () const
 PFCandidate ()
 default constructor
 PFCandidate (const PFCandidatePtr &sourcePtr)
 constructor from a reference (keeps track of source relationship)
 PFCandidate (Charge q, const LorentzVector &p4, ParticleType particleId)
reco::PFCandidatePhotonExtraRef photonExtraRef () const
 return a reference to the photon extra
reco::PhotonRef photonRef () const
 return a reference to the corresponding Photon if any
const math::XYZPointFpositionAtECALEntrance () const
double pS1Energy () const
 return corrected PS1 energy
double pS2Energy () const
 return corrected PS2 energy
double rawEcalEnergy () const
 return corrected Ecal energy
double rawHcalEnergy () const
 return raw Hcal energy
double rawHoEnergy () const
 return raw Hcal energy
void rescaleMomentum (double rescaleFactor)
 particle momentum *= rescaleFactor
void set_mva_e_mu (float mva)
 set mva for electron-muon discrimination
void set_mva_e_pi (float mva)
void set_mva_gamma_nh (float mva)
 set mva for neutral hadron - gamma discrimination
void set_mva_nothing_gamma (float mva)
 set mva for gamma detection
void set_mva_nothing_nh (float mva)
 set mva for neutral hadron detection
void set_mva_pi_mu (float mva)
 set mva for pi-muon discrimination
void setConversionRef (const reco::ConversionRef &ref)
 set ref to original reco conversion
void setDeltaP (double dp)
 set uncertainty on momentum
void setDisplacedVertexRef (const reco::PFDisplacedVertexRef &ref, Flags flag)
 set displaced vertex reference
void setEcalEnergy (float eeRaw, float eeCorr)
 set corrected Ecal energy
void setFlag (Flags theFlag, bool value)
 set a given flag
void setGsfElectronRef (const reco::GsfElectronRef &ref)
 set GsfElectronRef
void setGsfTrackRef (const reco::GsfTrackRef &ref)
 set gsftrack reference
void setHcalEnergy (float ehRaw, float ehCorr)
 set corrected Hcal energy
void setHoEnergy (float eoRaw, float eoCorr)
 set corrected Hcal energy
void setMuonRef (const reco::MuonRef &ref)
 set muon reference
void setParticleType (ParticleType type)
 set Particle Type
void setPFElectronExtraRef (const reco::PFCandidateElectronExtraRef &ref)
 set the PF Electron Extra Ref
void setPFPhotonExtraRef (const reco::PFCandidatePhotonExtraRef &ref)
 set the PF Photon Extra Ref
void setPhotonRef (const reco::PhotonRef &phRef)
 set ref to the corresponding reco::Photon if any
void setPositionAtECALEntrance (const math::XYZPointF &pos)
 set position at ECAL entrance
void setPs1Energy (float e1)
 set corrected PS1 energy
void setPs2Energy (float e2)
 set corrected PS2 energy
void setSourceCandidatePtr (const PFCandidatePtr &ptr)
void setSuperClusterRef (const reco::SuperClusterRef &scRef)
void setTrackRef (const reco::TrackRef &ref)
 set track reference
void setV0Ref (const reco::VertexCompositeCandidateRef &ref)
 set ref to original reco conversion
virtual void setVertex (math::XYZPoint p)
void setVertexSource (PFVertexType vt)
CandidatePtr sourceCandidatePtr (size_type i) const
reco::SuperClusterRef superClusterRef () const
 return a reference to the corresponding SuperCluster if any
reco::TrackRef trackRef () const
ParticleType translatePdgIdToType (int pdgid) const
int translateTypeToPdgId (ParticleType type) const
reco::VertexCompositeCandidateRef v0Ref () const
 return a reference to the original conversion
virtual const Pointvertex () const
 vertex position
virtual double vx () const
 x coordinate of vertex position
virtual double vy () const
 y coordinate of vertex position
virtual double vz () const
 z coordinate of vertex position
virtual ~PFCandidate ()
 destructor

Static Public Attributes

static const float bigMva_ = -999.

Private Member Functions

bool flag (unsigned shift, unsigned flag) const
bool getRefInfo (unsigned int iMask, unsigned int iBit, edm::ProductID &oProdID, size_t &oIndex, size_t &aIndex) const
virtual bool overlap (const Candidate &) const
 Polymorphic overlap.
void setFlag (unsigned shift, unsigned flag, bool value)
void storeRefInfo (unsigned int iMask, unsigned int iBit, bool iIsValid, const edm::RefCore &iCore, size_t iKey, const edm::EDProductGetter *)

Private Attributes

Blocks blocksStorage_
float deltaP_
 uncertainty on 3-momentum
float ecalERatio_
 corrected ECAL energy ratio (corrected/raw)
ElementsInBlocks elementsInBlocks_
Elements elementsStorage_
unsigned flags_
 all flags, packed (ecal regional, hcal regional, tracking)
const edm::EDProductGettergetter_
float hcalERatio_
 corrected HCAL energy ratio (corrected/raw)
float hoERatio_
 corrected HO energy ratio (corrected/raw)
float mva_e_mu_
 mva for electron-muon discrimination
float mva_e_pi_
 mva for electron-pion discrimination
float mva_gamma_nh_
 mva for neutral hadron - gamma discrimination
float mva_nothing_gamma_
 mva for gamma detection
float mva_nothing_nh_
 mva for neutral hadron detection
float mva_pi_mu_
 mva for pi-muon discrimination
math::XYZPointF positionAtECALEntrance_
 position at ECAL entrance, from the PFRecTrack
float ps1Energy_
 corrected PS1 energy
float ps2Energy_
 corrected PS2 energy
float rawEcalEnergy_
 raw ECAL energy
float rawHcalEnergy_
 raw HCAL energy
float rawHoEnergy_
 raw HO energy
std::vector< const void * > refsCollectionCache_
std::vector< unsigned long long > refsInfo_
PFCandidatePtr sourcePtr_
 reference to the source PFCandidate, if any
unsigned short storedRefsBitPattern_
PFVertexType vertexType_

Friends

std::ostream & operator<< (std::ostream &out, const PFCandidate &c)

Detailed Description

Particle reconstructed by the particle flow algorithm.

particle candidate from particle flow

Author:
Colin Bernet
Date:
February 2007

Definition at line 33 of file PFCandidate.h.


Member Typedef Documentation

Definition at line 339 of file PFCandidate.h.

return indices of elements used in the block

return elements return elements in blocks

Definition at line 336 of file PFCandidate.h.

typedef std::vector<unsigned> reco::PFCandidate::Elements

Definition at line 340 of file PFCandidate.h.

Definition at line 337 of file PFCandidate.h.


Member Enumeration Documentation

Enumerator:
NORMAL 
E_PHI_SMODULES 
E_ETA_0 
E_ETA_MODULES 
E_BARREL_ENDCAP 
E_PRESHOWER_EDGE 
E_PRESHOWER 
E_ENDCAP_EDGE 
H_ETA_0 
H_BARREL_ENDCAP 
H_ENDCAP_VFCAL 
H_VFCAL_EDGE 
T_TO_DISP 
T_FROM_DISP 
T_FROM_V0 
T_FROM_GAMMACONV 
GAMMA_TO_GAMMACONV 

Definition at line 49 of file PFCandidate.h.

particle types

Enumerator:
X 
h 
e 
mu 
gamma 
h0 
h_HF 
egamma_HF 

Definition at line 38 of file PFCandidate.h.

                      {
      X=0,     // undefined
      h,       // charged hadron
      e,       // electron 
      mu,      // muon 
      gamma,   // photon
      h0,      // neutral hadron
      h_HF,        // HF tower identified as a hadron
      egamma_HF    // HF tower identified as an EM particle
    };
Enumerator:
kCandVertex 
kTrkVertex 
kComMuonVertex 
kSAMuonVertex 
kTrkMuonVertex 
kGSFVertex 

Definition at line 70 of file PFCandidate.h.


Constructor & Destructor Documentation

PFCandidate::PFCandidate ( )
PFCandidate::PFCandidate ( const PFCandidatePtr sourcePtr)

constructor from a reference (keeps track of source relationship)

Definition at line 56 of file PFCandidate.cc.

References sourcePtr_.

                                                          {
  *this = *sourcePtr;
  sourcePtr_ = sourcePtr;
}
PFCandidate::PFCandidate ( Charge  q,
const LorentzVector p4,
ParticleType  particleId 
)

Definition at line 62 of file PFCandidate.cc.

References blocksStorage_, e, elementsStorage_, Exception, h, mu, refsInfo_, edm::RefVector< C, T, F >::reserve(), reco::LeafCandidate::setPdgId(), and translateTypeToPdgId().

                                                : 
  
  CompositeCandidate(charge, p4), 
  ecalERatio_(1.),
  hcalERatio_(1.),
  hoERatio_(1.),
  rawEcalEnergy_(0.),
  rawHcalEnergy_(0.),
  rawHoEnergy_(0.),
  ps1Energy_(0.),
  ps2Energy_(0.),
  flags_(0),
  deltaP_(0.),
  vertexType_(kCandVertex),
  mva_e_pi_(bigMva_),
  mva_e_mu_(bigMva_),
  mva_pi_mu_(bigMva_),
  mva_nothing_gamma_(bigMva_),
  mva_nothing_nh_(bigMva_),
  mva_gamma_nh_(bigMva_),
  getter_(0),storedRefsBitPattern_(0)
{
  refsInfo_.reserve(3);
  blocksStorage_.reserve(10);
  elementsStorage_.reserve(10);

  // proceed with various consistency checks

  // charged candidate: track ref and charge must be non null
  if(  partId == h || 
       partId == e || 
       partId == mu ) {
    
    if( charge == 0 ) {
      string err;
      err+="Attempt to construct a charged PFCandidate with a zero charge";
      throw cms::Exception("InconsistentValue",
                           err.c_str() );
    } 
  }
  else {
    if( charge ) { 
      string err;
      err += "Attempt to construct a neutral PFCandidate ";
      err += "with a non-zero charge";
      throw cms::Exception("InconsistentValue",
                           err.c_str() );
    } 
  }  
  setPdgId( translateTypeToPdgId( partId ) );
}
virtual reco::PFCandidate::~PFCandidate ( ) [inline, virtual]

destructor

Definition at line 95 of file PFCandidate.h.

{}

Member Function Documentation

void PFCandidate::addElementInBlock ( const reco::PFBlockRef blockref,
unsigned  elementIndex 
)

add an element to the current PFCandidate

add element in block

Definition at line 123 of file PFCandidate.cc.

References blocksStorage_, elementsStorage_, edm::Ref< C, T, F >::id(), edm::RefVector< C, T, F >::push_back(), and edm::RefVector< C, T, F >::size().

Referenced by PFPhotonAlgo::RunPFPhoton(), and PFElectronAlgo::SetCandidates().

                                                             {
  //elementsInBlocks_.push_back( make_pair(blockref.key(), elementIndex) );
  if (blocksStorage_.size()==0)
    blocksStorage_ =Blocks(blockref.id());
  blocksStorage_.push_back(blockref);
  elementsStorage_.push_back(elementIndex);
}
PFCandidate * PFCandidate::clone ( void  ) const [virtual]

return a clone

Reimplemented from reco::CompositeCandidate.

Reimplemented in reco::IsolatedPFCandidate, reco::PileUpPFCandidate, and pat::PFParticle.

Definition at line 118 of file PFCandidate.cc.

References PFCandidate().

                                       {
  return new PFCandidate( * this );
}
reco::ConversionRef PFCandidate::conversionRef ( ) const

return a reference to the original conversion

Definition at line 459 of file PFCandidate.cc.

References GETREF, kRefConversionBit, and kRefConversionMask.

double reco::PFCandidate::deltaP ( ) const [inline]

uncertainty on 3-momentum

Definition at line 260 of file PFCandidate.h.

References deltaP_.

Referenced by PFElectronTranslator::createGsfElectrons().

{ return deltaP_;}
reco::PFDisplacedVertexRef PFCandidate::displacedVertexRef ( Flags  type) const
double reco::PFCandidate::ecalEnergy ( ) const [inline]

return corrected Ecal energy

Definition at line 189 of file PFCandidate.h.

References ecalERatio_, and rawEcalEnergy_.

Referenced by PFCandConnector::analyseNuclearWPrim(), and PFCandidateBenchmark::fillOne().

reco::PFCandidateElectronExtraRef PFCandidate::electronExtraRef ( ) const
const ElementsInBlocks& reco::PFCandidate::elementsInBlocks ( ) const [inline]
bool reco::PFCandidate::flag ( unsigned  shift,
unsigned  flag 
) const [private]
bool PFCandidate::flag ( Flags  theFlag) const

return a given flag

Definition at line 205 of file PFCandidate.cc.

References flags_.

Referenced by PFCandConnector::isPrimaryNucl(), PFCandConnector::isSecondaryNucl(), setConversionRef(), and setDisplacedVertexRef().

                                          {

  return (flags_>>theFlag) & 1;
}
bool PFCandidate::getRefInfo ( unsigned int  iMask,
unsigned int  iBit,
edm::ProductID oProdID,
size_t &  oIndex,
size_t &  aIndex 
) const [private]

Definition at line 307 of file PFCandidate.cc.

References refsInfo_, s_refsBefore, and storedRefsBitPattern_.

                                                                                             {

  if( 0 == (iBit & storedRefsBitPattern_) ) {
    return false;
  }
  aIndex = s_refsBefore[storedRefsBitPattern_ & iMask];
  unsigned long long bitPacked = refsInfo_[aIndex];
  oIndex = bitPacked & 0xFFFFFFFFULL; //low 32 bits are the index
  unsigned short productIndex = (bitPacked & 0x0000FFFF00000000ULL)>>32;
  unsigned short processIndex = (bitPacked & 0xFFFF000000000000ULL)>>48;
  oProductID = edm::ProductID(processIndex,productIndex);
  return true;
}
reco::GsfElectronRef PFCandidate::gsfElectronRef ( ) const

return a reference to the corresponding GsfElectron if any

Definition at line 479 of file PFCandidate.cc.

References GETREF, kRefGsfElectronBit, and kRefGsfElectronMask.

reco::GsfTrackRef PFCandidate::gsfTrackRef ( ) const

return a reference to the corresponding GSF track, if an electron. otherwise, return a null reference

Definition at line 376 of file PFCandidate.cc.

References GETREF, kRefGsfTrackBit, and kRefGsfTrackMask.

Referenced by PFElectronTranslator::fillMVAValueMap(), LeptonRecoSkim::filter(), reco::tau::getTrack(), PFLinker::produce(), PFElectronTranslator::produce(), and vertex().

double reco::PFCandidate::hcalEnergy ( ) const [inline]

return corrected Hcal energy

Definition at line 199 of file PFCandidate.h.

References hcalERatio_, and rawHcalEnergy_.

Referenced by PFCandConnector::analyseNuclearWPrim(), and PFCandidateBenchmark::fillOne().

double reco::PFCandidate::hoEnergy ( ) const [inline]

return corrected Hcal energy

Definition at line 209 of file PFCandidate.h.

References hoERatio_, and rawHoEnergy_.

reco::MuonRef PFCandidate::muonRef ( ) const

return a reference to the corresponding muon, if a muon. otherwise, return a null reference

Definition at line 355 of file PFCandidate.cc.

References GETREF, kRefMuonBit, and kRefMuonMask.

Referenced by PFAlgo::postMuonCleaning(), PFLinker::produce(), pat::PATMuonProducer::produce(), MuonProducer::produce(), and vertex().

float reco::PFCandidate::mva_e_mu ( ) const [inline]

mva for electron-muon discrimination

Definition at line 281 of file PFCandidate.h.

References mva_e_mu_.

{ return mva_e_mu_;}
float reco::PFCandidate::mva_e_pi ( ) const [inline]

mva for electron-pion discrimination

Definition at line 274 of file PFCandidate.h.

References mva_e_pi_.

Referenced by PFElectronTranslator::createGsfElectrons(), PFElectronTranslator::fillMVAValueMap(), PFCandidateBenchmark::fillOne(), and PFElectronTranslator::produce().

{ return mva_e_pi_;}
float reco::PFCandidate::mva_gamma_nh ( ) const [inline]

mva for neutral hadron - gamma discrimination

Definition at line 307 of file PFCandidate.h.

References mva_gamma_nh_.

{ return mva_gamma_nh_;}
float reco::PFCandidate::mva_nothing_gamma ( ) const [inline]

mva for gamma detection

Definition at line 294 of file PFCandidate.h.

References mva_nothing_gamma_.

Referenced by PFLinker::produce(), and PFPhotonTranslator::produce().

{ return mva_nothing_gamma_;}
float reco::PFCandidate::mva_nothing_nh ( ) const [inline]

mva for neutral hadron detection

Definition at line 300 of file PFCandidate.h.

References mva_nothing_nh_.

{ return mva_nothing_nh_;}
float reco::PFCandidate::mva_pi_mu ( ) const [inline]

mva for pi-muon discrimination

Definition at line 287 of file PFCandidate.h.

References mva_pi_mu_.

{ return mva_pi_mu_;}
size_t reco::PFCandidate::numberOfSourceCandidatePtrs ( ) const [inline, virtual]

return the number of source Candidates ( the candidates used to construct this Candidate)

Reimplemented from reco::LeafCandidate.

Definition at line 113 of file PFCandidate.h.

                                               { 
      return 1;
    }
bool PFCandidate::overlap ( const Candidate other) const [private, virtual]

Polymorphic overlap.

Reimplemented from reco::CompositeCandidate.

Definition at line 171 of file PFCandidate.cc.

References i, edm::Ptr< T >::isNonnull(), edm::Ptr< T >::isNull(), n, reco::Candidate::numberOfSourceCandidatePtrs(), reco::Candidate::sourceCandidatePtr(), sourceCandidatePtr(), and sourcePtr_.

                                                           {
    CandidatePtr myPtr = sourceCandidatePtr(0);
    if (myPtr.isNull()) return false;
    for (size_t i = 0, n = other.numberOfSourceCandidatePtrs(); i < n; ++i) {
        CandidatePtr otherPtr = other.sourceCandidatePtr(i);
        if ((otherPtr == myPtr) || 
            (sourcePtr_.isNonnull() && otherPtr.isNonnull() && sourcePtr_->overlap(*otherPtr))) {
                return true;
        }
    }
    return false;
}
virtual ParticleType reco::PFCandidate::particleId ( ) const [inline, virtual]
reco::PFCandidatePhotonExtraRef PFCandidate::photonExtraRef ( ) const

return a reference to the photon extra

Definition at line 498 of file PFCandidate.cc.

References GETREF, kRefPFPhotonExtraBit, and kRefPFPhotonExtraMask.

Referenced by PFPhotonTranslator::produce().

reco::PhotonRef PFCandidate::photonRef ( ) const

return a reference to the corresponding Photon if any

Definition at line 494 of file PFCandidate.cc.

References GETREF, kRefPhotonBit, and kRefPhotonMask.

const math::XYZPointF& reco::PFCandidate::positionAtECALEntrance ( ) const [inline]
Returns:
position at ECAL entrance

Definition at line 318 of file PFCandidate.h.

References positionAtECALEntrance_.

Referenced by reco::tau::RecoTauIsolationMasking::inCone().

double reco::PFCandidate::pS1Energy ( ) const [inline]

return corrected PS1 energy

Definition at line 239 of file PFCandidate.h.

References ps1Energy_.

{ return ps1Energy_;}
double reco::PFCandidate::pS2Energy ( ) const [inline]

return corrected PS2 energy

Definition at line 245 of file PFCandidate.h.

References ps2Energy_.

{ return ps2Energy_;}
double reco::PFCandidate::rawEcalEnergy ( ) const [inline]

return corrected Ecal energy

Definition at line 192 of file PFCandidate.h.

References rawEcalEnergy_.

Referenced by PFElectronTranslator::createBasicCluster(), and PFAlgo::postMuonCleaning().

{ return rawEcalEnergy_;}
double reco::PFCandidate::rawHcalEnergy ( ) const [inline]

return raw Hcal energy

Definition at line 202 of file PFCandidate.h.

References rawHcalEnergy_.

Referenced by PFAlgo::postMuonCleaning().

{ return rawHcalEnergy_;}
double reco::PFCandidate::rawHoEnergy ( ) const [inline]

return raw Hcal energy

Definition at line 212 of file PFCandidate.h.

References rawHoEnergy_.

{ return rawHoEnergy_;}
void PFCandidate::rescaleMomentum ( double  rescaleFactor)

particle momentum *= rescaleFactor

Definition at line 188 of file PFCandidate.cc.

References reco::LeafCandidate::p4(), and reco::LeafCandidate::setP4().

                                                        {
  LorentzVector rescaledp4 = p4();
  rescaledp4 *= rescaleFactor;
  setP4( rescaledp4 );
}
void reco::PFCandidate::set_mva_e_mu ( float  mva) [inline]

set mva for electron-muon discrimination

Definition at line 278 of file PFCandidate.h.

References mva_e_mu_.

{ mva_e_mu_=mva;}
void reco::PFCandidate::set_mva_e_pi ( float  mva) [inline]

set mva for electron-pion discrimination. For charged particles, this variable is set to 0 for particles that are not preided to 1 otherwise For neutral particles, it is set to the default value

Definition at line 271 of file PFCandidate.h.

References mva_e_pi_.

Referenced by PFElectronAlgo::SetCandidates().

{ mva_e_pi_=mva;}
void reco::PFCandidate::set_mva_gamma_nh ( float  mva) [inline]

set mva for neutral hadron - gamma discrimination

Definition at line 304 of file PFCandidate.h.

References mva_gamma_nh_.

{ mva_gamma_nh_=mva;}
void reco::PFCandidate::set_mva_nothing_gamma ( float  mva) [inline]

set mva for gamma detection

Definition at line 291 of file PFCandidate.h.

References mva_nothing_gamma_.

Referenced by PFPhotonAlgo::RunPFPhoton().

void reco::PFCandidate::set_mva_nothing_nh ( float  mva) [inline]

set mva for neutral hadron detection

Definition at line 297 of file PFCandidate.h.

References mva_nothing_nh_.

void reco::PFCandidate::set_mva_pi_mu ( float  mva) [inline]

set mva for pi-muon discrimination

Definition at line 284 of file PFCandidate.h.

References mva_pi_mu_.

{ mva_pi_mu_=mva;}
void PFCandidate::setConversionRef ( const reco::ConversionRef ref)

set ref to original reco conversion

Definition at line 435 of file PFCandidate.cc.

References Exception, flag(), gamma, GAMMA_TO_GAMMACONV, edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), kRefConversionBit, kRefConversionMask, particleId(), edm::Ref< C, T, F >::productGetter(), edm::Ref< C, T, F >::refCore(), and storeRefInfo().

                                                                 {
  if( particleId() != gamma ) {
    string err;
    err += "PFCandidate::setConversionRef: this is not a (converted) photon ! particleId_=";
    char num[4];
    sprintf( num, "%d", particleId());
    err += num;

    throw cms::Exception("InconsistentReference",
                         err.c_str() );
  }
  else if(  !flag( GAMMA_TO_GAMMACONV ) ) {
    string err;
    err += "PFCandidate::setConversionRef: particule flag is not GAMMA_TO_GAMMACONV";

    throw cms::Exception("InconsistentReference",
                         err.c_str() );
  }

  storeRefInfo(kRefConversionMask, kRefConversionBit, iRef.isNonnull(), 
               iRef.refCore(), iRef.key(),iRef.productGetter());
}
void reco::PFCandidate::setDeltaP ( double  dp) [inline]

set uncertainty on momentum

Definition at line 257 of file PFCandidate.h.

References deltaP_.

{deltaP_ = dp;}
void PFCandidate::setDisplacedVertexRef ( const reco::PFDisplacedVertexRef ref,
Flags  flag 
)

set displaced vertex reference

Definition at line 380 of file PFCandidate.cc.

References Exception, flag(), h, edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), kRefDisplacedVertexDauBit, kRefDisplacedVertexDauMask, kRefDisplacedVertexMotBit, kRefDisplacedVertexMotMask, particleId(), edm::Ref< C, T, F >::productGetter(), edm::Ref< C, T, F >::refCore(), storeRefInfo(), T_FROM_DISP, and T_TO_DISP.

                                                                                        {

  if( particleId() != h ) {
    string err;
    err += "PFCandidate::setDisplacedVertexRef: this is not a hadron! particleId_=";
    char num[4];
    sprintf( num, "%d", particleId());
    err += num;

    throw cms::Exception("InconsistentReference",
                         err.c_str() );
  }
  else if(  !flag( T_FROM_DISP ) && !flag( T_TO_DISP ) ) {
    string err;
    err += "PFCandidate::setDisplacedVertexRef: particule flag is neither T_FROM_DISP nor T_TO_DISP";

    throw cms::Exception("InconsistentReference",
                         err.c_str() );
  }


  if (type == T_TO_DISP && flag( T_TO_DISP )) 
    storeRefInfo(kRefDisplacedVertexDauMask, kRefDisplacedVertexDauBit, 
                 iRef.isNonnull(), 
                 iRef.refCore(), iRef.key(),iRef.productGetter());
  else if (type == T_FROM_DISP && flag( T_FROM_DISP )) 
    storeRefInfo(kRefDisplacedVertexMotMask, kRefDisplacedVertexMotBit, 
                 iRef.isNonnull(), 
                 iRef.refCore(), iRef.key(),iRef.productGetter());
  else if ( (type == T_FROM_DISP && !flag( T_FROM_DISP )) 
            || 
            (type == T_TO_DISP && !flag( T_TO_DISP )) ){
    string err;
    err += "PFCandidate::setDisplacedVertexRef: particule flag is not switched on";

    throw cms::Exception("InconsistentReference",
                         err.c_str() );
  }

}
void reco::PFCandidate::setEcalEnergy ( float  eeRaw,
float  eeCorr 
) [inline]

set corrected Ecal energy

Definition at line 185 of file PFCandidate.h.

References abs, ecalERatio_, and rawEcalEnergy_.

Referenced by PFAlgoTestBenchElectrons::processBlock(), PFPhotonAlgo::RunPFPhoton(), and PFElectronAlgo::SetCandidates().

                                                    {
      rawEcalEnergy_ = eeRaw; ecalERatio_= std::abs(eeRaw)<1.e-6 ? 1.0 : eeCorr/eeRaw;}
void reco::PFCandidate::setFlag ( unsigned  shift,
unsigned  flag,
bool  value 
) [private]
void PFCandidate::setFlag ( Flags  theFlag,
bool  value 
)

set a given flag

Definition at line 195 of file PFCandidate.cc.

References flags_.

Referenced by PFPhotonAlgo::RunPFPhoton().

                                                   {
  
  if(value)
    flags_ = flags_ | (1<<theFlag);
  else 
    flags_ = flags_ ^ (1<<theFlag);
}
void PFCandidate::setGsfElectronRef ( const reco::GsfElectronRef ref)
void PFCandidate::setGsfTrackRef ( const reco::GsfTrackRef ref)

set gsftrack reference

Definition at line 359 of file PFCandidate.cc.

References edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), kRefGsfTrackBit, kRefGsfTrackMask, edm::Ref< C, T, F >::productGetter(), edm::Ref< C, T, F >::refCore(), and storeRefInfo().

Referenced by PFElectronAlgo::SetCandidates().

                                                             {
//  Removed by F. Beaudette. Would like to be able to save the GsfTrackRef even for charged pions
//  if( particleId() != e ) {
//    string err;
//    err += "PFCandidate::setGsfTrackRef: this is not an electron ! particleId_=";
//    char num[4];
//    sprintf( num, "%d", particleId());
//    err += num;
//
//    throw cms::Exception("InconsistentReference",
//                         err.c_str() );
//  }

  storeRefInfo(kRefGsfTrackMask, kRefGsfTrackBit, iRef.isNonnull(), 
               iRef.refCore(), iRef.key(),iRef.productGetter());
}
void reco::PFCandidate::setHcalEnergy ( float  ehRaw,
float  ehCorr 
) [inline]

set corrected Hcal energy

Definition at line 195 of file PFCandidate.h.

References abs, hcalERatio_, and rawHcalEnergy_.

Referenced by PFAlgoTestBenchElectrons::processBlock(), PFPhotonAlgo::RunPFPhoton(), and PFElectronAlgo::SetCandidates().

                                                    {
      rawHcalEnergy_ = ehRaw; hcalERatio_= std::abs(ehRaw)<1.e-6 ? 1.0 : ehCorr/ehRaw;}
void reco::PFCandidate::setHoEnergy ( float  eoRaw,
float  eoCorr 
) [inline]

set corrected Hcal energy

Definition at line 205 of file PFCandidate.h.

References abs, hoERatio_, and rawHoEnergy_.

Referenced by PFAlgoTestBenchElectrons::processBlock().

                                                  {
      rawHoEnergy_ = eoRaw; hoERatio_= std::abs(eoRaw)<1.e-6 ? 1.0 : eoCorr/eoRaw;}
void PFCandidate::setMuonRef ( const reco::MuonRef ref)

set muon reference

Definition at line 342 of file PFCandidate.cc.

References Exception, edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), kRefMuonBit, kRefMuonMask, edm::Ref< C, T, F >::productGetter(), edm::Ref< C, T, F >::refCore(), storeRefInfo(), and trackRef().

Referenced by PFLinker::produce().

                                                     {
  if(  trackRef() != iRef->track() ) {
    string err;
    err += "PFCandidate::setMuonRef: inconsistent track references!";
    
    throw cms::Exception("InconsistentReference",
                         err.c_str() );
  }

  storeRefInfo(kRefMuonMask, kRefMuonBit, iRef.isNonnull(), 
               iRef.refCore(), iRef.key(),iRef.productGetter());
}
void PFCandidate::setParticleType ( ParticleType  type)

set Particle Type

Definition at line 166 of file PFCandidate.cc.

References reco::LeafCandidate::setPdgId(), and translateTypeToPdgId().

void PFCandidate::setPFElectronExtraRef ( const reco::PFCandidateElectronExtraRef ref)
void PFCandidate::setPFPhotonExtraRef ( const reco::PFCandidatePhotonExtraRef ref)
void PFCandidate::setPhotonRef ( const reco::PhotonRef phRef)

set ref to the corresponding reco::Photon if any

Definition at line 506 of file PFCandidate.cc.

References e, Exception, gamma, edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), kRefPhotonBit, kRefPhotonMask, particleId(), edm::Ref< C, T, F >::productGetter(), edm::Ref< C, T, F >::refCore(), and storeRefInfo().

Referenced by PFLinker::produce().

                                                        {
  if( particleId() != gamma && particleId() != e) {
    string err;
    err += "PFCandidate::setSuperClusterRef: this is not an electron neither a photon ! particleId_=";
    char num[4];
    sprintf( num, "%d", particleId());
    err += num;
    
    throw cms::Exception("InconsistentReference", err.c_str() );
  }

  storeRefInfo(kRefPhotonMask, kRefPhotonBit, iRef.isNonnull(), 
               iRef.refCore(), iRef.key(),iRef.productGetter());

}
void reco::PFCandidate::setPositionAtECALEntrance ( const math::XYZPointF pos) [inline]

set position at ECAL entrance

Definition at line 310 of file PFCandidate.h.

References pos, and positionAtECALEntrance_.

Referenced by PFElectronAlgo::SetCandidates().

void reco::PFCandidate::setPs1Energy ( float  e1) [inline]

set corrected PS1 energy

Definition at line 236 of file PFCandidate.h.

References ps1Energy_.

Referenced by PFPhotonAlgo::RunPFPhoton(), and PFElectronAlgo::SetCandidates().

{ps1Energy_ = e1;}
void reco::PFCandidate::setPs2Energy ( float  e2) [inline]

set corrected PS2 energy

Definition at line 242 of file PFCandidate.h.

References ps2Energy_.

Referenced by PFPhotonAlgo::RunPFPhoton(), and PFElectronAlgo::SetCandidates().

{ps2Energy_ = e2;}
void reco::PFCandidate::setSourceCandidatePtr ( const PFCandidatePtr ptr) [inline]

Definition at line 111 of file PFCandidate.h.

References sourcePtr_.

Referenced by FFTJetPFPileupCleaner::produce().

{ sourcePtr_ = ptr; }
void PFCandidate::setSuperClusterRef ( const reco::SuperClusterRef scRef)

Definition at line 522 of file PFCandidate.cc.

References e, Exception, gamma, edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), kRefSuperClusterBit, kRefSuperClusterMask, particleId(), edm::Ref< C, T, F >::productGetter(), edm::Ref< C, T, F >::refCore(), and storeRefInfo().

Referenced by PFLinker::produce(), PFPhotonAlgo::RunPFPhoton(), and PFElectronAlgo::SetCandidates().

                                                                    {
  if( particleId() != gamma && particleId() != e) {
    string err;
    err += "PFCandidate::setSuperClusterRef: this is not an electron neither a photon ! particleId_=";
    char num[4];
    sprintf( num, "%d", particleId());
    err += num;
    
    throw cms::Exception("InconsistentReference", err.c_str() );
  }

  storeRefInfo(kRefSuperClusterMask, kRefSuperClusterBit, iRef.isNonnull(), 
               iRef.refCore(), iRef.key(),iRef.productGetter());

}
void PFCandidate::setTrackRef ( const reco::TrackRef ref)

set track reference

Definition at line 322 of file PFCandidate.cc.

References reco::LeafCandidate::charge(), Exception, edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), kRefTrackBit, kRefTrackMask, particleId(), edm::Ref< C, T, F >::productGetter(), edm::Ref< C, T, F >::refCore(), and storeRefInfo().

Referenced by PFCandidateMixer::produce(), and PFElectronAlgo::SetCandidates().

                                                      {
  if(!charge()) {
    string err;
    err += "PFCandidate::setTrackRef: this is a neutral candidate! ";
    err += "particleId_=";
    char num[4];
    sprintf( num, "%d", particleId());
    err += num;
    
    throw cms::Exception("InconsistentReference",
                         err.c_str() );
  }

  storeRefInfo(kRefTrackMask, kRefTrackBit, iRef.isNonnull(), 
               iRef.refCore(), iRef.key(),iRef.productGetter());
}
void PFCandidate::setV0Ref ( const reco::VertexCompositeCandidateRef ref)

set ref to original reco conversion

Definition at line 464 of file PFCandidate.cc.

References edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), kRefV0Bit, kRefV0Mask, edm::Ref< C, T, F >::productGetter(), edm::Ref< C, T, F >::refCore(), and storeRefInfo().

                                                                       {
  storeRefInfo(kRefV0Mask, kRefV0Bit, iRef.isNonnull(), 
               iRef.refCore(), iRef.key(),iRef.productGetter());
}
virtual void reco::PFCandidate::setVertex ( math::XYZPoint  p) [inline, virtual]
void reco::PFCandidate::setVertexSource ( PFVertexType  vt) [inline]

Definition at line 368 of file PFCandidate.h.

References kCandVertex, reco::LeafCandidate::vertex_, and vertexType_.

Referenced by PFElectronAlgo::SetCandidates().

CandidatePtr reco::PFCandidate::sourceCandidatePtr ( size_type  i) const [inline, virtual]

return a Ptr to one of the source Candidates ( the candidates used to construct this Candidate)

Reimplemented from reco::LeafCandidate.

Definition at line 117 of file PFCandidate.h.

References sourcePtr_.

Referenced by overlap().

                                                         {
      return sourcePtr_;
    }
void PFCandidate::storeRefInfo ( unsigned int  iMask,
unsigned int  iBit,
bool  iIsValid,
const edm::RefCore iCore,
size_t  iKey,
const edm::EDProductGetter iGetter 
) [private]

Definition at line 271 of file PFCandidate.cc.

References bitPackRefInfo(), getter_, edm::RefCore::productPtr(), refsCollectionCache_, refsInfo_, s_refsBefore, and storedRefsBitPattern_.

Referenced by setConversionRef(), setDisplacedVertexRef(), setGsfElectronRef(), setGsfTrackRef(), setMuonRef(), setPFElectronExtraRef(), setPFPhotonExtraRef(), setPhotonRef(), setSuperClusterRef(), setTrackRef(), and setV0Ref().

                                                              {

  size_t index = s_refsBefore[storedRefsBitPattern_ & iMask];
  if ( 0 == getter_) {
    getter_ = iGetter;
  }

  if(iIsValid) {
    if(0 == (storedRefsBitPattern_ & iBit) ) {
      refsInfo_.insert(refsInfo_.begin()+index, bitPackRefInfo(iCore,iKey));
      if (iGetter==0)
        refsCollectionCache_.insert(refsCollectionCache_.begin()+index,(void*)iCore.productPtr());
      else
        refsCollectionCache_.insert(refsCollectionCache_.begin()+index,0);
    } else {
      assert(refsInfo_.size()>index);
      *(refsInfo_.begin()+index)=bitPackRefInfo(iCore,iKey);
      if (iGetter==0)
        *(refsCollectionCache_.begin()+index)=(void*)iCore.productPtr();
      else
        *(refsCollectionCache_.begin()+index)=0;

    }
    storedRefsBitPattern_ |= iBit;
  } else{
    if( storedRefsBitPattern_ & iBit) {
      refsInfo_.erase(refsInfo_.begin()+index);
      refsCollectionCache_.erase(refsCollectionCache_.begin()+index);
      storedRefsBitPattern_ ^= iBit;
    }
  }

}
reco::SuperClusterRef PFCandidate::superClusterRef ( ) const
reco::TrackRef PFCandidate::trackRef ( ) const
PFCandidate::ParticleType PFCandidate::translatePdgIdToType ( int  pdgid) const

Definition at line 134 of file PFCandidate.cc.

References abs, e, egamma_HF, gamma, h, h0, h_HF, mu, and X.

Referenced by particleId().

                                                                         {
  switch (std::abs(pdgid)) {
  case 211: return h;
  case 11: return e;
  case 13: return mu;
  case 22: return gamma;
  case 130: return h0;
  case 1: return h_HF;
  case 2: return egamma_HF;
  case 0: return X;  
  default: return X;
  }
}
int PFCandidate::translateTypeToPdgId ( ParticleType  type) const

returns the pdg id corresponding to the particle type. the particle type could be removed at some point to gain some space. low priority

Definition at line 148 of file PFCandidate.cc.

References reco::LeafCandidate::charge(), e, egamma_HF, gamma, h, h0, h_HF, mu, and X.

Referenced by PFCandidate(), and setParticleType().

                                                               {
  
  int thecharge = charge();

  switch( type ) {
  case h:     return thecharge*211; // pi+
  case e:     return thecharge*(-11);
  case mu:    return thecharge*(-13);
  case gamma: return 22;
  case h0:    return 130; // K_L0
  case h_HF:         return 1; // dummy pdg code 
  case egamma_HF:    return 2;  // dummy pdg code
  case X: 
  default:    return 0;  
  }
}
reco::VertexCompositeCandidateRef PFCandidate::v0Ref ( ) const

return a reference to the original conversion

Definition at line 469 of file PFCandidate.cc.

References GETREF, kRefV0Bit, and kRefV0Mask.

const math::XYZPoint & PFCandidate::vertex ( ) const [virtual]

vertex position

Reimplemented from reco::LeafCandidate.

Definition at line 546 of file PFCandidate.cc.

References gsfTrackRef(), kCandVertex, kComMuonVertex, kGSFVertex, kSAMuonVertex, kTrkMuonVertex, kTrkVertex, muonRef(), trackRef(), reco::LeafCandidate::vertex_, and vertexType_.

Referenced by FWPFCandidate3DProxyBuilder::build(), PFPileUpAlgo::chargedHadronVertex(), PFCandWithSuperClusterExtractor::depositFromObject(), FFTJetPFPileupCleaner::findSomeVertex(), PFConcretePFCandidateProducer::produce(), vx(), vy(), and vz().

                                               {
  switch (vertexType_) {
  case kCandVertex:
    return vertex_;
    break;
  case kTrkVertex:
    return trackRef()->vertex();
    break;
  case kComMuonVertex:
    return muonRef()->combinedMuon()->vertex();
    break;
  case kSAMuonVertex:
    return muonRef()->standAloneMuon()->vertex();
    break;
  case kTrkMuonVertex:
    return muonRef()->track()->vertex();
    break;
  case kGSFVertex:
    return gsfTrackRef()->vertex();
    break;
  }
  return vertex_;
}
virtual double reco::PFCandidate::vx ( ) const [inline, virtual]

x coordinate of vertex position

Reimplemented from reco::LeafCandidate.

Definition at line 375 of file PFCandidate.h.

References vertex().

Referenced by PFAlgo::postMuonCleaning().

{return vertex().x();}
virtual double reco::PFCandidate::vy ( ) const [inline, virtual]

y coordinate of vertex position

Reimplemented from reco::LeafCandidate.

Definition at line 376 of file PFCandidate.h.

References vertex().

Referenced by PFAlgo::postMuonCleaning().

{return vertex().y();}
virtual double reco::PFCandidate::vz ( ) const [inline, virtual]

z coordinate of vertex position

Reimplemented from reco::LeafCandidate.

Definition at line 377 of file PFCandidate.h.

References vertex().

Referenced by PFCandWithSuperClusterExtractor::depositFromObject().

{return vertex().z();}

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const PFCandidate c 
) [friend]

Member Data Documentation

const float PFCandidate::bigMva_ = -999. [static]

Definition at line 355 of file PFCandidate.h.

Definition at line 389 of file PFCandidate.h.

Referenced by addElementInBlock(), elementsInBlocks(), and PFCandidate().

float reco::PFCandidate::deltaP_ [private]

uncertainty on 3-momentum

Definition at line 425 of file PFCandidate.h.

Referenced by deltaP(), and setDeltaP().

corrected ECAL energy ratio (corrected/raw)

Definition at line 398 of file PFCandidate.h.

Referenced by ecalEnergy(), and setEcalEnergy().

Definition at line 388 of file PFCandidate.h.

Referenced by elementsInBlocks().

Definition at line 390 of file PFCandidate.h.

Referenced by addElementInBlock(), elementsInBlocks(), and PFCandidate().

unsigned reco::PFCandidate::flags_ [private]

all flags, packed (ecal regional, hcal regional, tracking)

Definition at line 422 of file PFCandidate.h.

Referenced by flag(), and setFlag().

Definition at line 459 of file PFCandidate.h.

Referenced by storeRefInfo().

corrected HCAL energy ratio (corrected/raw)

Definition at line 401 of file PFCandidate.h.

Referenced by hcalEnergy(), and setHcalEnergy().

corrected HO energy ratio (corrected/raw)

Definition at line 404 of file PFCandidate.h.

Referenced by hoEnergy(), and setHoEnergy().

mva for electron-muon discrimination

Definition at line 433 of file PFCandidate.h.

Referenced by mva_e_mu(), and set_mva_e_mu().

mva for electron-pion discrimination

Definition at line 430 of file PFCandidate.h.

Referenced by mva_e_pi(), and set_mva_e_pi().

mva for neutral hadron - gamma discrimination

Definition at line 445 of file PFCandidate.h.

Referenced by mva_gamma_nh(), and set_mva_gamma_nh().

mva for gamma detection

Definition at line 439 of file PFCandidate.h.

Referenced by mva_nothing_gamma(), and set_mva_nothing_gamma().

mva for neutral hadron detection

Definition at line 442 of file PFCandidate.h.

Referenced by mva_nothing_nh(), and set_mva_nothing_nh().

mva for pi-muon discrimination

Definition at line 436 of file PFCandidate.h.

Referenced by mva_pi_mu(), and set_mva_pi_mu().

position at ECAL entrance, from the PFRecTrack

Definition at line 448 of file PFCandidate.h.

Referenced by positionAtECALEntrance(), and setPositionAtECALEntrance().

corrected PS1 energy

Definition at line 416 of file PFCandidate.h.

Referenced by pS1Energy(), and setPs1Energy().

corrected PS2 energy

Definition at line 419 of file PFCandidate.h.

Referenced by pS2Energy(), and setPs2Energy().

raw ECAL energy

Definition at line 407 of file PFCandidate.h.

Referenced by ecalEnergy(), rawEcalEnergy(), and setEcalEnergy().

raw HCAL energy

Definition at line 410 of file PFCandidate.h.

Referenced by hcalEnergy(), rawHcalEnergy(), and setHcalEnergy().

raw HO energy

Definition at line 413 of file PFCandidate.h.

Referenced by hoEnergy(), rawHoEnergy(), and setHoEnergy().

std::vector<const void *> reco::PFCandidate::refsCollectionCache_ [private]

Definition at line 462 of file PFCandidate.h.

Referenced by storeRefInfo().

std::vector<unsigned long long> reco::PFCandidate::refsInfo_ [private]

Definition at line 461 of file PFCandidate.h.

Referenced by getRefInfo(), PFCandidate(), and storeRefInfo().

reference to the source PFCandidate, if any

Definition at line 394 of file PFCandidate.h.

Referenced by overlap(), PFCandidate(), setSourceCandidatePtr(), and sourceCandidatePtr().

unsigned short reco::PFCandidate::storedRefsBitPattern_ [private]

Definition at line 460 of file PFCandidate.h.

Referenced by getRefInfo(), and storeRefInfo().

Definition at line 427 of file PFCandidate.h.

Referenced by setVertex(), setVertexSource(), and vertex().