CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
PFIsolationEstimator Class Reference

#include <PFIsolationEstimator.h>

Public Types

enum  VetoType { kElectron = -1, kPhoton = 1 }
 

Public Member Functions

reco::VertexRef chargedHadronVertex (edm::Handle< reco::VertexCollection > verticies, const reco::PFCandidate &pfcand)
 
float fGetIsolation (const reco::PFCandidate *pfCandidate, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
 
float fGetIsolation (const reco::Photon *photon, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
 
float fGetIsolation (const reco::GsfElectron *electron, const reco::PFCandidateCollection *pfParticlesColl, const reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
 
std::vector< float > fGetIsolationInRings (const reco::PFCandidate *pfCandidate, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
 
std::vector< float > fGetIsolationInRings (const reco::Photon *photon, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
 
std::vector< float > fGetIsolationInRings (const reco::GsfElectron *electron, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
 
float getIsolationCharged ()
 
float getIsolationChargedAll ()
 
std::vector< float > getIsolationInRingsCharged ()
 
std::vector< float > getIsolationInRingsChargedAll ()
 
std::vector< float > getIsolationInRingsNeutral ()
 
std::vector< float > getIsolationInRingsPhoton ()
 
float getIsolationNeutral ()
 
float getIsolationPhoton ()
 
int getNumbersOfRings ()
 
float getRingSize ()
 
void initializeElectronIsolation (Bool_t bApplyVeto)
 
void initializeElectronIsolationInRings (Bool_t bApplyVeto, int iNumberOfRings, float fRingSize)
 
void initializePhotonIsolation (Bool_t bApplyVeto)
 
void initializePhotonIsolationInRings (Bool_t bApplyVeto, int iNumberOfRings, float fRingSize)
 
void initializeRings (int iNumberOfRings, float fRingSize)
 
float isChargedParticleVetoed (const reco::PFCandidate *pfIsoCand, edm::Handle< reco::VertexCollection > vertices)
 
float isChargedParticleVetoed (const reco::PFCandidate *pfIsoCand, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
 
Bool_t isInitialized () const
 
float isNeutralParticleVetoed (const reco::PFCandidate *pfIsoCand)
 
float isPhotonParticleVetoed (const reco::PFCandidate *pfIsoCand)
 
int matchPFObject (const reco::Photon *photon, const reco::PFCandidateCollection *pfParticlesColl)
 
int matchPFObject (const reco::GsfElectron *photon, const reco::PFCandidateCollection *pfParticlesColl)
 
 PFIsolationEstimator ()
 
void setApplyDzDxyVeto (Bool_t bValue=kTRUE)
 
void setApplyMissHitPhVeto (Bool_t bValue=kFALSE)
 
void setApplyPFPUVeto (Bool_t bValue=kFALSE)
 
void setApplyVeto (Bool_t bValue=kTRUE)
 
void setConeSize (float fValue=0.4)
 
void setDeltaRVetoBarrel (Bool_t bValue=kTRUE)
 
void setDeltaRVetoBarrelCharged (float fValue=-1.0)
 
void setDeltaRVetoBarrelNeutrals (float fValue=-1.0)
 
void setDeltaRVetoBarrelPhotons (float fValue=-1.0)
 
void setDeltaRVetoEndcap (Bool_t bValue=kTRUE)
 
void setDeltaRVetoEndcapCharged (float fValue=-1.0)
 
void setDeltaRVetoEndcapNeutrals (float fValue=-1.0)
 
void setDeltaRVetoEndcapPhotons (float fValue=-1.0)
 
void setNumberOfCrystalEndcapPhotons (float fValue=-1)
 
void setNumbersOfRings (int iValue=1)
 
void setParticleType (int iValue)
 
void setRectangleDeltaEtaVetoBarrelCharged (float fValue=-1.0)
 
void setRectangleDeltaEtaVetoBarrelNeutrals (float fValue=-1.0)
 
void setRectangleDeltaEtaVetoBarrelPhotons (float fValue=-1.0)
 
void setRectangleDeltaEtaVetoEndcapCharged (float fValue=-1.0)
 
void setRectangleDeltaEtaVetoEndcapNeutrals (float fValue=-1.0)
 
void setRectangleDeltaEtaVetoEndcapPhotons (float fValue=-1.0)
 
void setRectangleDeltaPhiVetoBarrelCharged (float fValue=-1.0)
 
void setRectangleDeltaPhiVetoBarrelNeutrals (float fValue=-1.0)
 
void setRectangleDeltaPhiVetoBarrelPhotons (float fValue=-1.0)
 
void setRectangleDeltaPhiVetoEndcapCharged (float fValue=-1.0)
 
void setRectangleDeltaPhiVetoEndcapNeutrals (float fValue=-1.0)
 
void setRectangleDeltaPhiVetoEndcapPhotons (float fValue=-1.0)
 
void setRectangleVetoBarrel (Bool_t bValue=kTRUE)
 
void setRectangleVetoEndcap (Bool_t bValue=kTRUE)
 
void setRingSize (float fValue=0.4)
 
void setUseCrystalSize (Bool_t bValue=kFALSE)
 
 ~PFIsolationEstimator ()
 

Private Member Functions

void initialize (Bool_t bApplyVeto, int iParticleType)
 

Private Attributes

Bool_t bApplyDzDxyVeto
 
Bool_t bApplyMissHitPhVeto
 
Bool_t bApplyPFPUVeto
 
Bool_t bApplyVeto
 
Bool_t bDeltaRVetoBarrel
 
Bool_t bDeltaRVetoEndcap
 
Bool_t bRectangleVetoBarrel
 
Bool_t bRectangleVetoEndcap
 
Bool_t bUseCrystalSize
 
Bool_t checkClosestZVertex
 
float fConeSize
 
float fDeltaEta
 
float fDeltaPhi
 
float fDeltaR
 
float fDeltaRVetoBarrelCharged
 
float fDeltaRVetoBarrelNeutrals
 
float fDeltaRVetoBarrelPhotons
 
float fDeltaRVetoEndcapCharged
 
float fDeltaRVetoEndcapNeutrals
 
float fDeltaRVetoEndcapPhotons
 
float fEta
 
float fEtaSC
 
Bool_t fisInitialized
 
float fIsolation
 
float fIsolationCharged
 
float fIsolationChargedAll
 
std::vector< float > fIsolationInRings
 
std::vector< float > fIsolationInRingsCharged
 
std::vector< float > fIsolationInRingsChargedAll
 
std::vector< float > fIsolationInRingsNeutral
 
std::vector< float > fIsolationInRingsPhoton
 
float fIsolationNeutral
 
float fIsolationPhoton
 
float fNumberOfCrystalEndcapPhotons
 
float fPhi
 
float fPhiSC
 
float fPt
 
float fRectangleDeltaEtaVetoBarrelCharged
 
float fRectangleDeltaEtaVetoBarrelNeutrals
 
float fRectangleDeltaEtaVetoBarrelPhotons
 
float fRectangleDeltaEtaVetoEndcapCharged
 
float fRectangleDeltaEtaVetoEndcapNeutrals
 
float fRectangleDeltaEtaVetoEndcapPhotons
 
float fRectangleDeltaPhiVetoBarrelCharged
 
float fRectangleDeltaPhiVetoBarrelNeutrals
 
float fRectangleDeltaPhiVetoBarrelPhotons
 
float fRectangleDeltaPhiVetoEndcapCharged
 
float fRectangleDeltaPhiVetoEndcapNeutrals
 
float fRectangleDeltaPhiVetoEndcapPhotons
 
float fRingSize
 
float fVx
 
float fVy
 
float fVz
 
int iMissHits
 
int iNumberOfRings
 
int iParticleType
 
bool pivotInBarrel
 
reco::SuperClusterRef refSC
 
math::XYZVector vtxWRTCandidate
 

Detailed Description

–> NOTE if you want to use this class as standalone without the CMSSW part you need to uncomment the below line and compile normally with scramv1 b Then you need just to load it in your root macro the lib with the correct path, eg: gSystem->Load("/data/benedet/CMSSW_5_2_2/lib/slc5_amd64_gcc462/pluginEGammaEGammaAnalysisTools.so");

Definition at line 54 of file PFIsolationEstimator.h.

Member Enumeration Documentation

Enumerator
kElectron 
kPhoton 

Definition at line 59 of file PFIsolationEstimator.h.

59  {
60  kElectron = -1, // MVA for non-triggering electrons
61  kPhoton = 1 // MVA for triggering electrons
62  };

Constructor & Destructor Documentation

PFIsolationEstimator::PFIsolationEstimator ( )

Definition at line 29 of file PFIsolationEstimator.cc.

29  :
30 fisInitialized(kFALSE)
31 {
32  // Constructor.
33 }
PFIsolationEstimator::~PFIsolationEstimator ( )

Definition at line 38 of file PFIsolationEstimator.cc.

39 {
40 
41 }

Member Function Documentation

VertexRef PFIsolationEstimator::chargedHadronVertex ( edm::Handle< reco::VertexCollection verticies,
const reco::PFCandidate pfcand 
)

Definition at line 688 of file PFIsolationEstimator.cc.

References checkClosestZVertex, cmsHarvester::index, edm::Handle< T >::product(), reco::PFCandidate::trackRef(), reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), reco::Vertex::trackWeight(), reco::PFCandidate::vertex(), HLT_FULL_cff::vertices, and w.

Referenced by isChargedParticleVetoed().

688  {
689 
690  //code copied from Florian's PFNoPU class
691 
692  reco::TrackBaseRef trackBaseRef( pfcand.trackRef() );
693 
694  size_t iVertex = 0;
695  unsigned index=0;
696  unsigned nFoundVertex = 0;
697 
698  float bestweight=0;
699 
700  const reco::VertexCollection& vertices = *(verticesColl.product());
701 
702  for( reco::VertexCollection::const_iterator iv=vertices.begin(); iv!=vertices.end(); ++iv, ++index) {
703 
704  const reco::Vertex& vtx = *iv;
705 
706  // loop on tracks in vertices
707  for(reco::Vertex::trackRef_iterator iTrack=vtx.tracks_begin();iTrack!=vtx.tracks_end(); ++iTrack) {
708 
709  const reco::TrackBaseRef& baseRef = *iTrack;
710 
711  // one of the tracks in the vertex is the same as
712  // the track considered in the function
713  if(baseRef == trackBaseRef ) {
714  float w = vtx.trackWeight(baseRef);
715  //select the vertex for which the track has the highest weight
716  if (w > bestweight){
717  bestweight=w;
718  iVertex=index;
719  nFoundVertex++;
720  }
721  }
722  }
723 
724  }
725 
726 
727 
728  if (nFoundVertex>0){
729  if (nFoundVertex!=1)
730  edm::LogWarning("TrackOnTwoVertex")<<"a track is shared by at least two verteces. Used to be an assert";
731  return VertexRef( verticesColl, iVertex);
732  }
733  // no vertex found with this track.
734 
735  // optional: as a secondary solution, associate the closest vertex in z
736  if ( checkClosestZVertex ) {
737 
738  double dzmin = 10000.;
739  double ztrack = pfcand.vertex().z();
740  bool foundVertex = false;
741  index = 0;
742  for( reco::VertexCollection::const_iterator iv=vertices.begin(); iv!=vertices.end(); ++iv, ++index) {
743 
744  double dz = fabs(ztrack - iv->z());
745  if(dz<dzmin) {
746  dzmin = dz;
747  iVertex = index;
748  foundVertex = true;
749  }
750  }
751 
752  if( foundVertex )
753  return VertexRef( verticesColl, iVertex);
754 
755  }
756 
757  return VertexRef( );
758 }
const double w
Definition: UKUtility.cc:23
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:44
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:433
virtual const Point & vertex() const
vertex position (overwritten by PF...)
Definition: PFCandidate.cc:647
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Definition: Vertex.h:73
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
Definition: VertexFwd.h:13
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:37
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39
float PFIsolationEstimator::fGetIsolation ( const reco::PFCandidate pfCandidate,
const reco::PFCandidateCollection pfParticlesColl,
reco::VertexRef  vtx,
edm::Handle< reco::VertexCollection vertices 
)

Definition at line 205 of file PFIsolationEstimator.cc.

References fGetIsolationInRings(), fIsolation, fIsolationInRings, and refSC.

Referenced by AdHocNTupler::fill().

205  {
206 
207  fGetIsolationInRings( pfCandidate, pfParticlesColl, vtx, vertices);
210 
211  return fIsolation;
212 }
std::vector< float > fIsolationInRings
edm::Ref< SuperClusterCollection > SuperClusterRef
reference to an object in a collection of SuperCluster objects
std::vector< float > fGetIsolationInRings(const reco::PFCandidate *pfCandidate, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
reco::SuperClusterRef refSC
float PFIsolationEstimator::fGetIsolation ( const reco::Photon photon,
const reco::PFCandidateCollection pfParticlesColl,
reco::VertexRef  vtx,
edm::Handle< reco::VertexCollection vertices 
)

Definition at line 282 of file PFIsolationEstimator.cc.

References fGetIsolationInRings(), fIsolation, and fIsolationInRings.

282  {
283 
284  fGetIsolationInRings( photon, pfParticlesColl, vtx, vertices);
286 
287  return fIsolation;
288 }
std::vector< float > fIsolationInRings
std::vector< float > fGetIsolationInRings(const reco::PFCandidate *pfCandidate, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
float PFIsolationEstimator::fGetIsolation ( const reco::GsfElectron electron,
const reco::PFCandidateCollection pfParticlesColl,
const reco::VertexRef  vtx,
edm::Handle< reco::VertexCollection vertices 
)

Definition at line 387 of file PFIsolationEstimator.cc.

References fGetIsolationInRings(), fIsolation, and fIsolationInRings.

387  {
388 
389  fGetIsolationInRings( electron, pfParticlesColl, vtx, vertices);
391 
392  return fIsolation;
393 }
std::vector< float > fIsolationInRings
std::vector< float > fGetIsolationInRings(const reco::PFCandidate *pfCandidate, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
vector< float > PFIsolationEstimator::fGetIsolationInRings ( const reco::PFCandidate pfCandidate,
const reco::PFCandidateCollection pfParticlesColl,
reco::VertexRef  vtx,
edm::Handle< reco::VertexCollection vertices 
)

Definition at line 216 of file PFIsolationEstimator.cc.

References funct::abs(), reco::LeafCandidate::eta(), fDeltaR, fEta, fIsolationInRings, fIsolationInRingsCharged, fIsolationInRingsChargedAll, fIsolationInRingsNeutral, fIsolationInRingsPhoton, fPhi, fPt, fRingSize, fVx, fVy, fVz, iNumberOfRings, isChargedParticleVetoed(), isNeutralParticleVetoed(), isPhotonParticleVetoed(), reco::LeafCandidate::pdgId(), reco::LeafCandidate::phi(), pivotInBarrel, reco::PFCandidate::positionAtECALEntrance(), reco::LeafCandidate::pt(), reco::PFCandidate::vx(), reco::PFCandidate::vy(), and reco::PFCandidate::vz().

Referenced by fGetIsolation().

216  {
217 
218  int isoBin;
219 
220 
221  for(isoBin =0;isoBin<iNumberOfRings;isoBin++){
222  fIsolationInRings[isoBin]=0.;
223  fIsolationInRingsPhoton[isoBin]=0.;
224  fIsolationInRingsNeutral[isoBin]=0.;
225  fIsolationInRingsCharged[isoBin]=0.;
226  fIsolationInRingsChargedAll[isoBin]=0.;
227  }
228 
229 
230 
231  fEta = pfCandidate->eta();
232  fPhi = pfCandidate->phi();
233  fPt = pfCandidate->pt();
234  fVx = pfCandidate->vx();
235  fVy = pfCandidate->vy();
236  fVz = pfCandidate->vz();
237 
238  pivotInBarrel = fabs(pfCandidate->positionAtECALEntrance().eta())<1.479;
239 
240  for(unsigned iPF=0; iPF<pfParticlesColl->size(); iPF++) {
241 
242  const reco::PFCandidate& pfParticle= (*pfParticlesColl)[iPF];
243 
244  if(&pfParticle==(pfCandidate))
245  continue;
246 
247  if(pfParticle.pdgId()==22){
248 
249  if(isPhotonParticleVetoed( &pfParticle)>=0.){
250  isoBin = (int)(fDeltaR/fRingSize);
251  fIsolationInRingsPhoton[isoBin] = fIsolationInRingsPhoton[isoBin] + pfParticle.pt();
252  }
253 
254  }else if(abs(pfParticle.pdgId())==130){
255 
256  if(isNeutralParticleVetoed( &pfParticle)>=0.){
257  isoBin = (int)(fDeltaR/fRingSize);
258  fIsolationInRingsNeutral[isoBin] = fIsolationInRingsNeutral[isoBin] + pfParticle.pt();
259  }
260 
261 
262  //}else if(abs(pfParticle.pdgId()) == 11 ||abs(pfParticle.pdgId()) == 13 || abs(pfParticle.pdgId()) == 211){
263  }else if(abs(pfParticle.pdgId()) == 211){
264  if(isChargedParticleVetoed( &pfParticle, vtx, vertices)>=0.){
265  isoBin = (int)(fDeltaR/fRingSize);
266  fIsolationInRingsCharged[isoBin] = fIsolationInRingsCharged[isoBin] + pfParticle.pt();
267  }
268 
269  }
270  }
271 
272 
273  for(int isoBin =0;isoBin<iNumberOfRings;isoBin++){
275  }
276 
277  return fIsolationInRings;
278 }
std::vector< float > fIsolationInRingsNeutral
virtual double vz() const
z coordinate of vertex position
Definition: PFCandidate.h:415
std::vector< float > fIsolationInRingsPhoton
float isChargedParticleVetoed(const reco::PFCandidate *pfIsoCand, edm::Handle< reco::VertexCollection > vertices)
virtual double phi() const final
momentum azimuthal angle
float isPhotonParticleVetoed(const reco::PFCandidate *pfIsoCand)
std::vector< float > fIsolationInRings
const math::XYZPointF & positionAtECALEntrance() const
Definition: PFCandidate.h:367
virtual double vx() const
x coordinate of vertex position
Definition: PFCandidate.h:413
std::vector< float > fIsolationInRingsChargedAll
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float isNeutralParticleVetoed(const reco::PFCandidate *pfIsoCand)
std::vector< float > fIsolationInRingsCharged
virtual double vy() const
y coordinate of vertex position
Definition: PFCandidate.h:414
virtual int pdgId() const final
PDG identifier.
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
virtual double eta() const final
momentum pseudorapidity
virtual double pt() const final
transverse momentum
vector< float > PFIsolationEstimator::fGetIsolationInRings ( const reco::Photon photon,
const reco::PFCandidateCollection pfParticlesColl,
reco::VertexRef  vtx,
edm::Handle< reco::VertexCollection vertices 
)

Definition at line 292 of file PFIsolationEstimator.cc.

References funct::abs(), fDeltaR, fEta, fIsolationInRings, fIsolationInRingsCharged, fIsolationInRingsChargedAll, fIsolationInRingsNeutral, fIsolationInRingsPhoton, fPhi, fRingSize, fVx, fVy, fVz, iMissHits, iNumberOfRings, isChargedParticleVetoed(), isNeutralParticleVetoed(), edm::Ref< C, T, F >::isNonnull(), isPhotonParticleVetoed(), reco::LeafCandidate::pdgId(), pivotInBarrel, reco::LeafCandidate::pt(), refSC, reco::Photon::superCluster(), reco::PFCandidate::superClusterRef(), reco::PFCandidate::vx(), reco::PFCandidate::vy(), and reco::PFCandidate::vz().

292  {
293 
294  int isoBin;
295 
296  for(isoBin =0;isoBin<iNumberOfRings;isoBin++){
297  fIsolationInRings[isoBin]=0.;
298  fIsolationInRingsPhoton[isoBin]=0.;
299  fIsolationInRingsNeutral[isoBin]=0.;
300  fIsolationInRingsCharged[isoBin]=0.;
301  fIsolationInRingsChargedAll[isoBin]=0.;
302  }
303 
304  iMissHits = 0;
305 
306  refSC = photon->superCluster();
307  pivotInBarrel = fabs((refSC->position().eta()))<1.479;
308 
309  for(unsigned iPF=0; iPF<pfParticlesColl->size(); iPF++) {
310 
311  const reco::PFCandidate& pfParticle= (*pfParticlesColl)[iPF];
312 
313  if (pfParticle.superClusterRef().isNonnull() &&
314  photon->superCluster().isNonnull() &&
315  pfParticle.superClusterRef() == photon->superCluster())
316  continue;
317 
318  if(pfParticle.pdgId()==22){
319 
320  // Set the vertex of reco::Photon to the first PV
321  math::XYZVector direction = math::XYZVector(photon->superCluster()->x() - pfParticle.vx(),
322  photon->superCluster()->y() - pfParticle.vy(),
323  photon->superCluster()->z() - pfParticle.vz());
324 
325  fEta = direction.Eta();
326  fPhi = direction.Phi();
327  fVx = pfParticle.vx();
328  fVy = pfParticle.vy();
329  fVz = pfParticle.vz();
330 
331  if(isPhotonParticleVetoed(&pfParticle)>=0.){
332  isoBin = (int)(fDeltaR/fRingSize);
333  fIsolationInRingsPhoton[isoBin] = fIsolationInRingsPhoton[isoBin] + pfParticle.pt();
334  }
335 
336  }else if(abs(pfParticle.pdgId())==130){
337 
338  // Set the vertex of reco::Photon to the first PV
339  math::XYZVector direction = math::XYZVector(photon->superCluster()->x() - pfParticle.vx(),
340  photon->superCluster()->y() - pfParticle.vy(),
341  photon->superCluster()->z() - pfParticle.vz());
342 
343  fEta = direction.Eta();
344  fPhi = direction.Phi();
345  fVx = pfParticle.vx();
346  fVy = pfParticle.vy();
347  fVz = pfParticle.vz();
348 
349  if(isNeutralParticleVetoed( &pfParticle)>=0.){
350  isoBin = (int)(fDeltaR/fRingSize);
351  fIsolationInRingsNeutral[isoBin] = fIsolationInRingsNeutral[isoBin] + pfParticle.pt();
352  }
353 
354  //}else if(abs(pfParticle.pdgId()) == 11 ||abs(pfParticle.pdgId()) == 13 || abs(pfParticle.pdgId()) == 211){
355  }else if(abs(pfParticle.pdgId()) == 211){
356 
357  // Set the vertex of reco::Photon to the first PV
358  math::XYZVector direction = math::XYZVector(photon->superCluster()->x() - (*vtx).x(),
359  photon->superCluster()->y() - (*vtx).y(),
360  photon->superCluster()->z() - (*vtx).z());
361 
362  fEta = direction.Eta();
363  fPhi = direction.Phi();
364  fVx = (*vtx).x();
365  fVy = (*vtx).y();
366  fVz = (*vtx).z();
367 
368  if(isChargedParticleVetoed( &pfParticle, vtx, vertices)>=0.){
369  isoBin = (int)(fDeltaR/fRingSize);
370  fIsolationInRingsCharged[isoBin] = fIsolationInRingsCharged[isoBin] + pfParticle.pt();
371  }
372 
373  }
374  }
375 
376 
377  for(int isoBin =0;isoBin<iNumberOfRings;isoBin++){
379  }
380 
381  return fIsolationInRings;
382 }
std::vector< float > fIsolationInRingsNeutral
virtual double vz() const
z coordinate of vertex position
Definition: PFCandidate.h:415
std::vector< float > fIsolationInRingsPhoton
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
float isChargedParticleVetoed(const reco::PFCandidate *pfIsoCand, edm::Handle< reco::VertexCollection > vertices)
float isPhotonParticleVetoed(const reco::PFCandidate *pfIsoCand)
std::vector< float > fIsolationInRings
virtual double vx() const
x coordinate of vertex position
Definition: PFCandidate.h:413
std::vector< float > fIsolationInRingsChargedAll
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float isNeutralParticleVetoed(const reco::PFCandidate *pfIsoCand)
std::vector< float > fIsolationInRingsCharged
reco::SuperClusterRef refSC
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
virtual double vy() const
y coordinate of vertex position
Definition: PFCandidate.h:414
virtual int pdgId() const final
PDG identifier.
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
virtual double pt() const final
transverse momentum
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any
Definition: PFCandidate.cc:600
vector< float > PFIsolationEstimator::fGetIsolationInRings ( const reco::GsfElectron electron,
const reco::PFCandidateCollection pfParticlesColl,
reco::VertexRef  vtx,
edm::Handle< reco::VertexCollection vertices 
)

Definition at line 397 of file PFIsolationEstimator.cc.

References funct::abs(), reco::LeafCandidate::eta(), fDeltaR, fEta, fIsolationInRings, fIsolationInRingsCharged, fIsolationInRingsChargedAll, fIsolationInRingsNeutral, fIsolationInRingsPhoton, fPhi, fPt, fRingSize, fVx, fVy, fVz, reco::GsfElectron::gsfTrack(), iMissHits, iNumberOfRings, isChargedParticleVetoed(), isNeutralParticleVetoed(), isPhotonParticleVetoed(), reco::LeafCandidate::pdgId(), reco::LeafCandidate::phi(), pivotInBarrel, reco::LeafCandidate::pt(), refSC, reco::GsfElectron::superCluster(), reco::LeafCandidate::vx(), reco::LeafCandidate::vy(), and reco::LeafCandidate::vz().

397  {
398 
399  int isoBin;
400 
401  for(isoBin =0;isoBin<iNumberOfRings;isoBin++){
402  fIsolationInRings[isoBin]=0.;
403  fIsolationInRingsPhoton[isoBin]=0.;
404  fIsolationInRingsNeutral[isoBin]=0.;
405  fIsolationInRingsCharged[isoBin]=0.;
406  fIsolationInRingsChargedAll[isoBin]=0.;
407  }
408 
409  // int iMatch = matchPFObject(electron,pfParticlesColl);
410 
411 
412  fEta = electron->eta();
413  fPhi = electron->phi();
414  fPt = electron->pt();
415  fVx = electron->vx();
416  fVy = electron->vy();
417  fVz = electron->vz();
418  iMissHits = electron->gsfTrack()->hitPattern().numberOfHits(HitPattern::MISSING_INNER_HITS);
419 
420  // if(electron->ecalDrivenSeed())
421  refSC = electron->superCluster();
422  pivotInBarrel = fabs((refSC->position().eta()))<1.479;
423 
424  for(unsigned iPF=0; iPF<pfParticlesColl->size(); iPF++) {
425 
426  const reco::PFCandidate& pfParticle= (*pfParticlesColl)[iPF];
427 
428 
429  if(pfParticle.pdgId()==22){
430 
431  if(isPhotonParticleVetoed(&pfParticle)>=0.){
432  isoBin = (int)(fDeltaR/fRingSize);
433  fIsolationInRingsPhoton[isoBin] = fIsolationInRingsPhoton[isoBin] + pfParticle.pt();
434 
435  }
436 
437  }else if(abs(pfParticle.pdgId())==130){
438 
439  if(isNeutralParticleVetoed( &pfParticle)>=0.){
440  isoBin = (int)(fDeltaR/fRingSize);
441  fIsolationInRingsNeutral[isoBin] = fIsolationInRingsNeutral[isoBin] + pfParticle.pt();
442  }
443 
444  //}else if(abs(pfParticle.pdgId()) == 11 ||abs(pfParticle.pdgId()) == 13 || abs(pfParticle.pdgId()) == 211){
445  }else if(abs(pfParticle.pdgId()) == 211){
446  if(isChargedParticleVetoed( &pfParticle, vtx, vertices)>=0.){
447  isoBin = (int)(fDeltaR/fRingSize);
448 
449  fIsolationInRingsCharged[isoBin] = fIsolationInRingsCharged[isoBin] + pfParticle.pt();
450  }
451 
452  }
453  }
454 
455 
456  for(int isoBin =0;isoBin<iNumberOfRings;isoBin++){
458  }
459 
460  return fIsolationInRings;
461 }
std::vector< float > fIsolationInRingsNeutral
std::vector< float > fIsolationInRingsPhoton
float isChargedParticleVetoed(const reco::PFCandidate *pfIsoCand, edm::Handle< reco::VertexCollection > vertices)
virtual double phi() const final
momentum azimuthal angle
float isPhotonParticleVetoed(const reco::PFCandidate *pfIsoCand)
std::vector< float > fIsolationInRings
virtual double vy() const
y coordinate of vertex position
std::vector< float > fIsolationInRingsChargedAll
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:182
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float isNeutralParticleVetoed(const reco::PFCandidate *pfIsoCand)
std::vector< float > fIsolationInRingsCharged
virtual double vz() const
z coordinate of vertex position
reco::SuperClusterRef refSC
virtual int pdgId() const final
PDG identifier.
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
virtual double vx() const
x coordinate of vertex position
virtual double eta() const final
momentum pseudorapidity
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:183
virtual double pt() const final
transverse momentum
float PFIsolationEstimator::getIsolationCharged ( )
inline
float PFIsolationEstimator::getIsolationChargedAll ( )
inline

Definition at line 135 of file PFIsolationEstimator.h.

References fIsolationChargedAll.

135 { return fIsolationChargedAll; };
std::vector<float > PFIsolationEstimator::getIsolationInRingsCharged ( )
inline

Definition at line 139 of file PFIsolationEstimator.h.

References fIsolationInRingsCharged.

139 { return fIsolationInRingsCharged; };
std::vector< float > fIsolationInRingsCharged
std::vector<float > PFIsolationEstimator::getIsolationInRingsChargedAll ( )
inline

Definition at line 140 of file PFIsolationEstimator.h.

References fIsolationInRingsChargedAll.

140 { return fIsolationInRingsChargedAll; };
std::vector< float > fIsolationInRingsChargedAll
std::vector<float > PFIsolationEstimator::getIsolationInRingsNeutral ( )
inline

Definition at line 138 of file PFIsolationEstimator.h.

References fIsolationInRingsNeutral.

138 { return fIsolationInRingsNeutral; };
std::vector< float > fIsolationInRingsNeutral
std::vector<float > PFIsolationEstimator::getIsolationInRingsPhoton ( )
inline

Definition at line 137 of file PFIsolationEstimator.h.

References fIsolationInRingsPhoton.

137 { return fIsolationInRingsPhoton; };
std::vector< float > fIsolationInRingsPhoton
float PFIsolationEstimator::getIsolationNeutral ( )
inline
float PFIsolationEstimator::getIsolationPhoton ( )
inline

Definition at line 132 of file PFIsolationEstimator.h.

References fIsolationInRingsPhoton, and fIsolationPhoton.

Referenced by AdHocNTupler::fill().

int PFIsolationEstimator::getNumbersOfRings ( )
inline

Definition at line 146 of file PFIsolationEstimator.h.

References iNumberOfRings.

float PFIsolationEstimator::getRingSize ( )
inline

Definition at line 147 of file PFIsolationEstimator.h.

References fRingSize.

147 {return fRingSize; };
void PFIsolationEstimator::initialize ( Bool_t  bApplyVeto,
int  iParticleType 
)
private

Definition at line 44 of file PFIsolationEstimator.cc.

References checkClosestZVertex, kElectron, setApplyDzDxyVeto(), setApplyMissHitPhVeto(), setApplyPFPUVeto(), setApplyVeto(), setConeSize(), setDeltaRVetoBarrel(), setDeltaRVetoBarrelCharged(), setDeltaRVetoBarrelNeutrals(), setDeltaRVetoBarrelPhotons(), setDeltaRVetoEndcap(), setDeltaRVetoEndcapCharged(), setDeltaRVetoEndcapNeutrals(), setDeltaRVetoEndcapPhotons(), setNumberOfCrystalEndcapPhotons(), setParticleType(), setRectangleDeltaEtaVetoBarrelCharged(), setRectangleDeltaEtaVetoBarrelNeutrals(), setRectangleDeltaEtaVetoBarrelPhotons(), setRectangleDeltaEtaVetoEndcapCharged(), setRectangleDeltaEtaVetoEndcapNeutrals(), setRectangleDeltaEtaVetoEndcapPhotons(), setRectangleDeltaPhiVetoBarrelCharged(), setRectangleDeltaPhiVetoBarrelNeutrals(), setRectangleDeltaPhiVetoBarrelPhotons(), setRectangleDeltaPhiVetoEndcapCharged(), setRectangleDeltaPhiVetoEndcapNeutrals(), setRectangleDeltaPhiVetoEndcapPhotons(), setRectangleVetoBarrel(), setRectangleVetoEndcap(), and setUseCrystalSize().

Referenced by initializeElectronIsolation(), initializeElectronIsolationInRings(), initializePhotonIsolation(), and initializePhotonIsolationInRings().

44  {
45 
47 
48  //By default check for an option vertex association
49  checkClosestZVertex = kTRUE;
50 
51  //Apply vetoes
53 
60 
61 
68 
69 
76 
77 
79 
80  //Setup veto conditions for electrons
81  setDeltaRVetoBarrel(kTRUE);
82  setDeltaRVetoEndcap(kTRUE);
83  setRectangleVetoBarrel(kFALSE);
84  setRectangleVetoEndcap(kFALSE);
85  setApplyDzDxyVeto(kFALSE);
86  setApplyPFPUVeto(kTRUE);
87  setApplyMissHitPhVeto(kTRUE); //NOTE: decided to go for this on the 26May 2012
88  //Current recommended default value for the electrons
89  setUseCrystalSize(kFALSE);
90 
91  // setDeltaRVetoBarrelPhotons(1E-5); //NOTE: just to be in synch with the isoDep: fixed isoDep in 26May
92  // setDeltaRVetoBarrelCharged(1E-5); //NOTE: just to be in synch with the isoDep: fixed isoDep in 26May
93  // setDeltaRVetoBarrelNeutrals(1E-5); //NOTE: just to be in synch with the isoDep: fixed isoDep in 26May
96  // setDeltaRVetoEndcapNeutrals(1E-5); //NOTE: just to be in synch with the isoDep: fixed isoDep in 26May
97 
98  setConeSize(0.4);
99 
100 
101  }else{
102  //Setup veto conditions for photons
103  setApplyDzDxyVeto(kTRUE);
104  setApplyPFPUVeto(kTRUE);
105  setApplyMissHitPhVeto(kFALSE);
106  setDeltaRVetoBarrel(kTRUE);
107  setDeltaRVetoEndcap(kTRUE);
108  setRectangleVetoBarrel(kTRUE);
109  setRectangleVetoEndcap(kFALSE);
110  setUseCrystalSize(kTRUE);
111  setConeSize(0.3);
112 
122 
133  }
134 
135 
136 }
void setRectangleVetoEndcap(Bool_t bValue=kTRUE)
void setDeltaRVetoBarrel(Bool_t bValue=kTRUE)
void setNumberOfCrystalEndcapPhotons(float fValue=-1)
void setDeltaRVetoEndcap(Bool_t bValue=kTRUE)
void setRectangleDeltaPhiVetoBarrelPhotons(float fValue=-1.0)
void setApplyMissHitPhVeto(Bool_t bValue=kFALSE)
void setApplyDzDxyVeto(Bool_t bValue=kTRUE)
void setDeltaRVetoBarrelNeutrals(float fValue=-1.0)
void setDeltaRVetoEndcapNeutrals(float fValue=-1.0)
void setDeltaRVetoBarrelCharged(float fValue=-1.0)
void setDeltaRVetoEndcapPhotons(float fValue=-1.0)
void setApplyPFPUVeto(Bool_t bValue=kFALSE)
void setRectangleVetoBarrel(Bool_t bValue=kTRUE)
void setRectangleDeltaEtaVetoBarrelNeutrals(float fValue=-1.0)
void setUseCrystalSize(Bool_t bValue=kFALSE)
void setParticleType(int iValue)
void setRectangleDeltaPhiVetoBarrelCharged(float fValue=-1.0)
void setRectangleDeltaPhiVetoEndcapNeutrals(float fValue=-1.0)
void setRectangleDeltaPhiVetoBarrelNeutrals(float fValue=-1.0)
void setRectangleDeltaEtaVetoBarrelCharged(float fValue=-1.0)
void setDeltaRVetoBarrelPhotons(float fValue=-1.0)
void setRectangleDeltaPhiVetoEndcapCharged(float fValue=-1.0)
void setRectangleDeltaEtaVetoEndcapCharged(float fValue=-1.0)
void setRectangleDeltaEtaVetoEndcapPhotons(float fValue=-1.0)
void setDeltaRVetoEndcapCharged(float fValue=-1.0)
void setApplyVeto(Bool_t bValue=kTRUE)
void setRectangleDeltaPhiVetoEndcapPhotons(float fValue=-1.0)
void setRectangleDeltaEtaVetoBarrelPhotons(float fValue=-1.0)
void setRectangleDeltaEtaVetoEndcapNeutrals(float fValue=-1.0)
void setConeSize(float fValue=0.4)
void PFIsolationEstimator::initializeElectronIsolation ( Bool_t  bApplyVeto)

Definition at line 139 of file PFIsolationEstimator.cc.

References fConeSize, initialize(), initializeRings(), and kElectron.

139  {
142 
143 // std::cout << " ********* Init Entering in kElectron setup "
144 // << " bApplyVeto " << bApplyVeto
145 // << " bDeltaRVetoBarrel " << bDeltaRVetoBarrel
146 // << " bDeltaRVetoEndcap " << bDeltaRVetoEndcap
147 // << " cone size " << fConeSize
148 // << " fDeltaRVetoEndcapPhotons " << fDeltaRVetoEndcapPhotons
149 // << " fDeltaRVetoEndcapNeutrals " << fDeltaRVetoEndcapNeutrals
150 // << " fDeltaRVetoEndcapCharged " << fDeltaRVetoEndcapCharged << std::endl;
151 
152 }
void initialize(Bool_t bApplyVeto, int iParticleType)
void initializeRings(int iNumberOfRings, float fRingSize)
void PFIsolationEstimator::initializeElectronIsolationInRings ( Bool_t  bApplyVeto,
int  iNumberOfRings,
float  fRingSize 
)

Definition at line 162 of file PFIsolationEstimator.cc.

References initialize(), initializeRings(), and kElectron.

void PFIsolationEstimator::initializePhotonIsolation ( Bool_t  bApplyVeto)

Definition at line 155 of file PFIsolationEstimator.cc.

References fConeSize, initialize(), initializeRings(), and kPhoton.

Referenced by AdHocNTupler::fill().

155  {
158 }
void initialize(Bool_t bApplyVeto, int iParticleType)
void initializeRings(int iNumberOfRings, float fRingSize)
void PFIsolationEstimator::initializePhotonIsolationInRings ( Bool_t  bApplyVeto,
int  iNumberOfRings,
float  fRingSize 
)

Definition at line 168 of file PFIsolationEstimator.cc.

References initialize(), initializeRings(), and kPhoton.

void PFIsolationEstimator::initializeRings ( int  iNumberOfRings,
float  fRingSize 
)

Definition at line 175 of file PFIsolationEstimator.cc.

References fConeSize, fIsolationInRings, fIsolationInRingsCharged, fIsolationInRingsChargedAll, fIsolationInRingsNeutral, fIsolationInRingsPhoton, iNumberOfRings, setNumbersOfRings(), and setRingSize().

Referenced by initializeElectronIsolation(), initializeElectronIsolationInRings(), initializePhotonIsolation(), and initializePhotonIsolationInRings().

175  {
176 
179 
180  fIsolationInRings.clear();
181  for(int isoBin =0;isoBin<iNumberOfRings;isoBin++){
182  float fTemp = 0.0;
183  fIsolationInRings.push_back(fTemp);
184 
185  float fTempPhoton = 0.0;
186  fIsolationInRingsPhoton.push_back(fTempPhoton);
187 
188  float fTempNeutral = 0.0;
189  fIsolationInRingsNeutral.push_back(fTempNeutral);
190 
191  float fTempCharged = 0.0;
192  fIsolationInRingsCharged.push_back(fTempCharged);
193 
194  float fTempChargedAll = 0.0;
195  fIsolationInRingsChargedAll.push_back(fTempChargedAll);
196 
197  }
198 
199  fConeSize = fRingSize * (float)iNumberOfRings;
200 
201 }
std::vector< float > fIsolationInRingsNeutral
std::vector< float > fIsolationInRingsPhoton
void setNumbersOfRings(int iValue=1)
std::vector< float > fIsolationInRings
std::vector< float > fIsolationInRingsChargedAll
std::vector< float > fIsolationInRingsCharged
void setRingSize(float fValue=0.4)
float PFIsolationEstimator::isChargedParticleVetoed ( const reco::PFCandidate pfIsoCand,
edm::Handle< reco::VertexCollection vertices 
)

Definition at line 573 of file PFIsolationEstimator.cc.

Referenced by fGetIsolationInRings().

573  {
574  //need code to handle special conditions
575 
576  return -999;
577 }
float PFIsolationEstimator::isChargedParticleVetoed ( const reco::PFCandidate pfIsoCand,
reco::VertexRef  vtx,
edm::Handle< reco::VertexCollection vertices 
)

Definition at line 580 of file PFIsolationEstimator.cc.

References funct::abs(), bApplyDzDxyVeto, bApplyPFPUVeto, bApplyVeto, bDeltaRVetoBarrel, bDeltaRVetoEndcap, bRectangleVetoBarrel, bRectangleVetoEndcap, chargedHadronVertex(), SiPixelRawToDigiRegional_cfi::deltaPhi, deltaR(), reco::LeafCandidate::eta(), fConeSize, fDeltaEta, fDeltaPhi, fDeltaR, fDeltaRVetoBarrelCharged, fDeltaRVetoEndcapCharged, fEta, fPhi, fRectangleDeltaEtaVetoBarrelCharged, fRectangleDeltaEtaVetoEndcapCharged, fRectangleDeltaPhiVetoBarrelCharged, fRectangleDeltaPhiVetoEndcapCharged, fVx, fVy, iParticleType, edm::Ref< C, T, F >::isNull(), kPhoton, reco::LeafCandidate::phi(), pivotInBarrel, reco::LeafCandidate::pt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), and reco::PFCandidate::trackRef().

580  {
581 
582  VertexRef vtx = chargedHadronVertex(vertices, *pfIsoCand );
583  if(vtx.isNull())
584  return -999.;
585 
586 // float fVtxMainX = (*vtxMain).x();
587 // float fVtxMainY = (*vtxMain).y();
588  float fVtxMainZ = (*vtxMain).z();
589 
590  if(bApplyPFPUVeto) {
591  if(vtx != vtxMain)
592  return -999.;
593  }
594 
595 
596  if(bApplyDzDxyVeto) {
597  if(iParticleType==kPhoton){
598 
599  float dz = fabs( pfIsoCand->trackRef()->dz( (*vtxMain).position() ) );
600  if (dz > 0.2)
601  return -999.;
602 
603  double dxy = pfIsoCand->trackRef()->dxy( (*vtxMain).position() );
604  if (fabs(dxy) > 0.1)
605  return -999.;
606 
607  /*
608  float dz = fabs(vtx->z() - fVtxMainZ);
609  if (dz > 1.)
610  return -999.;
611 
612 
613  double dxy = ( -(vtx->x() - fVtxMainX)*pfIsoCand->py() + (vtx->y() - fVtxMainY)*pfIsoCand->px()) / pfIsoCand->pt();
614 
615  if(fabs(dxy) > 0.2)
616  return -999.;
617  */
618  }else{
619 
620 
621  float dz = fabs(vtx->z() - fVtxMainZ);
622  if (dz > 1.)
623  return -999.;
624 
625  double dxy = ( -(vtx->x() - fVx)*pfIsoCand->py() + (vtx->y() - fVy)*pfIsoCand->px()) / pfIsoCand->pt();
626  if(fabs(dxy) > 0.1)
627  return -999.;
628  }
629  }
630 
631  fDeltaR = deltaR(pfIsoCand->eta(),pfIsoCand->phi(),fEta,fPhi);
632 
633  if(fDeltaR > fConeSize)
634  return -999.;
635 
636  fDeltaPhi = deltaPhi(fPhi,pfIsoCand->phi());
637  fDeltaEta = fEta-pfIsoCand->eta();
638 
639 
640 // std::cout << " charged hadron: DR " << fDeltaR
641 // << " pt " << pfIsoCand->pt() << " eta,phi " << pfIsoCand->eta() << ", " << pfIsoCand->phi()
642 // << " fVtxMainZ " << (*vtxMain).z() << " cand z " << vtx->z() << std::endl;
643 
644 
645  if(!bApplyVeto)
646  return fDeltaR;
647 
648  //NOTE: get the direction for the EB/EE transition region from the deposit just to be in synch with the isoDep
649  // this will be changed in the future
650  if(pivotInBarrel){
652  return fDeltaR;
653  }
654 
655  if(bDeltaRVetoBarrel){
657  return -999.;
658  }
661  return -999.;
662  }
663  }
664 
665  }else{
667  return fDeltaR;
668  }
669  if(bDeltaRVetoEndcap){
671  return -999.;
672  }
675  return -999.;
676  }
677  }
678  }
679 
680 
681 
682 
683  return fDeltaR;
684 }
virtual double phi() const final
momentum azimuthal angle
reco::VertexRef chargedHadronVertex(edm::Handle< reco::VertexCollection > verticies, const reco::PFCandidate &pfcand)
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:433
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual double py() const final
y coordinate of momentum vector
bool isNull() const
Checks for null.
Definition: Ref.h:249
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
virtual double px() const final
x coordinate of momentum vector
virtual double eta() const final
momentum pseudorapidity
virtual double pt() const final
transverse momentum
Bool_t PFIsolationEstimator::isInitialized ( ) const
inline

Definition at line 70 of file PFIsolationEstimator.h.

References fisInitialized.

70 { return fisInitialized; }
float PFIsolationEstimator::isNeutralParticleVetoed ( const reco::PFCandidate pfIsoCand)

Definition at line 523 of file PFIsolationEstimator.cc.

References funct::abs(), bApplyVeto, bDeltaRVetoBarrel, bDeltaRVetoEndcap, bRectangleVetoBarrel, bRectangleVetoEndcap, SiPixelRawToDigiRegional_cfi::deltaPhi, deltaR(), reco::LeafCandidate::eta(), fConeSize, fDeltaEta, fDeltaPhi, fDeltaR, fDeltaRVetoBarrelNeutrals, fDeltaRVetoEndcapNeutrals, fEta, fPhi, fRectangleDeltaEtaVetoBarrelNeutrals, fRectangleDeltaEtaVetoEndcapNeutrals, fRectangleDeltaPhiVetoBarrelNeutrals, fRectangleDeltaPhiVetoEndcapNeutrals, reco::LeafCandidate::phi(), and pivotInBarrel.

Referenced by fGetIsolationInRings().

523  {
524 
525  fDeltaR = deltaR(fEta,fPhi,pfIsoCand->eta(),pfIsoCand->phi());
526 
527  if(fDeltaR > fConeSize)
528  return -999;
529 
530  fDeltaPhi = deltaPhi(fPhi,pfIsoCand->phi());
531  fDeltaEta = fEta-pfIsoCand->eta();
532 
533  if(!bApplyVeto)
534  return fDeltaR;
535 
536  //NOTE: get the direction for the EB/EE transition region from the deposit just to be in synch with the isoDep
537  // this will be changed in the future
538  if(pivotInBarrel){
540  return fDeltaR;
541  }
542 
543  if(bDeltaRVetoBarrel){
545  return -999.;
546  }
549  return -999.;
550  }
551  }
552 
553  }else{
555  return fDeltaR;
556  }
557  if(bDeltaRVetoEndcap){
559  return -999.;
560  }
563  return -999.;
564  }
565  }
566  }
567 
568  return fDeltaR;
569 }
virtual double phi() const final
momentum azimuthal angle
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
virtual double eta() const final
momentum pseudorapidity
float PFIsolationEstimator::isPhotonParticleVetoed ( const reco::PFCandidate pfIsoCand)

