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

Fix MTV validation of initialStepPreSplitting tracks and add B-hadron MTV variation to pixel track validation sequence #199

1 change: 1 addition & 0 deletions DataFormats/Provenance/src/classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "DataFormats/Provenance/interface/ESRecordAuxiliary.h"
#include "DataFormats/Provenance/interface/ViewTypeChecker.h"
#include "FWCore/Utilities/interface/typedefs.h"
#include "FWCore/Utilities/interface/VecArray.h"
#include <map>
#include <set>
#include <vector>
Expand Down
1 change: 1 addition & 0 deletions DataFormats/Provenance/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<class name="std::pair<edm::BranchID, std::set<edm::BranchID> >"/>
<class name="std::vector<edm::BranchID>"/>
<class name="std::vector<edm::ProductID>"/>
<class name="edm::VecArray<edm::ProductID, 2>"/>
<class name="std::pair<edm::ProductID, unsigned int>" />
<class name="std::vector<std::pair<edm::ProductID, unsigned int> >" />
<class name="std::vector<edm::EventID>"/>
Expand Down
1 change: 1 addition & 0 deletions SimTracker/TrackerHitAssociation/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Utilities"/>
<use name="DataFormats/Common"/>
<use name="SimDataFormats/CrossingFrame"/>
<use name="SimDataFormats/TrackingHit"/>
Expand Down
10 changes: 10 additions & 0 deletions SimTracker/TrackerHitAssociation/interface/ClusterTPAssociation.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "DataFormats/Provenance/interface/ProductID.h"
#include "DataFormats/Common/interface/HandleBase.h"
#include "DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h"
#include "FWCore/Utilities/interface/VecArray.h"
#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"

