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