Definition at line 465 of file PFIsolationEstimator.cc.

References funct::abs(), bApplyMissHitPhVeto, bApplyVeto, bDeltaRVetoBarrel, bDeltaRVetoEndcap, bRectangleVetoBarrel, bRectangleVetoEndcap, bUseCrystalSize, SiPixelRawToDigiRegional_cfi::deltaPhi, deltaR(), reco::LeafCandidate::eta(), fConeSize, fDeltaEta, fDeltaPhi, fDeltaR, fDeltaRVetoBarrelPhotons, fDeltaRVetoEndcapPhotons, fEta, fNumberOfCrystalEndcapPhotons, fPhi, fRectangleDeltaEtaVetoBarrelPhotons, fRectangleDeltaEtaVetoEndcapPhotons, fRectangleDeltaPhiVetoBarrelPhotons, fRectangleDeltaPhiVetoEndcapPhotons, iMissHits, edm::Ref< C, T, F >::isNonnull(), reco::PFCandidate::mva_nothing_gamma(), reco::LeafCandidate::phi(), pivotInBarrel, refSC, and reco::PFCandidate::superClusterRef().

Referenced by fGetIsolationInRings().

465  {
466 
467 
468  fDeltaR = deltaR(fEta,fPhi,pfIsoCand->eta(),pfIsoCand->phi());
469 
470  if(fDeltaR > fConeSize)
471  return -999.;
472 
473  fDeltaPhi = deltaPhi(fPhi,pfIsoCand->phi());
474  fDeltaEta = fEta-pfIsoCand->eta();
475 
476  if(!bApplyVeto)
477  return fDeltaR;
478 
479  //NOTE: get the direction for the EB/EE transition region from the deposit just to be in synch with the isoDep
480  // this will be changed in the future
481 
482  if(bApplyMissHitPhVeto) {
483  if(iMissHits > 0)
484  if(pfIsoCand->mva_nothing_gamma() > 0.99) {
485  if(pfIsoCand->superClusterRef().isNonnull() && refSC.isNonnull()) {
486  if(pfIsoCand->superClusterRef() == refSC)
487  return -999.;
488  }
489  }
490  }
491 
492  if(pivotInBarrel){
493  if(bDeltaRVetoBarrel){
495  return -999.;
496  }
497 
500  return -999.;
501  }
502  }
503  }else{
504  if (bUseCrystalSize == true) {
505  fDeltaRVetoEndcapPhotons = 0.00864*fabs(sinh(refSC->position().eta()))*fNumberOfCrystalEndcapPhotons;
506  }
507 
508  if(bDeltaRVetoEndcap){
510  return -999.;
511  }
514  return -999.;
515  }
516  }
517  }
518 
519  return fDeltaR;
520 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
float mva_nothing_gamma() const
mva for gamma detection
Definition: PFCandidate.h:332
virtual double phi() const final
momentum azimuthal angle
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::SuperClusterRef refSC
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
virtual double eta() const final
momentum pseudorapidity
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any
Definition: PFCandidate.cc:600
int PFIsolationEstimator::matchPFObject ( const reco::Photon photon,
const reco::PFCandidateCollection pfParticlesColl 
)

