CMS 3D CMS Logo

PFCandidate.cc
Go to the documentation of this file.
2 //#include "DataFormats/ParticleFlowReco/interface/PFBlock.h"
3 
12 
14 
15 #include <ostream>
16 #include <iomanip>
17 
18 using namespace reco;
19 using namespace std;
20 
21 
22 
23 const float PFCandidate::bigMva_ = -999.;
24 
25 
27 
28 
29 
30 
32  elementsInBlocks_(nullptr),
33  ecalERatio_(1.),
34  hcalERatio_(1.),
35  hoERatio_(1.),
36  rawEcalEnergy_(0.),
37  rawHcalEnergy_(0.),
38  rawHoEnergy_(0.),
39  ps1Energy_(0.),
40  ps2Energy_(0.),
41  flags_(0),
42  deltaP_(0.),
43  vertexType_(kCandVertex),
44  mva_Isolated_(bigMva_),
45  mva_e_pi_(bigMva_),
46  mva_e_mu_(bigMva_),
47  mva_pi_mu_(bigMva_),
48  mva_nothing_gamma_(bigMva_),
49  mva_nothing_nh_(bigMva_),
50  mva_gamma_nh_(bigMva_),
51  getter_(nullptr),storedRefsBitPattern_(0),
52  time_(0.f),timeError_(-1.f)
53 {
54 
56 
58  refsInfo_.reserve(3);
60 }
61 
62 
64  PFCandidate(*sourcePtr)
65 {
66  sourcePtr_ = sourcePtr;
67  hcalDepthEnergyFractions_ = sourcePtr->hcalDepthEnergyFractions_; // GP not sure it's needed
68 }
69 
70 
72  const LorentzVector & p4,
73  ParticleType partId ) :
74 
75  CompositeCandidate(charge, p4),
77  ecalERatio_(1.),
78  hcalERatio_(1.),
79  hoERatio_(1.),
80  rawEcalEnergy_(0.),
81  rawHcalEnergy_(0.),
82  rawHoEnergy_(0.),
83  ps1Energy_(0.),
84  ps2Energy_(0.),
85  flags_(0),
86  deltaP_(0.),
96  time_(0.f),timeError_(-1.f)
97 {
98  refsInfo_.reserve(3);
100  elementsStorage_.reserve(10);
102 
104 
105  // proceed with various consistency checks
106 
107  // charged candidate: track ref and charge must be non null
108  if( partId == h ||
109  partId == e ||
110  partId == mu ) {
111 
112  if( charge == 0 ) {
113  string err;
114  err+="Attempt to construct a charged PFCandidate with a zero charge";
115  throw cms::Exception("InconsistentValue",
116  err.c_str() );
117  }
118  }
119  else {
120  if( charge ) {
121  string err;
122  err += "Attempt to construct a neutral PFCandidate ";
123  err += "with a non-zero charge";
124  throw cms::Exception("InconsistentValue",
125  err.c_str() );
126  }
127  }
128  setPdgId( translateTypeToPdgId( partId ) );
129 }
130 
131 PFCandidate::PFCandidate( PFCandidate const& iOther) :
132  CompositeCandidate(iOther),
133  elementsInBlocks_(nullptr),
136  sourcePtr_(iOther.sourcePtr_),
138  ecalERatio_(iOther.ecalERatio_),
139  hcalERatio_(iOther.hcalERatio_),
140  hoERatio_(iOther.hoERatio_),
143  rawHoEnergy_(iOther.rawHoEnergy_),
144  ps1Energy_(iOther.ps1Energy_),
145  ps2Energy_(iOther.ps2Energy_),
146  flags_(iOther.flags_),
147  deltaP_(iOther.deltaP_),
148  vertexType_(iOther.vertexType_),
150  mva_e_pi_(iOther.mva_e_pi_),
151  mva_e_mu_(iOther.mva_e_mu_),
152  mva_pi_mu_(iOther.mva_pi_mu_),
157  getter_(iOther.getter_),
159  refsInfo_(iOther.refsInfo_),
161  time_(iOther.time_),timeError_(iOther.timeError_),
163 {
164  auto tmp = iOther.elementsInBlocks_.load(std::memory_order_acquire);
165  if(nullptr != tmp) {
166  elementsInBlocks_.store( new ElementsInBlocks{*tmp}, std::memory_order_release);
167  }
168 }
169 
172  auto tmp = iOther.elementsInBlocks_.load(std::memory_order_acquire);
173  if(nullptr != tmp) {
174  delete elementsInBlocks_.exchange( new ElementsInBlocks{*tmp}, std::memory_order_acq_rel);
175  } else {
176  delete elementsInBlocks_.exchange(nullptr, std::memory_order_acq_rel);
177  }
180  sourcePtr_=iOther.sourcePtr_;
182  ecalERatio_=iOther.ecalERatio_;
183  hcalERatio_=iOther.hcalERatio_;
184  hoERatio_=iOther.hoERatio_;
187  rawHoEnergy_=iOther.rawHoEnergy_;
188  ps1Energy_=iOther.ps1Energy_;
189  ps2Energy_=iOther.ps2Energy_;
190  flags_=iOther.flags_;
191  deltaP_=iOther.deltaP_;
192  vertexType_=iOther.vertexType_;
194  mva_e_pi_=iOther.mva_e_pi_;
195  mva_e_mu_=iOther.mva_e_mu_;
196  mva_pi_mu_=iOther.mva_pi_mu_;
201  getter_=iOther.getter_;
203  refsInfo_=iOther.refsInfo_;
205  time_=iOther.time_;
206  timeError_=iOther.timeError_;
208  return *this;
209 }
210 
212  delete elementsInBlocks_.load(std::memory_order_acquire);
213 }
214 
216  return new PFCandidate( * this );
217 }
218 
219 
221  unsigned elementIndex ) {
222  //elementsInBlocks_.push_back( make_pair(blockref.key(), elementIndex) );
223  if (blocksStorage_.empty())
224  blocksStorage_ =Blocks(blockref.id());
225  blocksStorage_.push_back(blockref);
226  elementsStorage_.push_back(elementIndex);
227  auto ptr = elementsInBlocks_.exchange(nullptr);
228  delete ptr;
229 }
230 
231 
232 
234  switch (std::abs(pdgid)) {
235  case 211: return h;
236  case 11: return e;
237  case 13: return mu;
238  case 22: return gamma;
239  case 130: return h0;
240  case 1: return h_HF;
241  case 2: return egamma_HF;
242  case 0: return X;
243  default: return X;
244  }
245 }
246 
248 
249  int thecharge = charge();
250 
251  switch( type ) {
252  case h: return thecharge*211; // pi+
253  case e: return thecharge*(-11);
254  case mu: return thecharge*(-13);
255  case gamma: return 22;
256  case h0: return 130; // K_L0
257  case h_HF: return 1; // dummy pdg code
258  case egamma_HF: return 2; // dummy pdg code
259  case X:
260  default: return 0;
261  }
262 }
263 
264 
266  setPdgId( translateTypeToPdgId( type ) );
267 }
268 
269 
271  CandidatePtr myPtr = sourceCandidatePtr(0);
272  if (myPtr.isNull()) return false;
273  for (size_t i = 0, n = other.numberOfSourceCandidatePtrs(); i < n; ++i) {
274  CandidatePtr otherPtr = other.sourceCandidatePtr(i);
275  if ((otherPtr == myPtr) ||
276  (sourcePtr_.isNonnull() && otherPtr.isNonnull() && sourcePtr_->overlap(*otherPtr))) {
277  return true;
278  }
279  }
280  return false;
281 }
282 
283 
284 
285 
286 
287 void PFCandidate::rescaleMomentum( double rescaleFactor ) {
288  LorentzVector rescaledp4 = p4();
289  rescaledp4 *= rescaleFactor;
290  setP4( rescaledp4 );
291 }
292 
293 
294 void PFCandidate::setFlag(Flags theFlag, bool value) {
295 
296  if(value)
297  flags_ = flags_ | (1<<theFlag);
298  else
299  flags_ = flags_ ^ (1<<theFlag);
300 }
301 
302 
303 
304 bool PFCandidate::flag(Flags theFlag) const {
305 
306  return (flags_>>theFlag) & 1;
307 }
308 
309 
310 
311 
312 ostream& reco::operator<<(ostream& out,
313  const PFCandidate& c ) {
314 
315  if(!out) return out;
316 
317  out<<"\tPFCandidate type: "<<c.particleId();
318  out<<setiosflags(ios::right);
319  out<<setiosflags(ios::fixed);
320  out<<setprecision(3);
321  out<<" E/pT/eta/phi "
322  <<c.energy()<<"/"
323  <<c.pt()<<"/"
324  <<c.eta()<<"/"
325  <<c.phi();
326  if( c.flag( PFCandidate::T_FROM_DISP ) ) out<<", T_FROM_DISP" << endl;
327  else if( c.flag( PFCandidate::T_TO_DISP ) ) out<<", T_TO_DISP" << endl;
328  else if( c.flag( PFCandidate::T_FROM_GAMMACONV ) ) out<<", T_FROM_GAMMACONV" << endl;
329  else if( c.flag( PFCandidate::GAMMA_TO_GAMMACONV ) ) out<<", GAMMA_TO_GAMMACONV" << endl;
330 
331  out<<", blocks/iele: ";
332 
334  for(unsigned i=0; i<eleInBlocks.size(); i++) {
335  PFBlockRef blockRef = eleInBlocks[i].first;
336  unsigned indexInBlock = eleInBlocks[i].second;
337 
338  out<<"("<<blockRef.key()<<"|"<<indexInBlock<<"), ";
339  }
340 
341  out<<" source:"<<c.sourcePtr_.id()<<"/"<<c.sourcePtr_.key();
342 
343 // PFBlockRef blockRef = c.block();
344 // int blockid = blockRef.key();
345 // const edm::OwnVector< reco::PFBlockElement >& elements = c.elements();
346 // out<< "\t# of elements " << elements.size()
347 // <<" from block " << blockid << endl;
348 
349 // // print each element in turn
350 
351 // for(unsigned ie=0; ie<elements.size(); ie++) {
352 // out<<"\t"<< elements[ie] <<endl;
353 // }
354 
355  // Improved printout for electrons if PFCandidateElectronExtra is available
357  out << std::endl << *(c.electronExtraRef()) ;
358  }
359  out<<resetiosflags(ios::right|ios::fixed);
360  return out;
361 }
362 
363 static unsigned long long bitPackRefInfo(const edm::RefCore& iCore, size_t iIndex){
364  unsigned long long bitPack = iIndex;
365  bitPack |= static_cast<unsigned long long>(iCore.id().productIndex())<<32;
366  bitPack |= static_cast<unsigned long long>(iCore.id().processIndex())<<48;
367  return bitPack;
368 }
369 
370 void PFCandidate::storeRefInfo(unsigned int iMask,
371  unsigned int iBit,
372  bool iIsValid,
373  const edm::RefCore& iCore,
374  size_t iKey,
375  const edm::EDProductGetter* iGetter) {
376 
377  size_t index = s_refsBefore[storedRefsBitPattern_ & iMask];
378  if ( nullptr == getter_) {
379  getter_ = iGetter;
380  }
381 
382  if(iIsValid) {
383  if(0 == (storedRefsBitPattern_ & iBit) ) {
384  refsInfo_.insert(refsInfo_.begin()+index, bitPackRefInfo(iCore,iKey));
385  if (iGetter==nullptr)
387  static_cast<void const*>(iCore.productPtr()));
388  else
389  refsCollectionCache_.insert(refsCollectionCache_.begin()+index,nullptr);
390  } else {
391  assert(refsInfo_.size()>index);
392  *(refsInfo_.begin()+index)=bitPackRefInfo(iCore,iKey);
393  if (iGetter==nullptr)
394  *(refsCollectionCache_.begin()+index)=static_cast<void const*>(iCore.productPtr());
395  else
396  *(refsCollectionCache_.begin()+index)=nullptr;
397 
398  }
399  storedRefsBitPattern_ |= iBit;
400  } else{
401  if( storedRefsBitPattern_ & iBit) {
402  refsInfo_.erase(refsInfo_.begin()+index);
404  storedRefsBitPattern_ ^= iBit;
405  }
406  }
407 
408 }
409 
410 bool PFCandidate::getRefInfo(unsigned int iMask, unsigned int iBit,
411  edm::ProductID& oProductID, size_t& oIndex, size_t& aIndex) const {
412 
413  if( 0 == (iBit & storedRefsBitPattern_) ) {
414  return false;
415  }
416  aIndex = s_refsBefore[storedRefsBitPattern_ & iMask];
417  unsigned long long bitPacked = refsInfo_[aIndex];
418  oIndex = bitPacked & 0xFFFFFFFFULL; //low 32 bits are the index
419  unsigned short productIndex = (bitPacked & 0x0000FFFF00000000ULL)>>32;
420  unsigned short processIndex = (bitPacked & 0xFFFF000000000000ULL)>>48;
421  oProductID = edm::ProductID(processIndex,productIndex);
422  return true;
423 }
424 
426  if(!charge()) {
427  string err;
428  err += "PFCandidate::setTrackRef: this is a neutral candidate! ";
429  err += "particleId_=";
430  char num[4];
431  sprintf( num, "%d", particleId());
432  err += num;
433 
434  throw cms::Exception("InconsistentReference",
435  err.c_str() );
436  }
437 
439  iRef.refCore(), iRef.key(),iRef.productGetter());
440 }
441 
443 
444 
446 
447  if( trackRef() != iRef->track() ) {
448  string err;
449  err += "PFCandidate::setMuonRef: inconsistent track references!";
450 
451  throw cms::Exception("InconsistentReference",
452  err.c_str() );
453  }
454 
456  iRef.refCore(), iRef.key(),iRef.productGetter());
457 }
458 
460 
461 
464 // Removed by F. Beaudette. Would like to be able to save the GsfTrackRef even for charged pions
465 // if( particleId() != e ) {
466 // string err;
467 // err += "PFCandidate::setGsfTrackRef: this is not an electron ! particleId_=";
468 // char num[4];
469 // sprintf( num, "%d", particleId());
470 // err += num;
471 //
472 // throw cms::Exception("InconsistentReference",
473 // err.c_str() );
474 // }
475 
477  iRef.refCore(), iRef.key(),iRef.productGetter());
478 }
479 
481 
482 
485 
486  if( particleId() != h ) {
487  string err;
488  err += "PFCandidate::setDisplacedVertexRef: this is not a hadron! particleId_=";
489  char num[4];
490  sprintf( num, "%d", particleId());
491  err += num;
492 
493  throw cms::Exception("InconsistentReference",
494  err.c_str() );
495  }
496  else if( !flag( T_FROM_DISP ) && !flag( T_TO_DISP ) ) {
497  string err;
498  err += "PFCandidate::setDisplacedVertexRef: particule flag is neither T_FROM_DISP nor T_TO_DISP";
499 
500  throw cms::Exception("InconsistentReference",
501  err.c_str() );
502  }
503 
504 
505  if (type == T_TO_DISP && flag( T_TO_DISP ))
507  iRef.isNonnull(),
508  iRef.refCore(), iRef.key(),iRef.productGetter());
509  else if (type == T_FROM_DISP && flag( T_FROM_DISP ))
511  iRef.isNonnull(),
512  iRef.refCore(), iRef.key(),iRef.productGetter());
513  else if ( (type == T_FROM_DISP && !flag( T_FROM_DISP ))
514  ||
515  (type == T_TO_DISP && !flag( T_TO_DISP )) ){
516  string err;
517  err += "PFCandidate::setDisplacedVertexRef: particule flag is not switched on";
518 
519  throw cms::Exception("InconsistentReference",
520  err.c_str() );
521  }
522 
523 }
524 
525 
526 
527 
529  if (type == T_TO_DISP) {
531  }
532  else if (type == T_FROM_DISP) {
534  }
536 }
537 
540  if( particleId() != gamma ) {
541  string err;
542  err += "PFCandidate::setConversionRef: this is not a (converted) photon ! particleId_=";
543  char num[4];
544  sprintf( num, "%d", particleId());
545  err += num;
546 
547  throw cms::Exception("InconsistentReference",
548  err.c_str() );
549  }
550  else if( !flag( GAMMA_TO_GAMMACONV ) ) {
551  string err;
552  err += "PFCandidate::setConversionRef: particule flag is not GAMMA_TO_GAMMACONV";
553 
554  throw cms::Exception("InconsistentReference",
555  err.c_str() );
556  }
557 
559  iRef.refCore(), iRef.key(),iRef.productGetter());
560 }
561 
562 
565 }
566 
570  iRef.refCore(), iRef.key(),iRef.productGetter());
571 }
572 
575 }
576 
580  iRef.refCore(), iRef.key(),iRef.productGetter());
581 }
582 
585 }
586 
590  iRef.refCore(), iRef.key(),iRef.productGetter());
591 }
592 
595 }
596 
599 }
600 
603 }
604 
607 }
608 
611 }
612 
614  if( particleId() != gamma && particleId() != e) {
615  string err;
616  err += "PFCandidate::setSuperClusterRef: this is not an electron neither a photon ! particleId_=";
617  char num[4];
618  sprintf( num, "%d", particleId());
619  err += num;
620 
621  throw cms::Exception("InconsistentReference", err.c_str() );
622  }
623 
625  iRef.refCore(), iRef.key(),iRef.productGetter());
626 
627 }
628 
630  if( particleId() != gamma && particleId() != e) {
631  string err;
632  err += "PFCandidate::setSuperClusterRef: this is not an electron neither a photon ! particleId_=";
633  char num[4];
634  sprintf( num, "%d", particleId());
635  err += num;
636 
637  throw cms::Exception("InconsistentReference", err.c_str() );
638  }
639 
641  iRef.refCore(), iRef.key(),iRef.productGetter());
642 
643 }
644 
647  iRef.refCore(), iRef.key(),iRef.productGetter());
648 }
649 
651  //std::cout << " before storeRefInfo " << kRefPFEGammaExtraMask << " " << kRefPFEGammaExtraBit << " " << iRef.isNonnull() << " " << iRef.key() << " " << std::endl;
653  iRef.refCore(), iRef.key(),iRef.productGetter());
654 }
655 
657  switch (vertexType_) {
658  case kCandVertex:
659  return LeafCandidate::vertex();
660  break;
661  case kTrkVertex:
662  return trackRef()->vertex();
663  break;
664  case kComMuonVertex:
665  return muonRef()->combinedMuon()->vertex();
666  break;
667  case kSAMuonVertex:
668  return muonRef()->standAloneMuon()->vertex();
669  break;
670  case kTrkMuonVertex:
671  return muonRef()->track()->vertex();
672  break;
673  case kTPFMSMuonVertex:
674  return muonRef()->tpfmsTrack()->vertex();
675  break;
676  case kPickyMuonVertex:
677  return muonRef()->pickyTrack()->vertex();
678  break;
679  case kDYTMuonVertex:
680  return muonRef()->dytTrack()->vertex();
681  break;
682 
683  case kGSFVertex:
684  return gsfTrackRef()->vertex();
685  break;
686  }
687  return LeafCandidate::vertex();
688 }
689 
692 
693  if (nullptr == elementsInBlocks_.load(std::memory_order_acquire))
694  {
695  std::unique_ptr<ElementsInBlocks> temp( new ElementsInBlocks(blocksStorage_.size()));
696  for(unsigned int icopy=0;icopy!=blocksStorage_.size();++icopy)
697  (*temp)[icopy]=std::make_pair(blocksStorage_[icopy],elementsStorage_[icopy]);
698  ElementsInBlocks* expected=nullptr;
699  if(elementsInBlocks_.compare_exchange_strong(expected,temp.get(),std::memory_order_acq_rel)) {
700  temp.release();
701  }
702  }
703  return *(elementsInBlocks_.load(std::memory_order_acquire));
704 }
bool isAvailable() const
Definition: Ref.h:575
type
Definition: HCALResponse.h:21
~PFCandidate() override
destructor
Definition: PFCandidate.cc:211
float deltaP_
uncertainty on 3-momentum
Definition: PFCandidate.h:487
int Charge
electric charge type
Definition: Candidate.h:35
ParticleType
particle types
Definition: PFCandidate.h:45
reco::Muon::MuonTrackType muonTrackType_
Definition: PFCandidate.h:457
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
double eta() const final
momentum pseudorapidity
const edm::EDProductGetter * getter_
Definition: PFCandidate.h:524
void setPFPhotonExtraRef(const reco::PFCandidatePhotonExtraRef &ref)
set the PF Photon Extra Ref
Definition: PFCandidate.cc:645
void setGsfElectronRef(const reco::GsfElectronRef &ref)
set GsfElectronRef
Definition: PFCandidate.cc:578
void setFlag(Flags theFlag, bool value)
set a given flag
Definition: PFCandidate.cc:294
bool getRefInfo(unsigned int iMask, unsigned int iBit, edm::ProductID &oProdID, size_t &oIndex, size_t &aIndex) const
Definition: PFCandidate.cc:410
float timeError_
timing information uncertainty (<0 if timing not available)
Definition: PFCandidate.h:532
key_type key() const
Definition: Ptr.h:185
float hcalERatio_
corrected HCAL energy ratio (corrected/raw)
Definition: PFCandidate.h:463
float rawHcalEnergy_
raw HCAL energy
Definition: PFCandidate.h:472
unsigned flags_
all flags, packed (ecal regional, hcal regional, tracking)
Definition: PFCandidate.h:484
virtual CandidatePtr sourceCandidatePtr(size_type i) const
Definition: Candidate.h:170
float mva_e_mu_
mva for electron-muon discrimination
Definition: PFCandidate.h:498
static const float bigMva_
Definition: PFCandidate.h:394
std::array< float, 7 > hcalDepthEnergyFractions_
Definition: PFCandidate.h:534
#define nullptr
bool overlap(const Candidate &) const override
Polymorphic overlap.
Definition: PFCandidate.cc:270
float mva_nothing_nh_
mva for neutral hadron detection
Definition: PFCandidate.h:507
RefCore const & refCore() const
Definition: Ref.h:278
ProcessIndex productIndex() const
Definition: ProductID.h:37
double pt() const final
transverse momentum
int charge() const final
electric charge
Definition: LeafCandidate.h:91
float hoERatio_
corrected HO energy ratio (corrected/raw)
Definition: PFCandidate.h:466
edm::RefVector< reco::PFBlockCollection > Blocks
Definition: PFCandidate.h:389
key_type key() const
Accessor for product key.
Definition: Ref.h:263
reco::PFCandidatePhotonExtraRef photonExtraRef() const
return a reference to the photon extra
Definition: PFCandidate.cc:601
float mva_gamma_nh_
mva for neutral hadron - gamma discrimination
Definition: PFCandidate.h:510
float ecalERatio_
corrected ECAL energy ratio (corrected/raw)
Definition: PFCandidate.h:460
virtual size_t numberOfSourceCandidatePtrs() const =0
float mva_pi_mu_
mva for pi-muon discrimination
Definition: PFCandidate.h:501
bool empty() const
Is the RefVector empty.
Definition: RefVector.h:104
std::vector< ElementInBlock > ElementsInBlocks
Definition: PFCandidate.h:387
ProductID id() const
Accessor for product ID.
Definition: Ref.h:257
float rawEcalEnergy_
raw ECAL energy
Definition: PFCandidate.h:469
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:442
float mva_e_pi_
mva for electron-pion discrimination
Definition: PFCandidate.h:495
reco::PFDisplacedVertexRef displacedVertexRef(Flags type) const
Definition: PFCandidate.cc:528
const Point & vertex() const override
vertex position (overwritten by PF...)
Definition: PFCandidate.cc:656
std::vector< unsigned long long > refsInfo_
Definition: PFCandidate.h:526
static unsigned long long bitPackRefInfo(const edm::RefCore &iCore, size_t iIndex)
Definition: PFCandidate.cc:363
void setDisplacedVertexRef(const reco::PFDisplacedVertexRef &ref, Flags flag)
set displaced vertex reference
Definition: PFCandidate.cc:484
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
float ps1Energy_
corrected PS1 energy
Definition: PFCandidate.h:478
CandidatePtr sourceCandidatePtr(size_type i) const override
Definition: PFCandidate.h:132
void addElementInBlock(const reco::PFBlockRef &blockref, unsigned elementIndex)
add an element to the current PFCandidate
Definition: PFCandidate.cc:220
void setPFElectronExtraRef(const reco::PFCandidateElectronExtraRef &ref)
set the PF Electron Extra Ref
Definition: PFCandidate.cc:588
void setParticleType(ParticleType type)
set Particle Type
Definition: PFCandidate.cc:265
reco::PhotonRef photonRef() const
return a reference to the corresponding Photon if any
Definition: PFCandidate.cc:597
bool flag(Flags theFlag) const
return a given flag
Definition: PFCandidate.cc:304
const Point & vertex() const override
vertex position (overwritten by PF...)
void const * productPtr() const
Definition: RefCore.h:52
unsigned short storedRefsBitPattern_
Definition: PFCandidate.h:525
double energy() const final
energy
bool isNull() const
Checks for null.
Definition: Ptr.h:164
int translateTypeToPdgId(ParticleType type) const
Definition: PFCandidate.cc:247
CompositeCandidate(std::string name="")
default constructor
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::GsfElectronRef gsfElectronRef() const
return a reference to the corresponding GsfElectron if any
Definition: PFCandidate.cc:583
double f[11][100]
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
float rawHoEnergy_
raw HO energy
Definition: PFCandidate.h:475
Definition: value.py:1
unsigned int index
Definition: LeafCandidate.h:31
void reserve(size_type n)
Reserve space for RefVector.
Definition: RefVector.h:113
void rescaleMomentum(double rescaleFactor)
particle momentum *= rescaleFactor
Definition: PFCandidate.cc:287
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:459
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
PFCandidate * clone() const override
return a clone
Definition: PFCandidate.cc:215
static const unsigned int s_refsBefore[]
Definition: CountBits.h:14
unsigned int index
index type
Definition: Candidate.h:51
Block of elements.
reco::PFCandidateElectronExtraRef electronExtraRef() const
return a reference to the electron extra
Definition: PFCandidate.cc:593
void setGsfTrackRef(const reco::GsfTrackRef &ref)
set gsftrack reference
Definition: PFCandidate.cc:463
PFCandidate()
default constructor
Definition: PFCandidate.cc:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void setPhotonRef(const reco::PhotonRef &phRef)
set ref to the corresponding reco::Photon if any
Definition: PFCandidate.cc:613
void setConversionRef(const reco::ConversionRef &ref)
set ref to original reco conversion
Definition: PFCandidate.cc:539
edm::Ref< PFDisplacedVertexCollection > PFDisplacedVertexRef
persistent reference to a PFDisplacedVertex objects
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:180
ParticleType translatePdgIdToType(int pdgid) const
Definition: PFCandidate.cc:233
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
PFCandidate & operator=(PFCandidate const &)
Definition: PFCandidate.cc:170
ProductID id() const
Definition: RefCore.h:49
std::atomic< ElementsInBlocks * > elementsInBlocks_
Definition: PFCandidate.h:443
PFVertexType vertexType_
Definition: PFCandidate.h:489
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
PFCandidatePtr sourcePtr_
reference to the source PFCandidate, if any
Definition: PFCandidate.h:452
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
fixed size matrix
float time_
timing information (valid if timeError_ >= 0)
Definition: PFCandidate.h:530
reco::VertexCompositeCandidateRef v0Ref() const
return a reference to the original conversion
Definition: PFCandidate.cc:573
void setMuonRef(const reco::MuonRef &ref)
set muon reference
Definition: PFCandidate.cc:445
math::XYZPointF positionAtECALEntrance_
position at ECAL entrance, from the PFRecTrack
Definition: PFCandidate.h:513
float mva_nothing_gamma_
mva for gamma detection
Definition: PFCandidate.h:504
reco::PFCandidateEGammaExtraRef egammaExtraRef() const
return a reference to the EGamma extra
Definition: PFCandidate.cc:605
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:480
void setPFEGammaExtraRef(const reco::PFCandidateEGammaExtraRef &ref)
set the PF EGamma Extra Ref
Definition: PFCandidate.cc:650
EDProductGetter const * productGetter() const
Accessor for product getter.
Definition: Ref.h:260
float ps2Energy_
corrected PS2 energy
Definition: PFCandidate.h:481
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:69
size_type size() const
Size of the RefVector.
Definition: RefVector.h:107
void setSuperClusterRef(const reco::SuperClusterRef &scRef)
Definition: PFCandidate.cc:629
void setV0Ref(const reco::VertexCompositeCandidateRef &ref)
set ref to original reco conversion
Definition: PFCandidate.cc:568
virtual ParticleType particleId() const
Definition: PFCandidate.h:374
LeafCandidate & operator=(LeafCandidate &&)=default
void setTrackRef(const reco::TrackRef &ref)
set track reference
Definition: PFCandidate.cc:425
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.cc:691
ProcessIndex processIndex() const
Definition: ProductID.h:36
double phi() const final
momentum azimuthal angle
Elements elementsStorage_
Definition: PFCandidate.h:448
void setPdgId(int pdgId) final
reco::ConversionRef conversionRef() const
return a reference to the original conversion
Definition: PFCandidate.cc:563
void setP4(const LorentzVector &p4) final
set 4-momentum
std::vector< const void * > refsCollectionCache_
Definition: PFCandidate.h:527
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any
Definition: PFCandidate.cc:609
void storeRefInfo(unsigned int iMask, unsigned int iBit, bool iIsValid, const edm::RefCore &iCore, size_t iKey, const edm::EDProductGetter *)
Definition: PFCandidate.cc:370
#define GETREF(_class_, _mask_, _bit_)
Definition: CountBits.h:4660