diff --git a/DQM/TrackingMonitor/interface/TrackAnalyzer.h b/DQM/TrackingMonitor/interface/TrackAnalyzer.h index 5137fa34730d3..c7364f4c1cf50 100644 --- a/DQM/TrackingMonitor/interface/TrackAnalyzer.h +++ b/DQM/TrackingMonitor/interface/TrackAnalyzer.h @@ -11,6 +11,7 @@ Monitoring source for general quantities related to tracks. #include #include +#include #include "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -34,7 +35,7 @@ class TrackAnalyzer TrackAnalyzer(const edm::ParameterSet&); TrackAnalyzer(const edm::ParameterSet&, edm::ConsumesCollector& iC); virtual ~TrackAnalyzer(); - virtual void initHisto(DQMStore::IBooker & ibooker); + virtual void initHisto(DQMStore::IBooker & ibooker, const edm::EventSetup &); virtual void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track); @@ -42,6 +43,13 @@ class TrackAnalyzer void doReset (); void undoSoftReset(DQMStore * dqmStore_); void setLumiFlag(); + // Compute and locally store the number of Good vertices found + // in the event. This information is used as X-axis value in + // the hit-efficiency plots derived from the hit patter. This + // ugly design to avoid comuting this very same quantity for + // each and every track while in the analyze method. A + // redesign of the class is needed in the future. + void setNumberOfGoodVertices(const edm::Event &); private: void initHistos(); @@ -51,6 +59,7 @@ class TrackAnalyzer void bookHistosForLScertification(DQMStore::IBooker & ibooker); void bookHistosForBeamSpot(DQMStore::IBooker & ibooker); void bookHistosForTrackerSpecific(DQMStore::IBooker & ibooker); + void bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, const edm::EventSetup & iSetup); void fillHistosForHitProperties(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname); void fillHistosForLScertification(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname); void fillHistosForTrackerSpecific(const reco::Track & track); @@ -98,6 +107,9 @@ class TrackAnalyzer // IP significance plots bool doSIPPlots_; + // Compute the hit-finding efficiency using the HitPattern of + // the reconstructed tracks + bool doEffFromHitPattern_; std::string qualityString_; struct TkParameterMEs { @@ -345,7 +357,29 @@ class TrackAnalyzer }; std::map TkRecHitsPerSubDetMEMap; - + struct Key { + int det; + int subdet; + explicit Key(int det, int subdet):det(det),subdet(subdet){}; + bool operator==(const Key & other) const { + return (det == other.det && subdet == other.subdet); + } + }; + + // Trivial hasher function: warning, it only works if det has less than 99 subdets. + struct KeyHasher { + std::size_t operator()(const Key& k) const { + return k.det*100+k.subdet; + } + }; + + std::unordered_map hits_valid_; + std::unordered_map hits_missing_; + std::unordered_map hits_inactive_; + std::unordered_map hits_bad_; + std::unordered_map hits_total_; + unsigned int good_vertices_; + std::string histname; //for naming the histograms according to algorithm used }; diff --git a/DQM/TrackingMonitor/python/MonitorTrackSTAMuons_cfi.py b/DQM/TrackingMonitor/python/MonitorTrackSTAMuons_cfi.py index 8143dd87921c0..d4b9bc321b367 100644 --- a/DQM/TrackingMonitor/python/MonitorTrackSTAMuons_cfi.py +++ b/DQM/TrackingMonitor/python/MonitorTrackSTAMuons_cfi.py @@ -21,9 +21,9 @@ # determines where to evaluate track parameters # options: 'default' --> straight up track parametes -# 'ImpactPoint' --> evalutate at impact point -# 'InnerSurface' --> evalutate at innermost measurement state -# 'OuterSurface' --> evalutate at outermost measurement state +# 'ImpactPoint' --> evalutate at impact point +# 'InnerSurface' --> evalutate at innermost measurement state +# 'OuterSurface' --> evalutate at outermost measurement state MonitorTrackSTAMuons.MeasurementState = cms.string('default') # which plots to do @@ -34,12 +34,13 @@ MonitorTrackSTAMuons.doTrackCandHistos = cms.bool(False) MonitorTrackSTAMuons.doDCAPlots = cms.bool(False) MonitorTrackSTAMuons.doGeneralPropertiesPlots = cms.bool(True) -MonitorTrackSTAMuons.doHitPropertiesPlots = cms.bool(True) +MonitorTrackSTAMuons.doHitPropertiesPlots = cms.bool(True) +MonitorTrackSTAMuons.doEffFromHitPattern = cms.bool(False) #MonitorTrackSTAMuons.doGoodTrackPlots = cms.bool(False) MonitorTrackSTAMuons.doMeasurementStatePlots = cms.bool(True) MonitorTrackSTAMuons.doProfilesVsLS = cms.bool(False) MonitorTrackSTAMuons.doRecHitVsPhiVsEtaPerTrack = cms.bool(False) -#MonitorTrackSTAMuons.doGoodTrackRecHitVsPhiVsEtaPerTrack = cms.bool(False) +#MonitorTrackSTAMuons.doGoodTrackRecHitVsPhiVsEtaPerTrack = cms.bool(False) #which seed plots to do MonitorTrackSTAMuons.doSeedNumberHisto = cms.bool(False) @@ -58,7 +59,7 @@ # paramters of the Track -# ============================================================ +# ============================================================ # chi2 MonitorTrackSTAMuons.Chi2Bin = cms.int32(250) @@ -80,29 +81,29 @@ MonitorTrackSTAMuons.TkSizeMax = cms.double(10.5) MonitorTrackSTAMuons.TkSizeMin = cms.double(-0.5) -# Number of seeds per Event +# Number of seeds per Event MonitorTrackSTAMuons.TkSeedSizeBin = cms.int32(20) -MonitorTrackSTAMuons.TkSeedSizeMax = cms.double(19.5) +MonitorTrackSTAMuons.TkSeedSizeMax = cms.double(19.5) MonitorTrackSTAMuons.TkSeedSizeMin = cms.double(-0.5) # Number of Track Cadidates per Event MonitorTrackSTAMuons.TCSizeBin = cms.int32(150) -MonitorTrackSTAMuons.TCSizeMax = cms.double(149.5) +MonitorTrackSTAMuons.TCSizeMax = cms.double(149.5) MonitorTrackSTAMuons.TCSizeMin = cms.double(-0.5) -# num rec hits +# num rec hits MonitorTrackSTAMuons.TrackQBin = cms.int32(8) -MonitorTrackSTAMuons.TrackQMax = cms.double(2.5) +MonitorTrackSTAMuons.TrackQMax = cms.double(2.5) MonitorTrackSTAMuons.TrackQMin = cms.double(-2.5) -# num rec hits in seed +# num rec hits in seed MonitorTrackSTAMuons.SeedHitBin = cms.int32(6) MonitorTrackSTAMuons.SeedHitMax = cms.double(5.5) MonitorTrackSTAMuons.SeedHitMin = cms.double(-0.5) # num rec hits per track candidate MonitorTrackSTAMuons.TCHitBin = cms.int32(40) -MonitorTrackSTAMuons.TCHitMax = cms.double(39.5) +MonitorTrackSTAMuons.TCHitMax = cms.double(39.5) MonitorTrackSTAMuons.TCHitMin = cms.double(-0.5) # num rec hits @@ -112,7 +113,7 @@ # mean rec hits MonitorTrackSTAMuons.MeanHitBin = cms.int32(30) -MonitorTrackSTAMuons.MeanHitMax = cms.double(29.5) +MonitorTrackSTAMuons.MeanHitMax = cms.double(29.5) MonitorTrackSTAMuons.MeanHitMin = cms.double(-0.5) # num TOB rec hits @@ -147,7 +148,7 @@ # num rec hits lost MonitorTrackSTAMuons.RecLostBin = cms.int32(120) -MonitorTrackSTAMuons.RecLostMax = cms.double(20) +MonitorTrackSTAMuons.RecLostMax = cms.double(20) MonitorTrackSTAMuons.RecLostMin = cms.double(0.0) # num layers @@ -155,44 +156,44 @@ MonitorTrackSTAMuons.RecLayMax = cms.double(120.0) MonitorTrackSTAMuons.RecLayMin = cms.double(0.0) -# mean layers +# mean layers MonitorTrackSTAMuons.MeanLayBin = cms.int32(20) -MonitorTrackSTAMuons.MeanLayMax = cms.double(19.5) +MonitorTrackSTAMuons.MeanLayMax = cms.double(19.5) MonitorTrackSTAMuons.MeanLayMin = cms.double(-0.5) # num TOB layers MonitorTrackSTAMuons.TOBLayBin = cms.int32(10) -MonitorTrackSTAMuons.TOBLayMax = cms.double(9.5) +MonitorTrackSTAMuons.TOBLayMax = cms.double(9.5) MonitorTrackSTAMuons.TOBLayMin = cms.double(-0.5) # num TIB layers MonitorTrackSTAMuons.TIBLayBin = cms.int32(6) -MonitorTrackSTAMuons.TIBLayMax = cms.double(5.5) +MonitorTrackSTAMuons.TIBLayMax = cms.double(5.5) MonitorTrackSTAMuons.TIBLayMin = cms.double(-0.5) # num TID layers MonitorTrackSTAMuons.TIDLayBin = cms.int32(6) -MonitorTrackSTAMuons.TIDLayMax = cms.double(5.5) +MonitorTrackSTAMuons.TIDLayMax = cms.double(5.5) MonitorTrackSTAMuons.TIDLayMin = cms.double(-0.5) # num TEC layers MonitorTrackSTAMuons.TECLayBin = cms.int32(15) -MonitorTrackSTAMuons.TECLayMax = cms.double(14.5) +MonitorTrackSTAMuons.TECLayMax = cms.double(14.5) MonitorTrackSTAMuons.TECLayMin = cms.double(-0.5) # num PXB layers MonitorTrackSTAMuons.PXBLayBin = cms.int32(6) -MonitorTrackSTAMuons.PXBLayMax = cms.double(5.5) +MonitorTrackSTAMuons.PXBLayMax = cms.double(5.5) MonitorTrackSTAMuons.PXBLayMin = cms.double(-0.5) # num PXF layers MonitorTrackSTAMuons.PXFLayBin = cms.int32(6) -MonitorTrackSTAMuons.PXFLayMax = cms.double(5.5) +MonitorTrackSTAMuons.PXFLayMax = cms.double(5.5) MonitorTrackSTAMuons.PXFLayMin = cms.double(-0.5) -# Track |p| +# Track |p| MonitorTrackSTAMuons.TrackPBin = cms.int32(1000) -MonitorTrackSTAMuons.TrackPMax = cms.double(1000) +MonitorTrackSTAMuons.TrackPMax = cms.double(1000) MonitorTrackSTAMuons.TrackPMin = cms.double(0) # Track pT @@ -200,7 +201,7 @@ MonitorTrackSTAMuons.TrackPtMax = cms.double(1000) MonitorTrackSTAMuons.TrackPtMin = cms.double(0) -# Track px +# Track px MonitorTrackSTAMuons.TrackPxBin = cms.int32(1000) MonitorTrackSTAMuons.TrackPxMax = cms.double(500.0) MonitorTrackSTAMuons.TrackPxMin = cms.double(-500.0) @@ -261,7 +262,7 @@ MonitorTrackSTAMuons.etaErrMin = cms.double(0.0) # track phi Error -MonitorTrackSTAMuons.phiErrBin = cms.int32(100) +MonitorTrackSTAMuons.phiErrBin = cms.int32(100) MonitorTrackSTAMuons.phiErrMax = cms.double(1.0) MonitorTrackSTAMuons.phiErrMin = cms.double(0.0) @@ -270,7 +271,7 @@ MonitorTrackSTAMuons.VXMax = cms.double(20.0) MonitorTrackSTAMuons.VXMin = cms.double(-20.0) -# PCA y position +# PCA y position MonitorTrackSTAMuons.VYBin = cms.int32(20) MonitorTrackSTAMuons.VYMax = cms.double(20.0) MonitorTrackSTAMuons.VYMin = cms.double(-20.0) @@ -282,12 +283,12 @@ # PCA x position for 2D plot MonitorTrackSTAMuons.X0Bin = cms.int32(100) -MonitorTrackSTAMuons.X0Max = cms.double(3.0) +MonitorTrackSTAMuons.X0Max = cms.double(3.0) MonitorTrackSTAMuons.X0Min = cms.double(-3.0) # PCA y position for 2D plot MonitorTrackSTAMuons.Y0Bin = cms.int32(100) -MonitorTrackSTAMuons.Y0Max = cms.double(3.0) +MonitorTrackSTAMuons.Y0Max = cms.double(3.0) MonitorTrackSTAMuons.Y0Min = cms.double(-3.0) # PCA z position for 2D plot @@ -297,53 +298,53 @@ # Track dxy (transverse impact parameter) MonitorTrackSTAMuons.DxyBin = cms.int32(100) -MonitorTrackSTAMuons.DxyMax = cms.double(0.5) -MonitorTrackSTAMuons.DxyMin = cms.double(-0.5) +MonitorTrackSTAMuons.DxyMax = cms.double(0.5) +MonitorTrackSTAMuons.DxyMin = cms.double(-0.5) # Seed dxy (transverse impact parameter) MonitorTrackSTAMuons.SeedDxyBin = cms.int32(100) MonitorTrackSTAMuons.SeedDxyMax = cms.double(0.5) -MonitorTrackSTAMuons.SeedDxyMin = cms.double(-0.5) +MonitorTrackSTAMuons.SeedDxyMin = cms.double(-0.5) # Seed dz (longitudinal impact parameter) MonitorTrackSTAMuons.SeedDzBin = cms.int32(200) MonitorTrackSTAMuons.SeedDzMax = cms.double(30.0) -MonitorTrackSTAMuons.SeedDzMin = cms.double(-30.0) +MonitorTrackSTAMuons.SeedDzMin = cms.double(-30.0) # Track Candidate dxy (transverse impact parameter) MonitorTrackSTAMuons.TCDxyBin = cms.int32(200) MonitorTrackSTAMuons.TCDxyMax = cms.double(100.0) -MonitorTrackSTAMuons.TCDxyMin = cms.double(-100.0) +MonitorTrackSTAMuons.TCDxyMin = cms.double(-100.0) # Track Candidate dz (transverse impact parameter) MonitorTrackSTAMuons.TCDzBin = cms.int32(200) MonitorTrackSTAMuons.TCDzMax = cms.double(400.0) -MonitorTrackSTAMuons.TCDzMin = cms.double(-400.0) +MonitorTrackSTAMuons.TCDzMin = cms.double(-400.0) # NCluster Pixel MonitorTrackSTAMuons.NClusPxBin = cms.int32(50) -MonitorTrackSTAMuons.NClusPxMax = cms.double(1999.5) +MonitorTrackSTAMuons.NClusPxMax = cms.double(1999.5) MonitorTrackSTAMuons.NClusPxMin = cms.double(-0.5) # NCluster Strip MonitorTrackSTAMuons.NClusStrBin = cms.int32(150) -MonitorTrackSTAMuons.NClusStrMax = cms.double(14999.5) +MonitorTrackSTAMuons.NClusStrMax = cms.double(14999.5) MonitorTrackSTAMuons.NClusStrMin = cms.double(-0.5) # NCluster 2D MonitorTrackSTAMuons.NClus2DPxBin = cms.int32(20) -MonitorTrackSTAMuons.NClus2DPxMax = cms.double(1999.5) +MonitorTrackSTAMuons.NClus2DPxMax = cms.double(1999.5) MonitorTrackSTAMuons.NClus2DPxMin = cms.double(-0.5) MonitorTrackSTAMuons.NClus2DStrBin = cms.int32(50) -MonitorTrackSTAMuons.NClus2DStrMax = cms.double(14999.5) +MonitorTrackSTAMuons.NClus2DStrMax = cms.double(14999.5) MonitorTrackSTAMuons.NClus2DStrMin = cms.double(-0.5) # NCluster Vs Tracks MonitorTrackSTAMuons.NClus2DTotBin = cms.int32(50) -MonitorTrackSTAMuons.NClus2DTotMax = cms.double(14999.5) +MonitorTrackSTAMuons.NClus2DTotMax = cms.double(14999.5) MonitorTrackSTAMuons.NClus2DTotMin = cms.double(-0.5) MonitorTrackSTAMuons.NTrk2DBin = cms.int32(20) -MonitorTrackSTAMuons.NTrk2DMax = cms.double(199.5) +MonitorTrackSTAMuons.NTrk2DMax = cms.double(199.5) MonitorTrackSTAMuons.NTrk2DMin = cms.double(-0.5) MonitorTrackSTAMuons.TTRHBuilder = cms.string('WithTrackAngle') @@ -354,5 +355,5 @@ MonitorTrackSTAMuons.LSMax = cms.double(2000.) # Luminosity based analysis -MonitorTrackSTAMuons.doLumiAnalysis = cms.bool(False) +MonitorTrackSTAMuons.doLumiAnalysis = cms.bool(False) diff --git a/DQM/TrackingMonitor/python/TrackerCollisionTrackingMonitor_cfi.py b/DQM/TrackingMonitor/python/TrackerCollisionTrackingMonitor_cfi.py index a79b8acad57ff..d033f8d20db8b 100644 --- a/DQM/TrackingMonitor/python/TrackerCollisionTrackingMonitor_cfi.py +++ b/DQM/TrackingMonitor/python/TrackerCollisionTrackingMonitor_cfi.py @@ -50,6 +50,7 @@ TrackerCollisionTrackMon.doPUmonitoring = cms.bool(False) TrackerCollisionTrackMon.doPlotsVsBXlumi = cms.bool(False) TrackerCollisionTrackMon.doPlotsVsGoodPVtx = cms.bool(True) +TrackerCollisionTrackMon.doEffFromHitPattern = cms.bool(True) # LS analysis TrackerCollisionTrackMon.doLumiAnalysis = cms.bool(True) diff --git a/DQM/TrackingMonitor/python/TrackingMonitor_cfi.py b/DQM/TrackingMonitor/python/TrackingMonitor_cfi.py index 10018e2d152db..5011641e9ce94 100644 --- a/DQM/TrackingMonitor/python/TrackingMonitor_cfi.py +++ b/DQM/TrackingMonitor/python/TrackingMonitor_cfi.py @@ -59,6 +59,7 @@ doDCAwrtPVPlots = cms.bool(False), doDCAwrt000Plots = cms.bool(False), doSIPPlots = cms.bool(False), + doEffFromHitPattern = cms.bool(False), doGeneralPropertiesPlots = cms.bool(False), doHitPropertiesPlots = cms.bool(False), # doGoodTrackPlots = cms.bool(False), diff --git a/DQM/TrackingMonitor/src/TrackAnalyzer.cc b/DQM/TrackingMonitor/src/TrackAnalyzer.cc index 9d2ffcb08cbe8..12becbb442bfb 100644 --- a/DQM/TrackingMonitor/src/TrackAnalyzer.cc +++ b/DQM/TrackingMonitor/src/TrackAnalyzer.cc @@ -11,6 +11,7 @@ #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "TrackingTools/IPTools/interface/IPTools.h" #include "MagneticField/Engine/interface/MagneticField.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -40,11 +41,12 @@ TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig) , doTestPlots_ ( conf_.getParameter("doTestPlots") ) , doHIPlots_ ( conf_.getParameter("doHIPlots") ) , doSIPPlots_ ( conf_.getParameter("doSIPPlots") ) + , doEffFromHitPattern_ ( conf_.getParameter("doEffFromHitPattern") ) , qualityString_ ( conf_.getParameter("qualityString")) + , good_vertices_(0) { initHistos(); TopFolder_ = conf_.getParameter("FolderName"); - } TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig, edm::ConsumesCollector& iC) @@ -133,13 +135,14 @@ TrackAnalyzer::~TrackAnalyzer() { } -void TrackAnalyzer::initHisto(DQMStore::IBooker & ibooker) +void TrackAnalyzer::initHisto(DQMStore::IBooker & ibooker, const edm::EventSetup & iSetup) { bookHistosForHitProperties(ibooker); bookHistosForBeamSpot(ibooker); bookHistosForLScertification( ibooker); - + bookHistosForEfficiencyFromHitPatter(ibooker, iSetup); + // book tracker specific related histograms // ---------------------------------------------------------------------------------// if(doTrackerSpecific_ || doAllPlots_) bookHistosForTrackerSpecific(ibooker); @@ -169,6 +172,69 @@ void TrackAnalyzer::initHisto(DQMStore::IBooker & ibooker) } } +void TrackAnalyzer::bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, + const edm::EventSetup & iSetup) +{ + if (doEffFromHitPattern_ || doAllPlots_) { + ibooker.setCurrentFolder(TopFolder_ + "/HitEffFromHitPattern"); + + edm::ESHandle trackerGeometry; + iSetup.get().get(trackerGeometry); + + // Values are not ordered randomly, but the order is taken from + // http://cmslxr.fnal.gov/dxr/CMSSW/source/Geometry/CommonDetUnit/interface/GeomDetEnumerators.h#15 + const char * dets[] = { "None", "PXB", "PXF", "TIB", "TID", "TOB", "TEC"}; + + // Also in this case, ordering is not random but extracted from + // http://cmslxr.fnal.gov/dxr/CMSSW/source/DataFormats/TrackReco/interface/HitPattern.h + // The category "total" is an addition to ease the computation of + // the efficiencies and is not part of the original HitPattern. + const char * hit_category[] = { "valid", "missing", "inactive", "bad", "total"}; + + // We set sub_det to be a 1-based index since to it is the sub-sub-structure in the HitPattern + char title[50]; + for (unsigned int det = 1; det < sizeof(dets)/sizeof(char*); ++det ) { + for (unsigned int sub_det = 1; + sub_det <= trackerGeometry->numberOfLayers(det); ++sub_det) { + for (unsigned int cat = 0; + cat < sizeof(hit_category)/sizeof(char *); ++cat) { + memset(title, 0, sizeof(title)); + snprintf(title, sizeof(title), "Hits_%s_%s_Subdet%d", hit_category[cat], dets[det], sub_det); + switch(cat) { + case 0: + hits_valid_.insert(std::make_pair( + Key(det, sub_det), + ibooker.book1D(title, title, 50, 0.5, 50.5))); + break; + case 1: + hits_missing_.insert(std::make_pair( + Key(det, sub_det), + ibooker.book1D(title, title, 50, 0.5, 50.5))); + break; + case 2: + hits_inactive_.insert(std::make_pair( + Key(det, sub_det), + ibooker.book1D(title, title, 50, 0.5, 50.5))); + break; + case 3: + hits_bad_.insert(std::make_pair( + Key(det, sub_det), + ibooker.book1D(title, title, 50, 0.5, 50.5))); + break; + case 4: + hits_total_.insert(std::make_pair( + Key(det, sub_det), + ibooker.book1D(title, title, 50, 0.5, 50.5))); + break; + default: + LogDebug("TrackAnalyzer") << "Invalid hit category used " << cat << " ignored\n"; + } + } + } + } + } +} + void TrackAnalyzer::bookHistosForHitProperties(DQMStore::IBooker & ibooker) { // parameters from the configuration @@ -725,6 +791,19 @@ void TrackAnalyzer::bookHistosForBeamSpot(DQMStore::IBooker & ibooker) { // -- Analyse // ---------------------------------------------------------------------------------// +void TrackAnalyzer::setNumberOfGoodVertices(const edm::Event & iEvent) { + + good_vertices_ = 0; + + edm::Handle recoPrimaryVerticesHandle; + iEvent.getByToken(pvToken_, recoPrimaryVerticesHandle); + if (recoPrimaryVerticesHandle.isValid()) + if (recoPrimaryVerticesHandle->size() > 0) + for (auto v : *recoPrimaryVerticesHandle) + if (v.ndof() >=4 && !v.isFake()) + ++good_vertices_; +} + void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track) { double phi = track.phi(); @@ -772,6 +851,54 @@ void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe // 2D plots if ( doLayersVsPhiVsEtaPerTrack_ || doAllPlots_ ) for (int i=0;i<4;++i) NumberOfLayersVsPhiVsEtaPerTrack[i]->Fill(etaIn,phiIn,nLayers[i]); + + } + + if (doEffFromHitPattern_ || doAllPlots_) { + if (track.pt() > 1.0 && track.dxy() < 0.1 and good_vertices_ > 0) { + auto hp = track.hitPattern(); + // Here hit_category is meant to iterate over + // reco::HitPattern::HitCategory, defined here: + // http://cmslxr.fnal.gov/dxr/CMSSW/source/DataFormats/TrackReco/interface/HitPattern.h + for (unsigned int category = 0; category < 3; ++category) { + for (int hit = 0; hit < hp.numberOfHits((reco::HitPattern::HitCategory)(category)); ++hit) { + auto pattern = hp.getHitPattern((reco::HitPattern::HitCategory)(category), hit); + // Boolean bad is missing simply because it is inferred and the only missing case. + bool valid = hp.validHitFilter(pattern); + bool missing = hp.missingHitFilter(pattern); + bool inactive = hp.inactiveHitFilter(pattern); + int hit_type = -1; + hit_type = valid ? 0 : + ( missing ? 1 : + ( inactive ? 2 : 3)); + if (hits_valid_.find(Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern))) == hits_valid_.end()) { + LogDebug("TrackAnalyzer") << "Invalid combination of detector and subdetector: (" + << hp.getSubStructure(pattern) << ", " + << hp.getSubSubStructure(pattern) + << "): ignoring it.\n"; + continue; + } + switch (hit_type) { + case 0: + hits_valid_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern))]->Fill(good_vertices_); + hits_total_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern))]->Fill(good_vertices_); + break; + case 1: + hits_missing_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern))]->Fill(good_vertices_); + hits_total_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern))]->Fill(good_vertices_); + break; + case 2: + hits_inactive_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern))]->Fill(good_vertices_); + break; + case 3: + hits_bad_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern))]->Fill(good_vertices_); + break; + default: + LogDebug("TrackAnalyzer") << "Invalid hit category used " << hit_type << " ignored\n"; + } + } + } + } } if (doGeneralPropertiesPlots_ || doAllPlots_){ diff --git a/DQM/TrackingMonitor/src/TrackingMonitor.cc b/DQM/TrackingMonitor/src/TrackingMonitor.cc index 270d417f80a6a..2efe64474707d 100644 --- a/DQM/TrackingMonitor/src/TrackingMonitor.cc +++ b/DQM/TrackingMonitor/src/TrackingMonitor.cc @@ -326,7 +326,7 @@ void TrackingMonitor::bookHistograms(DQMStore::IBooker & ibooker, } - theTrackAnalyzer->initHisto(ibooker); + theTrackAnalyzer->initHisto(ibooker, iSetup); // book the Seed Property histograms // ---------------------------------------------------------------------------------// @@ -533,7 +533,8 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i reco::TrackCollection trackCollection = *trackHandle; // calculate the mean # rechits and layers int totalRecHits = 0, totalLayers = 0; - + + theTrackAnalyzer->setNumberOfGoodVertices(iEvent); for (reco::TrackCollection::const_iterator track = trackCollection.begin(); track!=trackCollection.end(); ++track) { diff --git a/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_cff.py b/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_cff.py index 718bd1a26eaf8..3f4cda3f0b3ea 100644 --- a/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_cff.py +++ b/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_cff.py @@ -65,8 +65,9 @@ getQualityTestsFromFile = cms.untracked.bool(True) ) +from DQM.TrackingMonitorClient.TrackingEffFromHitPatternClientConfig_cff import trackingEffFromHitPattern # Sequence -TrackingOfflineDQMClient = cms.Sequence(trackingQTester*trackingOfflineAnalyser) +TrackingOfflineDQMClient = cms.Sequence(trackingQTester*trackingOfflineAnalyser*trackingEffFromHitPattern) diff --git a/DQM/TrackingMonitorClient/python/TrackingEffFromHitPatternClientConfig_cff.py b/DQM/TrackingMonitorClient/python/TrackingEffFromHitPatternClientConfig_cff.py new file mode 100644 index 0000000000000..bb9cd157d37d4 --- /dev/null +++ b/DQM/TrackingMonitorClient/python/TrackingEffFromHitPatternClientConfig_cff.py @@ -0,0 +1,39 @@ +import FWCore.ParameterSet.Config as cms + +trackingEffFromHitPattern = cms.EDAnalyzer("DQMGenericClient", + subDirs = cms.untracked.vstring("Tracking/TrackParameters/generalTracks/HitEffFromHitPattern", + "Tracking/TrackParameters/highPurityTracks/pt_1/HitEffFromHitPattern"), + efficiency = cms.vstring( + "effic_vs_PU_PXB1 'PXB Layer1 Efficiency vs GoodNumVertices' Hits_valid_PXB_Subdet1 Hits_total_PXB_Subdet1", + "effic_vs_PU_PXB2 'PXB Layer2 Efficiency vs GoodNumVertices' Hits_valid_PXB_Subdet2 Hits_total_PXB_Subdet2", + "effic_vs_PU_PXB3 'PXB Layer3 Efficiency vs GoodNumVertices' Hits_valid_PXB_Subdet3 Hits_total_PXB_Subdet3", + "effic_vs_PU_PXF1 'PXF Layer1 Efficiency vs GoodNumVertices' Hits_valid_PXF_Subdet1 Hits_total_PXF_Subdet1", + "effic_vs_PU_PXF2 'PXF Layer2 Efficiency vs GoodNumVertices' Hits_valid_PXF_Subdet2 Hits_total_PXF_Subdet2", + "effic_vs_PU_TIB1 'TIB Layer1 Efficiency vs GoodNumVertices' Hits_valid_TIB_Subdet1 Hits_total_TIB_Subdet1", + "effic_vs_PU_TIB2 'TIB Layer2 Efficiency vs GoodNumVertices' Hits_valid_TIB_Subdet2 Hits_total_TIB_Subdet2", + "effic_vs_PU_TIB3 'TIB Layer3 Efficiency vs GoodNumVertices' Hits_valid_TIB_Subdet3 Hits_total_TIB_Subdet3", + "effic_vs_PU_TIB4 'TIB Layer4 Efficiency vs GoodNumVertices' Hits_valid_TIB_Subdet4 Hits_total_TIB_Subdet4", + "effic_vs_PU_TOB1 'TOB Layer1 Efficiency vs GoodNumVertices' Hits_valid_TOB_Subdet1 Hits_total_TOB_Subdet1", + "effic_vs_PU_TOB2 'TOB Layer2 Efficiency vs GoodNumVertices' Hits_valid_TOB_Subdet2 Hits_total_TOB_Subdet2", + "effic_vs_PU_TOB3 'TOB Layer3 Efficiency vs GoodNumVertices' Hits_valid_TOB_Subdet3 Hits_total_TOB_Subdet3", + "effic_vs_PU_TOB4 'TOB Layer4 Efficiency vs GoodNumVertices' Hits_valid_TOB_Subdet4 Hits_total_TOB_Subdet4", + "effic_vs_PU_TOB5 'TOB Layer5 Efficiency vs GoodNumVertices' Hits_valid_TOB_Subdet5 Hits_total_TOB_Subdet5", + "effic_vs_PU_TOB6 'TOB Layer6 Efficiency vs GoodNumVertices' Hits_valid_TOB_Subdet6 Hits_total_TOB_Subdet6", + "effic_vs_PU_TID1 'TID Layer1 Efficiency vs GoodNumVertices' Hits_valid_TID_Subdet1 Hits_total_TID_Subdet1", + "effic_vs_PU_TID2 'TID Layer2 Efficiency vs GoodNumVertices' Hits_valid_TID_Subdet2 Hits_total_TID_Subdet2", + "effic_vs_PU_TID3 'TID Layer3 Efficiency vs GoodNumVertices' Hits_valid_TID_Subdet3 Hits_total_TID_Subdet3", + "effic_vs_PU_TEC1 'TEC Layer1 Efficiency vs GoodNumVertices' Hits_valid_TEC_Subdet1 Hits_total_TEC_Subdet1", + "effic_vs_PU_TEC2 'TEC Layer2 Efficiency vs GoodNumVertices' Hits_valid_TEC_Subdet2 Hits_total_TEC_Subdet2", + "effic_vs_PU_TEC3 'TEC Layer3 Efficiency vs GoodNumVertices' Hits_valid_TEC_Subdet3 Hits_total_TEC_Subdet3", + "effic_vs_PU_TEC4 'TEC Layer4 Efficiency vs GoodNumVertices' Hits_valid_TEC_Subdet4 Hits_total_TEC_Subdet4", + "effic_vs_PU_TEC5 'TEC Layer5 Efficiency vs GoodNumVertices' Hits_valid_TEC_Subdet5 Hits_total_TEC_Subdet5", + "effic_vs_PU_TEC6 'TEC Layer6 Efficiency vs GoodNumVertices' Hits_valid_TEC_Subdet6 Hits_total_TEC_Subdet6", + "effic_vs_PU_TEC7 'TEC Layer7 Efficiency vs GoodNumVertices' Hits_valid_TEC_Subdet7 Hits_total_TEC_Subdet7", + "effic_vs_PU_TEC8 'TEC Layer8 Efficiency vs GoodNumVertices' Hits_valid_TEC_Subdet8 Hits_total_TEC_Subdet8", + "effic_vs_PU_TEC9 'TEC Layer9 Efficiency vs GoodNumVertices' Hits_valid_TEC_Subdet9 Hits_total_TEC_Subdet9" + ), + resolution = cms.vstring(), + verbose = cms.untracked.uint32(5), + outputFileName = cms.untracked.string(""), + ) +