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 
300  float e = std::sqrt(p() * p() * rescaleFactor * rescaleFactor + mass() * mass());
301 
302  LorentzVector rescaledp4(rescaleFactor * px(), rescaleFactor * py(), rescaleFactor * pz(), e);
303  setP4(rescaledp4);
304 }
305 
306 void PFCandidate::setFlag(Flags theFlag, bool value) {
307  if (value)
308  flags_ = flags_ | (1 << theFlag);
309  else
310  flags_ = flags_ ^ (1 << theFlag);
311 }
312 
313 bool PFCandidate::flag(Flags theFlag) const { return (flags_ >> theFlag) & 1; }
314 
315 ostream& reco::operator<<(ostream& out, const PFCandidate& c) {
316  if (!out)
317  return out;
318 
319  out << "\tPFCandidate type: " << c.particleId();
320  out << setiosflags(ios::right);
321  out << setiosflags(ios::fixed);
322  out << setprecision(3);
323  out << " E/pT/eta/phi " << c.energy() << "/" << c.pt() << "/" << c.eta() << "/" << c.phi();
324  if (c.flag(PFCandidate::T_FROM_DISP))
325  out << ", T_FROM_DISP" << endl;
326  else if (c.flag(PFCandidate::T_TO_DISP))
327  out << ", T_TO_DISP" << endl;
328  else if (c.flag(PFCandidate::T_FROM_GAMMACONV))
329  out << ", T_FROM_GAMMACONV" << endl;
330  else if (c.flag(PFCandidate::GAMMA_TO_GAMMACONV))
331  out << ", GAMMA_TO_GAMMACONV" << endl;
332 
333  out << ", blocks/iele: ";
334 
335  PFCandidate::ElementsInBlocks eleInBlocks = c.elementsInBlocks();
336  for (unsigned i = 0; i < eleInBlocks.size(); i++) {
337  PFBlockRef blockRef = eleInBlocks[i].first;
338  unsigned indexInBlock = eleInBlocks[i].second;
339 
340  out << "(" << blockRef.key() << "|" << indexInBlock << "), ";
341  }
342 
343  out << " source:" << c.sourcePtr_.id() << "/" << c.sourcePtr_.key();
344 
345  // PFBlockRef blockRef = c.block();
346  // int blockid = blockRef.key();
347  // const edm::OwnVector< reco::PFBlockElement >& elements = c.elements();
348  // out<< "\t# of elements " << elements.size()
349  // <<" from block " << blockid << endl;
350 
351  // // print each element in turn
352 
353  // for(unsigned ie=0; ie<elements.size(); ie++) {
354  // out<<"\t"<< elements[ie] <<endl;
355  // }
356 
357  // Improved printout for electrons if PFCandidateElectronExtra is available
358  if (c.particleId() == PFCandidate::e && c.electronExtraRef().isNonnull() && c.electronExtraRef().isAvailable()) {
359  out << std::endl << *(c.electronExtraRef());
360  }
361  out << resetiosflags(ios::right | ios::fixed);
362  return out;
363 }
364 
365 static unsigned long long bitPackRefInfo(const edm::RefCore& iCore, size_t iIndex) {
366  unsigned long long bitPack = iIndex;
367  bitPack |= static_cast<unsigned long long>(iCore.id().productIndex()) << 32;
368  bitPack |= static_cast<unsigned long long>(iCore.id().processIndex()) << 48;
369  return bitPack;
370 }
371 
372 void PFCandidate::storeRefInfo(unsigned int iMask,
373  unsigned int iBit,
374  bool iIsValid,
375  const edm::RefCore& iCore,
376  size_t iKey,
377  const edm::EDProductGetter* iGetter) {
378  size_t index = s_refsBefore[storedRefsBitPattern_ & iMask];
379  if (nullptr == getter_) {
380  getter_ = iGetter;
381  }
382 
383  if (iIsValid) {
384  if (0 == (storedRefsBitPattern_ & iBit)) {
385  refsInfo_.insert(refsInfo_.begin() + index, bitPackRefInfo(iCore, iKey));
386  if (iGetter == nullptr)
387  refsCollectionCache_.insert(refsCollectionCache_.begin() + index, 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  storedRefsBitPattern_ |= iBit;
399  } else {
400  if (storedRefsBitPattern_ & iBit) {
401  refsInfo_.erase(refsInfo_.begin() + index);
403  storedRefsBitPattern_ ^= iBit;
404  }
405  }
406 }
407 
409  unsigned int iMask, unsigned int iBit, edm::ProductID& oProductID, size_t& oIndex, size_t& aIndex) const {
410  if (0 == (iBit & storedRefsBitPattern_)) {
411  return false;
412  }
413  aIndex = s_refsBefore[storedRefsBitPattern_ & iMask];
414  unsigned long long bitPacked = refsInfo_[aIndex];
415  oIndex = bitPacked & 0xFFFFFFFFULL; //low 32 bits are the index
416  unsigned short productIndex = (bitPacked & 0x0000FFFF00000000ULL) >> 32;
417  unsigned short processIndex = (bitPacked & 0xFFFF000000000000ULL) >> 48;
418  oProductID = edm::ProductID(processIndex, productIndex);
419  return true;
420 }
421 
423  if (!charge()) {
424  string err;
425  err += "PFCandidate::setTrackRef: this is a neutral candidate! ";
426  err += "particleId_=";
427  char num[4];
428  sprintf(num, "%d", particleId());
429  err += num;
430 
431  throw cms::Exception("InconsistentReference", err.c_str());
432  }
433 
434  storeRefInfo(kRefTrackMask, kRefTrackBit, iRef.isNonnull(), iRef.refCore(), iRef.key(), iRef.productGetter());
435 }
436 
438 
440  if (trackRef() != iRef->track()) {
441  string err;
442  err += "PFCandidate::setMuonRef: inconsistent track references!";
443 
444  throw cms::Exception("InconsistentReference", err.c_str());
445  }
446 
447  storeRefInfo(kRefMuonMask, kRefMuonBit, iRef.isNonnull(), iRef.refCore(), iRef.key(), iRef.productGetter());
448 }
449 
451 
454  // Removed by F. Beaudette. Would like to be able to save the GsfTrackRef even for charged pions
455  // if( particleId() != e ) {
456  // string err;
457  // err += "PFCandidate::setGsfTrackRef: this is not an electron ! particleId_=";
458  // char num[4];
459  // sprintf( num, "%d", particleId());
460  // err += num;
461  //
462  // throw cms::Exception("InconsistentReference",
463  // err.c_str() );
464  // }
465 
467 }
468 
470 
473  if (particleId() != h) {
474  string err;
475  err += "PFCandidate::setDisplacedVertexRef: this is not a hadron! particleId_=";
476  char num[4];
477  sprintf(num, "%d", particleId());
478  err += num;
479 
480  throw cms::Exception("InconsistentReference", err.c_str());
481  } else if (!flag(T_FROM_DISP) && !flag(T_TO_DISP)) {
482  string err;
483  err += "PFCandidate::setDisplacedVertexRef: particule flag is neither T_FROM_DISP nor T_TO_DISP";
484 
485  throw cms::Exception("InconsistentReference", err.c_str());
486  }
487 
488  if (type == T_TO_DISP && flag(T_TO_DISP))
491  iRef.isNonnull(),
492  iRef.refCore(),
493  iRef.key(),
494  iRef.productGetter());
495  else if (type == T_FROM_DISP && flag(T_FROM_DISP))
498  iRef.isNonnull(),
499  iRef.refCore(),
500  iRef.key(),
501  iRef.productGetter());
502  else if ((type == T_FROM_DISP && !flag(T_FROM_DISP)) || (type == T_TO_DISP && !flag(T_TO_DISP))) {
503  string err;
504  err += "PFCandidate::setDisplacedVertexRef: particule flag is not switched on";
505 
506  throw cms::Exception("InconsistentReference", err.c_str());
507  }
508 }
509 
511  if (type == T_TO_DISP) {
513  } else if (type == T_FROM_DISP) {
515  }
517 }
518 
521  if (particleId() != gamma) {
522  string err;
523  err += "PFCandidate::setConversionRef: this is not a (converted) photon ! particleId_=";
524  char num[4];
525  sprintf(num, "%d", particleId());
526  err += num;
527 
528  throw cms::Exception("InconsistentReference", err.c_str());
529  } else if (!flag(GAMMA_TO_GAMMACONV)) {
530  string err;
531  err += "PFCandidate::setConversionRef: particule flag is not GAMMA_TO_GAMMACONV";
532 
533  throw cms::Exception("InconsistentReference", err.c_str());
534  }
535 
536  storeRefInfo(
537  kRefConversionMask, kRefConversionBit, iRef.isNonnull(), iRef.refCore(), iRef.key(), iRef.productGetter());
538 }
539 
542 }
543 
546  storeRefInfo(kRefV0Mask, kRefV0Bit, iRef.isNonnull(), iRef.refCore(), iRef.key(), iRef.productGetter());
547 }
548 
551 }
552 
555  storeRefInfo(
556  kRefGsfElectronMask, kRefGsfElectronBit, iRef.isNonnull(), iRef.refCore(), iRef.key(), iRef.productGetter());
557 }
558 
561 }
562 
567  iRef.isNonnull(),
568  iRef.refCore(),
569  iRef.key(),
570  iRef.productGetter());
571 }
572 
575 }
576 
578 
581 }
582 
585 }
586 
589 }
590 
592  if (particleId() != gamma && particleId() != e) {
593  string err;
594  err += "PFCandidate::setSuperClusterRef: this is not an electron neither a photon ! particleId_=";
595  char num[4];
596  sprintf(num, "%d", particleId());
597  err += num;
598 
599  throw cms::Exception("InconsistentReference", err.c_str());
600  }
601 
602  storeRefInfo(kRefPhotonMask, kRefPhotonBit, iRef.isNonnull(), iRef.refCore(), iRef.key(), iRef.productGetter());
603 }
604 
606  if (particleId() != gamma && particleId() != e) {
607  string err;
608  err += "PFCandidate::setSuperClusterRef: this is not an electron neither a photon ! particleId_=";
609  char num[4];
610  sprintf(num, "%d", particleId());
611  err += num;
612 
613  throw cms::Exception("InconsistentReference", err.c_str());
614  }
615 
616  storeRefInfo(
618 }
619 
621  storeRefInfo(
623 }
624 
626  storeRefInfo(
628 }
629 
631  switch (vertexType) {
632  case kCandVertex:
633  return LeafCandidate::vertex();
634  break;
635  //the following cases will only be called for legacy AOD which does not have an embedded vertex
636  case kTrkVertex:
637  return trackRef()->vertex();
638  break;
639  case kComMuonVertex:
640  return muonRef()->combinedMuon()->vertex();
641  break;
642  case kSAMuonVertex:
643  return muonRef()->standAloneMuon()->vertex();
644  break;
645  case kTrkMuonVertex:
646  return muonRef()->track()->vertex();
647  break;
648  case kTPFMSMuonVertex:
649  return muonRef()->tpfmsTrack()->vertex();
650  break;
651  case kPickyMuonVertex:
652  return muonRef()->pickyTrack()->vertex();
653  break;
654  case kDYTMuonVertex:
655  return muonRef()->dytTrack()->vertex();
656  break;
657 
658  case kGSFVertex:
659  return gsfTrackRef()->vertex();
660  break;
661  }
662  return LeafCandidate::vertex();
663 }
664 
666  if (nullptr == elementsInBlocks_.load(std::memory_order_acquire)) {
667  std::unique_ptr<ElementsInBlocks> temp(new ElementsInBlocks(blocksStorage_.size()));
668  for (unsigned int icopy = 0; icopy != blocksStorage_.size(); ++icopy)
669  (*temp)[icopy] = std::make_pair(blocksStorage_[icopy], elementsStorage_[icopy]);
670  ElementsInBlocks* expected = nullptr;
671  if (elementsInBlocks_.compare_exchange_strong(expected, temp.get(), std::memory_order_acq_rel)) {
672  temp.release();
673  }
674  }
675  return *(elementsInBlocks_.load(std::memory_order_acquire));
676 }
~PFCandidate() override
destructor
Definition: PFCandidate.cc:217
reco::PFDisplacedVertexRef displacedVertexRef(Flags type) const
Definition: PFCandidate.cc:510
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:469
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:620
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
void setGsfElectronRef(const reco::GsfElectronRef &ref)
set GsfElectronRef
Definition: PFCandidate.cc:554
void setFlag(Flags theFlag, bool value)
set a given flag
Definition: PFCandidate.cc:306
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:540
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
reco::GsfElectronRef gsfElectronRef() const
return a reference to the corresponding GsfElectron if any
Definition: PFCandidate.cc:559
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:313
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
static std::string to_string(const XMLCh *ch)
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:583
reco::PhotonRef photonRef() const
return a reference to the corresponding Photon if any
Definition: PFCandidate.cc:577
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:472
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:579
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.cc:665
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:564
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:450
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:453
reco::VertexCompositeCandidateRef v0Ref() const
return a reference to the original conversion
Definition: PFCandidate.cc:549
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:591
void setConversionRef(const reco::ConversionRef &ref)
set ref to original reco conversion
Definition: PFCandidate.cc:520
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:408
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:439
double mass() const final
mass
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:625
static unsigned long long bitPackRefInfo(const edm::RefCore &iCore, size_t iIndex)
Definition: PFCandidate.cc:365
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:573
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:437
void setSuperClusterRef(const reco::SuperClusterRef &scRef)
Definition: PFCandidate.cc:605
const math::XYZPoint & vertexLegacy(PFCandidate::PFVertexType vertexType) const
Definition: PFCandidate.cc:630
void setV0Ref(const reco::VertexCompositeCandidateRef &ref)
set ref to original reco conversion
Definition: PFCandidate.cc:545
LeafCandidate & operator=(LeafCandidate &&)=default
void setTrackRef(const reco::TrackRef &ref)
set track reference
Definition: PFCandidate.cc:422
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:587
int charge() const final
electric charge
std::array< float, 7 > hcalDepthEnergyFractions_
Definition: PFCandidate.h:561
void storeRefInfo(unsigned int iMask, unsigned int iBit, bool iIsValid, const edm::RefCore &iCore, size_t iKey, const edm::EDProductGetter *)
Definition: PFCandidate.cc:372
#define GETREF(_class_, _mask_, _bit_)
Definition: CountBits.h:4656
virtual ParticleType particleId() const
Definition: PFCandidate.h:392