CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFCandidate.h
Go to the documentation of this file.
1 #ifndef ParticleFlowCandidate_PFCandidate_h
2 #define ParticleFlowCandidate_PFCandidate_h
3 
9 #include <iosfwd>
10 
12 
26 namespace reco {
34 
35  public:
36 
38  enum ParticleType {
39  X=0, // undefined
40  h, // charged hadron
41  e, // electron
42  mu, // muon
43  gamma, // photon
44  h0, // neutral hadron
45  h_HF, // HF tower identified as a hadron
46  egamma_HF // HF tower identified as an EM particle
47  };
48 
49  enum Flags {
50  NORMAL=0,
67  };
68 
69 
70  enum PFVertexType {
77  };
78 
79 
81  PFCandidate();
82 
84  PFCandidate( const PFCandidatePtr& sourcePtr );
85 
86  /* PFCandidate( Charge q, */
87  /* const LorentzVector & p4, */
88  /* ParticleType particleId, */
89  /* reco::PFBlockRef blockRef ); */
91  const LorentzVector & p4,
93 
95  virtual ~PFCandidate();
96 
98  virtual PFCandidate * clone() const;
99 
100 
101  /* /// set source ref */
102  /* void setSourceRef(const PFCandidateRef& ref) { sourceRef_ = ref; } */
103 
104  /* size_type numberOfSourceCandidateRefs() const {return 1;} */
105 
106  /* CandidateBaseRef sourceCandidateRef( size_type i ) const { */
107  /* return CandidateBaseRef(sourceRef_); */
108  /* } */
109 
110  //using reco::Candidate::setSourceCandidatePtr;
111  void setSourceCandidatePtr(const PFCandidatePtr& ptr) { sourcePtr_ = ptr; }
112 
113  size_t numberOfSourceCandidatePtrs() const {
114  return 1;
115  }
116 
118  return sourcePtr_;
119  }
120 
125  ParticleType translatePdgIdToType(int pdgid) const;
126 
129 
130 
132  /* void addElement( const reco::PFBlockElement* element ); */
133 
135  void addElementInBlock( const reco::PFBlockRef& blockref,
136  unsigned elementIndex );
137 
139  void setTrackRef(const reco::TrackRef& ref);
140 
143  reco::TrackRef trackRef() const;
144 
146  void setGsfTrackRef(const reco::GsfTrackRef& ref);
147 
151 
153  void setMuonRef(const reco::MuonRef& ref);
154 
157  reco::MuonRef muonRef() const;
158 
161 
165 
167  void setConversionRef(const reco::ConversionRef& ref);
168 
171 
174 
177 
180 
183 
185  void setEcalEnergy( float eeRaw, float eeCorr ) {
186  rawEcalEnergy_ = eeRaw; ecalERatio_= std::abs(eeRaw)<1.e-6 ? 1.0 : eeCorr/eeRaw;}
187 
189  double ecalEnergy() const { return ecalERatio_*rawEcalEnergy_;}
190 
192  double rawEcalEnergy() const { return rawEcalEnergy_;}
193 
195  void setHcalEnergy( float ehRaw, float ehCorr ) {
196  rawHcalEnergy_ = ehRaw; hcalERatio_= std::abs(ehRaw)<1.e-6 ? 1.0 : ehCorr/ehRaw;}
197 
199  double hcalEnergy() const { return hcalERatio_*rawHcalEnergy_;}
200 
202  double rawHcalEnergy() const { return rawHcalEnergy_;}
203 
205  void setHoEnergy( float eoRaw, float eoCorr ) {
206  rawHoEnergy_ = eoRaw; hoERatio_= std::abs(eoRaw)<1.e-6 ? 1.0 : eoCorr/eoRaw;}
207 
209  double hoEnergy() const { return hoERatio_*rawHoEnergy_;}
210 
212  double rawHoEnergy() const { return rawHoEnergy_;}
213 
215  void setGsfElectronRef (const reco::GsfElectronRef & ref);
216 
217  void setSuperClusterRef (const reco::SuperClusterRef& scRef);
218 
221 
223  void setPhotonRef(const reco::PhotonRef& phRef);
224 
226  reco::PhotonRef photonRef() const;
227 
230 
233 
234 
236  void setPs1Energy( float e1 ) {ps1Energy_ = e1;}
237 
239  double pS1Energy() const { return ps1Energy_;}
240 
242  void setPs2Energy( float e2 ) {ps2Energy_ = e2;}
243 
245  double pS2Energy() const { return ps2Energy_;}
246 
248  void rescaleMomentum( double rescaleFactor );
249 
251  void setFlag(Flags theFlag, bool value);
252 
254  bool flag(Flags theFlag) const;
255 
257  void setDeltaP(double dp ) {deltaP_ = dp;}
258 
260  double deltaP() const { return deltaP_;}
261 
262  // int pdgId() const { return translateTypeToPdgId( particleId_ ); }
263 
269 
270 
271  void set_mva_e_pi( float mva ){ mva_e_pi_=mva;}
272 
274  float mva_e_pi() const { return mva_e_pi_;}
275 
276 
278  void set_mva_e_mu( float mva ) { mva_e_mu_=mva;}
279 
281  float mva_e_mu() const { return mva_e_mu_;}
282 
284  void set_mva_pi_mu( float mva ) { mva_pi_mu_=mva;}
285 
287  float mva_pi_mu() const { return mva_pi_mu_;}
288 
289 
291  void set_mva_nothing_gamma( float mva ) { mva_nothing_gamma_=mva;}
292 
294  float mva_nothing_gamma() const { return mva_nothing_gamma_;}
295 
297  void set_mva_nothing_nh( float mva ) { mva_nothing_nh_=mva;}
298 
300  float mva_nothing_nh() const { return mva_nothing_nh_;}
301 
302 
304  void set_mva_gamma_nh( float mva ) { mva_gamma_nh_=mva;}
305 
307  float mva_gamma_nh() const { return mva_gamma_nh_;}
308 
312  }
313 
316 
320  }
321 
325 
326 
328  /* const std::vector<unsigned>& elementIndices() const { */
329  /* return elementIndices_; */
330  /* } */
332  /* const edm::OwnVector< reco::PFBlockElement >& elements() const */
333  /* {return elements_;} */
334 
336  typedef std::pair<reco::PFBlockRef, unsigned> ElementInBlock;
337  typedef std::vector< ElementInBlock > ElementsInBlocks;
338 
340  typedef std::vector<unsigned> Elements;
341 
343 
344  if (elementsInBlocks_.size()!=blocksStorage_.size())
345  {
347  for(unsigned int icopy=0;icopy!=blocksStorage_.size();++icopy)
348  elementsInBlocks_[icopy]=std::make_pair(blocksStorage_[icopy],elementsStorage_[icopy]);
349  }
350  return elementsInBlocks_;
351  }
352 
353 
354 
355  static const float bigMva_;
356 
357  friend std::ostream& operator<<( std::ostream& out,
358  const PFCandidate& c );
359 
360  //Tips on setting the vertex efficiently
361  //There are two choices: a) use the vertex_ data member, or b) point to the vertex
362  //of one of the refs stored by this class. The PFVertexType enum gives the current list
363  //of possible references. For these references, use the setVeretxSource method and NOT
364  //the setVertex method. If none of the available refs have the vertex that you want for this
365  //PFCandidate, use the setVertex method. If you find that you are using frequently two store a
366  // vertex that is the same as one of the refs in this class, you should just extend the enum
367  // and modify the vertex() method accordingly.
369 
370  virtual void setVertex( math::XYZPoint p) {
372  }
373 
374  virtual const Point & vertex() const;
375  virtual double vx() const {return vertex().x();}
376  virtual double vy() const {return vertex().y();}
377  virtual double vz() const {return vertex().z();}
378 
379  private:
381  virtual bool overlap( const Candidate & ) const;
382 
383  void setFlag(unsigned shift, unsigned flag, bool value);
384 
385  bool flag(unsigned shift, unsigned flag) const;
386 
387 
391 
393  /* PFCandidateRef sourceRef_; */
395 
396 
398  float ecalERatio_;
399 
401  float hcalERatio_;
402 
404  float hoERatio_;
405 
408 
411 
414 
416  float ps1Energy_;
417 
419  float ps2Energy_;
420 
422  unsigned flags_;
423 
425  float deltaP_;
426 
428 
430  float mva_e_pi_;
431 
433  float mva_e_mu_;
434 
436  float mva_pi_mu_;
437 
440 
443 
446 
449 
450 
451  //more efficiently stored refs
452  void storeRefInfo(unsigned int iMask, unsigned int iBit, bool iIsValid,
453  const edm::RefCore& iCore, size_t iKey,
454  const edm::EDProductGetter*);
455  bool getRefInfo(unsigned int iMask, unsigned int iBit,
456  edm::ProductID& oProdID, size_t& oIndex, size_t& aIndex ) const;
457 
458 
459  const edm::EDProductGetter* getter_; //transient
460  unsigned short storedRefsBitPattern_;
461  std::vector<unsigned long long> refsInfo_;
462  std::vector<const void *> refsCollectionCache_;
463 
464  };
465 
467  struct PFParticleIdTag { };
468 
471  /* GET_DEFAULT_CANDIDATE_COMPONENT( PFCandidate, PFBlockRef, block ); */
472 
476 
477  std::ostream& operator<<( std::ostream& out, const PFCandidate& c );
478 
479 
480 }
481 
482 #endif
type
Definition: HCALResponse.h:22
double ecalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:189
float deltaP_
uncertainty on 3-momentum
Definition: PFCandidate.h:425
void setPs2Energy(float e2)
set corrected PS2 energy
Definition: PFCandidate.h:242
int i
Definition: DBlmapReader.cc:9
virtual double p() const
magnitude of momentum vector
virtual double vz() const
z coordinate of vertex position
Definition: PFCandidate.h:377
void setDeltaP(double dp)
set uncertainty on momentum
Definition: PFCandidate.h:257
long int flag
Definition: mlp_lapack.h:47
friend std::ostream & operator<<(std::ostream &out, const PFCandidate &c)
void setPs1Energy(float e1)
set corrected PS1 energy
Definition: PFCandidate.h:236
ParticleType
particle types
Definition: PFCandidate.h:38
const edm::EDProductGetter * getter_
Definition: PFCandidate.h:459
void setPFPhotonExtraRef(const reco::PFCandidatePhotonExtraRef &ref)
set the PF Photon Extra Ref
Definition: PFCandidate.cc:538
double rawEcalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:192
void setGsfElectronRef(const reco::GsfElectronRef &ref)
set GsfElectronRef
Definition: PFCandidate.cc:474
void setFlag(Flags theFlag, bool value)
set a given flag
Definition: PFCandidate.cc:195
bool getRefInfo(unsigned int iMask, unsigned int iBit, edm::ProductID &oProdID, size_t &oIndex, size_t &aIndex) const
Definition: PFCandidate.cc:307
void set_mva_e_mu(float mva)
set mva for electron-muon discrimination
Definition: PFCandidate.h:278
virtual bool overlap(const Candidate &) const
Polymorphic overlap.
Definition: PFCandidate.cc:171
void set_mva_nothing_gamma(float mva)
set mva for gamma detection
Definition: PFCandidate.h:291
size_t size_type
Definition: Candidate.h:31
void setPositionAtECALEntrance(const math::XYZPointF &pos)
set position at ECAL entrance
Definition: PFCandidate.h:310
float mva_nothing_gamma() const
mva for gamma detection
Definition: PFCandidate.h:294
float hcalERatio_
corrected HCAL energy ratio (corrected/raw)
Definition: PFCandidate.h:401
int pdgId_
PDG identifier.
float rawHcalEnergy_
raw HCAL energy
Definition: PFCandidate.h:410
virtual PFCandidate * clone() const
return a clone
Definition: PFCandidate.cc:118
unsigned flags_
all flags, packed (ecal regional, hcal regional, tracking)
Definition: PFCandidate.h:422
double rawHoEnergy() const
return raw Hcal energy
Definition: PFCandidate.h:212
float mva_e_mu_
mva for electron-muon discrimination
Definition: PFCandidate.h:433
static const float bigMva_
Definition: PFCandidate.h:355
math::XYZTLorentzVector LorentzVector
size_t numberOfSourceCandidatePtrs() const
Definition: PFCandidate.h:113
float mva_nothing_nh_
mva for neutral hadron detection
Definition: PFCandidate.h:442
ElementsInBlocks elementsInBlocks_
Definition: PFCandidate.h:388
#define abs(x)
Definition: mlp_lapack.h:159
float hoERatio_
corrected HO energy ratio (corrected/raw)
Definition: PFCandidate.h:404
edm::RefVector< reco::PFBlockCollection > Blocks
Definition: PFCandidate.h:339
void setSourceCandidatePtr(const PFCandidatePtr &ptr)
Definition: PFCandidate.h:111
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:11
reco::PFCandidatePhotonExtraRef photonExtraRef() const
return a reference to the photon extra
Definition: PFCandidate.cc:498
float mva_gamma_nh_
mva for neutral hadron - gamma discrimination
Definition: PFCandidate.h:445
float ecalERatio_
corrected ECAL energy ratio (corrected/raw)
Definition: PFCandidate.h:398
Point vertex_
vertex position
float mva_pi_mu_
mva for pi-muon discrimination
Definition: PFCandidate.h:436
particle ID component tag
Definition: PFCandidate.h:467
const math::XYZPointF & positionAtECALEntrance() const
Definition: PFCandidate.h:318
std::vector< ElementInBlock > ElementsInBlocks
Definition: PFCandidate.h:337
float mva_e_mu() const
mva for electron-muon discrimination
Definition: PFCandidate.h:281
virtual double vx() const
x coordinate of vertex position
Definition: PFCandidate.h:375
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.h:342
void set_mva_e_pi(float mva)
Definition: PFCandidate.h:271
float rawEcalEnergy_
raw ECAL energy
Definition: PFCandidate.h:407
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:339
float mva_e_pi_
mva for electron-pion discrimination
Definition: PFCandidate.h:430
reco::PFDisplacedVertexRef displacedVertexRef(Flags type) const
Definition: PFCandidate.cc:424
void set_mva_pi_mu(float mva)
set mva for pi-muon discrimination
Definition: PFCandidate.h:284
CandidatePtr sourceCandidatePtr(size_type i) const
Definition: PFCandidate.h:117
void set_mva_nothing_nh(float mva)
set mva for neutral hadron detection
Definition: PFCandidate.h:297
double pS1Energy() const
return corrected PS1 energy
Definition: PFCandidate.h:239
std::vector< unsigned long long > refsInfo_
Definition: PFCandidate.h:461
float mva_pi_mu() const
mva for pi-muon discrimination
Definition: PFCandidate.h:287
void setDisplacedVertexRef(const reco::PFDisplacedVertexRef &ref, Flags flag)
set displaced vertex reference
Definition: PFCandidate.cc:380
float mva_nothing_nh() const
mva for neutral hadron detection
Definition: PFCandidate.h:300
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:72
std::vector< unsigned > Elements
Definition: PFCandidate.h:340
void setVertexSource(PFVertexType vt)
Definition: PFCandidate.h:368
float ps1Energy_
corrected PS1 energy
Definition: PFCandidate.h:416
void addElementInBlock(const reco::PFBlockRef &blockref, unsigned elementIndex)
add an element to the current PFCandidate
Definition: PFCandidate.cc:123
void setPFElectronExtraRef(const reco::PFCandidateElectronExtraRef &ref)
set the PF Electron Extra Ref
Definition: PFCandidate.cc:484
void setParticleType(ParticleType type)
set Particle Type
Definition: PFCandidate.cc:166
reco::PhotonRef photonRef() const
return a reference to the corresponding Photon if any
Definition: PFCandidate.cc:494
bool flag(Flags theFlag) const
return a given flag
Definition: PFCandidate.cc:205
math::XYZPoint Point
unsigned short storedRefsBitPattern_
Definition: PFCandidate.h:460
int translateTypeToPdgId(ParticleType type) const
Definition: PFCandidate.cc:148
GET_CANDIDATE_COMPONENT(PFCandidate, PFCandidate::ParticleType, particleId, PFParticleIdTag)
reco::GsfElectronRef gsfElectronRef() const
return a reference to the corresponding GsfElectron if any
Definition: PFCandidate.cc:479
virtual const Point & vertex() const
vertex position
Definition: PFCandidate.cc:546
float rawHoEnergy_
raw HO energy
Definition: PFCandidate.h:413
void rescaleMomentum(double rescaleFactor)
particle momentum *= rescaleFactor
Definition: PFCandidate.cc:188
virtual ~PFCandidate()
destructor
Definition: PFCandidate.cc:116
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:355
void setEcalEnergy(float eeRaw, float eeCorr)
set corrected Ecal energy
Definition: PFCandidate.h:185
float mva_e_pi() const
mva for electron-pion discrimination
Definition: PFCandidate.h:274
tuple out
Definition: dbtoconf.py:99
double hoEnergy() const
return corrected Hcal energy
Definition: PFCandidate.h:209
reco::PFCandidateElectronExtraRef electronExtraRef() const
return a reference to the electron extra
Definition: PFCandidate.cc:489
void setGsfTrackRef(const reco::GsfTrackRef &ref)
set gsftrack reference
Definition: PFCandidate.cc:359
PFCandidate()
default constructor
Definition: PFCandidate.cc:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
virtual void setVertex(math::XYZPoint p)
Definition: PFCandidate.h:370
void setPhotonRef(const reco::PhotonRef &phRef)
set ref to the corresponding reco::Photon if any
Definition: PFCandidate.cc:506
void setConversionRef(const reco::ConversionRef &ref)
set ref to original reco conversion
Definition: PFCandidate.cc:435
void set_mva_gamma_nh(float mva)
set mva for neutral hadron - gamma discrimination
Definition: PFCandidate.h:304
virtual double vy() const
y coordinate of vertex position
Definition: PFCandidate.h:376
ParticleType translatePdgIdToType(int pdgid) const
Definition: PFCandidate.cc:134
PFVertexType vertexType_
Definition: PFCandidate.h:427
void setHoEnergy(float eoRaw, float eoCorr)
set corrected Hcal energy
Definition: PFCandidate.h:205
PFCandidatePtr sourcePtr_
reference to the source PFCandidate, if any
Definition: PFCandidate.h:394
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:33
reco::VertexCompositeCandidateRef v0Ref() const
return a reference to the original conversion
Definition: PFCandidate.cc:469
void setMuonRef(const reco::MuonRef &ref)
set muon reference
Definition: PFCandidate.cc:342
std::pair< reco::PFBlockRef, unsigned > ElementInBlock
return indices of elements used in the block
Definition: PFCandidate.h:336
math::XYZPointF positionAtECALEntrance_
position at ECAL entrance, from the PFRecTrack
Definition: PFCandidate.h:448
float mva_nothing_gamma_
mva for gamma detection
Definition: PFCandidate.h:439
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:376
double hcalEnergy() const
return corrected Hcal energy
Definition: PFCandidate.h:199
static unsigned int const shift
double pS2Energy() const
return corrected PS2 energy
Definition: PFCandidate.h:245
float ps2Energy_
corrected PS2 energy
Definition: PFCandidate.h:419
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
void setSuperClusterRef(const reco::SuperClusterRef &scRef)
Definition: PFCandidate.cc:522
void setV0Ref(const reco::VertexCompositeCandidateRef &ref)
set ref to original reco conversion
Definition: PFCandidate.cc:464
float mva_gamma_nh() const
mva for neutral hadron - gamma discrimination
Definition: PFCandidate.h:307
virtual ParticleType particleId() const
Definition: PFCandidate.h:324
void setTrackRef(const reco::TrackRef &ref)
set track reference
Definition: PFCandidate.cc:322
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
Elements elementsStorage_
Definition: PFCandidate.h:390
reco::ConversionRef conversionRef() const
return a reference to the original conversion
Definition: PFCandidate.cc:459
void setHcalEnergy(float ehRaw, float ehCorr)
set corrected Hcal energy
Definition: PFCandidate.h:195
int Charge
electric charge type
Definition: LeafCandidate.h:23
std::vector< const void * > refsCollectionCache_
Definition: PFCandidate.h:462
double deltaP() const
uncertainty on 3-momentum
Definition: PFCandidate.h:260
double rawHcalEnergy() const
return raw Hcal energy
Definition: PFCandidate.h:202
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:29
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any
Definition: PFCandidate.cc:502
void storeRefInfo(unsigned int iMask, unsigned int iBit, bool iIsValid, const edm::RefCore &iCore, size_t iKey, const edm::EDProductGetter *)
Definition: PFCandidate.cc:271