Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add track algo and originalAlgo to PackedCandidates [13_0_X] #41227

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions DataFormats/PatCandidates/interface/PackedCandidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ namespace pat {
normalizedChi2_(iOther.normalizedChi2_),
covarianceVersion_(iOther.covarianceVersion_),
covarianceSchema_(iOther.covarianceSchema_),
firstHit_(iOther.firstHit_) {}
firstHit_(iOther.firstHit_),
trkAlgoPacked_(iOther.trkAlgoPacked_) {}

PackedCandidate(PackedCandidate &&iOther)
: packedPt_(iOther.packedPt_),
Expand Down Expand Up @@ -262,7 +263,8 @@ namespace pat {
normalizedChi2_(iOther.normalizedChi2_),
covarianceVersion_(iOther.covarianceVersion_),
covarianceSchema_(iOther.covarianceSchema_),
firstHit_(iOther.firstHit_) {}
firstHit_(iOther.firstHit_),
trkAlgoPacked_(iOther.trkAlgoPacked_) {}

PackedCandidate &operator=(const PackedCandidate &iOther) {
if (this == &iOther) {
Expand Down Expand Up @@ -339,6 +341,7 @@ namespace pat {
covarianceVersion_ = iOther.covarianceVersion_;
covarianceSchema_ = iOther.covarianceSchema_;
firstHit_ = iOther.firstHit_;
trkAlgoPacked_ = iOther.trkAlgoPacked_;
return *this;
}

Expand Down Expand Up @@ -385,6 +388,7 @@ namespace pat {
covarianceVersion_ = iOther.covarianceVersion_;
covarianceSchema_ = iOther.covarianceSchema_;
firstHit_ = iOther.firstHit_;
trkAlgoPacked_ = iOther.trkAlgoPacked_;
return *this;
}

Expand Down Expand Up @@ -837,6 +841,15 @@ namespace pat {
/// Return first hit from HitPattern for tracks with high level details
uint16_t firstHit() const { return firstHit_; }

/// Set/get track algo
void setTrkAlgo(uint8_t algo, uint8_t original) {
trkAlgoPacked_ = algo | ((algo == original ? 0 : original) << 8);
}
uint8_t trkAlgo() const { return trkAlgoPacked_ & 0xff; }
uint8_t trkOriginalAlgo() const {
return (trkAlgoPacked_ & 0xff00) == 0 ? trkAlgo() : ((trkAlgoPacked_ >> 8) & 0xff);
}

void setMuonID(bool isStandAlone, bool isGlobal) {
int16_t muonFlags = isStandAlone | (2 * isGlobal);
qualityFlags_ = (qualityFlags_ & ~muonFlagsMask) | ((muonFlags << muonFlagsShift) & muonFlagsMask);
Expand Down Expand Up @@ -1111,6 +1124,9 @@ namespace pat {
/// details (hit pattern) of the first hit on track
uint16_t firstHit_;

/// track algorithm details
uint16_t trkAlgoPacked_ = 0;

/// check overlap with another Candidate
bool overlap(const reco::Candidate &) const override;
template <typename, typename, typename>
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/PatCandidates/src/classes_def_objects.xml
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@
<class name="pat::PackedCandidate::PackedCovariance" ClassVersion="3">
<version ClassVersion="3" checksum="3320406063"/>
</class>
<class name="pat::PackedCandidate" ClassVersion="34">
<class name="pat::PackedCandidate" ClassVersion="35">
<version ClassVersion="35" checksum="2065846728"/>
<version ClassVersion="34" checksum="3953181632"/>
<version ClassVersion="33" checksum="1092680546"/>
<version ClassVersion="32" checksum="926869123"/>
Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/PatAlgos/plugins/PATLostTracks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ void pat::PATLostTracks::addPackedCandidate(std::vector<pat::PackedCandidate>& c
cands.back().setCovarianceVersion(covarianceVersion_);
cands.back().setLostInnerHits(lostHits);
if (trk->pt() > minPtToStoreProps_ || trkStatus == TrkStatus::VTX) {
cands.back().setTrkAlgo(static_cast<uint8_t>(trk->algo()), static_cast<uint8_t>(trk->originalAlgo()));
if (useLegacySetup_ || std::abs(id) == 11 || trkStatus == TrkStatus::VTX) {
cands.back().setTrackProperties(*trk, covariancePackingSchemas_[4], covarianceVersion_);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ void pat::PATPackedCandidateProducer::produce(edm::StreamID, edm::Event &iEvent,
if (outPtrP->back().pt() > minPtForTrackProperties_ || outPtrP->back().ptTrk() > minPtForTrackProperties_ ||
whiteList.find(ic) != whiteList.end() ||
(cand.trackRef().isNonnull() && whiteListTk.find(cand.trackRef()) != whiteListTk.end())) {
outPtrP->back().setTrkAlgo(static_cast<uint8_t>(ctrack->algo()), static_cast<uint8_t>(ctrack->originalAlgo()));
outPtrP->back().setFirstHit(ctrack->hitPattern().getHitPattern(reco::HitPattern::TRACK_HITS, 0));
if (abs(outPtrP->back().pdgId()) == 22) {
outPtrP->back().setTrackProperties(*ctrack, covariancePackingSchemas_[4], covarianceVersion_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ void DeepBoostedJetTagInfoProducer::fillParticleFeatures(DeepBoostedJetFeatures
} else
lostHits = (nlost == 1 ? pat::PackedCandidate::oneLostInnerHit : pat::PackedCandidate::moreLostInnerHits);
candidate.setLostInnerHits(lostHits);
candidate.setTrkAlgo(static_cast<uint8_t>(track->algo()), static_cast<uint8_t>(track->originalAlgo()));

if (useTrackProperties(reco_cand) or
std::find(whiteListSV.begin(), whiteListSV.end(), icand) != whiteListSV.end() or
Expand Down