CMS 3D CMS Logo

PackedCandidateTrackValidator.cc
Go to the documentation of this file.
9 
12 
21 
24 
25 #include <iomanip>
26 
27 namespace {
28  using dqm::reco::DQMStore;
30 
31  template <typename T>
32  void fillNoFlow(MonitorElement* me, T val) {
33  auto h = me->getTH1();
34  const auto xaxis = h->GetXaxis();
35  if (val <= xaxis->GetXmin())
36  h->AddBinContent(xaxis->GetFirst());
37  else if (val >= xaxis->GetXmax())
38  h->AddBinContent(xaxis->GetLast());
39  else
40  h->Fill(val);
41  }
42 
43  class HitPatternPrinter {
44  public:
45  explicit HitPatternPrinter(const reco::Track& trk) : track(trk) {}
46 
47  void print(std::ostream& os) const {
48  const reco::HitPattern& p = track.hitPattern();
49 
50  for (int i = 0; i < p.numberOfAllHits(reco::HitPattern::TRACK_HITS); ++i) {
51  uint32_t hit = p.getHitPattern(reco::HitPattern::TRACK_HITS, i);
52 
53  detLayer(os, p, hit);
54  if (p.missingHitFilter(hit)) {
55  os << "(miss)";
56  } else if (p.inactiveHitFilter(hit)) {
57  os << "(inact)";
58  } else if (p.badHitFilter(hit)) {
59  os << "(bad)";
60  }
61  os << " ";
62  }
63 
64  if (p.numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) > 0) {
65  os << "lost inner ";
66 
67  for (int i = 0; i < p.numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS); ++i) {
68  uint32_t hit = p.getHitPattern(reco::HitPattern::MISSING_INNER_HITS, i);
69  detLayer(os, p, hit);
70  if (p.missingHitFilter(hit)) {
71  os << "(miss)";
72  } else if (p.inactiveHitFilter(hit)) {
73  os << "(inact)";
74  }
75  }
76  }
77  if (p.numberOfLostHits(reco::HitPattern::MISSING_OUTER_HITS) > 0) {
78  os << "lost outer ";
79 
80  for (int i = 0; i < p.numberOfAllHits(reco::HitPattern::MISSING_OUTER_HITS); ++i) {
81  uint32_t hit = p.getHitPattern(reco::HitPattern::MISSING_OUTER_HITS, i);
82  detLayer(os, p, hit);
83  if (p.missingHitFilter(hit)) {
84  os << "(miss)";
85  } else if (p.inactiveHitFilter(hit)) {
86  os << "(inact)";
87  }
88  }
89  }
90  }
91 
92  private:
93  static void detLayer(std::ostream& os, const reco::HitPattern& p, uint32_t hit) {
94  if (p.pixelBarrelHitFilter(hit)) {
95  os << "BPIX";
96  } else if (p.pixelEndcapHitFilter(hit)) {
97  os << "FPIX";
98  } else if (p.stripTIBHitFilter(hit)) {
99  os << "TIB";
100  } else if (p.stripTIDHitFilter(hit)) {
101  os << "TID";
102  } else if (p.stripTOBHitFilter(hit)) {
103  os << "TOB";
104  } else if (p.stripTECHitFilter(hit)) {
105  os << "TEC";
106  }
107  os << p.getLayer(hit);
108  }
109 
110  const reco::Track& track;
111  };
112 
113  std::ostream& operator<<(std::ostream& os, const HitPatternPrinter& hpp) {
114  hpp.print(os);
115  return os;
116  }
117 
118  class TrackAlgoPrinter {
119  public:
120  explicit TrackAlgoPrinter(const reco::Track& trk) : track(trk) {}
121 
122  void print(std::ostream& os) const {
124  for (int ialgo = 0; ialgo < reco::TrackBase::algoSize; ++ialgo) {
125  auto algo = static_cast<reco::TrackBase::TrackAlgorithm>(ialgo);
126  if (track.isAlgoInMask(algo)) {
127  algos.push_back(algo);
128  }
129  }
130 
131  os << "algo " << reco::TrackBase::algoName(track.algo());
132  if (track.originalAlgo() != track.algo())
133  os << " originalAlgo " << reco::TrackBase::algoName(track.originalAlgo());
134  if (algos.size() > 1) {
135  os << " algoMask";
136  for (auto algo : algos) {
137  os << " " << reco::TrackBase::algoName(algo);
138  }
139  }
140  }
141 
142  private:
143  const reco::Track& track;
144  };
145  std::ostream& operator<<(std::ostream& os, const TrackAlgoPrinter& tap) {
146  tap.print(os);
147  return os;
148  }
149 
150  double diffRelative(double a, double b) { return (a - b) / b; }
151 
152  class LogIntHelper {
153  public:
154  LogIntHelper(double lmin, double lmax) : lmin_(lmin), lmax_(lmax) {}
155 
156  class UnderOverflow {
157  public:
158  UnderOverflow(double largestValue, double smallestValue, std::function<double(double)> modifyUnpack)
159  : unpackedLargestValue_(modifyUnpack ? modifyUnpack(largestValue) : largestValue),
160  unpackedSmallestValue_(modifyUnpack ? modifyUnpack(smallestValue) : smallestValue) {}
161 
162  bool compatibleWithUnderflow(double value) const { return value == unpackedSmallestValue_; }
163  void printNonOkUnderflow(std::ostream& os) const { os << " (not min " << unpackedSmallestValue_ << ")"; }
164 
165  bool compatibleWithOverflow(double value) const { return value == unpackedLargestValue_; }
166  void printNonOkOverflow(std::ostream& os) const { os << " (not max " << unpackedLargestValue_ << ")"; }
167 
168  private:
169  // narrow to float to compare apples to apples with values from
170  // PackedCandidate (even though the final comparison is done in
171  // double)
172  const float unpackedLargestValue_;
173  const float unpackedSmallestValue_;
174  };
175 
176  static std::string maxName() { return "max"; }
177  static std::string minName() { return "min"; }
178 
179  UnderOverflow underOverflowHelper(double value, std::function<double(double)> modifyUnpack) const {
180  return UnderOverflow(
181  largestValue(), value >= 0 ? smallestPositiveValue() : std::abs(smallestNegativeValue()), modifyUnpack);
182  }
183 
184  double largestValue() const { return logintpack::unpack8log(127, lmin_, lmax_); }
185 
186  static bool wouldBeDenorm(double value) { return false; }
187 
188  // lessThan means closer to zero
189  bool lessThanSmallestValue(double value) const {
190  if (value >= 0)
191  return value < smallestPositiveValue();
192  else
193  return value > smallestNegativeValue();
194  }
195 
196  double smallestPositiveValue() const { return logintpack::unpack8log(logintpack::smallestPositive, lmin_, lmax_); }
197 
198  double smallestNegativeValue() const { return logintpack::unpack8log(logintpack::smallestNegative, lmin_, lmax_); }
199 
200  private:
201  const double lmin_;
202  const double lmax_;
203  };
204  class Float16Helper {
205  public:
206  class UnderOverflow {
207  public:
208  static void printNonOkUnderflow(std::ostream& os) { os << " (not 0)"; }
209  static bool compatibleWithUnderflow(double value) { return value == 0.0; }
210  static void printNonOkOverflow(std::ostream& os) { os << " (not inf)"; }
211  static bool compatibleWithOverflow(double value) { return edm::isNotFinite(value); }
212  };
213 
214  static std::string maxName() { return "inf"; }
215  static std::string minName() { return "0"; }
216 
217  static UnderOverflow underOverflowHelper(double value, std::function<double(double)>) { return UnderOverflow(); }
218 
219  static double largestValue() { return MiniFloatConverter::max32RoundedToMax16(); }
220 
221  static bool wouldBeDenorm(double value) {
222  const float valuef = static_cast<float>(value);
223  return valuef >= MiniFloatConverter::denorm_min() && valuef < MiniFloatConverter::min();
224  }
225 
226  static bool lessThanSmallestValue(double value) { return std::abs(value) < smallestValue(); }
227 
228  static double smallestValue() { return MiniFloatConverter::denorm_min(); }
229  };
230 
231  enum class RangeStatus {
232  inrange = 0,
233  inrange_signflip = 1,
234  denormal = 2,
235  underflow_OK = 3,
236  underflow_notOK = 4,
237  overflow_OK = 5,
238  overflow_notOK = 6
239  };
240  bool isInRange(RangeStatus status) { return status == RangeStatus::inrange || status == RangeStatus::denormal; }
241 
242  template <typename T>
243  class PackedValueCheckResult {
244  public:
245  PackedValueCheckResult(RangeStatus status,
246  double diff,
247  double pcvalue,
248  double trackvalue,
249  double rangeMin,
250  double rangeMax,
251  const typename T::UnderOverflow& underOverflow)
252  : diff_(diff),
253  pcvalue_(pcvalue),
254  trackvalue_(trackvalue),
255  rangeMin_(rangeMin),
256  rangeMax_(rangeMax),
257  status_(status),
258  underOverflow_(underOverflow) {}
259 
260  RangeStatus status() const { return status_; }
261  double diff() const { return diff_; }
262 
263  bool outsideExpectedRange() const {
264  if (status_ == RangeStatus::inrange)
265  return diff_ < rangeMin_ || diff_ > rangeMax_;
266  // denormal is considered as "in range" regardless of the expected range
267  return status_ == RangeStatus::underflow_notOK || status_ == RangeStatus::overflow_notOK ||
268  status_ == RangeStatus::inrange_signflip;
269  }
270 
271  void print(std::ostream& os) const {
272  if (outsideExpectedRange())
273  os << "!! ";
274  os << "(" << rangeMin_ << "," << rangeMax_ << ") ";
275 
276  os << diff_ << " " << pcvalue_;
277  if (status_ == RangeStatus::underflow_OK || status_ == RangeStatus::underflow_notOK) {
278  os << " (underflow) ";
279  if (status_ == RangeStatus::underflow_notOK)
280  underOverflow_.printNonOkUnderflow(os);
281  } else if (status_ == RangeStatus::overflow_OK || status_ == RangeStatus::overflow_notOK) {
282  os << " (overflow) ";
283  if (status_ == RangeStatus::overflow_notOK)
284  underOverflow_.printNonOkOverflow(os);
285  } else if (status_ == RangeStatus::denormal)
286  os << " (denormal)";
287  os << " " << trackvalue_;
288  }
289 
290  private:
291  const double diff_;
292  const double pcvalue_;
293  const double trackvalue_;
294  const double rangeMin_;
295  const double rangeMax_;
296  const RangeStatus status_;
297  const typename T::UnderOverflow underOverflow_;
298  };
299 
300  struct Range {
301  Range(double mi, double ma) : min(mi), max(ma) {}
302  const double min, max;
303  };
304  struct RangeAbs {
305  RangeAbs(double val) : min(-val), max(val) {}
306  const double min, max;
307  };
308 
309  template <typename T>
310  class PackedValueCheck {
311  public:
312  template <typename R, typename... Args>
313  PackedValueCheck(const R& range, Args&&... args)
314  : helper_(std::forward<Args>(args)...), rangeMin_(range.min), rangeMax_(range.max) {}
315 
316  void book(DQMStore::IBooker& iBooker,
317  const std::string& name,
318  const std::string& title,
319  int nbins,
320  double min,
321  double max,
322  int flow_nbins,
323  double flow_min,
324  double flow_max) {
325  hInrange = iBooker.book1D(name, title, nbins, min, max);
326  hUnderOverflowSign = iBooker.book1D(name + "UnderOverFlowSign",
327  title + " with over- and underflow, and sign flip",
328  flow_nbins,
329  flow_min,
330  flow_max);
331  hStatus = iBooker.book1D(name + "Status", title + " status", 7, -0.5, 6.5);
332  hStatus->setBinLabel(1, "In range");
333  hStatus->setBinLabel(2, "In range, sign flip");
334  hStatus->setBinLabel(3, "Denormal");
335  hStatus->setBinLabel(4, "Underflow, PC is " + T::minName());
336  hStatus->setBinLabel(5, "Underflow, PC is not " + T::minName());
337  hStatus->setBinLabel(6, "Overflow, PC is " + T::maxName());
338  hStatus->setBinLabel(7, "Overflow, PC is not " + T::maxName());
339  }
340 
341  PackedValueCheckResult<T> fill(double pcvalue,
342  double trackvalue,
343  std::function<double(double)> modifyPack = std::function<double(double)>(),
344  std::function<double(double)> modifyUnpack = std::function<double(double)>()) {
345  const auto diff = diffRelative(pcvalue, trackvalue);
346 
347  const auto tmpSigned = modifyPack ? modifyPack(trackvalue) : trackvalue;
348  const auto tmp = std::abs(tmpSigned);
349  const auto underOverflow = helper_.underOverflowHelper(tmpSigned, modifyUnpack);
351  if (tmp > helper_.largestValue()) {
352  fillNoFlow(hUnderOverflowSign, diff);
353  if (underOverflow.compatibleWithOverflow(std::abs(pcvalue))) {
354  status = RangeStatus::overflow_OK;
355  } else {
356  status = RangeStatus::overflow_notOK;
357  }
358  } else if (helper_.lessThanSmallestValue(tmpSigned)) {
359  fillNoFlow(hUnderOverflowSign, diff);
360  if (underOverflow.compatibleWithUnderflow(std::abs(pcvalue))) {
361  status = RangeStatus::underflow_OK;
362  } else {
363  status = RangeStatus::underflow_notOK;
364  }
365  } else {
366  //Check if both numbers have same sign or both are zero.
367  if (pcvalue * trackvalue > 0 || pcvalue == trackvalue) {
368  if (T::wouldBeDenorm(tmp)) {
369  status = RangeStatus::denormal;
370  } else {
371  status = RangeStatus::inrange;
372  }
373  fillNoFlow(hInrange, diff);
374  } else {
375  fillNoFlow(hUnderOverflowSign, diff);
376  status = RangeStatus::inrange_signflip;
377  }
378  }
379  hStatus->Fill(static_cast<int>(status));
380 
381  return PackedValueCheckResult<T>(status, diff, pcvalue, trackvalue, rangeMin_, rangeMax_, underOverflow);
382  }
383 
384  private:
385  const T helper_;
386  const double rangeMin_;
387  const double rangeMax_;
388 
389  MonitorElement* hInrange;
390  MonitorElement* hUnderOverflowSign;
391  MonitorElement* hStatus;
392  };
393  template <typename T>
394  std::ostream& operator<<(std::ostream& os, const PackedValueCheckResult<T>& res) {
395  res.print(os);
396  return os;
397  }
398 } // namespace
399 
401 public:
404 
405  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
406  void analyze(const edm::Event&, const edm::EventSetup&) override;
407 
408  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
409 
410 private:
414 
416  bool debug_;
417 
418  enum {
427  };
429 
433 
436 
439 
443  PackedValueCheck<Float16Helper> h_diffDxyAssocPV;
444  PackedValueCheck<Float16Helper> h_diffDzAssocPV;
447 
450 
451  PackedValueCheck<LogIntHelper> h_diffCovQoverpQoverp;
452  PackedValueCheck<LogIntHelper> h_diffCovLambdaLambda;
453  PackedValueCheck<LogIntHelper> h_diffCovLambdaDsz;
454  PackedValueCheck<LogIntHelper> h_diffCovPhiPhi;
455  PackedValueCheck<LogIntHelper> h_diffCovPhiDxy;
456  PackedValueCheck<Float16Helper> h_diffCovDxyDxy;
457  PackedValueCheck<Float16Helper> h_diffCovDxyDsz;
458  PackedValueCheck<Float16Helper> h_diffCovDszDsz;
459 
463 
466 
469 
475 
483 
490 };
491 
493  : tracksToken_(consumes<edm::View<reco::Track>>(iConfig.getUntrackedParameter<edm::InputTag>("tracks"))),
494  verticesToken_(consumes<reco::VertexCollection>(iConfig.getUntrackedParameter<edm::InputTag>("vertices"))),
495  trackToPackedCandidateToken_(consumes<edm::Association<pat::PackedCandidateCollection>>(
496  iConfig.getUntrackedParameter<edm::InputTag>("trackToPackedCandidateAssociation"))),
497  rootFolder_(iConfig.getUntrackedParameter<std::string>("rootFolder")),
498  debug_(iConfig.getUntrackedParameter<bool>("debug")),
499  h_diffDxyAssocPV(RangeAbs(0.001)),
500  h_diffDzAssocPV(RangeAbs(0.001)),
501  h_diffCovQoverpQoverp(Range(-1e-6, 0.13), -15, 0), // despite of ceil in pack, there is rounding in double->float
502  h_diffCovLambdaLambda(
503  Range(-1e-6, 0.13), -20, -5), // despite of ceil in pack, there is rounding in double->float
504  h_diffCovLambdaDsz(RangeAbs(0.13), -17, -4),
505  h_diffCovPhiPhi(RangeAbs(0.13), -15, 0),
506  h_diffCovPhiDxy(RangeAbs(0.13), -17, -4),
507  h_diffCovDxyDxy(RangeAbs(0.001)),
508  h_diffCovDxyDsz(RangeAbs(0.001)),
509  h_diffCovDszDsz(RangeAbs(0.001)) {}
510 
512 
515 
516  desc.addUntracked<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
517  desc.addUntracked<edm::InputTag>("vertices", edm::InputTag("offlinePrimaryVertices"));
518  desc.addUntracked<edm::InputTag>("trackToPackedCandidateAssociation", edm::InputTag("packedPFCandidates"));
519  desc.addUntracked<std::string>("rootFolder", "Tracking/PackedCandidate");
520  desc.addUntracked<bool>("debug", false);
521 
522  descriptions.add("packedCandidateTrackValidator", desc);
523 }
524 
526  edm::Run const&,
527  edm::EventSetup const&) {
528  iBooker.setCurrentFolder(rootFolder_);
529 
530  h_selectionFlow = iBooker.book1D("selectionFlow", "Track selection flow", 8, -0.5, 7.5);
531  h_selectionFlow->setBinLabel(1, "All tracks");
532  h_selectionFlow->setBinLabel(2, "Associated to PackedCandidate");
533  h_selectionFlow->setBinLabel(3, "PC is charged"), h_selectionFlow->setBinLabel(4, "PC has track");
534  h_selectionFlow->setBinLabel(5, "PC is not electron");
535  h_selectionFlow->setBinLabel(6, "PC has hits");
536  h_selectionFlow->setBinLabel(7, "PC ndof != 0");
537  h_selectionFlow->setBinLabel(8, "Track: no missing inner hits");
538 
539  constexpr int diffBins = 50;
540 
541  h_diffVx =
542  iBooker.book1D("diffVx", "PackedCandidate::bestTrack() - reco::Track in vx()", diffBins, -0.2, 0.2); // not equal
543  h_diffVy =
544  iBooker.book1D("diffVy", "PackedCandidate::bestTrack() - reco::Track in vy()", diffBins, -0.2, 0.2); // not equal
545  h_diffVz =
546  iBooker.book1D("diffVz", "PackedCandidate::bestTrack() - reco::Track in vz()", diffBins, -0.4, 0.4); // not equal
547 
548  h_diffNormalizedChi2 = iBooker.book1D("diffNormalizedChi2",
549  "PackedCandidate::bestTrack() - reco::Track in normalizedChi2()",
550  30,
551  -1.5,
552  1.5); // expected difference in -1...0
553  h_diffNdof = iBooker.book1D(
554  "diffNdof", "PackedCandidate::bestTrack() - reco::Track in ndof()", 33, -30.5, 2.5); // to monitor the difference
555 
556  h_diffCharge = iBooker.book1D(
557  "diffCharge", "PackedCandidate::bestTrack() - reco::Track in charge()", 5, -2.5, 2.5); // expect equality
558  h_diffIsHighPurity = iBooker.book1D("diffIsHighPurity",
559  "PackedCandidate::bestTrack() - reco::Track in quality(highPurity)",
560  3,
561  -1.5,
562  1.5); // expect equality
563 
564  h_diffPt = iBooker.book1D("diffPt",
565  "(PackedCandidate::bestTrack() - reco::Track)/reco::Track in pt()",
566  diffBins,
567  -1.1,
568  1.1); // not equal, keep
569  h_diffEta = iBooker.book1D(
570  "diffEta", "PackedCandidate::bestTrack() - reco::Track in eta()", diffBins, -0.001, 0.001); // not equal, keep
571  h_diffPhi = iBooker.book1D("diffPhi",
572  "PackedCandidate::bestTrack() - reco::Track in phi()",
573  diffBins,
574  -0.0005,
575  0.0005); // expect equality within precision
576 
577  h_diffDxyAssocPV.book(iBooker,
578  "diffDxyAssocPV",
579  "(PackedCandidate::dxy() - reco::Track::dxy(assocPV))/reco::Track",
580  40,
581  -0.001,
582  0.001, // expect equality within precision
583  50,
584  -0.5,
585  0.5);
586  h_diffDzAssocPV.book(iBooker,
587  "diffDzAssocPV",
588  "(PackedCandidate::dzAssociatedPV() - reco::Track::dz(assocPV))/reco::Track",
589  40,
590  -0.001,
591  0.001, // expect equality within precision
592  50,
593  -0.5,
594  0.5);
595  h_diffDxyPV = iBooker.book1D("diffDxyPV",
596  "(PackedCandidate::dxy(PV) - reco::Track::dxy(PV))/reco::Track",
597  diffBins,
598  -0.01,
599  0.01); // expect equality within precision (worse than assocPV)
600  h_diffDzPV = iBooker.book1D("diffDzPV",
601  "(PackedCandidate::dz(PV) - reco::Track::dz(PV))/reco::Track",
602  diffBins,
603  -0.01,
604  0.01); // expect equality wihtin precision (worse than assocPV)
606  iBooker.book1D("diffTrackDxyAssocPV",
607  "(PackedCandidate::bestTrack()::dxy(assocPV)) - reco::Track::dxy(assocPV))/reco::Track",
608  diffBins,
609  -0.01,
610  0.01); // not equal
612  iBooker.book1D("diffTrackDzAssocPV",
613  "(PackedCandidate::bestTrack()::dz(assocPV)) - reco::Track::dz(assocPV))/reco::Track",
614  diffBins,
615  -0.01,
616  0.01); // not equal
617 
618  h_diffCovQoverpQoverp.book(iBooker,
619  "diffCovQoverpQoverp",
620  "(PackedCandidate::bestTrack() - reco::Track)/reco::track in cov(qoverp, qoverp)",
621  40,
622  -0.05,
623  0.15, // expect equality within precision (worst precision is exp(1/128*15) =~ 12 %
624  50,
625  -0.5,
626  0.5);
628  iBooker,
629  "diffCovLambdaLambda",
630  "(PackedCandidate::bestTrack() - reco::Track)/reco::Track in cov(lambda, lambda)",
631  40,
632  -0.05,
633  0.15, // expect equality within precision worst precision is exp(1/128*(20-5)) =~ 12 % (multiplied by pt^2 in packing & unpacking)
634  50,
635  -0.5,
636  0.5);
637  h_diffCovLambdaDsz.book(iBooker,
638  "diffCovLambdaDsz",
639  "(PackedCandidate::bestTrack() - reco::Track)/reco::Track in cov(lambda, dsz)",
640  60,
641  -0.15,
642  0.15, // expect equality within precision, worst precision is exp(1/128*(17-4) =~ 11 %
643  50,
644  -1,
645  1);
646  h_diffCovPhiPhi.book(
647  iBooker,
648  "diffCovPhiPhi",
649  "(PackedCandidate::bestTrack() - reco::Track)/reco::Track in cov(phi, phi)",
650  40,
651  -0.05,
652  0.15, // expect equality within precision worst precision is exp(1/128*(20-5)) =~ 12 % (multiplied by pt^2 in packing & unpacking)
653  50,
654  -0.5,
655  0.5);
656  h_diffCovPhiDxy.book(iBooker,
657  "diffCovPhiDxy",
658  "(PackedCandidate::bestTrack() - reco::Track)/reco::Track in cov(phi, dxy)",
659  60,
660  -0.15,
661  0.15, // expect equality within precision, wors precision is exp(1/128)*(17-4) =~ 11 %
662  50,
663  -1,
664  1);
665  h_diffCovDxyDxy.book(iBooker,
666  "diffCovDxyDxy",
667  "(PackedCandidate::bestTrack() - reco::Track)/reco::Track in cov(dxy, dxy)",
668  40,
669  -0.001,
670  0.001,
671  50,
672  -0.1,
673  0.1);
674  h_diffCovDxyDsz.book(iBooker,
675  "diffCovDxyDsz",
676  "(PackedCandidate::bestTrack() - reco::Track)/reco::Track in cov(dxy, dsz)",
677  40,
678  -0.001,
679  0.001, // expect equality within precision
680  50,
681  -0.5,
682  0.5);
683  h_diffCovDszDsz.book(iBooker,
684  "diffCovDszDsz",
685  "(PackedCandidate::bestTrack() - reco::Track)/reco::Track in cov(dsz, dsz)",
686  40,
687  -0.001,
688  0.001, // expect equality within precision
689  50,
690  -0.1,
691  0.1);
692 
693  h_diffDxyError = iBooker.book1D("diffDxyError",
694  "(PackedCandidate::dxyError() - reco::Track::dxyError())/reco::Track",
695  40,
696  -0.001,
697  0.001); // expect equality within precision
698  h_diffDszError = iBooker.book1D("diffDszError",
699  "(PackedCandidate::dzError() - reco::Track::dszError())/reco::Track",
700  40,
701  -0.001,
702  0.001); // ideally, not equal, but for now they are
703  h_diffDzError = iBooker.book1D("diffDzError",
704  "(PackedCandidate::dzError() - reco::Track::dzError())/reco::Track",
705  40,
706  -0.001,
707  0.001); // expect equality within precision (not currently the case)
708 
709  h_diffTrackDxyError = iBooker.book1D("diffTrackDxyError",
710  "(PackedCandidate::bestTrack() - reco::Track)/reco::Track in dxyError()",
711  40,
712  -0.001,
713  0.001); // expect equality within precision
714  h_diffTrackDzError = iBooker.book1D("diffTrackDzError",
715  "(PackedCandidate::bestTrack() - reco::Track)/reco::Track in dzError()",
716  40,
717  -0.05,
718  0.05); // not equal
719 
720  h_diffPtError = iBooker.book1D("diffPtError",
721  "(PackedCandidate::bestTrack() - reco::Track)/reco::Track in ptError()",
722  diffBins,
723  -1.1,
724  1.1); // not equal
725  h_diffEtaError = iBooker.book1D("diffEtaError",
726  "(PackedCandidate::bestTrack() - reco::Track)/reco::Track in etaError()",
727  60,
728  -0.15,
729  0.15); // not equal
730 
732  "diffNumberOfPixelLayers",
733  "PackedCandidate::pixelLayersWithMeasurement() - reco::Track::hitPattern::pixelLayersWithMeasurement()",
734  5,
735  -2.5,
736  2.5); // expect equality
738  "diffNumberOfStripLayers",
739  "PackedCandidate::stripLayersWithMeasurement() - reco::Track::hitPattern::stripLayersWithMeasurement()",
740  5,
741  -2.5,
742  2.5); // expect equality
744  iBooker.book1D("diffNumberOfPixelHits",
745  "PackedCandidate::numberOfPixelHits() - reco::Track::hitPattern::numberOfValidPixelHits()",
746  5,
747  -2.5,
748  2.5); // expect equality
749  h_diffNumberOfHits = iBooker.book1D("diffNumberOfHits",
750  "PackedCandidate::numberHits() - reco::Track::hitPattern::numberOfValidHits()",
751  5,
752  -2.5,
753  2.5); // expect equality
755  iBooker.book1D("diffLostInnerHits",
756  "PackedCandidate::lostInnerHits() - reco::Track::hitPattern::numberOfLostHits(MISSING_INNER_HITS)",
757  5,
758  -2.5,
759  2.5); // expect equality
760 
762  iBooker.book1D("diffHitPatternPixelLayersWithMeasurement",
763  "PackedCandidate::bestTrack() - reco::Track in hitPattern::pixelLayersWithMeasurement()",
764  13,
765  -10.5,
766  2.5); // not equal
768  iBooker.book1D("diffHitPatternStripLayersWithMeasurement",
769  "PackedCandidate::bestTrack() - reco::Track in hitPattern::stripLayersWithMeasurement()",
770  13,
771  -10.5,
772  2.5); // not equal
774  iBooker.book1D("diffHitPatternTrackerLayersWithMeasurement",
775  "PackedCandidate::bestTrack() - reco::Track in hitPattern::trackerLayersWithMeasurement()",
776  13,
777  -10.5,
778  2.5); // not equal
780  iBooker.book1D("diffHitPatternNumberOfValidPixelHits",
781  "PackedCandidate::bestTrack() - reco::Track in hitPattern::numberOfValidPixelHits()",
782  13,
783  -10.5,
784  2.5); // not equal
786  iBooker.book1D("diffHitPatternNumberOfValidHits",
787  "PackedCandidate::bestTrack() - reco::Track in hitPattern::numberOfValidHits()",
788  13,
789  -10.5,
790  2.5); // not equal
792  iBooker.book1D("diffHitPatternNumberOfLostPixelHits",
793  "PackedCandidate::bestTrack() - reco::Track in hitPattern::numberOfLostHits(MISSING_INNER_HITS)",
794  13,
795  -10.5,
796  2.5); // not equal
798  iBooker.book1D("diffHitPatternHasValidHitInFirstPixelBarrel",
799  "PackedCandidate::bestTrack() - reco::Track in hitPattern::hasValidHitInFirstPixelBarrel",
800  3,
801  -1.5,
802  1.5); // expect equality
803 
805  "numberPixelLayersOverMax", "Number of pixel layers over the maximum of PackedCandidate", 10, 0, 10);
807  "numberStripLayersOverMax", "Number of strip layers over the maximum of PackedCandidate", 10, 0, 10);
809  iBooker.book1D("numberLayersOverMax", "Number of layers over the maximum of PackedCandidate", 20, 0, 20);
811  iBooker.book1D("numberPixelHitsOverMax", "Number of pixel hits over the maximum of PackedCandidate", 10, 0, 10);
813  iBooker.book1D("numberStripHitsOverMax", "Number of strip hits over the maximum of PackedCandidate", 10, 0, 10);
815  iBooker.book1D("numberHitsOverMax", "Number of hits over the maximum of PackedCandidate", 20, 0, 20);
816 }
817 
820  iEvent.getByToken(tracksToken_, htracks);
821  const auto& tracks = *htracks;
822 
824  iEvent.getByToken(verticesToken_, hvertices);
825  const auto& vertices = *hvertices;
826 
827  if (vertices.empty())
828  return;
829  const reco::Vertex& pv = vertices[0];
830 
832  iEvent.getByToken(trackToPackedCandidateToken_, hassoc);
833  const auto& trackToPackedCandidate = *hassoc;
834 
835  for (size_t i = 0; i < tracks.size(); ++i) {
836  auto trackPtr = tracks.ptrAt(i);
837  const reco::Track& track = *trackPtr;
839 
840  pat::PackedCandidateRef pcRef = trackToPackedCandidate[trackPtr];
841  if (pcRef.isNull()) {
842  continue;
843  }
845 
846  // Filter out neutral PackedCandidates, some of them may have track associated, and for those the charge comparison fails
847  if (pcRef->charge() == 0) {
848  continue;
849  }
851 
852  const reco::Track* trackPcPtr = pcRef->bestTrack();
853  if (!trackPcPtr) {
854  continue;
855  }
857 
858  // Filter out electrons to avoid comparisons to PackedCandidates with GsfTrack
859  if (std::abs(pcRef->pdgId()) == 11) {
860  continue;
861  }
863 
864  // Filter out PackedCandidate-tracks with no hits, as they won't have their details filled
865  const reco::Track& trackPc = *trackPcPtr;
866  if (trackPc.hitPattern().numberOfValidHits() == 0) {
867  continue;
868  }
870 
871  auto slimmedVertexRef = pcRef->vertexRef();
872  const reco::Vertex& pcVertex = vertices[slimmedVertexRef.key()];
873 
874  fillNoFlow(h_diffVx, trackPc.vx() - track.vx());
875  fillNoFlow(h_diffVy, trackPc.vy() - track.vy());
876  fillNoFlow(h_diffVz, trackPc.vz() - track.vz());
877 
878  // PackedCandidate recalculates the ndof in unpacking as
879  // (nhits+npixelhits-5), but some strip hits may have dimension 2.
880  // If PackedCandidate has ndof=0, the resulting normalizedChi2
881  // will be 0 too. Hence, the comparison makes sense only for those
882  // PackedCandidates that have ndof != 0.
883  double diffNormalizedChi2 = 0;
884  if (trackPc.ndof() != 0) {
886  diffNormalizedChi2 = trackPc.normalizedChi2() - track.normalizedChi2();
887  fillNoFlow(h_diffNormalizedChi2, diffNormalizedChi2);
888  }
889  fillNoFlow(h_diffNdof, trackPc.ndof() - track.ndof());
890 
891  auto diffCharge = trackPc.charge() - track.charge();
892  fillNoFlow(h_diffCharge, diffCharge);
893  int diffHP = static_cast<int>(trackPc.quality(reco::TrackBase::highPurity)) -
894  static_cast<int>(track.quality(reco::TrackBase::highPurity));
895  fillNoFlow(h_diffIsHighPurity, diffHP);
896 
897  const auto diffPt = diffRelative(trackPc.pt(), track.pt());
898  const auto diffPhi = reco::deltaPhi(trackPc.phi(), track.phi());
899  fillNoFlow(h_diffPt, diffPt);
900  fillNoFlow(h_diffEta, trackPc.eta() - track.eta());
901  fillNoFlow(h_diffPhi, diffPhi);
902 
903  const auto diffDxyAssocPV =
904  h_diffDxyAssocPV.fill(pcRef->dxy(), track.dxy(pcVertex.position()), [](double value) { return value * 100.; });
905  const auto diffDzAssocPV = h_diffDzAssocPV.fill(
906  pcRef->dzAssociatedPV(), track.dz(pcVertex.position()), [](double value) { return value * 100.; });
907  const auto diffDxyPV = diffRelative(pcRef->dxy(pv.position()), track.dxy(pv.position()));
908  const auto diffDzPV = diffRelative(pcRef->dz(pv.position()), track.dz(pv.position()));
909  fillNoFlow(h_diffDxyPV, diffDxyPV);
910  fillNoFlow(h_diffDzPV, diffDzPV);
911  fillNoFlow(h_diffTrackDxyAssocPV, diffRelative(trackPc.dxy(pcVertex.position()), track.dxy(pcVertex.position())));
912  fillNoFlow(h_diffTrackDzAssocPV, diffRelative(trackPc.dz(pcVertex.position()), track.dz(pcVertex.position())));
913 
914  auto fillCov1 = [&](auto& hlp, const int i, const int j) {
915  return hlp.fill(trackPc.covariance(i, j), track.covariance(i, j));
916  };
917  auto fillCov2 = [&](auto& hlp, const int i, const int j, std::function<double(double)> modifyPack) {
918  return hlp.fill(trackPc.covariance(i, j), track.covariance(i, j), modifyPack);
919  };
920  auto fillCov3 = [&](auto& hlp,
921  const int i,
922  const int j,
923  std::function<double(double)> modifyPack,
924  std::function<double(double)> modifyUnpack) {
925  return hlp.fill(trackPc.covariance(i, j), track.covariance(i, j), modifyPack, modifyUnpack);
926  };
927 
928  const auto pcPt = pcRef->pt();
929  const auto diffCovQoverpQoverp = fillCov3(
933  [=](double val) { return val * pcPt * pcPt; },
934  [=](double val) { return val / pcPt / pcPt; });
935  const auto diffCovLambdaLambda =
937  const auto diffCovLambdaDsz = fillCov1(h_diffCovLambdaDsz, reco::TrackBase::i_lambda, reco::TrackBase::i_dsz);
938  const auto diffCovPhiPhi = fillCov3(
942  [=](double val) { return val * pcPt * pcPt; },
943  [=](double val) { return val / pcPt / pcPt; });
944  const auto diffCovPhiDxy = fillCov1(h_diffCovPhiDxy, reco::TrackBase::i_phi, reco::TrackBase::i_dxy);
945  const auto diffCovDxyDxy = fillCov2(
946  h_diffCovDxyDxy, reco::TrackBase::i_dxy, reco::TrackBase::i_dxy, [](double value) { return value * 10000.; });
947  const auto diffCovDxyDsz = fillCov2(
948  h_diffCovDxyDsz, reco::TrackBase::i_dxy, reco::TrackBase::i_dsz, [](double value) { return value * 10000.; });
949  const auto diffCovDszDsz = fillCov2(
950  h_diffCovDszDsz, reco::TrackBase::i_dsz, reco::TrackBase::i_dsz, [](double value) { return value * 10000.; });
951 
952  if (isInRange(diffCovDszDsz.status())) {
953  fillNoFlow(h_diffDszError, diffRelative(pcRef->dzError(), track.dszError()));
954  fillNoFlow(h_diffDzError, diffRelative(pcRef->dzError(), track.dzError()));
955  fillNoFlow(h_diffTrackDzError, diffRelative(trackPc.dzError(), track.dzError()));
956  }
957  if (isInRange(diffCovDxyDxy.status())) {
958  fillNoFlow(h_diffDxyError, diffRelative(pcRef->dxyError(), track.dxyError()));
959  fillNoFlow(h_diffTrackDxyError, diffRelative(trackPc.dxyError(), track.dxyError()));
960  }
961  fillNoFlow(h_diffPtError, diffRelative(trackPc.ptError(), track.ptError()));
962  fillNoFlow(h_diffEtaError, diffRelative(trackPc.etaError(), track.etaError()));
963 
964  // For the non-HitPattern ones, take into account the PackedCandidate packing precision
965  const auto trackNumberOfHits = track.hitPattern().numberOfValidHits();
966  const auto trackNumberOfPixelHits = track.hitPattern().numberOfValidPixelHits();
967  const auto trackNumberOfStripHits = track.hitPattern().numberOfValidStripHits();
968  const auto pcNumberOfHits = pcRef->numberOfHits();
969  const auto pcNumberOfPixelHits = pcRef->numberOfPixelHits();
970  const auto pcNumberOfStripHits = pcNumberOfHits - pcNumberOfPixelHits;
971  const auto trackNumberOfLayers = track.hitPattern().trackerLayersWithMeasurement();
972  const auto trackNumberOfPixelLayers = track.hitPattern().pixelLayersWithMeasurement();
973  const auto trackNumberOfStripLayers = track.hitPattern().stripLayersWithMeasurement();
974  const auto pcNumberOfLayers = pcRef->trackerLayersWithMeasurement();
975  const auto pcNumberOfPixelLayers = pcRef->pixelLayersWithMeasurement();
976  const auto pcNumberOfStripLayers = pcRef->stripLayersWithMeasurement();
977 
978  // layer number overflow (should be zero)
979  const int pixelLayerOverflow = trackNumberOfPixelLayers > pat::PackedCandidate::trackPixelHitsMask
980  ? trackNumberOfPixelLayers - pat::PackedCandidate::trackPixelHitsMask
981  : 0;
982  const int stripLayerOverflow = trackNumberOfStripLayers > pat::PackedCandidate::trackStripHitsMask
983  ? trackNumberOfStripLayers - pat::PackedCandidate::trackStripHitsMask
984  : 0;
985  const int layerOverflow =
987  ? trackNumberOfLayers -
989  : 0;
990 
991  // hit overflow (should also be zero)
992  const int pixelOverflow =
993  trackNumberOfPixelHits - pcNumberOfPixelLayers > pat::PackedCandidate::trackPixelHitsMask
994  ? trackNumberOfPixelHits - pcNumberOfPixelLayers - pat::PackedCandidate::trackPixelHitsMask
995  : 0;
996  const int stripOverflow =
997  trackNumberOfStripHits - pcNumberOfStripLayers > pat::PackedCandidate::trackStripHitsMask
998  ? trackNumberOfStripHits - pcNumberOfStripLayers - pat::PackedCandidate::trackStripHitsMask
999  : 0;
1000  const int hitsOverflow =
1001  trackNumberOfHits - pcNumberOfLayers >
1003  ? trackNumberOfHits - pcNumberOfLayers -
1005  : 0;
1006  // PackedCandidate counts overflow pixel hits as strip
1007  const int pixelInducedStripOverflow =
1008  (trackNumberOfStripHits + pixelOverflow - pcNumberOfStripLayers) > pat::PackedCandidate::trackStripHitsMask
1009  ? (trackNumberOfStripHits + pixelOverflow - stripOverflow - pcNumberOfStripLayers) -
1011  : 0;
1012  h_numberPixelLayersOverMax->Fill(pixelLayerOverflow);
1013  h_numberStripLayersOverMax->Fill(stripLayerOverflow);
1014  h_numberLayersOverMax->Fill(layerOverflow);
1015  h_numberPixelHitsOverMax->Fill(pixelOverflow);
1016  h_numberStripHitsOverMax->Fill(stripOverflow);
1017  h_numberHitsOverMax->Fill(hitsOverflow);
1018 
1019  int diffNumberOfPixelHits = 0;
1020  int diffNumberOfHits = 0;
1021  int diffNumberOfPixelLayers = 0;
1022  int diffNumberOfStripLayers = 0;
1023  if (pixelLayerOverflow) {
1024  diffNumberOfPixelLayers = pcNumberOfPixelLayers - pat::PackedCandidate::trackPixelHitsMask;
1025  } else {
1026  diffNumberOfPixelLayers = pcNumberOfPixelLayers - trackNumberOfPixelLayers;
1027  }
1028  if (pixelOverflow) {
1029  diffNumberOfPixelHits = pcNumberOfPixelHits - pcNumberOfPixelLayers - pat::PackedCandidate::trackPixelHitsMask;
1030  } else {
1031  diffNumberOfPixelHits = pcNumberOfPixelHits - trackNumberOfPixelHits;
1032  }
1033  if (stripLayerOverflow) {
1034  diffNumberOfStripLayers = pcNumberOfStripLayers - pat::PackedCandidate::trackStripHitsMask;
1035  } else {
1036  diffNumberOfStripLayers = pcNumberOfStripLayers - trackNumberOfStripLayers;
1037  }
1038  if (stripOverflow || pixelInducedStripOverflow || pixelOverflow) {
1039  int diffNumberOfStripHits = 0;
1040  if (stripOverflow || pixelInducedStripOverflow) {
1041  diffNumberOfStripHits = pcNumberOfStripHits - pat::PackedCandidate::trackStripHitsMask;
1042  } else if (pixelOverflow) {
1043  diffNumberOfStripHits = (pcNumberOfStripHits - pixelOverflow) - trackNumberOfStripHits;
1044  }
1045 
1046  diffNumberOfHits = diffNumberOfPixelHits + diffNumberOfStripHits;
1047  } else {
1048  diffNumberOfHits = pcNumberOfHits - trackNumberOfHits;
1049  }
1050 
1051  fillNoFlow(h_diffNumberOfPixelHits, diffNumberOfPixelHits);
1052  fillNoFlow(h_diffNumberOfHits, diffNumberOfHits);
1053  fillNoFlow(h_diffNumberOfPixelLayers, diffNumberOfPixelLayers);
1054  fillNoFlow(h_diffNumberOfStripLayers, diffNumberOfStripLayers);
1055 
1056  int diffLostInnerHits = 0;
1057  const auto trackLostInnerHits = track.hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS);
1058  switch (pcRef->lostInnerHits()) {
1061  diffLostInnerHits = -trackLostInnerHits;
1062  break;
1064  diffLostInnerHits = 1 - trackLostInnerHits;
1065  break;
1067  diffLostInnerHits = trackLostInnerHits >= 2 ? 0 : 2 - trackLostInnerHits;
1068  break;
1069  }
1070  fillNoFlow(h_diffLostInnerHits, diffLostInnerHits);
1071 
1072  // For HitPattern ones, calculate the full diff (i.e. some differences are expected)
1073  auto diffHitPatternPixelLayersWithMeasurement =
1074  trackPc.hitPattern().pixelLayersWithMeasurement() - trackNumberOfPixelLayers;
1075  fillNoFlow(h_diffHitPatternPixelLayersWithMeasurement, diffHitPatternPixelLayersWithMeasurement);
1076  auto diffHitPatternStripLayersWithMeasurement =
1077  trackPc.hitPattern().stripLayersWithMeasurement() - trackNumberOfStripLayers;
1078  fillNoFlow(h_diffHitPatternStripLayersWithMeasurement, diffHitPatternStripLayersWithMeasurement);
1079  auto diffHitPatternTrackerLayersWithMeasurement =
1080  trackPc.hitPattern().trackerLayersWithMeasurement() - trackNumberOfLayers;
1081  fillNoFlow(h_diffHitPatternTrackerLayersWithMeasurement, diffHitPatternTrackerLayersWithMeasurement);
1082  auto diffHitPatternNumberOfValidPixelHits = trackPc.hitPattern().numberOfValidPixelHits() - trackNumberOfPixelHits;
1083  fillNoFlow(h_diffHitPatternNumberOfValidPixelHits, diffHitPatternNumberOfValidPixelHits);
1084  auto diffHitPatternNumberOfValidHits = trackPc.hitPattern().numberOfValidHits() - trackNumberOfHits;
1085  fillNoFlow(h_diffHitPatternNumberOfValidHits, diffHitPatternNumberOfValidHits);
1088  track.hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS));
1089 
1090  // hasValidHitInFirstPixelBarrel is set only if numberOfLostHits(MISSING_INNER_HITS) == 0
1091  int diffHitPatternHasValidHitInFirstPixelBarrel = 0;
1092  if (track.hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) == 0) {
1094  diffHitPatternHasValidHitInFirstPixelBarrel =
1095  static_cast<int>(
1097  static_cast<int>(track.hitPattern().hasValidHitInPixelLayer(PixelSubdetector::SubDetector::PixelBarrel, 1));
1098  fillNoFlow(h_diffHitPatternHasValidHitInFirstPixelBarrel, diffHitPatternHasValidHitInFirstPixelBarrel);
1099  }
1100 
1101  // Print warning if there are differences outside the expected range
1102  if (debug_ &&
1103  (diffNormalizedChi2 < -1 || diffNormalizedChi2 > 0 || diffCharge != 0 || diffHP != 0 ||
1104  std::abs(diffPhi) > 5e-4 || diffDxyAssocPV.outsideExpectedRange() || diffDzAssocPV.outsideExpectedRange() ||
1105  std::abs(diffDxyPV) > 0.05 || std::abs(diffDzPV) > 0.05 || diffCovQoverpQoverp.outsideExpectedRange() ||
1106  diffCovLambdaLambda.outsideExpectedRange() || diffCovLambdaDsz.outsideExpectedRange() ||
1107  diffCovPhiPhi.outsideExpectedRange() || diffCovPhiDxy.outsideExpectedRange() ||
1108  diffCovDxyDxy.outsideExpectedRange() || diffCovDxyDsz.outsideExpectedRange() ||
1109  diffCovDszDsz.outsideExpectedRange() || diffNumberOfPixelHits != 0 || diffNumberOfHits != 0 ||
1110  diffLostInnerHits != 0 || diffHitPatternHasValidHitInFirstPixelBarrel != 0)) {
1111  edm::LogInfo("PackedCandidateTrackValidator")
1112  << "Track " << i << " pt " << track.pt() << " eta " << track.eta() << " phi " << track.phi() << " chi2 "
1113  << track.chi2() << " ndof " << track.ndof() << "\n"
1114  << " ptError " << track.ptError() << " etaError " << track.etaError() << " phiError " << track.phiError()
1115  << " dxyError " << track.dxyError() << " dzError " << track.dzError() << "\n"
1116  << " refpoint " << track.referencePoint() << " momentum " << track.momentum() << "\n"
1117  << " dxy " << track.dxy() << " dz " << track.dz() << "\n"
1118  << " " << TrackAlgoPrinter(track) << " lost inner hits " << trackLostInnerHits << " lost outer hits "
1119  << track.hitPattern().numberOfLostHits(reco::HitPattern::MISSING_OUTER_HITS) << " hitpattern "
1120  << HitPatternPrinter(track) << " \n"
1121  << " PC " << pcRef.id() << ":" << pcRef.key() << " track pt " << trackPc.pt() << " eta " << trackPc.eta()
1122  << " phi " << trackPc.phi() << " (PC " << pcRef->phi() << ") chi2 " << trackPc.chi2() << " ndof "
1123  << trackPc.ndof() << " pdgId " << pcRef->pdgId() << " mass " << pcRef->mass() << "\n"
1124  << " ptError " << trackPc.ptError() << " etaError " << trackPc.etaError() << " phiError "
1125  << trackPc.phiError() << "\n"
1126  << " pc.vertex " << pcRef->vertex() << " momentum " << pcRef->momentum() << " track " << trackPc.momentum()
1127  << "\n"
1128  << " dxy " << trackPc.dxy() << " dz " << trackPc.dz() << " pc.dz " << pcRef->dz() << " dxyError "
1129  << trackPc.dxyError() << " dzError " << trackPc.dzError() << "\n"
1130  << " dxy(PV) " << trackPc.dxy(pv.position()) << " dz(PV) " << trackPc.dz(pv.position()) << " dxy(assocPV) "
1131  << trackPc.dxy(pcVertex.position()) << " dz(assocPV) " << trackPc.dz(pcVertex.position()) << "\n"
1132  << " (diff PackedCandidate track)"
1133  << " highPurity " << diffHP << " " << trackPc.quality(reco::TrackBase::highPurity) << " "
1134  << track.quality(reco::TrackBase::highPurity) << " charge " << diffCharge << " " << trackPc.charge() << " "
1135  << track.charge() << " normalizedChi2 " << diffNormalizedChi2 << " " << trackPc.normalizedChi2() << " "
1136  << track.normalizedChi2() << "\n "
1137  << " numberOfAllHits " << diffNumberOfHits << " " << pcNumberOfHits << " " << trackNumberOfHits
1138  << " numberOfPixelHits " << diffNumberOfPixelHits << " " << pcNumberOfPixelHits << " "
1139  << trackNumberOfPixelHits << " numberOfStripHits # " << pcNumberOfStripHits << " " << trackNumberOfStripHits
1140  << "\n "
1141  << " hitPattern.numberOfValidPixelHits " << diffHitPatternNumberOfValidPixelHits << " "
1142  << trackPc.hitPattern().numberOfValidPixelHits() << " " << track.hitPattern().numberOfValidPixelHits()
1143  << " hitPattern.numberOfValidHits " << diffHitPatternNumberOfValidHits << " "
1144  << trackPc.hitPattern().numberOfValidHits() << " " << track.hitPattern().numberOfValidHits()
1145  << " hitPattern.hasValidHitInFirstPixelBarrel " << diffHitPatternHasValidHitInFirstPixelBarrel << " "
1147  << track.hitPattern().hasValidHitInPixelLayer(PixelSubdetector::SubDetector::PixelBarrel, 1) << "\n "
1148  << " lostInnerHits " << diffLostInnerHits << " " << pcRef->lostInnerHits() << " #"
1149  << " phi (5e-4) " << diffPhi << " " << trackPc.phi() << " " << track.phi() << "\n "
1150  << " dxy(assocPV) " << diffDxyAssocPV << "\n "
1151  << " dz(assocPV) " << diffDzAssocPV << "\n "
1152  << " dxy(PV) (0.05) " << diffDxyPV << " " << pcRef->dxy(pv.position()) << " " << track.dxy(pv.position())
1153  << "\n "
1154  << " dz(PV) (0.05) " << diffDzPV << " " << pcRef->dz(pv.position()) << " " << track.dz(pv.position()) << "\n "
1155  << " cov(qoverp, qoverp) " << diffCovQoverpQoverp << "\n "
1156  << " cov(lambda, lambda) " << diffCovLambdaLambda << "\n "
1157  << " cov(lambda, dsz) " << diffCovLambdaDsz << "\n "
1158  << " cov(phi, phi) " << diffCovPhiPhi << "\n "
1159  << " cov(phi, dxy) " << diffCovPhiDxy << "\n "
1160  << " cov(dxy, dxy) " << diffCovDxyDxy << "\n "
1161  << " cov(dxy, dsz) " << diffCovDxyDsz << "\n "
1162  << " cov(dsz, dsz) " << diffCovDszDsz;
1163  }
1164  }
1165 }
1166 
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:552
int numberOfValidPixelHits() const
Definition: HitPattern.h:831
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
int numberOfLostHits(HitCategory category) const
Definition: HitPattern.h:891
int numberOfValidHits() const
Definition: HitPattern.h:817
PackedValueCheck< LogIntHelper > h_diffCovLambdaDsz
PackedValueCheck< Float16Helper > h_diffDzAssocPV
PackedValueCheck< Float16Helper > h_diffDxyAssocPV
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
dqm::impl::MonitorElement MonitorElement
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:754
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:655
edm::EDGetTokenT< edm::View< reco::Track > > tracksToken_
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
PixelRecoRange< float > Range
const Point & position() const
position
Definition: Vertex.h:127
double unpack8log(int8_t i, double lmin, double lmax, uint8_t base=128)
PackedCandidateTrackValidator(const edm::ParameterSet &pset)
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:534
std::vector< pat::PackedCandidate > PackedCandidateCollection
int stripLayersWithMeasurement() const
Definition: HitPattern.h:1005
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > trackToPackedCandidateToken_
constexpr int8_t smallestNegative
Definition: liblogintpack.h:11
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
std::vector< Vertex > VertexCollection
Definition: Vertex.h:31
key_type key() const
Accessor for product key.
Definition: Ref.h:250
Definition: Electron.h:6
TrackAlgorithm
track algorithm
Definition: TrackBase.h:89
static float denorm_min()
Definition: libminifloat.h:119
Definition: HeavyIon.h:7
PackedValueCheck< LogIntHelper > h_diffCovLambdaLambda
void Fill(long long x)
double pt() const
track transverse momentum
Definition: TrackBase.h:637
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:590
int charge() const
track electric charge
Definition: TrackBase.h:596
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:622
int iEvent
Definition: GenABIO.cc:224
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:716
PackedValueCheck< LogIntHelper > h_diffCovPhiDxy
double dxyError() const
error on dxy
Definition: TrackBase.h:769
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:661
PackedValueCheck< Float16Helper > h_diffCovDxyDxy
double dzError() const
error on dz
Definition: TrackBase.h:778
PackedValueCheck< LogIntHelper > h_diffCovPhiPhi
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqm::legacy::DQMStore DQMStore
Definition: DQMStore.h:822
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: value.py:1
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
bool isNull() const
Checks for null.
Definition: Ref.h:235
static float min()
Definition: libminifloat.h:106
std::string algoName() const
Definition: TrackBase.h:550
Log< level::Info, false > LogInfo
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:504
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
constexpr int8_t smallestPositive
Definition: liblogintpack.h:8
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:587
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:593
double b
Definition: hdecay.h:118
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
fixed size matrix
HLT enums.
double a
Definition: hdecay.h:119
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:658
void analyze(const edm::Event &, const edm::EventSetup &) override
static float max32RoundedToMax16()
Definition: libminifloat.h:99
PackedValueCheck< LogIntHelper > h_diffCovQoverpQoverp
PackedValueCheck< Float16Helper > h_diffCovDxyDsz
PackedValueCheck< Float16Helper > h_diffCovDszDsz
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:513
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
double phiError() const
error on phi
Definition: TrackBase.h:766
tmp
align.sh
Definition: createJobs.py:716
long double T
double etaError() const
error on eta
Definition: TrackBase.h:763
bool hasValidHitInPixelLayer(enum PixelSubdetector::SubDetector, uint16_t layer) const
Definition: HitPattern.cc:358
Definition: Run.h:45
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:608