Definition at line 762 of file PFIsolationEstimator.cc.

References Abs(), i, reco::LeafCandidate::pdgId(), reco::Photon::superCluster(), and reco::PFCandidate::superClusterRef().

762  {
763 
764  Int_t iMatch = -1;
765 
766  int i=0;
767  for(reco::PFCandidateCollection::const_iterator iPF=Candidates->begin();iPF !=Candidates->end();iPF++){
768  const reco::PFCandidate& pfParticle = (*iPF);
769  // if((((pfParticle.pdgId()==22 && pfParticle.mva_nothing_gamma()>0.01) || TMath::Abs(pfParticle.pdgId())==11) )){
770  if((((pfParticle.pdgId()==22 ) || TMath::Abs(pfParticle.pdgId())==11) )){
771 
772  if(pfParticle.superClusterRef()==photon->superCluster())
773  iMatch= i;
774 
775  }
776 
777  i++;
778  }
779 
780 /*
781  if(iMatch == -1){
782  i=0;
783  float fPt = -1;
784  for(reco::PFCandidateCollection::const_iterator iPF=Candidates->begin();iPF !=Candidates->end();iPF++){
785  const reco::PFCandidate& pfParticle = (*iPF);
786  if((((pfParticle.pdgId()==22 ) || TMath::Abs(pfParticle.pdgId())==11) )){
787  if(pfParticle.pt()>fPt){
788  fDeltaR = deltaR(pfParticle.eta(),pfParticle.phi(),photon->eta(),photon->phi());
789  if(fDeltaR<0.1){
790  iMatch = i;
791  fPt = pfParticle.pt();
792  }
793  }
794  }
795  i++;
796  }
797  }
798 */
799 
800  return iMatch;
801 
802 }
int i
Definition: DBlmapReader.cc:9
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
T Abs(T a)
Definition: MathUtil.h:49
virtual int pdgId() const final
PDG identifier.
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any
Definition: PFCandidate.cc:600
int PFIsolationEstimator::matchPFObject ( const reco::GsfElectron photon,
const reco::PFCandidateCollection pfParticlesColl 
)

