822 const auto&
tracks = *htracks;
834 const auto& trackToPackedCandidate = *hassoc;
836 for (
size_t i = 0;
i <
tracks.size(); ++
i) {
837 auto trackPtr =
tracks.ptrAt(
i);
848 if (pcRef->charge() == 0) {
853 const reco::Track* trackPcPtr = pcRef->bestTrack();
860 if (
std::abs(pcRef->pdgId()) == 11) {
872 auto slimmedVertexRef = pcRef->vertexRef();
884 double diffNormalizedChi2 = 0;
885 if (trackPc.
ndof() != 0) {
898 const auto diffPt = diffRelative(trackPc.
pt(), track.
pt());
904 const auto diffDxyAssocPV =
907 pcRef->dzAssociatedPV(), track.
dz(pcVertex.
position()), [](
double value) {
return value * 100.; });
909 const auto diffDzPV = diffRelative(pcRef->dz(pv.
position()), track.
dz(pv.
position()));
915 auto fillCov1 = [&](
auto& hlp,
const int i,
const int j) {
918 auto fillCov2 = [&](
auto& hlp,
const int i,
const int j, std::function<double(double)> modifyPack) {
921 auto fillCov3 = [&](
auto& hlp,
924 std::function<double(double)> modifyPack,
925 std::function<double(double)> modifyUnpack) {
929 const auto pcPt = pcRef->pt();
933 [=](
double val) {
return val * pcPt * pcPt; },
934 [=](
double val) {
return val / pcPt / pcPt; });
935 const auto diffCovLambdaLambda =
941 [=](
double val) {
return val * pcPt * pcPt; },
942 [=](
double val) {
return val / pcPt / pcPt; });
944 const auto diffCovDxyDxy = fillCov2(
946 const auto diffCovDxyDsz = fillCov2(
948 const auto diffCovDszDsz = fillCov2(
951 if (isInRange(diffCovDszDsz.status())) {
956 if (isInRange(diffCovDxyDxy.status())) {
967 const auto pcNumberOfHits = pcRef->numberOfHits();
968 const auto pcNumberOfPixelHits = pcRef->numberOfPixelHits();
969 const auto pcNumberOfStripHits = pcNumberOfHits - pcNumberOfPixelHits;
973 const auto pcNumberOfLayers = pcRef->trackerLayersWithMeasurement();
974 const auto pcNumberOfPixelLayers = pcRef->pixelLayersWithMeasurement();
975 const auto pcNumberOfStripLayers = pcRef->stripLayersWithMeasurement();
984 const int layerOverflow =
986 ? trackNumberOfLayers -
991 const int pixelOverflow =
995 const int stripOverflow =
999 const int hitsOverflow =
1000 trackNumberOfHits - pcNumberOfLayers >
1002 ? trackNumberOfHits - pcNumberOfLayers -
1006 const int pixelInducedStripOverflow =
1008 ? (trackNumberOfStripHits + pixelOverflow - stripOverflow - pcNumberOfStripLayers) -
1018 int diffNumberOfPixelHits = 0;
1019 int diffNumberOfHits = 0;
1020 int diffNumberOfPixelLayers = 0;
1021 int diffNumberOfStripLayers = 0;
1022 if (pixelLayerOverflow) {
1025 diffNumberOfPixelLayers = pcNumberOfPixelLayers - trackNumberOfPixelLayers;
1027 if (pixelOverflow) {
1030 diffNumberOfPixelHits = pcNumberOfPixelHits - trackNumberOfPixelHits;
1032 if (stripLayerOverflow) {
1035 diffNumberOfStripLayers = pcNumberOfStripLayers - trackNumberOfStripLayers;
1037 if (stripOverflow || pixelInducedStripOverflow || pixelOverflow) {
1038 int diffNumberOfStripHits = 0;
1039 if (stripOverflow || pixelInducedStripOverflow) {
1041 }
else if (pixelOverflow) {
1042 diffNumberOfStripHits = (pcNumberOfStripHits - pixelOverflow) - trackNumberOfStripHits;
1045 diffNumberOfHits = diffNumberOfPixelHits + diffNumberOfStripHits;
1047 diffNumberOfHits = pcNumberOfHits - trackNumberOfHits;
1055 int diffLostInnerHits = 0;
1057 switch (pcRef->lostInnerHits()) {
1060 diffLostInnerHits = -trackLostInnerHits;
1063 diffLostInnerHits = 1 - trackLostInnerHits;
1066 diffLostInnerHits = trackLostInnerHits >= 2 ? 0 : 2 - trackLostInnerHits;
1072 auto diffHitPatternPixelLayersWithMeasurement =
1075 auto diffHitPatternStripLayersWithMeasurement =
1078 auto diffHitPatternTrackerLayersWithMeasurement =
1090 int diffHitPatternHasValidHitInFirstPixelBarrel = 0;
1093 diffHitPatternHasValidHitInFirstPixelBarrel =
1102 (diffNormalizedChi2 < -1 || diffNormalizedChi2 > 0 || diffCharge != 0 || diffHP != 0 ||
1103 std::abs(diffPhi) > 5
e-4 || diffDxyAssocPV.outsideExpectedRange() || diffDzAssocPV.outsideExpectedRange() ||
1104 std::abs(diffDxyPV) > 0.05 ||
std::abs(diffDzPV) > 0.05 || diffCovQoverpQoverp.outsideExpectedRange() ||
1105 diffCovLambdaLambda.outsideExpectedRange() || diffCovLambdaDsz.outsideExpectedRange() ||
1106 diffCovPhiPhi.outsideExpectedRange() || diffCovPhiDxy.outsideExpectedRange() ||
1107 diffCovDxyDxy.outsideExpectedRange() || diffCovDxyDsz.outsideExpectedRange() ||
1108 diffCovDszDsz.outsideExpectedRange() || diffNumberOfPixelHits != 0 || diffNumberOfHits != 0 ||
1109 diffLostInnerHits != 0 || diffHitPatternHasValidHitInFirstPixelBarrel != 0)) {
1111 <<
"Track " << i <<
" pt " << track.
pt() <<
" eta " << track.
eta() <<
" phi " << track.
phi() <<
" chi2 " 1112 << track.
chi2() <<
" ndof " << track.
ndof() <<
"\n" 1114 <<
" dxyError " << track.
dxyError() <<
" dzError " << track.
dzError() <<
"\n" 1116 <<
" dxy " << track.
dxy() <<
" dz " << track.
dz() <<
"\n" 1117 <<
" " << TrackAlgoPrinter(track) <<
" lost inner hits " << trackLostInnerHits <<
" lost outer hits " 1119 << HitPatternPrinter(track) <<
" \n" 1120 <<
" PC " << pcRef.
id() <<
":" << pcRef.
key() <<
" track pt " << trackPc.
pt() <<
" eta " << trackPc.
eta()
1121 <<
" phi " << trackPc.
phi() <<
" (PC " << pcRef->phi() <<
") chi2 " << trackPc.
chi2() <<
" ndof " 1122 << trackPc.
ndof() <<
" pdgId " << pcRef->pdgId() <<
" mass " << pcRef->mass() <<
"\n" 1123 <<
" ptError " << trackPc.
ptError() <<
" etaError " << trackPc.
etaError() <<
" phiError " 1125 <<
" pc.vertex " << pcRef->vertex() <<
" momentum " << pcRef->momentum() <<
" track " << trackPc.
momentum()
1127 <<
" dxy " << trackPc.
dxy() <<
" dz " << trackPc.
dz() <<
" pc.dz " << pcRef->dz() <<
" dxyError " 1129 <<
" dxy(PV) " << trackPc.
dxy(pv.
position()) <<
" dz(PV) " << trackPc.
dz(pv.
position()) <<
" dxy(assocPV) " 1131 <<
" (diff PackedCandidate track)" 1134 << track.
charge() <<
" normalizedChi2 " << diffNormalizedChi2 <<
" " << trackPc.
normalizedChi2() <<
" " 1136 <<
" numberOfAllHits " << diffNumberOfHits <<
" " << pcNumberOfHits <<
" " << trackNumberOfHits
1137 <<
" numberOfPixelHits " << diffNumberOfPixelHits <<
" " << pcNumberOfPixelHits <<
" " 1138 << trackNumberOfPixelHits <<
" numberOfStripHits # " << pcNumberOfStripHits <<
" " << trackNumberOfStripHits
1140 <<
" hitPattern.numberOfValidPixelHits " << diffHitPatternNumberOfValidPixelHits <<
" " 1142 <<
" hitPattern.numberOfValidHits " << diffHitPatternNumberOfValidHits <<
" " 1144 <<
" hitPattern.hasValidHitInFirstPixelBarrel " << diffHitPatternHasValidHitInFirstPixelBarrel <<
" " 1147 <<
" lostInnerHits " << diffLostInnerHits <<
" " << pcRef->lostInnerHits() <<
" #" 1148 <<
" phi (5e-4) " << diffPhi <<
" " << trackPc.
phi() <<
" " << track.
phi() <<
"\n " 1149 <<
" dxy(assocPV) " << diffDxyAssocPV <<
"\n " 1150 <<
" dz(assocPV) " << diffDzAssocPV <<
"\n " 1151 <<
" dxy(PV) (0.05) " << diffDxyPV <<
" " << pcRef->dxy(pv.
position()) <<
" " << track.
dxy(pv.
position())
1153 <<
" dz(PV) (0.05) " << diffDzPV <<
" " << pcRef->dz(pv.
position()) <<
" " << track.
dz(pv.
position()) <<
"\n " 1154 <<
" cov(qoverp, qoverp) " << diffCovQoverpQoverp <<
"\n " 1155 <<
" cov(lambda, lambda) " << diffCovLambdaLambda <<
"\n " 1156 <<
" cov(lambda, dsz) " << diffCovLambdaDsz <<
"\n " 1157 <<
" cov(phi, phi) " << diffCovPhiPhi <<
"\n " 1158 <<
" cov(phi, dxy) " << diffCovPhiDxy <<
"\n " 1159 <<
" cov(dxy, dxy) " << diffCovDxyDxy <<
"\n " 1160 <<
" cov(dxy, dsz) " << diffCovDxyDsz <<
"\n " 1161 <<
" cov(dsz, dsz) " << diffCovDszDsz;
constexpr double deltaPhi(double phi1, double phi2)
const Point & referencePoint() const
Reference point on the track.
PackedValueCheck< LogIntHelper > h_diffCovLambdaDsz
PackedValueCheck< Float16Helper > h_diffDzAssocPV
PackedValueCheck< Float16Helper > h_diffDxyAssocPV
bool hasValidHitInPixelLayer(enum PixelSubdetector::SubDetector, uint16_t layer) const
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
edm::EDGetTokenT< edm::View< reco::Track > > tracksToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * h_diffNormalizedChi2
double dxyError() const
error on dxy
MonitorElement * h_diffVy
int numberOfValidHits() const
MonitorElement * h_selectionFlow
MonitorElement * h_diffVz
MonitorElement * h_diffCharge
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > trackToPackedCandidateToken_
double etaError() const
error on eta
int numberOfValidStripHits() const
double phi() const
azimuthal angle of momentum vector
MonitorElement * h_numberHitsOverMax
MonitorElement * h_numberPixelHitsOverMax
key_type key() const
Accessor for product key.
MonitorElement * h_diffNumberOfPixelHits
int pixelLayersWithMeasurement() const
const Vector & momentum() const
track momentum vector
int trackerLayersWithMeasurement() const
const Point & position() const
position
MonitorElement * h_diffTrackDxyAssocPV
ProductID id() const
Accessor for product ID.
MonitorElement * h_diffDzError
PackedValueCheck< LogIntHelper > h_diffCovLambdaLambda
MonitorElement * h_numberStripHitsOverMax
MonitorElement * h_diffLostInnerHits
MonitorElement * h_numberLayersOverMax
double dszError() const
error on dsz
double eta() const
pseudorapidity of momentum vector
MonitorElement * h_diffPhi
PackedValueCheck< LogIntHelper > h_diffCovPhiDxy
double chi2() const
chi-squared of the fit
PackedValueCheck< Float16Helper > h_diffCovDxyDxy
MonitorElement * h_diffTrackDzError
PackedValueCheck< LogIntHelper > h_diffCovPhiPhi
double ndof() const
number of degrees of freedom of the fit
MonitorElement * h_diffDzPV
CovarianceMatrix covariance() const
return track covariance matrix
double pt() const
track transverse momentum
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
double phiError() const
error on phi
MonitorElement * h_diffHitPatternHasValidHitInFirstPixelBarrel
Abs< T >::type abs(const T &t)
MonitorElement * h_diffHitPatternTrackerLayersWithMeasurement
MonitorElement * h_diffIsHighPurity
bool isNull() const
Checks for null.
MonitorElement * h_diffDszError
MonitorElement * h_diffHitPatternPixelLayersWithMeasurement
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...
double dzError() const
error on dz
double vz() const
z coordinate of the reference point on track
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
MonitorElement * h_diffDxyPV
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
int stripLayersWithMeasurement() const
MonitorElement * h_diffTrackDzAssocPV
MonitorElement * h_diffHitPatternNumberOfLostInnerHits
MonitorElement * h_diffHitPatternNumberOfValidPixelHits
bool quality(const TrackQuality) const
Track quality.
MonitorElement * h_diffNdof
int numberOfLostHits(HitCategory category) const
MonitorElement * h_diffVx
double vy() const
y coordinate of the reference point on track
MonitorElement * h_diffHitPatternNumberOfValidHits
PackedValueCheck< LogIntHelper > h_diffCovQoverpQoverp
PackedValueCheck< Float16Helper > h_diffCovDxyDsz
MonitorElement * h_numberStripLayersOverMax
MonitorElement * h_diffDxyError
MonitorElement * h_diffPt
int numberOfValidPixelHits() const
PackedValueCheck< Float16Helper > h_diffCovDszDsz
int charge() const
track electric charge
MonitorElement * h_numberPixelLayersOverMax
MonitorElement * h_diffNumberOfStripLayers
MonitorElement * h_diffPtError
MonitorElement * h_diffEta
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
MonitorElement * h_diffTrackDxyError
MonitorElement * h_diffNumberOfHits
MonitorElement * h_diffEtaError
MonitorElement * h_diffNumberOfPixelLayers
double vx() const
x coordinate of the reference point on track
MonitorElement * h_diffHitPatternStripLayersWithMeasurement