Expand Down Expand Up @@ -32,6 +33,10 @@ class ClusterTPAssociation {

void emplace_back(const OmniClusterRef& cluster, const TrackingParticleRef& tp) {
checkMappedProductID(tp);
auto foundKeyID = std::find(std::begin(keyProductIDs_), std::end(keyProductIDs_), cluster.id());
if(foundKeyID == std::end(keyProductIDs_)) {
keyProductIDs_.emplace_back(cluster.id());
}
map_.emplace_back(cluster, tp);
}
void sortAndUnique() {
Expand All @@ -54,11 +59,15 @@ class ClusterTPAssociation {
const_iterator cend() const { return map_.end(); }

range equal_range(const OmniClusterRef& key) const {
checkKeyProductID(key);
return std::equal_range(map_.begin(), map_.end(), value_type(key, TrackingParticleRef()), compare);
}

const map_type& map() const { return map_; }

void checkKeyProductID(const OmniClusterRef& key) const { checkKeyProductID(key.id()); }
void checkKeyProductID(const edm::ProductID& id) const;

void checkMappedProductID(const edm::HandleBase& mappedHandle) const { checkMappedProductID(mappedHandle.id()); }
void checkMappedProductID(const TrackingParticleRef& tp) const { checkMappedProductID(tp.id()); }
void checkMappedProductID(const edm::ProductID& id) const;
Expand All @@ -75,6 +84,7 @@ class ClusterTPAssociation {
}

map_type map_;
edm::VecArray<edm::ProductID, 2> keyProductIDs_;
edm::ProductID mappedProductId_;
};

Expand Down
15 changes: 15 additions & 0 deletions SimTracker/TrackerHitAssociation/src/ClusterTPAssociation.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
#include "SimTracker/TrackerHitAssociation/interface/ClusterTPAssociation.h"
#include "FWCore/Utilities/interface/Exception.h"

void ClusterTPAssociation::checkKeyProductID(const edm::ProductID& id) const {
if(std::find(std::begin(keyProductIDs_), std::end(keyProductIDs_), id) == std::end(keyProductIDs_)) {
auto e = cms::Exception("InvalidReference");
e << "ClusterTPAssociation has OmniClusterRefs with ProductIDs ";
for(size_t i=0; i<keyProductIDs_.size(); ++i) {
e << keyProductIDs_[i];
if(i < keyProductIDs_.size()-1) {
e << ",";
}
}
e << " but got OmniClusterRef/ProductID with ID " << id << ". This is typically caused by a configuration error.";
throw e;
}
}

void ClusterTPAssociation::checkMappedProductID(const edm::ProductID& id) const {
if(id != mappedProductId_) {
throw cms::Exception("InvalidReference") << "ClusterTPAssociation has TrackingParticles with ProductID " << mappedProductId_ << ", but got TrackingParticleRef/Handle/ProductID with ID " << id << ". This is typically caused by a configuration error.";
Expand Down
14 changes: 14 additions & 0 deletions Validation/RecoTrack/plugins/MultiTrackValidator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ MultiTrackValidator::MultiTrackValidator(const edm::ParameterSet& pset):
doMVAPlots_(pset.getUntrackedParameter<bool>("doMVAPlots")),
simPVMaxZ_(pset.getUntrackedParameter<double>("simPVMaxZ"))
{
if(label.empty()) {
// Disable prefetching of everything if there are no track collections
return;
}

const edm::InputTag& label_tp_effic_tag = pset.getParameter< edm::InputTag >("label_tp_effic");
const edm::InputTag& label_tp_fake_tag = pset.getParameter< edm::InputTag >("label_tp_fake");

Expand Down Expand Up @@ -211,6 +216,10 @@ MultiTrackValidator::~MultiTrackValidator() {}


void MultiTrackValidator::bookHistograms(DQMStore::ConcurrentBooker& ibook, edm::Run const&, edm::EventSetup const& setup, Histograms& histograms) const {
if(label.empty()) {
// Disable histogram booking if there are no track collections
return;
}

const auto minColl = -0.5;
const auto maxColl = label.size()-0.5;
Expand Down Expand Up @@ -481,6 +490,11 @@ void MultiTrackValidator::trackDR(const edm::View<reco::Track>& trackCollection,


void MultiTrackValidator::dqmAnalyze(const edm::Event& event, const edm::EventSetup& setup, const Histograms& histograms) const {
if(label.empty()) {
// Disable if there are no track collections
return;
}

using namespace reco;

LogDebug("TrackValidator") << "\n====================================================" << "\n"
Expand Down
4 changes: 2 additions & 2 deletions Validation/RecoTrack/python/PostProcessorTracker_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ def _addNoFlow(module):
)

postProcessorTrackTrackingOnly = postProcessorTrack.clone()
postProcessorTrackTrackingOnly.subDirs.extend(["Tracking/TrackSeeding/*", "Tracking/PixelTrack/*", "Tracking/PixelTrackFromPV/*", "Tracking/PixelTrackFromPVAllTP/*"])
postProcessorTrackTrackingOnly.subDirs.extend(["Tracking/TrackSeeding/*", "Tracking/PixelTrack/*", "Tracking/PixelTrackFromPV/*", "Tracking/PixelTrackFromPVAllTP/*", "Tracking/PixelTrackBHadron/*"])
postProcessorTrackSummaryTrackingOnly = postProcessorTrackSummary.clone()
postProcessorTrackSummaryTrackingOnly.subDirs.extend(["Tracking/TrackSeeding", "Tracking/PixelTrack", "Tracking/PixelTrackFromPV/*", "Tracking/PixelTrackFromPVAllTP/*"])
postProcessorTrackSummaryTrackingOnly.subDirs.extend(["Tracking/TrackSeeding", "Tracking/PixelTrack", "Tracking/PixelTrackFromPV/*", "Tracking/PixelTrackFromPVAllTP/*", "Tracking/PixelTrackBHadron/*"])

postProcessorTrackSequenceTrackingOnly = cms.Sequence(
postProcessorTrackTrackingOnly+
Expand Down
Loading