Definition at line 808 of file PFIsolationEstimator.cc.

References Abs(), deltaR(), reco::LeafCandidate::eta(), fDeltaR, fPt, i, reco::LeafCandidate::pdgId(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::GsfElectron::superCluster(), and reco::PFCandidate::superClusterRef().

808  {
809 
810  Int_t iMatch = -1;
811 
812  int i=0;
813  for(reco::PFCandidateCollection::const_iterator iPF=Candidates->begin();iPF !=Candidates->end();iPF++){
814  const reco::PFCandidate& pfParticle = (*iPF);
815  // if((((pfParticle.pdgId()==22 && pfParticle.mva_nothing_gamma()>0.01) || TMath::Abs(pfParticle.pdgId())==11) )){
816  if((((pfParticle.pdgId()==22 ) || TMath::Abs(pfParticle.pdgId())==11) )){
817 
818  if(pfParticle.superClusterRef()==electron->superCluster())
819  iMatch= i;
820 
821  }
822 
823  i++;
824  }
825 
826  if(iMatch == -1){
827  i=0;
828  float fPt = -1;
829  for(reco::PFCandidateCollection::const_iterator iPF=Candidates->begin();iPF !=Candidates->end();iPF++){
830  const reco::PFCandidate& pfParticle = (*iPF);
831  if((((pfParticle.pdgId()==22 ) || TMath::Abs(pfParticle.pdgId())==11) )){
832  if(pfParticle.pt()>fPt){
833  fDeltaR = deltaR(pfParticle.eta(),pfParticle.phi(),electron->eta(),electron->phi());
834  if(fDeltaR<0.1){
835  iMatch = i;
836  fPt = pfParticle.pt();
837  }
838  }
839  }
840  i++;
841  }
842  }
843 
844  return iMatch;
845 
846 }
int i
Definition: DBlmapReader.cc:9
virtual double phi() const final
momentum azimuthal angle
T Abs(T a)
Definition: MathUtil.h:49
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
virtual int pdgId() const final
PDG identifier.
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
virtual double eta() const final
momentum pseudorapidity
virtual double pt() const final
transverse momentum
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any
Definition: PFCandidate.cc:600
void PFIsolationEstimator::setApplyDzDxyVeto ( Bool_t  bValue = kTRUE)
inline

Definition at line 92 of file PFIsolationEstimator.h.

References bApplyDzDxyVeto.

Referenced by initialize().

92 { bApplyDzDxyVeto = bValue;};
void PFIsolationEstimator::setApplyMissHitPhVeto ( Bool_t  bValue = kFALSE)
inline

Definition at line 93 of file PFIsolationEstimator.h.

References bApplyMissHitPhVeto.

Referenced by initialize().

93 { bApplyMissHitPhVeto = bValue;};
void PFIsolationEstimator::setApplyPFPUVeto ( Bool_t  bValue = kFALSE)
inline

Definition at line 91 of file PFIsolationEstimator.h.

References bApplyPFPUVeto.

Referenced by initialize().

91 {bApplyPFPUVeto = bValue;};
void PFIsolationEstimator::setApplyVeto ( Bool_t  bValue = kTRUE)
inline

Definition at line 90 of file PFIsolationEstimator.h.

References bApplyVeto.

Referenced by initialize().

90 { bApplyVeto = bValue;};
void PFIsolationEstimator::setConeSize ( float  fValue = 0.4)
inline

Definition at line 85 of file PFIsolationEstimator.h.

References fConeSize, and hcaldqm::axis::fValue.

Referenced by AdHocNTupler::fill(), and initialize().

void PFIsolationEstimator::setDeltaRVetoBarrel ( Bool_t  bValue = kTRUE)
inline

Definition at line 94 of file PFIsolationEstimator.h.

References bDeltaRVetoBarrel.

Referenced by initialize().

94 { bDeltaRVetoBarrel = bValue;};
void PFIsolationEstimator::setDeltaRVetoBarrelCharged ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setDeltaRVetoBarrelNeutrals ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setDeltaRVetoBarrelPhotons ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setDeltaRVetoEndcap ( Bool_t  bValue = kTRUE)
inline

Definition at line 95 of file PFIsolationEstimator.h.

References bDeltaRVetoEndcap.

Referenced by initialize().

95 { bDeltaRVetoEndcap = bValue;};
void PFIsolationEstimator::setDeltaRVetoEndcapCharged ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setDeltaRVetoEndcapNeutrals ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setDeltaRVetoEndcapPhotons ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setNumberOfCrystalEndcapPhotons ( float  fValue = -1)
inline
void PFIsolationEstimator::setNumbersOfRings ( int  iValue = 1)
inline

Definition at line 143 of file PFIsolationEstimator.h.

References iNumberOfRings.

Referenced by initializeRings().

143 {iNumberOfRings = iValue;};
void PFIsolationEstimator::setParticleType ( int  iValue)
inline

Definition at line 87 of file PFIsolationEstimator.h.

References iParticleType.

Referenced by initialize().

void PFIsolationEstimator::setRectangleDeltaEtaVetoBarrelCharged ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setRectangleDeltaEtaVetoBarrelNeutrals ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setRectangleDeltaEtaVetoBarrelPhotons ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setRectangleDeltaEtaVetoEndcapCharged ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setRectangleDeltaEtaVetoEndcapNeutrals ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setRectangleDeltaEtaVetoEndcapPhotons ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setRectangleDeltaPhiVetoBarrelCharged ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setRectangleDeltaPhiVetoBarrelNeutrals ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setRectangleDeltaPhiVetoBarrelPhotons ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setRectangleDeltaPhiVetoEndcapCharged ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setRectangleDeltaPhiVetoEndcapNeutrals ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setRectangleDeltaPhiVetoEndcapPhotons ( float  fValue = -1.0)
inline
void PFIsolationEstimator::setRectangleVetoBarrel ( Bool_t  bValue = kTRUE)
inline

Definition at line 96 of file PFIsolationEstimator.h.

References bRectangleVetoBarrel.

Referenced by initialize().

96 { bRectangleVetoBarrel = bValue;};
void PFIsolationEstimator::setRectangleVetoEndcap ( Bool_t  bValue = kTRUE)
inline

Definition at line 97 of file PFIsolationEstimator.h.

References bRectangleVetoEndcap.

Referenced by initialize().

97 { bRectangleVetoEndcap = bValue;};
void PFIsolationEstimator::setRingSize ( float  fValue = 0.4)
inline

Definition at line 144 of file PFIsolationEstimator.h.

References fRingSize, and hcaldqm::axis::fValue.

Referenced by initializeRings().

void PFIsolationEstimator::setUseCrystalSize ( Bool_t  bValue = kFALSE)
inline

Definition at line 99 of file PFIsolationEstimator.h.

References bUseCrystalSize.

Referenced by initialize().

99 { bUseCrystalSize = bValue;};

Member Data Documentation

Bool_t PFIsolationEstimator::bApplyDzDxyVeto
private

Definition at line 173 of file PFIsolationEstimator.h.

Referenced by isChargedParticleVetoed(), and setApplyDzDxyVeto().

Bool_t PFIsolationEstimator::bApplyMissHitPhVeto
private

Definition at line 175 of file PFIsolationEstimator.h.

Referenced by isPhotonParticleVetoed(), and setApplyMissHitPhVeto().

Bool_t PFIsolationEstimator::bApplyPFPUVeto
private

Definition at line 174 of file PFIsolationEstimator.h.

Referenced by isChargedParticleVetoed(), and setApplyPFPUVeto().

Bool_t PFIsolationEstimator::bApplyVeto
private
Bool_t PFIsolationEstimator::bDeltaRVetoBarrel
private
Bool_t PFIsolationEstimator::bDeltaRVetoEndcap
private
Bool_t PFIsolationEstimator::bRectangleVetoBarrel
private
Bool_t PFIsolationEstimator::bRectangleVetoEndcap
private
Bool_t PFIsolationEstimator::bUseCrystalSize
private

Definition at line 176 of file PFIsolationEstimator.h.

Referenced by isPhotonParticleVetoed(), and setUseCrystalSize().

Bool_t PFIsolationEstimator::checkClosestZVertex
private

Definition at line 170 of file PFIsolationEstimator.h.

Referenced by chargedHadronVertex(), and initialize().

float PFIsolationEstimator::fConeSize
private
float PFIsolationEstimator::fDeltaEta
private
float PFIsolationEstimator::fDeltaPhi
private
float PFIsolationEstimator::fDeltaR
private
float PFIsolationEstimator::fDeltaRVetoBarrelCharged
private

Definition at line 186 of file PFIsolationEstimator.h.

Referenced by isChargedParticleVetoed(), and setDeltaRVetoBarrelCharged().

float PFIsolationEstimator::fDeltaRVetoBarrelNeutrals
private

Definition at line 185 of file PFIsolationEstimator.h.

Referenced by isNeutralParticleVetoed(), and setDeltaRVetoBarrelNeutrals().

float PFIsolationEstimator::fDeltaRVetoBarrelPhotons
private

Definition at line 184 of file PFIsolationEstimator.h.

Referenced by isPhotonParticleVetoed(), and setDeltaRVetoBarrelPhotons().

float PFIsolationEstimator::fDeltaRVetoEndcapCharged
private

Definition at line 190 of file PFIsolationEstimator.h.

Referenced by isChargedParticleVetoed(), and setDeltaRVetoEndcapCharged().

float PFIsolationEstimator::fDeltaRVetoEndcapNeutrals
private

Definition at line 189 of file PFIsolationEstimator.h.

Referenced by isNeutralParticleVetoed(), and setDeltaRVetoEndcapNeutrals().

float PFIsolationEstimator::fDeltaRVetoEndcapPhotons
private

Definition at line 188 of file PFIsolationEstimator.h.

Referenced by isPhotonParticleVetoed(), and setDeltaRVetoEndcapPhotons().

float PFIsolationEstimator::fEta
private
float PFIsolationEstimator::fEtaSC
private

Definition at line 221 of file PFIsolationEstimator.h.

Bool_t PFIsolationEstimator::fisInitialized
private

Definition at line 157 of file PFIsolationEstimator.h.

Referenced by isInitialized().

float PFIsolationEstimator::fIsolation
private

Definition at line 158 of file PFIsolationEstimator.h.

Referenced by fGetIsolation().

float PFIsolationEstimator::fIsolationCharged
private

Definition at line 161 of file PFIsolationEstimator.h.

Referenced by getIsolationCharged().

float PFIsolationEstimator::fIsolationChargedAll
private

Definition at line 162 of file PFIsolationEstimator.h.

Referenced by getIsolationChargedAll().

std::vector<float > PFIsolationEstimator::fIsolationInRings
private

Definition at line 164 of file PFIsolationEstimator.h.

Referenced by fGetIsolation(), fGetIsolationInRings(), and initializeRings().

std::vector<float > PFIsolationEstimator::fIsolationInRingsCharged
private
std::vector<float > PFIsolationEstimator::fIsolationInRingsChargedAll
private
std::vector<float > PFIsolationEstimator::fIsolationInRingsNeutral
private
std::vector<float > PFIsolationEstimator::fIsolationInRingsPhoton
private
float PFIsolationEstimator::fIsolationNeutral
private

Definition at line 160 of file PFIsolationEstimator.h.

Referenced by getIsolationNeutral().

float PFIsolationEstimator::fIsolationPhoton
private

Definition at line 159 of file PFIsolationEstimator.h.

Referenced by getIsolationPhoton().

float PFIsolationEstimator::fNumberOfCrystalEndcapPhotons
private
float PFIsolationEstimator::fPhi
private
float PFIsolationEstimator::fPhiSC
private

Definition at line 222 of file PFIsolationEstimator.h.

float PFIsolationEstimator::fPt
private

Definition at line 224 of file PFIsolationEstimator.h.

Referenced by fGetIsolationInRings(), and matchPFObject().

float PFIsolationEstimator::fRectangleDeltaEtaVetoBarrelCharged
private
float PFIsolationEstimator::fRectangleDeltaEtaVetoBarrelNeutrals
private
float PFIsolationEstimator::fRectangleDeltaEtaVetoBarrelPhotons
private
float PFIsolationEstimator::fRectangleDeltaEtaVetoEndcapCharged
private
float PFIsolationEstimator::fRectangleDeltaEtaVetoEndcapNeutrals
private
float PFIsolationEstimator::fRectangleDeltaEtaVetoEndcapPhotons
private
float PFIsolationEstimator::fRectangleDeltaPhiVetoBarrelCharged
private
float PFIsolationEstimator::fRectangleDeltaPhiVetoBarrelNeutrals
private
float PFIsolationEstimator::fRectangleDeltaPhiVetoBarrelPhotons
private
float PFIsolationEstimator::fRectangleDeltaPhiVetoEndcapCharged
private
float PFIsolationEstimator::fRectangleDeltaPhiVetoEndcapNeutrals
private
float PFIsolationEstimator::fRectangleDeltaPhiVetoEndcapPhotons
private
float PFIsolationEstimator::fRingSize
private

Definition at line 213 of file PFIsolationEstimator.h.

Referenced by fGetIsolationInRings(), getRingSize(), and setRingSize().

float PFIsolationEstimator::fVx
private

Definition at line 225 of file PFIsolationEstimator.h.

Referenced by fGetIsolationInRings(), and isChargedParticleVetoed().

float PFIsolationEstimator::fVy
private

Definition at line 226 of file PFIsolationEstimator.h.

Referenced by fGetIsolationInRings(), and isChargedParticleVetoed().

float PFIsolationEstimator::fVz
private

Definition at line 227 of file PFIsolationEstimator.h.

Referenced by fGetIsolationInRings().

int PFIsolationEstimator::iMissHits
private

Definition at line 211 of file PFIsolationEstimator.h.

Referenced by fGetIsolationInRings(), and isPhotonParticleVetoed().

int PFIsolationEstimator::iNumberOfRings
private
int PFIsolationEstimator::iParticleType
private

Definition at line 155 of file PFIsolationEstimator.h.

Referenced by isChargedParticleVetoed(), and setParticleType().

bool PFIsolationEstimator::pivotInBarrel
private
reco::SuperClusterRef PFIsolationEstimator::refSC
private
math::XYZVector PFIsolationEstimator::vtxWRTCandidate
private

Definition at line 232 of file PFIsolationEstimator.h.