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 
22 
24  : elementsInBlocks_(nullptr),
25  ecalERatio_(1.),
26  hcalERatio_(1.),
27  hoERatio_(1.),
28  rawEcalEnergy_(0.),
29  rawHcalEnergy_(0.),
30  rawHoEnergy_(0.),
31  ps1Energy_(0.),
32  ps2Energy_(0.),
33  flags_(0),
34  deltaP_(0.),
35  vertexType_(kCandVertex),
36  mva_Isolated_(PFCandidate::bigMva_),
37  mva_e_pi_(PFCandidate::bigMva_),
38  mva_e_mu_(PFCandidate::bigMva_),
39  mva_pi_mu_(PFCandidate::bigMva_),
40  mva_nothing_gamma_(PFCandidate::bigMva_),
41  mva_nothing_nh_(PFCandidate::bigMva_),
42  mva_gamma_nh_(PFCandidate::bigMva_),
43  dnn_e_sigIsolated_(PFCandidate::bigMva_),
44  dnn_e_sigNonIsolated_(PFCandidate::bigMva_),
45  dnn_e_bkgNonIsolated_(PFCandidate::bigMva_),
46  dnn_e_bkgTau_(PFCandidate::bigMva_),
47  dnn_e_bkgPhoton_(PFCandidate::bigMva_),
48  dnn_gamma_(PFCandidate::bigMva_),
49  getter_(nullptr),
50  storedRefsBitPattern_(0),
51  time_(0.f),
52  timeError_(-1.f) {
54 
56  refsInfo_.reserve(3);
58 }
59 
61 
62 PFCandidate::PFCandidate(const PFCandidatePtr& sourcePtr) : PFCandidate(*sourcePtr) {
63  sourcePtr_ = sourcePtr;
64  hcalDepthEnergyFractions_ = sourcePtr->hcalDepthEnergyFractions_; // GP not sure it's needed
65 }
66 
69  elementsInBlocks_(nullptr),
70  ecalERatio_(1.),
71  hcalERatio_(1.),
72  hoERatio_(1.),
73  rawEcalEnergy_(0.),
74  rawHcalEnergy_(0.),
75  rawHoEnergy_(0.),
76  ps1Energy_(0.),
77  ps2Energy_(0.),
78  flags_(0),
79  deltaP_(0.),
80  vertexType_(kCandVertex),
81  mva_Isolated_(PFCandidate::bigMva_),
82  mva_e_pi_(PFCandidate::bigMva_),
83  mva_e_mu_(PFCandidate::bigMva_),
84  mva_pi_mu_(PFCandidate::bigMva_),
85  mva_nothing_gamma_(PFCandidate::bigMva_),
86  mva_nothing_nh_(PFCandidate::bigMva_),
87  mva_gamma_nh_(PFCandidate::bigMva_),
88  dnn_e_sigIsolated_(PFCandidate::bigMva_),
89  dnn_e_sigNonIsolated_(PFCandidate::bigMva_),
90  dnn_e_bkgNonIsolated_(PFCandidate::bigMva_),
91  dnn_e_bkgTau_(PFCandidate::bigMva_),
92  dnn_e_bkgPhoton_(PFCandidate::bigMva_),
93  dnn_gamma_(PFCandidate::bigMva_),
94  getter_(nullptr),
95  storedRefsBitPattern_(0),
96  time_(0.f),
97  timeError_(-1.f) {
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 || partId == e || partId == mu) {
109  if (charge == 0) {
110  string err;
111  err += "Attempt to construct a charged PFCandidate with a zero charge";
112  throw cms::Exception("InconsistentValue", err.c_str());
113  }
114  } else {
115  if (charge) {
116  string err;
117  err += "Attempt to construct a neutral PFCandidate ";
118  err += "with a non-zero charge";
119  throw cms::Exception("InconsistentValue", err.c_str());
120  }
121  }
123 }
124 
126  : CompositeCandidate(iOther),
127  elementsInBlocks_(nullptr),
128  blocksStorage_(iOther.blocksStorage_),
129  elementsStorage_(iOther.elementsStorage_),
130  sourcePtr_(iOther.sourcePtr_),
131  muonTrackType_(iOther.muonTrackType_),
132  ecalERatio_(iOther.ecalERatio_),
133  hcalERatio_(iOther.hcalERatio_),
134  hoERatio_(iOther.hoERatio_),
135  rawEcalEnergy_(iOther.rawEcalEnergy_),
136  rawHcalEnergy_(iOther.rawHcalEnergy_),
137  rawHoEnergy_(iOther.rawHoEnergy_),
138  ps1Energy_(iOther.ps1Energy_),
139  ps2Energy_(iOther.ps2Energy_),
140  flags_(iOther.flags_),
141  deltaP_(iOther.deltaP_),
142  vertexType_(iOther.vertexType_),
143  mva_Isolated_(iOther.mva_Isolated_),
144  mva_e_pi_(iOther.mva_e_pi_),
145  mva_e_mu_(iOther.mva_e_mu_),
146  mva_pi_mu_(iOther.mva_pi_mu_),
147  mva_nothing_gamma_(iOther.mva_nothing_gamma_),
148  mva_nothing_nh_(iOther.mva_nothing_nh_),
149  mva_gamma_nh_(iOther.mva_gamma_nh_),
150  dnn_e_sigIsolated_(iOther.dnn_e_sigIsolated_),
151  dnn_e_sigNonIsolated_(iOther.dnn_e_sigNonIsolated_),
152  dnn_e_bkgNonIsolated_(iOther.dnn_e_bkgNonIsolated_),
153  dnn_e_bkgTau_(iOther.dnn_e_bkgTau_),
154  dnn_e_bkgPhoton_(iOther.dnn_e_bkgPhoton_),
155  dnn_gamma_(iOther.dnn_gamma_),
156  positionAtECALEntrance_(iOther.positionAtECALEntrance_),
157  getter_(iOther.getter_),
158  storedRefsBitPattern_(iOther.storedRefsBitPattern_),
159  refsInfo_(iOther.refsInfo_),
160  refsCollectionCache_(iOther.refsCollectionCache_),
161  time_(iOther.time_),
162  timeError_(iOther.timeError_),
163  hcalDepthEnergyFractions_(iOther.hcalDepthEnergyFractions_) {
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_;
193  mva_Isolated_ = iOther.mva_Isolated_;
194  mva_e_pi_ = iOther.mva_e_pi_;
195  mva_e_mu_ = iOther.mva_e_mu_;
196  mva_pi_mu_ = iOther.mva_pi_mu_;
199  mva_gamma_nh_ = iOther.mva_gamma_nh_;
203  dnn_e_bkgTau_ = iOther.dnn_e_bkgTau_;
205  dnn_gamma_ = iOther.dnn_gamma_;
207  getter_ = iOther.getter_;
209  refsInfo_ = iOther.refsInfo_;
211  time_ = iOther.time_;
212  timeError_ = iOther.timeError_;
214  return *this;
215 }
216 
217 PFCandidate::~PFCandidate() { delete elementsInBlocks_.load(std::memory_order_acquire); }
218 
219 PFCandidate* PFCandidate::clone() const { return new PFCandidate(*this); }
220 
221 void PFCandidate::addElementInBlock(const reco::PFBlockRef& blockref, 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 
232  switch (std::abs(pdgid)) {
233  case 211:
234  return h;
235  case 11:
236  return e;
237  case 13:
238  return mu;
239  case 22:
240  return gamma;
241  case 130:
242  return h0;
243  case 1:
244  return h_HF;
245  case 2:
246  return egamma_HF;
247  case 0:
248  return X;
249  default:
250  return X;
251  }
252 }
253 
255  int thecharge = charge();
256 
257  switch (type) {
258  case h:
259  return thecharge * 211; // pi+
260  case e:
261  return thecharge * (-11);
262  case mu:
263  return thecharge * (-13);
264  case gamma:
265  return 22;
266  case h0:
267  return 130; // K_L0
268  case h_HF:
269  return 1; // dummy pdg code
270  case egamma_HF:
271  return 2; // dummy pdg code
272  case X:
273  default:
274  return 0;
275  }
276 }
277 
279 
281  CandidatePtr myPtr = sourceCandidatePtr(0);
282  if (myPtr.isNull())
283  return false;
284  for (size_t i = 0, n = other.numberOfSourceCandidatePtrs(); i < n; ++i) {
285  CandidatePtr otherPtr = other.sourceCandidatePtr(i);
286  if ((otherPtr == myPtr) || (sourcePtr_.isNonnull() && otherPtr.isNonnull() && sourcePtr_->overlap(*otherPtr))) {
287  return true;
288  }
289  }
290  return false;
291 }
292 
293 // Rescale three-momentum, preserving mass
294 void PFCandidate::rescaleMomentum(double rescaleFactor) {
295  if (rescaleFactor < 0)
296  throw cms::Exception(
297  "NegativeScaling",
298  "Scale factor " + std::to_string(rescaleFactor) + " is < 0. Cannot rescale momentum by this value");
299  float rescaleE = std::sqrt(p() * p() * (rescaleFactor * rescaleFactor - 1) / (energy() * energy()) + 1);
300  LorentzVector rescaledp4(rescaleFactor * px(), rescaleFactor * py(), rescaleFactor * pz(), rescaleE * energy());
301  setP4(rescaledp4);
302 }
303 
304 void PFCandidate::setFlag(Flags theFlag, bool value) {
305  if (value)
306  flags_ = flags_ | (1 << theFlag);
307  else
308  flags_ = flags_ ^ (1 << theFlag);
309 }
310 
311 bool PFCandidate::flag(Flags theFlag) const { return (flags_ >> theFlag) & 1; }
312 
313 ostream& reco::operator<<(ostream& out, const PFCandidate& c) {
314  if (!out)
315  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 " << c.energy() << "/" << c.pt() << "/" << c.eta() << "/" << c.phi();
322  if (c.flag(PFCandidate::T_FROM_DISP))
323  out << ", T_FROM_DISP" << endl;
324  else if (c.flag(PFCandidate::T_TO_DISP))
325  out << ", T_TO_DISP" << endl;
326  else if (c.flag(PFCandidate::T_FROM_GAMMACONV))
327  out << ", T_FROM_GAMMACONV" << endl;
328  else if (c.flag(PFCandidate::GAMMA_TO_GAMMACONV))
329  out << ", GAMMA_TO_GAMMACONV" << endl;
330 
331  out << ", blocks/iele: ";
332 
333  PFCandidate::ElementsInBlocks eleInBlocks = c.elementsInBlocks();
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
356  if (c.particleId() == PFCandidate::e && c.electronExtraRef().isNonnull() && c.electronExtraRef().isAvailable()) {
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  size_t index = s_refsBefore[storedRefsBitPattern_ & iMask];
377  if (nullptr == getter_) {
378  getter_ = iGetter;
379  }
380 
381  if (iIsValid) {
382  if (0 == (storedRefsBitPattern_ & iBit)) {
383  refsInfo_.insert(refsInfo_.begin() + index, bitPackRefInfo(iCore, iKey));
384  if (iGetter == nullptr)
385  refsCollectionCache_.insert(refsCollectionCache_.begin() + index, static_cast<void const*>(iCore.productPtr()));
386  else
387  refsCollectionCache_.insert(refsCollectionCache_.begin() + index, nullptr);
388  } else {
389  assert(refsInfo_.size() > index);
390  *(refsInfo_.begin() + index) = bitPackRefInfo(iCore, iKey);
391  if (iGetter == nullptr)
392  *(refsCollectionCache_.begin() + index) = static_cast<void const*>(iCore.productPtr());
393  else
394  *(refsCollectionCache_.begin() + index) = nullptr;
395  }
396  storedRefsBitPattern_ |= iBit;
397  } else {
398  if (storedRefsBitPattern_ & iBit) {
399  refsInfo_.erase(refsInfo_.begin() + index);
401  storedRefsBitPattern_ ^= iBit;
402  }
403  }
404 }
405 
407  unsigned int iMask, unsigned int iBit, edm::ProductID& oProductID, size_t& oIndex, size_t& aIndex) const {
408  if (0 == (iBit & storedRefsBitPattern_)) {
409  return false;
410  }
411  aIndex = s_refsBefore[storedRefsBitPattern_ & iMask];
412  unsigned long long bitPacked = refsInfo_[aIndex];
413  oIndex = bitPacked & 0xFFFFFFFFULL; //low 32 bits are the index
414  unsigned short productIndex = (bitPacked & 0x0000FFFF00000000ULL) >> 32;
415  unsigned short processIndex = (bitPacked & 0xFFFF000000000000ULL) >> 48;
416  oProductID = edm::ProductID(processIndex, productIndex);
417  return true;
418 }
419 
421  if (!charge()) {
422  string err;
423  err += "PFCandidate::setTrackRef: this is a neutral candidate! ";
424  err += "particleId_=";
425  char num[4];
426  sprintf(num, "%d", particleId());
427  err += num;
428 
429  throw cms::Exception("InconsistentReference", err.c_str());
430  }
431 
432  storeRefInfo(kRefTrackMask, kRefTrackBit, iRef.isNonnull(), iRef.refCore(), iRef.key(), iRef.productGetter());
433 }
434 
436 
438  if (trackRef() != iRef->track()) {
439  string err;
440  err += "PFCandidate::setMuonRef: inconsistent track references!";
441 
442  throw cms::Exception("InconsistentReference", err.c_str());
443  }
444 
445  storeRefInfo(kRefMuonMask, kRefMuonBit, iRef.isNonnull(), iRef.refCore(), iRef.key(), iRef.productGetter());
446 }
447 
449 
452  // Removed by F. Beaudette. Would like to be able to save the GsfTrackRef even for charged pions
453  // if( particleId() != e ) {
454  // string err;
455  // err += "PFCandidate::setGsfTrackRef: this is not an electron ! particleId_=";
456  // char num[4];
457  // sprintf( num, "%d", particleId());
458  // err += num;
459  //
460  // throw cms::Exception("InconsistentReference",
461  // err.c_str() );
462  // }
463 
465 }
466 
468 
471  if (particleId() != h) {
472  string err;
473  err += "PFCandidate::setDisplacedVertexRef: this is not a hadron! particleId_=";
474  char num[4];
475  sprintf(num, "%d", particleId());
476  err += num;
477 
478  throw cms::Exception("InconsistentReference", err.c_str());
479  } else if (!flag(T_FROM_DISP) && !flag(T_TO_DISP)) {
480  string err;
481  err += "PFCandidate::setDisplacedVertexRef: particule flag is neither T_FROM_DISP nor T_TO_DISP";
482 
483  throw cms::Exception("InconsistentReference", err.c_str());
484  }
485 
486  if (type == T_TO_DISP && flag(T_TO_DISP))
489  iRef.isNonnull(),
490  iRef.refCore(),
491  iRef.key(),
492  iRef.productGetter());
493  else if (type == T_FROM_DISP && flag(T_FROM_DISP))
496  iRef.isNonnull(),
497  iRef.refCore(),
498  iRef.key(),
499  iRef.productGetter());
500  else if ((type == T_FROM_DISP && !flag(T_FROM_DISP)) || (type == T_TO_DISP && !flag(T_TO_DISP))) {
501  string err;
502  err += "PFCandidate::setDisplacedVertexRef: particule flag is not switched on";
503 
504  throw cms::Exception("InconsistentReference", err.c_str());
505  }
506 }
507 
509  if (type == T_TO_DISP) {
511  } else if (type == T_FROM_DISP) {
513  }
515 }
516 
519  if (particleId() != gamma) {
520  string err;
521  err += "PFCandidate::setConversionRef: this is not a (converted) photon ! particleId_=";
522  char num[4];
523  sprintf(num, "%d", particleId());
524  err += num;
525 
526  throw cms::Exception("InconsistentReference", err.c_str());
527  } else if (!flag(GAMMA_TO_GAMMACONV)) {
528  string err;
529  err += "PFCandidate::setConversionRef: particule flag is not GAMMA_TO_GAMMACONV";
530 
531  throw cms::Exception("InconsistentReference", err.c_str());
532  }
533 
534  storeRefInfo(
535  kRefConversionMask, kRefConversionBit, iRef.isNonnull(), iRef.refCore(), iRef.key(), iRef.productGetter());
536 }
537 
540 }
541 
544  storeRefInfo(kRefV0Mask, kRefV0Bit, iRef.isNonnull(), iRef.refCore(), iRef.key(), iRef.productGetter());
545 }
546 
549 }
550 
553  storeRefInfo(
554  kRefGsfElectronMask, kRefGsfElectronBit, iRef.isNonnull(), iRef.refCore(), iRef.key(), iRef.productGetter());
555 }
556 
559 }
560 
565  iRef.isNonnull(),
566  iRef.refCore(),
567  iRef.key(),
568  iRef.productGetter());
569 }
570 
573 }
574 
576 
579 }
580 
583 }
584 
587 }
588 
590  if (particleId() != gamma && particleId() != e) {
591  string err;
592  err += "PFCandidate::setSuperClusterRef: this is not an electron neither a photon ! particleId_=";
593  char num[4];
594  sprintf(num, "%d", particleId());
595  err += num;
596 
597  throw cms::Exception("InconsistentReference", err.c_str());
598  }
599 
600  storeRefInfo(kRefPhotonMask, kRefPhotonBit, iRef.isNonnull(), iRef.refCore(), iRef.key(), iRef.productGetter());
601 }
602 
604  if (particleId() != gamma && particleId() != e) {
605  string err;
606  err += "PFCandidate::setSuperClusterRef: this is not an electron neither a photon ! particleId_=";
607  char num[4];
608  sprintf(num, "%d", particleId());
609  err += num;
610 
611  throw cms::Exception("InconsistentReference", err.c_str());
612  }
613 
614  storeRefInfo(
616 }
617 
619  storeRefInfo(
621 }
622 
624  storeRefInfo(
626 }
627 
629  switch (vertexType) {
630  case kCandVertex:
631  return LeafCandidate::vertex();
632  break;
633  //the following cases will only be called for legacy AOD which does not have an embedded vertex
634  case kTrkVertex:
635  return trackRef()->vertex();
636  break;
637  case kComMuonVertex:
638  return muonRef()->combinedMuon()->vertex();
639  break;
640  case kSAMuonVertex:
641  return muonRef()->standAloneMuon()->vertex();
642  break;
643  case kTrkMuonVertex:
644  return muonRef()->track()->vertex();
645  break;
646  case kTPFMSMuonVertex:
647  return muonRef()->tpfmsTrack()->vertex();
648  break;
649  case kPickyMuonVertex:
650  return muonRef()->pickyTrack()->vertex();
651  break;
652  case kDYTMuonVertex:
653  return muonRef()->dytTrack()->vertex();
654  break;
655 
656  case kGSFVertex:
657  return gsfTrackRef()->vertex();
658  break;
659  }
660  return LeafCandidate::vertex();
661 }
662 
664  if (nullptr == elementsInBlocks_.load(std::memory_order_acquire)) {
665  std::unique_ptr<ElementsInBlocks> temp(new ElementsInBlocks(blocksStorage_.size()));
666  for (unsigned int icopy = 0; icopy != blocksStorage_.size(); ++icopy)
667  (*temp)[icopy] = std::make_pair(blocksStorage_[icopy], elementsStorage_[icopy]);
668  ElementsInBlocks* expected = nullptr;
669  if (elementsInBlocks_.compare_exchange_strong(expected, temp.get(), std::memory_order_acq_rel)) {
670  temp.release();
671  }
672  }
673  return *(elementsInBlocks_.load(std::memory_order_acquire));
674 }
~PFCandidate() override
destructor
Definition: PFCandidate.cc:217
reco::PFDisplacedVertexRef displacedVertexRef(Flags type) const
Definition: PFCandidate.cc:508
float deltaP_
uncertainty on 3-momentum
Definition: PFCandidate.h:494
RefCore const & refCore() const
Definition: Ref.h:267
int Charge
electric charge type
Definition: Candidate.h:34
bool empty() const
Is the RefVector empty.
Definition: RefVector.h:99
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:467
ParticleType
particle types
Definition: PFCandidate.h:44
reco::Muon::MuonTrackType muonTrackType_
Definition: PFCandidate.h:464
double pz() const final
z coordinate of momentum vector
bool overlap(const Candidate &) const override
Polymorphic overlap.
Definition: PFCandidate.cc:280
const edm::EDProductGetter * getter_
Definition: PFCandidate.h:551
void setPFPhotonExtraRef(const reco::PFCandidatePhotonExtraRef &ref)
set the PF Photon Extra Ref
Definition: PFCandidate.cc:618
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
void setGsfElectronRef(const reco::GsfElectronRef &ref)
set GsfElectronRef
Definition: PFCandidate.cc:552
void setFlag(Flags theFlag, bool value)
set a given flag
Definition: PFCandidate.cc:304
float timeError_
timing information uncertainty (<0 if timing not available)
Definition: PFCandidate.h:559
reco::ConversionRef conversionRef() const
return a reference to the original conversion
Definition: PFCandidate.cc:538
float hcalERatio_
corrected HCAL energy ratio (corrected/raw)
Definition: PFCandidate.h:470
float rawHcalEnergy_
raw HCAL energy
Definition: PFCandidate.h:479
unsigned flags_
all flags, packed (ecal regional, hcal regional, tracking)
Definition: PFCandidate.h:491
float dnn_e_bkgTau_
DNN for electron PFid: tau bkg.
Definition: PFCandidate.h:530
float dnn_e_sigNonIsolated_
DNN for electron PFid: non-isolated signal.
Definition: PFCandidate.h:524
float mva_e_mu_
mva for electron-muon discrimination
Definition: PFCandidate.h:506
ProductID id() const
Definition: RefCore.h:48
float mva_nothing_nh_
mva for neutral hadron detection
Definition: PFCandidate.h:515
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
std::vector< const void * > refsCollectionCache_
Definition: PFCandidate.h:554
std::string to_string(const V &value)
Definition: OMSAccess.h:71
reco::GsfElectronRef gsfElectronRef() const
return a reference to the corresponding GsfElectron if any
Definition: PFCandidate.cc:557
const Point & vertex() const override
vertex position (overwritten by PF...)
float hoERatio_
corrected HO energy ratio (corrected/raw)
Definition: PFCandidate.h:473
edm::RefVector< reco::PFBlockCollection > Blocks
Definition: PFCandidate.h:406
float mva_gamma_nh_
mva for neutral hadron - gamma discrimination
Definition: PFCandidate.h:518
float ecalERatio_
corrected ECAL energy ratio (corrected/raw)
Definition: PFCandidate.h:467
assert(be >=bs)
float mva_pi_mu_
mva for pi-muon discrimination
Definition: PFCandidate.h:509
void const * productPtr() const
Definition: RefCore.h:51
bool flag(Flags theFlag) const
return a given flag
Definition: PFCandidate.cc:311
EDProductGetter const * productGetter() const
Accessor for product getter.
Definition: Ref.h:247
key_type key() const
Accessor for product key.
Definition: Ref.h:250
float dnn_e_bkgPhoton_
DNN for electron PFid: photon bkg.
Definition: PFCandidate.h:533
std::vector< ElementInBlock > ElementsInBlocks
Definition: PFCandidate.h:404
float rawEcalEnergy_
raw ECAL energy
Definition: PFCandidate.h:476
float mva_e_pi_
mva for electron-pion discrimination
Definition: PFCandidate.h:503
reco::PFCandidateEGammaExtraRef egammaExtraRef() const
return a reference to the EGamma extra
Definition: PFCandidate.cc:581
reco::PhotonRef photonRef() const
return a reference to the corresponding Photon if any
Definition: PFCandidate.cc:575
std::vector< unsigned long long > refsInfo_
Definition: PFCandidate.h:553
double px() const final
x coordinate of momentum vector
void setDisplacedVertexRef(const reco::PFDisplacedVertexRef &ref, Flags flag)
set displaced vertex reference
Definition: PFCandidate.cc:470
bool isNull() const
Checks for null.
Definition: Ptr.h:142
double p() const final
magnitude of momentum vector
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
reco::PFCandidatePhotonExtraRef photonExtraRef() const
return a reference to the photon extra
Definition: PFCandidate.cc:577
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.cc:663
float ps1Energy_
corrected PS1 energy
Definition: PFCandidate.h:485
void addElementInBlock(const reco::PFBlockRef &blockref, unsigned elementIndex)
add an element to the current PFCandidate
Definition: PFCandidate.cc:221
void setPFElectronExtraRef(const reco::PFCandidateElectronExtraRef &ref)
set the PF Electron Extra Ref
Definition: PFCandidate.cc:562
void setParticleType(ParticleType type)
set Particle Type
Definition: PFCandidate.cc:278
T sqrt(T t)
Definition: SSEVec.h:19
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
unsigned short storedRefsBitPattern_
Definition: PFCandidate.h:552
PFCandidate * clone() const override
return a clone
Definition: PFCandidate.cc:219
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
float rawHoEnergy_
raw HO energy
Definition: PFCandidate.h:482
Definition: value.py:1
unsigned int index
Definition: LeafCandidate.h:31
void reserve(size_type n)
Reserve space for RefVector.
Definition: RefVector.h:108
double py() const final
y coordinate of momentum vector
ProcessIndex processIndex() const
Definition: ProductID.h:33
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:448
void rescaleMomentum(double rescaleFactor)
particle momentum *= rescaleFactor
Definition: PFCandidate.cc:294
int translateTypeToPdgId(ParticleType type) const
Definition: PFCandidate.cc:254
static const unsigned int s_refsBefore[]
Definition: CountBits.h:14
unsigned int index
index type
Definition: Candidate.h:50
Block of elements.
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
float dnn_e_sigIsolated_
DNN for electron PFid: isolated signal.
Definition: PFCandidate.h:521
void setGsfTrackRef(const reco::GsfTrackRef &ref)
set gsftrack reference
Definition: PFCandidate.cc:451
reco::VertexCompositeCandidateRef v0Ref() const
return a reference to the original conversion
Definition: PFCandidate.cc:547
PFCandidate()
default constructor
Definition: PFCandidate.cc:23
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:589
void setConversionRef(const reco::ConversionRef &ref)
set ref to original reco conversion
Definition: PFCandidate.cc:518
edm::Ref< PFDisplacedVertexCollection > PFDisplacedVertexRef
persistent reference to a PFDisplacedVertex objects
bool getRefInfo(unsigned int iMask, unsigned int iBit, edm::ProductID &oProdID, size_t &oIndex, size_t &aIndex) const
Definition: PFCandidate.cc:406
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
PFCandidate & operator=(PFCandidate const &)
Definition: PFCandidate.cc:170
std::atomic< ElementsInBlocks * > elementsInBlocks_
Definition: PFCandidate.h:451
PFVertexType vertexType_
Definition: PFCandidate.h:497
PFCandidatePtr sourcePtr_
reference to the source PFCandidate, if any
Definition: PFCandidate.h:460
const Point & vertex() const override
vertex position (overwritten by PF...)
Definition: PFCandidate.cc:60
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
fixed size matrix
float time_
timing information (valid if timeError_ >= 0)
Definition: PFCandidate.h:557
ParticleType translatePdgIdToType(int pdgid) const
Definition: PFCandidate.cc:231
void setMuonRef(const reco::MuonRef &ref)
set muon reference
Definition: PFCandidate.cc:437
math::XYZPointF positionAtECALEntrance_
position at ECAL entrance, from the PFRecTrack
Definition: PFCandidate.h:539
float mva_nothing_gamma_
mva for gamma detection
Definition: PFCandidate.h:512
void setPFEGammaExtraRef(const reco::PFCandidateEGammaExtraRef &ref)
set the PF EGamma Extra Ref
Definition: PFCandidate.cc:623
static unsigned long long bitPackRefInfo(const edm::RefCore &iCore, size_t iIndex)
Definition: PFCandidate.cc:363
ProcessIndex productIndex() const
Definition: ProductID.h:34
float ps2Energy_
corrected PS2 energy
Definition: PFCandidate.h:488
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
reco::PFCandidateElectronExtraRef electronExtraRef() const
return a reference to the electron extra
Definition: PFCandidate.cc:571
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:435
void setSuperClusterRef(const reco::SuperClusterRef &scRef)
Definition: PFCandidate.cc:603
const math::XYZPoint & vertexLegacy(PFCandidate::PFVertexType vertexType) const
Definition: PFCandidate.cc:628
void setV0Ref(const reco::VertexCompositeCandidateRef &ref)
set ref to original reco conversion
Definition: PFCandidate.cc:543
LeafCandidate & operator=(LeafCandidate &&)=default
void setTrackRef(const reco::TrackRef &ref)
set track reference
Definition: PFCandidate.cc:420
tmp
align.sh
Definition: createJobs.py:716
float dnn_e_bkgNonIsolated_
DNN for electron PFid: non-isolated bkg.
Definition: PFCandidate.h:527
Elements elementsStorage_
Definition: PFCandidate.h:456
void setPdgId(int pdgId) final
CandidatePtr sourceCandidatePtr(size_type i) const override
Definition: PFCandidate.h:124
void setP4(const LorentzVector &p4) final
set 4-momentum
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any
Definition: PFCandidate.cc:585
int charge() const final
electric charge
std::array< float, 7 > hcalDepthEnergyFractions_
Definition: PFCandidate.h:561
double energy() const final
energy
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:4656
virtual ParticleType particleId() const
Definition: PFCandidate.h:392