From 094a71f79fa8130c8c631b1acc8591b695df82b3 Mon Sep 17 00:00:00 2001 From: Hugo Becerril Date: Mon, 24 Jun 2019 11:13:25 +0200 Subject: [PATCH 1/5] New plots for Tracking Workspace --- DQM/TrackingMonitor/interface/TrackAnalyzer.h | 911 ++-- .../interface/TrackingMonitor.h | 343 +- DQM/TrackingMonitor/src/TrackAnalyzer.cc | 3651 +++++++++-------- DQM/TrackingMonitor/src/TrackingMonitor.cc | 1946 ++++----- 4 files changed, 3551 insertions(+), 3300 deletions(-) diff --git a/DQM/TrackingMonitor/interface/TrackAnalyzer.h b/DQM/TrackingMonitor/interface/TrackAnalyzer.h index e9db0ec830479..f03898d1e938b 100644 --- a/DQM/TrackingMonitor/interface/TrackAnalyzer.h +++ b/DQM/TrackingMonitor/interface/TrackAnalyzer.h @@ -1,6 +1,6 @@ #ifndef TrackAnalyzer_H #define TrackAnalyzer_H -// +// /**\class TrackingAnalyzer TrackingAnalyzer.cc Monitoring source for general quantities related to tracks. */ @@ -31,446 +31,471 @@ Monitoring source for general quantities related to tracks. class BeamSpot; namespace dqm { - class TrackAnalyzer { - public: - TrackAnalyzer(const edm::ParameterSet&); - TrackAnalyzer(const edm::ParameterSet&, edm::ConsumesCollector& iC); - ~TrackAnalyzer(); - void initHisto(DQMStore::IBooker& ibooker, const edm::EventSetup&, const edm::ParameterSet&); - - void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track); - - void doSoftReset(DQMStore* dqmStore_); - 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&); - void setBX(const edm::Event&); - void setLumi(const edm::Event&, const edm::EventSetup& iSetup); - - private: - void initHistos(); - void fillHistosForState(const edm::EventSetup& iSetup, const reco::Track& track, std::string sname); - void bookHistosForState(std::string sname, DQMStore::IBooker& ibooker); - void bookHistosForHitProperties(DQMStore::IBooker& ibooker); - void bookHistosForLScertification(DQMStore::IBooker& ibooker); - void bookHistosForBeamSpot(DQMStore::IBooker& ibooker); - void bookHistosForTrackerSpecific(DQMStore::IBooker& ibooker); - void bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker& ibooker, - const edm::EventSetup& iSetup, - const std::string suffix, - bool useInac); - 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); - void fillHistosForEfficiencyFromHitPatter(const reco::Track& track, - const std::string suffix, - const float monitoring, - bool useInac); - - // ----------member data --------------------------- - std::string TopFolder_; - - edm::EDGetTokenT beamSpotToken_; - edm::EDGetTokenT pvToken_; - edm::EDGetTokenT > pixelClustersToken_; - edm::EDGetTokenT lumiscalersToken_; - float lumi_factor_per_bx_; - - edm::ParameterSet const* conf_; - - std::string stateName_; - - bool doTrackerSpecific_; - bool doAllPlots_; - bool doBSPlots_; - bool doPVPlots_; - bool doDCAPlots_; - bool doGeneralPropertiesPlots_; - bool doMeasurementStatePlots_; - bool doHitPropertiesPlots_; - bool doRecHitVsPhiVsEtaPerTrack_; - bool doRecHitVsPtVsEtaPerTrack_; - // ADD by Mia - bool doLayersVsPhiVsEtaPerTrack_; - bool doTrackRecHitVsPhiVsEtaPerTrack_; - bool doTrackRecHitVsPtVsEtaPerTrack_; - bool doTrackLayersVsPhiVsEtaPerTrack_; - bool doTrack2DChi2Plots_; - bool doRecHitsPerTrackProfile_; - // ADD by Mia in order to clean the tracking MEs - // do not plot *Theta* and TrackPx* and TrackPy* - bool doThetaPlots_; - bool doTrackPxPyPlots_; - // ADD by Mia in order to not plot DistanceOfClosestApproach w.r.t. (0,0,0) - // the DistanceOfClosestApproach w.r.t. the beam-spot is already shown in DistanceOfClosestApproachToBS - bool doDCAwrtPVPlots_; - bool doDCAwrt000Plots_; - - bool doLumiAnalysis_; - - // ADD by Mia in order to turnON test MEs - bool doTestPlots_; - - //For HI Plots - bool doHIPlots_; - - // IP significance plots - bool doSIPPlots_; - - // Compute the hit-finding efficiency using the HitPattern of - // the reconstructed tracks - bool doEffFromHitPatternVsPU_; - bool doEffFromHitPatternVsBX_; - bool doEffFromHitPatternVsLUMI_; - int pvNDOF_; - bool useBPixLayer1_; - int minNumberOfPixelsPerCluster_; - float minPixelClusterCharge_; - std::string qualityString_; - - struct TkParameterMEs { - TkParameterMEs() - : TrackP(nullptr), - TrackPx(nullptr), - TrackPy(nullptr), - TrackPz(nullptr), - TrackPt(nullptr) - - , - TrackPxErr(nullptr), - TrackPyErr(nullptr), - TrackPzErr(nullptr), - TrackPtErr(nullptr), - TrackPErr(nullptr) - - , - TrackPtErrVsEta(nullptr) - - , - TrackQ(nullptr) - - , - TrackPhi(nullptr), - TrackEta(nullptr), - TrackTheta(nullptr) - - , - TrackPhiErr(nullptr), - TrackEtaErr(nullptr), - TrackThetaErr(nullptr) - - , - NumberOfRecHitsPerTrackVsPhi(nullptr), - NumberOfRecHitsPerTrackVsTheta(nullptr), - NumberOfRecHitsPerTrackVsEta(nullptr), - NumberOfRecHitVsPhiVsEtaPerTrack(nullptr) - - , - NumberOfValidRecHitsPerTrackVsPhi(nullptr), - NumberOfValidRecHitsPerTrackVsTheta(nullptr), - NumberOfValidRecHitsPerTrackVsEta(nullptr), - NumberOfValidRecHitsPerTrackVsPt(nullptr), - NumberOfValidRecHitVsPhiVsEtaPerTrack(nullptr), - NumberOfValidRecHitVsPtVsEtaPerTrack(nullptr) - - , - NumberOfLostRecHitsPerTrackVsPhi(nullptr), - NumberOfLostRecHitsPerTrackVsTheta(nullptr), - NumberOfLostRecHitsPerTrackVsEta(nullptr), - NumberOfLostRecHitsPerTrackVsPt(nullptr), - NumberOfLostRecHitVsPhiVsEtaPerTrack(nullptr), - NumberOfLostRecHitVsPtVsEtaPerTrack(nullptr) - - , - NumberOfMIRecHitsPerTrackVsPhi(nullptr), - NumberOfMIRecHitsPerTrackVsTheta(nullptr), - NumberOfMIRecHitsPerTrackVsEta(nullptr), - NumberOfMIRecHitsPerTrackVsPt(nullptr), - NumberOfMIRecHitVsPhiVsEtaPerTrack(nullptr), - NumberOfMIRecHitVsPtVsEtaPerTrack(nullptr) - - , - NumberOfMORecHitsPerTrackVsPhi(nullptr), - NumberOfMORecHitsPerTrackVsTheta(nullptr), - NumberOfMORecHitsPerTrackVsEta(nullptr), - NumberOfMORecHitsPerTrackVsPt(nullptr), - NumberOfMORecHitVsPhiVsEtaPerTrack(nullptr), - NumberOfMORecHitVsPtVsEtaPerTrack(nullptr) - - , - NumberOfLayersPerTrackVsPhi(nullptr), - NumberOfLayersPerTrackVsTheta(nullptr), - NumberOfLayersPerTrackVsEta(nullptr) - - , - Chi2oNDFVsNHits(nullptr), - Chi2oNDFVsPt(nullptr), - Chi2oNDFVsEta(nullptr), - Chi2oNDFVsPhi(nullptr), - Chi2oNDFVsTheta(nullptr) - - , - Chi2ProbVsEta(nullptr), - Chi2ProbVsPhi(nullptr), - Chi2ProbVsTheta(nullptr) {} - - MonitorElement* TrackP; - MonitorElement* TrackPx; - MonitorElement* TrackPy; - MonitorElement* TrackPz; - MonitorElement* TrackPt; - - MonitorElement* TrackPxErr; - MonitorElement* TrackPyErr; - MonitorElement* TrackPzErr; - MonitorElement* TrackPtErr; - MonitorElement* TrackPErr; - - MonitorElement* TrackPtErrVsEta; - - MonitorElement* TrackQ; - - MonitorElement* TrackPhi; - MonitorElement* TrackEta; - MonitorElement* TrackEtaPhi = nullptr; - MonitorElement* TrackEtaPhiInner = nullptr; - MonitorElement* TrackEtaPhiOuter = nullptr; - - MonitorElement* TrackTheta; - - MonitorElement* TrackPhiErr; - MonitorElement* TrackEtaErr; - MonitorElement* TrackThetaErr; - - MonitorElement* NumberOfRecHitsPerTrackVsPhi; - MonitorElement* NumberOfRecHitsPerTrackVsTheta; - MonitorElement* NumberOfRecHitsPerTrackVsEta; - MonitorElement* NumberOfRecHitVsPhiVsEtaPerTrack; - - MonitorElement* NumberOfValidRecHitsPerTrackVsPhi; - MonitorElement* NumberOfValidRecHitsPerTrackVsTheta; - MonitorElement* NumberOfValidRecHitsPerTrackVsEta; - MonitorElement* NumberOfValidRecHitsPerTrackVsPt; - MonitorElement* NumberOfValidRecHitVsPhiVsEtaPerTrack; - MonitorElement* NumberOfValidRecHitVsPtVsEtaPerTrack; - - MonitorElement* NumberOfLostRecHitsPerTrackVsPhi; - MonitorElement* NumberOfLostRecHitsPerTrackVsTheta; - MonitorElement* NumberOfLostRecHitsPerTrackVsEta; - MonitorElement* NumberOfLostRecHitsPerTrackVsPt; - MonitorElement* NumberOfLostRecHitVsPhiVsEtaPerTrack; - MonitorElement* NumberOfLostRecHitVsPtVsEtaPerTrack; - - MonitorElement* NumberOfMIRecHitsPerTrackVsPhi; - MonitorElement* NumberOfMIRecHitsPerTrackVsTheta; - MonitorElement* NumberOfMIRecHitsPerTrackVsEta; - MonitorElement* NumberOfMIRecHitsPerTrackVsPt; - MonitorElement* NumberOfMIRecHitVsPhiVsEtaPerTrack; - MonitorElement* NumberOfMIRecHitVsPtVsEtaPerTrack; - - MonitorElement* NumberOfMORecHitsPerTrackVsPhi; - MonitorElement* NumberOfMORecHitsPerTrackVsTheta; - MonitorElement* NumberOfMORecHitsPerTrackVsEta; - MonitorElement* NumberOfMORecHitsPerTrackVsPt; - MonitorElement* NumberOfMORecHitVsPhiVsEtaPerTrack; - MonitorElement* NumberOfMORecHitVsPtVsEtaPerTrack; - - MonitorElement* NumberOfLayersPerTrackVsPhi; - MonitorElement* NumberOfLayersPerTrackVsTheta; - MonitorElement* NumberOfLayersPerTrackVsEta; - - MonitorElement* Chi2oNDFVsNHits; - MonitorElement* Chi2oNDFVsPt; - MonitorElement* Chi2oNDFVsEta; - MonitorElement* Chi2oNDFVsPhi; - MonitorElement* Chi2oNDFVsTheta; - - MonitorElement* Chi2ProbVsEta; - MonitorElement* Chi2ProbVsPhi; - MonitorElement* Chi2ProbVsTheta; - }; - std::map TkParameterMEMap; - - MonitorElement* NumberOfRecHitsPerTrack; - MonitorElement* NumberOfValidRecHitsPerTrack; - MonitorElement* NumberOfLostRecHitsPerTrack; - MonitorElement* NumberOfMIRecHitsPerTrack = nullptr; - MonitorElement* NumberOfMORecHitsPerTrack = nullptr; - - MonitorElement* NumberOfRecHitsPerTrackVsPhi = nullptr; - MonitorElement* NumberOfRecHitsPerTrackVsTheta = nullptr; - MonitorElement* NumberOfRecHitsPerTrackVsEta = nullptr; - MonitorElement* NumberOfRecHitVsPhiVsEtaPerTrack = nullptr; - - MonitorElement* NumberOfValidRecHitsPerTrackVsPhi = nullptr; - MonitorElement* NumberOfValidRecHitsPerTrackVsTheta = nullptr; - MonitorElement* NumberOfValidRecHitsPerTrackVsEta = nullptr; - MonitorElement* NumberOfValidRecHitsPerTrackVsPt = nullptr; - MonitorElement* NumberOfValidRecHitVsPhiVsEtaPerTrack = nullptr; - MonitorElement* NumberOfValidRecHitVsPtVsEtaPerTrack = nullptr; - - MonitorElement* NumberOfLostRecHitsPerTrackVsPhi = nullptr; - MonitorElement* NumberOfLostRecHitsPerTrackVsTheta = nullptr; - MonitorElement* NumberOfLostRecHitsPerTrackVsEta = nullptr; - MonitorElement* NumberOfLostRecHitsPerTrackVsPt = nullptr; - MonitorElement* NumberOfLostRecHitVsPhiVsEtaPerTrack = nullptr; - MonitorElement* NumberOfLostRecHitVsPtVsEtaPerTrack = nullptr; - - MonitorElement* NumberOfMIRecHitsPerTrackVsPhi = nullptr; - MonitorElement* NumberOfMIRecHitsPerTrackVsTheta = nullptr; - MonitorElement* NumberOfMIRecHitsPerTrackVsEta = nullptr; - MonitorElement* NumberOfMIRecHitsPerTrackVsPt = nullptr; - MonitorElement* NumberOfMIRecHitVsPhiVsEtaPerTrack = nullptr; - MonitorElement* NumberOfMIRecHitVsPtVsEtaPerTrack = nullptr; - - MonitorElement* NumberOfMORecHitsPerTrackVsPhi = nullptr; - MonitorElement* NumberOfMORecHitsPerTrackVsTheta = nullptr; - MonitorElement* NumberOfMORecHitsPerTrackVsEta = nullptr; - MonitorElement* NumberOfMORecHitsPerTrackVsPt = nullptr; - MonitorElement* NumberOfMORecHitVsPhiVsEtaPerTrack = nullptr; - MonitorElement* NumberOfMORecHitVsPtVsEtaPerTrack = nullptr; - - MonitorElement* ValidFractionPerTrack = nullptr; - MonitorElement* ValidFractionVsPhiVsEtaPerTrack = nullptr; - - MonitorElement* NumberOfLayersPerTrack[4] = {nullptr, nullptr, nullptr, nullptr}; - - MonitorElement* NumberOfLayersPerTrackVsPhi; - MonitorElement* NumberOfLayersPerTrackVsTheta; - MonitorElement* NumberOfLayersPerTrackVsEta; - - MonitorElement* NumberOfLayersVsPhiVsEtaPerTrack[5] = {nullptr, nullptr, nullptr, nullptr, nullptr}; - - MonitorElement* Chi2; - MonitorElement* Chi2Prob; - MonitorElement* Chi2oNDF; - - MonitorElement* Chi2oNDFVsNHits = nullptr; - MonitorElement* Chi2oNDFVsPt = nullptr; - MonitorElement* Chi2oNDFVsEta = nullptr; - MonitorElement* Chi2oNDFVsPhi; - MonitorElement* Chi2oNDFVsTheta; - - MonitorElement* Chi2ProbVsEta; - MonitorElement* Chi2ProbVsPhi; - MonitorElement* Chi2ProbVsTheta; - - MonitorElement* DistanceOfClosestApproach; - MonitorElement* DistanceOfClosestApproachError; - MonitorElement* DistanceOfClosestApproachErrorVsPt; - MonitorElement* DistanceOfClosestApproachErrorVsEta; - MonitorElement* DistanceOfClosestApproachErrorVsPhi; - MonitorElement* DistanceOfClosestApproachErrorVsDxy; - MonitorElement* DistanceOfClosestApproachToBS; - MonitorElement* AbsDistanceOfClosestApproachToBS; - MonitorElement* DistanceOfClosestApproachToPV; - MonitorElement* DistanceOfClosestApproachToPVZoom; - MonitorElement* DeltaZToPV; - MonitorElement* DeltaZToPVZoom; - MonitorElement* DistanceOfClosestApproachVsTheta; - MonitorElement* DistanceOfClosestApproachVsPhi; - MonitorElement* DistanceOfClosestApproachToBSVsPhi; - MonitorElement* DistanceOfClosestApproachToPVVsPhi; - MonitorElement* DistanceOfClosestApproachVsEta; - MonitorElement* xPointOfClosestApproach; - MonitorElement* xPointOfClosestApproachToPV; - MonitorElement* xPointOfClosestApproachVsZ0wrt000; - MonitorElement* xPointOfClosestApproachVsZ0wrtBS; - MonitorElement* xPointOfClosestApproachVsZ0wrtPV; - MonitorElement* yPointOfClosestApproach; - MonitorElement* yPointOfClosestApproachToPV; - MonitorElement* yPointOfClosestApproachVsZ0wrt000; - MonitorElement* yPointOfClosestApproachVsZ0wrtBS; - MonitorElement* yPointOfClosestApproachVsZ0wrtPV; - MonitorElement* zPointOfClosestApproach; - MonitorElement* zPointOfClosestApproachToPV; - MonitorElement* zPointOfClosestApproachVsPhi; - MonitorElement *algorithm, *oriAlgo; - MonitorElement* stoppingSource; - MonitorElement* stoppingSourceVSeta; - MonitorElement* stoppingSourceVSphi; - // TESTING MEs - MonitorElement* TESTDistanceOfClosestApproachToBS; - MonitorElement* TESTDistanceOfClosestApproachToBSVsPhi; - - // add by Mia in order to deal w/ LS transitions - MonitorElement* Chi2oNDF_lumiFlag; - MonitorElement* NumberOfRecHitsPerTrack_lumiFlag; - - //new plots for Heavy Ion DQM - MonitorElement* LongDCASig; - MonitorElement* TransDCASig; - MonitorElement* dNdPhi_HighPurity; - MonitorElement* dNdEta_HighPurity; - MonitorElement* dNdPt_HighPurity; - MonitorElement* NhitVsEta_HighPurity; - MonitorElement* NhitVsPhi_HighPurity; - MonitorElement* Ptdist_HighPurity; - MonitorElement* dNhitdPt_HighPurity; - - // IP significance plots - MonitorElement* sipDxyToBS; - MonitorElement* sipDzToBS; - MonitorElement* sip3dToPV; - MonitorElement* sip2dToPV; - MonitorElement* sipDxyToPV; - MonitorElement* sipDzToPV; - - struct TkRecHitsPerSubDetMEs { - MonitorElement* NumberOfRecHitsPerTrack; - MonitorElement* NumberOfRecHitsPerTrackVsPhi; - MonitorElement* NumberOfRecHitsPerTrackVsEta; - MonitorElement* NumberOfRecHitsPerTrackVsPt; - MonitorElement* NumberOfLayersPerTrack; - MonitorElement* NumberOfLayersPerTrackVsPhi; - MonitorElement* NumberOfLayersPerTrackVsEta; - MonitorElement* NumberOfLayersPerTrackVsPt; - MonitorElement* RecHitChi2PerTrack; - - int detectorId; - std::string detectorTag; - }; - std::map TkRecHitsPerSubDetMEMap; - - struct Key { - int det; - int subdet; - int monitoring; - explicit Key(int det, int subdet, int monitoring) : det(det), subdet(subdet), monitoring(monitoring){}; - bool operator==(const Key& other) const { - return (det == other.det && subdet == other.subdet && monitoring == other.monitoring); - } - }; - - struct KeyHasher { - std::size_t operator()(const Key& k) const { - // 3 bits (0x7) for kind of monitoring (7 kinds at most) - // next 8 bits to the subdetector (255 subdetectors at most) - // next 8 bits to the detector (255 detectors at most) - return (size_t)((k.monitoring & (0x7)) | ((k.subdet & (0xff)) << 3) | ((k.det & (0xff)) << 11)); - } - }; - - 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_; - unsigned int bx_; - float pixel_lumi_; - float scal_lumi_; - enum monQuantity { VsPU, VsBX, VsPIXELLUMI, VsSCALLUMI, END }; - std::string monName[monQuantity::END] = {"", "VsBX", "VsPIXELLUMI", "VsSCALLUMI"}; - - std::string histname; //for naming the histograms according to algorithm used - }; -} // namespace dqm +class TrackAnalyzer +{ + public: + TrackAnalyzer(const edm::ParameterSet&); + TrackAnalyzer(const edm::ParameterSet&, edm::ConsumesCollector& iC); + ~TrackAnalyzer(); + void initHisto(DQMStore::IBooker & ibooker, const edm::EventSetup &, const edm::ParameterSet&); + + void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track); + + void doSoftReset (DQMStore * dqmStore_); + 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 &); + void setBX(const edm::Event &); + void setLumi(const edm::Event &, const edm::EventSetup& iSetup); + + private: + void initHistos(); + void fillHistosForState(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname); + void bookHistosForState(std::string sname,DQMStore::IBooker & ibooker); + void bookHistosForHitProperties(DQMStore::IBooker & ibooker); + void bookHistosForLScertification(DQMStore::IBooker & ibooker); + void bookHistosForBeamSpot(DQMStore::IBooker & ibooker); + void bookHistosForTrackerSpecific(DQMStore::IBooker & ibooker); + void bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, const edm::EventSetup & iSetup, const std::string suffix, bool useInac); + 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); + void fillHistosForEfficiencyFromHitPatter(const reco::Track & track, const std::string suffix, const float monitoring,bool useInac); + + // ----------member data --------------------------- + std::string TopFolder_; + + edm::EDGetTokenT beamSpotToken_; + edm::EDGetTokenT pvToken_; + edm::EDGetTokenT > pixelClustersToken_; + edm::EDGetTokenT lumiscalersToken_; + float lumi_factor_per_bx_; + + edm::ParameterSet const* conf_; + + std::string stateName_; + + bool doTrackerSpecific_; + bool doAllPlots_; + bool doBSPlots_; + bool doPVPlots_; + bool doDCAPlots_; + bool doGeneralPropertiesPlots_; + bool doMeasurementStatePlots_; + bool doHitPropertiesPlots_; + bool doRecHitVsPhiVsEtaPerTrack_; + bool doRecHitVsPtVsEtaPerTrack_; + // ADD by Mia + bool doLayersVsPhiVsEtaPerTrack_; + bool doTrackRecHitVsPhiVsEtaPerTrack_; + bool doTrackRecHitVsPtVsEtaPerTrack_; + bool doTrackLayersVsPhiVsEtaPerTrack_; + bool doTrack2DChi2Plots_; + bool doRecHitsPerTrackProfile_; + // ADD by Mia in order to clean the tracking MEs + // do not plot *Theta* and TrackPx* and TrackPy* + bool doThetaPlots_; + bool doTrackPxPyPlots_; + // ADD by Mia in order to not plot DistanceOfClosestApproach w.r.t. (0,0,0) + // the DistanceOfClosestApproach w.r.t. the beam-spot is already shown in DistanceOfClosestApproachToBS + bool doDCAwrtPVPlots_; + bool doDCAwrt000Plots_; + + bool doLumiAnalysis_; + + // ADD by Mia in order to turnON test MEs + bool doTestPlots_; + + //For HI Plots + bool doHIPlots_; + + // IP significance plots + bool doSIPPlots_; + + // Compute the hit-finding efficiency using the HitPattern of + // the reconstructed tracks + bool doEffFromHitPatternVsPU_; + bool doEffFromHitPatternVsBX_; + bool doEffFromHitPatternVsLUMI_; + int pvNDOF_; + bool useBPixLayer1_; + int minNumberOfPixelsPerCluster_; + float minPixelClusterCharge_; + std::string qualityString_; + + struct TkParameterMEs { + TkParameterMEs() : + TrackP(nullptr) + , TrackPx(nullptr) + , TrackPy(nullptr) + , TrackPz(nullptr) + , TrackPt(nullptr) + + , TrackPxErr(nullptr) + , TrackPyErr(nullptr) + , TrackPzErr(nullptr) + , TrackPtErr(nullptr) + , TrackPErr(nullptr) + + , TrackPtErrVsEta(nullptr) + + , TrackQ(nullptr) + + , TrackPhi(nullptr) + , TrackEta(nullptr) + , TrackTheta(nullptr) + + , TrackPhiErr(nullptr) + , TrackEtaErr(nullptr) + , TrackThetaErr(nullptr) + + , NumberOfRecHitsPerTrackVsPhi(nullptr) + , NumberOfRecHitsPerTrackVsTheta(nullptr) + , NumberOfRecHitsPerTrackVsEta(nullptr) + , NumberOfRecHitVsPhiVsEtaPerTrack(nullptr) + + , NumberOfValidRecHitsPerTrackVsPhi(nullptr) + , NumberOfValidRecHitsPerTrackVsTheta(nullptr) + , NumberOfValidRecHitsPerTrackVsEta(nullptr) + , NumberOfValidRecHitsPerTrackVsPt(nullptr) + , NumberOfValidRecHitVsPhiVsEtaPerTrack(nullptr) + , NumberOfValidRecHitVsPtVsEtaPerTrack(nullptr) + + , NumberOfLostRecHitsPerTrackVsPhi(nullptr) + , NumberOfLostRecHitsPerTrackVsTheta(nullptr) + , NumberOfLostRecHitsPerTrackVsEta(nullptr) + , NumberOfLostRecHitsPerTrackVsPt(nullptr) + , NumberOfLostRecHitVsPhiVsEtaPerTrack(nullptr) + , NumberOfLostRecHitVsPtVsEtaPerTrack(nullptr) + + , NumberOfMIRecHitsPerTrackVsPhi(nullptr) + , NumberOfMIRecHitsPerTrackVsTheta(nullptr) + , NumberOfMIRecHitsPerTrackVsEta(nullptr) + , NumberOfMIRecHitsPerTrackVsPt(nullptr) + , NumberOfMIRecHitVsPhiVsEtaPerTrack(nullptr) + , NumberOfMIRecHitVsPtVsEtaPerTrack(nullptr) + + , NumberOfMORecHitsPerTrackVsPhi(nullptr) + , NumberOfMORecHitsPerTrackVsTheta(nullptr) + , NumberOfMORecHitsPerTrackVsEta(nullptr) + , NumberOfMORecHitsPerTrackVsPt(nullptr) + , NumberOfMORecHitVsPhiVsEtaPerTrack(nullptr) + , NumberOfMORecHitVsPtVsEtaPerTrack(nullptr) + + , NumberOfLayersPerTrackVsPhi(nullptr) + , NumberOfLayersPerTrackVsTheta(nullptr) + , NumberOfLayersPerTrackVsEta(nullptr) + + , Chi2oNDFVsNHits(nullptr) + , Chi2oNDFVsPt(nullptr) + , Chi2oNDFVsEta(nullptr) + , Chi2oNDFVsPhi(nullptr) + , Chi2oNDFVsTheta(nullptr) + + , Chi2ProbVsEta(nullptr) + , Chi2ProbVsPhi(nullptr) + , Chi2ProbVsTheta(nullptr) + {} + + MonitorElement* TrackP; + MonitorElement* TrackPx; + MonitorElement* TrackPy; + MonitorElement* TrackPz; + MonitorElement* TrackPt; + MonitorElement* TrackPtZone1; + MonitorElement* TrackPtZone2; + MonitorElement* TrackPtZone3; + MonitorElement* TrackPtZone4; + MonitorElement* TrackPtZone5; + MonitorElement* TrackPtZone6; + MonitorElement* TrackPtZone7; + MonitorElement* TrackPtZone8; + MonitorElement* Ratio_byFolding; + MonitorElement* Ratio_byFolding2; + MonitorElement* TrackPtHighPurity; + MonitorElement* TrackPtTight; + MonitorElement* TrackPtLoose; + MonitorElement* Quality; + + + MonitorElement* TrackPxErr; + MonitorElement* TrackPyErr; + MonitorElement* TrackPzErr; + MonitorElement* TrackPtErr; + MonitorElement* TrackPErr; + + MonitorElement* TrackPtErrVsEta; + + MonitorElement* TrackQ; + MonitorElement* TrackQoverP; + + + MonitorElement* TrackPhi; + MonitorElement* TrackEta; + MonitorElement* TrackEtaHighPurity; + MonitorElement* TrackEtaTight; + MonitorElement* TrackEtaLoose; + MonitorElement* TrackEtaPhi=nullptr; + MonitorElement* TrackEtaPhiInverted=nullptr; + MonitorElement* TrackEtaPhiInvertedoutofphase=nullptr; + MonitorElement* TkEtaPhi_Ratio_byFoldingmap=nullptr; + MonitorElement* TkEtaPhi_Ratio_byFoldingmap_op=nullptr; + MonitorElement* TkEtaPhi_RelativeDifference_byFoldingmap=nullptr; + MonitorElement* TkEtaPhi_RelativeDifference_byFoldingmap_op=nullptr; + MonitorElement* TrackEtaPhiInner=nullptr; + MonitorElement* TrackEtaPhiOuter=nullptr; + + MonitorElement* TrackTheta; + + MonitorElement* TrackPhiErr; + MonitorElement* TrackEtaErr; + MonitorElement* TrackThetaErr; + + MonitorElement* NumberOfRecHitsPerTrackVsPhi; + MonitorElement* NumberOfRecHitsPerTrackVsTheta; + MonitorElement* NumberOfRecHitsPerTrackVsEta; + MonitorElement* NumberOfRecHitVsPhiVsEtaPerTrack; + + MonitorElement* NumberOfValidRecHitsPerTrackVsPhi; + MonitorElement* NumberOfValidRecHitsPerTrackVsTheta; + MonitorElement* NumberOfValidRecHitsPerTrackVsEta; + MonitorElement* NumberOfValidRecHitsPerTrackVsPt; + MonitorElement* NumberOfValidRecHitVsPhiVsEtaPerTrack; + MonitorElement* NumberOfValidRecHitVsPtVsEtaPerTrack; + + MonitorElement* NumberOfLostRecHitsPerTrackVsPhi; + MonitorElement* NumberOfLostRecHitsPerTrackVsTheta; + MonitorElement* NumberOfLostRecHitsPerTrackVsEta; + MonitorElement* NumberOfLostRecHitsPerTrackVsPt; + MonitorElement* NumberOfLostRecHitVsPhiVsEtaPerTrack; + MonitorElement* NumberOfLostRecHitVsPtVsEtaPerTrack; + + MonitorElement* NumberOfMIRecHitsPerTrackVsPhi; + MonitorElement* NumberOfMIRecHitsPerTrackVsTheta; + MonitorElement* NumberOfMIRecHitsPerTrackVsEta; + MonitorElement* NumberOfMIRecHitsPerTrackVsPt; + MonitorElement* NumberOfMIRecHitVsPhiVsEtaPerTrack; + MonitorElement* NumberOfMIRecHitVsPtVsEtaPerTrack; + + MonitorElement* NumberOfMORecHitsPerTrackVsPhi; + MonitorElement* NumberOfMORecHitsPerTrackVsTheta; + MonitorElement* NumberOfMORecHitsPerTrackVsEta; + MonitorElement* NumberOfMORecHitsPerTrackVsPt; + MonitorElement* NumberOfMORecHitVsPhiVsEtaPerTrack; + MonitorElement* NumberOfMORecHitVsPtVsEtaPerTrack; + + MonitorElement* NumberOfLayersPerTrackVsPhi; + MonitorElement* NumberOfLayersPerTrackVsTheta; + MonitorElement* NumberOfLayersPerTrackVsEta; + + MonitorElement* Chi2oNDFVsNHits; + MonitorElement* Chi2oNDFVsPt; + MonitorElement* Chi2oNDFVsEta; + MonitorElement* Chi2oNDFVsPhi; + MonitorElement* Chi2oNDFVsTheta; + + MonitorElement* Chi2ProbVsEta; + MonitorElement* Chi2ProbVsPhi; + MonitorElement* Chi2ProbVsTheta; + + }; + std::map TkParameterMEMap; + + + MonitorElement* NumberOfRecHitsPerTrack; + MonitorElement* NumberOfValidRecHitsPerTrack; + MonitorElement* NumberOfLostRecHitsPerTrack; + MonitorElement* NumberOfMIRecHitsPerTrack = nullptr; + MonitorElement* NumberOfMORecHitsPerTrack = nullptr; + + + MonitorElement* NumberOfRecHitsPerTrackVsPhi = nullptr; + MonitorElement* NumberOfRecHitsPerTrackVsTheta = nullptr; + MonitorElement* NumberOfRecHitsPerTrackVsEta = nullptr; + MonitorElement* NumberOfRecHitVsPhiVsEtaPerTrack = nullptr; + + MonitorElement* NumberOfValidRecHitsPerTrackVsPhi = nullptr; + MonitorElement* NumberOfValidRecHitsPerTrackVsTheta = nullptr; + MonitorElement* NumberOfValidRecHitsPerTrackVsEta = nullptr; + MonitorElement* NumberOfValidRecHitsPerTrackVsPt = nullptr; + MonitorElement* NumberOfValidRecHitVsPhiVsEtaPerTrack = nullptr; + MonitorElement* NumberOfValidRecHitVsPtVsEtaPerTrack = nullptr; + + MonitorElement* NumberOfLostRecHitsPerTrackVsPhi = nullptr; + MonitorElement* NumberOfLostRecHitsPerTrackVsTheta = nullptr; + MonitorElement* NumberOfLostRecHitsPerTrackVsEta = nullptr; + MonitorElement* NumberOfLostRecHitsPerTrackVsPt = nullptr; + MonitorElement* NumberOfLostRecHitVsPhiVsEtaPerTrack = nullptr; + MonitorElement* NumberOfLostRecHitVsPtVsEtaPerTrack = nullptr; + + MonitorElement* NumberOfMIRecHitsPerTrackVsPhi = nullptr; + MonitorElement* NumberOfMIRecHitsPerTrackVsTheta = nullptr; + MonitorElement* NumberOfMIRecHitsPerTrackVsEta = nullptr; + MonitorElement* NumberOfMIRecHitsPerTrackVsPt = nullptr; + MonitorElement* NumberOfMIRecHitVsPhiVsEtaPerTrack = nullptr; + MonitorElement* NumberOfMIRecHitVsPtVsEtaPerTrack = nullptr; + + MonitorElement* NumberOfMORecHitsPerTrackVsPhi = nullptr; + MonitorElement* NumberOfMORecHitsPerTrackVsTheta = nullptr; + MonitorElement* NumberOfMORecHitsPerTrackVsEta = nullptr; + MonitorElement* NumberOfMORecHitsPerTrackVsPt = nullptr; + MonitorElement* NumberOfMORecHitVsPhiVsEtaPerTrack = nullptr; + MonitorElement* NumberOfMORecHitVsPtVsEtaPerTrack = nullptr; + + MonitorElement* ValidFractionPerTrack = nullptr; + MonitorElement* ValidFractionVsPhiVsEtaPerTrack = nullptr; + + + MonitorElement* NumberOfLayersPerTrack[4] = {nullptr,nullptr,nullptr,nullptr}; + + MonitorElement* NumberOfLayersPerTrackVsPhi; + MonitorElement* NumberOfLayersPerTrackVsTheta; + MonitorElement* NumberOfLayersPerTrackVsEta; + + MonitorElement* NumberOfLayersVsPhiVsEtaPerTrack[5]= {nullptr,nullptr,nullptr,nullptr,nullptr}; + + + MonitorElement* Chi2; + MonitorElement* Chi2Prob; + MonitorElement* Chi2oNDF; + + MonitorElement* Chi2oNDFVsNHits = nullptr; + MonitorElement* Chi2oNDFVsPt = nullptr; + MonitorElement* Chi2oNDFVsEta = nullptr; + MonitorElement* Chi2oNDFVsPhi; + MonitorElement* Chi2oNDFVsTheta; + + MonitorElement* Chi2ProbVsEta; + MonitorElement* Chi2ProbVsPhi; + MonitorElement* Chi2ProbVsTheta; + + MonitorElement* DistanceOfClosestApproach; + MonitorElement* DistanceOfClosestApproachError; + MonitorElement* DistanceOfClosestApproachErrorVsPt; + MonitorElement* DistanceOfClosestApproachErrorVsEta; + MonitorElement* DistanceOfClosestApproachErrorVsPhi; + MonitorElement* DistanceOfClosestApproachErrorVsDxy; + MonitorElement* DistanceOfClosestApproachToBS; + MonitorElement* DistanceOfClosestApproachToBSdz; + MonitorElement* AbsDistanceOfClosestApproachToBS; + MonitorElement* DistanceOfClosestApproachToPV; + MonitorElement* DistanceOfClosestApproachToPVZoom; + MonitorElement* DeltaZToPV; + MonitorElement* DeltaZToPVZoom; + MonitorElement* DistanceOfClosestApproachVsTheta; + MonitorElement* DistanceOfClosestApproachVsPhi; + MonitorElement* DistanceOfClosestApproachToBSVsPhi; + MonitorElement* DistanceOfClosestApproachToBSVsEta; + MonitorElement* DistanceOfClosestApproachToPVVsPhi; + MonitorElement* DistanceOfClosestApproachVsEta; + MonitorElement* xPointOfClosestApproach; + MonitorElement* xPointOfClosestApproachToPV; + MonitorElement* xPointOfClosestApproachVsZ0wrt000; + MonitorElement* xPointOfClosestApproachVsZ0wrtBS; + MonitorElement* xPointOfClosestApproachVsZ0wrtPV; + MonitorElement* yPointOfClosestApproach; + MonitorElement* yPointOfClosestApproachToPV; + MonitorElement* yPointOfClosestApproachVsZ0wrt000; + MonitorElement* yPointOfClosestApproachVsZ0wrtBS; + MonitorElement* yPointOfClosestApproachVsZ0wrtPV; + MonitorElement* zPointOfClosestApproach; + MonitorElement* zPointOfClosestApproachToPV; + MonitorElement* zPointOfClosestApproachVsPhi; + MonitorElement *algorithm, *oriAlgo; + MonitorElement *stoppingSource; + MonitorElement *stoppingSourceVSeta; + MonitorElement *stoppingSourceVSphi; + // TESTING MEs + MonitorElement* TESTDistanceOfClosestApproachToBS; + MonitorElement* TESTDistanceOfClosestApproachToBSVsPhi; + + // add by Mia in order to deal w/ LS transitions + MonitorElement* Chi2oNDF_lumiFlag; + MonitorElement* NumberOfRecHitsPerTrack_lumiFlag; + + //new plots for Heavy Ion DQM + MonitorElement* LongDCASig; + MonitorElement* TransDCASig; + MonitorElement* dNdPhi_HighPurity; + MonitorElement* dNdEta_HighPurity; + MonitorElement* dNdPt_HighPurity; + MonitorElement* NhitVsEta_HighPurity; + MonitorElement* NhitVsPhi_HighPurity; + MonitorElement* Ptdist_HighPurity; + MonitorElement* dNhitdPt_HighPurity; + + // IP significance plots + MonitorElement *sipDxyToBS; + MonitorElement *sipDzToBS; + MonitorElement *sip3dToPV; + MonitorElement *sip2dToPV; + MonitorElement *sipDxyToPV; + MonitorElement *sipDzToPV; + + struct TkRecHitsPerSubDetMEs { + MonitorElement* NumberOfRecHitsPerTrack; + MonitorElement* NumberOfRecHitsPerTrackVsPhi; + MonitorElement* NumberOfRecHitsPerTrackVsEta; + MonitorElement* NumberOfRecHitsPerTrackVsPt; + MonitorElement* NumberOfLayersPerTrack; + MonitorElement* NumberOfLayersPerTrackVsPhi; + MonitorElement* NumberOfLayersPerTrackVsEta; + MonitorElement* NumberOfLayersPerTrackVsPt; + MonitorElement* RecHitChi2PerTrack; + + int detectorId; + std::string detectorTag; + }; + std::map TkRecHitsPerSubDetMEMap; + + struct Key { + int det; + int subdet; + int monitoring; + explicit Key(int det, int subdet,int monitoring):det(det),subdet(subdet),monitoring(monitoring){}; + bool operator==(const Key & other) const { + return (det == other.det && subdet == other.subdet && monitoring == other.monitoring); + } + }; + + struct KeyHasher { + std::size_t operator()(const Key& k) const { + // 3 bits (0x7) for kind of monitoring (7 kinds at most) + // next 8 bits to the subdetector (255 subdetectors at most) + // next 8 bits to the detector (255 detectors at most) + return (size_t)( + (k.monitoring & (0x7)) | + ((k.subdet & (0xff)) << 3) | + ((k.det & (0xff)) << 11)); + } + }; + + 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_; + unsigned int bx_; + float pixel_lumi_; + float scal_lumi_; + enum monQuantity { + VsPU, + VsBX, + VsPIXELLUMI, + VsSCALLUMI, + END + }; + std::string monName[monQuantity::END] = { "", "VsBX", "VsPIXELLUMI", "VsSCALLUMI" }; + + std::string histname; //for naming the histograms according to algorithm used +}; +} #endif diff --git a/DQM/TrackingMonitor/interface/TrackingMonitor.h b/DQM/TrackingMonitor/interface/TrackingMonitor.h index c3fcca9fc0275..23f3e33d54ce1 100644 --- a/DQM/TrackingMonitor/interface/TrackingMonitor.h +++ b/DQM/TrackingMonitor/interface/TrackingMonitor.h @@ -4,7 +4,7 @@ // // Package: TrackingMonitor // Class: TrackingMonitor -// +// /**\class TrackingMonitor TrackingMonitor.cc DQM/TrackerMonitorTrack/src/TrackingMonitor.cc Monitoring source for general quantities related to tracks. */ @@ -30,8 +30,8 @@ Monitoring source for general quantities related to tracks. #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" -#include "DataFormats/TrackCandidate/interface/TrackCandidate.h" +#include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" +#include "DataFormats/TrackCandidate/interface/TrackCandidate.h" #include "DataFormats/TrackReco/interface/SeedStopInfo.h" @@ -57,170 +57,177 @@ class GetLumi; class TProfile; class GenericTriggerEventFlag; -class TrackingMonitor : public one::DQMEDAnalyzer { -public: - using MVACollection = std::vector; - using QualityMaskCollection = std::vector; - - explicit TrackingMonitor(const edm::ParameterSet&); - ~TrackingMonitor() override; - - virtual void setMaxMinBin( - std::vector&, std::vector&, std::vector&, double, double, int, double, double, int); - virtual void setNclus(const edm::Event&, std::vector&); - - void beginLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& eSetup) override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; - // virtual void beginRun(const edm::Run&, const edm::EventSetup&); - void endRun(const edm::Run&, const edm::EventSetup&) override; - -private: - void doProfileX(TH2* th2, MonitorElement* me); - void doProfileX(MonitorElement* th2m, MonitorElement* me); - - // ----------member data --------------------------- - - std::string MEFolderName; - std::string histname; //for naming the histograms according to algorithm used - - // DQMStore * dqmStore_; - - edm::ParameterSetID confID_; - - // the track analyzer - edm::InputTag bsSrc_; - edm::InputTag pvSrc_; - edm::EDGetTokenT bsSrcToken_; - edm::EDGetTokenT pvSrcToken_; - - edm::EDGetTokenT > allTrackToken_; - edm::EDGetTokenT > trackToken_; - edm::EDGetTokenT trackCandidateToken_; - edm::EDGetTokenT > seedToken_; - edm::EDGetTokenT > seedStopInfoToken_; - edm::EDGetTokenT > regionToken_; - edm::EDGetTokenT regionLayerSetsToken_; - edm::EDGetTokenT regionCandidateToken_; - - edm::EDGetTokenT lumiscalersToken_; - - edm::InputTag stripClusterInputTag_; - edm::InputTag pixelClusterInputTag_; - edm::EDGetTokenT > stripClustersToken_; - edm::EDGetTokenT > pixelClustersToken_; - - std::vector, edm::EDGetTokenT > > mvaQualityTokens_; - edm::EDGetTokenT > mvaTrackToken_; - - std::string Quality_; - std::string AlgoName_; - - dqm::TrackAnalyzer* theTrackAnalyzer; - TrackBuildingAnalyzer* theTrackBuildingAnalyzer; - std::vector theVertexMonitor; - GetLumi* theLumiDetails_; - - // Tracks - MonitorElement* NumberOfTracks; - MonitorElement* NumberOfMeanRecHitsPerTrack; - MonitorElement* NumberOfMeanLayersPerTrack; - - // Good Tracks - MonitorElement* FractionOfGoodTracks; - - // Tracking regions - MonitorElement* NumberOfTrackingRegions; - - // Track Seeds - MonitorElement* NumberOfSeeds; - MonitorElement* NumberOfSeeds_lumiFlag; - std::vector SeedsVsClusters; - std::vector ClusterLabels; - - // Track Candidates - MonitorElement* NumberOfTrackCandidates; - MonitorElement* FractionCandidatesOverSeeds; - - // Cluster Properties - std::vector NumberOfTrkVsClusters; - MonitorElement* NumberOfTrkVsClus; - MonitorElement* NumberOfTrkVsStripClus; - MonitorElement* NumberOfTrkVsPixelClus; - - // Monitoring vs LS - MonitorElement* NumberEventsOfVsLS; - MonitorElement* NumberOfTracksVsLS; - MonitorElement* GoodTracksFractionVsLS; - MonitorElement* NumberOfRecHitsPerTrackVsLS; - MonitorElement* NumberOfGoodPVtxVsLS; - MonitorElement* NumberOfGoodPVtxWO0VsLS; - - // Monitoring vs BX - MonitorElement* NumberEventsOfVsBX; - MonitorElement* NumberOfTracksVsBX; - MonitorElement* GoodTracksFractionVsBX; - MonitorElement* NumberOfRecHitsPerTrackVsBX; - MonitorElement* NumberOfGoodPVtxVsBX; - MonitorElement* NumberOfGoodPVtxWO0VsBX; - - MonitorElement* NumberOfTracksVsBXlumi; - - // Monitoring PU - MonitorElement* NumberOfTracksVsGoodPVtx; - MonitorElement* NumberOfTracksVsPUPVtx; - MonitorElement* NumberEventsOfVsGoodPVtx; - MonitorElement* GoodTracksFractionVsGoodPVtx; - MonitorElement* NumberOfRecHitsPerTrackVsGoodPVtx; - MonitorElement* NumberOfPVtxVsGoodPVtx; - MonitorElement* NumberOfPixelClustersVsGoodPVtx; - MonitorElement* NumberOfStripClustersVsGoodPVtx; - - // Monitoring vs lumi - MonitorElement* NumberEventsOfVsLUMI; - MonitorElement* NumberOfTracksVsLUMI; - MonitorElement* GoodTracksFractionVsLUMI; - MonitorElement* NumberOfRecHitsPerTrackVsLUMI; - MonitorElement* NumberOfGoodPVtxVsLUMI; - MonitorElement* NumberOfGoodPVtxWO0VsLUMI; - MonitorElement* NumberOfPixelClustersVsLUMI; - MonitorElement* NumberOfStripClustersVsLUMI; - - // add in order to deal with LS transitions - MonitorElement* NumberOfTracks_lumiFlag; - - std::string builderName; - edm::ESHandle theTTRHBuilder; - - bool doTrackerSpecific_; - bool doLumiAnalysis; - bool doProfilesVsLS_; - bool doAllSeedPlots; - bool doAllPlots; - bool doDCAPlots_; - bool doGeneralPropertiesPlots_; - bool doHitPropertiesPlots_; - bool doTkCandPlots; - bool doMVAPlots; - bool doRegionPlots; - bool doRegionCandidatePlots; - bool doSeedNumberPlot; - bool doSeedLumiAnalysis_; - bool doSeedVsClusterPlot; - bool runTrackBuildingAnalyzerForSeed; - // ADD by Mia in order to have GoodTrack plots only for collision - bool doPUmonitoring_; - bool doPlotsVsBXlumi_; - bool doPlotsVsGoodPVtx_; - bool doPlotsVsLUMI_; - bool doPlotsVsBX_; - bool doFractionPlot_; - - GenericTriggerEventFlag* genTriggerEventFlag_; - - StringCutObjectSelector numSelection_; - StringCutObjectSelector denSelection_; - int pvNDOF_; +class TrackingMonitor : public one::DQMEDAnalyzer +{ + public: + using MVACollection = std::vector; + using QualityMaskCollection = std::vector; + + explicit TrackingMonitor(const edm::ParameterSet&); + ~TrackingMonitor() override; + + virtual void setMaxMinBin(std::vector & ,std::vector & ,std::vector & ,double, double, int, double, double, int); + virtual void setNclus(const edm::Event&, std::vector & ); + + void beginLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& eSetup) override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + // virtual void beginRun(const edm::Run&, const edm::EventSetup&); + void endRun(const edm::Run&, const edm::EventSetup&) override; + + private: + void doProfileX(TH2 * th2, MonitorElement* me); + void doProfileX(MonitorElement * th2m, MonitorElement* me); + + + // ----------member data --------------------------- + + std::string MEFolderName; + std::string histname; //for naming the histograms according to algorithm used + + // DQMStore * dqmStore_; + + edm::ParameterSetID confID_; + + // the track analyzer + edm::InputTag bsSrc_; + edm::InputTag pvSrc_; + edm::EDGetTokenT bsSrcToken_; + edm::EDGetTokenT pvSrcToken_; + + edm::EDGetTokenT > allTrackToken_; + edm::EDGetTokenT > trackToken_; + edm::EDGetTokenT trackCandidateToken_; + edm::EDGetTokenT > seedToken_; + edm::EDGetTokenT > seedStopInfoToken_; + edm::EDGetTokenT > regionToken_; + edm::EDGetTokenT regionLayerSetsToken_; + edm::EDGetTokenT regionCandidateToken_; + + edm::EDGetTokenT lumiscalersToken_; + + edm::InputTag stripClusterInputTag_; + edm::InputTag pixelClusterInputTag_; + edm::EDGetTokenT > stripClustersToken_; + edm::EDGetTokenT > pixelClustersToken_; + + std::vector, edm::EDGetTokenT > > mvaQualityTokens_; + edm::EDGetTokenT > mvaTrackToken_; + + std::string Quality_; + std::string AlgoName_; + + + dqm::TrackAnalyzer * theTrackAnalyzer; + TrackBuildingAnalyzer * theTrackBuildingAnalyzer; + std::vector theVertexMonitor; + GetLumi* theLumiDetails_; + + // Tracks + MonitorElement * NumberOfTracks; + MonitorElement * NumberOfTracks_PUvtx; + MonitorElement * NumberofTracks_Hardvtx; + MonitorElement * NumberofTracks_Hardvtx_PUvtx; + MonitorElement * NumberOfMeanRecHitsPerTrack; + MonitorElement * NumberOfMeanLayersPerTrack; + + // Good Tracks + MonitorElement * FractionOfGoodTracks; + + // Tracking regions + MonitorElement * NumberOfTrackingRegions; + + // Track Seeds + MonitorElement * NumberOfSeeds; + MonitorElement * NumberOfSeeds_lumiFlag; + std::vector SeedsVsClusters; + std::vector ClusterLabels; + + + // Track Candidates + MonitorElement * NumberOfTrackCandidates; + MonitorElement * FractionCandidatesOverSeeds; + + // Cluster Properties + std::vector NumberOfTrkVsClusters; + MonitorElement* NumberOfTrkVsClus; + MonitorElement* NumberOfTrkVsStripClus; + MonitorElement* NumberOfTrkVsPixelClus; + + // Monitoring vs LS + MonitorElement* NumberEventsOfVsLS; + MonitorElement* NumberOfTracksVsLS; + MonitorElement* GoodTracksFractionVsLS; + MonitorElement* NumberOfRecHitsPerTrackVsLS; + MonitorElement* NumberOfGoodPVtxVsLS; + MonitorElement* NumberOfGoodPVtxWO0VsLS; + + // Monitoring vs BX + MonitorElement* NumberEventsOfVsBX; + MonitorElement* NumberOfTracksVsBX; + MonitorElement* GoodTracksFractionVsBX; + MonitorElement* NumberOfRecHitsPerTrackVsBX; + MonitorElement* NumberOfGoodPVtxVsBX; + MonitorElement* NumberOfGoodPVtxWO0VsBX; + + MonitorElement* NumberOfTracksVsBXlumi; + + // Monitoring PU + MonitorElement *NumberOfTracksVsGoodPVtx; + MonitorElement* NumberOfTracksVsPUPVtx; + MonitorElement* NumberEventsOfVsGoodPVtx; + MonitorElement* GoodTracksFractionVsGoodPVtx; + MonitorElement* NumberOfRecHitsPerTrackVsGoodPVtx; + MonitorElement* NumberOfPVtxVsGoodPVtx; + MonitorElement* NumberOfPixelClustersVsGoodPVtx; + MonitorElement* NumberOfStripClustersVsGoodPVtx; + + // Monitoring vs lumi + MonitorElement* NumberEventsOfVsLUMI; + MonitorElement* NumberOfTracksVsLUMI; + MonitorElement* GoodTracksFractionVsLUMI; + MonitorElement* NumberOfRecHitsPerTrackVsLUMI; + MonitorElement* NumberOfGoodPVtxVsLUMI; + MonitorElement* NumberOfGoodPVtxWO0VsLUMI; + MonitorElement* NumberOfPixelClustersVsLUMI; + MonitorElement* NumberOfStripClustersVsLUMI; + + // add in order to deal with LS transitions + MonitorElement * NumberOfTracks_lumiFlag; + + std::string builderName; + edm::ESHandle theTTRHBuilder; + + bool doTrackerSpecific_; + bool doLumiAnalysis; + bool doProfilesVsLS_; + bool doAllSeedPlots; + bool doAllPlots; + bool doDCAPlots_; + bool doGeneralPropertiesPlots_; + bool doHitPropertiesPlots_; + bool doTkCandPlots; + bool doMVAPlots; + bool doRegionPlots; + bool doRegionCandidatePlots; + bool doSeedNumberPlot; + bool doSeedLumiAnalysis_; + bool doSeedVsClusterPlot; + bool runTrackBuildingAnalyzerForSeed; + // ADD by Mia in order to have GoodTrack plots only for collision + bool doPUmonitoring_; + bool doPlotsVsBXlumi_; + bool doPlotsVsGoodPVtx_; + bool doPlotsVsLUMI_; + bool doPlotsVsBX_; + bool doFractionPlot_; + + GenericTriggerEventFlag* genTriggerEventFlag_; + + StringCutObjectSelector numSelection_; + StringCutObjectSelector denSelection_; + int pvNDOF_; + }; -#endif //define TrackingMonitor_H +#endif //define TrackingMonitor_H diff --git a/DQM/TrackingMonitor/src/TrackAnalyzer.cc b/DQM/TrackingMonitor/src/TrackAnalyzer.cc index aed129a798467..e4bac1cbe380c 100644 --- a/DQM/TrackingMonitor/src/TrackAnalyzer.cc +++ b/DQM/TrackingMonitor/src/TrackAnalyzer.cc @@ -25,76 +25,82 @@ using namespace dqm; namespace { template - std::array makeLogBins(const double min, const double max) { + std::array makeLogBins(const double min, const double max) { const double minLog10 = std::log10(min); const double maxLog10 = std::log10(max); - const double width = (maxLog10 - minLog10) / N; - std::array ret; - ret[0] = std::pow(10, minLog10); + const double width = (maxLog10-minLog10)/N; + std::array ret; + ret[0] = std::pow(10,minLog10); const double mult = std::pow(10, width); - for (size_t i = 1; i <= N; ++i) { - ret[i] = ret[i - 1] * mult; + for(size_t i=1; i<= N; ++i) { + ret[i] = ret[i-1]*mult; } return ret; } -} // namespace - -TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig) - : conf_(nullptr), - stateName_(iConfig.getParameter("MeasurementState")), - doTrackerSpecific_(iConfig.getParameter("doTrackerSpecific")), - doAllPlots_(iConfig.getParameter("doAllPlots")), - doBSPlots_(iConfig.getParameter("doBeamSpotPlots")), - doPVPlots_(iConfig.getParameter("doPrimaryVertexPlots")), - doDCAPlots_(iConfig.getParameter("doDCAPlots")), - doGeneralPropertiesPlots_(iConfig.getParameter("doGeneralPropertiesPlots")), - doMeasurementStatePlots_(iConfig.getParameter("doMeasurementStatePlots")), - doHitPropertiesPlots_(iConfig.getParameter("doHitPropertiesPlots")), - doRecHitVsPhiVsEtaPerTrack_(iConfig.getParameter("doRecHitVsPhiVsEtaPerTrack")), - doRecHitVsPtVsEtaPerTrack_(iConfig.getParameter("doRecHitVsPtVsEtaPerTrack")), - doLayersVsPhiVsEtaPerTrack_(iConfig.getParameter("doLayersVsPhiVsEtaPerTrack")), - doRecHitsPerTrackProfile_(iConfig.getParameter("doRecHitsPerTrackProfile")), - doThetaPlots_(iConfig.getParameter("doThetaPlots")), - doTrackPxPyPlots_(iConfig.getParameter("doTrackPxPyPlots")), - doDCAwrtPVPlots_(iConfig.getParameter("doDCAwrtPVPlots")), - doDCAwrt000Plots_(iConfig.getParameter("doDCAwrt000Plots")), - doLumiAnalysis_(iConfig.getParameter("doLumiAnalysis")), - doTestPlots_(iConfig.getParameter("doTestPlots")), - doHIPlots_(iConfig.getParameter("doHIPlots")), - doSIPPlots_(iConfig.getParameter("doSIPPlots")), - doEffFromHitPatternVsPU_(iConfig.getParameter("doEffFromHitPatternVsPU")), - doEffFromHitPatternVsBX_(iConfig.getParameter("doEffFromHitPatternVsBX")), - doEffFromHitPatternVsLUMI_(iConfig.getParameter("doEffFromHitPatternVsLUMI")), - pvNDOF_(iConfig.getParameter("pvNDOF")), - useBPixLayer1_(iConfig.getParameter("useBPixLayer1")), - minNumberOfPixelsPerCluster_(iConfig.getParameter("minNumberOfPixelsPerCluster")), - minPixelClusterCharge_(iConfig.getParameter("minPixelClusterCharge")), - qualityString_(iConfig.getParameter("qualityString")), - good_vertices_(0), - bx_(0), - pixel_lumi_(0.), - scal_lumi_(0.) { +} + +TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig) + : conf_( nullptr ) + , stateName_ (iConfig.getParameter("MeasurementState") ) + , doTrackerSpecific_ ( iConfig.getParameter("doTrackerSpecific") ) + , doAllPlots_ ( iConfig.getParameter("doAllPlots") ) + , doBSPlots_ ( iConfig.getParameter("doBeamSpotPlots") ) + , doPVPlots_ ( iConfig.getParameter("doPrimaryVertexPlots") ) + , doDCAPlots_ ( iConfig.getParameter("doDCAPlots") ) + , doGeneralPropertiesPlots_ ( iConfig.getParameter("doGeneralPropertiesPlots") ) + , doMeasurementStatePlots_ ( iConfig.getParameter("doMeasurementStatePlots") ) + , doHitPropertiesPlots_ ( iConfig.getParameter("doHitPropertiesPlots") ) + , doRecHitVsPhiVsEtaPerTrack_ ( iConfig.getParameter("doRecHitVsPhiVsEtaPerTrack") ) + , doRecHitVsPtVsEtaPerTrack_ ( iConfig.getParameter("doRecHitVsPtVsEtaPerTrack") ) + , doLayersVsPhiVsEtaPerTrack_ ( iConfig.getParameter("doLayersVsPhiVsEtaPerTrack") ) + , doRecHitsPerTrackProfile_ ( iConfig.getParameter("doRecHitsPerTrackProfile") ) + , doThetaPlots_ ( iConfig.getParameter("doThetaPlots") ) + , doTrackPxPyPlots_ ( iConfig.getParameter("doTrackPxPyPlots") ) + , doDCAwrtPVPlots_ ( iConfig.getParameter("doDCAwrtPVPlots") ) + , doDCAwrt000Plots_ ( iConfig.getParameter("doDCAwrt000Plots") ) + , doLumiAnalysis_ ( iConfig.getParameter("doLumiAnalysis") ) + , doTestPlots_ ( iConfig.getParameter("doTestPlots") ) + , doHIPlots_ ( iConfig.getParameter("doHIPlots") ) + , doSIPPlots_ ( iConfig.getParameter("doSIPPlots") ) + , doEffFromHitPatternVsPU_ ( iConfig.getParameter("doEffFromHitPatternVsPU") ) + , doEffFromHitPatternVsBX_ ( iConfig.getParameter("doEffFromHitPatternVsBX") ) + , doEffFromHitPatternVsLUMI_ ( iConfig.getParameter("doEffFromHitPatternVsLUMI") ) + , pvNDOF_ ( iConfig.getParameter ("pvNDOF") ) + , useBPixLayer1_ ( iConfig.getParameter("useBPixLayer1") ) + , minNumberOfPixelsPerCluster_ ( iConfig.getParameter("minNumberOfPixelsPerCluster") ) + , minPixelClusterCharge_ ( iConfig.getParameter("minPixelClusterCharge") ) + , qualityString_ ( iConfig.getParameter("qualityString")) + , good_vertices_(0) + , bx_(0) + , pixel_lumi_(0.) + , scal_lumi_(0.) +{ initHistos(); - TopFolder_ = iConfig.getParameter("FolderName"); + TopFolder_ = iConfig.getParameter("FolderName"); } -TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig, edm::ConsumesCollector& iC) : TrackAnalyzer(iConfig) { - edm::InputTag bsSrc = iConfig.getParameter("beamSpot"); +TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig, edm::ConsumesCollector& iC) + : TrackAnalyzer(iConfig) +{ + edm::InputTag bsSrc = iConfig.getParameter("beamSpot"); edm::InputTag primaryVertexInputTag = iConfig.getParameter("primaryVertex"); - edm::InputTag pixelClusterInputTag = iConfig.getParameter("pixelCluster4lumi"); - edm::InputTag scalInputTag = iConfig.getParameter("scal"); - beamSpotToken_ = iC.consumes(bsSrc); - pvToken_ = iC.consumes(primaryVertexInputTag); + edm::InputTag pixelClusterInputTag = iConfig.getParameter("pixelCluster4lumi"); + edm::InputTag scalInputTag = iConfig.getParameter("scal"); + beamSpotToken_ = iC.consumes(bsSrc); + pvToken_ = iC.consumes(primaryVertexInputTag); pixelClustersToken_ = iC.mayConsume >(pixelClusterInputTag); - lumiscalersToken_ = iC.mayConsume(scalInputTag); - - if (useBPixLayer1_) - lumi_factor_per_bx_ = GetLumi::FREQ_ORBIT * GetLumi::SECONDS_PER_LS / GetLumi::XSEC_PIXEL_CLUSTER; + lumiscalersToken_ = iC.mayConsume(scalInputTag); + + if(useBPixLayer1_) + lumi_factor_per_bx_ = GetLumi::FREQ_ORBIT * GetLumi::SECONDS_PER_LS / GetLumi::XSEC_PIXEL_CLUSTER ; else - lumi_factor_per_bx_ = GetLumi::FREQ_ORBIT * GetLumi::SECONDS_PER_LS / GetLumi::rXSEC_PIXEL_CLUSTER; + lumi_factor_per_bx_ = GetLumi::FREQ_ORBIT * GetLumi::SECONDS_PER_LS / GetLumi::rXSEC_PIXEL_CLUSTER ; + + } -void TrackAnalyzer::initHistos() { +void TrackAnalyzer::initHistos() +{ Chi2 = nullptr; Chi2Prob = nullptr; Chi2ProbVsPhi = nullptr; @@ -103,7 +109,7 @@ void TrackAnalyzer::initHistos() { Chi2oNDFVsEta = nullptr; Chi2oNDFVsPhi = nullptr; Chi2oNDFVsTheta = nullptr; - + NumberOfRecHitsPerTrack = nullptr; NumberOfValidRecHitsPerTrack = nullptr; NumberOfLostRecHitsPerTrack = nullptr; @@ -124,14 +130,16 @@ void TrackAnalyzer::initHistos() { DistanceOfClosestApproachErrorVsPhi = nullptr; DistanceOfClosestApproachErrorVsDxy = nullptr; DistanceOfClosestApproachToBS = nullptr; + DistanceOfClosestApproachToBSdz = nullptr; AbsDistanceOfClosestApproachToBS = nullptr; DistanceOfClosestApproachToPV = nullptr; DistanceOfClosestApproachToPVZoom = nullptr; DeltaZToPV = nullptr; DeltaZToPVZoom = nullptr; DistanceOfClosestApproachVsTheta = nullptr; - DistanceOfClosestApproachVsPhi = nullptr; + DistanceOfClosestApproachVsPhi = nullptr; DistanceOfClosestApproachToBSVsPhi = nullptr; + DistanceOfClosestApproachToBSVsEta = nullptr; DistanceOfClosestApproachToPVVsPhi = nullptr; DistanceOfClosestApproachVsEta = nullptr; xPointOfClosestApproach = nullptr; @@ -147,17 +155,17 @@ void TrackAnalyzer::initHistos() { stoppingSource = nullptr; stoppingSourceVSeta = nullptr; stoppingSourceVSphi = nullptr; - // TESTING + // TESTING TESTDistanceOfClosestApproachToBS = nullptr; TESTDistanceOfClosestApproachToBSVsPhi = nullptr; - // by Mia in order to deal w/ LS transitions +// by Mia in order to deal w/ LS transitions Chi2oNDF_lumiFlag = nullptr; NumberOfRecHitsPerTrack_lumiFlag = nullptr; - //////////////////////////////////////////////////////////// - //special Plots for HI DQM //SHOULD I ADD THE BOOL HERE?? - //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// + //special Plots for HI DQM //SHOULD I ADD THE BOOL HERE?? + //////////////////////////////////////////////////////////// LongDCASig = nullptr; TransDCASig = nullptr; dNdPhi_HighPurity = nullptr; @@ -173,43 +181,45 @@ void TrackAnalyzer::initHistos() { sip2dToPV = nullptr; sipDxyToPV = nullptr; sipDzToPV = nullptr; + } -TrackAnalyzer::~TrackAnalyzer() {} +TrackAnalyzer::~TrackAnalyzer() +{ +} -void TrackAnalyzer::initHisto(DQMStore::IBooker& ibooker, - const edm::EventSetup& iSetup, - const edm::ParameterSet& iConfig) { +void TrackAnalyzer::initHisto(DQMStore::IBooker & ibooker, const edm::EventSetup & iSetup, const edm::ParameterSet& iConfig) +{ conf_ = &iConfig; bookHistosForHitProperties(ibooker); bookHistosForBeamSpot(ibooker); - bookHistosForLScertification(ibooker); - if (doEffFromHitPatternVsPU_ || doAllPlots_) - bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "", false); - if (doEffFromHitPatternVsBX_ || doAllPlots_) - bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsBX", false); - if (doEffFromHitPatternVsLUMI_ || doAllPlots_) - bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsSCALLUMI", false); + bookHistosForLScertification( ibooker); + if (doEffFromHitPatternVsPU_ || doAllPlots_) bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "",false); + if (doEffFromHitPatternVsBX_ || doAllPlots_) bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsBX",false); + if (doEffFromHitPatternVsLUMI_ || doAllPlots_) bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsSCALLUMI",false); // if (doEffFromHitPatternVsLUMI_ || doAllPlots_) bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsPIXELLUMI"); - if (doEffFromHitPatternVsPU_ || doAllPlots_) - bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "", true); - if (doEffFromHitPatternVsLUMI_ || doAllPlots_) - bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsSCALLUMI", true); + if (doEffFromHitPatternVsPU_ || doAllPlots_) bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "",true); + if (doEffFromHitPatternVsLUMI_ || doAllPlots_) bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsSCALLUMI",true); // book tracker specific related histograms // ---------------------------------------------------------------------------------// - if (doTrackerSpecific_ || doAllPlots_) - bookHistosForTrackerSpecific(ibooker); - + if(doTrackerSpecific_ || doAllPlots_) bookHistosForTrackerSpecific(ibooker); + // book state related histograms // ---------------------------------------------------------------------------------// if (doMeasurementStatePlots_ || doAllPlots_) { + + if (stateName_ == "All") { bookHistosForState("OuterSurface", ibooker); bookHistosForState("InnerSurface", ibooker); - bookHistosForState("ImpactPoint", ibooker); - } else if (stateName_ != "OuterSurface" && stateName_ != "InnerSurface" && stateName_ != "ImpactPoint" && - stateName_ != "default") { + bookHistosForState("ImpactPoint" , ibooker); + } else if ( + stateName_ != "OuterSurface" && + stateName_ != "InnerSurface" && + stateName_ != "ImpactPoint" && + stateName_ != "default" + ) { bookHistosForState("default", ibooker); } else { @@ -219,868 +229,818 @@ void TrackAnalyzer::initHisto(DQMStore::IBooker& ibooker, } } -void TrackAnalyzer::bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker& ibooker, - const edm::EventSetup& iSetup, - const std::string suffix, - bool useInac) { - ibooker.setCurrentFolder(TopFolder_ + "/HitEffFromHitPattern" + (useInac ? "All" : "") + suffix); - - constexpr int LUMIBin = 300; // conf_->getParameter("LUMIBin"); - float LUMIMin = conf_->getParameter("LUMIMin"); - float LUMIMax = conf_->getParameter("LUMIMax"); - - int PVBin = conf_->getParameter("PVBin"); - float PVMin = conf_->getParameter("PVMin"); - float PVMax = conf_->getParameter("PVMax"); - - int NBINS[] = {PVBin, int(GetLumi::lastBunchCrossing), LUMIBin, LUMIBin}; - float MIN[] = {PVMin, 0.5, LUMIMin, LUMIMin}; - float MAX[] = {PVMax, float(GetLumi::lastBunchCrossing) + 0.5, LUMIMax, LUMIMax}; - std::string NAME[] = {"", "VsBX", "VsLUMI", "VsLUMI"}; - - auto logBins = makeLogBins(LUMIMin, LUMIMax); - - int mon = -1; - int nbins = -1; - float min = -1.; - float max = -1.; - bool logQ = false; - std::string name = ""; - for (int i = 0; i < monQuantity::END; i++) { - if (monName[i] == suffix) { - logQ = (i > 1); // VsLUMI - mon = i; - if (useInac) - mon += monQuantity::END; - nbins = NBINS[i]; - min = MIN[i]; - max = MAX[i]; - name = NAME[i]; +void TrackAnalyzer::bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, + const edm::EventSetup & iSetup, + const std::string suffix,bool useInac) +{ + + ibooker.setCurrentFolder(TopFolder_ + "/HitEffFromHitPattern" + (useInac ? "All" :"") + suffix); + + constexpr int LUMIBin = 300; // conf_->getParameter("LUMIBin"); + float LUMIMin = conf_->getParameter("LUMIMin"); + float LUMIMax = conf_->getParameter("LUMIMax"); + + int PVBin = conf_->getParameter ("PVBin"); + float PVMin = conf_->getParameter("PVMin"); + float PVMax = conf_->getParameter("PVMax"); + + + int NBINS[] = { PVBin, int(GetLumi::lastBunchCrossing), LUMIBin, LUMIBin}; + float MIN[] = { PVMin, 0.5, LUMIMin, LUMIMin }; + float MAX[] = { PVMax, float(GetLumi::lastBunchCrossing)+0.5, LUMIMax, LUMIMax }; + std::string NAME[] = { "", "VsBX", "VsLUMI", "VsLUMI" }; + + auto logBins = makeLogBins(LUMIMin,LUMIMax); + + int mon = -1; + int nbins = -1; + float min = -1.; + float max = -1.; + bool logQ = false; + std::string name = ""; + for (int i=0; i1); // VsLUMI + mon = i; + if (useInac) mon+=monQuantity::END; + nbins = NBINS[i]; + min = MIN[i]; + max = MAX[i]; + name = NAME[i]; + } } - } + + 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"}; - 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_%s_Subdet%d", name.c_str(), hit_category[cat], dets[det], sub_det); - switch (cat) { - case 0: - hits_valid_.insert(std::make_pair(Key(det, sub_det, mon), - logQ ? ibooker.book1D(title, title, nbins, &logBins[0]) - : ibooker.book1D(title, title, nbins, min, max))); - break; - case 4: - hits_total_.insert(std::make_pair(Key(det, sub_det, mon), - logQ ? ibooker.book1D(title, title, nbins, &logBins[0]) - : ibooker.book1D(title, title, nbins, min, max))); - break; - default: - LogDebug("TrackAnalyzer") << "Invalid hit category used " << cat << " ignored\n"; + // 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_%s_Subdet%d", name.c_str(), hit_category[cat], dets[det], sub_det); + switch(cat) { + case 0: + hits_valid_.insert(std::make_pair( + Key(det, sub_det, mon), logQ? + ibooker.book1D(title, title, nbins, &logBins[0]) : + ibooker.book1D(title, title, nbins, min, max))); + break; + case 4: + hits_total_.insert(std::make_pair( + Key(det, sub_det, mon), logQ? + ibooker.book1D(title, title, nbins, &logBins[0]) : + ibooker.book1D(title, title, nbins, min, max))); + break; + default: + LogDebug("TrackAnalyzer") << "Invalid hit category used " << cat << " ignored\n"; + } } } } - } } #include "DataFormats/TrackReco/interface/TrajectoryStopReasons.h" -void TrackAnalyzer::bookHistosForHitProperties(DQMStore::IBooker& ibooker) { - // parameters from the configuration - std::string QualName = conf_->getParameter("Quality"); - std::string AlgoName = conf_->getParameter("AlgoName"); - std::string MEBSFolderName = conf_->getParameter("BSFolderName"); - - // use the AlgoName and Quality Name - std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; - - // get binning from the configuration - int TKHitBin = conf_->getParameter("RecHitBin"); - double TKHitMin = conf_->getParameter("RecHitMin"); - double TKHitMax = conf_->getParameter("RecHitMax"); - - int TKLostBin = conf_->getParameter("RecLostBin"); - double TKLostMin = conf_->getParameter("RecLostMin"); - double TKLostMax = conf_->getParameter("RecLostMax"); - - int TKLayBin = conf_->getParameter("RecLayBin"); - double TKLayMin = conf_->getParameter("RecLayMin"); - double TKLayMax = conf_->getParameter("RecLayMax"); - - int PhiBin = conf_->getParameter("PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); - - int EtaBin = conf_->getParameter("EtaBin"); - double EtaMin = conf_->getParameter("EtaMin"); - double EtaMax = conf_->getParameter("EtaMax"); - - int PtBin = conf_->getParameter("TrackPtBin"); - double PtMin = conf_->getParameter("TrackPtMin"); - double PtMax = conf_->getParameter("TrackPtMax"); - - int Phi2DBin = conf_->getParameter("Phi2DBin"); - int Eta2DBin = conf_->getParameter("Eta2DBin"); - int Pt2DBin = conf_->getParameter("TrackPt2DBin"); +void TrackAnalyzer::bookHistosForHitProperties(DQMStore::IBooker & ibooker) { + + // parameters from the configuration + std::string QualName = conf_->getParameter("Quality"); + std::string AlgoName = conf_->getParameter("AlgoName"); + std::string MEBSFolderName = conf_->getParameter("BSFolderName"); - int VXBin = conf_->getParameter("VXBin"); - double VXMin = conf_->getParameter("VXMin"); - double VXMax = conf_->getParameter("VXMax"); + // use the AlgoName and Quality Name + std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; - int VYBin = conf_->getParameter("VYBin"); - double VYMin = conf_->getParameter("VYMin"); - double VYMax = conf_->getParameter("VYMax"); - - int VZBin = conf_->getParameter("VZBin"); - double VZMin = conf_->getParameter("VZMin"); - double VZMax = conf_->getParameter("VZMax"); - - ibooker.setCurrentFolder(TopFolder_); + // get binning from the configuration + int TKHitBin = conf_->getParameter( "RecHitBin"); + double TKHitMin = conf_->getParameter("RecHitMin"); + double TKHitMax = conf_->getParameter("RecHitMax"); - // book the Hit Property histograms - // ---------------------------------------------------------------------------------// + int TKLostBin = conf_->getParameter( "RecLostBin"); + double TKLostMin = conf_->getParameter("RecLostMin"); + double TKLostMax = conf_->getParameter("RecLostMax"); + + int TKLayBin = conf_->getParameter( "RecLayBin"); + double TKLayMin = conf_->getParameter("RecLayMin"); + double TKLayMax = conf_->getParameter("RecLayMax"); + + int PhiBin = conf_->getParameter( "PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); + + int EtaBin = conf_->getParameter( "EtaBin"); + double EtaMin = conf_->getParameter("EtaMin"); + double EtaMax = conf_->getParameter("EtaMax"); + + int PtBin = conf_->getParameter( "TrackPtBin"); + double PtMin = conf_->getParameter("TrackPtMin"); + double PtMax = conf_->getParameter("TrackPtMax"); + + int Phi2DBin = conf_->getParameter( "Phi2DBin"); + int Eta2DBin = conf_->getParameter( "Eta2DBin"); + int Pt2DBin = conf_->getParameter( "TrackPt2DBin"); + + int VXBin = conf_->getParameter( "VXBin"); + double VXMin = conf_->getParameter("VXMin"); + double VXMax = conf_->getParameter("VXMax"); + + int VYBin = conf_->getParameter( "VYBin"); + double VYMin = conf_->getParameter("VYMin"); + double VYMax = conf_->getParameter("VYMax"); + + int VZBin = conf_->getParameter( "VZBin"); + double VZMin = conf_->getParameter("VZMin"); + double VZMax = conf_->getParameter("VZMax"); + + ibooker.setCurrentFolder(TopFolder_); + + // book the Hit Property histograms + // ---------------------------------------------------------------------------------// + + TkParameterMEs tkmes; + if ( doHitPropertiesPlots_ || doAllPlots_ ){ + + ibooker.setCurrentFolder(TopFolder_+"/HitProperties"); + + histname = "NumberOfRecHitsPerTrack_"; + NumberOfRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax); + NumberOfRecHitsPerTrack->setAxisTitle("Number of all RecHits of each Track"); + NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfValidRecHitsPerTrack_"; + NumberOfValidRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax); + NumberOfValidRecHitsPerTrack->setAxisTitle("Number of valid RecHits for each Track"); + + NumberOfValidRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfLostRecHitsPerTrack_"; + NumberOfLostRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKLostBin, TKLostMin, TKLostMax); + NumberOfLostRecHitsPerTrack->setAxisTitle("Number of lost RecHits for each Track"); + NumberOfLostRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfMissingInnerRecHitsPerTrack_"; + NumberOfMIRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, 10, -0.5, 9.5); + NumberOfMIRecHitsPerTrack->setAxisTitle("Number of missing-inner RecHits for each Track"); + NumberOfMIRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfMissingOuterRecHitsPerTrack_"; + NumberOfMORecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, 10, -0.5, 9.5); + NumberOfMORecHitsPerTrack->setAxisTitle("Number of missing-outer RecHits for each Track"); + NumberOfMORecHitsPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "ValidFractionPerTrack_"; + ValidFractionPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, 101, 0., 1.01); + ValidFractionPerTrack->setAxisTitle("ValidFraction of RecHits for each Track"); + ValidFractionPerTrack->setAxisTitle("Number of Tracks", 2); + + + + if ( doRecHitVsPhiVsEtaPerTrack_ || doAllPlots_ ){ + + histname = "NumberOfValidRecHitVsPhiVsEtaPerTrack_"; + NumberOfValidRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, + Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax, 0, 40., ""); + NumberOfValidRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfValidRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); + + histname = "NumberOfLostRecHitVsPhiVsEtaPerTrack_"; + NumberOfLostRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, + Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax, 0, 5., ""); + NumberOfLostRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfLostRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); + + + histname = "NumberMIRecHitVsPhiVsEtaPerTrack_"; + NumberOfMIRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, + Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax, 0, 15., ""); + NumberOfMIRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfMIRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); - TkParameterMEs tkmes; - if (doHitPropertiesPlots_ || doAllPlots_) { - ibooker.setCurrentFolder(TopFolder_ + "/HitProperties"); - - histname = "NumberOfRecHitsPerTrack_"; - NumberOfRecHitsPerTrack = - ibooker.book1D(histname + CategoryName, histname + CategoryName, TKHitBin, TKHitMin, TKHitMax); - NumberOfRecHitsPerTrack->setAxisTitle("Number of all RecHits of each Track"); - NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfValidRecHitsPerTrack_"; - NumberOfValidRecHitsPerTrack = - ibooker.book1D(histname + CategoryName, histname + CategoryName, TKHitBin, TKHitMin, TKHitMax); - NumberOfValidRecHitsPerTrack->setAxisTitle("Number of valid RecHits for each Track"); - - NumberOfValidRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfLostRecHitsPerTrack_"; - NumberOfLostRecHitsPerTrack = - ibooker.book1D(histname + CategoryName, histname + CategoryName, TKLostBin, TKLostMin, TKLostMax); - NumberOfLostRecHitsPerTrack->setAxisTitle("Number of lost RecHits for each Track"); - NumberOfLostRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfMissingInnerRecHitsPerTrack_"; - NumberOfMIRecHitsPerTrack = ibooker.book1D(histname + CategoryName, histname + CategoryName, 10, -0.5, 9.5); - NumberOfMIRecHitsPerTrack->setAxisTitle("Number of missing-inner RecHits for each Track"); - NumberOfMIRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfMissingOuterRecHitsPerTrack_"; - NumberOfMORecHitsPerTrack = ibooker.book1D(histname + CategoryName, histname + CategoryName, 10, -0.5, 9.5); - NumberOfMORecHitsPerTrack->setAxisTitle("Number of missing-outer RecHits for each Track"); - NumberOfMORecHitsPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "ValidFractionPerTrack_"; - ValidFractionPerTrack = ibooker.book1D(histname + CategoryName, histname + CategoryName, 101, 0., 1.01); - ValidFractionPerTrack->setAxisTitle("ValidFraction of RecHits for each Track"); - ValidFractionPerTrack->setAxisTitle("Number of Tracks", 2); - - if (doRecHitVsPhiVsEtaPerTrack_ || doAllPlots_) { - histname = "NumberOfValidRecHitVsPhiVsEtaPerTrack_"; - NumberOfValidRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname + CategoryName, - histname + CategoryName, - Eta2DBin, - EtaMin, - EtaMax, - Phi2DBin, - PhiMin, - PhiMax, - 0, - 40., - ""); - NumberOfValidRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfValidRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); - - histname = "NumberOfLostRecHitVsPhiVsEtaPerTrack_"; - NumberOfLostRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname + CategoryName, - histname + CategoryName, - Eta2DBin, - EtaMin, - EtaMax, - Phi2DBin, - PhiMin, - PhiMax, - 0, - 5., - ""); - NumberOfLostRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfLostRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); - - histname = "NumberMIRecHitVsPhiVsEtaPerTrack_"; - NumberOfMIRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname + CategoryName, - histname + CategoryName, - Eta2DBin, - EtaMin, - EtaMax, - Phi2DBin, - PhiMin, - PhiMax, - 0, - 15., - ""); - NumberOfMIRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfMIRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); - - histname = "NumberMORecHitVsPhiVsEtaPerTrack_"; - NumberOfMORecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname + CategoryName, - histname + CategoryName, - Eta2DBin, - EtaMin, - EtaMax, - Phi2DBin, - PhiMin, - PhiMax, - 0, - 15., - ""); - NumberOfMORecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfMORecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); - - histname = "ValidFractionVsPhiVsEtaPerTrack_"; - ValidFractionVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname + CategoryName, - histname + CategoryName, - Eta2DBin, - EtaMin, - EtaMax, - Phi2DBin, - PhiMin, - PhiMax, - 0, - 2., - ""); - ValidFractionVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - ValidFractionVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); - } + histname = "NumberMORecHitVsPhiVsEtaPerTrack_"; + NumberOfMORecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, + Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax, 0, 15., ""); + NumberOfMORecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfMORecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); - if (doRecHitVsPtVsEtaPerTrack_ || doAllPlots_) { - histname = "NumberOfValidRecHitVsPtVsEtaPerTrack_"; - NumberOfValidRecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D( - histname + CategoryName, histname + CategoryName, Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 40., ""); - NumberOfValidRecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfValidRecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); - - histname = "NumberOfLostRecHitVsPtVsEtaPerTrack_"; - NumberOfLostRecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D( - histname + CategoryName, histname + CategoryName, Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 5., ""); - NumberOfLostRecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfLostRecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); - - histname = "NumberMIRecHitVsPtVsEtaPerTrack_"; - NumberOfMIRecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D( - histname + CategoryName, histname + CategoryName, Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 15., ""); - NumberOfMIRecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfMIRecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); - - histname = "NumberMORecHitVsPtVsEtaPerTrack_"; - NumberOfMORecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D( - histname + CategoryName, histname + CategoryName, Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 15., ""); - NumberOfMORecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfMORecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); - } + histname = "ValidFractionVsPhiVsEtaPerTrack_"; + ValidFractionVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, + Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax, 0, 2., ""); + ValidFractionVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + ValidFractionVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); - histname = "NumberOfValidRecHitsPerTrackVsPt_"; - NumberOfValidRecHitsPerTrackVsPt = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, PtBin, PtMin, PtMax, TKHitMin, TKHitMax, ""); - NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); - NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Number of valid RecHits in each Track", 2); - - histname = "NumberOfLostRecHitsPerTrackVsPt_"; - NumberOfLostRecHitsPerTrackVsPt = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, PtBin, PtMin, PtMax, TKHitMin, TKHitMax, ""); - NumberOfLostRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); - NumberOfLostRecHitsPerTrackVsPt->setAxisTitle("Average Number of Lost RecHits per Track", 2); - - histname = "NumberMIRecHitsPerTrackVsPt_"; - NumberOfMIRecHitsPerTrackVsPt = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, PtBin, PtMin, PtMax, TKHitMin, TKHitMax, ""); - NumberOfMIRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); - NumberOfMIRecHitsPerTrackVsPt->setAxisTitle("Average Number of Lost RecHits per Track", 2); - - histname = "NumberMORecHitsPerTrackVsPt_"; - NumberOfMORecHitsPerTrackVsPt = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, PtBin, PtMin, PtMax, TKHitMin, TKHitMax, ""); - NumberOfMORecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); - NumberOfMORecHitsPerTrackVsPt->setAxisTitle("Average Number of Lost RecHits per Track", 2); - - std::string layerTypeName[5] = {"", "Off", "3D", "Missing", "Pixel"}; - for (int i = 0; i < 4; ++i) { - histname = "NumberOf" + layerTypeName[i] + "LayersPerTrack_"; - NumberOfLayersPerTrack[i] = - ibooker.book1D(histname + CategoryName, histname + CategoryName, TKLayBin, TKLayMin, TKLayMax); - NumberOfLayersPerTrack[i]->setAxisTitle("Number of " + layerTypeName[i] + " Layers of each Track", 1); - NumberOfLayersPerTrack[i]->setAxisTitle("Number of Tracks", 2); - } - if (doLayersVsPhiVsEtaPerTrack_ || doAllPlots_) - for (int i = 0; i < 5; ++i) { - histname = "NumberOf" + layerTypeName[i] + "LayersVsPhiVsEtaPerTrack_"; - NumberOfLayersVsPhiVsEtaPerTrack[i] = ibooker.bookProfile2D(histname + CategoryName, - histname + CategoryName, - Eta2DBin, - EtaMin, - EtaMax, - Phi2DBin, - PhiMin, - PhiMax, - 0, - 40., - ""); - NumberOfLayersVsPhiVsEtaPerTrack[i]->setAxisTitle("Track #eta ", 1); - NumberOfLayersVsPhiVsEtaPerTrack[i]->setAxisTitle("Track #phi ", 2); } - } - - // book the General Property histograms - // ---------------------------------------------------------------------------------// - - if (doGeneralPropertiesPlots_ || doAllPlots_) { - int Chi2Bin = conf_->getParameter("Chi2Bin"); - double Chi2Min = conf_->getParameter("Chi2Min"); - double Chi2Max = conf_->getParameter("Chi2Max"); - int Chi2NDFBin = conf_->getParameter("Chi2NDFBin"); - double Chi2NDFMin = conf_->getParameter("Chi2NDFMin"); - double Chi2NDFMax = conf_->getParameter("Chi2NDFMax"); - - int Chi2ProbBin = conf_->getParameter("Chi2ProbBin"); - double Chi2ProbMin = conf_->getParameter("Chi2ProbMin"); - double Chi2ProbMax = conf_->getParameter("Chi2ProbMax"); - - //HI PLOTS//// - int TransDCABins = conf_->getParameter("TransDCABins"); - double TransDCAMin = conf_->getParameter("TransDCAMin"); - double TransDCAMax = conf_->getParameter("TransDCAMax"); - - int LongDCABins = conf_->getParameter("LongDCABins"); - double LongDCAMin = conf_->getParameter("LongDCAMin"); - double LongDCAMax = conf_->getParameter("LongDCAMax"); - /////////////////////////////////////////////////////////////////// - - ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); - - histname = "Chi2_"; - Chi2 = ibooker.book1D(histname + CategoryName, histname + CategoryName, Chi2Bin, Chi2Min, Chi2Max); - Chi2->setAxisTitle("Track #chi^{2}", 1); - Chi2->setAxisTitle("Number of Tracks", 2); - - histname = "Chi2Prob_"; - Chi2Prob = ibooker.book1D(histname + CategoryName, histname + CategoryName, Chi2ProbBin, Chi2ProbMin, Chi2ProbMax); - Chi2Prob->setAxisTitle("Track #chi^{2} probability", 1); - Chi2Prob->setAxisTitle("Number of Tracks", 2); - - histname = "Chi2oNDF_"; - Chi2oNDF = ibooker.book1D(histname + CategoryName, histname + CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax); - Chi2oNDF->setAxisTitle("Track #chi^{2}/ndf", 1); - Chi2oNDF->setAxisTitle("Number of Tracks", 2); - - ////////////// - //HI PLOTS/// - ////////////// - if (doHIPlots_) { - histname = "LongDCASig_"; - LongDCASig = - ibooker.book1D(histname + CategoryName, histname + CategoryName, LongDCABins, LongDCAMin, LongDCAMax); - LongDCASig->setAxisTitle("dz/#sigma_{dz}", 1); - - histname = "TransDCASig_"; - TransDCASig = - ibooker.book1D(histname + CategoryName, histname + CategoryName, TransDCABins, TransDCAMin, TransDCAMax); - TransDCASig->setAxisTitle("dxy/#sigma_{dxy}", 1); - - histname = "dNdPhi_HighPurity_"; - dNdPhi_HighPurity = ibooker.book1D(histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax); - dNdPhi_HighPurity->setAxisTitle("#phi", 1); - - histname = "dNdEta_HighPurity_"; - dNdEta_HighPurity = ibooker.book1D(histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax); - dNdEta_HighPurity->setAxisTitle("#eta", 1); - - histname = "dNdPt_HighPurity_"; - dNdPt_HighPurity = ibooker.book1D(histname + CategoryName, histname + CategoryName, 150, 0, 0.3); - dNdPt_HighPurity->setAxisTitle("#sigma_{p_{T}}/p_{T}", 1); - - histname = "NhitVsEta_HighPurity_"; - NhitVsEta_HighPurity = - ibooker.bookProfile(histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, -0.5, 39.5, ""); - NhitVsEta_HighPurity->setAxisTitle("Track #eta", 1); - NhitVsEta_HighPurity->setAxisTitle("Number of Valid RecHits in each Track", 2); - - histname = "NhitVsPhi_HighPurity_"; - NhitVsPhi_HighPurity = - ibooker.bookProfile(histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, -0.5, 39.5, ""); - NhitVsPhi_HighPurity->setAxisTitle("Track #phi", 1); - NhitVsPhi_HighPurity->setAxisTitle("Number of Valid RecHits in each Track", 2); - - histname = "Ptdist_HighPurity_"; - Ptdist_HighPurity = ibooker.book1D(histname + CategoryName, histname + CategoryName, 150, 0, 50.); - Ptdist_HighPurity->setAxisTitle("p_{T} (GeV/c)", 1); - Ptdist_HighPurity->setAxisTitle("Number of Tracks", 2); - - histname = "dNhitdPt_HighPurity_"; - dNhitdPt_HighPurity = - ibooker.bookProfile(histname + CategoryName, histname + CategoryName, 150, 0, 25., -0.5, 39.5, ""); - dNhitdPt_HighPurity->setAxisTitle("p_{T} (GeV/c)", 1); - dNhitdPt_HighPurity->setAxisTitle("N_{hit}", 2); - } - - if (doDCAPlots_ || doPVPlots_ || doSIPPlots_ || doAllPlots_) { - histname = "xPointOfClosestApproach_"; - xPointOfClosestApproach = ibooker.book1D(histname + CategoryName, histname + CategoryName, VXBin, VXMin, VXMax); - xPointOfClosestApproach->setAxisTitle("x component of Track PCA to beam line (cm)", 1); - xPointOfClosestApproach->setAxisTitle("Number of Tracks", 2); - - histname = "yPointOfClosestApproach_"; - yPointOfClosestApproach = ibooker.book1D(histname + CategoryName, histname + CategoryName, VYBin, VYMin, VYMax); - yPointOfClosestApproach->setAxisTitle("y component of Track PCA to beam line (cm)", 1); - yPointOfClosestApproach->setAxisTitle("Number of Tracks", 2); - - histname = "zPointOfClosestApproach_"; - zPointOfClosestApproach = ibooker.book1D(histname + CategoryName, histname + CategoryName, VZBin, VZMin, VZMax); - zPointOfClosestApproach->setAxisTitle("z component of Track PCA to beam line (cm)", 1); - zPointOfClosestApproach->setAxisTitle("Number of Tracks", 2); - - histname = "xPointOfClosestApproachToPV_"; - xPointOfClosestApproachToPV = - ibooker.book1D(histname + CategoryName, histname + CategoryName, VXBin, VXMin, VXMax); - xPointOfClosestApproachToPV->setAxisTitle("x component of Track PCA to pv (cm)", 1); - xPointOfClosestApproachToPV->setAxisTitle("Number of Tracks", 2); - - histname = "yPointOfClosestApproachToPV_"; - yPointOfClosestApproachToPV = - ibooker.book1D(histname + CategoryName, histname + CategoryName, VYBin, VYMin, VYMax); - yPointOfClosestApproachToPV->setAxisTitle("y component of Track PCA to pv line (cm)", 1); - yPointOfClosestApproachToPV->setAxisTitle("Number of Tracks", 2); - - histname = "zPointOfClosestApproachToPV_"; - zPointOfClosestApproachToPV = - ibooker.book1D(histname + CategoryName, histname + CategoryName, VZBin, VZMin, VZMax); - zPointOfClosestApproachToPV->setAxisTitle("z component of Track PCA to pv line (cm)", 1); - zPointOfClosestApproachToPV->setAxisTitle("Number of Tracks", 2); - } + if ( doRecHitVsPtVsEtaPerTrack_ || doAllPlots_ ){ + + histname = "NumberOfValidRecHitVsPtVsEtaPerTrack_"; + NumberOfValidRecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, + Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 40., ""); + NumberOfValidRecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfValidRecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); + + histname = "NumberOfLostRecHitVsPtVsEtaPerTrack_"; + NumberOfLostRecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, + Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 5., ""); + NumberOfLostRecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfLostRecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); + + + histname = "NumberMIRecHitVsPtVsEtaPerTrack_"; + NumberOfMIRecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, + Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 15., ""); + NumberOfMIRecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfMIRecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); + + histname = "NumberMORecHitVsPtVsEtaPerTrack_"; + NumberOfMORecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, + Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 15., ""); + NumberOfMORecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfMORecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); - // See DataFormats/TrackReco/interface/TrackBase.h for track algorithm enum definition - // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/DataFormats/TrackReco/interface/TrackBase.h?view=log - histname = "algorithm_"; - algorithm = ibooker.book1D(histname + CategoryName, - histname + CategoryName, - reco::TrackBase::algoSize, - 0., - double(reco::TrackBase::algoSize)); - algorithm->setAxisTitle("Tracking algorithm", 1); - algorithm->setAxisTitle("Number of Tracks", 2); - - histname = "originalAlgorithm_"; - oriAlgo = ibooker.book1D(histname + CategoryName, - histname + CategoryName, - reco::TrackBase::algoSize, - 0., - double(reco::TrackBase::algoSize)); - oriAlgo->setAxisTitle("Tracking algorithm", 1); - oriAlgo->setAxisTitle("Number of Tracks", 2); - - for (size_t ibin = 0; ibin < reco::TrackBase::algoSize - 1; ibin++) { - algorithm->setBinLabel(ibin + 1, reco::TrackBase::algoNames[ibin]); - oriAlgo->setBinLabel(ibin + 1, reco::TrackBase::algoNames[ibin]); - } + } - size_t StopReasonNameSize = sizeof(StopReasonName::StopReasonName) / sizeof(std::string); - histname = "stoppingSource_"; - stoppingSource = ibooker.book1D( - histname + CategoryName, histname + CategoryName, StopReasonNameSize, 0., double(StopReasonNameSize)); - stoppingSource->setAxisTitle("stopping reason", 1); - stoppingSource->setAxisTitle("Number of Tracks", 2); - - histname = "stoppingSourceVSeta_"; - stoppingSourceVSeta = - ibooker.bookProfile(histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, 2, 0., 2.); - stoppingSourceVSeta->setAxisTitle("track #eta", 1); - stoppingSourceVSeta->setAxisTitle("stopped fraction", 2); - - histname = "stoppingSourceVSphi_"; - stoppingSourceVSphi = - ibooker.bookProfile(histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, 2, 0., 2.); - stoppingSourceVSphi->setAxisTitle("track #phi", 1); - stoppingSourceVSphi->setAxisTitle("stopped fraction", 2); - - for (size_t ibin = 0; ibin < StopReasonNameSize; ibin++) { - stoppingSource->setBinLabel(ibin + 1, StopReasonName::StopReasonName[ibin], 1); + histname = "NumberOfValidRecHitsPerTrackVsPt_"; + NumberOfValidRecHitsPerTrackVsPt = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PtBin, PtMin, PtMax, TKHitMin, TKHitMax,""); + NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]",1); + NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Number of valid RecHits in each Track",2); + + histname = "NumberOfLostRecHitsPerTrackVsPt_"; + NumberOfLostRecHitsPerTrackVsPt = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PtBin, PtMin, PtMax,TKHitMin, TKHitMax,""); + NumberOfLostRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); + NumberOfLostRecHitsPerTrackVsPt->setAxisTitle("Average Number of Lost RecHits per Track", 2); + + + histname = "NumberMIRecHitsPerTrackVsPt_"; + NumberOfMIRecHitsPerTrackVsPt = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PtBin, PtMin, PtMax,TKHitMin, TKHitMax,""); + NumberOfMIRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); + NumberOfMIRecHitsPerTrackVsPt->setAxisTitle("Average Number of Lost RecHits per Track", 2); + + histname = "NumberMORecHitsPerTrackVsPt_"; + NumberOfMORecHitsPerTrackVsPt = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PtBin, PtMin, PtMax,TKHitMin, TKHitMax,""); + NumberOfMORecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); + NumberOfMORecHitsPerTrackVsPt->setAxisTitle("Average Number of Lost RecHits per Track", 2); + + std::string layerTypeName[5] = {"","Off","3D","Missing","Pixel"}; + for (int i=0; i<4; ++i) { + histname = "NumberOf"+ layerTypeName[i] + "LayersPerTrack_"; + NumberOfLayersPerTrack[i] = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKLayBin, TKLayMin, TKLayMax); + NumberOfLayersPerTrack[i]->setAxisTitle("Number of " + layerTypeName[i] + " Layers of each Track", 1); + NumberOfLayersPerTrack[i]->setAxisTitle("Number of Tracks", 2); + } + if ( doLayersVsPhiVsEtaPerTrack_ || doAllPlots_ ) + for (int i=0; i<5; ++i) { + histname = "NumberOf"+ layerTypeName[i] + "LayersVsPhiVsEtaPerTrack_"; + NumberOfLayersVsPhiVsEtaPerTrack[i] = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, + Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax, 0, 40., ""); + NumberOfLayersVsPhiVsEtaPerTrack[i]->setAxisTitle("Track #eta ", 1); + NumberOfLayersVsPhiVsEtaPerTrack[i]->setAxisTitle("Track #phi ", 2); + } } - } -} -void TrackAnalyzer::bookHistosForLScertification(DQMStore::IBooker& ibooker) { - // parameters from the configuration - std::string QualName = conf_->getParameter("Quality"); - std::string AlgoName = conf_->getParameter("AlgoName"); + // book the General Property histograms + // ---------------------------------------------------------------------------------// + + if (doGeneralPropertiesPlots_ || doAllPlots_){ + + int Chi2Bin = conf_->getParameter( "Chi2Bin"); + double Chi2Min = conf_->getParameter("Chi2Min"); + double Chi2Max = conf_->getParameter("Chi2Max"); + + int Chi2NDFBin = conf_->getParameter( "Chi2NDFBin"); + double Chi2NDFMin = conf_->getParameter("Chi2NDFMin"); + double Chi2NDFMax = conf_->getParameter("Chi2NDFMax"); + + int Chi2ProbBin = conf_->getParameter( "Chi2ProbBin"); + double Chi2ProbMin = conf_->getParameter("Chi2ProbMin"); + double Chi2ProbMax = conf_->getParameter("Chi2ProbMax"); + + + //HI PLOTS//// + int TransDCABins = conf_->getParameter("TransDCABins"); + double TransDCAMin = conf_->getParameter("TransDCAMin"); + double TransDCAMax = conf_->getParameter("TransDCAMax"); + + int LongDCABins = conf_->getParameter("LongDCABins"); + double LongDCAMin = conf_->getParameter("LongDCAMin"); + double LongDCAMax = conf_->getParameter("LongDCAMax"); + /////////////////////////////////////////////////////////////////// + + + ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); + + histname = "Chi2_"; + Chi2 = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2Bin, Chi2Min, Chi2Max); + Chi2->setAxisTitle("Track #chi^{2}" ,1); + Chi2->setAxisTitle("Number of Tracks",2); + + histname = "Chi2Prob_"; + Chi2Prob = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2ProbBin, Chi2ProbMin, Chi2ProbMax); + Chi2Prob->setAxisTitle("Track #chi^{2} probability",1); + Chi2Prob->setAxisTitle("Number of Tracks" ,2); + + histname = "Chi2oNDF_"; + Chi2oNDF = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax); + Chi2oNDF->setAxisTitle("Track #chi^{2}/ndf",1); + Chi2oNDF->setAxisTitle("Number of Tracks" ,2); + + + ////////////// + //HI PLOTS/// + ////////////// + if (doHIPlots_) + { + histname = "LongDCASig_"; + LongDCASig = ibooker.book1D(histname+CategoryName, histname+CategoryName,LongDCABins,LongDCAMin,LongDCAMax); + LongDCASig->setAxisTitle("dz/#sigma_{dz}",1); + + histname = "TransDCASig_"; + TransDCASig = ibooker.book1D(histname+CategoryName,histname+CategoryName,TransDCABins,TransDCAMin,TransDCAMax); + TransDCASig->setAxisTitle("dxy/#sigma_{dxy}",1); + + histname = "dNdPhi_HighPurity_"; + dNdPhi_HighPurity = ibooker.book1D(histname+CategoryName,histname+CategoryName,PhiBin,PhiMin,PhiMax); + dNdPhi_HighPurity->setAxisTitle("#phi",1); + + histname = "dNdEta_HighPurity_"; + dNdEta_HighPurity = ibooker.book1D(histname+CategoryName,histname+CategoryName,EtaBin,EtaMin,EtaMax); + dNdEta_HighPurity->setAxisTitle("#eta",1); + + histname = "dNdPt_HighPurity_"; + dNdPt_HighPurity = ibooker.book1D(histname+CategoryName,histname+CategoryName,150,0,0.3); + dNdPt_HighPurity->setAxisTitle("#sigma_{p_{T}}/p_{T}",1); + + histname = "NhitVsEta_HighPurity_"; + NhitVsEta_HighPurity = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,EtaBin,EtaMin,EtaMax,-0.5,39.5,""); + NhitVsEta_HighPurity->setAxisTitle("Track #eta",1); + NhitVsEta_HighPurity->setAxisTitle("Number of Valid RecHits in each Track",2); + + histname = "NhitVsPhi_HighPurity_"; + NhitVsPhi_HighPurity = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,PhiBin,PhiMin,PhiMax,-0.5,39.5,""); + NhitVsPhi_HighPurity->setAxisTitle("Track #phi",1); + NhitVsPhi_HighPurity->setAxisTitle("Number of Valid RecHits in each Track",2); + + histname = "Ptdist_HighPurity_"; + Ptdist_HighPurity = ibooker.book1D(histname+CategoryName,histname+CategoryName,150,0,50.); + Ptdist_HighPurity->setAxisTitle("p_{T} (GeV/c)",1); + Ptdist_HighPurity->setAxisTitle("Number of Tracks",2); + + histname = "dNhitdPt_HighPurity_"; + dNhitdPt_HighPurity = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,150,0,25.,-0.5,39.5,""); + dNhitdPt_HighPurity->setAxisTitle("p_{T} (GeV/c)",1); + dNhitdPt_HighPurity->setAxisTitle("N_{hit}",2); + + } - // use the AlgoName and Quality Name - std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; - // book LS analysis related histograms - // ----------------------------------- - if (doLumiAnalysis_) { - // get binning from the configuration - int TKHitBin = conf_->getParameter("RecHitBin"); - double TKHitMin = conf_->getParameter("RecHitMin"); - double TKHitMax = conf_->getParameter("RecHitMax"); + + if(doDCAPlots_ || doPVPlots_ || doSIPPlots_ || doAllPlots_) { + histname = "xPointOfClosestApproach_"; + xPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VXBin, VXMin, VXMax); + xPointOfClosestApproach->setAxisTitle("x component of Track PCA to beam line (cm)",1); + xPointOfClosestApproach->setAxisTitle("Number of Tracks",2); + + histname = "yPointOfClosestApproach_"; + yPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VYBin, VYMin, VYMax); + yPointOfClosestApproach->setAxisTitle("y component of Track PCA to beam line (cm)",1); + yPointOfClosestApproach->setAxisTitle("Number of Tracks",2); + + histname = "zPointOfClosestApproach_"; + zPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VZBin, VZMin, VZMax); + zPointOfClosestApproach->setAxisTitle("z component of Track PCA to beam line (cm)",1); + zPointOfClosestApproach->setAxisTitle("Number of Tracks",2); + + histname = "xPointOfClosestApproachToPV_"; + xPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VXBin, VXMin, VXMax); + xPointOfClosestApproachToPV->setAxisTitle("x component of Track PCA to pv (cm)",1); + xPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2); + + histname = "yPointOfClosestApproachToPV_"; + yPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VYBin, VYMin, VYMax); + yPointOfClosestApproachToPV->setAxisTitle("y component of Track PCA to pv line (cm)",1); + yPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2); + + histname = "zPointOfClosestApproachToPV_"; + zPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VZBin, VZMin, VZMax); + zPointOfClosestApproachToPV->setAxisTitle("z component of Track PCA to pv line (cm)",1); + zPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2); + } - int Chi2NDFBin = conf_->getParameter("Chi2NDFBin"); - double Chi2NDFMin = conf_->getParameter("Chi2NDFMin"); - double Chi2NDFMax = conf_->getParameter("Chi2NDFMax"); + // See DataFormats/TrackReco/interface/TrackBase.h for track algorithm enum definition + // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/DataFormats/TrackReco/interface/TrackBase.h?view=log + histname = "algorithm_"; + algorithm = ibooker.book1D(histname+CategoryName, histname+CategoryName, reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize)); + algorithm->setAxisTitle("Tracking algorithm",1); + algorithm->setAxisTitle("Number of Tracks",2); + + histname = "originalAlgorithm_"; + oriAlgo = ibooker.book1D(histname+CategoryName, histname+CategoryName, reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize)); + oriAlgo->setAxisTitle("Tracking algorithm",1); + oriAlgo->setAxisTitle("Number of Tracks",2); + + for (size_t ibin=0; ibinsetBinLabel(ibin+1,reco::TrackBase::algoNames[ibin]); + oriAlgo->setBinLabel(ibin+1,reco::TrackBase::algoNames[ibin]); + } - // add by Mia in order to deal w/ LS transitions - ibooker.setCurrentFolder(TopFolder_ + "/LSanalysis"); + size_t StopReasonNameSize = sizeof(StopReasonName::StopReasonName)/sizeof(std::string); + histname = "stoppingSource_"; + stoppingSource = ibooker.book1D(histname+CategoryName, histname+CategoryName, StopReasonNameSize, 0., double(StopReasonNameSize)); + stoppingSource->setAxisTitle("stopping reason",1); + stoppingSource->setAxisTitle("Number of Tracks",2); + + histname = "stoppingSourceVSeta_"; + stoppingSourceVSeta = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, + EtaBin, EtaMin, EtaMax, 2, 0., 2.); + stoppingSourceVSeta->setAxisTitle("track #eta",1); + stoppingSourceVSeta->setAxisTitle("stopped fraction",2); + + histname = "stoppingSourceVSphi_"; + stoppingSourceVSphi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, + PhiBin, PhiMin, PhiMax, 2, 0., 2.); + stoppingSourceVSphi->setAxisTitle("track #phi",1); + stoppingSourceVSphi->setAxisTitle("stopped fraction",2); + + for (size_t ibin=0; ibinsetBinLabel(ibin+1,StopReasonName::StopReasonName[ibin],1); + } - histname = "NumberOfRecHitsPerTrack_lumiFlag_"; - NumberOfRecHitsPerTrack_lumiFlag = - ibooker.book1D(histname + CategoryName, histname + CategoryName, TKHitBin, TKHitMin, TKHitMax); - NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of all RecHits of each Track"); - NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of Tracks", 2); + } - histname = "Chi2oNDF_lumiFlag_"; - Chi2oNDF_lumiFlag = - ibooker.book1D(histname + CategoryName, histname + CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax); - Chi2oNDF_lumiFlag->setAxisTitle("Track #chi^{2}/ndf", 1); - Chi2oNDF_lumiFlag->setAxisTitle("Number of Tracks", 2); - } } -void TrackAnalyzer::bookHistosForBeamSpot(DQMStore::IBooker& ibooker) { - // parameters from the configuration - std::string QualName = conf_->getParameter("Quality"); - std::string AlgoName = conf_->getParameter("AlgoName"); +void TrackAnalyzer::bookHistosForLScertification(DQMStore::IBooker & ibooker) { - // use the AlgoName and Quality Name - std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; + // parameters from the configuration + std::string QualName = conf_->getParameter("Quality"); + std::string AlgoName = conf_->getParameter("AlgoName"); - // book the Beam Spot related histograms - // ---------------------------------------------------------------------------------// - - if (doDCAPlots_ || doBSPlots_ || doAllPlots_) { - int DxyErrBin = conf_->getParameter("DxyErrBin"); - double DxyErrMax = conf_->getParameter("DxyErrMax"); + // use the AlgoName and Quality Name + std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; - int DxyBin = conf_->getParameter("DxyBin"); - double DxyMin = conf_->getParameter("DxyMin"); - double DxyMax = conf_->getParameter("DxyMax"); - int AbsDxyBin = conf_->getParameter("AbsDxyBin"); - double AbsDxyMin = conf_->getParameter("AbsDxyMin"); - double AbsDxyMax = conf_->getParameter("AbsDxyMax"); + // book LS analysis related histograms + // ----------------------------------- + if ( doLumiAnalysis_ ) { - int PhiBin = conf_->getParameter("PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); + // get binning from the configuration + int TKHitBin = conf_->getParameter( "RecHitBin"); + double TKHitMin = conf_->getParameter("RecHitMin"); + double TKHitMax = conf_->getParameter("RecHitMax"); - int EtaBin = conf_->getParameter("EtaBin"); - double EtaMin = conf_->getParameter("EtaMin"); - double EtaMax = conf_->getParameter("EtaMax"); + int Chi2NDFBin = conf_->getParameter( "Chi2NDFBin"); + double Chi2NDFMin = conf_->getParameter("Chi2NDFMin"); + double Chi2NDFMax = conf_->getParameter("Chi2NDFMax"); - int PtBin = conf_->getParameter("TrackPtBin"); - double PtMin = conf_->getParameter("TrackPtMin"); - double PtMax = conf_->getParameter("TrackPtMax"); + // add by Mia in order to deal w/ LS transitions + ibooker.setCurrentFolder(TopFolder_+"/LSanalysis"); - int X0Bin = conf_->getParameter("X0Bin"); - double X0Min = conf_->getParameter("X0Min"); - double X0Max = conf_->getParameter("X0Max"); - - int Y0Bin = conf_->getParameter("Y0Bin"); - double Y0Min = conf_->getParameter("Y0Min"); - double Y0Max = conf_->getParameter("Y0Max"); - - int Z0Bin = conf_->getParameter("Z0Bin"); - double Z0Min = conf_->getParameter("Z0Min"); - double Z0Max = conf_->getParameter("Z0Max"); - - int VZBinProf = conf_->getParameter("VZBinProf"); - double VZMinProf = conf_->getParameter("VZMinProf"); - double VZMaxProf = conf_->getParameter("VZMaxProf"); - - ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); - - histname = "DistanceOfClosestApproachError_"; - DistanceOfClosestApproachError = - ibooker.book1D(histname + CategoryName, histname + CategoryName, DxyErrBin, 0., DxyErrMax); - DistanceOfClosestApproachError->setAxisTitle("Track d_{xy} error (cm)", 1); - DistanceOfClosestApproachError->setAxisTitle("Number of Tracks", 2); - - histname = "DistanceOfClosestApproachErrorVsPt_"; - DistanceOfClosestApproachErrorVsPt = - ibooker.bookProfile(histname + CategoryName, histname + CategoryName, PtBin, PtMin, PtMax, 0., DxyErrMax); - DistanceOfClosestApproachErrorVsPt->setAxisTitle("Track p_{T} (GeV)", 1); - DistanceOfClosestApproachErrorVsPt->setAxisTitle("Track d_{xy} error (cm)", 2); - - histname = "DistanceOfClosestApproachErrorVsEta_"; - DistanceOfClosestApproachErrorVsEta = - ibooker.bookProfile(histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, 0., DxyErrMax); - DistanceOfClosestApproachErrorVsEta->setAxisTitle("Track #eta", 1); - DistanceOfClosestApproachErrorVsEta->setAxisTitle("Track d_{xy} error (cm)", 2); - - histname = "DistanceOfClosestApproachErrorVsPhi_"; - DistanceOfClosestApproachErrorVsPhi = - ibooker.bookProfile(histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, 0., DxyErrMax); - DistanceOfClosestApproachErrorVsPhi->setAxisTitle("Track #phi", 1); - DistanceOfClosestApproachErrorVsPhi->setAxisTitle("Track d_{xy} error (cm)", 2); - - histname = "DistanceOfClosestApproachErrorVsDxy_"; - DistanceOfClosestApproachErrorVsDxy = - ibooker.bookProfile(histname + CategoryName, histname + CategoryName, DxyBin, DxyMin, DxyMax, 0., DxyErrMax); - DistanceOfClosestApproachErrorVsDxy->setAxisTitle("Track d_{xy}", 1); - DistanceOfClosestApproachErrorVsDxy->setAxisTitle("Track d_{xy} error (cm)", 2); - - histname = "DistanceOfClosestApproachToBS_"; - DistanceOfClosestApproachToBS = - ibooker.book1D(histname + CategoryName, histname + CategoryName, DxyBin, DxyMin, DxyMax); - DistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 1); - DistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks", 2); - - histname = "AbsDistanceOfClosestApproachToBS_"; - AbsDistanceOfClosestApproachToBS = - ibooker.book1D(histname + CategoryName, histname + CategoryName, AbsDxyBin, AbsDxyMin, AbsDxyMax); - AbsDistanceOfClosestApproachToBS->setAxisTitle("Track |d_{xy}| wrt beam spot (cm)", 1); - AbsDistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks", 2); - - histname = "DistanceOfClosestApproachToBSVsPhi_"; - DistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax, ""); - DistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); - DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track #phi", 1); - DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 2); - - histname = "xPointOfClosestApproachVsZ0wrt000_"; - xPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max, ""); - xPointOfClosestApproachVsZ0wrt000->setAxisTitle("d_{z} (cm)", 1); - xPointOfClosestApproachVsZ0wrt000->setAxisTitle("x component of Track PCA to beam line (cm)", 2); - - histname = "yPointOfClosestApproachVsZ0wrt000_"; - yPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max, ""); - yPointOfClosestApproachVsZ0wrt000->setAxisTitle("d_{z} (cm)", 1); - yPointOfClosestApproachVsZ0wrt000->setAxisTitle("y component of Track PCA to beam line (cm)", 2); - - histname = "xPointOfClosestApproachVsZ0wrtBS_"; - xPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max, ""); - xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)", 1); - xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("x component of Track PCA to BS (cm)", 2); - - histname = "yPointOfClosestApproachVsZ0wrtBS_"; - yPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max, ""); - yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)", 1); - yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("y component of Track PCA to BS (cm)", 2); - - histname = "zPointOfClosestApproachVsPhi_"; - zPointOfClosestApproachVsPhi = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, VZBinProf, VZMinProf, VZMaxProf, ""); - zPointOfClosestApproachVsPhi->setAxisTitle("Track #phi", 1); - zPointOfClosestApproachVsPhi->setAxisTitle("z component of Track PCA to beam line (cm)", 2); - } + histname = "NumberOfRecHitsPerTrack_lumiFlag_"; + NumberOfRecHitsPerTrack_lumiFlag = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax); + NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of all RecHits of each Track"); + NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of Tracks", 2); - if (doDCAPlots_ || doPVPlots_ || doAllPlots_) { - int DxyBin = conf_->getParameter("DxyBin"); - double DxyMin = conf_->getParameter("DxyMin"); - double DxyMax = conf_->getParameter("DxyMax"); - - int PhiBin = conf_->getParameter("PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); - - int X0Bin = conf_->getParameter("X0Bin"); - double X0Min = conf_->getParameter("X0Min"); - double X0Max = conf_->getParameter("X0Max"); - - int Y0Bin = conf_->getParameter("Y0Bin"); - double Y0Min = conf_->getParameter("Y0Min"); - double Y0Max = conf_->getParameter("Y0Max"); - - int Z0Bin = conf_->getParameter("Z0Bin"); - double Z0Min = conf_->getParameter("Z0Min"); - double Z0Max = conf_->getParameter("Z0Max"); - - ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); - - histname = "DistanceOfClosestApproachToPV_"; - DistanceOfClosestApproachToPV = - ibooker.book1D(histname + CategoryName, histname + CategoryName, DxyBin, DxyMin, DxyMax); - DistanceOfClosestApproachToPV->setAxisTitle("Track d_{xy} w.r.t. PV (cm)", 1); - DistanceOfClosestApproachToPV->setAxisTitle("Number of Tracks", 2); - - histname = "DistanceOfClosestApproachToPVZoom_"; - DistanceOfClosestApproachToPVZoom = - ibooker.book1D(histname + CategoryName, histname + CategoryName, 100, -0.08, 0.08); - DistanceOfClosestApproachToPVZoom->setAxisTitle("Track d_{xy} w.r.t. PV (cm)", 1); - DistanceOfClosestApproachToPVZoom->setAxisTitle("Number of Tracks", 2); - - histname = "DeltaZToPV_"; - DeltaZToPV = ibooker.book1D(histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max); - DeltaZToPV->setAxisTitle("Track d_{z} w.r.t. PV (cm)", 1); - DeltaZToPV->setAxisTitle("Number of Tracks", 2); - - histname = "DeltaZToPVZoom_"; - DeltaZToPVZoom = ibooker.book1D(histname + CategoryName, histname + CategoryName, 100, -0.15, 0.15); - DeltaZToPVZoom->setAxisTitle("Track d_{z} w.r.t. PV (cm)", 1); - DeltaZToPVZoom->setAxisTitle("Number of Tracks", 2); - - histname = "DistanceOfClosestApproachToPVVsPhi_"; - DistanceOfClosestApproachToPVVsPhi = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax, ""); - DistanceOfClosestApproachToPVVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); - DistanceOfClosestApproachToPVVsPhi->setAxisTitle("Track #phi", 1); - DistanceOfClosestApproachToPVVsPhi->setAxisTitle("Track d_{xy} w.r.t. PV (cm)", 2); - - histname = "xPointOfClosestApproachVsZ0wrtPV_"; - xPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max, ""); - xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. PV (cm)", 1); - xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("x component of Track PCA to PV (cm)", 2); - - histname = "yPointOfClosestApproachVsZ0wrtPV_"; - yPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max, ""); - yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. PV (cm)", 1); - yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("y component of Track PCA to PV (cm)", 2); - } + histname = "Chi2oNDF_lumiFlag_"; + Chi2oNDF_lumiFlag = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax); + Chi2oNDF_lumiFlag->setAxisTitle("Track #chi^{2}/ndf",1); + Chi2oNDF_lumiFlag->setAxisTitle("Number of Tracks" ,2); - if (doBSPlots_ || doAllPlots_) { - if (doTestPlots_) { - int DxyBin = conf_->getParameter("DxyBin"); - double DxyMin = conf_->getParameter("DxyMin"); - double DxyMax = conf_->getParameter("DxyMax"); - - int PhiBin = conf_->getParameter("PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); - - histname = "TESTDistanceOfClosestApproachToBS_"; - TESTDistanceOfClosestApproachToBS = - ibooker.book1D(histname + CategoryName, histname + CategoryName, DxyBin, DxyMin, DxyMax); - TESTDistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 1); - TESTDistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks", 2); - - histname = "TESTDistanceOfClosestApproachToBSVsPhi_"; - TESTDistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax, ""); - TESTDistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); - TESTDistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track #phi", 1); - TESTDistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 2); } - } +} - // book the Profile plots for DCA related histograms - // ---------------------------------------------------------------------------------// - if (doDCAPlots_ || doAllPlots_) { - if (doDCAwrt000Plots_) { - int EtaBin = conf_->getParameter("EtaBin"); - double EtaMin = conf_->getParameter("EtaMin"); - double EtaMax = conf_->getParameter("EtaMax"); +void TrackAnalyzer::bookHistosForBeamSpot(DQMStore::IBooker & ibooker) { + + // parameters from the configuration + std::string QualName = conf_->getParameter("Quality"); + std::string AlgoName = conf_->getParameter("AlgoName"); + + // use the AlgoName and Quality Name + std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; + + // book the Beam Spot related histograms + // ---------------------------------------------------------------------------------// + + if(doDCAPlots_ || doBSPlots_ || doAllPlots_) { + + int DxyErrBin = conf_->getParameter( "DxyErrBin"); + double DxyErrMax = conf_->getParameter("DxyErrMax"); + + int DxyBin = conf_->getParameter( "DxyBin"); + double DxyMin = conf_->getParameter("DxyMin"); + double DxyMax = conf_->getParameter("DxyMax"); + + int AbsDxyBin = conf_->getParameter( "AbsDxyBin"); + double AbsDxyMin = conf_->getParameter("AbsDxyMin"); + double AbsDxyMax = conf_->getParameter("AbsDxyMax"); + + int PhiBin = conf_->getParameter( "PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); + + int EtaBin = conf_->getParameter( "EtaBin"); + double EtaMin = conf_->getParameter("EtaMin"); + double EtaMax = conf_->getParameter("EtaMax"); + + int PtBin = conf_->getParameter( "TrackPtBin"); + double PtMin = conf_->getParameter("TrackPtMin"); + double PtMax = conf_->getParameter("TrackPtMax"); + + int X0Bin = conf_->getParameter( "X0Bin"); + double X0Min = conf_->getParameter("X0Min"); + double X0Max = conf_->getParameter("X0Max"); + + int Y0Bin = conf_->getParameter( "Y0Bin"); + double Y0Min = conf_->getParameter("Y0Min"); + double Y0Max = conf_->getParameter("Y0Max"); + + int Z0Bin = conf_->getParameter( "Z0Bin"); + double Z0Min = conf_->getParameter("Z0Min"); + double Z0Max = conf_->getParameter("Z0Max"); + + int VZBinProf = conf_->getParameter( "VZBinProf"); + double VZMinProf = conf_->getParameter("VZMinProf"); + double VZMaxProf = conf_->getParameter("VZMaxProf"); + + + ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); + + histname = "DistanceOfClosestApproachError_"; + DistanceOfClosestApproachError = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyErrBin,0.,DxyErrMax); + DistanceOfClosestApproachError->setAxisTitle("Track d_{xy} error (cm)",1); + DistanceOfClosestApproachError->setAxisTitle("Number of Tracks",2); + + histname = "DistanceOfClosestApproachErrorVsPt_"; + DistanceOfClosestApproachErrorVsPt = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,PtBin,PtMin,PtMax,0.,DxyErrMax); + DistanceOfClosestApproachErrorVsPt->setAxisTitle("Track p_{T} (GeV)",1); + DistanceOfClosestApproachErrorVsPt->setAxisTitle("Track d_{xy} error (cm)",2); + + histname = "DistanceOfClosestApproachErrorVsEta_"; + DistanceOfClosestApproachErrorVsEta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,EtaBin,EtaMin,EtaMax,0.,DxyErrMax); + DistanceOfClosestApproachErrorVsEta->setAxisTitle("Track #eta",1); + DistanceOfClosestApproachErrorVsEta->setAxisTitle("Track d_{xy} error (cm)",2); + + histname = "DistanceOfClosestApproachErrorVsPhi_"; + DistanceOfClosestApproachErrorVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,PhiBin,PhiMin,PhiMax,0.,DxyErrMax); + DistanceOfClosestApproachErrorVsPhi->setAxisTitle("Track #phi",1); + DistanceOfClosestApproachErrorVsPhi->setAxisTitle("Track d_{xy} error (cm)",2); + + histname = "DistanceOfClosestApproachErrorVsDxy_"; + DistanceOfClosestApproachErrorVsDxy = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax,0.,DxyErrMax); + DistanceOfClosestApproachErrorVsDxy->setAxisTitle("Track d_{xy}",1); + DistanceOfClosestApproachErrorVsDxy->setAxisTitle("Track d_{xy} error (cm)",2); + + histname = "DistanceOfClosestApproachToBS_"; + DistanceOfClosestApproachToBS = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax); + DistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1); + DistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2); + + histname = "DistanceOfClosestApproachToBSdz_"; + DistanceOfClosestApproachToBSdz = ibooker.book1D(histname+CategoryName,histname+CategoryName,100,-1.1,1.1); + DistanceOfClosestApproachToBSdz->setAxisTitle("Track d_{z} wrt beam spot (cm)",1); + DistanceOfClosestApproachToBSdz->setAxisTitle("Number of Tracks",2); + + histname = "AbsDistanceOfClosestApproachToBS_"; + AbsDistanceOfClosestApproachToBS = ibooker.book1D(histname+CategoryName,histname+CategoryName,AbsDxyBin,AbsDxyMin,AbsDxyMax); + AbsDistanceOfClosestApproachToBS->setAxisTitle("Track |d_{xy}| wrt beam spot (cm)",1); + AbsDistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2); + + histname = "DistanceOfClosestApproachToBSVsPhi_"; + DistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,""); + DistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); + DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track #phi",1); + DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2); + + histname = "DistanceOfClosestApproachToBSVsEta_"; + DistanceOfClosestApproachToBSVsEta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, EtaBin, EtaMin, EtaMax, DxyBin, DxyMin, DxyMax,""); + DistanceOfClosestApproachToBSVsEta->getTH1()->SetCanExtend(TH1::kAllAxes); + DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track #eta",1); + DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2); + + histname = "xPointOfClosestApproachVsZ0wrt000_"; + xPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,""); + xPointOfClosestApproachVsZ0wrt000->setAxisTitle("d_{z} (cm)",1); + xPointOfClosestApproachVsZ0wrt000->setAxisTitle("x component of Track PCA to beam line (cm)",2); + + histname = "yPointOfClosestApproachVsZ0wrt000_"; + yPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,""); + yPointOfClosestApproachVsZ0wrt000->setAxisTitle("d_{z} (cm)",1); + yPointOfClosestApproachVsZ0wrt000->setAxisTitle("y component of Track PCA to beam line (cm)",2); + + histname = "xPointOfClosestApproachVsZ0wrtBS_"; + xPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,""); + xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1); + xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("x component of Track PCA to BS (cm)",2); + + histname = "yPointOfClosestApproachVsZ0wrtBS_"; + yPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,""); + yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1); + yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("y component of Track PCA to BS (cm)",2); + + histname = "zPointOfClosestApproachVsPhi_"; + zPointOfClosestApproachVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, VZBinProf, VZMinProf, VZMaxProf, ""); + zPointOfClosestApproachVsPhi->setAxisTitle("Track #phi",1); + zPointOfClosestApproachVsPhi->setAxisTitle("z component of Track PCA to beam line (cm)",2); + } + + if(doDCAPlots_ || doPVPlots_ || doAllPlots_) { + + int DxyBin = conf_->getParameter( "DxyBin"); + double DxyMin = conf_->getParameter("DxyMin"); + double DxyMax = conf_->getParameter("DxyMax"); + + int PhiBin = conf_->getParameter( "PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); + + int X0Bin = conf_->getParameter( "X0Bin"); + double X0Min = conf_->getParameter("X0Min"); + double X0Max = conf_->getParameter("X0Max"); + + int Y0Bin = conf_->getParameter( "Y0Bin"); + double Y0Min = conf_->getParameter("Y0Min"); + double Y0Max = conf_->getParameter("Y0Max"); + + int Z0Bin = conf_->getParameter( "Z0Bin"); + double Z0Min = conf_->getParameter("Z0Min"); + double Z0Max = conf_->getParameter("Z0Max"); + + ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); + + histname = "DistanceOfClosestApproachToPV_"; + DistanceOfClosestApproachToPV = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax); + DistanceOfClosestApproachToPV->setAxisTitle("Track d_{xy} w.r.t. PV (cm)",1); + DistanceOfClosestApproachToPV->setAxisTitle("Number of Tracks",2); + + histname = "DistanceOfClosestApproachToPVZoom_"; + DistanceOfClosestApproachToPVZoom = ibooker.book1D(histname+CategoryName,histname+CategoryName,100,-0.08,0.08); + DistanceOfClosestApproachToPVZoom->setAxisTitle("Track d_{xy} w.r.t. PV (cm)",1); + DistanceOfClosestApproachToPVZoom->setAxisTitle("Number of Tracks",2); + + + histname = "DeltaZToPV_"; + DeltaZToPV = ibooker.book1D(histname+CategoryName,histname+CategoryName,Z0Bin,Z0Min,Z0Max); + DeltaZToPV->setAxisTitle("Track d_{z} w.r.t. PV (cm)",1); + DeltaZToPV->setAxisTitle("Number of Tracks",2); + + histname = "DeltaZToPVZoom_"; + DeltaZToPVZoom = ibooker.book1D(histname+CategoryName,histname+CategoryName,100,-0.15,0.15); + DeltaZToPVZoom->setAxisTitle("Track d_{z} w.r.t. PV (cm)",1); + DeltaZToPVZoom->setAxisTitle("Number of Tracks",2); + + + histname = "DistanceOfClosestApproachToPVVsPhi_"; + DistanceOfClosestApproachToPVVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,""); + DistanceOfClosestApproachToPVVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); + DistanceOfClosestApproachToPVVsPhi->setAxisTitle("Track #phi",1); + DistanceOfClosestApproachToPVVsPhi->setAxisTitle("Track d_{xy} w.r.t. PV (cm)",2); + + histname = "xPointOfClosestApproachVsZ0wrtPV_"; + xPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,""); + xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. PV (cm)",1); + xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("x component of Track PCA to PV (cm)",2); + + histname = "yPointOfClosestApproachVsZ0wrtPV_"; + yPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,""); + yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. PV (cm)",1); + yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("y component of Track PCA to PV (cm)",2); + + } - int PhiBin = conf_->getParameter("PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); + if (doBSPlots_ || doAllPlots_) { + if (doTestPlots_) { + + int DxyBin = conf_->getParameter( "DxyBin"); + double DxyMin = conf_->getParameter("DxyMin"); + double DxyMax = conf_->getParameter("DxyMax"); + + int PhiBin = conf_->getParameter( "PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); + + histname = "TESTDistanceOfClosestApproachToBS_"; + TESTDistanceOfClosestApproachToBS = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax); + TESTDistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1); + TESTDistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2); + + histname = "TESTDistanceOfClosestApproachToBSVsPhi_"; + TESTDistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,""); + TESTDistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); + TESTDistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track #phi",1); + TESTDistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2); + + } + + } + + // book the Profile plots for DCA related histograms + // ---------------------------------------------------------------------------------// + if(doDCAPlots_ || doAllPlots_) { - int DxyBin = conf_->getParameter("DxyBin"); - double DxyMin = conf_->getParameter("DxyMin"); - double DxyMax = conf_->getParameter("DxyMax"); + if (doDCAwrt000Plots_) { - if (doThetaPlots_) { - int ThetaBin = conf_->getParameter("ThetaBin"); - double ThetaMin = conf_->getParameter("ThetaMin"); - double ThetaMax = conf_->getParameter("ThetaMax"); - - ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); - histname = "DistanceOfClosestApproachVsTheta_"; - DistanceOfClosestApproachVsTheta = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, ThetaBin, ThetaMin, ThetaMax, DxyMin, DxyMax, ""); - DistanceOfClosestApproachVsTheta->setAxisTitle("Track #theta", 1); - DistanceOfClosestApproachVsTheta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)", 2); + int EtaBin = conf_->getParameter( "EtaBin"); + double EtaMin = conf_->getParameter("EtaMin"); + double EtaMax = conf_->getParameter("EtaMax"); + + int PhiBin = conf_->getParameter( "PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); + + int DxyBin = conf_->getParameter( "DxyBin"); + double DxyMin = conf_->getParameter("DxyMin"); + double DxyMax = conf_->getParameter("DxyMax"); + + if (doThetaPlots_) { + int ThetaBin = conf_->getParameter( "ThetaBin"); + double ThetaMin = conf_->getParameter("ThetaMin"); + double ThetaMax = conf_->getParameter("ThetaMax"); + + ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); + histname = "DistanceOfClosestApproachVsTheta_"; + DistanceOfClosestApproachVsTheta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, ThetaBin, ThetaMin, ThetaMax, DxyMin,DxyMax,""); + DistanceOfClosestApproachVsTheta->setAxisTitle("Track #theta",1); + DistanceOfClosestApproachVsTheta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2); + } + + histname = "DistanceOfClosestApproachVsEta_"; + DistanceOfClosestApproachVsEta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, EtaBin, EtaMin, EtaMax, DxyMin, DxyMax,""); + DistanceOfClosestApproachVsEta->setAxisTitle("Track #eta",1); + DistanceOfClosestApproachVsEta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2); + // temporary patch in order to put back those MEs in Muon Workspace + + histname = "DistanceOfClosestApproach_"; + DistanceOfClosestApproach = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax); + DistanceOfClosestApproach->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",1); + DistanceOfClosestApproach->setAxisTitle("Number of Tracks",2); + + histname = "DistanceOfClosestApproachVsPhi_"; + DistanceOfClosestApproachVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyMin,DxyMax,""); + DistanceOfClosestApproachVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); + DistanceOfClosestApproachVsPhi->setAxisTitle("Track #phi",1); + DistanceOfClosestApproachVsPhi->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2); } - - histname = "DistanceOfClosestApproachVsEta_"; - DistanceOfClosestApproachVsEta = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, DxyMin, DxyMax, ""); - DistanceOfClosestApproachVsEta->setAxisTitle("Track #eta", 1); - DistanceOfClosestApproachVsEta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)", 2); - // temporary patch in order to put back those MEs in Muon Workspace - - histname = "DistanceOfClosestApproach_"; - DistanceOfClosestApproach = - ibooker.book1D(histname + CategoryName, histname + CategoryName, DxyBin, DxyMin, DxyMax); - DistanceOfClosestApproach->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)", 1); - DistanceOfClosestApproach->setAxisTitle("Number of Tracks", 2); - - histname = "DistanceOfClosestApproachVsPhi_"; - DistanceOfClosestApproachVsPhi = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, DxyMin, DxyMax, ""); - DistanceOfClosestApproachVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); - DistanceOfClosestApproachVsPhi->setAxisTitle("Track #phi", 1); - DistanceOfClosestApproachVsPhi->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)", 2); } - } - if (doSIPPlots_ || doAllPlots_) { - const double sipBins = 200; - const double sipMin = -20; - const double sipMax = 20; - - ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); - - // SIP wrt. beamspot - histname = "SIPDxyToBS_"; - sipDxyToBS = ibooker.book1D(histname + CategoryName, histname + CategoryName, sipBins, sipMin, sipMax); - sipDxyToBS->setAxisTitle("Track dxy significance wrt beam spot", 1); - sipDxyToBS->setAxisTitle("Number of Tracks", 2); - - histname = "SIPDzToBS_"; - sipDzToBS = ibooker.book1D(histname + CategoryName, histname + CategoryName, sipBins, sipMin, sipMax); - sipDzToBS->setAxisTitle("Track dz significance wrt beam spot", 1); - sipDzToBS->setAxisTitle("Number of Tracks", 2); - - // SIP wrt. vertex - histname = "SIP3DToPV_"; - sip3dToPV = ibooker.book1D(histname + CategoryName, histname + CategoryName, sipBins, sipMin, sipMax); - sip3dToPV->setAxisTitle("3D IP significance wrt primary vertex", 1); - sip3dToPV->setAxisTitle("Number of Tracks", 2); - - histname = "SIP2DToPV_"; - sip2dToPV = ibooker.book1D(histname + CategoryName, histname + CategoryName, sipBins, sipMin, sipMax); - sip2dToPV->setAxisTitle("2D IP significance wrt primary vertex", 1); - sip2dToPV->setAxisTitle("Number of Tracks", 2); - - histname = "SIPDxyToPV_"; - sipDxyToPV = ibooker.book1D(histname + CategoryName, histname + CategoryName, sipBins, sipMin, sipMax); - sipDxyToPV->setAxisTitle("Track dxy significance wrt primary vertex", 1); - sipDxyToPV->setAxisTitle("Number of Tracks", 2); - - histname = "SIPDzToPV_"; - sipDzToPV = ibooker.book1D(histname + CategoryName, histname + CategoryName, sipBins, sipMin, sipMax); - sipDzToPV->setAxisTitle("Track dz significance wrt primary vertex", 1); - sipDzToPV->setAxisTitle("Number of Tracks", 2); - } + + if (doSIPPlots_ || doAllPlots_) { + const double sipBins = 200; + const double sipMin = -20; + const double sipMax = 20; + + ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); + + // SIP wrt. beamspot + histname = "SIPDxyToBS_"; + sipDxyToBS = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax); + sipDxyToBS->setAxisTitle("Track dxy significance wrt beam spot",1); + sipDxyToBS->setAxisTitle("Number of Tracks",2); + + histname = "SIPDzToBS_"; + sipDzToBS = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax); + sipDzToBS->setAxisTitle("Track dz significance wrt beam spot",1); + sipDzToBS->setAxisTitle("Number of Tracks",2); + + // SIP wrt. vertex + histname = "SIP3DToPV_"; + sip3dToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax); + sip3dToPV->setAxisTitle("3D IP significance wrt primary vertex",1); + sip3dToPV->setAxisTitle("Number of Tracks",2); + + histname = "SIP2DToPV_"; + sip2dToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax); + sip2dToPV->setAxisTitle("2D IP significance wrt primary vertex",1); + sip2dToPV->setAxisTitle("Number of Tracks",2); + + histname = "SIPDxyToPV_"; + sipDxyToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax); + sipDxyToPV->setAxisTitle("Track dxy significance wrt primary vertex",1); + sipDxyToPV->setAxisTitle("Number of Tracks",2); + + histname = "SIPDzToPV_"; + sipDzToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax); + sipDzToPV->setAxisTitle("Track dz significance wrt primary vertex",1); + sipDzToPV->setAxisTitle("Number of Tracks",2); + } } // -- Analyse // ---------------------------------------------------------------------------------// -void TrackAnalyzer::setNumberOfGoodVertices(const edm::Event& iEvent) { - good_vertices_ = 0; +void TrackAnalyzer::setNumberOfGoodVertices(const edm::Event & iEvent) { + good_vertices_ = 0; + edm::Handle recoPrimaryVerticesHandle; iEvent.getByToken(pvToken_, recoPrimaryVerticesHandle); if (recoPrimaryVerticesHandle.isValid()) @@ -1090,23 +1050,26 @@ void TrackAnalyzer::setNumberOfGoodVertices(const edm::Event& iEvent) { ++good_vertices_; } -void TrackAnalyzer::setBX(const edm::Event& iEvent) { bx_ = iEvent.bunchCrossing(); } +void TrackAnalyzer::setBX(const edm::Event & iEvent) { + bx_ = iEvent.bunchCrossing(); +} #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -void TrackAnalyzer::setLumi(const edm::Event& iEvent, const edm::EventSetup& iSetup) { +void TrackAnalyzer::setLumi(const edm::Event & iEvent, const edm::EventSetup& iSetup) { // as done by pixelLumi http://cmslxr.fnal.gov/source/DQM/PixelLumi/plugins/PixelLumiDQM.cc edm::Handle lumiScalers; iEvent.getByToken(lumiscalersToken_, lumiScalers); - if (lumiScalers.isValid() && !lumiScalers->empty()) { + if ( lumiScalers.isValid() && !lumiScalers->empty() ) { LumiScalersCollection::const_iterator scalit = lumiScalers->begin(); scal_lumi_ = scalit->instantLumi(); - } else + } else scal_lumi_ = -1; - edm::Handle > pixelClusters; + edm::Handle< edmNew::DetSetVector > pixelClusters; iEvent.getByToken(pixelClustersToken_, pixelClusters); - if (pixelClusters.isValid()) { + if ( pixelClusters.isValid() ) { + edm::ESHandle tTopoHandle; iSetup.get().get(tTopoHandle); const TrackerTopology* const tTopo = tTopoHandle.product(); @@ -1116,116 +1079,116 @@ void TrackAnalyzer::setLumi(const edm::Event& iEvent, const edm::EventSetup& iSe size_t numClusters = 0; size_t tot = 0; - edmNew::DetSetVector::const_iterator pixCluDet = pixelClusters->begin(); - for (; pixCluDet != pixelClusters->end(); ++pixCluDet) { + edmNew::DetSetVector::const_iterator pixCluDet = pixelClusters->begin(); + for ( ; pixCluDet!=pixelClusters->end(); ++pixCluDet) { + DetId detid = pixCluDet->detId(); size_t subdetid = detid.subdetId(); // std::cout << tTopo->print(detid) << std::endl; - if (subdetid == (int)PixelSubdetector::PixelBarrel) - if (tTopo->layer(detid) == 1) - continue; - - edmNew::DetSet::const_iterator pixClu = pixCluDet->begin(); - for (; pixClu != pixCluDet->end(); ++pixClu) { - ++tot; - if ((pixClu->size() >= minNumberOfPixelsPerCluster_) && (pixClu->charge() >= minPixelClusterCharge_)) { - ++numClusters; - } + if ( subdetid == (int) PixelSubdetector::PixelBarrel ) + if ( tTopo->layer(detid)==1 ) + continue; + + edmNew::DetSet::const_iterator pixClu = pixCluDet->begin(); + for ( ; pixClu != pixCluDet->end(); ++pixClu ) { + ++tot; + if ( (pixClu->size() >= minNumberOfPixelsPerCluster_) && + (pixClu->charge() >= minPixelClusterCharge_ ) ) { + ++numClusters; + } } } - pixel_lumi_ = lumi_factor_per_bx_ * numClusters / GetLumi::CM2_TO_NANOBARN; // ?!?! + pixel_lumi_ = lumi_factor_per_bx_ * numClusters / GetLumi::CM2_TO_NANOBARN ; // ?!?! } else pixel_lumi_ = -1.; + } -void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track) { - auto pt = track.pt(); - auto phi = track.phi(); +void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track) +{ + auto pt = track.pt(); + auto phi = track.phi(); // double eta = track.eta(); - auto phiIn = track.innerPosition().phi(); - auto etaIn = track.innerPosition().eta(); - auto phiOut = track.outerPosition().phi(); - auto etaOut = track.outerPosition().eta(); + auto phiIn = track.innerPosition().phi(); + auto etaIn = track.innerPosition().eta(); + auto phiOut = track.outerPosition().phi(); + auto etaOut = track.outerPosition().eta(); - int nRecHits = track.hitPattern().numberOfAllHits(reco::HitPattern::TRACK_HITS); + int nRecHits = track.hitPattern().numberOfAllHits(reco::HitPattern::TRACK_HITS); int nValidRecHits = track.numberOfValidHits(); - int nLostRecHits = track.numberOfLostHits(); - int nLostIn = track.hitPattern().numberOfLostTrackerHits(reco::HitPattern::MISSING_INNER_HITS); - int nLostOut = track.hitPattern().numberOfLostTrackerHits(reco::HitPattern::MISSING_OUTER_HITS); + int nLostRecHits = track.numberOfLostHits(); + int nLostIn = track.hitPattern().numberOfLostTrackerHits(reco::HitPattern::MISSING_INNER_HITS); + int nLostOut = track.hitPattern().numberOfLostTrackerHits(reco::HitPattern::MISSING_OUTER_HITS); - auto chi2 = track.chi2(); - auto chi2prob = TMath::Prob(track.chi2(), (int)track.ndof()); + auto chi2 = track.chi2(); + auto chi2prob = TMath::Prob(track.chi2(),(int)track.ndof()); auto chi2oNDF = track.normalizedChi2(); - - if (doHitPropertiesPlots_ || doAllPlots_) { + + if ( doHitPropertiesPlots_ || doAllPlots_ ){ // rec hits - NumberOfRecHitsPerTrack->Fill(nRecHits); - NumberOfValidRecHitsPerTrack->Fill(nValidRecHits); - NumberOfLostRecHitsPerTrack->Fill(nLostRecHits); - NumberOfMIRecHitsPerTrack->Fill(nLostIn); - NumberOfMORecHitsPerTrack->Fill(nLostOut); - ValidFractionPerTrack->Fill(track.validFraction()); - - // 2D plots - if (doRecHitVsPhiVsEtaPerTrack_ || doAllPlots_) { - NumberOfValidRecHitVsPhiVsEtaPerTrack->Fill(etaIn, phiIn, nValidRecHits); - NumberOfLostRecHitVsPhiVsEtaPerTrack->Fill(etaIn, phiIn, nLostRecHits); - NumberOfMIRecHitVsPhiVsEtaPerTrack->Fill(etaIn, phiIn, nLostIn); - NumberOfMORecHitVsPhiVsEtaPerTrack->Fill(etaOut, phiOut, nLostOut); - ValidFractionVsPhiVsEtaPerTrack->Fill(etaIn, phiIn, track.validFraction()); + NumberOfRecHitsPerTrack -> Fill(nRecHits); + NumberOfValidRecHitsPerTrack-> Fill(nValidRecHits); + NumberOfLostRecHitsPerTrack -> Fill(nLostRecHits); + NumberOfMIRecHitsPerTrack -> Fill(nLostIn); + NumberOfMORecHitsPerTrack -> Fill(nLostOut); + ValidFractionPerTrack -> Fill(track.validFraction()); + + + // 2D plots + if ( doRecHitVsPhiVsEtaPerTrack_ || doAllPlots_ ) { + NumberOfValidRecHitVsPhiVsEtaPerTrack->Fill(etaIn,phiIn,nValidRecHits); + NumberOfLostRecHitVsPhiVsEtaPerTrack->Fill(etaIn,phiIn,nLostRecHits); + NumberOfMIRecHitVsPhiVsEtaPerTrack->Fill(etaIn,phiIn,nLostIn); + NumberOfMORecHitVsPhiVsEtaPerTrack->Fill(etaOut,phiOut,nLostOut); + ValidFractionVsPhiVsEtaPerTrack -> Fill(etaIn,phiIn,track.validFraction()); } - if (doRecHitVsPtVsEtaPerTrack_ || doAllPlots_) { - NumberOfValidRecHitVsPtVsEtaPerTrack->Fill(etaIn, pt, nValidRecHits); - NumberOfLostRecHitVsPtVsEtaPerTrack->Fill(etaIn, pt, nLostRecHits); - NumberOfMIRecHitVsPtVsEtaPerTrack->Fill(etaIn, pt, nLostIn); - NumberOfMORecHitVsPtVsEtaPerTrack->Fill(etaOut, pt, nLostOut); + if ( doRecHitVsPtVsEtaPerTrack_ || doAllPlots_ ) { + NumberOfValidRecHitVsPtVsEtaPerTrack->Fill(etaIn,pt,nValidRecHits); + NumberOfLostRecHitVsPtVsEtaPerTrack->Fill(etaIn,pt,nLostRecHits); + NumberOfMIRecHitVsPtVsEtaPerTrack->Fill(etaIn,pt,nLostIn); + NumberOfMORecHitVsPtVsEtaPerTrack->Fill(etaOut,pt,nLostOut); } - NumberOfValidRecHitsPerTrackVsPt->Fill(pt, nValidRecHits); - NumberOfLostRecHitsPerTrackVsPt->Fill(pt, nLostRecHits); - NumberOfMIRecHitsPerTrackVsPt->Fill(pt, nLostIn); - NumberOfMORecHitsPerTrackVsPt->Fill(pt, nLostOut); - - int nLayers[5] = {track.hitPattern().trackerLayersWithMeasurement(), - track.hitPattern().trackerLayersTotallyOffOrBad(), - track.hitPattern().numberOfValidStripLayersWithMonoAndStereo() + - track.hitPattern().pixelLayersWithMeasurement(), - track.hitPattern().trackerLayersWithoutMeasurement(reco::HitPattern::TRACK_HITS), - track.hitPattern().pixelLayersWithMeasurement()}; + NumberOfValidRecHitsPerTrackVsPt->Fill(pt,nValidRecHits); + NumberOfLostRecHitsPerTrackVsPt->Fill(pt,nLostRecHits); + NumberOfMIRecHitsPerTrackVsPt->Fill(pt,nLostIn); + NumberOfMORecHitsPerTrackVsPt->Fill(pt,nLostOut); + + int nLayers[5] = { track.hitPattern().trackerLayersWithMeasurement(), + track.hitPattern().trackerLayersTotallyOffOrBad(), + track.hitPattern().numberOfValidStripLayersWithMonoAndStereo() + track.hitPattern().pixelLayersWithMeasurement(), + track.hitPattern().trackerLayersWithoutMeasurement(reco::HitPattern::TRACK_HITS), + track.hitPattern().pixelLayersWithMeasurement() + }; // layers - for (int i = 0; i < 4; ++i) - NumberOfLayersPerTrack[i]->Fill(nLayers[i]); + for (int i=0;i<4;++i) NumberOfLayersPerTrack[i]->Fill(nLayers[i]); + + // 2D plots + if ( doLayersVsPhiVsEtaPerTrack_ || doAllPlots_ ) + for (int i=0;i<5;++i) NumberOfLayersVsPhiVsEtaPerTrack[i]->Fill(etaIn,phiIn,nLayers[i]); - // 2D plots - if (doLayersVsPhiVsEtaPerTrack_ || doAllPlots_) - for (int i = 0; i < 5; ++i) - NumberOfLayersVsPhiVsEtaPerTrack[i]->Fill(etaIn, phiIn, nLayers[i]); } - if (doEffFromHitPatternVsPU_ || doAllPlots_) - fillHistosForEfficiencyFromHitPatter(track, "", float(good_vertices_), false); - if (doEffFromHitPatternVsBX_ || doAllPlots_) - fillHistosForEfficiencyFromHitPatter(track, "VsBX", float(bx_), false); - if (doEffFromHitPatternVsLUMI_ || doAllPlots_) - fillHistosForEfficiencyFromHitPatter(track, "VsSCALLUMI", scal_lumi_, false); + if (doEffFromHitPatternVsPU_ || doAllPlots_) fillHistosForEfficiencyFromHitPatter(track,"", float(good_vertices_), false ); + if (doEffFromHitPatternVsBX_ || doAllPlots_) fillHistosForEfficiencyFromHitPatter(track,"VsBX", float(bx_), false ); + if (doEffFromHitPatternVsLUMI_ || doAllPlots_) fillHistosForEfficiencyFromHitPatter(track,"VsSCALLUMI", scal_lumi_, false ); // if (doEffFromHitPatternVsLUMI_ || doAllPlots_) fillHistosForEfficiencyFromHitPatter(track,"VsPIXELLUMI", pixel_lumi_ ); - if (doEffFromHitPatternVsPU_ || doAllPlots_) - fillHistosForEfficiencyFromHitPatter(track, "", float(good_vertices_), true); - if (doEffFromHitPatternVsLUMI_ || doAllPlots_) - fillHistosForEfficiencyFromHitPatter(track, "VsSCALLUMI", scal_lumi_, true); + if (doEffFromHitPatternVsPU_ || doAllPlots_) fillHistosForEfficiencyFromHitPatter(track,"", float(good_vertices_), true ); + if (doEffFromHitPatternVsLUMI_ || doAllPlots_) fillHistosForEfficiencyFromHitPatter(track,"VsSCALLUMI", scal_lumi_, true ); + - if (doGeneralPropertiesPlots_ || doAllPlots_) { + if (doGeneralPropertiesPlots_ || doAllPlots_){ // fitting - Chi2->Fill(chi2); - Chi2Prob->Fill(chi2prob); - Chi2oNDF->Fill(chi2oNDF); + Chi2 -> Fill(chi2); + Chi2Prob -> Fill(chi2prob); + Chi2oNDF -> Fill(chi2oNDF); // DCA - // temporary patch in order to put back those MEs in Muon Workspace + // temporary patch in order to put back those MEs in Muon Workspace if (doDCAPlots_) { if (doDCAwrt000Plots_) { - DistanceOfClosestApproach->Fill(track.dxy()); - DistanceOfClosestApproachVsPhi->Fill(phi, track.dxy()); + DistanceOfClosestApproach->Fill(track.dxy()); + DistanceOfClosestApproachVsPhi->Fill(phi, track.dxy()); } // PCA @@ -1240,893 +1203,1143 @@ void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe // stopping source int max = stoppingSource->getNbinsX(); - double stop = track.stopReason() > max ? double(max - 1) : static_cast(track.stopReason()); - double stopped = int(StopReason::NOT_STOPPED) == track.stopReason() ? 0. : 1.; + double stop = track.stopReason() > max ? double(max-1) : static_cast(track.stopReason()); + double stopped = int(StopReason::NOT_STOPPED)==track.stopReason() ? 0. : 1.; stoppingSource->Fill(stop); - stoppingSourceVSeta->Fill(track.eta(), stopped); - stoppingSourceVSphi->Fill(track.phi(), stopped); + stoppingSourceVSeta->Fill(track.eta(),stopped); + stoppingSourceVSphi->Fill(track.phi(),stopped); } - if (doLumiAnalysis_) { - NumberOfRecHitsPerTrack_lumiFlag->Fill(nRecHits); - Chi2oNDF_lumiFlag->Fill(chi2oNDF); + if ( doLumiAnalysis_ ) { + NumberOfRecHitsPerTrack_lumiFlag -> Fill(nRecHits); + Chi2oNDF_lumiFlag -> Fill(chi2oNDF); } - if (doDCAPlots_ || doBSPlots_ || doSIPPlots_ || doAllPlots_) { + if(doDCAPlots_ || doBSPlots_ || doSIPPlots_ || doAllPlots_) { + edm::Handle recoBeamSpotHandle; - iEvent.getByToken(beamSpotToken_, recoBeamSpotHandle); + iEvent.getByToken(beamSpotToken_,recoBeamSpotHandle); const reco::BeamSpot& bs = *recoBeamSpotHandle; - DistanceOfClosestApproachError->Fill(track.dxyError()); - DistanceOfClosestApproachErrorVsPt->Fill(track.pt(), track.dxyError()); - DistanceOfClosestApproachErrorVsEta->Fill(track.eta(), track.dxyError()); - DistanceOfClosestApproachErrorVsPhi->Fill(track.phi(), track.dxyError()); - DistanceOfClosestApproachErrorVsDxy->Fill(track.dxy(bs.position()), track.dxyError()); - - DistanceOfClosestApproachToBS->Fill(track.dxy(bs.position())); - AbsDistanceOfClosestApproachToBS->Fill(std::abs(track.dxy(bs.position()))); - DistanceOfClosestApproachToBSVsPhi->Fill(track.phi(), track.dxy(bs.position())); - zPointOfClosestApproachVsPhi->Fill(track.phi(), track.vz()); - xPointOfClosestApproachVsZ0wrt000->Fill(track.dz(), track.vx()); - yPointOfClosestApproachVsZ0wrt000->Fill(track.dz(), track.vy()); - xPointOfClosestApproachVsZ0wrtBS->Fill(track.dz(bs.position()), (track.vx() - bs.position(track.vz()).x())); - yPointOfClosestApproachVsZ0wrtBS->Fill(track.dz(bs.position()), (track.vy() - bs.position(track.vz()).y())); + DistanceOfClosestApproachError -> Fill(track.dxyError()); + DistanceOfClosestApproachErrorVsPt -> Fill(track.pt(),track.dxyError()); + DistanceOfClosestApproachErrorVsEta -> Fill(track.eta(),track.dxyError()); + DistanceOfClosestApproachErrorVsPhi -> Fill(track.phi(),track.dxyError()); + DistanceOfClosestApproachErrorVsDxy -> Fill(track.dxy(bs.position()),track.dxyError()); + + DistanceOfClosestApproachToBS -> Fill(track.dxy(bs.position())); + DistanceOfClosestApproachToBSdz -> Fill(track.dz(bs.position())); + AbsDistanceOfClosestApproachToBS -> Fill(std::abs(track.dxy(bs.position()))); + DistanceOfClosestApproachToBSVsPhi -> Fill(track.phi(), track.dxy(bs.position())); + DistanceOfClosestApproachToBSVsEta -> Fill(track.eta(), track.dxy(bs.position())); + zPointOfClosestApproachVsPhi -> Fill(track.phi(), track.vz()); + xPointOfClosestApproachVsZ0wrt000 -> Fill(track.dz(), track.vx()); + yPointOfClosestApproachVsZ0wrt000 -> Fill(track.dz(), track.vy()); + xPointOfClosestApproachVsZ0wrtBS -> Fill(track.dz(bs.position()),(track.vx()-bs.position(track.vz()).x())); + yPointOfClosestApproachVsZ0wrtBS -> Fill(track.dz(bs.position()),(track.vy()-bs.position(track.vz()).y())); if (doTestPlots_) { - TESTDistanceOfClosestApproachToBS->Fill(track.dxy(bs.position(track.vz()))); - TESTDistanceOfClosestApproachToBSVsPhi->Fill(track.phi(), track.dxy(bs.position(track.vz()))); + TESTDistanceOfClosestApproachToBS -> Fill(track.dxy(bs.position(track.vz()))); + TESTDistanceOfClosestApproachToBSVsPhi -> Fill(track.phi(), track.dxy(bs.position(track.vz()))); } - if (doSIPPlots_) { - sipDxyToBS->Fill(track.dxy(bs.position()) / track.dxyError()); - sipDzToBS->Fill(track.dz(bs.position()) / track.dzError()); + if(doSIPPlots_) { + sipDxyToBS->Fill(track.dxy(bs.position())/track.dxyError()); + sipDzToBS->Fill(track.dz(bs.position())/track.dzError()); } } - - if (doDCAPlots_ || doPVPlots_ || doSIPPlots_ || doAllPlots_) { + + if(doDCAPlots_ || doPVPlots_ || doSIPPlots_ || doAllPlots_) { edm::Handle recoPrimaryVerticesHandle; - iEvent.getByToken(pvToken_, recoPrimaryVerticesHandle); + iEvent.getByToken(pvToken_,recoPrimaryVerticesHandle); if (recoPrimaryVerticesHandle.isValid() && !recoPrimaryVerticesHandle->empty()) { const reco::Vertex& pv = (*recoPrimaryVerticesHandle)[0]; + ////////////////// - //HI PLOTS/////// - //////////////// - - if (doHIPlots_) { - double longDCAsig = 0, transDCAsig = 0; - double zerr2 = track.dzError() * track.dzError() + pv.zError() * pv.zError(); - double xyerr2 = track.d0Error() * track.d0Error() + pv.xError() * pv.yError(); - if (zerr2 > 0) - longDCAsig = track.dz(pv.position()) / zerr2; - if (xyerr2 > 0) - transDCAsig = track.dxy(pv.position()) / xyerr2; - LongDCASig->Fill(longDCAsig); - TransDCASig->Fill(transDCAsig); - - if (track.quality(reco::TrackBase::qualityByName(qualityString_)) == 1) { - dNdEta_HighPurity->Fill(track.eta()); - dNdPhi_HighPurity->Fill(track.phi()); - dNdPt_HighPurity->Fill(track.ptError() / track.pt()); - NhitVsEta_HighPurity->Fill(track.eta(), track.numberOfValidHits()); - NhitVsPhi_HighPurity->Fill(track.phi(), track.numberOfValidHits()); - dNhitdPt_HighPurity->Fill(track.pt(), track.numberOfValidHits()); - Ptdist_HighPurity->Fill(track.pt()); - } //end of high quality tracks requirement - } + //HI PLOTS/////// + //////////////// + + if(doHIPlots_) + { + double longDCAsig = 0, transDCAsig = 0; + double zerr2 = track.dzError()*track.dzError()+pv.zError()*pv.zError(); + double xyerr2 = track.d0Error()*track.d0Error()+pv.xError()*pv.yError(); + if(zerr2 > 0) longDCAsig = track.dz(pv.position())/zerr2; + if(xyerr2 > 0) transDCAsig = track.dxy(pv.position())/xyerr2; + LongDCASig->Fill(longDCAsig); + TransDCASig->Fill(transDCAsig); + + + + + if(track.quality(reco::TrackBase::qualityByName(qualityString_)) ==1) + { + dNdEta_HighPurity->Fill(track.eta()); + dNdPhi_HighPurity->Fill(track.phi()); + dNdPt_HighPurity->Fill(track.ptError()/track.pt()); + NhitVsEta_HighPurity->Fill(track.eta(),track.numberOfValidHits()); + NhitVsPhi_HighPurity->Fill(track.phi(),track.numberOfValidHits()); + dNhitdPt_HighPurity->Fill(track.pt(),track.numberOfValidHits()); + Ptdist_HighPurity->Fill(track.pt()); + }//end of high quality tracks requirement + } + - xPointOfClosestApproachToPV->Fill(track.vx() - pv.position().x()); - yPointOfClosestApproachToPV->Fill(track.vy() - pv.position().y()); + xPointOfClosestApproachToPV->Fill(track.vx()-pv.position().x()); + yPointOfClosestApproachToPV->Fill(track.vy()-pv.position().y()); zPointOfClosestApproachToPV->Fill(track.dz(pv.position())); - DistanceOfClosestApproachToPV->Fill(track.dxy(pv.position())); - DeltaZToPV->Fill(track.dz(pv.position())); - DistanceOfClosestApproachToPVZoom->Fill(track.dxy(pv.position())); - DeltaZToPVZoom->Fill(track.dz(pv.position())); - DistanceOfClosestApproachToPVVsPhi->Fill(track.phi(), track.dxy(pv.position())); - xPointOfClosestApproachVsZ0wrtPV->Fill(track.dz(pv.position()), (track.vx() - pv.position().x())); - yPointOfClosestApproachVsZ0wrtPV->Fill(track.dz(pv.position()), (track.vy() - pv.position().y())); - - if (doSIPPlots_) { + DistanceOfClosestApproachToPV -> Fill(track.dxy(pv.position())); + DeltaZToPV -> Fill(track.dz (pv.position())); + DistanceOfClosestApproachToPVZoom -> Fill(track.dxy(pv.position())); + DeltaZToPVZoom -> Fill(track.dz (pv.position())); + DistanceOfClosestApproachToPVVsPhi -> Fill(track.phi(), track.dxy(pv.position())); + xPointOfClosestApproachVsZ0wrtPV -> Fill(track.dz(pv.position()),(track.vx()-pv.position().x())); + yPointOfClosestApproachVsZ0wrtPV -> Fill(track.dz(pv.position()),(track.vy()-pv.position().y())); + + + if(doSIPPlots_) { edm::ESHandle theB; - iSetup.get().get("TransientTrackBuilder", theB); + iSetup.get().get("TransientTrackBuilder",theB); reco::TransientTrack transTrack = theB->build(track); GlobalVector dir(track.px(), track.py(), track.pz()); std::pair ip3d = IPTools::signedImpactParameter3D(transTrack, dir, pv); std::pair ip2d = IPTools::signedTransverseImpactParameter(transTrack, dir, pv); - if (ip3d.first) - sip3dToPV->Fill(ip3d.second.value() / ip3d.second.error()); - if (ip2d.first) - sip2dToPV->Fill(ip2d.second.value() / ip2d.second.error()); - sipDxyToPV->Fill(track.dxy(pv.position()) / track.dxyError()); - sipDzToPV->Fill(track.dz(pv.position()) / track.dzError()); + if(ip3d.first) sip3dToPV->Fill(ip3d.second.value() / ip3d.second.error()); + if(ip2d.first) sip2dToPV->Fill(ip2d.second.value() / ip2d.second.error()); + sipDxyToPV->Fill(track.dxy(pv.position())/track.dxyError()); + sipDzToPV->Fill(track.dz(pv.position())/track.dzError()); } } } - if (doDCAPlots_ || doAllPlots_) { + if(doDCAPlots_ || doAllPlots_) { if (doDCAwrt000Plots_) { if (doThetaPlots_) { - DistanceOfClosestApproachVsTheta->Fill(track.theta(), track.d0()); + DistanceOfClosestApproachVsTheta->Fill(track.theta(), track.d0()); } DistanceOfClosestApproachVsEta->Fill(track.eta(), track.d0()); - } + } + } //Tracker Specific Histograms - if (doTrackerSpecific_ || doAllPlots_) { + if(doTrackerSpecific_ || doAllPlots_) { fillHistosForTrackerSpecific(track); } - if (doMeasurementStatePlots_ || doAllPlots_) { + if (doMeasurementStatePlots_ || doAllPlots_){ + if (stateName_ == "All") { fillHistosForState(iSetup, track, std::string("OuterSurface")); fillHistosForState(iSetup, track, std::string("InnerSurface")); fillHistosForState(iSetup, track, std::string("ImpactPoint")); - } else if (stateName_ != "OuterSurface" && stateName_ != "InnerSurface" && stateName_ != "ImpactPoint" && - stateName_ != "default") { + } else if ( + stateName_ != "OuterSurface" && + stateName_ != "InnerSurface" && + stateName_ != "ImpactPoint" && + stateName_ != "default" + ) { fillHistosForState(iSetup, track, std::string("default")); } else { fillHistosForState(iSetup, track, stateName_); } } - - if (doAllPlots_) { + + if ( doAllPlots_ ) { } + } -void TrackAnalyzer::fillHistosForEfficiencyFromHitPatter(const reco::Track& track, - const std::string suffix, - const float monitoring, - bool useInac) { - int mon = -1; - for (int i = 0; i < monQuantity::END; i++) { - if (monName[i] == suffix) - mon = i; - } - if (useInac) - mon += monQuantity::END; - - // if (track.pt() > 1.0 && track.dxy() < 0.1 and monitoring > 0) { - if (track.pt() > 1.0 && track.dxy() < 0.1 and monitoring > -9.) { - 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.numberOfAllHits((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), mon)) == - hits_valid_.end()) { - LogDebug("TrackAnalyzer") << "Invalid combination of detector and subdetector: (" - << hp.getSubStructure(pattern) << ", " << hp.getSubSubStructure(pattern) << ", " - << mon << "): ignoring it.\n"; - continue; - } - switch (hit_type) { - case 0: - hits_valid_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring); - hits_total_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring); - break; - case 2: - if (!useInac) +void TrackAnalyzer::fillHistosForEfficiencyFromHitPatter(const reco::Track & track, const std::string suffix, const float monitoring, bool useInac) { + + int mon = -1; + for (int i=0; i 1.0 && track.dxy() < 0.1 and monitoring > 0) { + if (track.pt() > 1.0 && track.dxy() < 0.1 and monitoring > -9.) { + 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.numberOfAllHits((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), mon)) == hits_valid_.end()) { + LogDebug("TrackAnalyzer") << "Invalid combination of detector and subdetector: (" + << hp.getSubStructure(pattern) << ", " + << hp.getSubSubStructure(pattern) << ", " + << mon + << "): ignoring it.\n"; + continue; + } + switch (hit_type) { + case 0: + hits_valid_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring); + hits_total_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring); break; - case 1: - hits_total_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring); - break; - default: - LogDebug("TrackAnalyzer") << "Invalid hit category used " << hit_type << " ignored\n"; + case 2: + if (!useInac) break; + case 1: + hits_total_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring); + break; + default: + LogDebug("TrackAnalyzer") << "Invalid hit category used " << hit_type << " ignored\n"; + } } } } - } + } // book histograms at differnt measurement points // ---------------------------------------------------------------------------------// -void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibooker) { - // parameters from the configuration - std::string QualName = conf_->getParameter("Quality"); - std::string AlgoName = conf_->getParameter("AlgoName"); +void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker & ibooker) +{ - // use the AlgoName and Quality Name - std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; + // parameters from the configuration + std::string QualName = conf_->getParameter("Quality"); + std::string AlgoName = conf_->getParameter("AlgoName"); - // get binning from the configuration - double Chi2NDFMin = conf_->getParameter("Chi2NDFMin"); - double Chi2NDFMax = conf_->getParameter("Chi2NDFMax"); + // use the AlgoName and Quality Name + std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; - int RecHitBin = conf_->getParameter("RecHitBin"); - double RecHitMin = conf_->getParameter("RecHitMin"); - double RecHitMax = conf_->getParameter("RecHitMax"); + // get binning from the configuration + double Chi2NDFMin = conf_->getParameter("Chi2NDFMin"); + double Chi2NDFMax = conf_->getParameter("Chi2NDFMax"); - int RecLayBin = conf_->getParameter("RecHitBin"); - double RecLayMin = conf_->getParameter("RecHitMin"); - double RecLayMax = conf_->getParameter("RecHitMax"); + int RecHitBin = conf_->getParameter( "RecHitBin"); + double RecHitMin = conf_->getParameter("RecHitMin"); + double RecHitMax = conf_->getParameter("RecHitMax"); - int PhiBin = conf_->getParameter("PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); + int RecLayBin = conf_->getParameter( "RecHitBin"); + double RecLayMin = conf_->getParameter("RecHitMin"); + double RecLayMax = conf_->getParameter("RecHitMax"); - int EtaBin = conf_->getParameter("EtaBin"); - double EtaMin = conf_->getParameter("EtaMin"); - double EtaMax = conf_->getParameter("EtaMax"); - int Phi2DBin = conf_->getParameter("Phi2DBin"); - int Eta2DBin = conf_->getParameter("Eta2DBin"); + int PhiBin = conf_->getParameter( "PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); - int ThetaBin = conf_->getParameter("ThetaBin"); - double ThetaMin = conf_->getParameter("ThetaMin"); - double ThetaMax = conf_->getParameter("ThetaMax"); + int EtaBin = conf_->getParameter( "EtaBin"); + double EtaMin = conf_->getParameter("EtaMin"); + double EtaMax = conf_->getParameter("EtaMax"); - int TrackQBin = conf_->getParameter("TrackQBin"); - double TrackQMin = conf_->getParameter("TrackQMin"); - double TrackQMax = conf_->getParameter("TrackQMax"); + int Phi2DBin = conf_->getParameter( "Phi2DBin"); + int Eta2DBin = conf_->getParameter( "Eta2DBin"); - int TrackPtBin = conf_->getParameter("TrackPtBin"); - double TrackPtMin = conf_->getParameter("TrackPtMin"); - double TrackPtMax = conf_->getParameter("TrackPtMax"); + int ThetaBin = conf_->getParameter( "ThetaBin"); + double ThetaMin = conf_->getParameter("ThetaMin"); + double ThetaMax = conf_->getParameter("ThetaMax"); - int TrackPBin = conf_->getParameter("TrackPBin"); - double TrackPMin = conf_->getParameter("TrackPMin"); - double TrackPMax = conf_->getParameter("TrackPMax"); + int TrackQBin = conf_->getParameter( "TrackQBin"); + double TrackQMin = conf_->getParameter("TrackQMin"); + double TrackQMax = conf_->getParameter("TrackQMax"); - int TrackPxBin = conf_->getParameter("TrackPxBin"); - double TrackPxMin = conf_->getParameter("TrackPxMin"); - double TrackPxMax = conf_->getParameter("TrackPxMax"); + int TrackPtBin = conf_->getParameter( "TrackPtBin"); + double TrackPtMin = conf_->getParameter("TrackPtMin"); + double TrackPtMax = conf_->getParameter("TrackPtMax"); - int TrackPyBin = conf_->getParameter("TrackPyBin"); - double TrackPyMin = conf_->getParameter("TrackPyMin"); - double TrackPyMax = conf_->getParameter("TrackPyMax"); + int TrackPBin = conf_->getParameter( "TrackPBin"); + double TrackPMin = conf_->getParameter("TrackPMin"); + double TrackPMax = conf_->getParameter("TrackPMax"); - int TrackPzBin = conf_->getParameter("TrackPzBin"); - double TrackPzMin = conf_->getParameter("TrackPzMin"); - double TrackPzMax = conf_->getParameter("TrackPzMax"); + int TrackPxBin = conf_->getParameter( "TrackPxBin"); + double TrackPxMin = conf_->getParameter("TrackPxMin"); + double TrackPxMax = conf_->getParameter("TrackPxMax"); - int ptErrBin = conf_->getParameter("ptErrBin"); - double ptErrMin = conf_->getParameter("ptErrMin"); - double ptErrMax = conf_->getParameter("ptErrMax"); + int TrackPyBin = conf_->getParameter( "TrackPyBin"); + double TrackPyMin = conf_->getParameter("TrackPyMin"); + double TrackPyMax = conf_->getParameter("TrackPyMax"); - int pxErrBin = conf_->getParameter("pxErrBin"); - double pxErrMin = conf_->getParameter("pxErrMin"); - double pxErrMax = conf_->getParameter("pxErrMax"); + int TrackPzBin = conf_->getParameter( "TrackPzBin"); + double TrackPzMin = conf_->getParameter("TrackPzMin"); + double TrackPzMax = conf_->getParameter("TrackPzMax"); - int pyErrBin = conf_->getParameter("pyErrBin"); - double pyErrMin = conf_->getParameter("pyErrMin"); - double pyErrMax = conf_->getParameter("pyErrMax"); + int ptErrBin = conf_->getParameter( "ptErrBin"); + double ptErrMin = conf_->getParameter("ptErrMin"); + double ptErrMax = conf_->getParameter("ptErrMax"); - int pzErrBin = conf_->getParameter("pzErrBin"); - double pzErrMin = conf_->getParameter("pzErrMin"); - double pzErrMax = conf_->getParameter("pzErrMax"); + int pxErrBin = conf_->getParameter( "pxErrBin"); + double pxErrMin = conf_->getParameter("pxErrMin"); + double pxErrMax = conf_->getParameter("pxErrMax"); - int pErrBin = conf_->getParameter("pErrBin"); - double pErrMin = conf_->getParameter("pErrMin"); - double pErrMax = conf_->getParameter("pErrMax"); + int pyErrBin = conf_->getParameter( "pyErrBin"); + double pyErrMin = conf_->getParameter("pyErrMin"); + double pyErrMax = conf_->getParameter("pyErrMax"); - int phiErrBin = conf_->getParameter("phiErrBin"); - double phiErrMin = conf_->getParameter("phiErrMin"); - double phiErrMax = conf_->getParameter("phiErrMax"); + int pzErrBin = conf_->getParameter( "pzErrBin"); + double pzErrMin = conf_->getParameter("pzErrMin"); + double pzErrMax = conf_->getParameter("pzErrMax"); - int etaErrBin = conf_->getParameter("etaErrBin"); - double etaErrMin = conf_->getParameter("etaErrMin"); - double etaErrMax = conf_->getParameter("etaErrMax"); + int pErrBin = conf_->getParameter( "pErrBin"); + double pErrMin = conf_->getParameter("pErrMin"); + double pErrMax = conf_->getParameter("pErrMax"); - double Chi2ProbMin = conf_->getParameter("Chi2ProbMin"); - double Chi2ProbMax = conf_->getParameter("Chi2ProbMax"); + int phiErrBin = conf_->getParameter( "phiErrBin"); + double phiErrMin = conf_->getParameter("phiErrMin"); + double phiErrMax = conf_->getParameter("phiErrMax"); - ibooker.setCurrentFolder(TopFolder_); + int etaErrBin = conf_->getParameter( "etaErrBin"); + double etaErrMin = conf_->getParameter("etaErrMin"); + double etaErrMax = conf_->getParameter("etaErrMax"); - TkParameterMEs tkmes; - std::string histTag = (sname == "default") ? CategoryName : sname + "_" + CategoryName; + double Chi2ProbMin = conf_->getParameter("Chi2ProbMin"); + double Chi2ProbMax = conf_->getParameter("Chi2ProbMax"); - if (doAllPlots_) { - // general properties - ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); + ibooker.setCurrentFolder(TopFolder_); - if (doThetaPlots_) { - histname = "Chi2oNDFVsTheta_" + histTag; - tkmes.Chi2oNDFVsTheta = - ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax, ""); - tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta", 1); - tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf", 2); - } - histname = "Chi2oNDFVsPhi_" + histTag; - tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax, ""); - tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi", 1); - tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf", 2); - - histname = "Chi2ProbVsPhi_" + histTag; - tkmes.Chi2ProbVsPhi = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax); - tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi", 1); - tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability", 2); - - histname = "Chi2ProbVsEta_" + histTag; - tkmes.Chi2ProbVsEta = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax); - tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta", 1); - tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability", 2); - } + TkParameterMEs tkmes; - // general properties - ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); - - histname = "Chi2oNDFVsEta_" + histTag; - tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax, ""); - tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta", 1); - tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf", 2); - - histname = "Chi2oNDFVsPt_" + histTag; - tkmes.Chi2oNDFVsPt = - ibooker.bookProfile(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax, Chi2NDFMin, Chi2NDFMax, ""); - tkmes.Chi2oNDFVsPt->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.Chi2oNDFVsPt->setAxisTitle("Track #chi^{2}/ndf", 2); - - histname = "Chi2oNDFVsNHits_" + histTag; - tkmes.Chi2oNDFVsNHits = ibooker.bookProfile(histname, histname, 50, 0., 50, Chi2NDFMin, Chi2NDFMax, ""); - tkmes.Chi2oNDFVsNHits->setAxisTitle("Track NHits", 1); - tkmes.Chi2oNDFVsNHits->setAxisTitle("Track #chi^{2}/ndf", 2); - - histname = "TrackP_" + histTag; - tkmes.TrackP = ibooker.book1D(histname, histname, TrackPBin, TrackPMin, TrackPMax); - tkmes.TrackP->setAxisTitle("Track |p| (GeV/c)", 1); - tkmes.TrackP->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPt_" + histTag; - tkmes.TrackPt = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPt->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPt->setAxisTitle("Number of Tracks", 2); - - if (doTrackPxPyPlots_) { - histname = "TrackPx_" + histTag; - tkmes.TrackPx = ibooker.book1D(histname, histname, TrackPxBin, TrackPxMin, TrackPxMax); - tkmes.TrackPx->setAxisTitle("Track p_{x} (GeV/c)", 1); - tkmes.TrackPx->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPy_" + histTag; - tkmes.TrackPy = ibooker.book1D(histname, histname, TrackPyBin, TrackPyMin, TrackPyMax); - tkmes.TrackPy->setAxisTitle("Track p_{y} (GeV/c)", 1); - tkmes.TrackPy->setAxisTitle("Number of Tracks", 2); - } - histname = "TrackPz_" + histTag; - tkmes.TrackPz = ibooker.book1D(histname, histname, TrackPzBin, TrackPzMin, TrackPzMax); - tkmes.TrackPz->setAxisTitle("Track p_{z} (GeV/c)", 1); - tkmes.TrackPz->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPhi_" + histTag; - tkmes.TrackPhi = ibooker.book1D(histname, histname, PhiBin, PhiMin, PhiMax); - tkmes.TrackPhi->setAxisTitle("Track #phi", 1); - tkmes.TrackPhi->setAxisTitle("Number of Tracks", 2); - - histname = "TrackEta_" + histTag; - tkmes.TrackEta = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); - tkmes.TrackEta->setAxisTitle("Track #eta", 1); - tkmes.TrackEta->setAxisTitle("Number of Tracks", 2); - - histname = "TrackEtaPhi_" + histTag; - tkmes.TrackEtaPhi = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TrackEtaPhi->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaPhi->setAxisTitle("Track #phi", 2); - - histname = "TrackEtaPhiInner_" + histTag; - tkmes.TrackEtaPhiInner = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TrackEtaPhiInner->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaPhiInner->setAxisTitle("Track #phi", 2); - - histname = "TrackEtaPhiOuter_" + histTag; - tkmes.TrackEtaPhiOuter = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TrackEtaPhiOuter->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaPhiOuter->setAxisTitle("Track #phi", 2); - - if (doThetaPlots_) { - histname = "TrackTheta_" + histTag; - tkmes.TrackTheta = ibooker.book1D(histname, histname, ThetaBin, ThetaMin, ThetaMax); - tkmes.TrackTheta->setAxisTitle("Track #theta", 1); - tkmes.TrackTheta->setAxisTitle("Number of Tracks", 2); - } - histname = "TrackQ_" + histTag; - tkmes.TrackQ = ibooker.book1D(histname, histname, TrackQBin, TrackQMin, TrackQMax); - tkmes.TrackQ->setAxisTitle("Track Charge", 1); - tkmes.TrackQ->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPErrOverP_" + histTag; - tkmes.TrackPErr = ibooker.book1D(histname, histname, pErrBin, pErrMin, pErrMax); - tkmes.TrackPErr->setAxisTitle("track error(p)/p", 1); - tkmes.TrackPErr->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPtErrOverPt_" + histTag; - tkmes.TrackPtErr = ibooker.book1D(histname, histname, ptErrBin, ptErrMin, ptErrMax); - tkmes.TrackPtErr->setAxisTitle("track error(p_{T})/p_{T}", 1); - tkmes.TrackPtErr->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPtErrOverPtVsEta_" + histTag; - tkmes.TrackPtErrVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, ptErrMin, ptErrMax); - tkmes.TrackPtErrVsEta->setAxisTitle("Track #eta", 1); - tkmes.TrackPtErrVsEta->setAxisTitle("track error(p_{T})/p_{T}", 2); - - if (doTrackPxPyPlots_) { - histname = "TrackPxErrOverPx_" + histTag; - tkmes.TrackPxErr = ibooker.book1D(histname, histname, pxErrBin, pxErrMin, pxErrMax); - tkmes.TrackPxErr->setAxisTitle("track error(p_{x})/p_{x}", 1); - tkmes.TrackPxErr->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPyErrOverPy_" + histTag; - tkmes.TrackPyErr = ibooker.book1D(histname, histname, pyErrBin, pyErrMin, pyErrMax); - tkmes.TrackPyErr->setAxisTitle("track error(p_{y})/p_{y}", 1); - tkmes.TrackPyErr->setAxisTitle("Number of Tracks", 2); - } - histname = "TrackPzErrOverPz_" + histTag; - tkmes.TrackPzErr = ibooker.book1D(histname, histname, pzErrBin, pzErrMin, pzErrMax); - tkmes.TrackPzErr->setAxisTitle("track error(p_{z})/p_{z}", 1); - tkmes.TrackPzErr->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPhiErr_" + histTag; - tkmes.TrackPhiErr = ibooker.book1D(histname, histname, phiErrBin, phiErrMin, phiErrMax); - tkmes.TrackPhiErr->setAxisTitle("track error(#phi)"); - tkmes.TrackPhiErr->setAxisTitle("Number of Tracks", 2); - - histname = "TrackEtaErr_" + histTag; - tkmes.TrackEtaErr = ibooker.book1D(histname, histname, etaErrBin, etaErrMin, etaErrMax); - tkmes.TrackEtaErr->setAxisTitle("track error(#eta)"); - tkmes.TrackEtaErr->setAxisTitle("Number of Tracks", 2); - - // rec hit profiles - ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); - histname = "NumberOfRecHitsPerTrackVsPhi_" + histTag; - tkmes.NumberOfRecHitsPerTrackVsPhi = - ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitBin, RecHitMin, RecHitMax, ""); - tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi", 1); - tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of RecHits in each Track", 2); - - if (doThetaPlots_) { - histname = "NumberOfRecHitsPerTrackVsTheta_" + histTag; - tkmes.NumberOfRecHitsPerTrackVsTheta = - ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecHitBin, RecHitMin, RecHitMax, ""); - tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Track #phi", 1); - tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Number of RecHits in each Track", 2); - } - histname = "NumberOfRecHitsPerTrackVsEta_" + histTag; - tkmes.NumberOfRecHitsPerTrackVsEta = - ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitBin, RecHitMin, RecHitMax, ""); - tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta", 1); - tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of RecHits in each Track", 2); - - histname = "NumberOfValidRecHitsPerTrackVsPhi_" + histTag; - tkmes.NumberOfValidRecHitsPerTrackVsPhi = - ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitMin, RecHitMax, ""); - tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Track #phi", 1); - tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Number of valid RecHits in each Track", 2); - - histname = "NumberOfValidRecHitsPerTrackVsEta_" + histTag; - tkmes.NumberOfValidRecHitsPerTrackVsEta = - ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitMin, RecHitMax, ""); - tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Track #eta", 1); - tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Number of valid RecHits in each Track", 2); - - histname = "NumberOfValidRecHitsPerTrackVsPt_" + histTag; - tkmes.NumberOfValidRecHitsPerTrackVsPt = - ibooker.bookProfile(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax, RecHitMin, RecHitMax, ""); - tkmes.NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); - tkmes.NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Number of valid RecHits in each Track", 2); - - ////////////////////////////////////////// - histname = "NumberOfLayersPerTrackVsPhi_" + histTag; - tkmes.NumberOfLayersPerTrackVsPhi = - ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecLayBin, RecLayMin, RecLayMax, ""); - tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi", 1); - tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of Layers in each Track", 2); - - if (doThetaPlots_) { - histname = "NumberOfLayersPerTrackVsTheta_" + histTag; - tkmes.NumberOfLayersPerTrackVsTheta = - ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecLayBin, RecLayMin, RecLayMax, ""); - tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Track #phi", 1); - tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Number of Layers in each Track", 2); - } - histname = "NumberOfLayersPerTrackVsEta_" + histTag; - tkmes.NumberOfLayersPerTrackVsEta = - ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecLayBin, RecLayMin, RecLayMax, ""); - tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta", 1); - tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of Layers in each Track", 2); - - if (doThetaPlots_) { - histname = "Chi2oNDFVsTheta_" + histTag; - tkmes.Chi2oNDFVsTheta = - ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax, ""); - tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta", 1); - tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf", 2); - } - if (doAllPlots_) { - histname = "Chi2oNDFVsPhi_" + histTag; - tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax, ""); - tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi", 1); - tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf", 2); + std::string histTag = (sname == "default") ? CategoryName : sname + "_" + CategoryName; - histname = "Chi2oNDFVsEta_" + histTag; - tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax, ""); - tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta", 1); - tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf", 2); - - histname = "Chi2ProbVsPhi_" + histTag; - tkmes.Chi2ProbVsPhi = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax); - tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi", 1); - tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability", 2); - - histname = "Chi2ProbVsEta_" + histTag; - tkmes.Chi2ProbVsEta = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax); - tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta", 1); - tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability", 2); - } + if(doAllPlots_) { - // now put the MEs in the map - TkParameterMEMap.insert(std::make_pair(sname, tkmes)); -} + // general properties + ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); + + if (doThetaPlots_) { + histname = "Chi2oNDFVsTheta_" + histTag; + tkmes.Chi2oNDFVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax,""); + tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta",1); + tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf",2); + } + histname = "Chi2oNDFVsPhi_" + histTag; + tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax,""); + tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi",1); + tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf",2); + + histname = "Chi2ProbVsPhi_" + histTag; + tkmes.Chi2ProbVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax); + tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi" ,1); + tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability",2); + + histname = "Chi2ProbVsEta_" + histTag; + tkmes.Chi2ProbVsEta = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax); + tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta" ,1); + tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability",2); -// fill histograms at differnt measurement points -// ---------------------------------------------------------------------------------// -void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco::Track& track, std::string sname) { - //get the kinematic parameters - double p, px, py, pz, pt, theta, phi, eta, q; - double pxerror, pyerror, pzerror, pterror, perror, phierror, etaerror; - - auto phiIn = track.innerPosition().phi(); - auto etaIn = track.innerPosition().eta(); - auto phiOut = track.outerPosition().phi(); - auto etaOut = track.outerPosition().eta(); - - if (sname == "default") { - p = track.p(); - px = track.px(); - py = track.py(); - pz = track.pz(); - pt = track.pt(); - phi = track.phi(); - theta = track.theta(); - eta = track.eta(); - q = track.charge(); - - pterror = (pt) ? track.ptError() / (pt * pt) : 0.0; - pxerror = -1.0; - pyerror = -1.0; - pzerror = -1.0; - perror = -1.0; - phierror = track.phiError(); - etaerror = track.etaError(); - - } else { - edm::ESHandle theB; - iSetup.get().get("TransientTrackBuilder", theB); - reco::TransientTrack TransTrack = theB->build(track); - - TrajectoryStateOnSurface TSOS; - - if (sname == "OuterSurface") - TSOS = TransTrack.outermostMeasurementState(); - else if (sname == "InnerSurface") - TSOS = TransTrack.innermostMeasurementState(); - else if (sname == "ImpactPoint") - TSOS = TransTrack.impactPointState(); - - p = TSOS.globalMomentum().mag(); - px = TSOS.globalMomentum().x(); - py = TSOS.globalMomentum().y(); - pz = TSOS.globalMomentum().z(); - pt = TSOS.globalMomentum().perp(); - phi = TSOS.globalMomentum().phi(); - theta = TSOS.globalMomentum().theta(); - eta = TSOS.globalMomentum().eta(); - q = TSOS.charge(); - - //get the error of the kinimatic parameters - AlgebraicSymMatrix66 errors = TSOS.cartesianError().matrix(); - double partialPterror = - errors(3, 3) * pow(TSOS.globalMomentum().x(), 2) + errors(4, 4) * pow(TSOS.globalMomentum().y(), 2); - pterror = sqrt(partialPterror) / TSOS.globalMomentum().perp(); - pxerror = sqrt(errors(3, 3)) / TSOS.globalMomentum().x(); - pyerror = sqrt(errors(4, 4)) / TSOS.globalMomentum().y(); - pzerror = sqrt(errors(5, 5)) / TSOS.globalMomentum().z(); - perror = sqrt(partialPterror + errors(5, 5) * pow(TSOS.globalMomentum().z(), 2)) / TSOS.globalMomentum().mag(); - phierror = sqrt(TSOS.curvilinearError().matrix()(2, 2)); - etaerror = sqrt(TSOS.curvilinearError().matrix()(1, 1)) * fabs(sin(TSOS.globalMomentum().theta())); - } + } + + // general properties + ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); - std::map::iterator iPos = TkParameterMEMap.find(sname); - if (iPos != TkParameterMEMap.end()) { - TkParameterMEs tkmes = iPos->second; - // momentum - tkmes.TrackP->Fill(p); - if (doTrackPxPyPlots_) { - tkmes.TrackPx->Fill(px); - tkmes.TrackPy->Fill(py); + histname = "Chi2oNDFVsEta_" + histTag; + tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax,""); + tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta",1); + tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf",2); + + histname = "Chi2oNDFVsPt_" + histTag; + tkmes.Chi2oNDFVsPt = ibooker.bookProfile(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax, Chi2NDFMin, Chi2NDFMax,""); + tkmes.Chi2oNDFVsPt->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.Chi2oNDFVsPt->setAxisTitle("Track #chi^{2}/ndf",2); + + histname = "Chi2oNDFVsNHits_" + histTag; + tkmes.Chi2oNDFVsNHits = ibooker.bookProfile(histname, histname, 50, 0., 50, Chi2NDFMin, Chi2NDFMax,""); + tkmes.Chi2oNDFVsNHits->setAxisTitle("Track NHits", 1); + tkmes.Chi2oNDFVsNHits->setAxisTitle("Track #chi^{2}/ndf",2); + + histname = "TrackP_" + histTag; + tkmes.TrackP = ibooker.book1D(histname, histname, TrackPBin, TrackPMin, TrackPMax); + tkmes.TrackP->setAxisTitle("Track |p| (GeV/c)", 1); + tkmes.TrackP->setAxisTitle("Number of Tracks",2); + + histname = "TrackPt_" + histTag; + tkmes.TrackPt = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt->setAxisTitle("Number of Tracks",2); + + histname = "TrackPtHighPurity_" + histTag; + tkmes.TrackPtHighPurity = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtHighPurity->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtHighPurity->setAxisTitle("Number of High Purity Tracks",2); + + histname = "TrackPtTight_" + histTag; + tkmes.TrackPtTight = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtTight->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtTight->setAxisTitle("Number of Tight Tracks",2); + + histname = "TrackPtLoose_" + histTag; + tkmes.TrackPtLoose = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtLoose->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtLoose->setAxisTitle("Number of Loose Tracks",2); + + histname = "Quality_"; + tkmes.Quality = ibooker.book1D(histname+CategoryName, histname+CategoryName, 3, 0., 3.); + tkmes.Quality->setAxisTitle("Track quality",1); + tkmes.Quality->setAxisTitle("Number of Tracks",2); + + for (size_t ibin=0; ibin<3; ibin++) { + tkmes.Quality->setBinLabel(ibin+1,reco::TrackBase::qualityNames[ibin]); } - tkmes.TrackPz->Fill(pz); - tkmes.TrackPt->Fill(pt); - // angles - tkmes.TrackPhi->Fill(phi); - tkmes.TrackEta->Fill(eta); - tkmes.TrackEtaPhi->Fill(eta, phi); - tkmes.TrackEtaPhiInner->Fill(etaIn, phiIn); - tkmes.TrackEtaPhiOuter->Fill(etaOut, phiOut); + histname = "TrackPtZone1_" + histTag; + tkmes.TrackPtZone1 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone1->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone1->setAxisTitle("Number of Tracks",2); + + histname = "TrackPtZone2_" + histTag; + tkmes.TrackPtZone2 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone2->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone2->setAxisTitle("Number of Tracks",2); + + histname = "TrackPtZone3_" + histTag; + tkmes.TrackPtZone3 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone3->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone3->setAxisTitle("Number of Tracks",2); + + histname = "TrackPtZone4_" + histTag; + tkmes.TrackPtZone4 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone4->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone4->setAxisTitle("Number of Tracks",2); + + histname = "TrackPtZone5_" + histTag; + tkmes.TrackPtZone5 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone5->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone5->setAxisTitle("Number of Tracks",2); + + histname = "TrackPtZone6_" + histTag; + tkmes.TrackPtZone6 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone6->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone6->setAxisTitle("Number of Tracks",2); + + histname = "TrackPtZone7_" + histTag; + tkmes.TrackPtZone7 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone7->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone7->setAxisTitle("Number of Tracks",2); + + histname = "TrackPtZone8_" + histTag; + tkmes.TrackPtZone8 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone8->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone8->setAxisTitle("Number of Tracks",2); + + histname = "Ratio_byFolding_" + histTag; + tkmes.Ratio_byFolding = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.Ratio_byFolding->setAxisTitle("Track p_{T} (GeV/c)", 1); + + histname = "Ratio_byFolding2_" + histTag; + tkmes.Ratio_byFolding2 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.Ratio_byFolding2->setAxisTitle("Track p_{T} (GeV/c)", 1); - if (doThetaPlots_) { - tkmes.TrackTheta->Fill(theta); + if (doTrackPxPyPlots_) { + histname = "TrackPx_" + histTag; + tkmes.TrackPx = ibooker.book1D(histname, histname, TrackPxBin, TrackPxMin, TrackPxMax); + tkmes.TrackPx->setAxisTitle("Track p_{x} (GeV/c)", 1); + tkmes.TrackPx->setAxisTitle("Number of Tracks",2); + + histname = "TrackPy_" + histTag; + tkmes.TrackPy = ibooker.book1D(histname, histname, TrackPyBin, TrackPyMin, TrackPyMax); + tkmes.TrackPy->setAxisTitle("Track p_{y} (GeV/c)", 1); + tkmes.TrackPy->setAxisTitle("Number of Tracks",2); + } + histname = "TrackPz_" + histTag; + tkmes.TrackPz = ibooker.book1D(histname, histname, TrackPzBin, TrackPzMin, TrackPzMax); + tkmes.TrackPz->setAxisTitle("Track p_{z} (GeV/c)", 1); + tkmes.TrackPz->setAxisTitle("Number of Tracks",2); + + histname = "TrackPhi_" + histTag; + tkmes.TrackPhi = ibooker.book1D(histname, histname, PhiBin, PhiMin, PhiMax); + tkmes.TrackPhi->setAxisTitle("Track #phi", 1); + tkmes.TrackPhi->setAxisTitle("Number of Tracks",2); + + histname = "TrackEta_" + histTag; + tkmes.TrackEta = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); + tkmes.TrackEta->setAxisTitle("Track #eta", 1); + tkmes.TrackEta->setAxisTitle("Number of Tracks",2); + + histname = "TrackEtaHighpurity_" + histTag; + tkmes.TrackEtaHighPurity = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); + tkmes.TrackEtaHighPurity->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaHighPurity->setAxisTitle("Number of High Purity Tracks",2); + + histname = "TrackEtaTight_" + histTag; + tkmes.TrackEtaTight = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); + tkmes.TrackEtaTight->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaTight->setAxisTitle("Number of Tight Tracks",2); + + histname = "TrackEtaLoose_" + histTag; + tkmes.TrackEtaLoose = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); + tkmes.TrackEtaLoose->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaLoose->setAxisTitle("Number of Loose Tracks",2); + + histname = "TrackEtaPhi_" + histTag; + tkmes.TrackEtaPhi = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhi->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhi->setAxisTitle("Track #phi", 2); + + histname = "TrackEtaPhiInverted_" + histTag; + tkmes.TrackEtaPhiInverted = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhiInverted->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhiInverted->setAxisTitle("Track #phi", 2); + + histname = "TrackEtaPhiInvertedoutofphase_" + histTag; + tkmes.TrackEtaPhiInvertedoutofphase = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhiInvertedoutofphase->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhiInvertedoutofphase->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_Ratio_byFoldingmap_" + histTag; + tkmes.TkEtaPhi_Ratio_byFoldingmap = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #eta", 1); + tkmes.TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_Ratio_byFoldingmap_op_" + histTag; + tkmes.TkEtaPhi_Ratio_byFoldingmap_op = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #eta", 1); + tkmes.TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_RelativeDifference_byFoldingmap_" + histTag; + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #eta", 1); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_RelativeDifference_byFoldingmap_op_" + histTag; + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #eta", 1); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #phi", 2); + + histname = "TrackEtaPhiInner_" + histTag; + tkmes.TrackEtaPhiInner = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhiInner->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhiInner->setAxisTitle("Track #phi", 2); + + histname = "TrackEtaPhiOuter_" + histTag; + tkmes.TrackEtaPhiOuter = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhiOuter->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhiOuter->setAxisTitle("Track #phi", 2); + + + + if (doThetaPlots_) { + histname = "TrackTheta_" + histTag; + tkmes.TrackTheta = ibooker.book1D(histname, histname, ThetaBin, ThetaMin, ThetaMax); + tkmes.TrackTheta->setAxisTitle("Track #theta", 1); + tkmes.TrackTheta->setAxisTitle("Number of Tracks",2); } - tkmes.TrackQ->Fill(q); + histname = "TrackQ_" + histTag; + tkmes.TrackQ = ibooker.book1D(histname, histname, TrackQBin, TrackQMin, TrackQMax); + tkmes.TrackQ->setAxisTitle("Track Charge", 1); + tkmes.TrackQ->setAxisTitle("Number of Tracks",2); + + histname = "TrackQoverP_" + histTag; + tkmes.TrackQoverP = ibooker.book1D(histname, histname, 10*TrackQBin, TrackQMin, TrackQMax); + tkmes.TrackQoverP->setAxisTitle("Track QoverP", 1); + tkmes.TrackQoverP->setAxisTitle("Number of Tracks",2); + + histname = "TrackPErrOverP_" + histTag; + tkmes.TrackPErr = ibooker.book1D(histname, histname, pErrBin, pErrMin, pErrMax); + tkmes.TrackPErr->setAxisTitle("track error(p)/p", 1); + tkmes.TrackPErr->setAxisTitle("Number of Tracks",2); + + histname = "TrackPtErrOverPt_" + histTag; + tkmes.TrackPtErr = ibooker.book1D(histname, histname, ptErrBin, ptErrMin, ptErrMax); + tkmes.TrackPtErr->setAxisTitle("track error(p_{T})/p_{T}", 1); + tkmes.TrackPtErr->setAxisTitle("Number of Tracks",2); + + histname = "TrackPtErrOverPtVsEta_" + histTag; + tkmes.TrackPtErrVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, ptErrMin, ptErrMax); + tkmes.TrackPtErrVsEta->setAxisTitle("Track #eta",1); + tkmes.TrackPtErrVsEta->setAxisTitle("track error(p_{T})/p_{T}", 2); - // errors - tkmes.TrackPtErr->Fill(pterror); - tkmes.TrackPtErrVsEta->Fill(eta, pterror); if (doTrackPxPyPlots_) { - tkmes.TrackPxErr->Fill(pxerror); - tkmes.TrackPyErr->Fill(pyerror); + histname = "TrackPxErrOverPx_" + histTag; + tkmes.TrackPxErr = ibooker.book1D(histname, histname, pxErrBin, pxErrMin, pxErrMax); + tkmes.TrackPxErr->setAxisTitle("track error(p_{x})/p_{x}", 1); + tkmes.TrackPxErr->setAxisTitle("Number of Tracks",2); + + histname = "TrackPyErrOverPy_" + histTag; + tkmes.TrackPyErr = ibooker.book1D(histname, histname, pyErrBin, pyErrMin, pyErrMax); + tkmes.TrackPyErr->setAxisTitle("track error(p_{y})/p_{y}", 1); + tkmes.TrackPyErr->setAxisTitle("Number of Tracks",2); } - tkmes.TrackPzErr->Fill(pzerror); - tkmes.TrackPErr->Fill(perror); - tkmes.TrackPhiErr->Fill(phierror); - tkmes.TrackEtaErr->Fill(etaerror); + histname = "TrackPzErrOverPz_" + histTag; + tkmes.TrackPzErr = ibooker.book1D(histname, histname, pzErrBin, pzErrMin, pzErrMax); + tkmes.TrackPzErr->setAxisTitle("track error(p_{z})/p_{z}", 1); + tkmes.TrackPzErr->setAxisTitle("Number of Tracks",2); + + histname = "TrackPhiErr_" + histTag; + tkmes.TrackPhiErr = ibooker.book1D(histname, histname, phiErrBin, phiErrMin, phiErrMax); + tkmes.TrackPhiErr->setAxisTitle("track error(#phi)"); + tkmes.TrackPhiErr->setAxisTitle("Number of Tracks",2); + + histname = "TrackEtaErr_" + histTag; + tkmes.TrackEtaErr = ibooker.book1D(histname, histname, etaErrBin, etaErrMin, etaErrMax); + tkmes.TrackEtaErr->setAxisTitle("track error(#eta)"); + tkmes.TrackEtaErr->setAxisTitle("Number of Tracks",2); + + // rec hit profiles + ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); + histname = "NumberOfRecHitsPerTrackVsPhi_" + histTag; + tkmes.NumberOfRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitBin, RecHitMin, RecHitMax,""); + tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1); + tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of RecHits in each Track",2); - int nRecHits = track.hitPattern().numberOfAllHits(reco::HitPattern::TRACK_HITS); - int nValidRecHits = track.numberOfValidHits(); - // rec hits - tkmes.NumberOfRecHitsPerTrackVsPhi->Fill(phi, nRecHits); if (doThetaPlots_) { - tkmes.NumberOfRecHitsPerTrackVsTheta->Fill(theta, nRecHits); + histname = "NumberOfRecHitsPerTrackVsTheta_" + histTag; + tkmes.NumberOfRecHitsPerTrackVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecHitBin, RecHitMin, RecHitMax,""); + tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Track #phi",1); + tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Number of RecHits in each Track",2); } - tkmes.NumberOfRecHitsPerTrackVsEta->Fill(eta, nRecHits); + histname = "NumberOfRecHitsPerTrackVsEta_" + histTag; + tkmes.NumberOfRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitBin, RecHitMin, RecHitMax,""); + tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1); + tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of RecHits in each Track",2); + + histname = "NumberOfValidRecHitsPerTrackVsPhi_" + histTag; + tkmes.NumberOfValidRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitMin, RecHitMax,""); + tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1); + tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Number of valid RecHits in each Track",2); + + histname = "NumberOfValidRecHitsPerTrackVsEta_" + histTag; + tkmes.NumberOfValidRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitMin, RecHitMax,""); + tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1); + tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Number of valid RecHits in each Track",2); + + histname = "NumberOfValidRecHitsPerTrackVsPt_" + histTag; + tkmes.NumberOfValidRecHitsPerTrackVsPt = ibooker.bookProfile(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax, RecHitMin, RecHitMax,""); + tkmes.NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]",1); + tkmes.NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Number of valid RecHits in each Track",2); + + ////////////////////////////////////////// + histname = "NumberOfLayersPerTrackVsPhi_" + histTag; + tkmes.NumberOfLayersPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecLayBin, RecLayMin, RecLayMax,""); + tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi",1); + tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of Layers in each Track",2); - tkmes.NumberOfValidRecHitsPerTrackVsPhi->Fill(phi, nValidRecHits); - tkmes.NumberOfValidRecHitsPerTrackVsEta->Fill(eta, nValidRecHits); - tkmes.NumberOfValidRecHitsPerTrackVsPt->Fill(pt, nValidRecHits); + if (doThetaPlots_) { + histname = "NumberOfLayersPerTrackVsTheta_" + histTag; + tkmes.NumberOfLayersPerTrackVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecLayBin, RecLayMin, RecLayMax,""); + tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Track #phi",1); + tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Number of Layers in each Track",2); + } + histname = "NumberOfLayersPerTrackVsEta_" + histTag; + tkmes.NumberOfLayersPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecLayBin, RecLayMin, RecLayMax,""); + tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta",1); + tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of Layers in each Track",2); - int nLayers = track.hitPattern().trackerLayersWithMeasurement(); - // rec layers - tkmes.NumberOfLayersPerTrackVsPhi->Fill(phi, nLayers); if (doThetaPlots_) { - tkmes.NumberOfLayersPerTrackVsTheta->Fill(theta, nLayers); + histname = "Chi2oNDFVsTheta_" + histTag; + tkmes.Chi2oNDFVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax,""); + tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta",1); + tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf",2); + } + if (doAllPlots_) { + histname = "Chi2oNDFVsPhi_" + histTag; + tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax,""); + tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi",1); + tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf",2); + + histname = "Chi2oNDFVsEta_" + histTag; + tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax,""); + tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta",1); + tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf",2); + + histname = "Chi2ProbVsPhi_" + histTag; + tkmes.Chi2ProbVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax); + tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi" ,1); + tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability",2); + + histname = "Chi2ProbVsEta_" + histTag; + tkmes.Chi2ProbVsEta = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax); + tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta" ,1); + tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability",2); } - tkmes.NumberOfLayersPerTrackVsEta->Fill(eta, nLayers); - double chi2prob = TMath::Prob(track.chi2(), (int)track.ndof()); - double chi2oNDF = track.normalizedChi2(); + // now put the MEs in the map + TkParameterMEMap.insert( std::make_pair(sname, tkmes) ); - tkmes.Chi2oNDFVsEta->Fill(eta, chi2oNDF); - tkmes.Chi2oNDFVsPt->Fill(pt, chi2oNDF); - tkmes.Chi2oNDFVsNHits->Fill(nRecHits, chi2oNDF); +} + + +// fill histograms at differnt measurement points +// ---------------------------------------------------------------------------------// +void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname) +{ + //get the kinematic parameters + double p, px, py, pz, pt, theta, phi, eta, q; + double pxerror, pyerror, pzerror, pterror, perror, phierror, etaerror; + + auto phiIn = track.innerPosition().phi(); + auto etaIn = track.innerPosition().eta(); + auto phiOut = track.outerPosition().phi(); + auto etaOut = track.outerPosition().eta(); + + + if (sname == "default") { + + p = track.p(); + px = track.px(); + py = track.py(); + pz = track.pz(); + pt = track.pt(); + phi = track.phi(); + theta = track.theta(); + eta = track.eta(); + q = track.charge(); + + pterror = (pt) ? track.ptError()/(pt*pt) : 0.0; + pxerror = -1.0; + pyerror = -1.0; + pzerror = -1.0; + perror = -1.0; + phierror = track.phiError(); + etaerror = track.etaError(); + + } else { + + edm::ESHandle theB; + iSetup.get().get("TransientTrackBuilder",theB); + reco::TransientTrack TransTrack = theB->build(track); + + TrajectoryStateOnSurface TSOS; + + if (sname == "OuterSurface") TSOS = TransTrack.outermostMeasurementState(); + else if (sname == "InnerSurface") TSOS = TransTrack.innermostMeasurementState(); + else if (sname == "ImpactPoint") TSOS = TransTrack.impactPointState(); + + p = TSOS.globalMomentum().mag(); + px = TSOS.globalMomentum().x(); + py = TSOS.globalMomentum().y(); + pz = TSOS.globalMomentum().z(); + pt = TSOS.globalMomentum().perp(); + phi = TSOS.globalMomentum().phi(); + theta = TSOS.globalMomentum().theta(); + eta = TSOS.globalMomentum().eta(); + q = TSOS.charge(); + + //get the error of the kinimatic parameters + AlgebraicSymMatrix66 errors = TSOS.cartesianError().matrix(); + double partialPterror = errors(3,3)*pow(TSOS.globalMomentum().x(),2) + errors(4,4)*pow(TSOS.globalMomentum().y(),2); + pterror = sqrt(partialPterror)/TSOS.globalMomentum().perp(); + pxerror = sqrt(errors(3,3))/TSOS.globalMomentum().x(); + pyerror = sqrt(errors(4,4))/TSOS.globalMomentum().y(); + pzerror = sqrt(errors(5,5))/TSOS.globalMomentum().z(); + perror = sqrt(partialPterror+errors(5,5)*pow(TSOS.globalMomentum().z(),2))/TSOS.globalMomentum().mag(); + phierror = sqrt(TSOS.curvilinearError().matrix()(2,2)); + etaerror = sqrt(TSOS.curvilinearError().matrix()(1,1))*fabs(sin(TSOS.globalMomentum().theta())); + + } + + std::map::iterator iPos = TkParameterMEMap.find(sname); + if (iPos != TkParameterMEMap.end()) { + + TkParameterMEs tkmes = iPos->second; + + // momentum + tkmes.TrackP->Fill(p); + if (doTrackPxPyPlots_) { + tkmes.TrackPx->Fill(px); + tkmes.TrackPy->Fill(py); + } + tkmes.TrackPz->Fill(pz); + tkmes.TrackPt->Fill(pt); + + if (track.quality(reco::TrackBase::highPurity)) { + tkmes.TrackPtHighPurity->Fill(pt); + tkmes.Quality->Fill(reco::TrackBase::highPurity,1.); + } + if (track.quality(reco::TrackBase::tight)) { + tkmes.TrackPtTight->Fill(pt); + tkmes.Quality->Fill(reco::TrackBase::tight,1.); + } + if (track.quality(reco::TrackBase::loose)) { + tkmes.TrackPtLoose->Fill(pt); + tkmes.Quality->Fill(reco::TrackBase::loose,1.); + } + + // angles + tkmes.TrackPhi->Fill(phi); + tkmes.TrackEta->Fill(eta); + if (track.quality(reco::TrackBase::highPurity)) { + tkmes.TrackEtaHighPurity->Fill(eta); + } + if (track.quality(reco::TrackBase::tight)) { + tkmes.TrackEtaTight->Fill(eta); + } + if (track.quality(reco::TrackBase::loose)) { + tkmes.TrackEtaLoose->Fill(eta); + } + + tkmes.TrackEtaPhi->Fill(eta,phi); + tkmes.TrackEtaPhiInverted->Fill(eta,-1*phi); + tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta,3.141592654+phi); + tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta,phi- 3.141592654 ); + tkmes.TkEtaPhi_Ratio_byFoldingmap->getTH2F()->Divide(tkmes.TrackEtaPhi->getTH2F(),tkmes.TrackEtaPhiInverted->getTH2F(),1.,1.,""); + tkmes.TkEtaPhi_Ratio_byFoldingmap_op->getTH2F()->Divide(tkmes.TrackEtaPhi->getTH2F(),tkmes.TrackEtaPhiInvertedoutofphase->getTH2F(),1.,1.,""); + + int nx = tkmes.TrackEtaPhi->getTH2F()->GetNbinsX(); + int ny = tkmes.TrackEtaPhi->getTH2F()->GetNbinsY(); + + for (int ii=1; ii<=nx; ii++){ + for (int jj=1; jj<=ny; jj++){ + + double Sum1 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii,jj) + tkmes.TrackEtaPhiInverted->getTH2F()->GetBinContent(ii,jj); + double Sum2 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii,jj) + tkmes.TrackEtaPhiInvertedoutofphase->getTH2F()->GetBinContent(ii,jj); + + double Sub1 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii,jj) - tkmes.TrackEtaPhiInverted->getTH2F()->GetBinContent(ii,jj); + double Sub2 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii,jj) - tkmes.TrackEtaPhiInvertedoutofphase->getTH2F()->GetBinContent(ii,jj); + + if (Sum1 == 0 || Sum2 ==0){ + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->getTH2F()->SetBinContent(ii,jj,1); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->getTH2F()->SetBinContent(ii,jj,1); + }else{ + double ratio1 = Sub1/Sum1; + double ratio2 = Sub2/Sum2; + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->getTH2F()->SetBinContent(ii,jj,ratio1); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->getTH2F()->SetBinContent(ii,jj,ratio2); + } + } + } + + +//pT histograms to create efficiency vs pT plot for only the more inefficient region. + + if(eta < 0. && phi < -1.6) {tkmes.TrackPtZone1->Fill(pt);} + if(eta < 0. && phi < 0 && phi >= -1.6) {tkmes.TrackPtZone2->Fill(pt);} + if(eta < 0. && phi < 1.6 && phi >= 0) {tkmes.TrackPtZone3->Fill(pt);} + if(eta < 0. && phi >= 1.6) {tkmes.TrackPtZone4->Fill(pt);} + if(eta >= 0. && phi < -1.6) {tkmes.TrackPtZone5->Fill(pt);} + if(eta >= 0. && phi < 0 && phi >= -1.6) {tkmes.TrackPtZone6->Fill(pt);} + if(eta >= 0. && phi < 1.6 && phi >= 0) {tkmes.TrackPtZone7->Fill(pt);} + if(eta >= 0. && phi >= 1.6) {tkmes.TrackPtZone8->Fill(pt);} + + float A [8]; + A[0] = tkmes.TrackPtZone1->getTH1()->Integral(); + A[1] = tkmes.TrackPtZone2->getTH1()->Integral(); + A[2] = tkmes.TrackPtZone3->getTH1()->Integral(); + A[3] = tkmes.TrackPtZone4->getTH1()->Integral(); + A[4] = tkmes.TrackPtZone5->getTH1()->Integral(); + A[5] = tkmes.TrackPtZone6->getTH1()->Integral(); + A[6] = tkmes.TrackPtZone7->getTH1()->Integral(); + A[7] = tkmes.TrackPtZone8->getTH1()->Integral(); + + int WZ = 0; + float minA = A[0]; + for(int w=1;w<8;w++){ + if( minA > A[w]){ + minA = A[w]; + WZ=w; + } + } + + switch(WZ){ + case 1: + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone1->getTH1(),tkmes.TrackPtZone4->getTH1(),1.,1.,"B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone1->getTH1(),tkmes.TrackPtZone2->getTH1(),1.,1.,"B"); + break; + case 2: + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone2->getTH1(),tkmes.TrackPtZone3->getTH1(),1.,1.,"B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone2->getTH1(),tkmes.TrackPtZone1->getTH1(),1.,1.,"B"); + break; + case 3: + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone3->getTH1(),tkmes.TrackPtZone2->getTH1(),1.,1.,"B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone3->getTH1(),tkmes.TrackPtZone4->getTH1(),1.,1.,"B"); + break; + case 4: + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone4->getTH1(),tkmes.TrackPtZone1->getTH1(),1.,1.,"B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone4->getTH1(),tkmes.TrackPtZone3->getTH1(),1.,1.,"B"); + break; + case 5: + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone5->getTH1(),tkmes.TrackPtZone8->getTH1(),1.,1.,"B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone5->getTH1(),tkmes.TrackPtZone6->getTH1(),1.,1.,"B"); + break; + case 6: + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone6->getTH1(),tkmes.TrackPtZone7->getTH1(),1.,1.,"B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone6->getTH1(),tkmes.TrackPtZone5->getTH1(),1.,1.,"B"); + break; + case 7: + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone7->getTH1(),tkmes.TrackPtZone6->getTH1(),1.,1.,"B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone7->getTH1(),tkmes.TrackPtZone8->getTH1(),1.,1.,"B"); + break; + case 8: + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone8->getTH1(),tkmes.TrackPtZone5->getTH1(),1.,1.,"B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone8->getTH1(),tkmes.TrackPtZone7->getTH1(),1.,1.,"B"); + break; +} + tkmes.Ratio_byFolding->setAxisTitle("Efficiency(Ratio)_Zone" + std::to_string(WZ),2); + tkmes.Ratio_byFolding2->setAxisTitle("Efficiency(Ratio)_Zone" + std::to_string(WZ),2); + + tkmes.TrackEtaPhiInner->Fill(etaIn,phiIn); + tkmes.TrackEtaPhiOuter->Fill(etaOut,phiOut); - if (doAllPlots_) { - // general properties if (doThetaPlots_) { - tkmes.Chi2oNDFVsTheta->Fill(theta, chi2oNDF); + tkmes.TrackTheta->Fill(theta); } - tkmes.Chi2oNDFVsPhi->Fill(phi, chi2oNDF); - tkmes.Chi2ProbVsPhi->Fill(phi, chi2prob); - tkmes.Chi2ProbVsEta->Fill(eta, chi2prob); + tkmes.TrackQ->Fill(q); + if (p > 0.) { + tkmes.TrackQoverP->Fill(q/p); + } + // errors + tkmes.TrackPtErr->Fill(pterror); + tkmes.TrackPtErrVsEta->Fill(eta,pterror); + if (doTrackPxPyPlots_) { + tkmes.TrackPxErr->Fill(pxerror); + tkmes.TrackPyErr->Fill(pyerror); + } + tkmes.TrackPzErr->Fill(pzerror); + tkmes.TrackPErr->Fill(perror); + tkmes.TrackPhiErr->Fill(phierror); + tkmes.TrackEtaErr->Fill(etaerror); + + int nRecHits = track.hitPattern().numberOfAllHits(reco::HitPattern::TRACK_HITS); + int nValidRecHits = track.numberOfValidHits(); + // rec hits + tkmes.NumberOfRecHitsPerTrackVsPhi->Fill(phi, nRecHits); + if (doThetaPlots_) { + tkmes.NumberOfRecHitsPerTrackVsTheta->Fill(theta,nRecHits); + } + tkmes.NumberOfRecHitsPerTrackVsEta->Fill(eta, nRecHits); + + tkmes.NumberOfValidRecHitsPerTrackVsPhi->Fill(phi, nValidRecHits); + tkmes.NumberOfValidRecHitsPerTrackVsEta->Fill(eta, nValidRecHits); + tkmes.NumberOfValidRecHitsPerTrackVsPt ->Fill(pt, nValidRecHits); + + int nLayers = track.hitPattern().trackerLayersWithMeasurement(); + // rec layers + tkmes.NumberOfLayersPerTrackVsPhi->Fill(phi, nLayers); + if (doThetaPlots_) { + tkmes.NumberOfLayersPerTrackVsTheta->Fill(theta, nLayers); + } + tkmes.NumberOfLayersPerTrackVsEta->Fill(eta, nLayers); + + double chi2prob = TMath::Prob(track.chi2(),(int)track.ndof()); + double chi2oNDF = track.normalizedChi2(); + + tkmes.Chi2oNDFVsEta->Fill(eta, chi2oNDF); + tkmes.Chi2oNDFVsPt->Fill(pt, chi2oNDF); + tkmes.Chi2oNDFVsNHits->Fill(nRecHits, chi2oNDF); + + if(doAllPlots_) { + + // general properties + if (doThetaPlots_) { + tkmes.Chi2oNDFVsTheta->Fill(theta, chi2oNDF); + } + tkmes.Chi2oNDFVsPhi->Fill(phi, chi2oNDF); + tkmes.Chi2ProbVsPhi->Fill(phi, chi2prob); + tkmes.Chi2ProbVsEta->Fill(eta, chi2prob); + } + } - } + } -void TrackAnalyzer::bookHistosForTrackerSpecific(DQMStore::IBooker& ibooker) { - // parameters from the configuration - std::string QualName = conf_->getParameter("Quality"); - std::string AlgoName = conf_->getParameter("AlgoName"); - // use the AlgoName and Quality Name - std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; +void TrackAnalyzer::bookHistosForTrackerSpecific(DQMStore::IBooker & ibooker) +{ - int PhiBin = conf_->getParameter("PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); + // parameters from the configuration + std::string QualName = conf_->getParameter("Quality"); + std::string AlgoName = conf_->getParameter("AlgoName"); - int EtaBin = conf_->getParameter("EtaBin"); - double EtaMin = conf_->getParameter("EtaMin"); - double EtaMax = conf_->getParameter("EtaMax"); + // use the AlgoName and Quality Name + std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; + + int PhiBin = conf_->getParameter( "PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); + + int EtaBin = conf_->getParameter( "EtaBin"); + double EtaMin = conf_->getParameter("EtaMin"); + double EtaMax = conf_->getParameter("EtaMax"); + + int PtBin = conf_->getParameter( "TrackPtBin"); + double PtMin = conf_->getParameter("TrackPtMin"); + double PtMax = conf_->getParameter("TrackPtMax"); + + // book hit property histograms + // ---------------------------------------------------------------------------------// + ibooker.setCurrentFolder(TopFolder_+"/HitProperties"); + + + + std::vector subdetectors = conf_->getParameter >("subdetectors"); + int detBin = conf_->getParameter("subdetectorBin"); + + for ( auto det : subdetectors ) { + + // hits properties + ibooker.setCurrentFolder(TopFolder_+"/HitProperties/"+det); + + TkRecHitsPerSubDetMEs recHitsPerSubDet_mes; + + recHitsPerSubDet_mes.detectorTag = det; + int detID = -1; + if ( det == "TIB" ) detID = StripSubdetector::TIB; // 3 + if ( det == "TOB" ) detID = StripSubdetector::TOB; // 5 + if ( det == "TID" ) detID = StripSubdetector::TID; // 4 + if ( det == "TEC" ) detID = StripSubdetector::TEC; // 6 + if ( det == "PixBarrel" ) detID = PixelSubdetector::PixelBarrel; // 1 + if ( det == "PixEndcap" ) detID = PixelSubdetector::PixelEndcap; // 2 + if ( det == "Pixel" ) detID = 0; + if ( det == "Strip" ) detID = 7; + + recHitsPerSubDet_mes.detectorId = detID; + + histname = "NumberOfRecHitsPerTrack_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfRecHitsPerTrack = ibooker.book1D(histname, histname, detBin, -0.5, double(detBin)-0.5); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of " + det + " valid RecHits in each Track",1); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfRecHitsPerTrackVsPhi_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin)-0.5,""); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of " + det + " valid RecHits in each Track",2); + + histname = "NumberOfRecHitsPerTrackVsEta_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin)-0.5,""); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of " + det + " valid RecHits in each Track",2); + + histname = "NumberOfRecHitsPerTrackVsPt_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPt = ibooker.bookProfile(histname, histname, PtBin, PtMin, PtMax, detBin, -0.5, double(detBin)-0.5,""); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]",1); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPt->setAxisTitle("Number of " + det + " valid RecHits in each Track",2); + + histname = "NumberOfLayersPerTrack_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfLayersPerTrack = ibooker.book1D(histname, histname, detBin, -0.5, double(detBin)-0.5); + recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of " + det + " valid Layers in each Track",1); + recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfLayersPerTrackVsPhi_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin)-0.5,""); + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi",1); + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of " + det + " valid Layers in each Track",2); + + histname = "NumberOfLayersPerTrackVsEta_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin)-0.5,""); + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta",1); + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of " + det + " valid Layers in each Track",2); + + histname = "NumberOfLayersPerTrackVsPt_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPt = ibooker.bookProfile(histname, histname, PtBin, PtMin, PtMax, detBin, -0.5, double(detBin)-0.5,""); + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]",1); + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPt->setAxisTitle("Number of " + det + " valid Layers in each Track",2); + + TkRecHitsPerSubDetMEMap.insert(std::pair(det,recHitsPerSubDet_mes)); + + + } - int PtBin = conf_->getParameter("TrackPtBin"); - double PtMin = conf_->getParameter("TrackPtMin"); - double PtMax = conf_->getParameter("TrackPtMax"); - // book hit property histograms - // ---------------------------------------------------------------------------------// - ibooker.setCurrentFolder(TopFolder_ + "/HitProperties"); - - std::vector subdetectors = conf_->getParameter >("subdetectors"); - int detBin = conf_->getParameter("subdetectorBin"); - - for (auto det : subdetectors) { - // hits properties - ibooker.setCurrentFolder(TopFolder_ + "/HitProperties/" + det); - - TkRecHitsPerSubDetMEs recHitsPerSubDet_mes; - - recHitsPerSubDet_mes.detectorTag = det; - int detID = -1; - if (det == "TIB") - detID = StripSubdetector::TIB; // 3 - if (det == "TOB") - detID = StripSubdetector::TOB; // 5 - if (det == "TID") - detID = StripSubdetector::TID; // 4 - if (det == "TEC") - detID = StripSubdetector::TEC; // 6 - if (det == "PixBarrel") - detID = PixelSubdetector::PixelBarrel; // 1 - if (det == "PixEndcap") - detID = PixelSubdetector::PixelEndcap; // 2 - if (det == "Pixel") - detID = 0; - if (det == "Strip") - detID = 7; - - recHitsPerSubDet_mes.detectorId = detID; - - histname = "NumberOfRecHitsPerTrack_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfRecHitsPerTrack = - ibooker.book1D(histname, histname, detBin, -0.5, double(detBin) - 0.5); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of " + det + " valid RecHits in each Track", 1); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfRecHitsPerTrackVsPhi_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi = - ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin) - 0.5, ""); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi", 1); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of " + det + " valid RecHits in each Track", - 2); - - histname = "NumberOfRecHitsPerTrackVsEta_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta = - ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin) - 0.5, ""); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta", 1); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of " + det + " valid RecHits in each Track", - 2); - - histname = "NumberOfRecHitsPerTrackVsPt_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPt = - ibooker.bookProfile(histname, histname, PtBin, PtMin, PtMax, detBin, -0.5, double(detBin) - 0.5, ""); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPt->setAxisTitle("Number of " + det + " valid RecHits in each Track", - 2); - - histname = "NumberOfLayersPerTrack_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfLayersPerTrack = - ibooker.book1D(histname, histname, detBin, -0.5, double(detBin) - 0.5); - recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of " + det + " valid Layers in each Track", 1); - recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfLayersPerTrackVsPhi_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi = - ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin) - 0.5, ""); - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi", 1); - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of " + det + " valid Layers in each Track", - 2); - - histname = "NumberOfLayersPerTrackVsEta_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta = - ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin) - 0.5, ""); - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta", 1); - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of " + det + " valid Layers in each Track", - 2); - - histname = "NumberOfLayersPerTrackVsPt_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPt = - ibooker.bookProfile(histname, histname, PtBin, PtMin, PtMax, detBin, -0.5, double(detBin) - 0.5, ""); - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPt->setAxisTitle("Number of " + det + " valid Layers in each Track", - 2); - - TkRecHitsPerSubDetMEMap.insert(std::pair(det, recHitsPerSubDet_mes)); - } } -void TrackAnalyzer::fillHistosForTrackerSpecific(const reco::Track& track) { - double phi = track.phi(); - double eta = track.eta(); - double pt = track.pt(); - for (std::map::iterator it = TkRecHitsPerSubDetMEMap.begin(); - it != TkRecHitsPerSubDetMEMap.end(); - it++) { - int nValidLayers = 0; +void TrackAnalyzer::fillHistosForTrackerSpecific(const reco::Track & track) +{ + + double phi = track.phi(); + double eta = track.eta(); + double pt = track.pt(); + + for ( std::map::iterator it = TkRecHitsPerSubDetMEMap.begin(); + it != TkRecHitsPerSubDetMEMap.end(); it++ ) { + + int nValidLayers = 0; int nValidRecHits = 0; int substr = it->second.detectorId; - switch (substr) { - case 0: - nValidLayers = track.hitPattern().pixelBarrelLayersWithMeasurement() + - track.hitPattern().pixelEndcapLayersWithMeasurement(); // case 0: pixel - nValidRecHits = track.hitPattern().numberOfValidPixelBarrelHits() + - track.hitPattern().numberOfValidPixelEndcapHits(); // case 0: pixel - break; - case StripSubdetector::TIB: - nValidLayers = track.hitPattern().stripTIBLayersWithMeasurement(); // case 3: strip TIB - nValidRecHits = track.hitPattern().numberOfValidStripTIBHits(); // case 3: strip TIB - break; - case StripSubdetector::TID: - nValidLayers = track.hitPattern().stripTIDLayersWithMeasurement(); // case 4: strip TID - nValidRecHits = track.hitPattern().numberOfValidStripTIDHits(); // case 4: strip TID - break; - case StripSubdetector::TOB: - nValidLayers = track.hitPattern().stripTOBLayersWithMeasurement(); // case 5: strip TOB - nValidRecHits = track.hitPattern().numberOfValidStripTOBHits(); // case 5: strip TOB - break; - case StripSubdetector::TEC: - nValidLayers = track.hitPattern().stripTECLayersWithMeasurement(); // case 6: strip TEC - nValidRecHits = track.hitPattern().numberOfValidStripTECHits(); // case 6: strip TEC - break; - case PixelSubdetector::PixelBarrel: - nValidLayers = track.hitPattern().pixelBarrelLayersWithMeasurement(); // case 1: pixel PXB - nValidRecHits = track.hitPattern().numberOfValidPixelBarrelHits(); // case 1: pixel PXB - break; - case PixelSubdetector::PixelEndcap: - nValidLayers = track.hitPattern().pixelEndcapLayersWithMeasurement(); // case 2: pixel PXF - nValidRecHits = track.hitPattern().numberOfValidPixelEndcapHits(); // case 2: pixel PXF - break; - case 7: - nValidLayers = track.hitPattern().stripTIBLayersWithMeasurement() // case 7: strip - + track.hitPattern().stripTIDLayersWithMeasurement() + - track.hitPattern().stripTOBLayersWithMeasurement() + - track.hitPattern().stripTECLayersWithMeasurement(); - nValidRecHits = track.hitPattern().numberOfValidStripTIBHits() // case 7: strip - + track.hitPattern().numberOfValidStripTIDHits() + - track.hitPattern().numberOfValidStripTOBHits() + track.hitPattern().numberOfValidStripTECHits(); - break; - default: - break; + switch(substr) { + case 0 : + nValidLayers = track.hitPattern().pixelBarrelLayersWithMeasurement() + + track.hitPattern().pixelEndcapLayersWithMeasurement(); // case 0: pixel + nValidRecHits = track.hitPattern().numberOfValidPixelBarrelHits() + + track.hitPattern().numberOfValidPixelEndcapHits(); // case 0: pixel + break; + case StripSubdetector::TIB : + nValidLayers = track.hitPattern().stripTIBLayersWithMeasurement(); // case 3: strip TIB + nValidRecHits = track.hitPattern().numberOfValidStripTIBHits(); // case 3: strip TIB + break; + case StripSubdetector::TID : + nValidLayers = track.hitPattern().stripTIDLayersWithMeasurement(); // case 4: strip TID + nValidRecHits = track.hitPattern().numberOfValidStripTIDHits(); // case 4: strip TID + break; + case StripSubdetector::TOB : + nValidLayers = track.hitPattern().stripTOBLayersWithMeasurement(); // case 5: strip TOB + nValidRecHits = track.hitPattern().numberOfValidStripTOBHits(); // case 5: strip TOB + break; + case StripSubdetector::TEC : + nValidLayers = track.hitPattern().stripTECLayersWithMeasurement(); // case 6: strip TEC + nValidRecHits = track.hitPattern().numberOfValidStripTECHits(); // case 6: strip TEC + break; + case PixelSubdetector::PixelBarrel : + nValidLayers = track.hitPattern().pixelBarrelLayersWithMeasurement(); // case 1: pixel PXB + nValidRecHits = track.hitPattern().numberOfValidPixelBarrelHits(); // case 1: pixel PXB + break; + case PixelSubdetector::PixelEndcap : + nValidLayers = track.hitPattern().pixelEndcapLayersWithMeasurement(); // case 2: pixel PXF + nValidRecHits = track.hitPattern().numberOfValidPixelEndcapHits(); // case 2: pixel PXF + break; + case 7 : + nValidLayers = track.hitPattern().stripTIBLayersWithMeasurement() // case 7: strip + + track.hitPattern().stripTIDLayersWithMeasurement() + + track.hitPattern().stripTOBLayersWithMeasurement() + + track.hitPattern().stripTECLayersWithMeasurement(); + nValidRecHits = track.hitPattern().numberOfValidStripTIBHits() // case 7: strip + + track.hitPattern().numberOfValidStripTIDHits() + + track.hitPattern().numberOfValidStripTOBHits() + + track.hitPattern().numberOfValidStripTECHits(); + break; + default : + break; } //Fill Layers and RecHits - it->second.NumberOfRecHitsPerTrack->Fill(nValidRecHits); - it->second.NumberOfRecHitsPerTrackVsPhi->Fill(phi, nValidRecHits); - it->second.NumberOfRecHitsPerTrackVsEta->Fill(eta, nValidRecHits); - it->second.NumberOfRecHitsPerTrackVsPt->Fill(pt, nValidRecHits); - - it->second.NumberOfLayersPerTrack->Fill(nValidLayers); - it->second.NumberOfLayersPerTrackVsPhi->Fill(phi, nValidLayers); - it->second.NumberOfLayersPerTrackVsEta->Fill(eta, nValidLayers); - it->second.NumberOfLayersPerTrackVsPt->Fill(pt, nValidLayers); + it->second.NumberOfRecHitsPerTrack -> Fill(nValidRecHits); + it->second.NumberOfRecHitsPerTrackVsPhi -> Fill(phi, nValidRecHits); + it->second.NumberOfRecHitsPerTrackVsEta -> Fill(eta, nValidRecHits); + it->second.NumberOfRecHitsPerTrackVsPt -> Fill(pt, nValidRecHits); + + it->second.NumberOfLayersPerTrack -> Fill(nValidLayers); + it->second.NumberOfLayersPerTrackVsPhi -> Fill(phi, nValidLayers); + it->second.NumberOfLayersPerTrackVsEta -> Fill(eta, nValidLayers); + it->second.NumberOfLayersPerTrackVsPt -> Fill(pt, nValidLayers); } + } // // -- Set Lumi Flag // -void TrackAnalyzer::setLumiFlag() { +void TrackAnalyzer::setLumiFlag() { + TkParameterMEs tkmes; - if (Chi2oNDF_lumiFlag) - Chi2oNDF_lumiFlag->setLumiFlag(); - if (NumberOfRecHitsPerTrack_lumiFlag) - NumberOfRecHitsPerTrack_lumiFlag->setLumiFlag(); + if ( Chi2oNDF_lumiFlag ) Chi2oNDF_lumiFlag -> setLumiFlag(); + if ( NumberOfRecHitsPerTrack_lumiFlag ) NumberOfRecHitsPerTrack_lumiFlag -> setLumiFlag(); } // -// -- Apply SoftReset +// -- Apply SoftReset // -void TrackAnalyzer::doSoftReset(DQMStore* dqmStore_) { +void TrackAnalyzer::doSoftReset(DQMStore * dqmStore_) { TkParameterMEs tkmes; dqmStore_->softReset(Chi2oNDF); dqmStore_->softReset(NumberOfRecHitsPerTrack); } // -// -- Apply Reset +// -- Apply Reset // void TrackAnalyzer::doReset() { TkParameterMEs tkmes; - if (Chi2oNDF_lumiFlag) - Chi2oNDF_lumiFlag->Reset(); - if (NumberOfRecHitsPerTrack_lumiFlag) - NumberOfRecHitsPerTrack_lumiFlag->Reset(); + if ( Chi2oNDF_lumiFlag ) Chi2oNDF_lumiFlag -> Reset(); + if ( NumberOfRecHitsPerTrack_lumiFlag ) NumberOfRecHitsPerTrack_lumiFlag -> Reset(); } // // -- Remove SoftReset // -void TrackAnalyzer::undoSoftReset(DQMStore* dqmStore_) { +void TrackAnalyzer::undoSoftReset(DQMStore * dqmStore_) { TkParameterMEs tkmes; dqmStore_->disableSoftReset(Chi2oNDF); dqmStore_->disableSoftReset(NumberOfRecHitsPerTrack); } + + diff --git a/DQM/TrackingMonitor/src/TrackingMonitor.cc b/DQM/TrackingMonitor/src/TrackingMonitor.cc index a1d1da06a8102..1d97a2daf5301 100644 --- a/DQM/TrackingMonitor/src/TrackingMonitor.cc +++ b/DQM/TrackingMonitor/src/TrackingMonitor.cc @@ -1,6 +1,6 @@ /* * See header file for a description of this class. - * + ** * \author Suchandra Dutta , Giorgia Mila */ @@ -22,10 +22,10 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/Registry.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" -#include "TrackingTools/Records/interface/TransientRecHitRecord.h" +#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "TrackingTools/PatternTools/interface/TSCBLBuilderNoMaterial.h" #include "TrackingTools/PatternTools/interface/TSCPBuilderNoMaterial.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" @@ -40,83 +40,80 @@ #include #ifdef VI_DEBUG -#define COUT(x) std::cout << x << ' ' +#define COUT(x) std::cout << x << ' ' #else -#define COUT(x) LogDebug(x) +#define COUT(x) LogDebug(x) #endif -// TrackingMonitor + +// TrackingMonitor // ----------------------------------------------------------------------------------// -TrackingMonitor::TrackingMonitor(const edm::ParameterSet& iConfig) - : confID_(iConfig.id()), - theTrackBuildingAnalyzer(new TrackBuildingAnalyzer(iConfig)), - NumberOfTracks(nullptr), - NumberOfMeanRecHitsPerTrack(nullptr), - NumberOfMeanLayersPerTrack(nullptr) - // , NumberOfGoodTracks(NULL) - , - FractionOfGoodTracks(nullptr), - NumberOfTrackingRegions(nullptr), - NumberOfSeeds(nullptr), - NumberOfSeeds_lumiFlag(nullptr), - NumberOfTrackCandidates(nullptr), - FractionCandidatesOverSeeds(nullptr) - // , NumberOfGoodTrkVsClus(NULL) - , - NumberEventsOfVsLS(nullptr), - NumberOfTracksVsLS(nullptr) - // , NumberOfGoodTracksVsLS(NULL) - , - GoodTracksFractionVsLS(nullptr) - // , GoodTracksNumberOfRecHitsPerTrackVsLS(NULL) - // ADD by Mia for PU monitoring - // vertex plots to be moved in ad hoc class - , - NumberOfGoodPVtxVsLS(nullptr), - NumberOfGoodPVtxWO0VsLS(nullptr), - NumberEventsOfVsBX(nullptr), - NumberOfTracksVsBX(nullptr), - GoodTracksFractionVsBX(nullptr), - NumberOfRecHitsPerTrackVsBX(nullptr), - NumberOfGoodPVtxVsBX(nullptr), - NumberOfGoodPVtxWO0VsBX(nullptr), - NumberOfTracksVsBXlumi(nullptr), - NumberOfTracksVsGoodPVtx(nullptr), - NumberOfTracksVsPUPVtx(nullptr), - NumberEventsOfVsGoodPVtx(nullptr), - GoodTracksFractionVsGoodPVtx(nullptr), - NumberOfRecHitsPerTrackVsGoodPVtx(nullptr), - NumberOfPVtxVsGoodPVtx(nullptr), - NumberOfPixelClustersVsGoodPVtx(nullptr), - NumberOfStripClustersVsGoodPVtx(nullptr), - NumberEventsOfVsLUMI(nullptr), - NumberOfTracksVsLUMI(nullptr), - GoodTracksFractionVsLUMI(nullptr), - NumberOfRecHitsPerTrackVsLUMI(nullptr), - NumberOfGoodPVtxVsLUMI(nullptr), - NumberOfGoodPVtxWO0VsLUMI(nullptr), - NumberOfPixelClustersVsLUMI(nullptr), - NumberOfStripClustersVsLUMI(nullptr), - NumberOfTracks_lumiFlag(nullptr) - // , NumberOfGoodTracks_lumiFlag(NULL) - - , - builderName(iConfig.getParameter("TTRHBuilder")), - doTrackerSpecific_(iConfig.getParameter("doTrackerSpecific")), - doLumiAnalysis(iConfig.getParameter("doLumiAnalysis")), - doProfilesVsLS_(iConfig.getParameter("doProfilesVsLS")), - doAllPlots(iConfig.getParameter("doAllPlots")), - doGeneralPropertiesPlots_(iConfig.getParameter("doGeneralPropertiesPlots")), - doHitPropertiesPlots_(iConfig.getParameter("doHitPropertiesPlots")), - doPUmonitoring_(iConfig.getParameter("doPUmonitoring")), - genTriggerEventFlag_(new GenericTriggerEventFlag( - iConfig.getParameter("genericTriggerEventPSet"), consumesCollector(), *this)), - numSelection_(iConfig.getParameter("numCut")), - denSelection_(iConfig.getParameter("denCut")), - pvNDOF_(iConfig.getParameter("pvNDOF")) { - edm::ConsumesCollector c{consumesCollector()}; - theTrackAnalyzer = new dqm::TrackAnalyzer(iConfig, c); +TrackingMonitor::TrackingMonitor(const edm::ParameterSet& iConfig) + : confID_ ( iConfig.id() ) + , theTrackBuildingAnalyzer( new TrackBuildingAnalyzer(iConfig) ) + , NumberOfTracks(nullptr) + , NumberOfMeanRecHitsPerTrack(nullptr) + , NumberOfMeanLayersPerTrack(nullptr) + // , NumberOfGoodTracks(NULL) + , FractionOfGoodTracks(nullptr) + , NumberOfTrackingRegions(nullptr) + , NumberOfSeeds(nullptr) + , NumberOfSeeds_lumiFlag(nullptr) + , NumberOfTrackCandidates(nullptr) + , FractionCandidatesOverSeeds(nullptr) + // , NumberOfGoodTrkVsClus(NULL) + , NumberEventsOfVsLS(nullptr) + , NumberOfTracksVsLS(nullptr) + // , NumberOfGoodTracksVsLS(NULL) + , GoodTracksFractionVsLS(nullptr) + // , GoodTracksNumberOfRecHitsPerTrackVsLS(NULL) + // ADD by Mia for PU monitoring + // vertex plots to be moved in ad hoc class + , NumberOfGoodPVtxVsLS(nullptr) + , NumberOfGoodPVtxWO0VsLS(nullptr) + , NumberEventsOfVsBX (nullptr) + , NumberOfTracksVsBX(nullptr) + , GoodTracksFractionVsBX(nullptr) + , NumberOfRecHitsPerTrackVsBX(nullptr) + , NumberOfGoodPVtxVsBX(nullptr) + , NumberOfGoodPVtxWO0VsBX(nullptr) + , NumberOfTracksVsBXlumi(nullptr) + , NumberOfTracksVsGoodPVtx(nullptr) + , NumberOfTracksVsPUPVtx(nullptr) + , NumberEventsOfVsGoodPVtx(nullptr) + , GoodTracksFractionVsGoodPVtx(nullptr) + , NumberOfRecHitsPerTrackVsGoodPVtx(nullptr) + , NumberOfPVtxVsGoodPVtx(nullptr) + , NumberOfPixelClustersVsGoodPVtx(nullptr) + , NumberOfStripClustersVsGoodPVtx(nullptr) + , NumberEventsOfVsLUMI(nullptr) + , NumberOfTracksVsLUMI(nullptr) + , GoodTracksFractionVsLUMI(nullptr) + , NumberOfRecHitsPerTrackVsLUMI(nullptr) + , NumberOfGoodPVtxVsLUMI(nullptr) + , NumberOfGoodPVtxWO0VsLUMI(nullptr) + , NumberOfPixelClustersVsLUMI(nullptr) + , NumberOfStripClustersVsLUMI(nullptr) + , NumberOfTracks_lumiFlag(nullptr) + // , NumberOfGoodTracks_lumiFlag(NULL) + + , builderName ( iConfig.getParameter("TTRHBuilder")) + , doTrackerSpecific_ ( iConfig.getParameter("doTrackerSpecific") ) + , doLumiAnalysis ( iConfig.getParameter("doLumiAnalysis")) + , doProfilesVsLS_ ( iConfig.getParameter("doProfilesVsLS")) + , doAllPlots ( iConfig.getParameter("doAllPlots")) + , doGeneralPropertiesPlots_( iConfig.getParameter("doGeneralPropertiesPlots")) + , doHitPropertiesPlots_ ( iConfig.getParameter("doHitPropertiesPlots")) + , doPUmonitoring_ ( iConfig.getParameter("doPUmonitoring") ) + , genTriggerEventFlag_(new GenericTriggerEventFlag(iConfig.getParameter("genericTriggerEventPSet"),consumesCollector(), *this)) + , numSelection_ (iConfig.getParameter("numCut")) + , denSelection_ (iConfig.getParameter("denCut")) + , pvNDOF_ ( iConfig.getParameter ("pvNDOF") ) +{ + + edm::ConsumesCollector c{ consumesCollector() }; + theTrackAnalyzer = new dqm::TrackAnalyzer( iConfig,c ); // input tags for collections from the configuration bsSrc_ = iConfig.getParameter("beamSpot"); @@ -124,579 +121,601 @@ TrackingMonitor::TrackingMonitor(const edm::ParameterSet& iConfig) bsSrcToken_ = consumes(bsSrc_); pvSrcToken_ = mayConsume(pvSrc_); - lumiscalersToken_ = consumes(iConfig.getParameter("scal")); + lumiscalersToken_ = consumes(iConfig.getParameter("scal") ); edm::InputTag alltrackProducer = iConfig.getParameter("allTrackProducer"); - edm::InputTag trackProducer = iConfig.getParameter("TrackProducer"); - edm::InputTag tcProducer = iConfig.getParameter("TCProducer"); - edm::InputTag seedProducer = iConfig.getParameter("SeedProducer"); - allTrackToken_ = consumes >(alltrackProducer); - trackToken_ = consumes >(trackProducer); - trackCandidateToken_ = consumes(tcProducer); - seedToken_ = consumes >(seedProducer); - seedStopInfoToken_ = consumes >(tcProducer); + edm::InputTag trackProducer = iConfig.getParameter("TrackProducer"); + edm::InputTag tcProducer = iConfig.getParameter("TCProducer"); + edm::InputTag seedProducer = iConfig.getParameter("SeedProducer"); + allTrackToken_ = consumes >(alltrackProducer); + trackToken_ = consumes >(trackProducer); + trackCandidateToken_ = consumes(tcProducer); + seedToken_ = consumes >(seedProducer); + seedStopInfoToken_ = consumes >(tcProducer); doMVAPlots = iConfig.getParameter("doMVAPlots"); - if (doMVAPlots) { - mvaQualityTokens_ = edm::vector_transform( - iConfig.getParameter >("MVAProducers"), [&](const std::string& tag) { - return std::make_tuple(consumes(edm::InputTag(tag, "MVAValues")), - consumes(edm::InputTag(tag, "QualityMasks"))); - }); + if(doMVAPlots) { + mvaQualityTokens_ = edm::vector_transform(iConfig.getParameter >("MVAProducers"), + [&](const std::string& tag) { + return std::make_tuple(consumes(edm::InputTag(tag, "MVAValues")), + consumes(edm::InputTag(tag, "QualityMasks"))); + }); mvaTrackToken_ = consumes >(iConfig.getParameter("TrackProducerForMVA")); } doRegionPlots = iConfig.getParameter("doRegionPlots"); doRegionCandidatePlots = iConfig.getParameter("doRegionCandidatePlots"); - if (doRegionPlots) { + if(doRegionPlots) { const auto& regionTag = iConfig.getParameter("RegionProducer"); - if (!regionTag.label().empty()) { + if(!regionTag.label().empty()) { regionToken_ = consumes >(regionTag); } const auto& regionLayersTag = iConfig.getParameter("RegionSeedingLayersProducer"); - if (!regionLayersTag.label().empty()) { - if (!regionToken_.isUninitialized()) { - throw cms::Exception("Configuration") - << "Only one of 'RegionProducer' and 'RegionSeedingLayersProducer' can be non-empty, now both are."; + if(!regionLayersTag.label().empty()) { + if(!regionToken_.isUninitialized()) { + throw cms::Exception("Configuration") << "Only one of 'RegionProducer' and 'RegionSeedingLayersProducer' can be non-empty, now both are."; } regionLayerSetsToken_ = consumes(regionLayersTag); - } else if (regionToken_.isUninitialized()) { - throw cms::Exception("Configuration") << "With doRegionPlots=True either 'RegionProducer' or " - "'RegionSeedingLayersProducer' must be non-empty, now both are empty."; + } + else if(regionToken_.isUninitialized()) { + throw cms::Exception("Configuration") << "With doRegionPlots=True either 'RegionProducer' or 'RegionSeedingLayersProducer' must be non-empty, now both are empty."; } - if (doRegionCandidatePlots) { + if(doRegionCandidatePlots) { regionCandidateToken_ = consumes(iConfig.getParameter("RegionCandidates")); } } edm::InputTag stripClusterInputTag_ = iConfig.getParameter("stripCluster"); edm::InputTag pixelClusterInputTag_ = iConfig.getParameter("pixelCluster"); - stripClustersToken_ = mayConsume >(stripClusterInputTag_); - pixelClustersToken_ = mayConsume >(pixelClusterInputTag_); + stripClustersToken_ = mayConsume > (stripClusterInputTag_); + pixelClustersToken_ = mayConsume > (pixelClusterInputTag_); doFractionPlot_ = true; - if (alltrackProducer.label() == trackProducer.label()) - doFractionPlot_ = false; - - Quality_ = iConfig.getParameter("Quality"); + if (alltrackProducer.label()==trackProducer.label()) doFractionPlot_ = false; + + Quality_ = iConfig.getParameter("Quality"); AlgoName_ = iConfig.getParameter("AlgoName"); - + // get flag from the configuration - doPlotsVsBXlumi_ = iConfig.getParameter("doPlotsVsBXlumi"); - if (doPlotsVsBXlumi_) - theLumiDetails_ = new GetLumi(iConfig.getParameter("BXlumiSetup"), c); + doPlotsVsBXlumi_ = iConfig.getParameter("doPlotsVsBXlumi"); + if ( doPlotsVsBXlumi_ ) + theLumiDetails_ = new GetLumi( iConfig.getParameter("BXlumiSetup"), c ); doPlotsVsGoodPVtx_ = iConfig.getParameter("doPlotsVsGoodPVtx"); - doPlotsVsLUMI_ = iConfig.getParameter("doPlotsVsLUMI"); - doPlotsVsBX_ = iConfig.getParameter("doPlotsVsBX"); - - if (doPUmonitoring_) { - std::vector primaryVertexInputTags = - iConfig.getParameter >("primaryVertexInputTags"); - std::vector selPrimaryVertexInputTags = - iConfig.getParameter >("selPrimaryVertexInputTags"); - std::vector pvLabels = iConfig.getParameter >("pvLabels"); - - if (primaryVertexInputTags.size() == pvLabels.size() and - primaryVertexInputTags.size() == selPrimaryVertexInputTags.size()) { - for (size_t i = 0; i < primaryVertexInputTags.size(); i++) { - edm::InputTag iPVinputTag = primaryVertexInputTags[i]; - edm::InputTag iSelPVinputTag = selPrimaryVertexInputTags[i]; - std::string iPVlabel = pvLabels[i]; - - theVertexMonitor.push_back(new VertexMonitor(iConfig, iPVinputTag, iSelPVinputTag, iPVlabel, c)); + doPlotsVsLUMI_ = iConfig.getParameter("doPlotsVsLUMI"); + doPlotsVsBX_ = iConfig.getParameter("doPlotsVsBX"); + + if ( doPUmonitoring_ ) { + + std::vector primaryVertexInputTags = iConfig.getParameter >("primaryVertexInputTags"); + std::vector selPrimaryVertexInputTags = iConfig.getParameter >("selPrimaryVertexInputTags"); + std::vector pvLabels = iConfig.getParameter > ("pvLabels"); + + if (primaryVertexInputTags.size()==pvLabels.size() and primaryVertexInputTags.size()==selPrimaryVertexInputTags.size()) { + for (size_t i=0; igetMapped(confID_); - assert(conf != nullptr); - std::string Quality = conf->getParameter("Quality"); - std::string AlgoName = conf->getParameter("AlgoName"); - MEFolderName = conf->getParameter("FolderName"); - - // test for the Quality veriable validity - if (!Quality_.empty()) { - if (Quality_ != "highPurity" && Quality_ != "tight" && Quality_ != "loose") { - edm::LogWarning("TrackingMonitor") << "Qualty Name is invalid, using no quality criterea by default"; - Quality_ = ""; - } - } - - // use the AlgoName and Quality Name - std::string CategoryName = !Quality_.empty() ? AlgoName_ + "_" + Quality_ : AlgoName_; - - // get binning from the configuration - int TKNoBin = conf->getParameter("TkSizeBin"); - double TKNoMin = conf->getParameter("TkSizeMin"); - double TKNoMax = conf->getParameter("TkSizeMax"); - - int TCNoBin = conf->getParameter("TCSizeBin"); - double TCNoMin = conf->getParameter("TCSizeMin"); - double TCNoMax = conf->getParameter("TCSizeMax"); - - int TKNoSeedBin = conf->getParameter("TkSeedSizeBin"); - double TKNoSeedMin = conf->getParameter("TkSeedSizeMin"); - double TKNoSeedMax = conf->getParameter("TkSeedSizeMax"); - - int MeanHitBin = conf->getParameter("MeanHitBin"); - double MeanHitMin = conf->getParameter("MeanHitMin"); - double MeanHitMax = conf->getParameter("MeanHitMax"); - - int MeanLayBin = conf->getParameter("MeanLayBin"); - double MeanLayMin = conf->getParameter("MeanLayMin"); - double MeanLayMax = conf->getParameter("MeanLayMax"); - - int LSBin = conf->getParameter("LSBin"); - int LSMin = conf->getParameter("LSMin"); - int LSMax = conf->getParameter("LSMax"); - - std::string StateName = conf->getParameter("MeasurementState"); - if (StateName != "OuterSurface" && StateName != "InnerSurface" && StateName != "ImpactPoint" && - StateName != "default" && StateName != "All") { - // print warning - edm::LogWarning("TrackingMonitor") << "State Name is invalid, using 'ImpactPoint' by default"; - } - - ibooker.setCurrentFolder(MEFolderName); - - // book the General Property histograms - // ---------------------------------------------------------------------------------// - - if (doGeneralPropertiesPlots_ || doAllPlots) { - ibooker.setCurrentFolder(MEFolderName + "/GeneralProperties"); - - histname = "NumberOfTracks_" + CategoryName; - // MODIFY by Mia in order to cope w/ high multiplicity - NumberOfTracks = ibooker.book1D(histname, histname, 3 * TKNoBin, TKNoMin, (TKNoMax + 0.5) * 3. - 0.5); - NumberOfTracks->setAxisTitle("Number of Tracks per Event", 1); - NumberOfTracks->setAxisTitle("Number of Events", 2); - - histname = "NumberOfMeanRecHitsPerTrack_" + CategoryName; - NumberOfMeanRecHitsPerTrack = ibooker.book1D(histname, histname, MeanHitBin, MeanHitMin, MeanHitMax); - NumberOfMeanRecHitsPerTrack->setAxisTitle("Mean number of valid RecHits per Track", 1); - NumberOfMeanRecHitsPerTrack->setAxisTitle("Entries", 2); - - histname = "NumberOfMeanLayersPerTrack_" + CategoryName; - NumberOfMeanLayersPerTrack = ibooker.book1D(histname, histname, MeanLayBin, MeanLayMin, MeanLayMax); - NumberOfMeanLayersPerTrack->setAxisTitle("Mean number of Layers per Track", 1); - NumberOfMeanLayersPerTrack->setAxisTitle("Entries", 2); - - if (doFractionPlot_) { - histname = "FractionOfGoodTracks_" + CategoryName; - FractionOfGoodTracks = ibooker.book1D(histname, histname, 101, -0.005, 1.005); - FractionOfGoodTracks->setAxisTitle("Fraction of Tracks (w.r.t. generalTracks)", 1); - FractionOfGoodTracks->setAxisTitle("Entries", 2); - } - } - - if (doLumiAnalysis) { - // add by Mia in order to deal with LS transitions - ibooker.setCurrentFolder(MEFolderName + "/LSanalysis"); - - histname = "NumberOfTracks_lumiFlag_" + CategoryName; - NumberOfTracks_lumiFlag = ibooker.book1D(histname, histname, 3 * TKNoBin, TKNoMin, (TKNoMax + 0.5) * 3. - 0.5); - NumberOfTracks_lumiFlag->setAxisTitle("Number of Tracks per Event", 1); - NumberOfTracks_lumiFlag->setAxisTitle("Number of Events", 2); - } - - // book profile plots vs LS : - //--------------------------- - - if (doProfilesVsLS_ || doAllPlots) { - ibooker.setCurrentFolder(MEFolderName + "/GeneralProperties"); - - histname = "NumberOfTracksVsLS_" + CategoryName; - NumberOfTracksVsLS = ibooker.bookProfile(histname, histname, LSBin, LSMin, LSMax, TKNoMin, TKNoMax * 3., ""); - NumberOfTracksVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); - NumberOfTracksVsLS->setAxisTitle("#Lumi section", 1); - NumberOfTracksVsLS->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfRecHitsPerTrackVsLS_" + CategoryName; - NumberOfRecHitsPerTrackVsLS = ibooker.bookProfile(histname, histname, LSBin, LSMin, LSMax, 0., 200., ""); - NumberOfRecHitsPerTrackVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); - NumberOfRecHitsPerTrackVsLS->setAxisTitle("#Lumi section", 1); - NumberOfRecHitsPerTrackVsLS->setAxisTitle("Mean number of Valid RecHits per track", 2); - - histname = "NumberEventsVsLS_" + CategoryName; - NumberEventsOfVsLS = ibooker.book1D(histname, histname, LSBin, LSMin, LSMax); - NumberEventsOfVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); - NumberEventsOfVsLS->setAxisTitle("#Lumi section", 1); - NumberEventsOfVsLS->setAxisTitle("Number of events", 2); - - double GoodPVtxMin = conf->getParameter("GoodPVtxMin"); - double GoodPVtxMax = conf->getParameter("GoodPVtxMax"); - - histname = "NumberOfGoodPVtxVsLS_" + CategoryName; - NumberOfGoodPVtxVsLS = - ibooker.bookProfile(histname, histname, LSBin, LSMin, LSMax, GoodPVtxMin, 3. * GoodPVtxMax, ""); - NumberOfGoodPVtxVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); - NumberOfGoodPVtxVsLS->setAxisTitle("#Lumi section", 1); - NumberOfGoodPVtxVsLS->setAxisTitle("Mean number of good PV", 2); - - histname = "NumberOfGoodPVtxWO0VsLS_" + CategoryName; - NumberOfGoodPVtxWO0VsLS = - ibooker.bookProfile(histname, histname, LSBin, LSMin, LSMax, GoodPVtxMin, 3. * GoodPVtxMax, ""); - NumberOfGoodPVtxWO0VsLS->setAxisTitle("#Lumi section", 1); - NumberOfGoodPVtxWO0VsLS->setAxisTitle("Mean number of good PV", 2); - - if (doFractionPlot_) { - histname = "GoodTracksFractionVsLS_" + CategoryName; - GoodTracksFractionVsLS = ibooker.bookProfile(histname, histname, LSBin, LSMin, LSMax, 0, 1.1, ""); - GoodTracksFractionVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); - GoodTracksFractionVsLS->setAxisTitle("#Lumi section", 1); - GoodTracksFractionVsLS->setAxisTitle("Fraction of Good Tracks", 2); - } - - if (doPlotsVsBX_ || doAllPlots) { - ibooker.setCurrentFolder(MEFolderName + "/BXanalysis"); - int BXBin = 3564; - double BXMin = 0.5; - double BXMax = 3564.5; - - histname = "NumberEventsVsBX_" + CategoryName; - NumberEventsOfVsBX = ibooker.book1D(histname, histname, BXBin, BXMin, BXMax); - NumberEventsOfVsBX->setAxisTitle("BX", 1); - NumberEventsOfVsBX->setAxisTitle("Number of events", 2); - - histname = "NumberOfTracksVsBX_" + CategoryName; - NumberOfTracksVsBX = ibooker.bookProfile(histname, histname, BXBin, BXMin, BXMax, TKNoMin, TKNoMax * 3., ""); - NumberOfTracksVsBX->setAxisTitle("BX", 1); - NumberOfTracksVsBX->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfRecHitsPerTrackVsBX_" + CategoryName; - NumberOfRecHitsPerTrackVsBX = ibooker.bookProfile(histname, histname, BXBin, BXMin, BXMax, 0., 200., ""); - NumberOfRecHitsPerTrackVsBX->setAxisTitle("BX", 1); - NumberOfRecHitsPerTrackVsBX->setAxisTitle("Mean number of Valid RecHits per track", 2); - - histname = "NumberOfGoodPVtxVsBX_" + CategoryName; - NumberOfGoodPVtxVsBX = - ibooker.bookProfile(histname, histname, BXBin, BXMin, BXMax, GoodPVtxMin, 3. * GoodPVtxMax, ""); - NumberOfGoodPVtxVsBX->setAxisTitle("BX", 1); - NumberOfGoodPVtxVsBX->setAxisTitle("Mean number of good PV", 2); - - histname = "NumberOfGoodPVtxWO0VsBX_" + CategoryName; - NumberOfGoodPVtxWO0VsBX = - ibooker.bookProfile(histname, histname, BXBin, BXMin, BXMax, GoodPVtxMin, 3. * GoodPVtxMax, ""); - NumberOfGoodPVtxWO0VsBX->setAxisTitle("BX", 1); - NumberOfGoodPVtxWO0VsBX->setAxisTitle("Mean number of good PV", 2); - - if (doFractionPlot_) { - histname = "GoodTracksFractionVsBX_" + CategoryName; - GoodTracksFractionVsBX = ibooker.bookProfile(histname, histname, BXBin, BXMin, BXMax, 0, 1.1, ""); - GoodTracksFractionVsBX->setAxisTitle("BX", 1); - GoodTracksFractionVsBX->setAxisTitle("Fraction of Good Tracks", 2); - } - } - } - - // book PU monitoring plots : - //--------------------------- - - if (doPUmonitoring_) { - for (size_t i = 0; i < theVertexMonitor.size(); i++) - theVertexMonitor[i]->initHisto(ibooker); - } - - if (doPlotsVsGoodPVtx_) { - ibooker.setCurrentFolder(MEFolderName + "/PUmonitoring"); - // get binning from the configuration - int PVBin = conf->getParameter("PVBin"); - float PVMin = conf->getParameter("PVMin"); - float PVMax = conf->getParameter("PVMax"); - - histname = "NumberOfTracksVsGoodPVtx"; - NumberOfTracksVsGoodPVtx = ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, TKNoMin, TKNoMax * 5., ""); - NumberOfTracksVsGoodPVtx->setAxisTitle("Number of PV", 1); - NumberOfTracksVsGoodPVtx->setAxisTitle("Mean number of Tracks per Event", 2); - - histname = "NumberOfTracksVsPUPVtx"; - NumberOfTracksVsPUPVtx = ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, 0., TKNoMax * 5., ""); - NumberOfTracksVsPUPVtx->setAxisTitle("Number of PU", 1); - NumberOfTracksVsPUPVtx->setAxisTitle("Mean number of Tracks per PUvtx", 2); - - histname = "NumberEventsVsGoodPVtx"; - NumberEventsOfVsGoodPVtx = ibooker.book1D(histname, histname, PVBin, PVMin, PVMax); - NumberEventsOfVsGoodPVtx->setAxisTitle("Number of good PV (PU)", 1); - NumberEventsOfVsGoodPVtx->setAxisTitle("Number of events", 2); - - if (doFractionPlot_) { - histname = "GoodTracksFractionVsGoodPVtx"; - GoodTracksFractionVsGoodPVtx = ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, 0., 1.1, ""); - GoodTracksFractionVsGoodPVtx->setAxisTitle("Number of good PV (PU)", 1); - GoodTracksFractionVsGoodPVtx->setAxisTitle("Mean fraction of good tracks", 2); - } - - histname = "NumberOfRecHitsPerTrackVsGoodPVtx"; - NumberOfRecHitsPerTrackVsGoodPVtx = ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, 0., 200., ""); - NumberOfRecHitsPerTrackVsGoodPVtx->setAxisTitle("Number of good PV (PU)", 1); - NumberOfRecHitsPerTrackVsGoodPVtx->setAxisTitle("Mean number of valid rechits per Tracks", 2); - - histname = "NumberOfPVtxVsGoodPVtx"; - NumberOfPVtxVsGoodPVtx = ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, 0., 3. * PVMax, ""); - NumberOfPVtxVsGoodPVtx->setAxisTitle("Number of good PV (PU)", 1); - NumberOfPVtxVsGoodPVtx->setAxisTitle("Mean number of vertices", 2); - double NClusPxMin = conf->getParameter("NClusPxMin"); - double NClusPxMax = conf->getParameter("NClusPxMax"); - histname = "NumberOfPixelClustersVsGoodPVtx"; - NumberOfPixelClustersVsGoodPVtx = - ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, NClusPxMin, 3. * NClusPxMax, ""); - NumberOfPixelClustersVsGoodPVtx->setAxisTitle("Number of good PV (PU)", 1); - NumberOfPixelClustersVsGoodPVtx->setAxisTitle("Mean number of pixel clusters", 2); - - double NClusStrMin = conf->getParameter("NClusStrMin"); - double NClusStrMax = conf->getParameter("NClusStrMax"); - histname = "NumberOfStripClustersVsGoodPVtx"; - NumberOfStripClustersVsGoodPVtx = - ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, NClusStrMin, 3. * NClusStrMax, ""); - NumberOfStripClustersVsGoodPVtx->setAxisTitle("Number of good PV (PU)", 1); - NumberOfStripClustersVsGoodPVtx->setAxisTitle("Mean number of strip clusters", 2); - } - - if (doPlotsVsLUMI_ || doAllPlots) { - ibooker.setCurrentFolder(MEFolderName + "/LUMIanalysis"); - int LUMIBin = conf->getParameter("LUMIBin"); - float LUMIMin = conf->getParameter("LUMIMin"); - float LUMIMax = conf->getParameter("LUMIMax"); - - histname = "NumberEventsVsLUMI"; - NumberEventsOfVsLUMI = ibooker.book1D(histname, histname, LUMIBin, LUMIMin, LUMIMax); - NumberEventsOfVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); - NumberEventsOfVsLUMI->setAxisTitle("Number of events", 2); - - histname = "NumberOfTracksVsLUMI"; - NumberOfTracksVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, 0., 2000., ""); - NumberOfTracksVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); - NumberOfTracksVsLUMI->setAxisTitle("Mean number of vertices", 2); - - if (doFractionPlot_) { - histname = "GoodTracksFractionVsLUMI"; - GoodTracksFractionVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, 0., 1.1, ""); - GoodTracksFractionVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); - GoodTracksFractionVsLUMI->setAxisTitle("Mean number of vertices", 2); - } - - histname = "NumberOfRecHitsPerTrackVsLUMI"; - NumberOfRecHitsPerTrackVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, 0., 200., ""); - NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); - NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("Mean number of vertices", 2); - - double PVMin = conf->getParameter("PVMin"); - double PVMax = conf->getParameter("PVMax"); - - histname = "NumberOfGoodPVtxVsLUMI"; - NumberOfGoodPVtxVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, PVMin, 3. * PVMax, ""); - NumberOfGoodPVtxVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); - NumberOfGoodPVtxVsLUMI->setAxisTitle("Mean number of vertices", 2); - - histname = "NumberOfGoodPVtxWO0VsLUMI"; - NumberOfGoodPVtxWO0VsLUMI = - ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, PVMin, 3. * PVMax, ""); - NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); - NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("Mean number of vertices", 2); - - double NClusPxMin = conf->getParameter("NClusPxMin"); - double NClusPxMax = conf->getParameter("NClusPxMax"); - histname = "NumberOfPixelClustersVsGoodPVtx"; - NumberOfPixelClustersVsLUMI = - ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, NClusPxMin, 3. * NClusPxMax, ""); - NumberOfPixelClustersVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); - NumberOfPixelClustersVsLUMI->setAxisTitle("Mean number of pixel clusters", 2); - - double NClusStrMin = conf->getParameter("NClusStrMin"); - double NClusStrMax = conf->getParameter("NClusStrMax"); - histname = "NumberOfStripClustersVsLUMI"; - NumberOfStripClustersVsLUMI = - ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, NClusStrMin, 3. * NClusStrMax, ""); - NumberOfStripClustersVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); - NumberOfStripClustersVsLUMI->setAxisTitle("Mean number of strip clusters", 2); - } - - if (doPlotsVsBXlumi_) { - ibooker.setCurrentFolder(MEFolderName + "/PUmonitoring"); - // get binning from the configuration - edm::ParameterSet BXlumiParameters = conf->getParameter("BXlumiSetup"); - int BXlumiBin = BXlumiParameters.getParameter("BXlumiBin"); - double BXlumiMin = BXlumiParameters.getParameter("BXlumiMin"); - double BXlumiMax = BXlumiParameters.getParameter("BXlumiMax"); - - histname = "NumberOfTracksVsBXlumi_" + CategoryName; - NumberOfTracksVsBXlumi = - ibooker.bookProfile(histname, histname, BXlumiBin, BXlumiMin, BXlumiMax, TKNoMin, 3. * TKNoMax, ""); - NumberOfTracksVsBXlumi->setAxisTitle("lumi BX [10^{30}Hzcm^{-2}]", 1); - NumberOfTracksVsBXlumi->setAxisTitle("Mean number of Tracks", 2); - } - - theTrackAnalyzer->initHisto(ibooker, iSetup, *conf); - - // book the Seed Property histograms - // ---------------------------------------------------------------------------------// - - ibooker.setCurrentFolder(MEFolderName + "/TrackBuilding"); - - doAllSeedPlots = conf->getParameter("doSeedParameterHistos"); - doSeedNumberPlot = conf->getParameter("doSeedNumberHisto"); - doSeedLumiAnalysis_ = conf->getParameter("doSeedLumiAnalysis"); - doSeedVsClusterPlot = conf->getParameter("doSeedVsClusterHisto"); - // if (doAllPlots) doAllSeedPlots=true; - - runTrackBuildingAnalyzerForSeed = - (doAllSeedPlots || conf->getParameter("doSeedPTHisto") || conf->getParameter("doSeedETAHisto") || - conf->getParameter("doSeedPHIHisto") || conf->getParameter("doSeedPHIVsETAHisto") || - conf->getParameter("doSeedThetaHisto") || conf->getParameter("doSeedQHisto") || - conf->getParameter("doSeedDxyHisto") || conf->getParameter("doSeedDzHisto") || - conf->getParameter("doSeedNRecHitsHisto") || conf->getParameter("doSeedNVsPhiProf") || - conf->getParameter("doSeedNVsEtaProf")); - - edm::InputTag seedProducer = conf->getParameter("SeedProducer"); - - if (doAllSeedPlots || doSeedNumberPlot) { - ibooker.setCurrentFolder(MEFolderName + "/TrackBuilding"); - histname = "NumberOfSeeds_" + seedProducer.label() + "_" + CategoryName; - NumberOfSeeds = ibooker.book1D(histname, histname, TKNoSeedBin, TKNoSeedMin, TKNoSeedMax); - NumberOfSeeds->setAxisTitle("Number of Seeds per Event", 1); - NumberOfSeeds->setAxisTitle("Number of Events", 2); - - if (doSeedLumiAnalysis_) { - ibooker.setCurrentFolder(MEFolderName + "/LSanalysis"); - histname = "NumberOfSeeds_lumiFlag_" + seedProducer.label() + "_" + CategoryName; - NumberOfSeeds_lumiFlag = ibooker.book1D(histname, histname, TKNoSeedBin, TKNoSeedMin, TKNoSeedMax); - NumberOfSeeds_lumiFlag->setAxisTitle("Number of Seeds per Event", 1); - NumberOfSeeds_lumiFlag->setAxisTitle("Number of Events", 2); - } - } +TrackingMonitor::~TrackingMonitor() +{ + if (theTrackAnalyzer) delete theTrackAnalyzer; + if (theTrackBuildingAnalyzer) delete theTrackBuildingAnalyzer; + if ( doPUmonitoring_ ) + for (size_t i=0; igetParameter >("ClusterLabels"); - std::vector histoMin, histoMax; - std::vector histoBin; //these vectors are for max min and nbins in histograms +void TrackingMonitor::bookHistograms(DQMStore::IBooker & ibooker, + edm::Run const & iRun, + edm::EventSetup const & iSetup) +{ + // parameters from the configuration + auto const* conf = edm::pset::Registry::instance()->getMapped(confID_); + assert(conf != nullptr); + std::string Quality = conf->getParameter("Quality"); + std::string AlgoName = conf->getParameter("AlgoName"); + MEFolderName = conf->getParameter("FolderName"); + + // test for the Quality veriable validity + if( !Quality_.empty()) { + if( Quality_ != "highPurity" && Quality_ != "tight" && Quality_ != "loose") { + edm::LogWarning("TrackingMonitor") << "Qualty Name is invalid, using no quality criterea by default"; + Quality_ = ""; + } + } + + // use the AlgoName and Quality Name + std::string CategoryName = !Quality_.empty() ? AlgoName_ + "_" + Quality_ : AlgoName_; + + // get binning from the configuration + int TKNoBin = conf->getParameter( "TkSizeBin"); + double TKNoMin = conf->getParameter("TkSizeMin"); + double TKNoMax = conf->getParameter("TkSizeMax"); + + int TCNoBin = conf->getParameter( "TCSizeBin"); + double TCNoMin = conf->getParameter("TCSizeMin"); + double TCNoMax = conf->getParameter("TCSizeMax"); + + int TKNoSeedBin = conf->getParameter( "TkSeedSizeBin"); + double TKNoSeedMin = conf->getParameter("TkSeedSizeMin"); + double TKNoSeedMax = conf->getParameter("TkSeedSizeMax"); + + int MeanHitBin = conf->getParameter( "MeanHitBin"); + double MeanHitMin = conf->getParameter("MeanHitMin"); + double MeanHitMax = conf->getParameter("MeanHitMax"); + + int MeanLayBin = conf->getParameter( "MeanLayBin"); + double MeanLayMin = conf->getParameter("MeanLayMin"); + double MeanLayMax = conf->getParameter("MeanLayMax"); + + int LSBin = conf->getParameter( "LSBin"); + int LSMin = conf->getParameter("LSMin"); + int LSMax = conf->getParameter("LSMax"); + + std::string StateName = conf->getParameter("MeasurementState"); + if ( + StateName != "OuterSurface" && + StateName != "InnerSurface" && + StateName != "ImpactPoint" && + StateName != "default" && + StateName != "All" + ) { + // print warning + edm::LogWarning("TrackingMonitor") << "State Name is invalid, using 'ImpactPoint' by default"; + } + + ibooker.setCurrentFolder(MEFolderName); + + // book the General Property histograms + // ---------------------------------------------------------------------------------// + + if (doGeneralPropertiesPlots_ || doAllPlots){ + + ibooker.setCurrentFolder(MEFolderName+"/GeneralProperties"); + + histname = "NumberOfTracks_" + CategoryName; + // MODIFY by Mia in order to cope w/ high multiplicity + NumberOfTracks = ibooker.book1D(histname, histname, 3*TKNoBin, TKNoMin, (TKNoMax+0.5)*3.-0.5); + NumberOfTracks->setAxisTitle("Number of Tracks per Event", 1); + NumberOfTracks->setAxisTitle("Number of Events", 2); + + histname = "NumberOfTracks_PUvtx_" + CategoryName; + NumberOfTracks_PUvtx = ibooker.book1D(histname, histname, 3*TKNoBin, TKNoMin, (TKNoMax+0.5)*3.-0.5); + NumberOfTracks_PUvtx->setAxisTitle("Number of Tracks per Event (matched a PU vertex)", 1); + NumberOfTracks_PUvtx->setAxisTitle("Number of Events", 2); + + histname = "NumberofTracks_Hardvtx_" + CategoryName; + NumberofTracks_Hardvtx = ibooker.book1D(histname, histname, TKNoBin/10, TKNoMin, (TKNoMax/10+0.5)*3.-0.5); + NumberofTracks_Hardvtx->setAxisTitle("Number of Tracks per Event (matched main vertex)", 1); + NumberofTracks_Hardvtx->setAxisTitle("Number of Events", 2); + + histname = "NumberofTracks_Hardvtx_PUvtx_" + CategoryName; + NumberofTracks_Hardvtx_PUvtx = ibooker.book1D(histname, histname, 2, 0., 2.); + NumberofTracks_Hardvtx_PUvtx->setAxisTitle("Number of Tracks per PU/Hard vertex", 1); + NumberofTracks_Hardvtx_PUvtx->setAxisTitle("Number of Tracks", 2); + NumberofTracks_Hardvtx_PUvtx->setBinLabel(1,"PU_Vertex"); + NumberofTracks_Hardvtx_PUvtx->setBinLabel(2,"Hard_Vertex"); + + histname = "NumberOfMeanRecHitsPerTrack_" + CategoryName; + NumberOfMeanRecHitsPerTrack = ibooker.book1D(histname, histname, MeanHitBin, MeanHitMin, MeanHitMax); + NumberOfMeanRecHitsPerTrack->setAxisTitle("Mean number of valid RecHits per Track", 1); + NumberOfMeanRecHitsPerTrack->setAxisTitle("Entries", 2); + + histname = "NumberOfMeanLayersPerTrack_" + CategoryName; + NumberOfMeanLayersPerTrack = ibooker.book1D(histname, histname, MeanLayBin, MeanLayMin, MeanLayMax); + NumberOfMeanLayersPerTrack->setAxisTitle("Mean number of Layers per Track", 1); + NumberOfMeanLayersPerTrack->setAxisTitle("Entries", 2); + + if (doFractionPlot_) { + histname = "FractionOfGoodTracks_" + CategoryName; + FractionOfGoodTracks = ibooker.book1D(histname, histname, 101, -0.005, 1.005); + FractionOfGoodTracks->setAxisTitle("Fraction of Tracks (w.r.t. generalTracks)", 1); + FractionOfGoodTracks->setAxisTitle("Entries", 2); + } + } + + if ( doLumiAnalysis ) { + // add by Mia in order to deal with LS transitions + ibooker.setCurrentFolder(MEFolderName+"/LSanalysis"); + + histname = "NumberOfTracks_lumiFlag_" + CategoryName; + NumberOfTracks_lumiFlag = ibooker.book1D(histname, histname, 3*TKNoBin, TKNoMin, (TKNoMax+0.5)*3.-0.5); + NumberOfTracks_lumiFlag->setAxisTitle("Number of Tracks per Event", 1); + NumberOfTracks_lumiFlag->setAxisTitle("Number of Events", 2); + + } - int NClusPxBin = conf->getParameter("NClusPxBin"); - double NClusPxMin = conf->getParameter("NClusPxMin"); - double NClusPxMax = conf->getParameter("NClusPxMax"); + // book profile plots vs LS : + //--------------------------- - int NClusStrBin = conf->getParameter("NClusStrBin"); - double NClusStrMin = conf->getParameter("NClusStrMin"); - double NClusStrMax = conf->getParameter("NClusStrMax"); - setMaxMinBin( - histoMin, histoMax, histoBin, NClusStrMin, NClusStrMax, NClusStrBin, NClusPxMin, NClusPxMax, NClusPxBin); - - for (uint i = 0; i < ClusterLabels.size(); i++) { - histname = "SeedsVsClusters_" + seedProducer.label() + "_Vs_" + ClusterLabels[i] + "_" + CategoryName; - SeedsVsClusters.push_back(dynamic_cast(ibooker.book2D( - histname, histname, histoBin[i], histoMin[i], histoMax[i], TKNoSeedBin, TKNoSeedMin, TKNoSeedMax))); - SeedsVsClusters[i]->setAxisTitle("Number of Clusters", 1); - SeedsVsClusters[i]->setAxisTitle("Number of Seeds", 2); - SeedsVsClusters[i]->getTH2F()->SetCanExtend(TH1::kAllAxes); - } - } + if ( doProfilesVsLS_ || doAllPlots) { + + ibooker.setCurrentFolder(MEFolderName+"/GeneralProperties"); + + histname = "NumberOfTracksVsLS_"+ CategoryName; + NumberOfTracksVsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax, TKNoMin, TKNoMax*3.,""); + NumberOfTracksVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); + NumberOfTracksVsLS->setAxisTitle("#Lumi section",1); + NumberOfTracksVsLS->setAxisTitle("Number of Tracks",2); + + histname = "NumberOfRecHitsPerTrackVsLS_" + CategoryName; + NumberOfRecHitsPerTrackVsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax,0.,200.,""); + NumberOfRecHitsPerTrackVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); + NumberOfRecHitsPerTrackVsLS->setAxisTitle("#Lumi section",1); + NumberOfRecHitsPerTrackVsLS->setAxisTitle("Mean number of Valid RecHits per track",2); + + histname = "NumberEventsVsLS_" + CategoryName; + NumberEventsOfVsLS = ibooker.book1D(histname,histname, LSBin,LSMin,LSMax); + NumberEventsOfVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); + NumberEventsOfVsLS->setAxisTitle("#Lumi section",1); + NumberEventsOfVsLS->setAxisTitle("Number of events",2); + + double GoodPVtxMin = conf->getParameter("GoodPVtxMin"); + double GoodPVtxMax = conf->getParameter("GoodPVtxMax"); + + histname = "NumberOfGoodPVtxVsLS_" + CategoryName; + NumberOfGoodPVtxVsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax,GoodPVtxMin,3.*GoodPVtxMax,""); + NumberOfGoodPVtxVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); + NumberOfGoodPVtxVsLS->setAxisTitle("#Lumi section",1); + NumberOfGoodPVtxVsLS->setAxisTitle("Mean number of good PV",2); + + histname = "NumberOfGoodPVtxWO0VsLS_" + CategoryName; + NumberOfGoodPVtxWO0VsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax,GoodPVtxMin,3.*GoodPVtxMax,""); + NumberOfGoodPVtxWO0VsLS->setAxisTitle("#Lumi section",1); + NumberOfGoodPVtxWO0VsLS->setAxisTitle("Mean number of good PV",2); + + if (doFractionPlot_) { + histname = "GoodTracksFractionVsLS_"+ CategoryName; + GoodTracksFractionVsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax,0,1.1,""); + GoodTracksFractionVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); + GoodTracksFractionVsLS->setAxisTitle("#Lumi section",1); + GoodTracksFractionVsLS->setAxisTitle("Fraction of Good Tracks",2); + } + + if ( doPlotsVsBX_ || doAllPlots ) { + ibooker.setCurrentFolder(MEFolderName+"/BXanalysis"); + int BXBin = 3564; double BXMin = 0.5; double BXMax = 3564.5; + + histname = "NumberEventsVsBX_" + CategoryName; + NumberEventsOfVsBX = ibooker.book1D(histname,histname, BXBin,BXMin,BXMax); + NumberEventsOfVsBX->setAxisTitle("BX",1); + NumberEventsOfVsBX->setAxisTitle("Number of events",2); + + histname = "NumberOfTracksVsBX_"+ CategoryName; + NumberOfTracksVsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax, TKNoMin, TKNoMax*3.,""); + NumberOfTracksVsBX->setAxisTitle("BX",1); + NumberOfTracksVsBX->setAxisTitle("Number of Tracks",2); + + histname = "NumberOfRecHitsPerTrackVsBX_" + CategoryName; + NumberOfRecHitsPerTrackVsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax,0.,200.,""); + NumberOfRecHitsPerTrackVsBX->setAxisTitle("BX",1); + NumberOfRecHitsPerTrackVsBX->setAxisTitle("Mean number of Valid RecHits per track",2); + + histname = "NumberOfGoodPVtxVsBX_" + CategoryName; + NumberOfGoodPVtxVsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax,GoodPVtxMin,3.*GoodPVtxMax,""); + NumberOfGoodPVtxVsBX->setAxisTitle("BX",1); + NumberOfGoodPVtxVsBX->setAxisTitle("Mean number of good PV",2); + + histname = "NumberOfGoodPVtxWO0VsBX_" + CategoryName; + NumberOfGoodPVtxWO0VsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax,GoodPVtxMin,3.*GoodPVtxMax,""); + NumberOfGoodPVtxWO0VsBX->setAxisTitle("BX",1); + NumberOfGoodPVtxWO0VsBX->setAxisTitle("Mean number of good PV",2); + + if (doFractionPlot_) { + histname = "GoodTracksFractionVsBX_"+ CategoryName; + GoodTracksFractionVsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax,0,1.1,""); + GoodTracksFractionVsBX->setAxisTitle("BX",1); + GoodTracksFractionVsBX->setAxisTitle("Fraction of Good Tracks",2); + } + } + + } + + // book PU monitoring plots : + //--------------------------- + + if ( doPUmonitoring_ ) { + + for (size_t i=0; iinitHisto(ibooker); + } + + if ( doPlotsVsGoodPVtx_ ) { + ibooker.setCurrentFolder(MEFolderName+"/PUmonitoring"); + // get binning from the configuration + int PVBin = conf->getParameter ("PVBin"); + float PVMin = conf->getParameter("PVMin"); + float PVMax = conf->getParameter("PVMax"); + + histname = "NumberOfTracksVsGoodPVtx"; + NumberOfTracksVsGoodPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,TKNoMin, TKNoMax*5.,""); + NumberOfTracksVsGoodPVtx->setAxisTitle("Number of PV",1); + NumberOfTracksVsGoodPVtx->setAxisTitle("Mean number of Tracks per Event",2); + + histname = "NumberOfTracksVsPUPVtx"; + NumberOfTracksVsPUPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,0., TKNoMax*5.,""); + NumberOfTracksVsPUPVtx->setAxisTitle("Number of PU",1); + NumberOfTracksVsPUPVtx->setAxisTitle("Mean number of Tracks per PUvtx",2); + + histname = "NumberEventsVsGoodPVtx"; + NumberEventsOfVsGoodPVtx = ibooker.book1D(histname,histname,PVBin,PVMin,PVMax); + NumberEventsOfVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1); + NumberEventsOfVsGoodPVtx->setAxisTitle("Number of events",2); + + if (doFractionPlot_) { + histname = "GoodTracksFractionVsGoodPVtx"; + GoodTracksFractionVsGoodPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,0., 1.1,""); + GoodTracksFractionVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1); + GoodTracksFractionVsGoodPVtx->setAxisTitle("Mean fraction of good tracks",2); + } + + histname = "NumberOfRecHitsPerTrackVsGoodPVtx"; + NumberOfRecHitsPerTrackVsGoodPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,0., 200.,""); + NumberOfRecHitsPerTrackVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1); + NumberOfRecHitsPerTrackVsGoodPVtx->setAxisTitle("Mean number of valid rechits per Tracks",2); + + histname = "NumberOfPVtxVsGoodPVtx"; + NumberOfPVtxVsGoodPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,0., 3.*PVMax,""); + NumberOfPVtxVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1); + NumberOfPVtxVsGoodPVtx->setAxisTitle("Mean number of vertices",2); + + double NClusPxMin = conf->getParameter("NClusPxMin"); + double NClusPxMax = conf->getParameter("NClusPxMax"); + histname = "NumberOfPixelClustersVsGoodPVtx"; + NumberOfPixelClustersVsGoodPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,NClusPxMin,3.*NClusPxMax,""); + NumberOfPixelClustersVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1); + NumberOfPixelClustersVsGoodPVtx->setAxisTitle("Mean number of pixel clusters",2); + + double NClusStrMin = conf->getParameter("NClusStrMin"); + double NClusStrMax = conf->getParameter("NClusStrMax"); + histname = "NumberOfStripClustersVsGoodPVtx"; + NumberOfStripClustersVsGoodPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,NClusStrMin,3.*NClusStrMax,""); + NumberOfStripClustersVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1); + NumberOfStripClustersVsGoodPVtx->setAxisTitle("Mean number of strip clusters",2); + + } + - if (doRegionPlots) { - ibooker.setCurrentFolder(MEFolderName + "/TrackBuilding"); + if ( doPlotsVsLUMI_ || doAllPlots ) { + ibooker.setCurrentFolder(MEFolderName+"/LUMIanalysis"); + int LUMIBin = conf->getParameter("LUMIBin"); + float LUMIMin = conf->getParameter("LUMIMin"); + float LUMIMax = conf->getParameter("LUMIMax"); + + histname = "NumberEventsVsLUMI"; + NumberEventsOfVsLUMI = ibooker.book1D(histname,histname,LUMIBin,LUMIMin,LUMIMax); + NumberEventsOfVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); + NumberEventsOfVsLUMI->setAxisTitle("Number of events",2); + + histname = "NumberOfTracksVsLUMI"; + NumberOfTracksVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,0., 2000.,""); + NumberOfTracksVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); + NumberOfTracksVsLUMI->setAxisTitle("Mean number of vertices",2); + + if (doFractionPlot_) { + histname = "GoodTracksFractionVsLUMI"; + GoodTracksFractionVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,0., 1.1,""); + GoodTracksFractionVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); + GoodTracksFractionVsLUMI->setAxisTitle("Mean number of vertices",2); + } + + histname = "NumberOfRecHitsPerTrackVsLUMI"; + NumberOfRecHitsPerTrackVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,0., 200.,""); + NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); + NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("Mean number of vertices",2); + + double PVMin = conf->getParameter("PVMin"); + double PVMax = conf->getParameter("PVMax"); + + histname = "NumberOfGoodPVtxVsLUMI"; + NumberOfGoodPVtxVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,PVMin,3.*PVMax,""); + NumberOfGoodPVtxVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); + NumberOfGoodPVtxVsLUMI->setAxisTitle("Mean number of vertices",2); + + histname = "NumberOfGoodPVtxWO0VsLUMI"; + NumberOfGoodPVtxWO0VsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,PVMin,3.*PVMax,""); + NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); + NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("Mean number of vertices",2); + + double NClusPxMin = conf->getParameter("NClusPxMin"); + double NClusPxMax = conf->getParameter("NClusPxMax"); + histname = "NumberOfPixelClustersVsGoodPVtx"; + NumberOfPixelClustersVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,NClusPxMin,3.*NClusPxMax,""); + NumberOfPixelClustersVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); + NumberOfPixelClustersVsLUMI->setAxisTitle("Mean number of pixel clusters",2); + + double NClusStrMin = conf->getParameter("NClusStrMin"); + double NClusStrMax = conf->getParameter("NClusStrMax"); + histname = "NumberOfStripClustersVsLUMI"; + NumberOfStripClustersVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,NClusStrMin,3.*NClusStrMax,""); + NumberOfStripClustersVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); + NumberOfStripClustersVsLUMI->setAxisTitle("Mean number of strip clusters",2); + + } + + + if ( doPlotsVsBXlumi_ ) { + ibooker.setCurrentFolder(MEFolderName+"/PUmonitoring"); + // get binning from the configuration + edm::ParameterSet BXlumiParameters = conf->getParameter("BXlumiSetup"); + int BXlumiBin = BXlumiParameters.getParameter("BXlumiBin"); + double BXlumiMin = BXlumiParameters.getParameter("BXlumiMin"); + double BXlumiMax = BXlumiParameters.getParameter("BXlumiMax"); + + histname = "NumberOfTracksVsBXlumi_"+ CategoryName; + NumberOfTracksVsBXlumi = ibooker.bookProfile(histname,histname, BXlumiBin,BXlumiMin,BXlumiMax, TKNoMin, 3.*TKNoMax,""); + NumberOfTracksVsBXlumi->setAxisTitle("lumi BX [10^{30}Hzcm^{-2}]",1); + NumberOfTracksVsBXlumi->setAxisTitle("Mean number of Tracks",2); + + } + + + theTrackAnalyzer->initHisto(ibooker, iSetup, *conf); + + // book the Seed Property histograms + // ---------------------------------------------------------------------------------// + + ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding"); + + doAllSeedPlots = conf->getParameter("doSeedParameterHistos"); + doSeedNumberPlot = conf->getParameter("doSeedNumberHisto"); + doSeedLumiAnalysis_ = conf->getParameter("doSeedLumiAnalysis"); + doSeedVsClusterPlot = conf->getParameter("doSeedVsClusterHisto"); + // if (doAllPlots) doAllSeedPlots=true; + + runTrackBuildingAnalyzerForSeed=(doAllSeedPlots || conf->getParameter("doSeedPTHisto") ||conf->getParameter("doSeedETAHisto") || conf->getParameter("doSeedPHIHisto") || conf->getParameter("doSeedPHIVsETAHisto") || conf->getParameter("doSeedThetaHisto") || conf->getParameter("doSeedQHisto") || conf->getParameter("doSeedDxyHisto") || conf->getParameter("doSeedDzHisto") || conf->getParameter("doSeedNRecHitsHisto") || conf->getParameter("doSeedNVsPhiProf")|| conf->getParameter("doSeedNVsEtaProf")); + + edm::InputTag seedProducer = conf->getParameter("SeedProducer"); + + if (doAllSeedPlots || doSeedNumberPlot){ + ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding"); + histname = "NumberOfSeeds_"+ seedProducer.label() + "_"+ CategoryName; + NumberOfSeeds = ibooker.book1D(histname, histname, TKNoSeedBin, TKNoSeedMin, TKNoSeedMax); + NumberOfSeeds->setAxisTitle("Number of Seeds per Event", 1); + NumberOfSeeds->setAxisTitle("Number of Events", 2); + + if ( doSeedLumiAnalysis_ ) { + ibooker.setCurrentFolder(MEFolderName+"/LSanalysis"); + histname = "NumberOfSeeds_lumiFlag_"+ seedProducer.label() + "_"+ CategoryName; + NumberOfSeeds_lumiFlag = ibooker.book1D(histname, histname, TKNoSeedBin, TKNoSeedMin, TKNoSeedMax); + NumberOfSeeds_lumiFlag->setAxisTitle("Number of Seeds per Event", 1); + NumberOfSeeds_lumiFlag->setAxisTitle("Number of Events", 2); + } + + } + + if (doAllSeedPlots || doSeedVsClusterPlot){ + ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding"); + + ClusterLabels= conf->getParameter >("ClusterLabels"); + + std::vector histoMin,histoMax; + std::vector histoBin; //these vectors are for max min and nbins in histograms + + int NClusPxBin = conf->getParameter( "NClusPxBin"); + double NClusPxMin = conf->getParameter("NClusPxMin"); + double NClusPxMax = conf->getParameter("NClusPxMax"); + + int NClusStrBin = conf->getParameter( "NClusStrBin"); + double NClusStrMin = conf->getParameter("NClusStrMin"); + double NClusStrMax = conf->getParameter("NClusStrMax"); + + setMaxMinBin(histoMin,histoMax,histoBin,NClusStrMin,NClusStrMax,NClusStrBin,NClusPxMin,NClusPxMax,NClusPxBin); + + for (uint i=0; i(ibooker.book2D(histname, histname, histoBin[i], histoMin[i], histoMax[i], + TKNoSeedBin, TKNoSeedMin, TKNoSeedMax))); + SeedsVsClusters[i]->setAxisTitle("Number of Clusters", 1); + SeedsVsClusters[i]->setAxisTitle("Number of Seeds", 2); + SeedsVsClusters[i]->getTH2F()->SetCanExtend(TH1::kAllAxes); + } + } + + if(doRegionPlots) { + ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding"); - int regionBin = conf->getParameter("RegionSizeBin"); - double regionMin = conf->getParameter("RegionSizeMin"); - double regionMax = conf->getParameter("RegionSizeMax"); + int regionBin = conf->getParameter( "RegionSizeBin"); + double regionMin = conf->getParameter("RegionSizeMin"); + double regionMax = conf->getParameter("RegionSizeMax"); - histname = "TrackingRegionsNumberOf_" + seedProducer.label() + "_" + CategoryName; - NumberOfTrackingRegions = ibooker.book1D(histname, histname, regionBin, regionMin, regionMax); - NumberOfTrackingRegions->setAxisTitle("Number of TrackingRegions per Event", 1); - NumberOfTrackingRegions->setAxisTitle("Number of Events", 2); - } + histname = "TrackingRegionsNumberOf_"+ seedProducer.label() + "_"+ CategoryName; + NumberOfTrackingRegions = ibooker.book1D(histname, histname, regionBin, regionMin, regionMax); + NumberOfTrackingRegions->setAxisTitle("Number of TrackingRegions per Event", 1); + NumberOfTrackingRegions->setAxisTitle("Number of Events", 2); + } - doTkCandPlots = conf->getParameter("doTrackCandHistos"); + doTkCandPlots=conf->getParameter("doTrackCandHistos"); // if (doAllPlots) doTkCandPlots=true; - - if (doTkCandPlots) { - ibooker.setCurrentFolder(MEFolderName + "/TrackBuilding"); - - edm::InputTag tcProducer = conf->getParameter("TCProducer"); - - histname = "NumberOfTrackCandidates_" + tcProducer.label() + "_" + CategoryName; + + if (doTkCandPlots){ + ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding"); + + edm::InputTag tcProducer = conf->getParameter("TCProducer"); + + histname = "NumberOfTrackCandidates_"+ tcProducer.label() + "_"+ CategoryName; NumberOfTrackCandidates = ibooker.book1D(histname, histname, TCNoBin, TCNoMin, TCNoMax); NumberOfTrackCandidates->setAxisTitle("Number of Track Candidates per Event", 1); NumberOfTrackCandidates->setAxisTitle("Number of Event", 2); - histname = "FractionOfCandOverSeeds_" + tcProducer.label() + "_" + CategoryName; + histname = "FractionOfCandOverSeeds_"+ tcProducer.label() + "_"+ CategoryName; FractionCandidatesOverSeeds = ibooker.book1D(histname, histname, 101, 0., 1.01); FractionCandidatesOverSeeds->setAxisTitle("Number of Track Candidates / Number of Seeds per Event", 1); FractionCandidatesOverSeeds->setAxisTitle("Number of Event", 2); - } - - theTrackBuildingAnalyzer->initHisto(ibooker, *conf); + } + + theTrackBuildingAnalyzer->initHisto(ibooker,*conf); + + if (doLumiAnalysis) { - if (NumberOfTracks_lumiFlag) - NumberOfTracks_lumiFlag->setLumiFlag(); - theTrackAnalyzer->setLumiFlag(); + if ( NumberOfTracks_lumiFlag ) NumberOfTracks_lumiFlag -> setLumiFlag(); + theTrackAnalyzer->setLumiFlag(); } - if (doAllSeedPlots || doSeedNumberPlot) { - if (doSeedLumiAnalysis_) + if(doAllSeedPlots || doSeedNumberPlot){ + if ( doSeedLumiAnalysis_ ) NumberOfSeeds_lumiFlag->setLumiFlag(); } - + if (doTrackerSpecific_ || doAllPlots) { - ClusterLabels = conf->getParameter >("ClusterLabels"); - - std::vector histoMin, histoMax; - std::vector histoBin; //these vectors are for max min and nbins in histograms - - int NClusStrBin = conf->getParameter("NClusStrBin"); + + ClusterLabels= conf->getParameter >("ClusterLabels"); + + std::vector histoMin,histoMax; + std::vector histoBin; //these vectors are for max min and nbins in histograms + + int NClusStrBin = conf->getParameter( "NClusStrBin"); double NClusStrMin = conf->getParameter("NClusStrMin"); double NClusStrMax = conf->getParameter("NClusStrMax"); - - int NClusPxBin = conf->getParameter("NClusPxBin"); + + int NClusPxBin = conf->getParameter( "NClusPxBin"); double NClusPxMin = conf->getParameter("NClusPxMin"); double NClusPxMax = conf->getParameter("NClusPxMax"); - - int NTrk2DBin = conf->getParameter("NTrk2DBin"); - double NTrk2DMin = conf->getParameter("NTrk2DMin"); - double NTrk2DMax = conf->getParameter("NTrk2DMax"); - - setMaxMinBin( - histoMin, histoMax, histoBin, NClusStrMin, NClusStrMax, NClusStrBin, NClusPxMin, NClusPxMax, NClusPxBin); - - ibooker.setCurrentFolder(MEFolderName + "/HitProperties"); - - for (uint i = 0; i < ClusterLabels.size(); i++) { - ibooker.setCurrentFolder(MEFolderName + "/HitProperties"); + + int NTrk2DBin = conf->getParameter( "NTrk2DBin"); + double NTrk2DMin = conf->getParameter("NTrk2DMin"); + double NTrk2DMax = conf->getParameter("NTrk2DMax"); + + setMaxMinBin(histoMin,histoMax,histoBin, + NClusStrMin,NClusStrMax,NClusStrBin, + NClusPxMin, NClusPxMax, NClusPxBin); + + ibooker.setCurrentFolder(MEFolderName+"/HitProperties"); + + for (uint i=0; i( - ibooker.book2D(histname, histname, histoBin[i], histoMin[i], histoMax[i], NTrk2DBin, NTrk2DMin, NTrk2DMax))); + NumberOfTrkVsClusters.push_back(dynamic_cast(ibooker.book2D(histname, histname, + histoBin[i], histoMin[i], histoMax[i], + NTrk2DBin,NTrk2DMin,NTrk2DMax + ))); std::string title = "Number of " + ClusterLabels[i] + " Clusters"; - if (ClusterLabels[i] == "Tot") - title = "# of Clusters in (Pixel+Strip) Detectors"; + if(ClusterLabels[i]=="Tot") + title = "# of Clusters in (Pixel+Strip) Detectors"; NumberOfTrkVsClusters[i]->setAxisTitle(title, 1); NumberOfTrkVsClusters[i]->setAxisTitle("Number of Tracks", 2); NumberOfTrkVsClusters[i]->getTH1()->SetCanExtend(TH1::kXaxis); } } - + // Initialize the GenericTriggerEventFlag - if (genTriggerEventFlag_->on()) - genTriggerEventFlag_->initRun(iRun, iSetup); + if ( genTriggerEventFlag_->on() ) genTriggerEventFlag_->initRun( iRun, iSetup ); + } /* @@ -710,448 +729,435 @@ void TrackingMonitor::beginRun(const edm::Run& iRun, const edm::EventSetup& iSet // - BeginLumi // ---------------------------------------------------------------------------------// -void TrackingMonitor::beginLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& eSetup) { +void TrackingMonitor::beginLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& eSetup) { + if (doLumiAnalysis) { - if (NumberOfTracks_lumiFlag) - NumberOfTracks_lumiFlag->Reset(); - theTrackAnalyzer->doReset(); + if ( NumberOfTracks_lumiFlag ) NumberOfTracks_lumiFlag -> Reset(); + theTrackAnalyzer->doReset(); } - if (doAllSeedPlots || doSeedNumberPlot) { - if (doSeedLumiAnalysis_) + if(doAllSeedPlots || doSeedNumberPlot) { + if ( doSeedLumiAnalysis_ ) NumberOfSeeds_lumiFlag->Reset(); } } // -- Analyse // ---------------------------------------------------------------------------------// -void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - // Filter out events if Trigger Filtering is requested - if (genTriggerEventFlag_->on() && !genTriggerEventFlag_->accept(iEvent, iSetup)) - return; - - float lumi = -1.; - edm::Handle lumiScalers; - iEvent.getByToken(lumiscalersToken_, lumiScalers); - if (lumiScalers.isValid() && !lumiScalers->empty()) { - LumiScalersCollection::const_iterator scalit = lumiScalers->begin(); - lumi = scalit->instantLumi(); - } else - lumi = -1.; - - if (doPlotsVsLUMI_ || doAllPlots) - NumberEventsOfVsLUMI->Fill(lumi); - - // Analyse the tracks - // if the collection is empty, do not fill anything - // ---------------------------------------------------------------------------------// - - size_t bx = iEvent.bunchCrossing(); - if (doPlotsVsBX_ || doAllPlots) - NumberEventsOfVsBX->Fill(bx); - - // get the track collection - edm::Handle > trackHandle; - iEvent.getByToken(trackToken_, trackHandle); - - int numberOfTracks_den = 0; - edm::Handle > allTrackHandle; - iEvent.getByToken(allTrackToken_, allTrackHandle); - if (allTrackHandle.isValid()) { - for (edm::View::const_iterator track = allTrackHandle->begin(); track != allTrackHandle->end(); - ++track) { - if (denSelection_(*track)) - numberOfTracks_den++; - } - } - - edm::Handle pvHandle; - iEvent.getByToken(pvSrcToken_, pvHandle); - reco::Vertex const* pv0 = nullptr; - if (pvHandle.isValid()) { - pv0 = &pvHandle->front(); - //--- pv fake (the pv collection should have size==1 and the pv==beam spot) - if (pv0->isFake() || - pv0->tracksSize() == 0 - // definition of goodOfflinePrimaryVertex - || pv0->ndof() < pvNDOF_ || pv0->z() > 24.) - pv0 = nullptr; - } - - if (trackHandle.isValid()) { - int numberOfTracks = trackHandle->size(); - int numberOfTracks_num = 0; - int numberOfTracks_pv0 = 0; - - const edm::View& trackCollection = *trackHandle; - // calculate the mean # rechits and layers - int totalRecHits = 0, totalLayers = 0; - - theTrackAnalyzer->setNumberOfGoodVertices(iEvent); - theTrackAnalyzer->setBX(iEvent); - theTrackAnalyzer->setLumi(iEvent, iSetup); - for (edm::View::const_iterator track = trackCollection.begin(); track != trackCollection.end(); - ++track) { - if (doPlotsVsBX_ || doAllPlots) - NumberOfRecHitsPerTrackVsBX->Fill(bx, track->numberOfValidHits()); - if (numSelection_(*track)) { - numberOfTracks_num++; - if (pv0 && std::abs(track->dz(pv0->position())) < 0.15) - ++numberOfTracks_pv0; - } - - if (doProfilesVsLS_ || doAllPlots) - NumberOfRecHitsPerTrackVsLS->Fill(static_cast(iEvent.id().luminosityBlock()), - track->numberOfValidHits()); +void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) +{ + + // Filter out events if Trigger Filtering is requested + if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( iEvent, iSetup) ) return; + + float lumi = -1.; + edm::Handle lumiScalers; + iEvent.getByToken(lumiscalersToken_, lumiScalers); + if ( lumiScalers.isValid() && !lumiScalers->empty() ) { + LumiScalersCollection::const_iterator scalit = lumiScalers->begin(); + lumi = scalit->instantLumi(); + } else + lumi = -1.; + + if (doPlotsVsLUMI_ || doAllPlots) + NumberEventsOfVsLUMI->Fill(lumi); + + // Analyse the tracks + // if the collection is empty, do not fill anything + // ---------------------------------------------------------------------------------// - if (doPlotsVsLUMI_ || doAllPlots) - NumberOfRecHitsPerTrackVsLUMI->Fill(lumi, track->numberOfValidHits()); + size_t bx = iEvent.bunchCrossing(); + if ( doPlotsVsBX_ || doAllPlots ) + NumberEventsOfVsBX->Fill(bx); - totalRecHits += track->numberOfValidHits(); - totalLayers += track->hitPattern().trackerLayersWithMeasurement(); + // get the track collection + edm::Handle > trackHandle; + iEvent.getByToken(trackToken_, trackHandle); - // do analysis per track - theTrackAnalyzer->analyze(iEvent, iSetup, *track); - } + int numberOfTracks_den = 0; + edm::Handle > allTrackHandle; + iEvent.getByToken(allTrackToken_,allTrackHandle); + if (allTrackHandle.isValid()) { + for ( edm::View::const_iterator track = allTrackHandle->begin(); + track != allTrackHandle->end(); ++track ) { - double frac = -1.; - // if (numberOfAllTracks > 0) frac = static_cast(numberOfTracks)/static_cast(numberOfAllTracks); - if (numberOfTracks_den > 0) - frac = static_cast(numberOfTracks_num) / static_cast(numberOfTracks_den); - - if (doGeneralPropertiesPlots_ || doAllPlots) { - NumberOfTracks->Fill(numberOfTracks); - if (doPlotsVsBX_ || doAllPlots) - NumberOfTracksVsBX->Fill(bx, numberOfTracks); - if (doPlotsVsLUMI_ || doAllPlots) - NumberOfTracksVsLUMI->Fill(lumi, numberOfTracks); - if (doFractionPlot_) { - FractionOfGoodTracks->Fill(frac); - - if (doFractionPlot_) { - if (doPlotsVsBX_ || doAllPlots) - GoodTracksFractionVsBX->Fill(bx, frac); - if (doPlotsVsLUMI_ || doAllPlots) - GoodTracksFractionVsLUMI->Fill(lumi, frac); - } + if ( denSelection_(*track) ) + numberOfTracks_den++; } - if (numberOfTracks > 0) { - double meanRecHits = static_cast(totalRecHits) / static_cast(numberOfTracks); - double meanLayers = static_cast(totalLayers) / static_cast(numberOfTracks); - NumberOfMeanRecHitsPerTrack->Fill(meanRecHits); - NumberOfMeanLayersPerTrack->Fill(meanLayers); - } - } - - if (doProfilesVsLS_ || doAllPlots) { - float nLS = static_cast(iEvent.id().luminosityBlock()); - NumberEventsOfVsLS->Fill(nLS); - NumberOfTracksVsLS->Fill(nLS, numberOfTracks); - if (doFractionPlot_) - GoodTracksFractionVsLS->Fill(nLS, frac); } - - if (doLumiAnalysis) { - NumberOfTracks_lumiFlag->Fill(numberOfTracks); + + edm::Handle< reco::VertexCollection > pvHandle; + iEvent.getByToken(pvSrcToken_, pvHandle ); + reco::Vertex const * pv0 = nullptr; + if (pvHandle.isValid()) { + pv0 = &pvHandle->front(); + //--- pv fake (the pv collection should have size==1 and the pv==beam spot) + if ( pv0->isFake() || pv0->tracksSize()==0 + // definition of goodOfflinePrimaryVertex + || pv0->ndof() < pvNDOF_ || pv0->z() > 24.) pv0 = nullptr; } - // Analyse the Track Building variables - // if the collection is empty, do not fill anything - // ---------------------------------------------------------------------------------// - // fill the TrackCandidate info - if (doTkCandPlots) { - // magnetic field - edm::ESHandle theMF; - iSetup.get().get(theMF); - - // get the candidate collection - edm::Handle theTCHandle; - iEvent.getByToken(trackCandidateToken_, theTCHandle); - const TrackCandidateCollection& theTCCollection = *theTCHandle; - - if (theTCHandle.isValid()) { - // get the beam spot - edm::Handle recoBeamSpotHandle; - iEvent.getByToken(bsSrcToken_, recoBeamSpotHandle); - const reco::BeamSpot& bs = *recoBeamSpotHandle; - - NumberOfTrackCandidates->Fill(theTCCollection.size()); - - // get the seed collection - edm::Handle > seedHandle; - iEvent.getByToken(seedToken_, seedHandle); - const edm::View& seedCollection = *seedHandle; - if (seedHandle.isValid() && !seedCollection.empty()) - FractionCandidatesOverSeeds->Fill(double(theTCCollection.size()) / double(seedCollection.size())); - - iSetup.get().get(builderName, theTTRHBuilder); - for (TrackCandidateCollection::const_iterator cand = theTCCollection.begin(); cand != theTCCollection.end(); - ++cand) { - theTrackBuildingAnalyzer->analyze(iEvent, iSetup, *cand, bs, theMF, theTTRHBuilder); - } - } else { - edm::LogWarning("TrackingMonitor") << "No Track Candidates in the event. Not filling associated histograms"; + if (trackHandle.isValid()) { + + int numberOfTracks = trackHandle->size(); + int numberOfTracks_num = 0; + int numberOfTracks_pv0 = 0; + + const edm::View& trackCollection = *trackHandle; + // calculate the mean # rechits and layers + int totalRecHits = 0, totalLayers = 0; + + theTrackAnalyzer->setNumberOfGoodVertices(iEvent); + theTrackAnalyzer->setBX(iEvent); + theTrackAnalyzer->setLumi(iEvent,iSetup); + for ( edm::View::const_iterator track = trackCollection.begin(); + track != trackCollection.end(); ++track ) { + + if ( doPlotsVsBX_ || doAllPlots ) + NumberOfRecHitsPerTrackVsBX->Fill(bx,track->numberOfValidHits()); + if ( numSelection_(*track) ) { + numberOfTracks_num++; + if (pv0 && std::abs(track->dz(pv0->position()))<0.15) ++numberOfTracks_pv0; + } + + if ( doProfilesVsLS_ || doAllPlots) + NumberOfRecHitsPerTrackVsLS->Fill(static_cast(iEvent.id().luminosityBlock()),track->numberOfValidHits()); + + if (doPlotsVsLUMI_ || doAllPlots) + NumberOfRecHitsPerTrackVsLUMI->Fill(lumi,track->numberOfValidHits()); + + totalRecHits += track->numberOfValidHits(); + totalLayers += track->hitPattern().trackerLayersWithMeasurement(); + + // do analysis per track + theTrackAnalyzer->analyze(iEvent, iSetup, *track); } - if (doMVAPlots) { - // Get MVA and quality mask collections - std::vector mvaCollections; - std::vector qualityMaskCollections; - - edm::Handle > htracks; - iEvent.getByToken(mvaTrackToken_, htracks); - - edm::Handle hmva; - edm::Handle hqual; - for (const auto& tokenTpl : mvaQualityTokens_) { - iEvent.getByToken(std::get<0>(tokenTpl), hmva); - iEvent.getByToken(std::get<1>(tokenTpl), hqual); - - mvaCollections.push_back(hmva.product()); - qualityMaskCollections.push_back(hqual.product()); - } - theTrackBuildingAnalyzer->analyze(*htracks, mvaCollections, qualityMaskCollections); + double frac = -1.; + // if (numberOfAllTracks > 0) frac = static_cast(numberOfTracks)/static_cast(numberOfAllTracks); + if (numberOfTracks_den > 0) frac = static_cast(numberOfTracks_num)/static_cast(numberOfTracks_den); + + if (doGeneralPropertiesPlots_ || doAllPlots){ + NumberOfTracks -> Fill(double(numberOfTracks)); + NumberofTracks_Hardvtx->Fill(double(numberOfTracks_pv0)); + NumberOfTracks_PUvtx->Fill(double(numberOfTracks - numberOfTracks_pv0)); + NumberofTracks_Hardvtx_PUvtx->Fill(0.5,double(numberOfTracks_pv0)); + NumberofTracks_Hardvtx_PUvtx->Fill(1.5,double(numberOfTracks-numberOfTracks_pv0)); + if ( doPlotsVsBX_ || doAllPlots ) + NumberOfTracksVsBX -> Fill(bx,numberOfTracks); + if (doPlotsVsLUMI_ || doAllPlots) + NumberOfTracksVsLUMI -> Fill(lumi,numberOfTracks); + if (doFractionPlot_) { + FractionOfGoodTracks -> Fill(frac); + + if (doFractionPlot_) { + if ( doPlotsVsBX_ || doAllPlots ) + GoodTracksFractionVsBX -> Fill(bx, frac); + if (doPlotsVsLUMI_ || doAllPlots) + GoodTracksFractionVsLUMI -> Fill(lumi,frac); + } + } + if( numberOfTracks > 0 ) { + double meanRecHits = static_cast(totalRecHits) / static_cast(numberOfTracks); + double meanLayers = static_cast(totalLayers) / static_cast(numberOfTracks); + NumberOfMeanRecHitsPerTrack -> Fill(meanRecHits); + NumberOfMeanLayersPerTrack -> Fill(meanLayers); + } } - } - - //plots for trajectory seeds - - if (doAllSeedPlots || doSeedNumberPlot || doSeedVsClusterPlot || runTrackBuildingAnalyzerForSeed) { - // get the seed collection - edm::Handle > seedHandle; - iEvent.getByToken(seedToken_, seedHandle); - - // fill the seed info - if (seedHandle.isValid()) { - const auto& seedCollection = *seedHandle; - - if (doAllSeedPlots || doSeedNumberPlot) { - NumberOfSeeds->Fill(seedCollection.size()); - if (doSeedLumiAnalysis_) - NumberOfSeeds_lumiFlag->Fill(seedCollection.size()); - } - - if (doAllSeedPlots || doSeedVsClusterPlot) { - std::vector NClus; - setNclus(iEvent, NClus); - for (uint i = 0; i < ClusterLabels.size(); i++) { - SeedsVsClusters[i]->Fill(NClus[i], seedCollection.size()); - } - } - - if (doAllSeedPlots || runTrackBuildingAnalyzerForSeed) { - edm::Handle > stopHandle; - iEvent.getByToken(seedStopInfoToken_, stopHandle); - const auto& seedStopInfo = *stopHandle; - - if (seedStopInfo.size() == seedCollection.size()) { - //here duplication of mag field and be informations is needed to allow seed and track cand histos to be independent - // magnetic field - edm::ESHandle theMF; - iSetup.get().get(theMF); - - // get the beam spot - edm::Handle recoBeamSpotHandle; - iEvent.getByToken(bsSrcToken_, recoBeamSpotHandle); - const reco::BeamSpot& bs = *recoBeamSpotHandle; - - iSetup.get().get(builderName, theTTRHBuilder); - for (size_t i = 0; i < seedCollection.size(); ++i) { - theTrackBuildingAnalyzer->analyze( - iEvent, iSetup, seedCollection[i], seedStopInfo[i], bs, theMF, theTTRHBuilder); - } - } else { - edm::LogWarning("TrackingMonitor") - << "Seed collection size (" << seedCollection.size() - << ") differs from seed stop info collection size (" << seedStopInfo.size() - << "). This is a sign of inconsistency in the configuration. Not filling associated histograms."; - } - } - - } else { - edm::LogWarning("TrackingMonitor") << "No Trajectory seeds in the event. Not filling associated histograms"; + + if ( doProfilesVsLS_ || doAllPlots) { + float nLS = static_cast(iEvent.id().luminosityBlock()); + NumberEventsOfVsLS ->Fill(nLS); + NumberOfTracksVsLS ->Fill(nLS,numberOfTracks); + if (doFractionPlot_) + GoodTracksFractionVsLS->Fill(nLS,frac); } - } - - // plots for tracking regions - if (doRegionPlots) { - if (!regionToken_.isUninitialized()) { - edm::Handle > hregions; - iEvent.getByToken(regionToken_, hregions); - const auto& regions = *hregions; - NumberOfTrackingRegions->Fill(regions.size()); - - theTrackBuildingAnalyzer->analyze(regions); - } else if (!regionLayerSetsToken_.isUninitialized()) { - edm::Handle hregions; - iEvent.getByToken(regionLayerSetsToken_, hregions); - const auto& regions = *hregions; - NumberOfTrackingRegions->Fill(regions.regionsSize()); - - theTrackBuildingAnalyzer->analyze(regions); + + if ( doLumiAnalysis ) { + NumberOfTracks_lumiFlag -> Fill(numberOfTracks); } - - if (doRegionCandidatePlots) { - edm::Handle hcandidates; - iEvent.getByToken(regionCandidateToken_, hcandidates); - theTrackBuildingAnalyzer->analyze(*hcandidates); + + + // Analyse the Track Building variables + // if the collection is empty, do not fill anything + // ---------------------------------------------------------------------------------// + + + // fill the TrackCandidate info + if (doTkCandPlots) { + // magnetic field + edm::ESHandle theMF; + iSetup.get().get(theMF); + + // get the candidate collection + edm::Handle theTCHandle; + iEvent.getByToken( trackCandidateToken_, theTCHandle ); + const TrackCandidateCollection& theTCCollection = *theTCHandle; + + if (theTCHandle.isValid()) { + + // get the beam spot + edm::Handle recoBeamSpotHandle; + iEvent.getByToken(bsSrcToken_, recoBeamSpotHandle ); + const reco::BeamSpot& bs = *recoBeamSpotHandle; + + NumberOfTrackCandidates->Fill(theTCCollection.size()); + + // get the seed collection + edm::Handle > seedHandle; + iEvent.getByToken(seedToken_, seedHandle ); + const edm::View& seedCollection = *seedHandle; + if (seedHandle.isValid() && !seedCollection.empty()) + FractionCandidatesOverSeeds->Fill(double(theTCCollection.size())/double(seedCollection.size())); + + iSetup.get().get(builderName,theTTRHBuilder); + for( TrackCandidateCollection::const_iterator cand = theTCCollection.begin(); cand != theTCCollection.end(); ++cand) { + + theTrackBuildingAnalyzer->analyze(iEvent, iSetup, *cand, bs, theMF, theTTRHBuilder); + } + } else { + edm::LogWarning("TrackingMonitor") << "No Track Candidates in the event. Not filling associated histograms"; + } + + if(doMVAPlots) { + // Get MVA and quality mask collections + std::vector mvaCollections; + std::vector qualityMaskCollections; + + edm::Handle > htracks; + iEvent.getByToken(mvaTrackToken_, htracks); + + edm::Handle hmva; + edm::Handle hqual; + for(const auto& tokenTpl: mvaQualityTokens_) { + iEvent.getByToken(std::get<0>(tokenTpl), hmva); + iEvent.getByToken(std::get<1>(tokenTpl), hqual); + + mvaCollections.push_back(hmva.product()); + qualityMaskCollections.push_back(hqual.product()); + } + theTrackBuildingAnalyzer->analyze(*htracks, mvaCollections, qualityMaskCollections); + } } - } - - if (doTrackerSpecific_ || doAllPlots) { - std::vector NClus; - setNclus(iEvent, NClus); - for (uint i = 0; i < ClusterLabels.size(); i++) { - NumberOfTrkVsClusters[i]->Fill(NClus[i], numberOfTracks); + + //plots for trajectory seeds + + if (doAllSeedPlots || doSeedNumberPlot || doSeedVsClusterPlot || runTrackBuildingAnalyzerForSeed) { + + // get the seed collection + edm::Handle > seedHandle; + iEvent.getByToken(seedToken_, seedHandle ); + + // fill the seed info + if (seedHandle.isValid()) { + const auto& seedCollection = *seedHandle; + + if(doAllSeedPlots || doSeedNumberPlot) { + NumberOfSeeds->Fill(seedCollection.size()); + if ( doSeedLumiAnalysis_ ) + NumberOfSeeds_lumiFlag->Fill(seedCollection.size()); + } + + if(doAllSeedPlots || doSeedVsClusterPlot){ + + std::vector NClus; + setNclus(iEvent,NClus); + for (uint i=0; i< ClusterLabels.size(); i++){ + SeedsVsClusters[i]->Fill(NClus[i],seedCollection.size()); + } + } + + if (doAllSeedPlots || runTrackBuildingAnalyzerForSeed){ + edm::Handle > stopHandle; + iEvent.getByToken(seedStopInfoToken_, stopHandle); + const auto& seedStopInfo = *stopHandle; + + if(seedStopInfo.size() == seedCollection.size()) { + //here duplication of mag field and be informations is needed to allow seed and track cand histos to be independent + // magnetic field + edm::ESHandle theMF; + iSetup.get().get(theMF); + + // get the beam spot + edm::Handle recoBeamSpotHandle; + iEvent.getByToken(bsSrcToken_, recoBeamSpotHandle); + const reco::BeamSpot& bs = *recoBeamSpotHandle; + + iSetup.get().get(builderName,theTTRHBuilder); + for(size_t i=0; i < seedCollection.size(); ++i) { + theTrackBuildingAnalyzer->analyze(iEvent, iSetup, seedCollection[i], seedStopInfo[i], bs, theMF, theTTRHBuilder); + } + } + else { + edm::LogWarning("TrackingMonitor") << "Seed collection size (" << seedCollection.size() + << ") differs from seed stop info collection size (" << seedStopInfo.size() + << "). This is a sign of inconsistency in the configuration. Not filling associated histograms."; + } + } + + } else { + edm::LogWarning("TrackingMonitor") << "No Trajectory seeds in the event. Not filling associated histograms"; + } } - } - - if (doPUmonitoring_) { - // do vertex monitoring - for (size_t i = 0; i < theVertexMonitor.size(); i++) - theVertexMonitor[i]->analyze(iEvent, iSetup); - } - if (doPlotsVsGoodPVtx_) { - size_t totalNumGoodPV = 0; - if (pvHandle.isValid()) { - for (reco::VertexCollection::const_iterator pv = pvHandle->begin(); pv != pvHandle->end(); ++pv) { - //--- pv fake (the pv collection should have size==1 and the pv==beam spot) - if (pv->isFake() || pv->tracksSize() == 0) - continue; - - // definition of goodOfflinePrimaryVertex - if (pv->ndof() < pvNDOF_ || pv->z() > 24.) - continue; - totalNumGoodPV++; - } + - NumberEventsOfVsGoodPVtx->Fill(float(totalNumGoodPV)); - NumberOfTracksVsGoodPVtx->Fill(float(totalNumGoodPV), numberOfTracks); - if (totalNumGoodPV > 1) - NumberOfTracksVsPUPVtx->Fill(totalNumGoodPV - 1, - double(numberOfTracks - numberOfTracks_pv0) / double(totalNumGoodPV - 1)); - NumberOfPVtxVsGoodPVtx->Fill(float(totalNumGoodPV), pvHandle->size()); + // plots for tracking regions + if (doRegionPlots) { + if(!regionToken_.isUninitialized()) { + edm::Handle > hregions; + iEvent.getByToken(regionToken_, hregions); + const auto& regions = *hregions; + NumberOfTrackingRegions->Fill(regions.size()); - for (edm::View::const_iterator track = trackCollection.begin(); track != trackCollection.end(); - ++track) { - NumberOfRecHitsPerTrackVsGoodPVtx->Fill(float(totalNumGoodPV), track->numberOfValidHits()); + theTrackBuildingAnalyzer->analyze(regions); } + else if(!regionLayerSetsToken_.isUninitialized()) { + edm::Handle hregions; + iEvent.getByToken(regionLayerSetsToken_, hregions); + const auto& regions = *hregions; + NumberOfTrackingRegions->Fill(regions.regionsSize()); - if (doProfilesVsLS_ || doAllPlots) - NumberOfGoodPVtxVsLS->Fill(static_cast(iEvent.id().luminosityBlock()), totalNumGoodPV); - if (doPlotsVsBX_ || doAllPlots) - NumberOfGoodPVtxVsBX->Fill(bx, float(totalNumGoodPV)); - - if (doFractionPlot_) - GoodTracksFractionVsGoodPVtx->Fill(float(totalNumGoodPV), frac); - - if (doPlotsVsLUMI_ || doAllPlots) - NumberOfGoodPVtxVsLUMI->Fill(lumi, float(totalNumGoodPV)); - } + theTrackBuildingAnalyzer->analyze(regions); + } - std::vector NClus; - setNclus(iEvent, NClus); - std::ostringstream ss; - ss << "VI stat " << totalNumGoodPV << ' ' << numberOfTracks; - for (uint i = 0; i < ClusterLabels.size(); i++) { - ss << ' ' << NClus[i]; - if (doPlotsVsLUMI_ || doAllPlots) { - if (ClusterLabels[i] == "Pix") - NumberOfPixelClustersVsLUMI->Fill(lumi, NClus[i]); - if (ClusterLabels[i] == "Strip") - NumberOfStripClustersVsLUMI->Fill(lumi, NClus[i]); + if (doRegionCandidatePlots) { + edm::Handle hcandidates; + iEvent.getByToken(regionCandidateToken_, hcandidates); + theTrackBuildingAnalyzer->analyze(*hcandidates); } - if (ClusterLabels[i] == "Pix") - NumberOfPixelClustersVsGoodPVtx->Fill(float(totalNumGoodPV), NClus[i]); - if (ClusterLabels[i] == "Strip") - NumberOfStripClustersVsGoodPVtx->Fill(float(totalNumGoodPV), NClus[i]); } - COUT(MEFolderName) << ss.str() << std::endl; - if (doPlotsVsBXlumi_) { - double bxlumi = theLumiDetails_->getValue(iEvent); - NumberOfTracksVsBXlumi->Fill(bxlumi, numberOfTracks); + + if (doTrackerSpecific_ || doAllPlots) { + + std::vector NClus; + setNclus(iEvent,NClus); + for (uint i=0; i< ClusterLabels.size(); i++) { + NumberOfTrkVsClusters[i]->Fill(NClus[i],numberOfTracks); + } } + + if ( doPUmonitoring_ ) { + + // do vertex monitoring + for (size_t i=0; ianalyze(iEvent, iSetup); + } + if ( doPlotsVsGoodPVtx_ ) { + + size_t totalNumGoodPV = 0; + if (pvHandle.isValid()) { + + for (reco::VertexCollection::const_iterator pv = pvHandle->begin(); + pv != pvHandle->end(); ++pv) { + + //--- pv fake (the pv collection should have size==1 and the pv==beam spot) + if (pv->isFake() || pv->tracksSize()==0) continue; + + // definition of goodOfflinePrimaryVertex + if (pv->ndof() < pvNDOF_ || pv->z() > 24.) continue; + totalNumGoodPV++; + } + + NumberEventsOfVsGoodPVtx -> Fill( float(totalNumGoodPV) ); + NumberOfTracksVsGoodPVtx -> Fill( float(totalNumGoodPV), numberOfTracks ); + if (totalNumGoodPV>1) NumberOfTracksVsPUPVtx-> Fill( totalNumGoodPV-1, double(numberOfTracks-numberOfTracks_pv0)/double(totalNumGoodPV-1) ); + NumberOfPVtxVsGoodPVtx -> Fill(float(totalNumGoodPV),pvHandle->size()); + + for ( edm::View::const_iterator track = trackCollection.begin(); + track != trackCollection.end(); ++track ) { + + NumberOfRecHitsPerTrackVsGoodPVtx -> Fill(float(totalNumGoodPV), track->numberOfValidHits()); + } + + if ( doProfilesVsLS_ || doAllPlots) + NumberOfGoodPVtxVsLS->Fill(static_cast(iEvent.id().luminosityBlock()),totalNumGoodPV); + if ( doPlotsVsBX_ || doAllPlots ) + NumberOfGoodPVtxVsBX->Fill(bx, float(totalNumGoodPV)); + + if (doFractionPlot_) + GoodTracksFractionVsGoodPVtx->Fill(float(totalNumGoodPV),frac); + + if ( doPlotsVsLUMI_ || doAllPlots ) + NumberOfGoodPVtxVsLUMI->Fill(lumi,float(totalNumGoodPV)); + } + + std::vector NClus; + setNclus(iEvent,NClus); + std::ostringstream ss; + ss << "VI stat " << totalNumGoodPV << ' ' << numberOfTracks; + for (uint i=0; i< ClusterLabels.size(); i++){ + ss << ' ' << NClus[i]; + if ( doPlotsVsLUMI_ || doAllPlots ) { + if (ClusterLabels[i] =="Pix") NumberOfPixelClustersVsLUMI->Fill(lumi,NClus[i]); + if (ClusterLabels[i]=="Strip") NumberOfStripClustersVsLUMI->Fill(lumi,NClus[i]); + } + if (ClusterLabels[i] =="Pix") NumberOfPixelClustersVsGoodPVtx->Fill(float(totalNumGoodPV),NClus[i]); + if (ClusterLabels[i]=="Strip") NumberOfStripClustersVsGoodPVtx->Fill(float(totalNumGoodPV),NClus[i]); + } + COUT(MEFolderName) << ss.str() << std::endl; + if ( doPlotsVsBXlumi_ ) { + double bxlumi = theLumiDetails_->getValue(iEvent); + NumberOfTracksVsBXlumi -> Fill( bxlumi, numberOfTracks ); + } + + if ( doProfilesVsLS_ || doAllPlots ) if ( totalNumGoodPV != 0 ) NumberOfGoodPVtxWO0VsLS -> Fill(static_cast(iEvent.id().luminosityBlock()),float(totalNumGoodPV)); + if ( doPlotsVsBX_ || doAllPlots ) if ( totalNumGoodPV != 0 ) NumberOfGoodPVtxWO0VsBX -> Fill(bx, float(totalNumGoodPV)); + if ( doPlotsVsLUMI_ || doAllPlots ) if ( totalNumGoodPV != 0 ) NumberOfGoodPVtxWO0VsLUMI-> Fill(lumi,float(totalNumGoodPV)); + + } // PU monitoring + + } // trackHandle is valid + +} - if (doProfilesVsLS_ || doAllPlots) - if (totalNumGoodPV != 0) - NumberOfGoodPVtxWO0VsLS->Fill(static_cast(iEvent.id().luminosityBlock()), float(totalNumGoodPV)); - if (doPlotsVsBX_ || doAllPlots) - if (totalNumGoodPV != 0) - NumberOfGoodPVtxWO0VsBX->Fill(bx, float(totalNumGoodPV)); - if (doPlotsVsLUMI_ || doAllPlots) - if (totalNumGoodPV != 0) - NumberOfGoodPVtxWO0VsLUMI->Fill(lumi, float(totalNumGoodPV)); - - } // PU monitoring - } // trackHandle is valid +void TrackingMonitor::endRun(const edm::Run&, const edm::EventSetup&) +{ } -void TrackingMonitor::endRun(const edm::Run&, const edm::EventSetup&) {} - -void TrackingMonitor::setMaxMinBin(std::vector& arrayMin, - std::vector& arrayMax, - std::vector& arrayBin, - double smin, - double smax, - int sbin, - double pmin, - double pmax, - int pbin) { +void TrackingMonitor::setMaxMinBin(std::vector &arrayMin, std::vector &arrayMax, std::vector &arrayBin, double smin, double smax, int sbin, double pmin, double pmax, int pbin) +{ arrayMin.resize(ClusterLabels.size()); arrayMax.resize(ClusterLabels.size()); arrayBin.resize(ClusterLabels.size()); - for (uint i = 0; i < ClusterLabels.size(); ++i) { - if (ClusterLabels[i] == "Pix") { - arrayMin[i] = pmin; - arrayMax[i] = pmax; - arrayBin[i] = pbin; - } else if (ClusterLabels[i] == "Strip") { - arrayMin[i] = smin; - arrayMax[i] = smax; - arrayBin[i] = sbin; - } else if (ClusterLabels[i] == "Tot") { - arrayMin[i] = smin; - arrayMax[i] = smax + pmax; - arrayBin[i] = sbin; - } else { - edm::LogWarning("TrackingMonitor") << "Cluster Label " << ClusterLabels[i] - << " not defined, using strip parameters "; - arrayMin[i] = smin; - arrayMax[i] = smax; - arrayBin[i] = sbin; - } + for (uint i=0; i& arrayNclus) { - int ncluster_pix = -1; - int ncluster_strip = -1; +void TrackingMonitor::setNclus(const edm::Event& iEvent,std::vector &arrayNclus) +{ - edm::Handle > strip_clusters; - iEvent.getByToken(stripClustersToken_, strip_clusters); - edm::Handle > pixel_clusters; - iEvent.getByToken(pixelClustersToken_, pixel_clusters); + int ncluster_pix=-1; + int ncluster_strip=-1; + + edm::Handle< edmNew::DetSetVector > strip_clusters; + iEvent.getByToken(stripClustersToken_, strip_clusters ); + edm::Handle< edmNew::DetSetVector > pixel_clusters; + iEvent.getByToken(pixelClustersToken_, pixel_clusters ); if (strip_clusters.isValid() && pixel_clusters.isValid()) { - ncluster_pix = (*pixel_clusters).dataSize(); - ncluster_strip = (*strip_clusters).dataSize(); + ncluster_pix = (*pixel_clusters).dataSize(); + ncluster_strip = (*strip_clusters).dataSize(); } arrayNclus.resize(ClusterLabels.size()); - for (uint i = 0; i < ClusterLabels.size(); ++i) { - if (ClusterLabels[i] == "Pix") - arrayNclus[i] = ncluster_pix; - else if (ClusterLabels[i] == "Strip") - arrayNclus[i] = ncluster_strip; - else if (ClusterLabels[i] == "Tot") - arrayNclus[i] = ncluster_pix + ncluster_strip; - else { - edm::LogWarning("TrackingMonitor") << "Cluster Label " << ClusterLabels[i] - << " not defined using stri parametrs "; - arrayNclus[i] = ncluster_strip; - } + for (uint i=0; i Date: Mon, 24 Jun 2019 14:47:16 +0200 Subject: [PATCH 2/5] New plots in Tracking Workspace --- DQM/TrackingMonitor/interface/TrackAnalyzer.h | 937 ++-- .../interface/TrackingMonitor.h | 346 +- DQM/TrackingMonitor/src/TrackAnalyzer.cc | 3937 +++++++++-------- DQM/TrackingMonitor/src/TrackingMonitor.cc | 1965 ++++---- 4 files changed, 3643 insertions(+), 3542 deletions(-) diff --git a/DQM/TrackingMonitor/interface/TrackAnalyzer.h b/DQM/TrackingMonitor/interface/TrackAnalyzer.h index f03898d1e938b..52169b3329aa6 100644 --- a/DQM/TrackingMonitor/interface/TrackAnalyzer.h +++ b/DQM/TrackingMonitor/interface/TrackAnalyzer.h @@ -1,6 +1,6 @@ #ifndef TrackAnalyzer_H #define TrackAnalyzer_H -// +// /**\class TrackingAnalyzer TrackingAnalyzer.cc Monitoring source for general quantities related to tracks. */ @@ -31,471 +31,472 @@ Monitoring source for general quantities related to tracks. class BeamSpot; namespace dqm { -class TrackAnalyzer -{ - public: - TrackAnalyzer(const edm::ParameterSet&); - TrackAnalyzer(const edm::ParameterSet&, edm::ConsumesCollector& iC); - ~TrackAnalyzer(); - void initHisto(DQMStore::IBooker & ibooker, const edm::EventSetup &, const edm::ParameterSet&); - - void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track); - - void doSoftReset (DQMStore * dqmStore_); - 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 &); - void setBX(const edm::Event &); - void setLumi(const edm::Event &, const edm::EventSetup& iSetup); - - private: - void initHistos(); - void fillHistosForState(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname); - void bookHistosForState(std::string sname,DQMStore::IBooker & ibooker); - void bookHistosForHitProperties(DQMStore::IBooker & ibooker); - void bookHistosForLScertification(DQMStore::IBooker & ibooker); - void bookHistosForBeamSpot(DQMStore::IBooker & ibooker); - void bookHistosForTrackerSpecific(DQMStore::IBooker & ibooker); - void bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, const edm::EventSetup & iSetup, const std::string suffix, bool useInac); - 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); - void fillHistosForEfficiencyFromHitPatter(const reco::Track & track, const std::string suffix, const float monitoring,bool useInac); - - // ----------member data --------------------------- - std::string TopFolder_; - - edm::EDGetTokenT beamSpotToken_; - edm::EDGetTokenT pvToken_; - edm::EDGetTokenT > pixelClustersToken_; - edm::EDGetTokenT lumiscalersToken_; - float lumi_factor_per_bx_; - - edm::ParameterSet const* conf_; - - std::string stateName_; - - bool doTrackerSpecific_; - bool doAllPlots_; - bool doBSPlots_; - bool doPVPlots_; - bool doDCAPlots_; - bool doGeneralPropertiesPlots_; - bool doMeasurementStatePlots_; - bool doHitPropertiesPlots_; - bool doRecHitVsPhiVsEtaPerTrack_; - bool doRecHitVsPtVsEtaPerTrack_; - // ADD by Mia - bool doLayersVsPhiVsEtaPerTrack_; - bool doTrackRecHitVsPhiVsEtaPerTrack_; - bool doTrackRecHitVsPtVsEtaPerTrack_; - bool doTrackLayersVsPhiVsEtaPerTrack_; - bool doTrack2DChi2Plots_; - bool doRecHitsPerTrackProfile_; - // ADD by Mia in order to clean the tracking MEs - // do not plot *Theta* and TrackPx* and TrackPy* - bool doThetaPlots_; - bool doTrackPxPyPlots_; - // ADD by Mia in order to not plot DistanceOfClosestApproach w.r.t. (0,0,0) - // the DistanceOfClosestApproach w.r.t. the beam-spot is already shown in DistanceOfClosestApproachToBS - bool doDCAwrtPVPlots_; - bool doDCAwrt000Plots_; - - bool doLumiAnalysis_; - - // ADD by Mia in order to turnON test MEs - bool doTestPlots_; - - //For HI Plots - bool doHIPlots_; - - // IP significance plots - bool doSIPPlots_; - - // Compute the hit-finding efficiency using the HitPattern of - // the reconstructed tracks - bool doEffFromHitPatternVsPU_; - bool doEffFromHitPatternVsBX_; - bool doEffFromHitPatternVsLUMI_; - int pvNDOF_; - bool useBPixLayer1_; - int minNumberOfPixelsPerCluster_; - float minPixelClusterCharge_; - std::string qualityString_; - - struct TkParameterMEs { - TkParameterMEs() : - TrackP(nullptr) - , TrackPx(nullptr) - , TrackPy(nullptr) - , TrackPz(nullptr) - , TrackPt(nullptr) - - , TrackPxErr(nullptr) - , TrackPyErr(nullptr) - , TrackPzErr(nullptr) - , TrackPtErr(nullptr) - , TrackPErr(nullptr) - - , TrackPtErrVsEta(nullptr) - - , TrackQ(nullptr) - - , TrackPhi(nullptr) - , TrackEta(nullptr) - , TrackTheta(nullptr) - - , TrackPhiErr(nullptr) - , TrackEtaErr(nullptr) - , TrackThetaErr(nullptr) - - , NumberOfRecHitsPerTrackVsPhi(nullptr) - , NumberOfRecHitsPerTrackVsTheta(nullptr) - , NumberOfRecHitsPerTrackVsEta(nullptr) - , NumberOfRecHitVsPhiVsEtaPerTrack(nullptr) - - , NumberOfValidRecHitsPerTrackVsPhi(nullptr) - , NumberOfValidRecHitsPerTrackVsTheta(nullptr) - , NumberOfValidRecHitsPerTrackVsEta(nullptr) - , NumberOfValidRecHitsPerTrackVsPt(nullptr) - , NumberOfValidRecHitVsPhiVsEtaPerTrack(nullptr) - , NumberOfValidRecHitVsPtVsEtaPerTrack(nullptr) - - , NumberOfLostRecHitsPerTrackVsPhi(nullptr) - , NumberOfLostRecHitsPerTrackVsTheta(nullptr) - , NumberOfLostRecHitsPerTrackVsEta(nullptr) - , NumberOfLostRecHitsPerTrackVsPt(nullptr) - , NumberOfLostRecHitVsPhiVsEtaPerTrack(nullptr) - , NumberOfLostRecHitVsPtVsEtaPerTrack(nullptr) - - , NumberOfMIRecHitsPerTrackVsPhi(nullptr) - , NumberOfMIRecHitsPerTrackVsTheta(nullptr) - , NumberOfMIRecHitsPerTrackVsEta(nullptr) - , NumberOfMIRecHitsPerTrackVsPt(nullptr) - , NumberOfMIRecHitVsPhiVsEtaPerTrack(nullptr) - , NumberOfMIRecHitVsPtVsEtaPerTrack(nullptr) - - , NumberOfMORecHitsPerTrackVsPhi(nullptr) - , NumberOfMORecHitsPerTrackVsTheta(nullptr) - , NumberOfMORecHitsPerTrackVsEta(nullptr) - , NumberOfMORecHitsPerTrackVsPt(nullptr) - , NumberOfMORecHitVsPhiVsEtaPerTrack(nullptr) - , NumberOfMORecHitVsPtVsEtaPerTrack(nullptr) - - , NumberOfLayersPerTrackVsPhi(nullptr) - , NumberOfLayersPerTrackVsTheta(nullptr) - , NumberOfLayersPerTrackVsEta(nullptr) - - , Chi2oNDFVsNHits(nullptr) - , Chi2oNDFVsPt(nullptr) - , Chi2oNDFVsEta(nullptr) - , Chi2oNDFVsPhi(nullptr) - , Chi2oNDFVsTheta(nullptr) - - , Chi2ProbVsEta(nullptr) - , Chi2ProbVsPhi(nullptr) - , Chi2ProbVsTheta(nullptr) - {} - - MonitorElement* TrackP; - MonitorElement* TrackPx; - MonitorElement* TrackPy; - MonitorElement* TrackPz; - MonitorElement* TrackPt; - MonitorElement* TrackPtZone1; - MonitorElement* TrackPtZone2; - MonitorElement* TrackPtZone3; - MonitorElement* TrackPtZone4; - MonitorElement* TrackPtZone5; - MonitorElement* TrackPtZone6; - MonitorElement* TrackPtZone7; - MonitorElement* TrackPtZone8; - MonitorElement* Ratio_byFolding; - MonitorElement* Ratio_byFolding2; - MonitorElement* TrackPtHighPurity; - MonitorElement* TrackPtTight; - MonitorElement* TrackPtLoose; - MonitorElement* Quality; - - - MonitorElement* TrackPxErr; - MonitorElement* TrackPyErr; - MonitorElement* TrackPzErr; - MonitorElement* TrackPtErr; - MonitorElement* TrackPErr; - - MonitorElement* TrackPtErrVsEta; - - MonitorElement* TrackQ; - MonitorElement* TrackQoverP; - - - MonitorElement* TrackPhi; - MonitorElement* TrackEta; - MonitorElement* TrackEtaHighPurity; - MonitorElement* TrackEtaTight; - MonitorElement* TrackEtaLoose; - MonitorElement* TrackEtaPhi=nullptr; - MonitorElement* TrackEtaPhiInverted=nullptr; - MonitorElement* TrackEtaPhiInvertedoutofphase=nullptr; - MonitorElement* TkEtaPhi_Ratio_byFoldingmap=nullptr; - MonitorElement* TkEtaPhi_Ratio_byFoldingmap_op=nullptr; - MonitorElement* TkEtaPhi_RelativeDifference_byFoldingmap=nullptr; - MonitorElement* TkEtaPhi_RelativeDifference_byFoldingmap_op=nullptr; - MonitorElement* TrackEtaPhiInner=nullptr; - MonitorElement* TrackEtaPhiOuter=nullptr; - - MonitorElement* TrackTheta; - - MonitorElement* TrackPhiErr; - MonitorElement* TrackEtaErr; - MonitorElement* TrackThetaErr; - - MonitorElement* NumberOfRecHitsPerTrackVsPhi; - MonitorElement* NumberOfRecHitsPerTrackVsTheta; - MonitorElement* NumberOfRecHitsPerTrackVsEta; - MonitorElement* NumberOfRecHitVsPhiVsEtaPerTrack; - - MonitorElement* NumberOfValidRecHitsPerTrackVsPhi; - MonitorElement* NumberOfValidRecHitsPerTrackVsTheta; - MonitorElement* NumberOfValidRecHitsPerTrackVsEta; - MonitorElement* NumberOfValidRecHitsPerTrackVsPt; - MonitorElement* NumberOfValidRecHitVsPhiVsEtaPerTrack; - MonitorElement* NumberOfValidRecHitVsPtVsEtaPerTrack; - - MonitorElement* NumberOfLostRecHitsPerTrackVsPhi; - MonitorElement* NumberOfLostRecHitsPerTrackVsTheta; - MonitorElement* NumberOfLostRecHitsPerTrackVsEta; - MonitorElement* NumberOfLostRecHitsPerTrackVsPt; - MonitorElement* NumberOfLostRecHitVsPhiVsEtaPerTrack; - MonitorElement* NumberOfLostRecHitVsPtVsEtaPerTrack; - - MonitorElement* NumberOfMIRecHitsPerTrackVsPhi; - MonitorElement* NumberOfMIRecHitsPerTrackVsTheta; - MonitorElement* NumberOfMIRecHitsPerTrackVsEta; - MonitorElement* NumberOfMIRecHitsPerTrackVsPt; - MonitorElement* NumberOfMIRecHitVsPhiVsEtaPerTrack; - MonitorElement* NumberOfMIRecHitVsPtVsEtaPerTrack; - - MonitorElement* NumberOfMORecHitsPerTrackVsPhi; - MonitorElement* NumberOfMORecHitsPerTrackVsTheta; - MonitorElement* NumberOfMORecHitsPerTrackVsEta; - MonitorElement* NumberOfMORecHitsPerTrackVsPt; - MonitorElement* NumberOfMORecHitVsPhiVsEtaPerTrack; - MonitorElement* NumberOfMORecHitVsPtVsEtaPerTrack; - - MonitorElement* NumberOfLayersPerTrackVsPhi; - MonitorElement* NumberOfLayersPerTrackVsTheta; - MonitorElement* NumberOfLayersPerTrackVsEta; - - MonitorElement* Chi2oNDFVsNHits; - MonitorElement* Chi2oNDFVsPt; - MonitorElement* Chi2oNDFVsEta; - MonitorElement* Chi2oNDFVsPhi; - MonitorElement* Chi2oNDFVsTheta; - - MonitorElement* Chi2ProbVsEta; - MonitorElement* Chi2ProbVsPhi; - MonitorElement* Chi2ProbVsTheta; - - }; - std::map TkParameterMEMap; - - - MonitorElement* NumberOfRecHitsPerTrack; - MonitorElement* NumberOfValidRecHitsPerTrack; - MonitorElement* NumberOfLostRecHitsPerTrack; - MonitorElement* NumberOfMIRecHitsPerTrack = nullptr; - MonitorElement* NumberOfMORecHitsPerTrack = nullptr; - - - MonitorElement* NumberOfRecHitsPerTrackVsPhi = nullptr; - MonitorElement* NumberOfRecHitsPerTrackVsTheta = nullptr; - MonitorElement* NumberOfRecHitsPerTrackVsEta = nullptr; - MonitorElement* NumberOfRecHitVsPhiVsEtaPerTrack = nullptr; - - MonitorElement* NumberOfValidRecHitsPerTrackVsPhi = nullptr; - MonitorElement* NumberOfValidRecHitsPerTrackVsTheta = nullptr; - MonitorElement* NumberOfValidRecHitsPerTrackVsEta = nullptr; - MonitorElement* NumberOfValidRecHitsPerTrackVsPt = nullptr; - MonitorElement* NumberOfValidRecHitVsPhiVsEtaPerTrack = nullptr; - MonitorElement* NumberOfValidRecHitVsPtVsEtaPerTrack = nullptr; - - MonitorElement* NumberOfLostRecHitsPerTrackVsPhi = nullptr; - MonitorElement* NumberOfLostRecHitsPerTrackVsTheta = nullptr; - MonitorElement* NumberOfLostRecHitsPerTrackVsEta = nullptr; - MonitorElement* NumberOfLostRecHitsPerTrackVsPt = nullptr; - MonitorElement* NumberOfLostRecHitVsPhiVsEtaPerTrack = nullptr; - MonitorElement* NumberOfLostRecHitVsPtVsEtaPerTrack = nullptr; - - MonitorElement* NumberOfMIRecHitsPerTrackVsPhi = nullptr; - MonitorElement* NumberOfMIRecHitsPerTrackVsTheta = nullptr; - MonitorElement* NumberOfMIRecHitsPerTrackVsEta = nullptr; - MonitorElement* NumberOfMIRecHitsPerTrackVsPt = nullptr; - MonitorElement* NumberOfMIRecHitVsPhiVsEtaPerTrack = nullptr; - MonitorElement* NumberOfMIRecHitVsPtVsEtaPerTrack = nullptr; - - MonitorElement* NumberOfMORecHitsPerTrackVsPhi = nullptr; - MonitorElement* NumberOfMORecHitsPerTrackVsTheta = nullptr; - MonitorElement* NumberOfMORecHitsPerTrackVsEta = nullptr; - MonitorElement* NumberOfMORecHitsPerTrackVsPt = nullptr; - MonitorElement* NumberOfMORecHitVsPhiVsEtaPerTrack = nullptr; - MonitorElement* NumberOfMORecHitVsPtVsEtaPerTrack = nullptr; - - MonitorElement* ValidFractionPerTrack = nullptr; - MonitorElement* ValidFractionVsPhiVsEtaPerTrack = nullptr; - - - MonitorElement* NumberOfLayersPerTrack[4] = {nullptr,nullptr,nullptr,nullptr}; - - MonitorElement* NumberOfLayersPerTrackVsPhi; - MonitorElement* NumberOfLayersPerTrackVsTheta; - MonitorElement* NumberOfLayersPerTrackVsEta; - - MonitorElement* NumberOfLayersVsPhiVsEtaPerTrack[5]= {nullptr,nullptr,nullptr,nullptr,nullptr}; - - - MonitorElement* Chi2; - MonitorElement* Chi2Prob; - MonitorElement* Chi2oNDF; - - MonitorElement* Chi2oNDFVsNHits = nullptr; - MonitorElement* Chi2oNDFVsPt = nullptr; - MonitorElement* Chi2oNDFVsEta = nullptr; - MonitorElement* Chi2oNDFVsPhi; - MonitorElement* Chi2oNDFVsTheta; - - MonitorElement* Chi2ProbVsEta; - MonitorElement* Chi2ProbVsPhi; - MonitorElement* Chi2ProbVsTheta; - - MonitorElement* DistanceOfClosestApproach; - MonitorElement* DistanceOfClosestApproachError; - MonitorElement* DistanceOfClosestApproachErrorVsPt; - MonitorElement* DistanceOfClosestApproachErrorVsEta; - MonitorElement* DistanceOfClosestApproachErrorVsPhi; - MonitorElement* DistanceOfClosestApproachErrorVsDxy; - MonitorElement* DistanceOfClosestApproachToBS; - MonitorElement* DistanceOfClosestApproachToBSdz; - MonitorElement* AbsDistanceOfClosestApproachToBS; - MonitorElement* DistanceOfClosestApproachToPV; - MonitorElement* DistanceOfClosestApproachToPVZoom; - MonitorElement* DeltaZToPV; - MonitorElement* DeltaZToPVZoom; - MonitorElement* DistanceOfClosestApproachVsTheta; - MonitorElement* DistanceOfClosestApproachVsPhi; - MonitorElement* DistanceOfClosestApproachToBSVsPhi; - MonitorElement* DistanceOfClosestApproachToBSVsEta; - MonitorElement* DistanceOfClosestApproachToPVVsPhi; - MonitorElement* DistanceOfClosestApproachVsEta; - MonitorElement* xPointOfClosestApproach; - MonitorElement* xPointOfClosestApproachToPV; - MonitorElement* xPointOfClosestApproachVsZ0wrt000; - MonitorElement* xPointOfClosestApproachVsZ0wrtBS; - MonitorElement* xPointOfClosestApproachVsZ0wrtPV; - MonitorElement* yPointOfClosestApproach; - MonitorElement* yPointOfClosestApproachToPV; - MonitorElement* yPointOfClosestApproachVsZ0wrt000; - MonitorElement* yPointOfClosestApproachVsZ0wrtBS; - MonitorElement* yPointOfClosestApproachVsZ0wrtPV; - MonitorElement* zPointOfClosestApproach; - MonitorElement* zPointOfClosestApproachToPV; - MonitorElement* zPointOfClosestApproachVsPhi; - MonitorElement *algorithm, *oriAlgo; - MonitorElement *stoppingSource; - MonitorElement *stoppingSourceVSeta; - MonitorElement *stoppingSourceVSphi; - // TESTING MEs - MonitorElement* TESTDistanceOfClosestApproachToBS; - MonitorElement* TESTDistanceOfClosestApproachToBSVsPhi; - - // add by Mia in order to deal w/ LS transitions - MonitorElement* Chi2oNDF_lumiFlag; - MonitorElement* NumberOfRecHitsPerTrack_lumiFlag; - - //new plots for Heavy Ion DQM - MonitorElement* LongDCASig; - MonitorElement* TransDCASig; - MonitorElement* dNdPhi_HighPurity; - MonitorElement* dNdEta_HighPurity; - MonitorElement* dNdPt_HighPurity; - MonitorElement* NhitVsEta_HighPurity; - MonitorElement* NhitVsPhi_HighPurity; - MonitorElement* Ptdist_HighPurity; - MonitorElement* dNhitdPt_HighPurity; - - // IP significance plots - MonitorElement *sipDxyToBS; - MonitorElement *sipDzToBS; - MonitorElement *sip3dToPV; - MonitorElement *sip2dToPV; - MonitorElement *sipDxyToPV; - MonitorElement *sipDzToPV; - - struct TkRecHitsPerSubDetMEs { - MonitorElement* NumberOfRecHitsPerTrack; - MonitorElement* NumberOfRecHitsPerTrackVsPhi; - MonitorElement* NumberOfRecHitsPerTrackVsEta; - MonitorElement* NumberOfRecHitsPerTrackVsPt; - MonitorElement* NumberOfLayersPerTrack; - MonitorElement* NumberOfLayersPerTrackVsPhi; - MonitorElement* NumberOfLayersPerTrackVsEta; - MonitorElement* NumberOfLayersPerTrackVsPt; - MonitorElement* RecHitChi2PerTrack; - - int detectorId; - std::string detectorTag; - }; - std::map TkRecHitsPerSubDetMEMap; - - struct Key { - int det; - int subdet; - int monitoring; - explicit Key(int det, int subdet,int monitoring):det(det),subdet(subdet),monitoring(monitoring){}; - bool operator==(const Key & other) const { - return (det == other.det && subdet == other.subdet && monitoring == other.monitoring); - } - }; - - struct KeyHasher { - std::size_t operator()(const Key& k) const { - // 3 bits (0x7) for kind of monitoring (7 kinds at most) - // next 8 bits to the subdetector (255 subdetectors at most) - // next 8 bits to the detector (255 detectors at most) - return (size_t)( - (k.monitoring & (0x7)) | - ((k.subdet & (0xff)) << 3) | - ((k.det & (0xff)) << 11)); - } - }; - - 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_; - unsigned int bx_; - float pixel_lumi_; - float scal_lumi_; - enum monQuantity { - VsPU, - VsBX, - VsPIXELLUMI, - VsSCALLUMI, - END - }; - std::string monName[monQuantity::END] = { "", "VsBX", "VsPIXELLUMI", "VsSCALLUMI" }; - - std::string histname; //for naming the histograms according to algorithm used -}; -} + class TrackAnalyzer { + public: + TrackAnalyzer(const edm::ParameterSet&); + TrackAnalyzer(const edm::ParameterSet&, edm::ConsumesCollector& iC); + ~TrackAnalyzer(); + void initHisto(DQMStore::IBooker& ibooker, const edm::EventSetup&, const edm::ParameterSet&); + + void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track); + + void doSoftReset(DQMStore* dqmStore_); + 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&); + void setBX(const edm::Event&); + void setLumi(const edm::Event&, const edm::EventSetup& iSetup); + + private: + void initHistos(); + void fillHistosForState(const edm::EventSetup& iSetup, const reco::Track& track, std::string sname); + void bookHistosForState(std::string sname, DQMStore::IBooker& ibooker); + void bookHistosForHitProperties(DQMStore::IBooker& ibooker); + void bookHistosForLScertification(DQMStore::IBooker& ibooker); + void bookHistosForBeamSpot(DQMStore::IBooker& ibooker); + void bookHistosForTrackerSpecific(DQMStore::IBooker& ibooker); + void bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker& ibooker, + const edm::EventSetup& iSetup, + const std::string suffix, + bool useInac); + 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); + void fillHistosForEfficiencyFromHitPatter(const reco::Track& track, + const std::string suffix, + const float monitoring, + bool useInac); + + // ----------member data --------------------------- + std::string TopFolder_; + + edm::EDGetTokenT beamSpotToken_; + edm::EDGetTokenT pvToken_; + edm::EDGetTokenT > pixelClustersToken_; + edm::EDGetTokenT lumiscalersToken_; + float lumi_factor_per_bx_; + + edm::ParameterSet const* conf_; + + std::string stateName_; + + bool doTrackerSpecific_; + bool doAllPlots_; + bool doBSPlots_; + bool doPVPlots_; + bool doDCAPlots_; + bool doGeneralPropertiesPlots_; + bool doMeasurementStatePlots_; + bool doHitPropertiesPlots_; + bool doRecHitVsPhiVsEtaPerTrack_; + bool doRecHitVsPtVsEtaPerTrack_; + // ADD by Mia + bool doLayersVsPhiVsEtaPerTrack_; + bool doTrackRecHitVsPhiVsEtaPerTrack_; + bool doTrackRecHitVsPtVsEtaPerTrack_; + bool doTrackLayersVsPhiVsEtaPerTrack_; + bool doTrack2DChi2Plots_; + bool doRecHitsPerTrackProfile_; + // ADD by Mia in order to clean the tracking MEs + // do not plot *Theta* and TrackPx* and TrackPy* + bool doThetaPlots_; + bool doTrackPxPyPlots_; + // ADD by Mia in order to not plot DistanceOfClosestApproach w.r.t. (0,0,0) + // the DistanceOfClosestApproach w.r.t. the beam-spot is already shown in DistanceOfClosestApproachToBS + bool doDCAwrtPVPlots_; + bool doDCAwrt000Plots_; + + bool doLumiAnalysis_; + + // ADD by Mia in order to turnON test MEs + bool doTestPlots_; + + //For HI Plots + bool doHIPlots_; + + // IP significance plots + bool doSIPPlots_; + + // Compute the hit-finding efficiency using the HitPattern of + // the reconstructed tracks + bool doEffFromHitPatternVsPU_; + bool doEffFromHitPatternVsBX_; + bool doEffFromHitPatternVsLUMI_; + int pvNDOF_; + bool useBPixLayer1_; + int minNumberOfPixelsPerCluster_; + float minPixelClusterCharge_; + std::string qualityString_; + + struct TkParameterMEs { + TkParameterMEs() + : TrackP(nullptr), + TrackPx(nullptr), + TrackPy(nullptr), + TrackPz(nullptr), + TrackPt(nullptr) + + , + TrackPxErr(nullptr), + TrackPyErr(nullptr), + TrackPzErr(nullptr), + TrackPtErr(nullptr), + TrackPErr(nullptr) + + , + TrackPtErrVsEta(nullptr) + + , + TrackQ(nullptr) + + , + TrackPhi(nullptr), + TrackEta(nullptr), + TrackTheta(nullptr) + + , + TrackPhiErr(nullptr), + TrackEtaErr(nullptr), + TrackThetaErr(nullptr) + + , + NumberOfRecHitsPerTrackVsPhi(nullptr), + NumberOfRecHitsPerTrackVsTheta(nullptr), + NumberOfRecHitsPerTrackVsEta(nullptr), + NumberOfRecHitVsPhiVsEtaPerTrack(nullptr) + + , + NumberOfValidRecHitsPerTrackVsPhi(nullptr), + NumberOfValidRecHitsPerTrackVsTheta(nullptr), + NumberOfValidRecHitsPerTrackVsEta(nullptr), + NumberOfValidRecHitsPerTrackVsPt(nullptr), + NumberOfValidRecHitVsPhiVsEtaPerTrack(nullptr), + NumberOfValidRecHitVsPtVsEtaPerTrack(nullptr) + + , + NumberOfLostRecHitsPerTrackVsPhi(nullptr), + NumberOfLostRecHitsPerTrackVsTheta(nullptr), + NumberOfLostRecHitsPerTrackVsEta(nullptr), + NumberOfLostRecHitsPerTrackVsPt(nullptr), + NumberOfLostRecHitVsPhiVsEtaPerTrack(nullptr), + NumberOfLostRecHitVsPtVsEtaPerTrack(nullptr) + + , + NumberOfMIRecHitsPerTrackVsPhi(nullptr), + NumberOfMIRecHitsPerTrackVsTheta(nullptr), + NumberOfMIRecHitsPerTrackVsEta(nullptr), + NumberOfMIRecHitsPerTrackVsPt(nullptr), + NumberOfMIRecHitVsPhiVsEtaPerTrack(nullptr), + NumberOfMIRecHitVsPtVsEtaPerTrack(nullptr) + + , + NumberOfMORecHitsPerTrackVsPhi(nullptr), + NumberOfMORecHitsPerTrackVsTheta(nullptr), + NumberOfMORecHitsPerTrackVsEta(nullptr), + NumberOfMORecHitsPerTrackVsPt(nullptr), + NumberOfMORecHitVsPhiVsEtaPerTrack(nullptr), + NumberOfMORecHitVsPtVsEtaPerTrack(nullptr) + + , + NumberOfLayersPerTrackVsPhi(nullptr), + NumberOfLayersPerTrackVsTheta(nullptr), + NumberOfLayersPerTrackVsEta(nullptr) + + , + Chi2oNDFVsNHits(nullptr), + Chi2oNDFVsPt(nullptr), + Chi2oNDFVsEta(nullptr), + Chi2oNDFVsPhi(nullptr), + Chi2oNDFVsTheta(nullptr) + + , + Chi2ProbVsEta(nullptr), + Chi2ProbVsPhi(nullptr), + Chi2ProbVsTheta(nullptr) {} + + MonitorElement* TrackP; + MonitorElement* TrackPx; + MonitorElement* TrackPy; + MonitorElement* TrackPz; + MonitorElement* TrackPt; + MonitorElement* TrackPtZone1; + MonitorElement* TrackPtZone2; + MonitorElement* TrackPtZone3; + MonitorElement* TrackPtZone4; + MonitorElement* TrackPtZone5; + MonitorElement* TrackPtZone6; + MonitorElement* TrackPtZone7; + MonitorElement* TrackPtZone8; + MonitorElement* Ratio_byFolding; + MonitorElement* Ratio_byFolding2; + MonitorElement* TrackPtHighPurity; + MonitorElement* TrackPtTight; + MonitorElement* TrackPtLoose; + MonitorElement* Quality; + + MonitorElement* TrackPxErr; + MonitorElement* TrackPyErr; + MonitorElement* TrackPzErr; + MonitorElement* TrackPtErr; + MonitorElement* TrackPErr; + + MonitorElement* TrackPtErrVsEta; + + MonitorElement* TrackQ; + MonitorElement* TrackQoverP; + + MonitorElement* TrackPhi; + MonitorElement* TrackEta; + MonitorElement* TrackEtaHighPurity; + MonitorElement* TrackEtaTight; + MonitorElement* TrackEtaLoose; + MonitorElement* TrackEtaPhi = nullptr; + MonitorElement* TrackEtaPhiInverted = nullptr; + MonitorElement* TrackEtaPhiInvertedoutofphase = nullptr; + MonitorElement* TkEtaPhi_Ratio_byFoldingmap = nullptr; + MonitorElement* TkEtaPhi_Ratio_byFoldingmap_op = nullptr; + MonitorElement* TkEtaPhi_RelativeDifference_byFoldingmap = nullptr; + MonitorElement* TkEtaPhi_RelativeDifference_byFoldingmap_op = nullptr; + MonitorElement* TrackEtaPhiInner = nullptr; + MonitorElement* TrackEtaPhiOuter = nullptr; + + MonitorElement* TrackTheta; + + MonitorElement* TrackPhiErr; + MonitorElement* TrackEtaErr; + MonitorElement* TrackThetaErr; + + MonitorElement* NumberOfRecHitsPerTrackVsPhi; + MonitorElement* NumberOfRecHitsPerTrackVsTheta; + MonitorElement* NumberOfRecHitsPerTrackVsEta; + MonitorElement* NumberOfRecHitVsPhiVsEtaPerTrack; + + MonitorElement* NumberOfValidRecHitsPerTrackVsPhi; + MonitorElement* NumberOfValidRecHitsPerTrackVsTheta; + MonitorElement* NumberOfValidRecHitsPerTrackVsEta; + MonitorElement* NumberOfValidRecHitsPerTrackVsPt; + MonitorElement* NumberOfValidRecHitVsPhiVsEtaPerTrack; + MonitorElement* NumberOfValidRecHitVsPtVsEtaPerTrack; + + MonitorElement* NumberOfLostRecHitsPerTrackVsPhi; + MonitorElement* NumberOfLostRecHitsPerTrackVsTheta; + MonitorElement* NumberOfLostRecHitsPerTrackVsEta; + MonitorElement* NumberOfLostRecHitsPerTrackVsPt; + MonitorElement* NumberOfLostRecHitVsPhiVsEtaPerTrack; + MonitorElement* NumberOfLostRecHitVsPtVsEtaPerTrack; + + MonitorElement* NumberOfMIRecHitsPerTrackVsPhi; + MonitorElement* NumberOfMIRecHitsPerTrackVsTheta; + MonitorElement* NumberOfMIRecHitsPerTrackVsEta; + MonitorElement* NumberOfMIRecHitsPerTrackVsPt; + MonitorElement* NumberOfMIRecHitVsPhiVsEtaPerTrack; + MonitorElement* NumberOfMIRecHitVsPtVsEtaPerTrack; + + MonitorElement* NumberOfMORecHitsPerTrackVsPhi; + MonitorElement* NumberOfMORecHitsPerTrackVsTheta; + MonitorElement* NumberOfMORecHitsPerTrackVsEta; + MonitorElement* NumberOfMORecHitsPerTrackVsPt; + MonitorElement* NumberOfMORecHitVsPhiVsEtaPerTrack; + MonitorElement* NumberOfMORecHitVsPtVsEtaPerTrack; + + MonitorElement* NumberOfLayersPerTrackVsPhi; + MonitorElement* NumberOfLayersPerTrackVsTheta; + MonitorElement* NumberOfLayersPerTrackVsEta; + + MonitorElement* Chi2oNDFVsNHits; + MonitorElement* Chi2oNDFVsPt; + MonitorElement* Chi2oNDFVsEta; + MonitorElement* Chi2oNDFVsPhi; + MonitorElement* Chi2oNDFVsTheta; + + MonitorElement* Chi2ProbVsEta; + MonitorElement* Chi2ProbVsPhi; + MonitorElement* Chi2ProbVsTheta; + }; + std::map TkParameterMEMap; + + MonitorElement* NumberOfRecHitsPerTrack; + MonitorElement* NumberOfValidRecHitsPerTrack; + MonitorElement* NumberOfLostRecHitsPerTrack; + MonitorElement* NumberOfMIRecHitsPerTrack = nullptr; + MonitorElement* NumberOfMORecHitsPerTrack = nullptr; + + MonitorElement* NumberOfRecHitsPerTrackVsPhi = nullptr; + MonitorElement* NumberOfRecHitsPerTrackVsTheta = nullptr; + MonitorElement* NumberOfRecHitsPerTrackVsEta = nullptr; + MonitorElement* NumberOfRecHitVsPhiVsEtaPerTrack = nullptr; + + MonitorElement* NumberOfValidRecHitsPerTrackVsPhi = nullptr; + MonitorElement* NumberOfValidRecHitsPerTrackVsTheta = nullptr; + MonitorElement* NumberOfValidRecHitsPerTrackVsEta = nullptr; + MonitorElement* NumberOfValidRecHitsPerTrackVsPt = nullptr; + MonitorElement* NumberOfValidRecHitVsPhiVsEtaPerTrack = nullptr; + MonitorElement* NumberOfValidRecHitVsPtVsEtaPerTrack = nullptr; + + MonitorElement* NumberOfLostRecHitsPerTrackVsPhi = nullptr; + MonitorElement* NumberOfLostRecHitsPerTrackVsTheta = nullptr; + MonitorElement* NumberOfLostRecHitsPerTrackVsEta = nullptr; + MonitorElement* NumberOfLostRecHitsPerTrackVsPt = nullptr; + MonitorElement* NumberOfLostRecHitVsPhiVsEtaPerTrack = nullptr; + MonitorElement* NumberOfLostRecHitVsPtVsEtaPerTrack = nullptr; + + MonitorElement* NumberOfMIRecHitsPerTrackVsPhi = nullptr; + MonitorElement* NumberOfMIRecHitsPerTrackVsTheta = nullptr; + MonitorElement* NumberOfMIRecHitsPerTrackVsEta = nullptr; + MonitorElement* NumberOfMIRecHitsPerTrackVsPt = nullptr; + MonitorElement* NumberOfMIRecHitVsPhiVsEtaPerTrack = nullptr; + MonitorElement* NumberOfMIRecHitVsPtVsEtaPerTrack = nullptr; + + MonitorElement* NumberOfMORecHitsPerTrackVsPhi = nullptr; + MonitorElement* NumberOfMORecHitsPerTrackVsTheta = nullptr; + MonitorElement* NumberOfMORecHitsPerTrackVsEta = nullptr; + MonitorElement* NumberOfMORecHitsPerTrackVsPt = nullptr; + MonitorElement* NumberOfMORecHitVsPhiVsEtaPerTrack = nullptr; + MonitorElement* NumberOfMORecHitVsPtVsEtaPerTrack = nullptr; + + MonitorElement* ValidFractionPerTrack = nullptr; + MonitorElement* ValidFractionVsPhiVsEtaPerTrack = nullptr; + + MonitorElement* NumberOfLayersPerTrack[4] = {nullptr, nullptr, nullptr, nullptr}; + + MonitorElement* NumberOfLayersPerTrackVsPhi; + MonitorElement* NumberOfLayersPerTrackVsTheta; + MonitorElement* NumberOfLayersPerTrackVsEta; + + MonitorElement* NumberOfLayersVsPhiVsEtaPerTrack[5] = {nullptr, nullptr, nullptr, nullptr, nullptr}; + + MonitorElement* Chi2; + MonitorElement* Chi2Prob; + MonitorElement* Chi2oNDF; + + MonitorElement* Chi2oNDFVsNHits = nullptr; + MonitorElement* Chi2oNDFVsPt = nullptr; + MonitorElement* Chi2oNDFVsEta = nullptr; + MonitorElement* Chi2oNDFVsPhi; + MonitorElement* Chi2oNDFVsTheta; + + MonitorElement* Chi2ProbVsEta; + MonitorElement* Chi2ProbVsPhi; + MonitorElement* Chi2ProbVsTheta; + + MonitorElement* DistanceOfClosestApproach; + MonitorElement* DistanceOfClosestApproachError; + MonitorElement* DistanceOfClosestApproachErrorVsPt; + MonitorElement* DistanceOfClosestApproachErrorVsEta; + MonitorElement* DistanceOfClosestApproachErrorVsPhi; + MonitorElement* DistanceOfClosestApproachErrorVsDxy; + MonitorElement* DistanceOfClosestApproachToBS; + MonitorElement* DistanceOfClosestApproachToBSdz; + MonitorElement* AbsDistanceOfClosestApproachToBS; + MonitorElement* DistanceOfClosestApproachToPV; + MonitorElement* DistanceOfClosestApproachToPVZoom; + MonitorElement* DeltaZToPV; + MonitorElement* DeltaZToPVZoom; + MonitorElement* DistanceOfClosestApproachVsTheta; + MonitorElement* DistanceOfClosestApproachVsPhi; + MonitorElement* DistanceOfClosestApproachToBSVsPhi; + MonitorElement* DistanceOfClosestApproachToBSVsEta; + MonitorElement* DistanceOfClosestApproachToPVVsPhi; + MonitorElement* DistanceOfClosestApproachVsEta; + MonitorElement* xPointOfClosestApproach; + MonitorElement* xPointOfClosestApproachToPV; + MonitorElement* xPointOfClosestApproachVsZ0wrt000; + MonitorElement* xPointOfClosestApproachVsZ0wrtBS; + MonitorElement* xPointOfClosestApproachVsZ0wrtPV; + MonitorElement* yPointOfClosestApproach; + MonitorElement* yPointOfClosestApproachToPV; + MonitorElement* yPointOfClosestApproachVsZ0wrt000; + MonitorElement* yPointOfClosestApproachVsZ0wrtBS; + MonitorElement* yPointOfClosestApproachVsZ0wrtPV; + MonitorElement* zPointOfClosestApproach; + MonitorElement* zPointOfClosestApproachToPV; + MonitorElement* zPointOfClosestApproachVsPhi; + MonitorElement *algorithm, *oriAlgo; + MonitorElement* stoppingSource; + MonitorElement* stoppingSourceVSeta; + MonitorElement* stoppingSourceVSphi; + // TESTING MEs + MonitorElement* TESTDistanceOfClosestApproachToBS; + MonitorElement* TESTDistanceOfClosestApproachToBSVsPhi; + + // add by Mia in order to deal w/ LS transitions + MonitorElement* Chi2oNDF_lumiFlag; + MonitorElement* NumberOfRecHitsPerTrack_lumiFlag; + + //new plots for Heavy Ion DQM + MonitorElement* LongDCASig; + MonitorElement* TransDCASig; + MonitorElement* dNdPhi_HighPurity; + MonitorElement* dNdEta_HighPurity; + MonitorElement* dNdPt_HighPurity; + MonitorElement* NhitVsEta_HighPurity; + MonitorElement* NhitVsPhi_HighPurity; + MonitorElement* Ptdist_HighPurity; + MonitorElement* dNhitdPt_HighPurity; + + // IP significance plots + MonitorElement* sipDxyToBS; + MonitorElement* sipDzToBS; + MonitorElement* sip3dToPV; + MonitorElement* sip2dToPV; + MonitorElement* sipDxyToPV; + MonitorElement* sipDzToPV; + + struct TkRecHitsPerSubDetMEs { + MonitorElement* NumberOfRecHitsPerTrack; + MonitorElement* NumberOfRecHitsPerTrackVsPhi; + MonitorElement* NumberOfRecHitsPerTrackVsEta; + MonitorElement* NumberOfRecHitsPerTrackVsPt; + MonitorElement* NumberOfLayersPerTrack; + MonitorElement* NumberOfLayersPerTrackVsPhi; + MonitorElement* NumberOfLayersPerTrackVsEta; + MonitorElement* NumberOfLayersPerTrackVsPt; + MonitorElement* RecHitChi2PerTrack; + + int detectorId; + std::string detectorTag; + }; + std::map TkRecHitsPerSubDetMEMap; + + struct Key { + int det; + int subdet; + int monitoring; + explicit Key(int det, int subdet, int monitoring) : det(det), subdet(subdet), monitoring(monitoring){}; + bool operator==(const Key& other) const { + return (det == other.det && subdet == other.subdet && monitoring == other.monitoring); + } + }; + + struct KeyHasher { + std::size_t operator()(const Key& k) const { + // 3 bits (0x7) for kind of monitoring (7 kinds at most) + // next 8 bits to the subdetector (255 subdetectors at most) + // next 8 bits to the detector (255 detectors at most) + return (size_t)((k.monitoring & (0x7)) | ((k.subdet & (0xff)) << 3) | ((k.det & (0xff)) << 11)); + } + }; + + 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_; + unsigned int bx_; + float pixel_lumi_; + float scal_lumi_; + enum monQuantity { VsPU, VsBX, VsPIXELLUMI, VsSCALLUMI, END }; + std::string monName[monQuantity::END] = {"", "VsBX", "VsPIXELLUMI", "VsSCALLUMI"}; + + std::string histname; //for naming the histograms according to algorithm used + }; +} // namespace dqm #endif diff --git a/DQM/TrackingMonitor/interface/TrackingMonitor.h b/DQM/TrackingMonitor/interface/TrackingMonitor.h index 23f3e33d54ce1..a1fec6f458287 100644 --- a/DQM/TrackingMonitor/interface/TrackingMonitor.h +++ b/DQM/TrackingMonitor/interface/TrackingMonitor.h @@ -4,7 +4,7 @@ // // Package: TrackingMonitor // Class: TrackingMonitor -// +// /**\class TrackingMonitor TrackingMonitor.cc DQM/TrackerMonitorTrack/src/TrackingMonitor.cc Monitoring source for general quantities related to tracks. */ @@ -30,8 +30,8 @@ Monitoring source for general quantities related to tracks. #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" -#include "DataFormats/TrackCandidate/interface/TrackCandidate.h" +#include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" +#include "DataFormats/TrackCandidate/interface/TrackCandidate.h" #include "DataFormats/TrackReco/interface/SeedStopInfo.h" @@ -57,177 +57,173 @@ class GetLumi; class TProfile; class GenericTriggerEventFlag; -class TrackingMonitor : public one::DQMEDAnalyzer -{ - public: - using MVACollection = std::vector; - using QualityMaskCollection = std::vector; - - explicit TrackingMonitor(const edm::ParameterSet&); - ~TrackingMonitor() override; - - virtual void setMaxMinBin(std::vector & ,std::vector & ,std::vector & ,double, double, int, double, double, int); - virtual void setNclus(const edm::Event&, std::vector & ); - - void beginLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& eSetup) override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - // virtual void beginRun(const edm::Run&, const edm::EventSetup&); - void endRun(const edm::Run&, const edm::EventSetup&) override; - - private: - void doProfileX(TH2 * th2, MonitorElement* me); - void doProfileX(MonitorElement * th2m, MonitorElement* me); - - - // ----------member data --------------------------- - - std::string MEFolderName; - std::string histname; //for naming the histograms according to algorithm used - - // DQMStore * dqmStore_; - - edm::ParameterSetID confID_; - - // the track analyzer - edm::InputTag bsSrc_; - edm::InputTag pvSrc_; - edm::EDGetTokenT bsSrcToken_; - edm::EDGetTokenT pvSrcToken_; - - edm::EDGetTokenT > allTrackToken_; - edm::EDGetTokenT > trackToken_; - edm::EDGetTokenT trackCandidateToken_; - edm::EDGetTokenT > seedToken_; - edm::EDGetTokenT > seedStopInfoToken_; - edm::EDGetTokenT > regionToken_; - edm::EDGetTokenT regionLayerSetsToken_; - edm::EDGetTokenT regionCandidateToken_; - - edm::EDGetTokenT lumiscalersToken_; - - edm::InputTag stripClusterInputTag_; - edm::InputTag pixelClusterInputTag_; - edm::EDGetTokenT > stripClustersToken_; - edm::EDGetTokenT > pixelClustersToken_; - - std::vector, edm::EDGetTokenT > > mvaQualityTokens_; - edm::EDGetTokenT > mvaTrackToken_; - - std::string Quality_; - std::string AlgoName_; - - - dqm::TrackAnalyzer * theTrackAnalyzer; - TrackBuildingAnalyzer * theTrackBuildingAnalyzer; - std::vector theVertexMonitor; - GetLumi* theLumiDetails_; - - // Tracks - MonitorElement * NumberOfTracks; - MonitorElement * NumberOfTracks_PUvtx; - MonitorElement * NumberofTracks_Hardvtx; - MonitorElement * NumberofTracks_Hardvtx_PUvtx; - MonitorElement * NumberOfMeanRecHitsPerTrack; - MonitorElement * NumberOfMeanLayersPerTrack; - - // Good Tracks - MonitorElement * FractionOfGoodTracks; - - // Tracking regions - MonitorElement * NumberOfTrackingRegions; - - // Track Seeds - MonitorElement * NumberOfSeeds; - MonitorElement * NumberOfSeeds_lumiFlag; - std::vector SeedsVsClusters; - std::vector ClusterLabels; - - - // Track Candidates - MonitorElement * NumberOfTrackCandidates; - MonitorElement * FractionCandidatesOverSeeds; - - // Cluster Properties - std::vector NumberOfTrkVsClusters; - MonitorElement* NumberOfTrkVsClus; - MonitorElement* NumberOfTrkVsStripClus; - MonitorElement* NumberOfTrkVsPixelClus; - - // Monitoring vs LS - MonitorElement* NumberEventsOfVsLS; - MonitorElement* NumberOfTracksVsLS; - MonitorElement* GoodTracksFractionVsLS; - MonitorElement* NumberOfRecHitsPerTrackVsLS; - MonitorElement* NumberOfGoodPVtxVsLS; - MonitorElement* NumberOfGoodPVtxWO0VsLS; - - // Monitoring vs BX - MonitorElement* NumberEventsOfVsBX; - MonitorElement* NumberOfTracksVsBX; - MonitorElement* GoodTracksFractionVsBX; - MonitorElement* NumberOfRecHitsPerTrackVsBX; - MonitorElement* NumberOfGoodPVtxVsBX; - MonitorElement* NumberOfGoodPVtxWO0VsBX; - - MonitorElement* NumberOfTracksVsBXlumi; - - // Monitoring PU - MonitorElement *NumberOfTracksVsGoodPVtx; - MonitorElement* NumberOfTracksVsPUPVtx; - MonitorElement* NumberEventsOfVsGoodPVtx; - MonitorElement* GoodTracksFractionVsGoodPVtx; - MonitorElement* NumberOfRecHitsPerTrackVsGoodPVtx; - MonitorElement* NumberOfPVtxVsGoodPVtx; - MonitorElement* NumberOfPixelClustersVsGoodPVtx; - MonitorElement* NumberOfStripClustersVsGoodPVtx; - - // Monitoring vs lumi - MonitorElement* NumberEventsOfVsLUMI; - MonitorElement* NumberOfTracksVsLUMI; - MonitorElement* GoodTracksFractionVsLUMI; - MonitorElement* NumberOfRecHitsPerTrackVsLUMI; - MonitorElement* NumberOfGoodPVtxVsLUMI; - MonitorElement* NumberOfGoodPVtxWO0VsLUMI; - MonitorElement* NumberOfPixelClustersVsLUMI; - MonitorElement* NumberOfStripClustersVsLUMI; - - // add in order to deal with LS transitions - MonitorElement * NumberOfTracks_lumiFlag; - - std::string builderName; - edm::ESHandle theTTRHBuilder; - - bool doTrackerSpecific_; - bool doLumiAnalysis; - bool doProfilesVsLS_; - bool doAllSeedPlots; - bool doAllPlots; - bool doDCAPlots_; - bool doGeneralPropertiesPlots_; - bool doHitPropertiesPlots_; - bool doTkCandPlots; - bool doMVAPlots; - bool doRegionPlots; - bool doRegionCandidatePlots; - bool doSeedNumberPlot; - bool doSeedLumiAnalysis_; - bool doSeedVsClusterPlot; - bool runTrackBuildingAnalyzerForSeed; - // ADD by Mia in order to have GoodTrack plots only for collision - bool doPUmonitoring_; - bool doPlotsVsBXlumi_; - bool doPlotsVsGoodPVtx_; - bool doPlotsVsLUMI_; - bool doPlotsVsBX_; - bool doFractionPlot_; - - GenericTriggerEventFlag* genTriggerEventFlag_; - - StringCutObjectSelector numSelection_; - StringCutObjectSelector denSelection_; - int pvNDOF_; - +class TrackingMonitor : public one::DQMEDAnalyzer { +public: + using MVACollection = std::vector; + using QualityMaskCollection = std::vector; + + explicit TrackingMonitor(const edm::ParameterSet&); + ~TrackingMonitor() override; + + virtual void setMaxMinBin( + std::vector&, std::vector&, std::vector&, double, double, int, double, double, int); + virtual void setNclus(const edm::Event&, std::vector&); + + void beginLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& eSetup) override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + // virtual void beginRun(const edm::Run&, const edm::EventSetup&); + void endRun(const edm::Run&, const edm::EventSetup&) override; + +private: + void doProfileX(TH2* th2, MonitorElement* me); + void doProfileX(MonitorElement* th2m, MonitorElement* me); + + // ----------member data --------------------------- + + std::string MEFolderName; + std::string histname; //for naming the histograms according to algorithm used + + // DQMStore * dqmStore_; + + edm::ParameterSetID confID_; + + // the track analyzer + edm::InputTag bsSrc_; + edm::InputTag pvSrc_; + edm::EDGetTokenT bsSrcToken_; + edm::EDGetTokenT pvSrcToken_; + + edm::EDGetTokenT > allTrackToken_; + edm::EDGetTokenT > trackToken_; + edm::EDGetTokenT trackCandidateToken_; + edm::EDGetTokenT > seedToken_; + edm::EDGetTokenT > seedStopInfoToken_; + edm::EDGetTokenT > regionToken_; + edm::EDGetTokenT regionLayerSetsToken_; + edm::EDGetTokenT regionCandidateToken_; + + edm::EDGetTokenT lumiscalersToken_; + + edm::InputTag stripClusterInputTag_; + edm::InputTag pixelClusterInputTag_; + edm::EDGetTokenT > stripClustersToken_; + edm::EDGetTokenT > pixelClustersToken_; + + std::vector, edm::EDGetTokenT > > mvaQualityTokens_; + edm::EDGetTokenT > mvaTrackToken_; + + std::string Quality_; + std::string AlgoName_; + + dqm::TrackAnalyzer* theTrackAnalyzer; + TrackBuildingAnalyzer* theTrackBuildingAnalyzer; + std::vector theVertexMonitor; + GetLumi* theLumiDetails_; + + // Tracks + MonitorElement* NumberOfTracks; + MonitorElement* NumberOfTracks_PUvtx; + MonitorElement* NumberofTracks_Hardvtx; + MonitorElement* NumberofTracks_Hardvtx_PUvtx; + MonitorElement* NumberOfMeanRecHitsPerTrack; + MonitorElement* NumberOfMeanLayersPerTrack; + + // Good Tracks + MonitorElement* FractionOfGoodTracks; + + // Tracking regions + MonitorElement* NumberOfTrackingRegions; + + // Track Seeds + MonitorElement* NumberOfSeeds; + MonitorElement* NumberOfSeeds_lumiFlag; + std::vector SeedsVsClusters; + std::vector ClusterLabels; + + // Track Candidates + MonitorElement* NumberOfTrackCandidates; + MonitorElement* FractionCandidatesOverSeeds; + + // Cluster Properties + std::vector NumberOfTrkVsClusters; + MonitorElement* NumberOfTrkVsClus; + MonitorElement* NumberOfTrkVsStripClus; + MonitorElement* NumberOfTrkVsPixelClus; + + // Monitoring vs LS + MonitorElement* NumberEventsOfVsLS; + MonitorElement* NumberOfTracksVsLS; + MonitorElement* GoodTracksFractionVsLS; + MonitorElement* NumberOfRecHitsPerTrackVsLS; + MonitorElement* NumberOfGoodPVtxVsLS; + MonitorElement* NumberOfGoodPVtxWO0VsLS; + + // Monitoring vs BX + MonitorElement* NumberEventsOfVsBX; + MonitorElement* NumberOfTracksVsBX; + MonitorElement* GoodTracksFractionVsBX; + MonitorElement* NumberOfRecHitsPerTrackVsBX; + MonitorElement* NumberOfGoodPVtxVsBX; + MonitorElement* NumberOfGoodPVtxWO0VsBX; + + MonitorElement* NumberOfTracksVsBXlumi; + + // Monitoring PU + MonitorElement* NumberOfTracksVsGoodPVtx; + MonitorElement* NumberOfTracksVsPUPVtx; + MonitorElement* NumberEventsOfVsGoodPVtx; + MonitorElement* GoodTracksFractionVsGoodPVtx; + MonitorElement* NumberOfRecHitsPerTrackVsGoodPVtx; + MonitorElement* NumberOfPVtxVsGoodPVtx; + MonitorElement* NumberOfPixelClustersVsGoodPVtx; + MonitorElement* NumberOfStripClustersVsGoodPVtx; + + // Monitoring vs lumi + MonitorElement* NumberEventsOfVsLUMI; + MonitorElement* NumberOfTracksVsLUMI; + MonitorElement* GoodTracksFractionVsLUMI; + MonitorElement* NumberOfRecHitsPerTrackVsLUMI; + MonitorElement* NumberOfGoodPVtxVsLUMI; + MonitorElement* NumberOfGoodPVtxWO0VsLUMI; + MonitorElement* NumberOfPixelClustersVsLUMI; + MonitorElement* NumberOfStripClustersVsLUMI; + + // add in order to deal with LS transitions + MonitorElement* NumberOfTracks_lumiFlag; + + std::string builderName; + edm::ESHandle theTTRHBuilder; + + bool doTrackerSpecific_; + bool doLumiAnalysis; + bool doProfilesVsLS_; + bool doAllSeedPlots; + bool doAllPlots; + bool doDCAPlots_; + bool doGeneralPropertiesPlots_; + bool doHitPropertiesPlots_; + bool doTkCandPlots; + bool doMVAPlots; + bool doRegionPlots; + bool doRegionCandidatePlots; + bool doSeedNumberPlot; + bool doSeedLumiAnalysis_; + bool doSeedVsClusterPlot; + bool runTrackBuildingAnalyzerForSeed; + // ADD by Mia in order to have GoodTrack plots only for collision + bool doPUmonitoring_; + bool doPlotsVsBXlumi_; + bool doPlotsVsGoodPVtx_; + bool doPlotsVsLUMI_; + bool doPlotsVsBX_; + bool doFractionPlot_; + + GenericTriggerEventFlag* genTriggerEventFlag_; + + StringCutObjectSelector numSelection_; + StringCutObjectSelector denSelection_; + int pvNDOF_; }; -#endif //define TrackingMonitor_H +#endif //define TrackingMonitor_H diff --git a/DQM/TrackingMonitor/src/TrackAnalyzer.cc b/DQM/TrackingMonitor/src/TrackAnalyzer.cc index e4bac1cbe380c..fdb8e6800d12b 100644 --- a/DQM/TrackingMonitor/src/TrackAnalyzer.cc +++ b/DQM/TrackingMonitor/src/TrackAnalyzer.cc @@ -25,82 +25,76 @@ using namespace dqm; namespace { template - std::array makeLogBins(const double min, const double max) { + std::array makeLogBins(const double min, const double max) { const double minLog10 = std::log10(min); const double maxLog10 = std::log10(max); - const double width = (maxLog10-minLog10)/N; - std::array ret; - ret[0] = std::pow(10,minLog10); + const double width = (maxLog10 - minLog10) / N; + std::array ret; + ret[0] = std::pow(10, minLog10); const double mult = std::pow(10, width); - for(size_t i=1; i<= N; ++i) { - ret[i] = ret[i-1]*mult; + for (size_t i = 1; i <= N; ++i) { + ret[i] = ret[i - 1] * mult; } return ret; } -} - -TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig) - : conf_( nullptr ) - , stateName_ (iConfig.getParameter("MeasurementState") ) - , doTrackerSpecific_ ( iConfig.getParameter("doTrackerSpecific") ) - , doAllPlots_ ( iConfig.getParameter("doAllPlots") ) - , doBSPlots_ ( iConfig.getParameter("doBeamSpotPlots") ) - , doPVPlots_ ( iConfig.getParameter("doPrimaryVertexPlots") ) - , doDCAPlots_ ( iConfig.getParameter("doDCAPlots") ) - , doGeneralPropertiesPlots_ ( iConfig.getParameter("doGeneralPropertiesPlots") ) - , doMeasurementStatePlots_ ( iConfig.getParameter("doMeasurementStatePlots") ) - , doHitPropertiesPlots_ ( iConfig.getParameter("doHitPropertiesPlots") ) - , doRecHitVsPhiVsEtaPerTrack_ ( iConfig.getParameter("doRecHitVsPhiVsEtaPerTrack") ) - , doRecHitVsPtVsEtaPerTrack_ ( iConfig.getParameter("doRecHitVsPtVsEtaPerTrack") ) - , doLayersVsPhiVsEtaPerTrack_ ( iConfig.getParameter("doLayersVsPhiVsEtaPerTrack") ) - , doRecHitsPerTrackProfile_ ( iConfig.getParameter("doRecHitsPerTrackProfile") ) - , doThetaPlots_ ( iConfig.getParameter("doThetaPlots") ) - , doTrackPxPyPlots_ ( iConfig.getParameter("doTrackPxPyPlots") ) - , doDCAwrtPVPlots_ ( iConfig.getParameter("doDCAwrtPVPlots") ) - , doDCAwrt000Plots_ ( iConfig.getParameter("doDCAwrt000Plots") ) - , doLumiAnalysis_ ( iConfig.getParameter("doLumiAnalysis") ) - , doTestPlots_ ( iConfig.getParameter("doTestPlots") ) - , doHIPlots_ ( iConfig.getParameter("doHIPlots") ) - , doSIPPlots_ ( iConfig.getParameter("doSIPPlots") ) - , doEffFromHitPatternVsPU_ ( iConfig.getParameter("doEffFromHitPatternVsPU") ) - , doEffFromHitPatternVsBX_ ( iConfig.getParameter("doEffFromHitPatternVsBX") ) - , doEffFromHitPatternVsLUMI_ ( iConfig.getParameter("doEffFromHitPatternVsLUMI") ) - , pvNDOF_ ( iConfig.getParameter ("pvNDOF") ) - , useBPixLayer1_ ( iConfig.getParameter("useBPixLayer1") ) - , minNumberOfPixelsPerCluster_ ( iConfig.getParameter("minNumberOfPixelsPerCluster") ) - , minPixelClusterCharge_ ( iConfig.getParameter("minPixelClusterCharge") ) - , qualityString_ ( iConfig.getParameter("qualityString")) - , good_vertices_(0) - , bx_(0) - , pixel_lumi_(0.) - , scal_lumi_(0.) -{ +} // namespace + +TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig) + : conf_(nullptr), + stateName_(iConfig.getParameter("MeasurementState")), + doTrackerSpecific_(iConfig.getParameter("doTrackerSpecific")), + doAllPlots_(iConfig.getParameter("doAllPlots")), + doBSPlots_(iConfig.getParameter("doBeamSpotPlots")), + doPVPlots_(iConfig.getParameter("doPrimaryVertexPlots")), + doDCAPlots_(iConfig.getParameter("doDCAPlots")), + doGeneralPropertiesPlots_(iConfig.getParameter("doGeneralPropertiesPlots")), + doMeasurementStatePlots_(iConfig.getParameter("doMeasurementStatePlots")), + doHitPropertiesPlots_(iConfig.getParameter("doHitPropertiesPlots")), + doRecHitVsPhiVsEtaPerTrack_(iConfig.getParameter("doRecHitVsPhiVsEtaPerTrack")), + doRecHitVsPtVsEtaPerTrack_(iConfig.getParameter("doRecHitVsPtVsEtaPerTrack")), + doLayersVsPhiVsEtaPerTrack_(iConfig.getParameter("doLayersVsPhiVsEtaPerTrack")), + doRecHitsPerTrackProfile_(iConfig.getParameter("doRecHitsPerTrackProfile")), + doThetaPlots_(iConfig.getParameter("doThetaPlots")), + doTrackPxPyPlots_(iConfig.getParameter("doTrackPxPyPlots")), + doDCAwrtPVPlots_(iConfig.getParameter("doDCAwrtPVPlots")), + doDCAwrt000Plots_(iConfig.getParameter("doDCAwrt000Plots")), + doLumiAnalysis_(iConfig.getParameter("doLumiAnalysis")), + doTestPlots_(iConfig.getParameter("doTestPlots")), + doHIPlots_(iConfig.getParameter("doHIPlots")), + doSIPPlots_(iConfig.getParameter("doSIPPlots")), + doEffFromHitPatternVsPU_(iConfig.getParameter("doEffFromHitPatternVsPU")), + doEffFromHitPatternVsBX_(iConfig.getParameter("doEffFromHitPatternVsBX")), + doEffFromHitPatternVsLUMI_(iConfig.getParameter("doEffFromHitPatternVsLUMI")), + pvNDOF_(iConfig.getParameter("pvNDOF")), + useBPixLayer1_(iConfig.getParameter("useBPixLayer1")), + minNumberOfPixelsPerCluster_(iConfig.getParameter("minNumberOfPixelsPerCluster")), + minPixelClusterCharge_(iConfig.getParameter("minPixelClusterCharge")), + qualityString_(iConfig.getParameter("qualityString")), + good_vertices_(0), + bx_(0), + pixel_lumi_(0.), + scal_lumi_(0.) { initHistos(); - TopFolder_ = iConfig.getParameter("FolderName"); + TopFolder_ = iConfig.getParameter("FolderName"); } -TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig, edm::ConsumesCollector& iC) - : TrackAnalyzer(iConfig) -{ - edm::InputTag bsSrc = iConfig.getParameter("beamSpot"); +TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig, edm::ConsumesCollector& iC) : TrackAnalyzer(iConfig) { + edm::InputTag bsSrc = iConfig.getParameter("beamSpot"); edm::InputTag primaryVertexInputTag = iConfig.getParameter("primaryVertex"); - edm::InputTag pixelClusterInputTag = iConfig.getParameter("pixelCluster4lumi"); - edm::InputTag scalInputTag = iConfig.getParameter("scal"); - beamSpotToken_ = iC.consumes(bsSrc); - pvToken_ = iC.consumes(primaryVertexInputTag); + edm::InputTag pixelClusterInputTag = iConfig.getParameter("pixelCluster4lumi"); + edm::InputTag scalInputTag = iConfig.getParameter("scal"); + beamSpotToken_ = iC.consumes(bsSrc); + pvToken_ = iC.consumes(primaryVertexInputTag); pixelClustersToken_ = iC.mayConsume >(pixelClusterInputTag); - lumiscalersToken_ = iC.mayConsume(scalInputTag); - - if(useBPixLayer1_) - lumi_factor_per_bx_ = GetLumi::FREQ_ORBIT * GetLumi::SECONDS_PER_LS / GetLumi::XSEC_PIXEL_CLUSTER ; - else - lumi_factor_per_bx_ = GetLumi::FREQ_ORBIT * GetLumi::SECONDS_PER_LS / GetLumi::rXSEC_PIXEL_CLUSTER ; - + lumiscalersToken_ = iC.mayConsume(scalInputTag); + if (useBPixLayer1_) + lumi_factor_per_bx_ = GetLumi::FREQ_ORBIT * GetLumi::SECONDS_PER_LS / GetLumi::XSEC_PIXEL_CLUSTER; + else + lumi_factor_per_bx_ = GetLumi::FREQ_ORBIT * GetLumi::SECONDS_PER_LS / GetLumi::rXSEC_PIXEL_CLUSTER; } -void TrackAnalyzer::initHistos() -{ +void TrackAnalyzer::initHistos() { Chi2 = nullptr; Chi2Prob = nullptr; Chi2ProbVsPhi = nullptr; @@ -109,7 +103,7 @@ void TrackAnalyzer::initHistos() Chi2oNDFVsEta = nullptr; Chi2oNDFVsPhi = nullptr; Chi2oNDFVsTheta = nullptr; - + NumberOfRecHitsPerTrack = nullptr; NumberOfValidRecHitsPerTrack = nullptr; NumberOfLostRecHitsPerTrack = nullptr; @@ -137,7 +131,7 @@ void TrackAnalyzer::initHistos() DeltaZToPV = nullptr; DeltaZToPVZoom = nullptr; DistanceOfClosestApproachVsTheta = nullptr; - DistanceOfClosestApproachVsPhi = nullptr; + DistanceOfClosestApproachVsPhi = nullptr; DistanceOfClosestApproachToBSVsPhi = nullptr; DistanceOfClosestApproachToBSVsEta = nullptr; DistanceOfClosestApproachToPVVsPhi = nullptr; @@ -155,17 +149,17 @@ void TrackAnalyzer::initHistos() stoppingSource = nullptr; stoppingSourceVSeta = nullptr; stoppingSourceVSphi = nullptr; - // TESTING + // TESTING TESTDistanceOfClosestApproachToBS = nullptr; TESTDistanceOfClosestApproachToBSVsPhi = nullptr; -// by Mia in order to deal w/ LS transitions + // by Mia in order to deal w/ LS transitions Chi2oNDF_lumiFlag = nullptr; NumberOfRecHitsPerTrack_lumiFlag = nullptr; - //////////////////////////////////////////////////////////// - //special Plots for HI DQM //SHOULD I ADD THE BOOL HERE?? - //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// + //special Plots for HI DQM //SHOULD I ADD THE BOOL HERE?? + //////////////////////////////////////////////////////////// LongDCASig = nullptr; TransDCASig = nullptr; dNdPhi_HighPurity = nullptr; @@ -181,45 +175,43 @@ void TrackAnalyzer::initHistos() sip2dToPV = nullptr; sipDxyToPV = nullptr; sipDzToPV = nullptr; - } -TrackAnalyzer::~TrackAnalyzer() -{ -} +TrackAnalyzer::~TrackAnalyzer() {} -void TrackAnalyzer::initHisto(DQMStore::IBooker & ibooker, const edm::EventSetup & iSetup, const edm::ParameterSet& iConfig) -{ +void TrackAnalyzer::initHisto(DQMStore::IBooker& ibooker, + const edm::EventSetup& iSetup, + const edm::ParameterSet& iConfig) { conf_ = &iConfig; bookHistosForHitProperties(ibooker); bookHistosForBeamSpot(ibooker); - bookHistosForLScertification( ibooker); - if (doEffFromHitPatternVsPU_ || doAllPlots_) bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "",false); - if (doEffFromHitPatternVsBX_ || doAllPlots_) bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsBX",false); - if (doEffFromHitPatternVsLUMI_ || doAllPlots_) bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsSCALLUMI",false); + bookHistosForLScertification(ibooker); + if (doEffFromHitPatternVsPU_ || doAllPlots_) + bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "", false); + if (doEffFromHitPatternVsBX_ || doAllPlots_) + bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsBX", false); + if (doEffFromHitPatternVsLUMI_ || doAllPlots_) + bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsSCALLUMI", false); // if (doEffFromHitPatternVsLUMI_ || doAllPlots_) bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsPIXELLUMI"); - if (doEffFromHitPatternVsPU_ || doAllPlots_) bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "",true); - if (doEffFromHitPatternVsLUMI_ || doAllPlots_) bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsSCALLUMI",true); + if (doEffFromHitPatternVsPU_ || doAllPlots_) + bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "", true); + if (doEffFromHitPatternVsLUMI_ || doAllPlots_) + bookHistosForEfficiencyFromHitPatter(ibooker, iSetup, "VsSCALLUMI", true); // book tracker specific related histograms // ---------------------------------------------------------------------------------// - if(doTrackerSpecific_ || doAllPlots_) bookHistosForTrackerSpecific(ibooker); - + if (doTrackerSpecific_ || doAllPlots_) + bookHistosForTrackerSpecific(ibooker); + // book state related histograms // ---------------------------------------------------------------------------------// if (doMeasurementStatePlots_ || doAllPlots_) { - - if (stateName_ == "All") { bookHistosForState("OuterSurface", ibooker); bookHistosForState("InnerSurface", ibooker); - bookHistosForState("ImpactPoint" , ibooker); - } else if ( - stateName_ != "OuterSurface" && - stateName_ != "InnerSurface" && - stateName_ != "ImpactPoint" && - stateName_ != "default" - ) { + bookHistosForState("ImpactPoint", ibooker); + } else if (stateName_ != "OuterSurface" && stateName_ != "InnerSurface" && stateName_ != "ImpactPoint" && + stateName_ != "default") { bookHistosForState("default", ibooker); } else { @@ -229,818 +221,880 @@ void TrackAnalyzer::initHisto(DQMStore::IBooker & ibooker, const edm::EventSetup } } -void TrackAnalyzer::bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, - const edm::EventSetup & iSetup, - const std::string suffix,bool useInac) -{ - - ibooker.setCurrentFolder(TopFolder_ + "/HitEffFromHitPattern" + (useInac ? "All" :"") + suffix); - - constexpr int LUMIBin = 300; // conf_->getParameter("LUMIBin"); - float LUMIMin = conf_->getParameter("LUMIMin"); - float LUMIMax = conf_->getParameter("LUMIMax"); - - int PVBin = conf_->getParameter ("PVBin"); - float PVMin = conf_->getParameter("PVMin"); - float PVMax = conf_->getParameter("PVMax"); - - - int NBINS[] = { PVBin, int(GetLumi::lastBunchCrossing), LUMIBin, LUMIBin}; - float MIN[] = { PVMin, 0.5, LUMIMin, LUMIMin }; - float MAX[] = { PVMax, float(GetLumi::lastBunchCrossing)+0.5, LUMIMax, LUMIMax }; - std::string NAME[] = { "", "VsBX", "VsLUMI", "VsLUMI" }; - - auto logBins = makeLogBins(LUMIMin,LUMIMax); - - int mon = -1; - int nbins = -1; - float min = -1.; - float max = -1.; - bool logQ = false; - std::string name = ""; - for (int i=0; i1); // VsLUMI - mon = i; - if (useInac) mon+=monQuantity::END; - nbins = NBINS[i]; - min = MIN[i]; - max = MAX[i]; - name = NAME[i]; - } +void TrackAnalyzer::bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker& ibooker, + const edm::EventSetup& iSetup, + const std::string suffix, + bool useInac) { + ibooker.setCurrentFolder(TopFolder_ + "/HitEffFromHitPattern" + (useInac ? "All" : "") + suffix); + + constexpr int LUMIBin = 300; // conf_->getParameter("LUMIBin"); + float LUMIMin = conf_->getParameter("LUMIMin"); + float LUMIMax = conf_->getParameter("LUMIMax"); + + int PVBin = conf_->getParameter("PVBin"); + float PVMin = conf_->getParameter("PVMin"); + float PVMax = conf_->getParameter("PVMax"); + + int NBINS[] = {PVBin, int(GetLumi::lastBunchCrossing), LUMIBin, LUMIBin}; + float MIN[] = {PVMin, 0.5, LUMIMin, LUMIMin}; + float MAX[] = {PVMax, float(GetLumi::lastBunchCrossing) + 0.5, LUMIMax, LUMIMax}; + std::string NAME[] = {"", "VsBX", "VsLUMI", "VsLUMI"}; + + auto logBins = makeLogBins(LUMIMin, LUMIMax); + + int mon = -1; + int nbins = -1; + float min = -1.; + float max = -1.; + bool logQ = false; + std::string name = ""; + for (int i = 0; i < monQuantity::END; i++) { + if (monName[i] == suffix) { + logQ = (i > 1); // VsLUMI + mon = i; + if (useInac) + mon += monQuantity::END; + nbins = NBINS[i]; + min = MIN[i]; + max = MAX[i]; + name = NAME[i]; } - - 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_%s_Subdet%d", name.c_str(), hit_category[cat], dets[det], sub_det); - switch(cat) { - case 0: - hits_valid_.insert(std::make_pair( - Key(det, sub_det, mon), logQ? - ibooker.book1D(title, title, nbins, &logBins[0]) : - ibooker.book1D(title, title, nbins, min, max))); - break; - case 4: - hits_total_.insert(std::make_pair( - Key(det, sub_det, mon), logQ? - ibooker.book1D(title, title, nbins, &logBins[0]) : - ibooker.book1D(title, title, nbins, min, max))); - break; - default: - LogDebug("TrackAnalyzer") << "Invalid hit category used " << cat << " ignored\n"; - } + 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_%s_Subdet%d", name.c_str(), hit_category[cat], dets[det], sub_det); + switch (cat) { + case 0: + hits_valid_.insert(std::make_pair(Key(det, sub_det, mon), + logQ ? ibooker.book1D(title, title, nbins, &logBins[0]) + : ibooker.book1D(title, title, nbins, min, max))); + break; + case 4: + hits_total_.insert(std::make_pair(Key(det, sub_det, mon), + logQ ? ibooker.book1D(title, title, nbins, &logBins[0]) + : ibooker.book1D(title, title, nbins, min, max))); + break; + default: + LogDebug("TrackAnalyzer") << "Invalid hit category used " << cat << " ignored\n"; } } } + } } #include "DataFormats/TrackReco/interface/TrajectoryStopReasons.h" -void TrackAnalyzer::bookHistosForHitProperties(DQMStore::IBooker & ibooker) { - - // parameters from the configuration - std::string QualName = conf_->getParameter("Quality"); - std::string AlgoName = conf_->getParameter("AlgoName"); - std::string MEBSFolderName = conf_->getParameter("BSFolderName"); +void TrackAnalyzer::bookHistosForHitProperties(DQMStore::IBooker& ibooker) { + // parameters from the configuration + std::string QualName = conf_->getParameter("Quality"); + std::string AlgoName = conf_->getParameter("AlgoName"); + std::string MEBSFolderName = conf_->getParameter("BSFolderName"); - // use the AlgoName and Quality Name - std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; + // use the AlgoName and Quality Name + std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; - // get binning from the configuration - int TKHitBin = conf_->getParameter( "RecHitBin"); - double TKHitMin = conf_->getParameter("RecHitMin"); - double TKHitMax = conf_->getParameter("RecHitMax"); + // get binning from the configuration + int TKHitBin = conf_->getParameter("RecHitBin"); + double TKHitMin = conf_->getParameter("RecHitMin"); + double TKHitMax = conf_->getParameter("RecHitMax"); - int TKLostBin = conf_->getParameter( "RecLostBin"); - double TKLostMin = conf_->getParameter("RecLostMin"); - double TKLostMax = conf_->getParameter("RecLostMax"); - - int TKLayBin = conf_->getParameter( "RecLayBin"); - double TKLayMin = conf_->getParameter("RecLayMin"); - double TKLayMax = conf_->getParameter("RecLayMax"); - - int PhiBin = conf_->getParameter( "PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); - - int EtaBin = conf_->getParameter( "EtaBin"); - double EtaMin = conf_->getParameter("EtaMin"); - double EtaMax = conf_->getParameter("EtaMax"); - - int PtBin = conf_->getParameter( "TrackPtBin"); - double PtMin = conf_->getParameter("TrackPtMin"); - double PtMax = conf_->getParameter("TrackPtMax"); - - int Phi2DBin = conf_->getParameter( "Phi2DBin"); - int Eta2DBin = conf_->getParameter( "Eta2DBin"); - int Pt2DBin = conf_->getParameter( "TrackPt2DBin"); - - int VXBin = conf_->getParameter( "VXBin"); - double VXMin = conf_->getParameter("VXMin"); - double VXMax = conf_->getParameter("VXMax"); - - int VYBin = conf_->getParameter( "VYBin"); - double VYMin = conf_->getParameter("VYMin"); - double VYMax = conf_->getParameter("VYMax"); - - int VZBin = conf_->getParameter( "VZBin"); - double VZMin = conf_->getParameter("VZMin"); - double VZMax = conf_->getParameter("VZMax"); - - ibooker.setCurrentFolder(TopFolder_); - - // book the Hit Property histograms - // ---------------------------------------------------------------------------------// - - TkParameterMEs tkmes; - if ( doHitPropertiesPlots_ || doAllPlots_ ){ - - ibooker.setCurrentFolder(TopFolder_+"/HitProperties"); - - histname = "NumberOfRecHitsPerTrack_"; - NumberOfRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax); - NumberOfRecHitsPerTrack->setAxisTitle("Number of all RecHits of each Track"); - NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfValidRecHitsPerTrack_"; - NumberOfValidRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax); - NumberOfValidRecHitsPerTrack->setAxisTitle("Number of valid RecHits for each Track"); - - NumberOfValidRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfLostRecHitsPerTrack_"; - NumberOfLostRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKLostBin, TKLostMin, TKLostMax); - NumberOfLostRecHitsPerTrack->setAxisTitle("Number of lost RecHits for each Track"); - NumberOfLostRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfMissingInnerRecHitsPerTrack_"; - NumberOfMIRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, 10, -0.5, 9.5); - NumberOfMIRecHitsPerTrack->setAxisTitle("Number of missing-inner RecHits for each Track"); - NumberOfMIRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfMissingOuterRecHitsPerTrack_"; - NumberOfMORecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, 10, -0.5, 9.5); - NumberOfMORecHitsPerTrack->setAxisTitle("Number of missing-outer RecHits for each Track"); - NumberOfMORecHitsPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "ValidFractionPerTrack_"; - ValidFractionPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, 101, 0., 1.01); - ValidFractionPerTrack->setAxisTitle("ValidFraction of RecHits for each Track"); - ValidFractionPerTrack->setAxisTitle("Number of Tracks", 2); - - - - if ( doRecHitVsPhiVsEtaPerTrack_ || doAllPlots_ ){ - - histname = "NumberOfValidRecHitVsPhiVsEtaPerTrack_"; - NumberOfValidRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, - Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax, 0, 40., ""); - NumberOfValidRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfValidRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); - - histname = "NumberOfLostRecHitVsPhiVsEtaPerTrack_"; - NumberOfLostRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, - Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax, 0, 5., ""); - NumberOfLostRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfLostRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); - - - histname = "NumberMIRecHitVsPhiVsEtaPerTrack_"; - NumberOfMIRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, - Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax, 0, 15., ""); - NumberOfMIRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfMIRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); + int TKLostBin = conf_->getParameter("RecLostBin"); + double TKLostMin = conf_->getParameter("RecLostMin"); + double TKLostMax = conf_->getParameter("RecLostMax"); - histname = "NumberMORecHitVsPhiVsEtaPerTrack_"; - NumberOfMORecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, - Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax, 0, 15., ""); - NumberOfMORecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfMORecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); + int TKLayBin = conf_->getParameter("RecLayBin"); + double TKLayMin = conf_->getParameter("RecLayMin"); + double TKLayMax = conf_->getParameter("RecLayMax"); - histname = "ValidFractionVsPhiVsEtaPerTrack_"; - ValidFractionVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, - Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax, 0, 2., ""); - ValidFractionVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - ValidFractionVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); + int PhiBin = conf_->getParameter("PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); - } + int EtaBin = conf_->getParameter("EtaBin"); + double EtaMin = conf_->getParameter("EtaMin"); + double EtaMax = conf_->getParameter("EtaMax"); - if ( doRecHitVsPtVsEtaPerTrack_ || doAllPlots_ ){ - - histname = "NumberOfValidRecHitVsPtVsEtaPerTrack_"; - NumberOfValidRecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, - Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 40., ""); - NumberOfValidRecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfValidRecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); - - histname = "NumberOfLostRecHitVsPtVsEtaPerTrack_"; - NumberOfLostRecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, - Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 5., ""); - NumberOfLostRecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfLostRecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); - - - histname = "NumberMIRecHitVsPtVsEtaPerTrack_"; - NumberOfMIRecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, - Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 15., ""); - NumberOfMIRecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfMIRecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); - - histname = "NumberMORecHitVsPtVsEtaPerTrack_"; - NumberOfMORecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, - Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 15., ""); - NumberOfMORecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); - NumberOfMORecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); + int PtBin = conf_->getParameter("TrackPtBin"); + double PtMin = conf_->getParameter("TrackPtMin"); + double PtMax = conf_->getParameter("TrackPtMax"); - } + int Phi2DBin = conf_->getParameter("Phi2DBin"); + int Eta2DBin = conf_->getParameter("Eta2DBin"); + int Pt2DBin = conf_->getParameter("TrackPt2DBin"); - histname = "NumberOfValidRecHitsPerTrackVsPt_"; - NumberOfValidRecHitsPerTrackVsPt = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PtBin, PtMin, PtMax, TKHitMin, TKHitMax,""); - NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]",1); - NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Number of valid RecHits in each Track",2); - - histname = "NumberOfLostRecHitsPerTrackVsPt_"; - NumberOfLostRecHitsPerTrackVsPt = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PtBin, PtMin, PtMax,TKHitMin, TKHitMax,""); - NumberOfLostRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); - NumberOfLostRecHitsPerTrackVsPt->setAxisTitle("Average Number of Lost RecHits per Track", 2); - - - histname = "NumberMIRecHitsPerTrackVsPt_"; - NumberOfMIRecHitsPerTrackVsPt = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PtBin, PtMin, PtMax,TKHitMin, TKHitMax,""); - NumberOfMIRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); - NumberOfMIRecHitsPerTrackVsPt->setAxisTitle("Average Number of Lost RecHits per Track", 2); - - histname = "NumberMORecHitsPerTrackVsPt_"; - NumberOfMORecHitsPerTrackVsPt = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PtBin, PtMin, PtMax,TKHitMin, TKHitMax,""); - NumberOfMORecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); - NumberOfMORecHitsPerTrackVsPt->setAxisTitle("Average Number of Lost RecHits per Track", 2); - - std::string layerTypeName[5] = {"","Off","3D","Missing","Pixel"}; - for (int i=0; i<4; ++i) { - histname = "NumberOf"+ layerTypeName[i] + "LayersPerTrack_"; - NumberOfLayersPerTrack[i] = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKLayBin, TKLayMin, TKLayMax); - NumberOfLayersPerTrack[i]->setAxisTitle("Number of " + layerTypeName[i] + " Layers of each Track", 1); - NumberOfLayersPerTrack[i]->setAxisTitle("Number of Tracks", 2); - } - if ( doLayersVsPhiVsEtaPerTrack_ || doAllPlots_ ) - for (int i=0; i<5; ++i) { - histname = "NumberOf"+ layerTypeName[i] + "LayersVsPhiVsEtaPerTrack_"; - NumberOfLayersVsPhiVsEtaPerTrack[i] = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName, - Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax, 0, 40., ""); - NumberOfLayersVsPhiVsEtaPerTrack[i]->setAxisTitle("Track #eta ", 1); - NumberOfLayersVsPhiVsEtaPerTrack[i]->setAxisTitle("Track #phi ", 2); - } - } + int VXBin = conf_->getParameter("VXBin"); + double VXMin = conf_->getParameter("VXMin"); + double VXMax = conf_->getParameter("VXMax"); - // book the General Property histograms - // ---------------------------------------------------------------------------------// - - if (doGeneralPropertiesPlots_ || doAllPlots_){ - - int Chi2Bin = conf_->getParameter( "Chi2Bin"); - double Chi2Min = conf_->getParameter("Chi2Min"); - double Chi2Max = conf_->getParameter("Chi2Max"); - - int Chi2NDFBin = conf_->getParameter( "Chi2NDFBin"); - double Chi2NDFMin = conf_->getParameter("Chi2NDFMin"); - double Chi2NDFMax = conf_->getParameter("Chi2NDFMax"); - - int Chi2ProbBin = conf_->getParameter( "Chi2ProbBin"); - double Chi2ProbMin = conf_->getParameter("Chi2ProbMin"); - double Chi2ProbMax = conf_->getParameter("Chi2ProbMax"); - - - //HI PLOTS//// - int TransDCABins = conf_->getParameter("TransDCABins"); - double TransDCAMin = conf_->getParameter("TransDCAMin"); - double TransDCAMax = conf_->getParameter("TransDCAMax"); - - int LongDCABins = conf_->getParameter("LongDCABins"); - double LongDCAMin = conf_->getParameter("LongDCAMin"); - double LongDCAMax = conf_->getParameter("LongDCAMax"); - /////////////////////////////////////////////////////////////////// - - - ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); - - histname = "Chi2_"; - Chi2 = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2Bin, Chi2Min, Chi2Max); - Chi2->setAxisTitle("Track #chi^{2}" ,1); - Chi2->setAxisTitle("Number of Tracks",2); - - histname = "Chi2Prob_"; - Chi2Prob = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2ProbBin, Chi2ProbMin, Chi2ProbMax); - Chi2Prob->setAxisTitle("Track #chi^{2} probability",1); - Chi2Prob->setAxisTitle("Number of Tracks" ,2); - - histname = "Chi2oNDF_"; - Chi2oNDF = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax); - Chi2oNDF->setAxisTitle("Track #chi^{2}/ndf",1); - Chi2oNDF->setAxisTitle("Number of Tracks" ,2); - - - ////////////// - //HI PLOTS/// - ////////////// - if (doHIPlots_) - { - histname = "LongDCASig_"; - LongDCASig = ibooker.book1D(histname+CategoryName, histname+CategoryName,LongDCABins,LongDCAMin,LongDCAMax); - LongDCASig->setAxisTitle("dz/#sigma_{dz}",1); - - histname = "TransDCASig_"; - TransDCASig = ibooker.book1D(histname+CategoryName,histname+CategoryName,TransDCABins,TransDCAMin,TransDCAMax); - TransDCASig->setAxisTitle("dxy/#sigma_{dxy}",1); - - histname = "dNdPhi_HighPurity_"; - dNdPhi_HighPurity = ibooker.book1D(histname+CategoryName,histname+CategoryName,PhiBin,PhiMin,PhiMax); - dNdPhi_HighPurity->setAxisTitle("#phi",1); - - histname = "dNdEta_HighPurity_"; - dNdEta_HighPurity = ibooker.book1D(histname+CategoryName,histname+CategoryName,EtaBin,EtaMin,EtaMax); - dNdEta_HighPurity->setAxisTitle("#eta",1); - - histname = "dNdPt_HighPurity_"; - dNdPt_HighPurity = ibooker.book1D(histname+CategoryName,histname+CategoryName,150,0,0.3); - dNdPt_HighPurity->setAxisTitle("#sigma_{p_{T}}/p_{T}",1); - - histname = "NhitVsEta_HighPurity_"; - NhitVsEta_HighPurity = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,EtaBin,EtaMin,EtaMax,-0.5,39.5,""); - NhitVsEta_HighPurity->setAxisTitle("Track #eta",1); - NhitVsEta_HighPurity->setAxisTitle("Number of Valid RecHits in each Track",2); - - histname = "NhitVsPhi_HighPurity_"; - NhitVsPhi_HighPurity = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,PhiBin,PhiMin,PhiMax,-0.5,39.5,""); - NhitVsPhi_HighPurity->setAxisTitle("Track #phi",1); - NhitVsPhi_HighPurity->setAxisTitle("Number of Valid RecHits in each Track",2); - - histname = "Ptdist_HighPurity_"; - Ptdist_HighPurity = ibooker.book1D(histname+CategoryName,histname+CategoryName,150,0,50.); - Ptdist_HighPurity->setAxisTitle("p_{T} (GeV/c)",1); - Ptdist_HighPurity->setAxisTitle("Number of Tracks",2); - - histname = "dNhitdPt_HighPurity_"; - dNhitdPt_HighPurity = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,150,0,25.,-0.5,39.5,""); - dNhitdPt_HighPurity->setAxisTitle("p_{T} (GeV/c)",1); - dNhitdPt_HighPurity->setAxisTitle("N_{hit}",2); - - } + int VYBin = conf_->getParameter("VYBin"); + double VYMin = conf_->getParameter("VYMin"); + double VYMax = conf_->getParameter("VYMax"); + int VZBin = conf_->getParameter("VZBin"); + double VZMin = conf_->getParameter("VZMin"); + double VZMax = conf_->getParameter("VZMax"); - - if(doDCAPlots_ || doPVPlots_ || doSIPPlots_ || doAllPlots_) { - histname = "xPointOfClosestApproach_"; - xPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VXBin, VXMin, VXMax); - xPointOfClosestApproach->setAxisTitle("x component of Track PCA to beam line (cm)",1); - xPointOfClosestApproach->setAxisTitle("Number of Tracks",2); - - histname = "yPointOfClosestApproach_"; - yPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VYBin, VYMin, VYMax); - yPointOfClosestApproach->setAxisTitle("y component of Track PCA to beam line (cm)",1); - yPointOfClosestApproach->setAxisTitle("Number of Tracks",2); - - histname = "zPointOfClosestApproach_"; - zPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VZBin, VZMin, VZMax); - zPointOfClosestApproach->setAxisTitle("z component of Track PCA to beam line (cm)",1); - zPointOfClosestApproach->setAxisTitle("Number of Tracks",2); - - histname = "xPointOfClosestApproachToPV_"; - xPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VXBin, VXMin, VXMax); - xPointOfClosestApproachToPV->setAxisTitle("x component of Track PCA to pv (cm)",1); - xPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2); - - histname = "yPointOfClosestApproachToPV_"; - yPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VYBin, VYMin, VYMax); - yPointOfClosestApproachToPV->setAxisTitle("y component of Track PCA to pv line (cm)",1); - yPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2); - - histname = "zPointOfClosestApproachToPV_"; - zPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VZBin, VZMin, VZMax); - zPointOfClosestApproachToPV->setAxisTitle("z component of Track PCA to pv line (cm)",1); - zPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2); - } + ibooker.setCurrentFolder(TopFolder_); - // See DataFormats/TrackReco/interface/TrackBase.h for track algorithm enum definition - // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/DataFormats/TrackReco/interface/TrackBase.h?view=log - histname = "algorithm_"; - algorithm = ibooker.book1D(histname+CategoryName, histname+CategoryName, reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize)); - algorithm->setAxisTitle("Tracking algorithm",1); - algorithm->setAxisTitle("Number of Tracks",2); - - histname = "originalAlgorithm_"; - oriAlgo = ibooker.book1D(histname+CategoryName, histname+CategoryName, reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize)); - oriAlgo->setAxisTitle("Tracking algorithm",1); - oriAlgo->setAxisTitle("Number of Tracks",2); - - for (size_t ibin=0; ibinsetBinLabel(ibin+1,reco::TrackBase::algoNames[ibin]); - oriAlgo->setBinLabel(ibin+1,reco::TrackBase::algoNames[ibin]); - } + // book the Hit Property histograms + // ---------------------------------------------------------------------------------// - size_t StopReasonNameSize = sizeof(StopReasonName::StopReasonName)/sizeof(std::string); - histname = "stoppingSource_"; - stoppingSource = ibooker.book1D(histname+CategoryName, histname+CategoryName, StopReasonNameSize, 0., double(StopReasonNameSize)); - stoppingSource->setAxisTitle("stopping reason",1); - stoppingSource->setAxisTitle("Number of Tracks",2); - - histname = "stoppingSourceVSeta_"; - stoppingSourceVSeta = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, - EtaBin, EtaMin, EtaMax, 2, 0., 2.); - stoppingSourceVSeta->setAxisTitle("track #eta",1); - stoppingSourceVSeta->setAxisTitle("stopped fraction",2); - - histname = "stoppingSourceVSphi_"; - stoppingSourceVSphi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, - PhiBin, PhiMin, PhiMax, 2, 0., 2.); - stoppingSourceVSphi->setAxisTitle("track #phi",1); - stoppingSourceVSphi->setAxisTitle("stopped fraction",2); - - for (size_t ibin=0; ibinsetBinLabel(ibin+1,StopReasonName::StopReasonName[ibin],1); + TkParameterMEs tkmes; + if (doHitPropertiesPlots_ || doAllPlots_) { + ibooker.setCurrentFolder(TopFolder_ + "/HitProperties"); + + histname = "NumberOfRecHitsPerTrack_"; + NumberOfRecHitsPerTrack = + ibooker.book1D(histname + CategoryName, histname + CategoryName, TKHitBin, TKHitMin, TKHitMax); + NumberOfRecHitsPerTrack->setAxisTitle("Number of all RecHits of each Track"); + NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfValidRecHitsPerTrack_"; + NumberOfValidRecHitsPerTrack = + ibooker.book1D(histname + CategoryName, histname + CategoryName, TKHitBin, TKHitMin, TKHitMax); + NumberOfValidRecHitsPerTrack->setAxisTitle("Number of valid RecHits for each Track"); + + NumberOfValidRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfLostRecHitsPerTrack_"; + NumberOfLostRecHitsPerTrack = + ibooker.book1D(histname + CategoryName, histname + CategoryName, TKLostBin, TKLostMin, TKLostMax); + NumberOfLostRecHitsPerTrack->setAxisTitle("Number of lost RecHits for each Track"); + NumberOfLostRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfMissingInnerRecHitsPerTrack_"; + NumberOfMIRecHitsPerTrack = ibooker.book1D(histname + CategoryName, histname + CategoryName, 10, -0.5, 9.5); + NumberOfMIRecHitsPerTrack->setAxisTitle("Number of missing-inner RecHits for each Track"); + NumberOfMIRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfMissingOuterRecHitsPerTrack_"; + NumberOfMORecHitsPerTrack = ibooker.book1D(histname + CategoryName, histname + CategoryName, 10, -0.5, 9.5); + NumberOfMORecHitsPerTrack->setAxisTitle("Number of missing-outer RecHits for each Track"); + NumberOfMORecHitsPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "ValidFractionPerTrack_"; + ValidFractionPerTrack = ibooker.book1D(histname + CategoryName, histname + CategoryName, 101, 0., 1.01); + ValidFractionPerTrack->setAxisTitle("ValidFraction of RecHits for each Track"); + ValidFractionPerTrack->setAxisTitle("Number of Tracks", 2); + + if (doRecHitVsPhiVsEtaPerTrack_ || doAllPlots_) { + histname = "NumberOfValidRecHitVsPhiVsEtaPerTrack_"; + NumberOfValidRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname + CategoryName, + histname + CategoryName, + Eta2DBin, + EtaMin, + EtaMax, + Phi2DBin, + PhiMin, + PhiMax, + 0, + 40., + ""); + NumberOfValidRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfValidRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); + + histname = "NumberOfLostRecHitVsPhiVsEtaPerTrack_"; + NumberOfLostRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname + CategoryName, + histname + CategoryName, + Eta2DBin, + EtaMin, + EtaMax, + Phi2DBin, + PhiMin, + PhiMax, + 0, + 5., + ""); + NumberOfLostRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfLostRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); + + histname = "NumberMIRecHitVsPhiVsEtaPerTrack_"; + NumberOfMIRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname + CategoryName, + histname + CategoryName, + Eta2DBin, + EtaMin, + EtaMax, + Phi2DBin, + PhiMin, + PhiMax, + 0, + 15., + ""); + NumberOfMIRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfMIRecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); + + histname = "NumberMORecHitVsPhiVsEtaPerTrack_"; + NumberOfMORecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname + CategoryName, + histname + CategoryName, + Eta2DBin, + EtaMin, + EtaMax, + Phi2DBin, + PhiMin, + PhiMax, + 0, + 15., + ""); + NumberOfMORecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfMORecHitVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); + + histname = "ValidFractionVsPhiVsEtaPerTrack_"; + ValidFractionVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname + CategoryName, + histname + CategoryName, + Eta2DBin, + EtaMin, + EtaMax, + Phi2DBin, + PhiMin, + PhiMax, + 0, + 2., + ""); + ValidFractionVsPhiVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + ValidFractionVsPhiVsEtaPerTrack->setAxisTitle("Track #phi ", 2); + } + + if (doRecHitVsPtVsEtaPerTrack_ || doAllPlots_) { + histname = "NumberOfValidRecHitVsPtVsEtaPerTrack_"; + NumberOfValidRecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D( + histname + CategoryName, histname + CategoryName, Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 40., ""); + NumberOfValidRecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfValidRecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); + + histname = "NumberOfLostRecHitVsPtVsEtaPerTrack_"; + NumberOfLostRecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D( + histname + CategoryName, histname + CategoryName, Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 5., ""); + NumberOfLostRecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfLostRecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); + + histname = "NumberMIRecHitVsPtVsEtaPerTrack_"; + NumberOfMIRecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D( + histname + CategoryName, histname + CategoryName, Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 15., ""); + NumberOfMIRecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfMIRecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); + + histname = "NumberMORecHitVsPtVsEtaPerTrack_"; + NumberOfMORecHitVsPtVsEtaPerTrack = ibooker.bookProfile2D( + histname + CategoryName, histname + CategoryName, Eta2DBin, EtaMin, EtaMax, Pt2DBin, PtMin, PtMax, 0, 15., ""); + NumberOfMORecHitVsPtVsEtaPerTrack->setAxisTitle("Track #eta ", 1); + NumberOfMORecHitVsPtVsEtaPerTrack->setAxisTitle("Track p_{T} [GeV] ", 2); + } + + histname = "NumberOfValidRecHitsPerTrackVsPt_"; + NumberOfValidRecHitsPerTrackVsPt = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, PtBin, PtMin, PtMax, TKHitMin, TKHitMax, ""); + NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); + NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Number of valid RecHits in each Track", 2); + + histname = "NumberOfLostRecHitsPerTrackVsPt_"; + NumberOfLostRecHitsPerTrackVsPt = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, PtBin, PtMin, PtMax, TKHitMin, TKHitMax, ""); + NumberOfLostRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); + NumberOfLostRecHitsPerTrackVsPt->setAxisTitle("Average Number of Lost RecHits per Track", 2); + + histname = "NumberMIRecHitsPerTrackVsPt_"; + NumberOfMIRecHitsPerTrackVsPt = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, PtBin, PtMin, PtMax, TKHitMin, TKHitMax, ""); + NumberOfMIRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); + NumberOfMIRecHitsPerTrackVsPt->setAxisTitle("Average Number of Lost RecHits per Track", 2); + + histname = "NumberMORecHitsPerTrackVsPt_"; + NumberOfMORecHitsPerTrackVsPt = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, PtBin, PtMin, PtMax, TKHitMin, TKHitMax, ""); + NumberOfMORecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); + NumberOfMORecHitsPerTrackVsPt->setAxisTitle("Average Number of Lost RecHits per Track", 2); + + std::string layerTypeName[5] = {"", "Off", "3D", "Missing", "Pixel"}; + for (int i = 0; i < 4; ++i) { + histname = "NumberOf" + layerTypeName[i] + "LayersPerTrack_"; + NumberOfLayersPerTrack[i] = + ibooker.book1D(histname + CategoryName, histname + CategoryName, TKLayBin, TKLayMin, TKLayMax); + NumberOfLayersPerTrack[i]->setAxisTitle("Number of " + layerTypeName[i] + " Layers of each Track", 1); + NumberOfLayersPerTrack[i]->setAxisTitle("Number of Tracks", 2); + } + if (doLayersVsPhiVsEtaPerTrack_ || doAllPlots_) + for (int i = 0; i < 5; ++i) { + histname = "NumberOf" + layerTypeName[i] + "LayersVsPhiVsEtaPerTrack_"; + NumberOfLayersVsPhiVsEtaPerTrack[i] = ibooker.bookProfile2D(histname + CategoryName, + histname + CategoryName, + Eta2DBin, + EtaMin, + EtaMax, + Phi2DBin, + PhiMin, + PhiMax, + 0, + 40., + ""); + NumberOfLayersVsPhiVsEtaPerTrack[i]->setAxisTitle("Track #eta ", 1); + NumberOfLayersVsPhiVsEtaPerTrack[i]->setAxisTitle("Track #phi ", 2); } + } + + // book the General Property histograms + // ---------------------------------------------------------------------------------// + + if (doGeneralPropertiesPlots_ || doAllPlots_) { + int Chi2Bin = conf_->getParameter("Chi2Bin"); + double Chi2Min = conf_->getParameter("Chi2Min"); + double Chi2Max = conf_->getParameter("Chi2Max"); + + int Chi2NDFBin = conf_->getParameter("Chi2NDFBin"); + double Chi2NDFMin = conf_->getParameter("Chi2NDFMin"); + double Chi2NDFMax = conf_->getParameter("Chi2NDFMax"); + int Chi2ProbBin = conf_->getParameter("Chi2ProbBin"); + double Chi2ProbMin = conf_->getParameter("Chi2ProbMin"); + double Chi2ProbMax = conf_->getParameter("Chi2ProbMax"); + + //HI PLOTS//// + int TransDCABins = conf_->getParameter("TransDCABins"); + double TransDCAMin = conf_->getParameter("TransDCAMin"); + double TransDCAMax = conf_->getParameter("TransDCAMax"); + + int LongDCABins = conf_->getParameter("LongDCABins"); + double LongDCAMin = conf_->getParameter("LongDCAMin"); + double LongDCAMax = conf_->getParameter("LongDCAMax"); + /////////////////////////////////////////////////////////////////// + + ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); + + histname = "Chi2_"; + Chi2 = ibooker.book1D(histname + CategoryName, histname + CategoryName, Chi2Bin, Chi2Min, Chi2Max); + Chi2->setAxisTitle("Track #chi^{2}", 1); + Chi2->setAxisTitle("Number of Tracks", 2); + + histname = "Chi2Prob_"; + Chi2Prob = ibooker.book1D(histname + CategoryName, histname + CategoryName, Chi2ProbBin, Chi2ProbMin, Chi2ProbMax); + Chi2Prob->setAxisTitle("Track #chi^{2} probability", 1); + Chi2Prob->setAxisTitle("Number of Tracks", 2); + + histname = "Chi2oNDF_"; + Chi2oNDF = ibooker.book1D(histname + CategoryName, histname + CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax); + Chi2oNDF->setAxisTitle("Track #chi^{2}/ndf", 1); + Chi2oNDF->setAxisTitle("Number of Tracks", 2); + + ////////////// + //HI PLOTS/// + ////////////// + if (doHIPlots_) { + histname = "LongDCASig_"; + LongDCASig = + ibooker.book1D(histname + CategoryName, histname + CategoryName, LongDCABins, LongDCAMin, LongDCAMax); + LongDCASig->setAxisTitle("dz/#sigma_{dz}", 1); + + histname = "TransDCASig_"; + TransDCASig = + ibooker.book1D(histname + CategoryName, histname + CategoryName, TransDCABins, TransDCAMin, TransDCAMax); + TransDCASig->setAxisTitle("dxy/#sigma_{dxy}", 1); + + histname = "dNdPhi_HighPurity_"; + dNdPhi_HighPurity = ibooker.book1D(histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax); + dNdPhi_HighPurity->setAxisTitle("#phi", 1); + + histname = "dNdEta_HighPurity_"; + dNdEta_HighPurity = ibooker.book1D(histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax); + dNdEta_HighPurity->setAxisTitle("#eta", 1); + + histname = "dNdPt_HighPurity_"; + dNdPt_HighPurity = ibooker.book1D(histname + CategoryName, histname + CategoryName, 150, 0, 0.3); + dNdPt_HighPurity->setAxisTitle("#sigma_{p_{T}}/p_{T}", 1); + + histname = "NhitVsEta_HighPurity_"; + NhitVsEta_HighPurity = + ibooker.bookProfile(histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, -0.5, 39.5, ""); + NhitVsEta_HighPurity->setAxisTitle("Track #eta", 1); + NhitVsEta_HighPurity->setAxisTitle("Number of Valid RecHits in each Track", 2); + + histname = "NhitVsPhi_HighPurity_"; + NhitVsPhi_HighPurity = + ibooker.bookProfile(histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, -0.5, 39.5, ""); + NhitVsPhi_HighPurity->setAxisTitle("Track #phi", 1); + NhitVsPhi_HighPurity->setAxisTitle("Number of Valid RecHits in each Track", 2); + + histname = "Ptdist_HighPurity_"; + Ptdist_HighPurity = ibooker.book1D(histname + CategoryName, histname + CategoryName, 150, 0, 50.); + Ptdist_HighPurity->setAxisTitle("p_{T} (GeV/c)", 1); + Ptdist_HighPurity->setAxisTitle("Number of Tracks", 2); + + histname = "dNhitdPt_HighPurity_"; + dNhitdPt_HighPurity = + ibooker.bookProfile(histname + CategoryName, histname + CategoryName, 150, 0, 25., -0.5, 39.5, ""); + dNhitdPt_HighPurity->setAxisTitle("p_{T} (GeV/c)", 1); + dNhitdPt_HighPurity->setAxisTitle("N_{hit}", 2); } + if (doDCAPlots_ || doPVPlots_ || doSIPPlots_ || doAllPlots_) { + histname = "xPointOfClosestApproach_"; + xPointOfClosestApproach = ibooker.book1D(histname + CategoryName, histname + CategoryName, VXBin, VXMin, VXMax); + xPointOfClosestApproach->setAxisTitle("x component of Track PCA to beam line (cm)", 1); + xPointOfClosestApproach->setAxisTitle("Number of Tracks", 2); + + histname = "yPointOfClosestApproach_"; + yPointOfClosestApproach = ibooker.book1D(histname + CategoryName, histname + CategoryName, VYBin, VYMin, VYMax); + yPointOfClosestApproach->setAxisTitle("y component of Track PCA to beam line (cm)", 1); + yPointOfClosestApproach->setAxisTitle("Number of Tracks", 2); + + histname = "zPointOfClosestApproach_"; + zPointOfClosestApproach = ibooker.book1D(histname + CategoryName, histname + CategoryName, VZBin, VZMin, VZMax); + zPointOfClosestApproach->setAxisTitle("z component of Track PCA to beam line (cm)", 1); + zPointOfClosestApproach->setAxisTitle("Number of Tracks", 2); + + histname = "xPointOfClosestApproachToPV_"; + xPointOfClosestApproachToPV = + ibooker.book1D(histname + CategoryName, histname + CategoryName, VXBin, VXMin, VXMax); + xPointOfClosestApproachToPV->setAxisTitle("x component of Track PCA to pv (cm)", 1); + xPointOfClosestApproachToPV->setAxisTitle("Number of Tracks", 2); + + histname = "yPointOfClosestApproachToPV_"; + yPointOfClosestApproachToPV = + ibooker.book1D(histname + CategoryName, histname + CategoryName, VYBin, VYMin, VYMax); + yPointOfClosestApproachToPV->setAxisTitle("y component of Track PCA to pv line (cm)", 1); + yPointOfClosestApproachToPV->setAxisTitle("Number of Tracks", 2); + + histname = "zPointOfClosestApproachToPV_"; + zPointOfClosestApproachToPV = + ibooker.book1D(histname + CategoryName, histname + CategoryName, VZBin, VZMin, VZMax); + zPointOfClosestApproachToPV->setAxisTitle("z component of Track PCA to pv line (cm)", 1); + zPointOfClosestApproachToPV->setAxisTitle("Number of Tracks", 2); + } + + // See DataFormats/TrackReco/interface/TrackBase.h for track algorithm enum definition + // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/DataFormats/TrackReco/interface/TrackBase.h?view=log + histname = "algorithm_"; + algorithm = ibooker.book1D(histname + CategoryName, + histname + CategoryName, + reco::TrackBase::algoSize, + 0., + double(reco::TrackBase::algoSize)); + algorithm->setAxisTitle("Tracking algorithm", 1); + algorithm->setAxisTitle("Number of Tracks", 2); + + histname = "originalAlgorithm_"; + oriAlgo = ibooker.book1D(histname + CategoryName, + histname + CategoryName, + reco::TrackBase::algoSize, + 0., + double(reco::TrackBase::algoSize)); + oriAlgo->setAxisTitle("Tracking algorithm", 1); + oriAlgo->setAxisTitle("Number of Tracks", 2); + + for (size_t ibin = 0; ibin < reco::TrackBase::algoSize - 1; ibin++) { + algorithm->setBinLabel(ibin + 1, reco::TrackBase::algoNames[ibin]); + oriAlgo->setBinLabel(ibin + 1, reco::TrackBase::algoNames[ibin]); + } + + size_t StopReasonNameSize = sizeof(StopReasonName::StopReasonName) / sizeof(std::string); + histname = "stoppingSource_"; + stoppingSource = ibooker.book1D( + histname + CategoryName, histname + CategoryName, StopReasonNameSize, 0., double(StopReasonNameSize)); + stoppingSource->setAxisTitle("stopping reason", 1); + stoppingSource->setAxisTitle("Number of Tracks", 2); + + histname = "stoppingSourceVSeta_"; + stoppingSourceVSeta = + ibooker.bookProfile(histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, 2, 0., 2.); + stoppingSourceVSeta->setAxisTitle("track #eta", 1); + stoppingSourceVSeta->setAxisTitle("stopped fraction", 2); + + histname = "stoppingSourceVSphi_"; + stoppingSourceVSphi = + ibooker.bookProfile(histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, 2, 0., 2.); + stoppingSourceVSphi->setAxisTitle("track #phi", 1); + stoppingSourceVSphi->setAxisTitle("stopped fraction", 2); + + for (size_t ibin = 0; ibin < StopReasonNameSize; ibin++) { + stoppingSource->setBinLabel(ibin + 1, StopReasonName::StopReasonName[ibin], 1); + } + } } -void TrackAnalyzer::bookHistosForLScertification(DQMStore::IBooker & ibooker) { +void TrackAnalyzer::bookHistosForLScertification(DQMStore::IBooker& ibooker) { + // parameters from the configuration + std::string QualName = conf_->getParameter("Quality"); + std::string AlgoName = conf_->getParameter("AlgoName"); - // parameters from the configuration - std::string QualName = conf_->getParameter("Quality"); - std::string AlgoName = conf_->getParameter("AlgoName"); + // use the AlgoName and Quality Name + std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; - // use the AlgoName and Quality Name - std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; + // book LS analysis related histograms + // ----------------------------------- + if (doLumiAnalysis_) { + // get binning from the configuration + int TKHitBin = conf_->getParameter("RecHitBin"); + double TKHitMin = conf_->getParameter("RecHitMin"); + double TKHitMax = conf_->getParameter("RecHitMax"); + int Chi2NDFBin = conf_->getParameter("Chi2NDFBin"); + double Chi2NDFMin = conf_->getParameter("Chi2NDFMin"); + double Chi2NDFMax = conf_->getParameter("Chi2NDFMax"); - // book LS analysis related histograms - // ----------------------------------- - if ( doLumiAnalysis_ ) { + // add by Mia in order to deal w/ LS transitions + ibooker.setCurrentFolder(TopFolder_ + "/LSanalysis"); - // get binning from the configuration - int TKHitBin = conf_->getParameter( "RecHitBin"); - double TKHitMin = conf_->getParameter("RecHitMin"); - double TKHitMax = conf_->getParameter("RecHitMax"); + histname = "NumberOfRecHitsPerTrack_lumiFlag_"; + NumberOfRecHitsPerTrack_lumiFlag = + ibooker.book1D(histname + CategoryName, histname + CategoryName, TKHitBin, TKHitMin, TKHitMax); + NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of all RecHits of each Track"); + NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of Tracks", 2); - int Chi2NDFBin = conf_->getParameter( "Chi2NDFBin"); - double Chi2NDFMin = conf_->getParameter("Chi2NDFMin"); - double Chi2NDFMax = conf_->getParameter("Chi2NDFMax"); + histname = "Chi2oNDF_lumiFlag_"; + Chi2oNDF_lumiFlag = + ibooker.book1D(histname + CategoryName, histname + CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax); + Chi2oNDF_lumiFlag->setAxisTitle("Track #chi^{2}/ndf", 1); + Chi2oNDF_lumiFlag->setAxisTitle("Number of Tracks", 2); + } +} - // add by Mia in order to deal w/ LS transitions - ibooker.setCurrentFolder(TopFolder_+"/LSanalysis"); +void TrackAnalyzer::bookHistosForBeamSpot(DQMStore::IBooker& ibooker) { + // parameters from the configuration + std::string QualName = conf_->getParameter("Quality"); + std::string AlgoName = conf_->getParameter("AlgoName"); - histname = "NumberOfRecHitsPerTrack_lumiFlag_"; - NumberOfRecHitsPerTrack_lumiFlag = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax); - NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of all RecHits of each Track"); - NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of Tracks", 2); + // use the AlgoName and Quality Name + std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; - histname = "Chi2oNDF_lumiFlag_"; - Chi2oNDF_lumiFlag = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax); - Chi2oNDF_lumiFlag->setAxisTitle("Track #chi^{2}/ndf",1); - Chi2oNDF_lumiFlag->setAxisTitle("Number of Tracks" ,2); + // book the Beam Spot related histograms + // ---------------------------------------------------------------------------------// - } -} + if (doDCAPlots_ || doBSPlots_ || doAllPlots_) { + int DxyErrBin = conf_->getParameter("DxyErrBin"); + double DxyErrMax = conf_->getParameter("DxyErrMax"); -void TrackAnalyzer::bookHistosForBeamSpot(DQMStore::IBooker & ibooker) { - - // parameters from the configuration - std::string QualName = conf_->getParameter("Quality"); - std::string AlgoName = conf_->getParameter("AlgoName"); - - // use the AlgoName and Quality Name - std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; - - // book the Beam Spot related histograms - // ---------------------------------------------------------------------------------// - - if(doDCAPlots_ || doBSPlots_ || doAllPlots_) { - - int DxyErrBin = conf_->getParameter( "DxyErrBin"); - double DxyErrMax = conf_->getParameter("DxyErrMax"); - - int DxyBin = conf_->getParameter( "DxyBin"); - double DxyMin = conf_->getParameter("DxyMin"); - double DxyMax = conf_->getParameter("DxyMax"); - - int AbsDxyBin = conf_->getParameter( "AbsDxyBin"); - double AbsDxyMin = conf_->getParameter("AbsDxyMin"); - double AbsDxyMax = conf_->getParameter("AbsDxyMax"); - - int PhiBin = conf_->getParameter( "PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); - - int EtaBin = conf_->getParameter( "EtaBin"); - double EtaMin = conf_->getParameter("EtaMin"); - double EtaMax = conf_->getParameter("EtaMax"); - - int PtBin = conf_->getParameter( "TrackPtBin"); - double PtMin = conf_->getParameter("TrackPtMin"); - double PtMax = conf_->getParameter("TrackPtMax"); - - int X0Bin = conf_->getParameter( "X0Bin"); - double X0Min = conf_->getParameter("X0Min"); - double X0Max = conf_->getParameter("X0Max"); - - int Y0Bin = conf_->getParameter( "Y0Bin"); - double Y0Min = conf_->getParameter("Y0Min"); - double Y0Max = conf_->getParameter("Y0Max"); - - int Z0Bin = conf_->getParameter( "Z0Bin"); - double Z0Min = conf_->getParameter("Z0Min"); - double Z0Max = conf_->getParameter("Z0Max"); - - int VZBinProf = conf_->getParameter( "VZBinProf"); - double VZMinProf = conf_->getParameter("VZMinProf"); - double VZMaxProf = conf_->getParameter("VZMaxProf"); - - - ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); - - histname = "DistanceOfClosestApproachError_"; - DistanceOfClosestApproachError = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyErrBin,0.,DxyErrMax); - DistanceOfClosestApproachError->setAxisTitle("Track d_{xy} error (cm)",1); - DistanceOfClosestApproachError->setAxisTitle("Number of Tracks",2); - - histname = "DistanceOfClosestApproachErrorVsPt_"; - DistanceOfClosestApproachErrorVsPt = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,PtBin,PtMin,PtMax,0.,DxyErrMax); - DistanceOfClosestApproachErrorVsPt->setAxisTitle("Track p_{T} (GeV)",1); - DistanceOfClosestApproachErrorVsPt->setAxisTitle("Track d_{xy} error (cm)",2); - - histname = "DistanceOfClosestApproachErrorVsEta_"; - DistanceOfClosestApproachErrorVsEta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,EtaBin,EtaMin,EtaMax,0.,DxyErrMax); - DistanceOfClosestApproachErrorVsEta->setAxisTitle("Track #eta",1); - DistanceOfClosestApproachErrorVsEta->setAxisTitle("Track d_{xy} error (cm)",2); - - histname = "DistanceOfClosestApproachErrorVsPhi_"; - DistanceOfClosestApproachErrorVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,PhiBin,PhiMin,PhiMax,0.,DxyErrMax); - DistanceOfClosestApproachErrorVsPhi->setAxisTitle("Track #phi",1); - DistanceOfClosestApproachErrorVsPhi->setAxisTitle("Track d_{xy} error (cm)",2); - - histname = "DistanceOfClosestApproachErrorVsDxy_"; - DistanceOfClosestApproachErrorVsDxy = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax,0.,DxyErrMax); - DistanceOfClosestApproachErrorVsDxy->setAxisTitle("Track d_{xy}",1); - DistanceOfClosestApproachErrorVsDxy->setAxisTitle("Track d_{xy} error (cm)",2); - - histname = "DistanceOfClosestApproachToBS_"; - DistanceOfClosestApproachToBS = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax); - DistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1); - DistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2); - - histname = "DistanceOfClosestApproachToBSdz_"; - DistanceOfClosestApproachToBSdz = ibooker.book1D(histname+CategoryName,histname+CategoryName,100,-1.1,1.1); - DistanceOfClosestApproachToBSdz->setAxisTitle("Track d_{z} wrt beam spot (cm)",1); - DistanceOfClosestApproachToBSdz->setAxisTitle("Number of Tracks",2); - - histname = "AbsDistanceOfClosestApproachToBS_"; - AbsDistanceOfClosestApproachToBS = ibooker.book1D(histname+CategoryName,histname+CategoryName,AbsDxyBin,AbsDxyMin,AbsDxyMax); - AbsDistanceOfClosestApproachToBS->setAxisTitle("Track |d_{xy}| wrt beam spot (cm)",1); - AbsDistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2); - - histname = "DistanceOfClosestApproachToBSVsPhi_"; - DistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,""); - DistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); - DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track #phi",1); - DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2); - - histname = "DistanceOfClosestApproachToBSVsEta_"; - DistanceOfClosestApproachToBSVsEta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, EtaBin, EtaMin, EtaMax, DxyBin, DxyMin, DxyMax,""); - DistanceOfClosestApproachToBSVsEta->getTH1()->SetCanExtend(TH1::kAllAxes); - DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track #eta",1); - DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2); - - histname = "xPointOfClosestApproachVsZ0wrt000_"; - xPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,""); - xPointOfClosestApproachVsZ0wrt000->setAxisTitle("d_{z} (cm)",1); - xPointOfClosestApproachVsZ0wrt000->setAxisTitle("x component of Track PCA to beam line (cm)",2); - - histname = "yPointOfClosestApproachVsZ0wrt000_"; - yPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,""); - yPointOfClosestApproachVsZ0wrt000->setAxisTitle("d_{z} (cm)",1); - yPointOfClosestApproachVsZ0wrt000->setAxisTitle("y component of Track PCA to beam line (cm)",2); - - histname = "xPointOfClosestApproachVsZ0wrtBS_"; - xPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,""); - xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1); - xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("x component of Track PCA to BS (cm)",2); - - histname = "yPointOfClosestApproachVsZ0wrtBS_"; - yPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,""); - yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1); - yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("y component of Track PCA to BS (cm)",2); - - histname = "zPointOfClosestApproachVsPhi_"; - zPointOfClosestApproachVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, VZBinProf, VZMinProf, VZMaxProf, ""); - zPointOfClosestApproachVsPhi->setAxisTitle("Track #phi",1); - zPointOfClosestApproachVsPhi->setAxisTitle("z component of Track PCA to beam line (cm)",2); - } - - if(doDCAPlots_ || doPVPlots_ || doAllPlots_) { - - int DxyBin = conf_->getParameter( "DxyBin"); - double DxyMin = conf_->getParameter("DxyMin"); - double DxyMax = conf_->getParameter("DxyMax"); - - int PhiBin = conf_->getParameter( "PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); - - int X0Bin = conf_->getParameter( "X0Bin"); - double X0Min = conf_->getParameter("X0Min"); - double X0Max = conf_->getParameter("X0Max"); - - int Y0Bin = conf_->getParameter( "Y0Bin"); - double Y0Min = conf_->getParameter("Y0Min"); - double Y0Max = conf_->getParameter("Y0Max"); - - int Z0Bin = conf_->getParameter( "Z0Bin"); - double Z0Min = conf_->getParameter("Z0Min"); - double Z0Max = conf_->getParameter("Z0Max"); - - ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); - - histname = "DistanceOfClosestApproachToPV_"; - DistanceOfClosestApproachToPV = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax); - DistanceOfClosestApproachToPV->setAxisTitle("Track d_{xy} w.r.t. PV (cm)",1); - DistanceOfClosestApproachToPV->setAxisTitle("Number of Tracks",2); - - histname = "DistanceOfClosestApproachToPVZoom_"; - DistanceOfClosestApproachToPVZoom = ibooker.book1D(histname+CategoryName,histname+CategoryName,100,-0.08,0.08); - DistanceOfClosestApproachToPVZoom->setAxisTitle("Track d_{xy} w.r.t. PV (cm)",1); - DistanceOfClosestApproachToPVZoom->setAxisTitle("Number of Tracks",2); - - - histname = "DeltaZToPV_"; - DeltaZToPV = ibooker.book1D(histname+CategoryName,histname+CategoryName,Z0Bin,Z0Min,Z0Max); - DeltaZToPV->setAxisTitle("Track d_{z} w.r.t. PV (cm)",1); - DeltaZToPV->setAxisTitle("Number of Tracks",2); - - histname = "DeltaZToPVZoom_"; - DeltaZToPVZoom = ibooker.book1D(histname+CategoryName,histname+CategoryName,100,-0.15,0.15); - DeltaZToPVZoom->setAxisTitle("Track d_{z} w.r.t. PV (cm)",1); - DeltaZToPVZoom->setAxisTitle("Number of Tracks",2); - - - histname = "DistanceOfClosestApproachToPVVsPhi_"; - DistanceOfClosestApproachToPVVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,""); - DistanceOfClosestApproachToPVVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); - DistanceOfClosestApproachToPVVsPhi->setAxisTitle("Track #phi",1); - DistanceOfClosestApproachToPVVsPhi->setAxisTitle("Track d_{xy} w.r.t. PV (cm)",2); - - histname = "xPointOfClosestApproachVsZ0wrtPV_"; - xPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,""); - xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. PV (cm)",1); - xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("x component of Track PCA to PV (cm)",2); - - histname = "yPointOfClosestApproachVsZ0wrtPV_"; - yPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,""); - yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. PV (cm)",1); - yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("y component of Track PCA to PV (cm)",2); - - } + int DxyBin = conf_->getParameter("DxyBin"); + double DxyMin = conf_->getParameter("DxyMin"); + double DxyMax = conf_->getParameter("DxyMax"); - if (doBSPlots_ || doAllPlots_) { - if (doTestPlots_) { - - int DxyBin = conf_->getParameter( "DxyBin"); - double DxyMin = conf_->getParameter("DxyMin"); - double DxyMax = conf_->getParameter("DxyMax"); - - int PhiBin = conf_->getParameter( "PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); - - histname = "TESTDistanceOfClosestApproachToBS_"; - TESTDistanceOfClosestApproachToBS = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax); - TESTDistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1); - TESTDistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2); - - histname = "TESTDistanceOfClosestApproachToBSVsPhi_"; - TESTDistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,""); - TESTDistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); - TESTDistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track #phi",1); - TESTDistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2); - - } - - } - - // book the Profile plots for DCA related histograms - // ---------------------------------------------------------------------------------// - if(doDCAPlots_ || doAllPlots_) { + int AbsDxyBin = conf_->getParameter("AbsDxyBin"); + double AbsDxyMin = conf_->getParameter("AbsDxyMin"); + double AbsDxyMax = conf_->getParameter("AbsDxyMax"); - if (doDCAwrt000Plots_) { + int PhiBin = conf_->getParameter("PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); - int EtaBin = conf_->getParameter( "EtaBin"); - double EtaMin = conf_->getParameter("EtaMin"); - double EtaMax = conf_->getParameter("EtaMax"); - - int PhiBin = conf_->getParameter( "PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); - - int DxyBin = conf_->getParameter( "DxyBin"); - double DxyMin = conf_->getParameter("DxyMin"); - double DxyMax = conf_->getParameter("DxyMax"); - - if (doThetaPlots_) { - int ThetaBin = conf_->getParameter( "ThetaBin"); - double ThetaMin = conf_->getParameter("ThetaMin"); - double ThetaMax = conf_->getParameter("ThetaMax"); - - ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); - histname = "DistanceOfClosestApproachVsTheta_"; - DistanceOfClosestApproachVsTheta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, ThetaBin, ThetaMin, ThetaMax, DxyMin,DxyMax,""); - DistanceOfClosestApproachVsTheta->setAxisTitle("Track #theta",1); - DistanceOfClosestApproachVsTheta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2); - } - - histname = "DistanceOfClosestApproachVsEta_"; - DistanceOfClosestApproachVsEta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, EtaBin, EtaMin, EtaMax, DxyMin, DxyMax,""); - DistanceOfClosestApproachVsEta->setAxisTitle("Track #eta",1); - DistanceOfClosestApproachVsEta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2); - // temporary patch in order to put back those MEs in Muon Workspace - - histname = "DistanceOfClosestApproach_"; - DistanceOfClosestApproach = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax); - DistanceOfClosestApproach->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",1); - DistanceOfClosestApproach->setAxisTitle("Number of Tracks",2); - - histname = "DistanceOfClosestApproachVsPhi_"; - DistanceOfClosestApproachVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyMin,DxyMax,""); - DistanceOfClosestApproachVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); - DistanceOfClosestApproachVsPhi->setAxisTitle("Track #phi",1); - DistanceOfClosestApproachVsPhi->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2); - } + int EtaBin = conf_->getParameter("EtaBin"); + double EtaMin = conf_->getParameter("EtaMin"); + double EtaMax = conf_->getParameter("EtaMax"); + + int PtBin = conf_->getParameter("TrackPtBin"); + double PtMin = conf_->getParameter("TrackPtMin"); + double PtMax = conf_->getParameter("TrackPtMax"); + + int X0Bin = conf_->getParameter("X0Bin"); + double X0Min = conf_->getParameter("X0Min"); + double X0Max = conf_->getParameter("X0Max"); + + int Y0Bin = conf_->getParameter("Y0Bin"); + double Y0Min = conf_->getParameter("Y0Min"); + double Y0Max = conf_->getParameter("Y0Max"); + + int Z0Bin = conf_->getParameter("Z0Bin"); + double Z0Min = conf_->getParameter("Z0Min"); + double Z0Max = conf_->getParameter("Z0Max"); + + int VZBinProf = conf_->getParameter("VZBinProf"); + double VZMinProf = conf_->getParameter("VZMinProf"); + double VZMaxProf = conf_->getParameter("VZMaxProf"); + + ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); + + histname = "DistanceOfClosestApproachError_"; + DistanceOfClosestApproachError = + ibooker.book1D(histname + CategoryName, histname + CategoryName, DxyErrBin, 0., DxyErrMax); + DistanceOfClosestApproachError->setAxisTitle("Track d_{xy} error (cm)", 1); + DistanceOfClosestApproachError->setAxisTitle("Number of Tracks", 2); + + histname = "DistanceOfClosestApproachErrorVsPt_"; + DistanceOfClosestApproachErrorVsPt = + ibooker.bookProfile(histname + CategoryName, histname + CategoryName, PtBin, PtMin, PtMax, 0., DxyErrMax); + DistanceOfClosestApproachErrorVsPt->setAxisTitle("Track p_{T} (GeV)", 1); + DistanceOfClosestApproachErrorVsPt->setAxisTitle("Track d_{xy} error (cm)", 2); + + histname = "DistanceOfClosestApproachErrorVsEta_"; + DistanceOfClosestApproachErrorVsEta = + ibooker.bookProfile(histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, 0., DxyErrMax); + DistanceOfClosestApproachErrorVsEta->setAxisTitle("Track #eta", 1); + DistanceOfClosestApproachErrorVsEta->setAxisTitle("Track d_{xy} error (cm)", 2); + + histname = "DistanceOfClosestApproachErrorVsPhi_"; + DistanceOfClosestApproachErrorVsPhi = + ibooker.bookProfile(histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, 0., DxyErrMax); + DistanceOfClosestApproachErrorVsPhi->setAxisTitle("Track #phi", 1); + DistanceOfClosestApproachErrorVsPhi->setAxisTitle("Track d_{xy} error (cm)", 2); + + histname = "DistanceOfClosestApproachErrorVsDxy_"; + DistanceOfClosestApproachErrorVsDxy = + ibooker.bookProfile(histname + CategoryName, histname + CategoryName, DxyBin, DxyMin, DxyMax, 0., DxyErrMax); + DistanceOfClosestApproachErrorVsDxy->setAxisTitle("Track d_{xy}", 1); + DistanceOfClosestApproachErrorVsDxy->setAxisTitle("Track d_{xy} error (cm)", 2); + + histname = "DistanceOfClosestApproachToBS_"; + DistanceOfClosestApproachToBS = + ibooker.book1D(histname + CategoryName, histname + CategoryName, DxyBin, DxyMin, DxyMax); + DistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 1); + DistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks", 2); + + histname = "DistanceOfClosestApproachToBSdz_"; + DistanceOfClosestApproachToBSdz = ibooker.book1D(histname + CategoryName, histname + CategoryName, 100, -1.1, 1.1); + DistanceOfClosestApproachToBSdz->setAxisTitle("Track d_{z} wrt beam spot (cm)", 1); + DistanceOfClosestApproachToBSdz->setAxisTitle("Number of Tracks", 2); + + histname = "AbsDistanceOfClosestApproachToBS_"; + AbsDistanceOfClosestApproachToBS = + ibooker.book1D(histname + CategoryName, histname + CategoryName, AbsDxyBin, AbsDxyMin, AbsDxyMax); + AbsDistanceOfClosestApproachToBS->setAxisTitle("Track |d_{xy}| wrt beam spot (cm)", 1); + AbsDistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks", 2); + + histname = "DistanceOfClosestApproachToBSVsPhi_"; + DistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax, ""); + DistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); + DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track #phi", 1); + DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 2); + + histname = "DistanceOfClosestApproachToBSVsEta_"; + DistanceOfClosestApproachToBSVsEta = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, DxyBin, DxyMin, DxyMax, ""); + DistanceOfClosestApproachToBSVsEta->getTH1()->SetCanExtend(TH1::kAllAxes); + DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track #eta", 1); + DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 2); + + histname = "xPointOfClosestApproachVsZ0wrt000_"; + xPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max, ""); + xPointOfClosestApproachVsZ0wrt000->setAxisTitle("d_{z} (cm)", 1); + xPointOfClosestApproachVsZ0wrt000->setAxisTitle("x component of Track PCA to beam line (cm)", 2); + + histname = "yPointOfClosestApproachVsZ0wrt000_"; + yPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max, ""); + yPointOfClosestApproachVsZ0wrt000->setAxisTitle("d_{z} (cm)", 1); + yPointOfClosestApproachVsZ0wrt000->setAxisTitle("y component of Track PCA to beam line (cm)", 2); + + histname = "xPointOfClosestApproachVsZ0wrtBS_"; + xPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max, ""); + xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)", 1); + xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("x component of Track PCA to BS (cm)", 2); + + histname = "yPointOfClosestApproachVsZ0wrtBS_"; + yPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max, ""); + yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)", 1); + yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("y component of Track PCA to BS (cm)", 2); + + histname = "zPointOfClosestApproachVsPhi_"; + zPointOfClosestApproachVsPhi = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, VZBinProf, VZMinProf, VZMaxProf, ""); + zPointOfClosestApproachVsPhi->setAxisTitle("Track #phi", 1); + zPointOfClosestApproachVsPhi->setAxisTitle("z component of Track PCA to beam line (cm)", 2); + } + + if (doDCAPlots_ || doPVPlots_ || doAllPlots_) { + int DxyBin = conf_->getParameter("DxyBin"); + double DxyMin = conf_->getParameter("DxyMin"); + double DxyMax = conf_->getParameter("DxyMax"); + + int PhiBin = conf_->getParameter("PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); + + int X0Bin = conf_->getParameter("X0Bin"); + double X0Min = conf_->getParameter("X0Min"); + double X0Max = conf_->getParameter("X0Max"); + + int Y0Bin = conf_->getParameter("Y0Bin"); + double Y0Min = conf_->getParameter("Y0Min"); + double Y0Max = conf_->getParameter("Y0Max"); + + int Z0Bin = conf_->getParameter("Z0Bin"); + double Z0Min = conf_->getParameter("Z0Min"); + double Z0Max = conf_->getParameter("Z0Max"); + + ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); + + histname = "DistanceOfClosestApproachToPV_"; + DistanceOfClosestApproachToPV = + ibooker.book1D(histname + CategoryName, histname + CategoryName, DxyBin, DxyMin, DxyMax); + DistanceOfClosestApproachToPV->setAxisTitle("Track d_{xy} w.r.t. PV (cm)", 1); + DistanceOfClosestApproachToPV->setAxisTitle("Number of Tracks", 2); + + histname = "DistanceOfClosestApproachToPVZoom_"; + DistanceOfClosestApproachToPVZoom = + ibooker.book1D(histname + CategoryName, histname + CategoryName, 100, -0.08, 0.08); + DistanceOfClosestApproachToPVZoom->setAxisTitle("Track d_{xy} w.r.t. PV (cm)", 1); + DistanceOfClosestApproachToPVZoom->setAxisTitle("Number of Tracks", 2); + + histname = "DeltaZToPV_"; + DeltaZToPV = ibooker.book1D(histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max); + DeltaZToPV->setAxisTitle("Track d_{z} w.r.t. PV (cm)", 1); + DeltaZToPV->setAxisTitle("Number of Tracks", 2); + + histname = "DeltaZToPVZoom_"; + DeltaZToPVZoom = ibooker.book1D(histname + CategoryName, histname + CategoryName, 100, -0.15, 0.15); + DeltaZToPVZoom->setAxisTitle("Track d_{z} w.r.t. PV (cm)", 1); + DeltaZToPVZoom->setAxisTitle("Number of Tracks", 2); + + histname = "DistanceOfClosestApproachToPVVsPhi_"; + DistanceOfClosestApproachToPVVsPhi = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax, ""); + DistanceOfClosestApproachToPVVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); + DistanceOfClosestApproachToPVVsPhi->setAxisTitle("Track #phi", 1); + DistanceOfClosestApproachToPVVsPhi->setAxisTitle("Track d_{xy} w.r.t. PV (cm)", 2); + + histname = "xPointOfClosestApproachVsZ0wrtPV_"; + xPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max, ""); + xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. PV (cm)", 1); + xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("x component of Track PCA to PV (cm)", 2); + + histname = "yPointOfClosestApproachVsZ0wrtPV_"; + yPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max, ""); + yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. PV (cm)", 1); + yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("y component of Track PCA to PV (cm)", 2); + } + + if (doBSPlots_ || doAllPlots_) { + if (doTestPlots_) { + int DxyBin = conf_->getParameter("DxyBin"); + double DxyMin = conf_->getParameter("DxyMin"); + double DxyMax = conf_->getParameter("DxyMax"); + + int PhiBin = conf_->getParameter("PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); + + histname = "TESTDistanceOfClosestApproachToBS_"; + TESTDistanceOfClosestApproachToBS = + ibooker.book1D(histname + CategoryName, histname + CategoryName, DxyBin, DxyMin, DxyMax); + TESTDistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 1); + TESTDistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks", 2); + + histname = "TESTDistanceOfClosestApproachToBSVsPhi_"; + TESTDistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax, ""); + TESTDistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); + TESTDistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track #phi", 1); + TESTDistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 2); } + } + + // book the Profile plots for DCA related histograms + // ---------------------------------------------------------------------------------// + if (doDCAPlots_ || doAllPlots_) { + if (doDCAwrt000Plots_) { + int EtaBin = conf_->getParameter("EtaBin"); + double EtaMin = conf_->getParameter("EtaMin"); + double EtaMax = conf_->getParameter("EtaMax"); + int PhiBin = conf_->getParameter("PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); - if (doSIPPlots_ || doAllPlots_) { - const double sipBins = 200; - const double sipMin = -20; - const double sipMax = 20; - - ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); - - // SIP wrt. beamspot - histname = "SIPDxyToBS_"; - sipDxyToBS = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax); - sipDxyToBS->setAxisTitle("Track dxy significance wrt beam spot",1); - sipDxyToBS->setAxisTitle("Number of Tracks",2); - - histname = "SIPDzToBS_"; - sipDzToBS = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax); - sipDzToBS->setAxisTitle("Track dz significance wrt beam spot",1); - sipDzToBS->setAxisTitle("Number of Tracks",2); - - // SIP wrt. vertex - histname = "SIP3DToPV_"; - sip3dToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax); - sip3dToPV->setAxisTitle("3D IP significance wrt primary vertex",1); - sip3dToPV->setAxisTitle("Number of Tracks",2); - - histname = "SIP2DToPV_"; - sip2dToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax); - sip2dToPV->setAxisTitle("2D IP significance wrt primary vertex",1); - sip2dToPV->setAxisTitle("Number of Tracks",2); - - histname = "SIPDxyToPV_"; - sipDxyToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax); - sipDxyToPV->setAxisTitle("Track dxy significance wrt primary vertex",1); - sipDxyToPV->setAxisTitle("Number of Tracks",2); - - histname = "SIPDzToPV_"; - sipDzToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax); - sipDzToPV->setAxisTitle("Track dz significance wrt primary vertex",1); - sipDzToPV->setAxisTitle("Number of Tracks",2); + int DxyBin = conf_->getParameter("DxyBin"); + double DxyMin = conf_->getParameter("DxyMin"); + double DxyMax = conf_->getParameter("DxyMax"); + + if (doThetaPlots_) { + int ThetaBin = conf_->getParameter("ThetaBin"); + double ThetaMin = conf_->getParameter("ThetaMin"); + double ThetaMax = conf_->getParameter("ThetaMax"); + + ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); + histname = "DistanceOfClosestApproachVsTheta_"; + DistanceOfClosestApproachVsTheta = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, ThetaBin, ThetaMin, ThetaMax, DxyMin, DxyMax, ""); + DistanceOfClosestApproachVsTheta->setAxisTitle("Track #theta", 1); + DistanceOfClosestApproachVsTheta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)", 2); + } + + histname = "DistanceOfClosestApproachVsEta_"; + DistanceOfClosestApproachVsEta = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, DxyMin, DxyMax, ""); + DistanceOfClosestApproachVsEta->setAxisTitle("Track #eta", 1); + DistanceOfClosestApproachVsEta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)", 2); + // temporary patch in order to put back those MEs in Muon Workspace + + histname = "DistanceOfClosestApproach_"; + DistanceOfClosestApproach = + ibooker.book1D(histname + CategoryName, histname + CategoryName, DxyBin, DxyMin, DxyMax); + DistanceOfClosestApproach->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)", 1); + DistanceOfClosestApproach->setAxisTitle("Number of Tracks", 2); + + histname = "DistanceOfClosestApproachVsPhi_"; + DistanceOfClosestApproachVsPhi = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, DxyMin, DxyMax, ""); + DistanceOfClosestApproachVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes); + DistanceOfClosestApproachVsPhi->setAxisTitle("Track #phi", 1); + DistanceOfClosestApproachVsPhi->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)", 2); } + } + + if (doSIPPlots_ || doAllPlots_) { + const double sipBins = 200; + const double sipMin = -20; + const double sipMax = 20; + + ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); + + // SIP wrt. beamspot + histname = "SIPDxyToBS_"; + sipDxyToBS = ibooker.book1D(histname + CategoryName, histname + CategoryName, sipBins, sipMin, sipMax); + sipDxyToBS->setAxisTitle("Track dxy significance wrt beam spot", 1); + sipDxyToBS->setAxisTitle("Number of Tracks", 2); + + histname = "SIPDzToBS_"; + sipDzToBS = ibooker.book1D(histname + CategoryName, histname + CategoryName, sipBins, sipMin, sipMax); + sipDzToBS->setAxisTitle("Track dz significance wrt beam spot", 1); + sipDzToBS->setAxisTitle("Number of Tracks", 2); + + // SIP wrt. vertex + histname = "SIP3DToPV_"; + sip3dToPV = ibooker.book1D(histname + CategoryName, histname + CategoryName, sipBins, sipMin, sipMax); + sip3dToPV->setAxisTitle("3D IP significance wrt primary vertex", 1); + sip3dToPV->setAxisTitle("Number of Tracks", 2); + + histname = "SIP2DToPV_"; + sip2dToPV = ibooker.book1D(histname + CategoryName, histname + CategoryName, sipBins, sipMin, sipMax); + sip2dToPV->setAxisTitle("2D IP significance wrt primary vertex", 1); + sip2dToPV->setAxisTitle("Number of Tracks", 2); + + histname = "SIPDxyToPV_"; + sipDxyToPV = ibooker.book1D(histname + CategoryName, histname + CategoryName, sipBins, sipMin, sipMax); + sipDxyToPV->setAxisTitle("Track dxy significance wrt primary vertex", 1); + sipDxyToPV->setAxisTitle("Number of Tracks", 2); + + histname = "SIPDzToPV_"; + sipDzToPV = ibooker.book1D(histname + CategoryName, histname + CategoryName, sipBins, sipMin, sipMax); + sipDzToPV->setAxisTitle("Track dz significance wrt primary vertex", 1); + sipDzToPV->setAxisTitle("Number of Tracks", 2); + } } // -- Analyse // ---------------------------------------------------------------------------------// -void TrackAnalyzer::setNumberOfGoodVertices(const edm::Event & iEvent) { - +void TrackAnalyzer::setNumberOfGoodVertices(const edm::Event& iEvent) { good_vertices_ = 0; - + edm::Handle recoPrimaryVerticesHandle; iEvent.getByToken(pvToken_, recoPrimaryVerticesHandle); if (recoPrimaryVerticesHandle.isValid()) @@ -1050,26 +1104,23 @@ void TrackAnalyzer::setNumberOfGoodVertices(const edm::Event & iEvent) { ++good_vertices_; } -void TrackAnalyzer::setBX(const edm::Event & iEvent) { - bx_ = iEvent.bunchCrossing(); -} +void TrackAnalyzer::setBX(const edm::Event& iEvent) { bx_ = iEvent.bunchCrossing(); } #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -void TrackAnalyzer::setLumi(const edm::Event & iEvent, const edm::EventSetup& iSetup) { +void TrackAnalyzer::setLumi(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // as done by pixelLumi http://cmslxr.fnal.gov/source/DQM/PixelLumi/plugins/PixelLumiDQM.cc edm::Handle lumiScalers; iEvent.getByToken(lumiscalersToken_, lumiScalers); - if ( lumiScalers.isValid() && !lumiScalers->empty() ) { + if (lumiScalers.isValid() && !lumiScalers->empty()) { LumiScalersCollection::const_iterator scalit = lumiScalers->begin(); scal_lumi_ = scalit->instantLumi(); - } else + } else scal_lumi_ = -1; - edm::Handle< edmNew::DetSetVector > pixelClusters; + edm::Handle > pixelClusters; iEvent.getByToken(pixelClustersToken_, pixelClusters); - if ( pixelClusters.isValid() ) { - + if (pixelClusters.isValid()) { edm::ESHandle tTopoHandle; iSetup.get().get(tTopoHandle); const TrackerTopology* const tTopo = tTopoHandle.product(); @@ -1079,116 +1130,116 @@ void TrackAnalyzer::setLumi(const edm::Event & iEvent, const edm::EventSetup& iS size_t numClusters = 0; size_t tot = 0; - edmNew::DetSetVector::const_iterator pixCluDet = pixelClusters->begin(); - for ( ; pixCluDet!=pixelClusters->end(); ++pixCluDet) { - + edmNew::DetSetVector::const_iterator pixCluDet = pixelClusters->begin(); + for (; pixCluDet != pixelClusters->end(); ++pixCluDet) { DetId detid = pixCluDet->detId(); size_t subdetid = detid.subdetId(); // std::cout << tTopo->print(detid) << std::endl; - if ( subdetid == (int) PixelSubdetector::PixelBarrel ) - if ( tTopo->layer(detid)==1 ) - continue; - - edmNew::DetSet::const_iterator pixClu = pixCluDet->begin(); - for ( ; pixClu != pixCluDet->end(); ++pixClu ) { - ++tot; - if ( (pixClu->size() >= minNumberOfPixelsPerCluster_) && - (pixClu->charge() >= minPixelClusterCharge_ ) ) { - ++numClusters; - } + if (subdetid == (int)PixelSubdetector::PixelBarrel) + if (tTopo->layer(detid) == 1) + continue; + + edmNew::DetSet::const_iterator pixClu = pixCluDet->begin(); + for (; pixClu != pixCluDet->end(); ++pixClu) { + ++tot; + if ((pixClu->size() >= minNumberOfPixelsPerCluster_) && (pixClu->charge() >= minPixelClusterCharge_)) { + ++numClusters; + } } } - pixel_lumi_ = lumi_factor_per_bx_ * numClusters / GetLumi::CM2_TO_NANOBARN ; // ?!?! + pixel_lumi_ = lumi_factor_per_bx_ * numClusters / GetLumi::CM2_TO_NANOBARN; // ?!?! } else pixel_lumi_ = -1.; - } -void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track) -{ - auto pt = track.pt(); - auto phi = track.phi(); +void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track) { + auto pt = track.pt(); + auto phi = track.phi(); // double eta = track.eta(); - auto phiIn = track.innerPosition().phi(); - auto etaIn = track.innerPosition().eta(); - auto phiOut = track.outerPosition().phi(); - auto etaOut = track.outerPosition().eta(); + auto phiIn = track.innerPosition().phi(); + auto etaIn = track.innerPosition().eta(); + auto phiOut = track.outerPosition().phi(); + auto etaOut = track.outerPosition().eta(); - int nRecHits = track.hitPattern().numberOfAllHits(reco::HitPattern::TRACK_HITS); + int nRecHits = track.hitPattern().numberOfAllHits(reco::HitPattern::TRACK_HITS); int nValidRecHits = track.numberOfValidHits(); - int nLostRecHits = track.numberOfLostHits(); - int nLostIn = track.hitPattern().numberOfLostTrackerHits(reco::HitPattern::MISSING_INNER_HITS); - int nLostOut = track.hitPattern().numberOfLostTrackerHits(reco::HitPattern::MISSING_OUTER_HITS); + int nLostRecHits = track.numberOfLostHits(); + int nLostIn = track.hitPattern().numberOfLostTrackerHits(reco::HitPattern::MISSING_INNER_HITS); + int nLostOut = track.hitPattern().numberOfLostTrackerHits(reco::HitPattern::MISSING_OUTER_HITS); - auto chi2 = track.chi2(); - auto chi2prob = TMath::Prob(track.chi2(),(int)track.ndof()); + auto chi2 = track.chi2(); + auto chi2prob = TMath::Prob(track.chi2(), (int)track.ndof()); auto chi2oNDF = track.normalizedChi2(); - - if ( doHitPropertiesPlots_ || doAllPlots_ ){ + + if (doHitPropertiesPlots_ || doAllPlots_) { // rec hits - NumberOfRecHitsPerTrack -> Fill(nRecHits); - NumberOfValidRecHitsPerTrack-> Fill(nValidRecHits); - NumberOfLostRecHitsPerTrack -> Fill(nLostRecHits); - NumberOfMIRecHitsPerTrack -> Fill(nLostIn); - NumberOfMORecHitsPerTrack -> Fill(nLostOut); - ValidFractionPerTrack -> Fill(track.validFraction()); - - - // 2D plots - if ( doRecHitVsPhiVsEtaPerTrack_ || doAllPlots_ ) { - NumberOfValidRecHitVsPhiVsEtaPerTrack->Fill(etaIn,phiIn,nValidRecHits); - NumberOfLostRecHitVsPhiVsEtaPerTrack->Fill(etaIn,phiIn,nLostRecHits); - NumberOfMIRecHitVsPhiVsEtaPerTrack->Fill(etaIn,phiIn,nLostIn); - NumberOfMORecHitVsPhiVsEtaPerTrack->Fill(etaOut,phiOut,nLostOut); - ValidFractionVsPhiVsEtaPerTrack -> Fill(etaIn,phiIn,track.validFraction()); + NumberOfRecHitsPerTrack->Fill(nRecHits); + NumberOfValidRecHitsPerTrack->Fill(nValidRecHits); + NumberOfLostRecHitsPerTrack->Fill(nLostRecHits); + NumberOfMIRecHitsPerTrack->Fill(nLostIn); + NumberOfMORecHitsPerTrack->Fill(nLostOut); + ValidFractionPerTrack->Fill(track.validFraction()); + + // 2D plots + if (doRecHitVsPhiVsEtaPerTrack_ || doAllPlots_) { + NumberOfValidRecHitVsPhiVsEtaPerTrack->Fill(etaIn, phiIn, nValidRecHits); + NumberOfLostRecHitVsPhiVsEtaPerTrack->Fill(etaIn, phiIn, nLostRecHits); + NumberOfMIRecHitVsPhiVsEtaPerTrack->Fill(etaIn, phiIn, nLostIn); + NumberOfMORecHitVsPhiVsEtaPerTrack->Fill(etaOut, phiOut, nLostOut); + ValidFractionVsPhiVsEtaPerTrack->Fill(etaIn, phiIn, track.validFraction()); } - if ( doRecHitVsPtVsEtaPerTrack_ || doAllPlots_ ) { - NumberOfValidRecHitVsPtVsEtaPerTrack->Fill(etaIn,pt,nValidRecHits); - NumberOfLostRecHitVsPtVsEtaPerTrack->Fill(etaIn,pt,nLostRecHits); - NumberOfMIRecHitVsPtVsEtaPerTrack->Fill(etaIn,pt,nLostIn); - NumberOfMORecHitVsPtVsEtaPerTrack->Fill(etaOut,pt,nLostOut); + if (doRecHitVsPtVsEtaPerTrack_ || doAllPlots_) { + NumberOfValidRecHitVsPtVsEtaPerTrack->Fill(etaIn, pt, nValidRecHits); + NumberOfLostRecHitVsPtVsEtaPerTrack->Fill(etaIn, pt, nLostRecHits); + NumberOfMIRecHitVsPtVsEtaPerTrack->Fill(etaIn, pt, nLostIn); + NumberOfMORecHitVsPtVsEtaPerTrack->Fill(etaOut, pt, nLostOut); } - NumberOfValidRecHitsPerTrackVsPt->Fill(pt,nValidRecHits); - NumberOfLostRecHitsPerTrackVsPt->Fill(pt,nLostRecHits); - NumberOfMIRecHitsPerTrackVsPt->Fill(pt,nLostIn); - NumberOfMORecHitsPerTrackVsPt->Fill(pt,nLostOut); - - int nLayers[5] = { track.hitPattern().trackerLayersWithMeasurement(), - track.hitPattern().trackerLayersTotallyOffOrBad(), - track.hitPattern().numberOfValidStripLayersWithMonoAndStereo() + track.hitPattern().pixelLayersWithMeasurement(), - track.hitPattern().trackerLayersWithoutMeasurement(reco::HitPattern::TRACK_HITS), - track.hitPattern().pixelLayersWithMeasurement() - }; + NumberOfValidRecHitsPerTrackVsPt->Fill(pt, nValidRecHits); + NumberOfLostRecHitsPerTrackVsPt->Fill(pt, nLostRecHits); + NumberOfMIRecHitsPerTrackVsPt->Fill(pt, nLostIn); + NumberOfMORecHitsPerTrackVsPt->Fill(pt, nLostOut); + + int nLayers[5] = {track.hitPattern().trackerLayersWithMeasurement(), + track.hitPattern().trackerLayersTotallyOffOrBad(), + track.hitPattern().numberOfValidStripLayersWithMonoAndStereo() + + track.hitPattern().pixelLayersWithMeasurement(), + track.hitPattern().trackerLayersWithoutMeasurement(reco::HitPattern::TRACK_HITS), + track.hitPattern().pixelLayersWithMeasurement()}; // layers - for (int i=0;i<4;++i) NumberOfLayersPerTrack[i]->Fill(nLayers[i]); - - // 2D plots - if ( doLayersVsPhiVsEtaPerTrack_ || doAllPlots_ ) - for (int i=0;i<5;++i) NumberOfLayersVsPhiVsEtaPerTrack[i]->Fill(etaIn,phiIn,nLayers[i]); + for (int i = 0; i < 4; ++i) + NumberOfLayersPerTrack[i]->Fill(nLayers[i]); + // 2D plots + if (doLayersVsPhiVsEtaPerTrack_ || doAllPlots_) + for (int i = 0; i < 5; ++i) + NumberOfLayersVsPhiVsEtaPerTrack[i]->Fill(etaIn, phiIn, nLayers[i]); } - if (doEffFromHitPatternVsPU_ || doAllPlots_) fillHistosForEfficiencyFromHitPatter(track,"", float(good_vertices_), false ); - if (doEffFromHitPatternVsBX_ || doAllPlots_) fillHistosForEfficiencyFromHitPatter(track,"VsBX", float(bx_), false ); - if (doEffFromHitPatternVsLUMI_ || doAllPlots_) fillHistosForEfficiencyFromHitPatter(track,"VsSCALLUMI", scal_lumi_, false ); + if (doEffFromHitPatternVsPU_ || doAllPlots_) + fillHistosForEfficiencyFromHitPatter(track, "", float(good_vertices_), false); + if (doEffFromHitPatternVsBX_ || doAllPlots_) + fillHistosForEfficiencyFromHitPatter(track, "VsBX", float(bx_), false); + if (doEffFromHitPatternVsLUMI_ || doAllPlots_) + fillHistosForEfficiencyFromHitPatter(track, "VsSCALLUMI", scal_lumi_, false); // if (doEffFromHitPatternVsLUMI_ || doAllPlots_) fillHistosForEfficiencyFromHitPatter(track,"VsPIXELLUMI", pixel_lumi_ ); - if (doEffFromHitPatternVsPU_ || doAllPlots_) fillHistosForEfficiencyFromHitPatter(track,"", float(good_vertices_), true ); - if (doEffFromHitPatternVsLUMI_ || doAllPlots_) fillHistosForEfficiencyFromHitPatter(track,"VsSCALLUMI", scal_lumi_, true ); + if (doEffFromHitPatternVsPU_ || doAllPlots_) + fillHistosForEfficiencyFromHitPatter(track, "", float(good_vertices_), true); + if (doEffFromHitPatternVsLUMI_ || doAllPlots_) + fillHistosForEfficiencyFromHitPatter(track, "VsSCALLUMI", scal_lumi_, true); - - if (doGeneralPropertiesPlots_ || doAllPlots_){ + if (doGeneralPropertiesPlots_ || doAllPlots_) { // fitting - Chi2 -> Fill(chi2); - Chi2Prob -> Fill(chi2prob); - Chi2oNDF -> Fill(chi2oNDF); + Chi2->Fill(chi2); + Chi2Prob->Fill(chi2prob); + Chi2oNDF->Fill(chi2oNDF); // DCA - // temporary patch in order to put back those MEs in Muon Workspace + // temporary patch in order to put back those MEs in Muon Workspace if (doDCAPlots_) { if (doDCAwrt000Plots_) { - DistanceOfClosestApproach->Fill(track.dxy()); - DistanceOfClosestApproachVsPhi->Fill(phi, track.dxy()); + DistanceOfClosestApproach->Fill(track.dxy()); + DistanceOfClosestApproachVsPhi->Fill(phi, track.dxy()); } // PCA @@ -1203,1143 +1254,1181 @@ void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe // stopping source int max = stoppingSource->getNbinsX(); - double stop = track.stopReason() > max ? double(max-1) : static_cast(track.stopReason()); - double stopped = int(StopReason::NOT_STOPPED)==track.stopReason() ? 0. : 1.; + double stop = track.stopReason() > max ? double(max - 1) : static_cast(track.stopReason()); + double stopped = int(StopReason::NOT_STOPPED) == track.stopReason() ? 0. : 1.; stoppingSource->Fill(stop); - stoppingSourceVSeta->Fill(track.eta(),stopped); - stoppingSourceVSphi->Fill(track.phi(),stopped); + stoppingSourceVSeta->Fill(track.eta(), stopped); + stoppingSourceVSphi->Fill(track.phi(), stopped); } - if ( doLumiAnalysis_ ) { - NumberOfRecHitsPerTrack_lumiFlag -> Fill(nRecHits); - Chi2oNDF_lumiFlag -> Fill(chi2oNDF); + if (doLumiAnalysis_) { + NumberOfRecHitsPerTrack_lumiFlag->Fill(nRecHits); + Chi2oNDF_lumiFlag->Fill(chi2oNDF); } - if(doDCAPlots_ || doBSPlots_ || doSIPPlots_ || doAllPlots_) { - + if (doDCAPlots_ || doBSPlots_ || doSIPPlots_ || doAllPlots_) { edm::Handle recoBeamSpotHandle; - iEvent.getByToken(beamSpotToken_,recoBeamSpotHandle); + iEvent.getByToken(beamSpotToken_, recoBeamSpotHandle); const reco::BeamSpot& bs = *recoBeamSpotHandle; - DistanceOfClosestApproachError -> Fill(track.dxyError()); - DistanceOfClosestApproachErrorVsPt -> Fill(track.pt(),track.dxyError()); - DistanceOfClosestApproachErrorVsEta -> Fill(track.eta(),track.dxyError()); - DistanceOfClosestApproachErrorVsPhi -> Fill(track.phi(),track.dxyError()); - DistanceOfClosestApproachErrorVsDxy -> Fill(track.dxy(bs.position()),track.dxyError()); - - DistanceOfClosestApproachToBS -> Fill(track.dxy(bs.position())); - DistanceOfClosestApproachToBSdz -> Fill(track.dz(bs.position())); - AbsDistanceOfClosestApproachToBS -> Fill(std::abs(track.dxy(bs.position()))); - DistanceOfClosestApproachToBSVsPhi -> Fill(track.phi(), track.dxy(bs.position())); - DistanceOfClosestApproachToBSVsEta -> Fill(track.eta(), track.dxy(bs.position())); - zPointOfClosestApproachVsPhi -> Fill(track.phi(), track.vz()); - xPointOfClosestApproachVsZ0wrt000 -> Fill(track.dz(), track.vx()); - yPointOfClosestApproachVsZ0wrt000 -> Fill(track.dz(), track.vy()); - xPointOfClosestApproachVsZ0wrtBS -> Fill(track.dz(bs.position()),(track.vx()-bs.position(track.vz()).x())); - yPointOfClosestApproachVsZ0wrtBS -> Fill(track.dz(bs.position()),(track.vy()-bs.position(track.vz()).y())); + DistanceOfClosestApproachError->Fill(track.dxyError()); + DistanceOfClosestApproachErrorVsPt->Fill(track.pt(), track.dxyError()); + DistanceOfClosestApproachErrorVsEta->Fill(track.eta(), track.dxyError()); + DistanceOfClosestApproachErrorVsPhi->Fill(track.phi(), track.dxyError()); + DistanceOfClosestApproachErrorVsDxy->Fill(track.dxy(bs.position()), track.dxyError()); + + DistanceOfClosestApproachToBS->Fill(track.dxy(bs.position())); + DistanceOfClosestApproachToBSdz->Fill(track.dz(bs.position())); + AbsDistanceOfClosestApproachToBS->Fill(std::abs(track.dxy(bs.position()))); + DistanceOfClosestApproachToBSVsPhi->Fill(track.phi(), track.dxy(bs.position())); + DistanceOfClosestApproachToBSVsEta->Fill(track.eta(), track.dxy(bs.position())); + zPointOfClosestApproachVsPhi->Fill(track.phi(), track.vz()); + xPointOfClosestApproachVsZ0wrt000->Fill(track.dz(), track.vx()); + yPointOfClosestApproachVsZ0wrt000->Fill(track.dz(), track.vy()); + xPointOfClosestApproachVsZ0wrtBS->Fill(track.dz(bs.position()), (track.vx() - bs.position(track.vz()).x())); + yPointOfClosestApproachVsZ0wrtBS->Fill(track.dz(bs.position()), (track.vy() - bs.position(track.vz()).y())); if (doTestPlots_) { - TESTDistanceOfClosestApproachToBS -> Fill(track.dxy(bs.position(track.vz()))); - TESTDistanceOfClosestApproachToBSVsPhi -> Fill(track.phi(), track.dxy(bs.position(track.vz()))); + TESTDistanceOfClosestApproachToBS->Fill(track.dxy(bs.position(track.vz()))); + TESTDistanceOfClosestApproachToBSVsPhi->Fill(track.phi(), track.dxy(bs.position(track.vz()))); } - if(doSIPPlots_) { - sipDxyToBS->Fill(track.dxy(bs.position())/track.dxyError()); - sipDzToBS->Fill(track.dz(bs.position())/track.dzError()); + if (doSIPPlots_) { + sipDxyToBS->Fill(track.dxy(bs.position()) / track.dxyError()); + sipDzToBS->Fill(track.dz(bs.position()) / track.dzError()); } } - - if(doDCAPlots_ || doPVPlots_ || doSIPPlots_ || doAllPlots_) { + + if (doDCAPlots_ || doPVPlots_ || doSIPPlots_ || doAllPlots_) { edm::Handle recoPrimaryVerticesHandle; - iEvent.getByToken(pvToken_,recoPrimaryVerticesHandle); + iEvent.getByToken(pvToken_, recoPrimaryVerticesHandle); if (recoPrimaryVerticesHandle.isValid() && !recoPrimaryVerticesHandle->empty()) { const reco::Vertex& pv = (*recoPrimaryVerticesHandle)[0]; - ////////////////// - //HI PLOTS/////// - //////////////// - - if(doHIPlots_) - { - double longDCAsig = 0, transDCAsig = 0; - double zerr2 = track.dzError()*track.dzError()+pv.zError()*pv.zError(); - double xyerr2 = track.d0Error()*track.d0Error()+pv.xError()*pv.yError(); - if(zerr2 > 0) longDCAsig = track.dz(pv.position())/zerr2; - if(xyerr2 > 0) transDCAsig = track.dxy(pv.position())/xyerr2; - LongDCASig->Fill(longDCAsig); - TransDCASig->Fill(transDCAsig); - - - - - if(track.quality(reco::TrackBase::qualityByName(qualityString_)) ==1) - { - dNdEta_HighPurity->Fill(track.eta()); - dNdPhi_HighPurity->Fill(track.phi()); - dNdPt_HighPurity->Fill(track.ptError()/track.pt()); - NhitVsEta_HighPurity->Fill(track.eta(),track.numberOfValidHits()); - NhitVsPhi_HighPurity->Fill(track.phi(),track.numberOfValidHits()); - dNhitdPt_HighPurity->Fill(track.pt(),track.numberOfValidHits()); - Ptdist_HighPurity->Fill(track.pt()); - }//end of high quality tracks requirement - } - + //HI PLOTS/////// + //////////////// + + if (doHIPlots_) { + double longDCAsig = 0, transDCAsig = 0; + double zerr2 = track.dzError() * track.dzError() + pv.zError() * pv.zError(); + double xyerr2 = track.d0Error() * track.d0Error() + pv.xError() * pv.yError(); + if (zerr2 > 0) + longDCAsig = track.dz(pv.position()) / zerr2; + if (xyerr2 > 0) + transDCAsig = track.dxy(pv.position()) / xyerr2; + LongDCASig->Fill(longDCAsig); + TransDCASig->Fill(transDCAsig); + + if (track.quality(reco::TrackBase::qualityByName(qualityString_)) == 1) { + dNdEta_HighPurity->Fill(track.eta()); + dNdPhi_HighPurity->Fill(track.phi()); + dNdPt_HighPurity->Fill(track.ptError() / track.pt()); + NhitVsEta_HighPurity->Fill(track.eta(), track.numberOfValidHits()); + NhitVsPhi_HighPurity->Fill(track.phi(), track.numberOfValidHits()); + dNhitdPt_HighPurity->Fill(track.pt(), track.numberOfValidHits()); + Ptdist_HighPurity->Fill(track.pt()); + } //end of high quality tracks requirement + } - xPointOfClosestApproachToPV->Fill(track.vx()-pv.position().x()); - yPointOfClosestApproachToPV->Fill(track.vy()-pv.position().y()); + xPointOfClosestApproachToPV->Fill(track.vx() - pv.position().x()); + yPointOfClosestApproachToPV->Fill(track.vy() - pv.position().y()); zPointOfClosestApproachToPV->Fill(track.dz(pv.position())); - DistanceOfClosestApproachToPV -> Fill(track.dxy(pv.position())); - DeltaZToPV -> Fill(track.dz (pv.position())); - DistanceOfClosestApproachToPVZoom -> Fill(track.dxy(pv.position())); - DeltaZToPVZoom -> Fill(track.dz (pv.position())); - DistanceOfClosestApproachToPVVsPhi -> Fill(track.phi(), track.dxy(pv.position())); - xPointOfClosestApproachVsZ0wrtPV -> Fill(track.dz(pv.position()),(track.vx()-pv.position().x())); - yPointOfClosestApproachVsZ0wrtPV -> Fill(track.dz(pv.position()),(track.vy()-pv.position().y())); - - - if(doSIPPlots_) { + DistanceOfClosestApproachToPV->Fill(track.dxy(pv.position())); + DeltaZToPV->Fill(track.dz(pv.position())); + DistanceOfClosestApproachToPVZoom->Fill(track.dxy(pv.position())); + DeltaZToPVZoom->Fill(track.dz(pv.position())); + DistanceOfClosestApproachToPVVsPhi->Fill(track.phi(), track.dxy(pv.position())); + xPointOfClosestApproachVsZ0wrtPV->Fill(track.dz(pv.position()), (track.vx() - pv.position().x())); + yPointOfClosestApproachVsZ0wrtPV->Fill(track.dz(pv.position()), (track.vy() - pv.position().y())); + + if (doSIPPlots_) { edm::ESHandle theB; - iSetup.get().get("TransientTrackBuilder",theB); + iSetup.get().get("TransientTrackBuilder", theB); reco::TransientTrack transTrack = theB->build(track); GlobalVector dir(track.px(), track.py(), track.pz()); std::pair ip3d = IPTools::signedImpactParameter3D(transTrack, dir, pv); std::pair ip2d = IPTools::signedTransverseImpactParameter(transTrack, dir, pv); - if(ip3d.first) sip3dToPV->Fill(ip3d.second.value() / ip3d.second.error()); - if(ip2d.first) sip2dToPV->Fill(ip2d.second.value() / ip2d.second.error()); - sipDxyToPV->Fill(track.dxy(pv.position())/track.dxyError()); - sipDzToPV->Fill(track.dz(pv.position())/track.dzError()); + if (ip3d.first) + sip3dToPV->Fill(ip3d.second.value() / ip3d.second.error()); + if (ip2d.first) + sip2dToPV->Fill(ip2d.second.value() / ip2d.second.error()); + sipDxyToPV->Fill(track.dxy(pv.position()) / track.dxyError()); + sipDzToPV->Fill(track.dz(pv.position()) / track.dzError()); } } } - if(doDCAPlots_ || doAllPlots_) { + if (doDCAPlots_ || doAllPlots_) { if (doDCAwrt000Plots_) { if (doThetaPlots_) { - DistanceOfClosestApproachVsTheta->Fill(track.theta(), track.d0()); + DistanceOfClosestApproachVsTheta->Fill(track.theta(), track.d0()); } DistanceOfClosestApproachVsEta->Fill(track.eta(), track.d0()); - } - + } } //Tracker Specific Histograms - if(doTrackerSpecific_ || doAllPlots_) { + if (doTrackerSpecific_ || doAllPlots_) { fillHistosForTrackerSpecific(track); } - if (doMeasurementStatePlots_ || doAllPlots_){ - + if (doMeasurementStatePlots_ || doAllPlots_) { if (stateName_ == "All") { fillHistosForState(iSetup, track, std::string("OuterSurface")); fillHistosForState(iSetup, track, std::string("InnerSurface")); fillHistosForState(iSetup, track, std::string("ImpactPoint")); - } else if ( - stateName_ != "OuterSurface" && - stateName_ != "InnerSurface" && - stateName_ != "ImpactPoint" && - stateName_ != "default" - ) { + } else if (stateName_ != "OuterSurface" && stateName_ != "InnerSurface" && stateName_ != "ImpactPoint" && + stateName_ != "default") { fillHistosForState(iSetup, track, std::string("default")); } else { fillHistosForState(iSetup, track, stateName_); } } - - if ( doAllPlots_ ) { - } + if (doAllPlots_) { + } } -void TrackAnalyzer::fillHistosForEfficiencyFromHitPatter(const reco::Track & track, const std::string suffix, const float monitoring, bool useInac) { - - int mon = -1; - for (int i=0; i 1.0 && track.dxy() < 0.1 and monitoring > 0) { - if (track.pt() > 1.0 && track.dxy() < 0.1 and monitoring > -9.) { - 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.numberOfAllHits((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), mon)) == hits_valid_.end()) { - LogDebug("TrackAnalyzer") << "Invalid combination of detector and subdetector: (" - << hp.getSubStructure(pattern) << ", " - << hp.getSubSubStructure(pattern) << ", " - << mon - << "): ignoring it.\n"; - continue; - } - switch (hit_type) { - case 0: - hits_valid_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring); - hits_total_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring); - break; - case 2: - if (!useInac) break; - case 1: - hits_total_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring); +void TrackAnalyzer::fillHistosForEfficiencyFromHitPatter(const reco::Track& track, + const std::string suffix, + const float monitoring, + bool useInac) { + int mon = -1; + for (int i = 0; i < monQuantity::END; i++) { + if (monName[i] == suffix) + mon = i; + } + if (useInac) + mon += monQuantity::END; + + // if (track.pt() > 1.0 && track.dxy() < 0.1 and monitoring > 0) { + if (track.pt() > 1.0 && track.dxy() < 0.1 and monitoring > -9.) { + 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.numberOfAllHits((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), mon)) == + hits_valid_.end()) { + LogDebug("TrackAnalyzer") << "Invalid combination of detector and subdetector: (" + << hp.getSubStructure(pattern) << ", " << hp.getSubSubStructure(pattern) << ", " + << mon << "): ignoring it.\n"; + continue; + } + switch (hit_type) { + case 0: + hits_valid_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring); + hits_total_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring); + break; + case 2: + if (!useInac) break; - default: - LogDebug("TrackAnalyzer") << "Invalid hit category used " << hit_type << " ignored\n"; - } + case 1: + hits_total_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring); + break; + default: + LogDebug("TrackAnalyzer") << "Invalid hit category used " << hit_type << " ignored\n"; } } } - + } } // book histograms at differnt measurement points // ---------------------------------------------------------------------------------// -void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker & ibooker) -{ - - // parameters from the configuration - std::string QualName = conf_->getParameter("Quality"); - std::string AlgoName = conf_->getParameter("AlgoName"); +void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibooker) { + // parameters from the configuration + std::string QualName = conf_->getParameter("Quality"); + std::string AlgoName = conf_->getParameter("AlgoName"); - // use the AlgoName and Quality Name - std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; + // use the AlgoName and Quality Name + std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; - // get binning from the configuration - double Chi2NDFMin = conf_->getParameter("Chi2NDFMin"); - double Chi2NDFMax = conf_->getParameter("Chi2NDFMax"); + // get binning from the configuration + double Chi2NDFMin = conf_->getParameter("Chi2NDFMin"); + double Chi2NDFMax = conf_->getParameter("Chi2NDFMax"); - int RecHitBin = conf_->getParameter( "RecHitBin"); - double RecHitMin = conf_->getParameter("RecHitMin"); - double RecHitMax = conf_->getParameter("RecHitMax"); + int RecHitBin = conf_->getParameter("RecHitBin"); + double RecHitMin = conf_->getParameter("RecHitMin"); + double RecHitMax = conf_->getParameter("RecHitMax"); - int RecLayBin = conf_->getParameter( "RecHitBin"); - double RecLayMin = conf_->getParameter("RecHitMin"); - double RecLayMax = conf_->getParameter("RecHitMax"); + int RecLayBin = conf_->getParameter("RecHitBin"); + double RecLayMin = conf_->getParameter("RecHitMin"); + double RecLayMax = conf_->getParameter("RecHitMax"); + int PhiBin = conf_->getParameter("PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); - int PhiBin = conf_->getParameter( "PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); + int EtaBin = conf_->getParameter("EtaBin"); + double EtaMin = conf_->getParameter("EtaMin"); + double EtaMax = conf_->getParameter("EtaMax"); - int EtaBin = conf_->getParameter( "EtaBin"); - double EtaMin = conf_->getParameter("EtaMin"); - double EtaMax = conf_->getParameter("EtaMax"); + int Phi2DBin = conf_->getParameter("Phi2DBin"); + int Eta2DBin = conf_->getParameter("Eta2DBin"); - int Phi2DBin = conf_->getParameter( "Phi2DBin"); - int Eta2DBin = conf_->getParameter( "Eta2DBin"); + int ThetaBin = conf_->getParameter("ThetaBin"); + double ThetaMin = conf_->getParameter("ThetaMin"); + double ThetaMax = conf_->getParameter("ThetaMax"); - int ThetaBin = conf_->getParameter( "ThetaBin"); - double ThetaMin = conf_->getParameter("ThetaMin"); - double ThetaMax = conf_->getParameter("ThetaMax"); + int TrackQBin = conf_->getParameter("TrackQBin"); + double TrackQMin = conf_->getParameter("TrackQMin"); + double TrackQMax = conf_->getParameter("TrackQMax"); - int TrackQBin = conf_->getParameter( "TrackQBin"); - double TrackQMin = conf_->getParameter("TrackQMin"); - double TrackQMax = conf_->getParameter("TrackQMax"); + int TrackPtBin = conf_->getParameter("TrackPtBin"); + double TrackPtMin = conf_->getParameter("TrackPtMin"); + double TrackPtMax = conf_->getParameter("TrackPtMax"); - int TrackPtBin = conf_->getParameter( "TrackPtBin"); - double TrackPtMin = conf_->getParameter("TrackPtMin"); - double TrackPtMax = conf_->getParameter("TrackPtMax"); + int TrackPBin = conf_->getParameter("TrackPBin"); + double TrackPMin = conf_->getParameter("TrackPMin"); + double TrackPMax = conf_->getParameter("TrackPMax"); - int TrackPBin = conf_->getParameter( "TrackPBin"); - double TrackPMin = conf_->getParameter("TrackPMin"); - double TrackPMax = conf_->getParameter("TrackPMax"); + int TrackPxBin = conf_->getParameter("TrackPxBin"); + double TrackPxMin = conf_->getParameter("TrackPxMin"); + double TrackPxMax = conf_->getParameter("TrackPxMax"); - int TrackPxBin = conf_->getParameter( "TrackPxBin"); - double TrackPxMin = conf_->getParameter("TrackPxMin"); - double TrackPxMax = conf_->getParameter("TrackPxMax"); + int TrackPyBin = conf_->getParameter("TrackPyBin"); + double TrackPyMin = conf_->getParameter("TrackPyMin"); + double TrackPyMax = conf_->getParameter("TrackPyMax"); - int TrackPyBin = conf_->getParameter( "TrackPyBin"); - double TrackPyMin = conf_->getParameter("TrackPyMin"); - double TrackPyMax = conf_->getParameter("TrackPyMax"); + int TrackPzBin = conf_->getParameter("TrackPzBin"); + double TrackPzMin = conf_->getParameter("TrackPzMin"); + double TrackPzMax = conf_->getParameter("TrackPzMax"); - int TrackPzBin = conf_->getParameter( "TrackPzBin"); - double TrackPzMin = conf_->getParameter("TrackPzMin"); - double TrackPzMax = conf_->getParameter("TrackPzMax"); + int ptErrBin = conf_->getParameter("ptErrBin"); + double ptErrMin = conf_->getParameter("ptErrMin"); + double ptErrMax = conf_->getParameter("ptErrMax"); - int ptErrBin = conf_->getParameter( "ptErrBin"); - double ptErrMin = conf_->getParameter("ptErrMin"); - double ptErrMax = conf_->getParameter("ptErrMax"); + int pxErrBin = conf_->getParameter("pxErrBin"); + double pxErrMin = conf_->getParameter("pxErrMin"); + double pxErrMax = conf_->getParameter("pxErrMax"); - int pxErrBin = conf_->getParameter( "pxErrBin"); - double pxErrMin = conf_->getParameter("pxErrMin"); - double pxErrMax = conf_->getParameter("pxErrMax"); + int pyErrBin = conf_->getParameter("pyErrBin"); + double pyErrMin = conf_->getParameter("pyErrMin"); + double pyErrMax = conf_->getParameter("pyErrMax"); - int pyErrBin = conf_->getParameter( "pyErrBin"); - double pyErrMin = conf_->getParameter("pyErrMin"); - double pyErrMax = conf_->getParameter("pyErrMax"); + int pzErrBin = conf_->getParameter("pzErrBin"); + double pzErrMin = conf_->getParameter("pzErrMin"); + double pzErrMax = conf_->getParameter("pzErrMax"); - int pzErrBin = conf_->getParameter( "pzErrBin"); - double pzErrMin = conf_->getParameter("pzErrMin"); - double pzErrMax = conf_->getParameter("pzErrMax"); + int pErrBin = conf_->getParameter("pErrBin"); + double pErrMin = conf_->getParameter("pErrMin"); + double pErrMax = conf_->getParameter("pErrMax"); - int pErrBin = conf_->getParameter( "pErrBin"); - double pErrMin = conf_->getParameter("pErrMin"); - double pErrMax = conf_->getParameter("pErrMax"); + int phiErrBin = conf_->getParameter("phiErrBin"); + double phiErrMin = conf_->getParameter("phiErrMin"); + double phiErrMax = conf_->getParameter("phiErrMax"); - int phiErrBin = conf_->getParameter( "phiErrBin"); - double phiErrMin = conf_->getParameter("phiErrMin"); - double phiErrMax = conf_->getParameter("phiErrMax"); + int etaErrBin = conf_->getParameter("etaErrBin"); + double etaErrMin = conf_->getParameter("etaErrMin"); + double etaErrMax = conf_->getParameter("etaErrMax"); - int etaErrBin = conf_->getParameter( "etaErrBin"); - double etaErrMin = conf_->getParameter("etaErrMin"); - double etaErrMax = conf_->getParameter("etaErrMax"); + double Chi2ProbMin = conf_->getParameter("Chi2ProbMin"); + double Chi2ProbMax = conf_->getParameter("Chi2ProbMax"); + ibooker.setCurrentFolder(TopFolder_); - double Chi2ProbMin = conf_->getParameter("Chi2ProbMin"); - double Chi2ProbMax = conf_->getParameter("Chi2ProbMax"); + TkParameterMEs tkmes; - ibooker.setCurrentFolder(TopFolder_); + std::string histTag = (sname == "default") ? CategoryName : sname + "_" + CategoryName; - TkParameterMEs tkmes; + if (doAllPlots_) { + // general properties + ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); - std::string histTag = (sname == "default") ? CategoryName : sname + "_" + CategoryName; + if (doThetaPlots_) { + histname = "Chi2oNDFVsTheta_" + histTag; + tkmes.Chi2oNDFVsTheta = + ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax, ""); + tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta", 1); + tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf", 2); + } + histname = "Chi2oNDFVsPhi_" + histTag; + tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax, ""); + tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi", 1); + tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf", 2); + + histname = "Chi2ProbVsPhi_" + histTag; + tkmes.Chi2ProbVsPhi = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax); + tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi", 1); + tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability", 2); + + histname = "Chi2ProbVsEta_" + histTag; + tkmes.Chi2ProbVsEta = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax); + tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta", 1); + tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability", 2); + } - if(doAllPlots_) { + // general properties + ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); + + histname = "Chi2oNDFVsEta_" + histTag; + tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax, ""); + tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta", 1); + tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf", 2); + + histname = "Chi2oNDFVsPt_" + histTag; + tkmes.Chi2oNDFVsPt = + ibooker.bookProfile(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax, Chi2NDFMin, Chi2NDFMax, ""); + tkmes.Chi2oNDFVsPt->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.Chi2oNDFVsPt->setAxisTitle("Track #chi^{2}/ndf", 2); + + histname = "Chi2oNDFVsNHits_" + histTag; + tkmes.Chi2oNDFVsNHits = ibooker.bookProfile(histname, histname, 50, 0., 50, Chi2NDFMin, Chi2NDFMax, ""); + tkmes.Chi2oNDFVsNHits->setAxisTitle("Track NHits", 1); + tkmes.Chi2oNDFVsNHits->setAxisTitle("Track #chi^{2}/ndf", 2); + + histname = "TrackP_" + histTag; + tkmes.TrackP = ibooker.book1D(histname, histname, TrackPBin, TrackPMin, TrackPMax); + tkmes.TrackP->setAxisTitle("Track |p| (GeV/c)", 1); + tkmes.TrackP->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_" + histTag; + tkmes.TrackPt = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPtHighPurity_" + histTag; + tkmes.TrackPtHighPurity = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtHighPurity->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtHighPurity->setAxisTitle("Number of High Purity Tracks", 2); + + histname = "TrackPtTight_" + histTag; + tkmes.TrackPtTight = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtTight->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtTight->setAxisTitle("Number of Tight Tracks", 2); + + histname = "TrackPtLoose_" + histTag; + tkmes.TrackPtLoose = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtLoose->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtLoose->setAxisTitle("Number of Loose Tracks", 2); + + histname = "Quality_"; + tkmes.Quality = ibooker.book1D(histname + CategoryName, histname + CategoryName, 3, 0., 3.); + tkmes.Quality->setAxisTitle("Track quality", 1); + tkmes.Quality->setAxisTitle("Number of Tracks", 2); + + for (size_t ibin = 0; ibin < 3; ibin++) { + tkmes.Quality->setBinLabel(ibin + 1, reco::TrackBase::qualityNames[ibin]); + } - // general properties - ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); - - if (doThetaPlots_) { - histname = "Chi2oNDFVsTheta_" + histTag; - tkmes.Chi2oNDFVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax,""); - tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta",1); - tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf",2); - } - histname = "Chi2oNDFVsPhi_" + histTag; - tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax,""); - tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi",1); - tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf",2); - - histname = "Chi2ProbVsPhi_" + histTag; - tkmes.Chi2ProbVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax); - tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi" ,1); - tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability",2); - - histname = "Chi2ProbVsEta_" + histTag; - tkmes.Chi2ProbVsEta = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax); - tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta" ,1); - tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability",2); + histname = "TrackPtZone1_" + histTag; + tkmes.TrackPtZone1 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone1->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone1->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPtZone2_" + histTag; + tkmes.TrackPtZone2 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone2->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone2->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPtZone3_" + histTag; + tkmes.TrackPtZone3 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone3->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone3->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPtZone4_" + histTag; + tkmes.TrackPtZone4 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone4->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone4->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPtZone5_" + histTag; + tkmes.TrackPtZone5 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone5->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone5->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPtZone6_" + histTag; + tkmes.TrackPtZone6 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone6->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone6->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPtZone7_" + histTag; + tkmes.TrackPtZone7 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone7->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone7->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPtZone8_" + histTag; + tkmes.TrackPtZone8 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtZone8->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtZone8->setAxisTitle("Number of Tracks", 2); + + histname = "Ratio_byFolding_" + histTag; + tkmes.Ratio_byFolding = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.Ratio_byFolding->setAxisTitle("Track p_{T} (GeV/c)", 1); + + histname = "Ratio_byFolding2_" + histTag; + tkmes.Ratio_byFolding2 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.Ratio_byFolding2->setAxisTitle("Track p_{T} (GeV/c)", 1); + + if (doTrackPxPyPlots_) { + histname = "TrackPx_" + histTag; + tkmes.TrackPx = ibooker.book1D(histname, histname, TrackPxBin, TrackPxMin, TrackPxMax); + tkmes.TrackPx->setAxisTitle("Track p_{x} (GeV/c)", 1); + tkmes.TrackPx->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPy_" + histTag; + tkmes.TrackPy = ibooker.book1D(histname, histname, TrackPyBin, TrackPyMin, TrackPyMax); + tkmes.TrackPy->setAxisTitle("Track p_{y} (GeV/c)", 1); + tkmes.TrackPy->setAxisTitle("Number of Tracks", 2); + } + histname = "TrackPz_" + histTag; + tkmes.TrackPz = ibooker.book1D(histname, histname, TrackPzBin, TrackPzMin, TrackPzMax); + tkmes.TrackPz->setAxisTitle("Track p_{z} (GeV/c)", 1); + tkmes.TrackPz->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPhi_" + histTag; + tkmes.TrackPhi = ibooker.book1D(histname, histname, PhiBin, PhiMin, PhiMax); + tkmes.TrackPhi->setAxisTitle("Track #phi", 1); + tkmes.TrackPhi->setAxisTitle("Number of Tracks", 2); + + histname = "TrackEta_" + histTag; + tkmes.TrackEta = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); + tkmes.TrackEta->setAxisTitle("Track #eta", 1); + tkmes.TrackEta->setAxisTitle("Number of Tracks", 2); + + histname = "TrackEtaHighpurity_" + histTag; + tkmes.TrackEtaHighPurity = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); + tkmes.TrackEtaHighPurity->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaHighPurity->setAxisTitle("Number of High Purity Tracks", 2); + + histname = "TrackEtaTight_" + histTag; + tkmes.TrackEtaTight = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); + tkmes.TrackEtaTight->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaTight->setAxisTitle("Number of Tight Tracks", 2); + + histname = "TrackEtaLoose_" + histTag; + tkmes.TrackEtaLoose = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); + tkmes.TrackEtaLoose->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaLoose->setAxisTitle("Number of Loose Tracks", 2); + + histname = "TrackEtaPhi_" + histTag; + tkmes.TrackEtaPhi = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhi->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhi->setAxisTitle("Track #phi", 2); + + histname = "TrackEtaPhiInverted_" + histTag; + tkmes.TrackEtaPhiInverted = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhiInverted->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhiInverted->setAxisTitle("Track #phi", 2); + + histname = "TrackEtaPhiInvertedoutofphase_" + histTag; + tkmes.TrackEtaPhiInvertedoutofphase = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhiInvertedoutofphase->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhiInvertedoutofphase->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_Ratio_byFoldingmap_" + histTag; + tkmes.TkEtaPhi_Ratio_byFoldingmap = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #eta", 1); + tkmes.TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_Ratio_byFoldingmap_op_" + histTag; + tkmes.TkEtaPhi_Ratio_byFoldingmap_op = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #eta", 1); + tkmes.TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_RelativeDifference_byFoldingmap_" + histTag; + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #eta", 1); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_RelativeDifference_byFoldingmap_op_" + histTag; + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #eta", 1); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #phi", 2); + + histname = "TrackEtaPhiInner_" + histTag; + tkmes.TrackEtaPhiInner = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhiInner->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhiInner->setAxisTitle("Track #phi", 2); + + histname = "TrackEtaPhiOuter_" + histTag; + tkmes.TrackEtaPhiOuter = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhiOuter->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhiOuter->setAxisTitle("Track #phi", 2); + + if (doThetaPlots_) { + histname = "TrackTheta_" + histTag; + tkmes.TrackTheta = ibooker.book1D(histname, histname, ThetaBin, ThetaMin, ThetaMax); + tkmes.TrackTheta->setAxisTitle("Track #theta", 1); + tkmes.TrackTheta->setAxisTitle("Number of Tracks", 2); + } + histname = "TrackQ_" + histTag; + tkmes.TrackQ = ibooker.book1D(histname, histname, TrackQBin, TrackQMin, TrackQMax); + tkmes.TrackQ->setAxisTitle("Track Charge", 1); + tkmes.TrackQ->setAxisTitle("Number of Tracks", 2); + + histname = "TrackQoverP_" + histTag; + tkmes.TrackQoverP = ibooker.book1D(histname, histname, 10 * TrackQBin, TrackQMin, TrackQMax); + tkmes.TrackQoverP->setAxisTitle("Track QoverP", 1); + tkmes.TrackQoverP->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPErrOverP_" + histTag; + tkmes.TrackPErr = ibooker.book1D(histname, histname, pErrBin, pErrMin, pErrMax); + tkmes.TrackPErr->setAxisTitle("track error(p)/p", 1); + tkmes.TrackPErr->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPtErrOverPt_" + histTag; + tkmes.TrackPtErr = ibooker.book1D(histname, histname, ptErrBin, ptErrMin, ptErrMax); + tkmes.TrackPtErr->setAxisTitle("track error(p_{T})/p_{T}", 1); + tkmes.TrackPtErr->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPtErrOverPtVsEta_" + histTag; + tkmes.TrackPtErrVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, ptErrMin, ptErrMax); + tkmes.TrackPtErrVsEta->setAxisTitle("Track #eta", 1); + tkmes.TrackPtErrVsEta->setAxisTitle("track error(p_{T})/p_{T}", 2); + + if (doTrackPxPyPlots_) { + histname = "TrackPxErrOverPx_" + histTag; + tkmes.TrackPxErr = ibooker.book1D(histname, histname, pxErrBin, pxErrMin, pxErrMax); + tkmes.TrackPxErr->setAxisTitle("track error(p_{x})/p_{x}", 1); + tkmes.TrackPxErr->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPyErrOverPy_" + histTag; + tkmes.TrackPyErr = ibooker.book1D(histname, histname, pyErrBin, pyErrMin, pyErrMax); + tkmes.TrackPyErr->setAxisTitle("track error(p_{y})/p_{y}", 1); + tkmes.TrackPyErr->setAxisTitle("Number of Tracks", 2); + } + histname = "TrackPzErrOverPz_" + histTag; + tkmes.TrackPzErr = ibooker.book1D(histname, histname, pzErrBin, pzErrMin, pzErrMax); + tkmes.TrackPzErr->setAxisTitle("track error(p_{z})/p_{z}", 1); + tkmes.TrackPzErr->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPhiErr_" + histTag; + tkmes.TrackPhiErr = ibooker.book1D(histname, histname, phiErrBin, phiErrMin, phiErrMax); + tkmes.TrackPhiErr->setAxisTitle("track error(#phi)"); + tkmes.TrackPhiErr->setAxisTitle("Number of Tracks", 2); + + histname = "TrackEtaErr_" + histTag; + tkmes.TrackEtaErr = ibooker.book1D(histname, histname, etaErrBin, etaErrMin, etaErrMax); + tkmes.TrackEtaErr->setAxisTitle("track error(#eta)"); + tkmes.TrackEtaErr->setAxisTitle("Number of Tracks", 2); + + // rec hit profiles + ibooker.setCurrentFolder(TopFolder_ + "/GeneralProperties"); + histname = "NumberOfRecHitsPerTrackVsPhi_" + histTag; + tkmes.NumberOfRecHitsPerTrackVsPhi = + ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitBin, RecHitMin, RecHitMax, ""); + tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi", 1); + tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of RecHits in each Track", 2); + + if (doThetaPlots_) { + histname = "NumberOfRecHitsPerTrackVsTheta_" + histTag; + tkmes.NumberOfRecHitsPerTrackVsTheta = + ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecHitBin, RecHitMin, RecHitMax, ""); + tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Track #phi", 1); + tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Number of RecHits in each Track", 2); + } + histname = "NumberOfRecHitsPerTrackVsEta_" + histTag; + tkmes.NumberOfRecHitsPerTrackVsEta = + ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitBin, RecHitMin, RecHitMax, ""); + tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta", 1); + tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of RecHits in each Track", 2); + + histname = "NumberOfValidRecHitsPerTrackVsPhi_" + histTag; + tkmes.NumberOfValidRecHitsPerTrackVsPhi = + ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitMin, RecHitMax, ""); + tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Track #phi", 1); + tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Number of valid RecHits in each Track", 2); + + histname = "NumberOfValidRecHitsPerTrackVsEta_" + histTag; + tkmes.NumberOfValidRecHitsPerTrackVsEta = + ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitMin, RecHitMax, ""); + tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Track #eta", 1); + tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Number of valid RecHits in each Track", 2); + + histname = "NumberOfValidRecHitsPerTrackVsPt_" + histTag; + tkmes.NumberOfValidRecHitsPerTrackVsPt = + ibooker.bookProfile(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax, RecHitMin, RecHitMax, ""); + tkmes.NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); + tkmes.NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Number of valid RecHits in each Track", 2); + + ////////////////////////////////////////// + histname = "NumberOfLayersPerTrackVsPhi_" + histTag; + tkmes.NumberOfLayersPerTrackVsPhi = + ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecLayBin, RecLayMin, RecLayMax, ""); + tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi", 1); + tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of Layers in each Track", 2); + + if (doThetaPlots_) { + histname = "NumberOfLayersPerTrackVsTheta_" + histTag; + tkmes.NumberOfLayersPerTrackVsTheta = + ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecLayBin, RecLayMin, RecLayMax, ""); + tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Track #phi", 1); + tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Number of Layers in each Track", 2); + } + histname = "NumberOfLayersPerTrackVsEta_" + histTag; + tkmes.NumberOfLayersPerTrackVsEta = + ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecLayBin, RecLayMin, RecLayMax, ""); + tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta", 1); + tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of Layers in each Track", 2); + + if (doThetaPlots_) { + histname = "Chi2oNDFVsTheta_" + histTag; + tkmes.Chi2oNDFVsTheta = + ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax, ""); + tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta", 1); + tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf", 2); + } + if (doAllPlots_) { + histname = "Chi2oNDFVsPhi_" + histTag; + tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax, ""); + tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi", 1); + tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf", 2); - } - - // general properties - ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); + histname = "Chi2oNDFVsEta_" + histTag; + tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax, ""); + tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta", 1); + tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf", 2); + + histname = "Chi2ProbVsPhi_" + histTag; + tkmes.Chi2ProbVsPhi = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax); + tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi", 1); + tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability", 2); + + histname = "Chi2ProbVsEta_" + histTag; + tkmes.Chi2ProbVsEta = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax); + tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta", 1); + tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability", 2); + } + // now put the MEs in the map + TkParameterMEMap.insert(std::make_pair(sname, tkmes)); +} - histname = "Chi2oNDFVsEta_" + histTag; - tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax,""); - tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta",1); - tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf",2); - - histname = "Chi2oNDFVsPt_" + histTag; - tkmes.Chi2oNDFVsPt = ibooker.bookProfile(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax, Chi2NDFMin, Chi2NDFMax,""); - tkmes.Chi2oNDFVsPt->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.Chi2oNDFVsPt->setAxisTitle("Track #chi^{2}/ndf",2); - - histname = "Chi2oNDFVsNHits_" + histTag; - tkmes.Chi2oNDFVsNHits = ibooker.bookProfile(histname, histname, 50, 0., 50, Chi2NDFMin, Chi2NDFMax,""); - tkmes.Chi2oNDFVsNHits->setAxisTitle("Track NHits", 1); - tkmes.Chi2oNDFVsNHits->setAxisTitle("Track #chi^{2}/ndf",2); - - histname = "TrackP_" + histTag; - tkmes.TrackP = ibooker.book1D(histname, histname, TrackPBin, TrackPMin, TrackPMax); - tkmes.TrackP->setAxisTitle("Track |p| (GeV/c)", 1); - tkmes.TrackP->setAxisTitle("Number of Tracks",2); - - histname = "TrackPt_" + histTag; - tkmes.TrackPt = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPt->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPt->setAxisTitle("Number of Tracks",2); - - histname = "TrackPtHighPurity_" + histTag; - tkmes.TrackPtHighPurity = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtHighPurity->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtHighPurity->setAxisTitle("Number of High Purity Tracks",2); - - histname = "TrackPtTight_" + histTag; - tkmes.TrackPtTight = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtTight->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtTight->setAxisTitle("Number of Tight Tracks",2); - - histname = "TrackPtLoose_" + histTag; - tkmes.TrackPtLoose = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtLoose->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtLoose->setAxisTitle("Number of Loose Tracks",2); - - histname = "Quality_"; - tkmes.Quality = ibooker.book1D(histname+CategoryName, histname+CategoryName, 3, 0., 3.); - tkmes.Quality->setAxisTitle("Track quality",1); - tkmes.Quality->setAxisTitle("Number of Tracks",2); - - for (size_t ibin=0; ibin<3; ibin++) { - tkmes.Quality->setBinLabel(ibin+1,reco::TrackBase::qualityNames[ibin]); - } +// fill histograms at differnt measurement points +// ---------------------------------------------------------------------------------// +void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco::Track& track, std::string sname) { + //get the kinematic parameters + double p, px, py, pz, pt, theta, phi, eta, q; + double pxerror, pyerror, pzerror, pterror, perror, phierror, etaerror; + + auto phiIn = track.innerPosition().phi(); + auto etaIn = track.innerPosition().eta(); + auto phiOut = track.outerPosition().phi(); + auto etaOut = track.outerPosition().eta(); + + if (sname == "default") { + p = track.p(); + px = track.px(); + py = track.py(); + pz = track.pz(); + pt = track.pt(); + phi = track.phi(); + theta = track.theta(); + eta = track.eta(); + q = track.charge(); + + pterror = (pt) ? track.ptError() / (pt * pt) : 0.0; + pxerror = -1.0; + pyerror = -1.0; + pzerror = -1.0; + perror = -1.0; + phierror = track.phiError(); + etaerror = track.etaError(); + + } else { + edm::ESHandle theB; + iSetup.get().get("TransientTrackBuilder", theB); + reco::TransientTrack TransTrack = theB->build(track); + + TrajectoryStateOnSurface TSOS; + + if (sname == "OuterSurface") + TSOS = TransTrack.outermostMeasurementState(); + else if (sname == "InnerSurface") + TSOS = TransTrack.innermostMeasurementState(); + else if (sname == "ImpactPoint") + TSOS = TransTrack.impactPointState(); + + p = TSOS.globalMomentum().mag(); + px = TSOS.globalMomentum().x(); + py = TSOS.globalMomentum().y(); + pz = TSOS.globalMomentum().z(); + pt = TSOS.globalMomentum().perp(); + phi = TSOS.globalMomentum().phi(); + theta = TSOS.globalMomentum().theta(); + eta = TSOS.globalMomentum().eta(); + q = TSOS.charge(); + + //get the error of the kinimatic parameters + AlgebraicSymMatrix66 errors = TSOS.cartesianError().matrix(); + double partialPterror = + errors(3, 3) * pow(TSOS.globalMomentum().x(), 2) + errors(4, 4) * pow(TSOS.globalMomentum().y(), 2); + pterror = sqrt(partialPterror) / TSOS.globalMomentum().perp(); + pxerror = sqrt(errors(3, 3)) / TSOS.globalMomentum().x(); + pyerror = sqrt(errors(4, 4)) / TSOS.globalMomentum().y(); + pzerror = sqrt(errors(5, 5)) / TSOS.globalMomentum().z(); + perror = sqrt(partialPterror + errors(5, 5) * pow(TSOS.globalMomentum().z(), 2)) / TSOS.globalMomentum().mag(); + phierror = sqrt(TSOS.curvilinearError().matrix()(2, 2)); + etaerror = sqrt(TSOS.curvilinearError().matrix()(1, 1)) * fabs(sin(TSOS.globalMomentum().theta())); + } - histname = "TrackPtZone1_" + histTag; - tkmes.TrackPtZone1 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone1->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone1->setAxisTitle("Number of Tracks",2); - - histname = "TrackPtZone2_" + histTag; - tkmes.TrackPtZone2 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone2->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone2->setAxisTitle("Number of Tracks",2); - - histname = "TrackPtZone3_" + histTag; - tkmes.TrackPtZone3 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone3->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone3->setAxisTitle("Number of Tracks",2); - - histname = "TrackPtZone4_" + histTag; - tkmes.TrackPtZone4 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone4->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone4->setAxisTitle("Number of Tracks",2); - - histname = "TrackPtZone5_" + histTag; - tkmes.TrackPtZone5 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone5->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone5->setAxisTitle("Number of Tracks",2); - - histname = "TrackPtZone6_" + histTag; - tkmes.TrackPtZone6 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone6->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone6->setAxisTitle("Number of Tracks",2); - - histname = "TrackPtZone7_" + histTag; - tkmes.TrackPtZone7 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone7->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone7->setAxisTitle("Number of Tracks",2); - - histname = "TrackPtZone8_" + histTag; - tkmes.TrackPtZone8 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone8->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone8->setAxisTitle("Number of Tracks",2); - - histname = "Ratio_byFolding_" + histTag; - tkmes.Ratio_byFolding = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.Ratio_byFolding->setAxisTitle("Track p_{T} (GeV/c)", 1); - - histname = "Ratio_byFolding2_" + histTag; - tkmes.Ratio_byFolding2 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.Ratio_byFolding2->setAxisTitle("Track p_{T} (GeV/c)", 1); + std::map::iterator iPos = TkParameterMEMap.find(sname); + if (iPos != TkParameterMEMap.end()) { + TkParameterMEs tkmes = iPos->second; + // momentum + tkmes.TrackP->Fill(p); if (doTrackPxPyPlots_) { - histname = "TrackPx_" + histTag; - tkmes.TrackPx = ibooker.book1D(histname, histname, TrackPxBin, TrackPxMin, TrackPxMax); - tkmes.TrackPx->setAxisTitle("Track p_{x} (GeV/c)", 1); - tkmes.TrackPx->setAxisTitle("Number of Tracks",2); - - histname = "TrackPy_" + histTag; - tkmes.TrackPy = ibooker.book1D(histname, histname, TrackPyBin, TrackPyMin, TrackPyMax); - tkmes.TrackPy->setAxisTitle("Track p_{y} (GeV/c)", 1); - tkmes.TrackPy->setAxisTitle("Number of Tracks",2); - } - histname = "TrackPz_" + histTag; - tkmes.TrackPz = ibooker.book1D(histname, histname, TrackPzBin, TrackPzMin, TrackPzMax); - tkmes.TrackPz->setAxisTitle("Track p_{z} (GeV/c)", 1); - tkmes.TrackPz->setAxisTitle("Number of Tracks",2); - - histname = "TrackPhi_" + histTag; - tkmes.TrackPhi = ibooker.book1D(histname, histname, PhiBin, PhiMin, PhiMax); - tkmes.TrackPhi->setAxisTitle("Track #phi", 1); - tkmes.TrackPhi->setAxisTitle("Number of Tracks",2); - - histname = "TrackEta_" + histTag; - tkmes.TrackEta = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); - tkmes.TrackEta->setAxisTitle("Track #eta", 1); - tkmes.TrackEta->setAxisTitle("Number of Tracks",2); - - histname = "TrackEtaHighpurity_" + histTag; - tkmes.TrackEtaHighPurity = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); - tkmes.TrackEtaHighPurity->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaHighPurity->setAxisTitle("Number of High Purity Tracks",2); - - histname = "TrackEtaTight_" + histTag; - tkmes.TrackEtaTight = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); - tkmes.TrackEtaTight->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaTight->setAxisTitle("Number of Tight Tracks",2); - - histname = "TrackEtaLoose_" + histTag; - tkmes.TrackEtaLoose = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); - tkmes.TrackEtaLoose->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaLoose->setAxisTitle("Number of Loose Tracks",2); - - histname = "TrackEtaPhi_" + histTag; - tkmes.TrackEtaPhi = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TrackEtaPhi->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaPhi->setAxisTitle("Track #phi", 2); - - histname = "TrackEtaPhiInverted_" + histTag; - tkmes.TrackEtaPhiInverted = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TrackEtaPhiInverted->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaPhiInverted->setAxisTitle("Track #phi", 2); - - histname = "TrackEtaPhiInvertedoutofphase_" + histTag; - tkmes.TrackEtaPhiInvertedoutofphase = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TrackEtaPhiInvertedoutofphase->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaPhiInvertedoutofphase->setAxisTitle("Track #phi", 2); - - histname = "TkEtaPhi_Ratio_byFoldingmap_" + histTag; - tkmes.TkEtaPhi_Ratio_byFoldingmap = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #eta", 1); - tkmes.TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #phi", 2); - - histname = "TkEtaPhi_Ratio_byFoldingmap_op_" + histTag; - tkmes.TkEtaPhi_Ratio_byFoldingmap_op = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #eta", 1); - tkmes.TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #phi", 2); - - histname = "TkEtaPhi_RelativeDifference_byFoldingmap_" + histTag; - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #eta", 1); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #phi", 2); - - histname = "TkEtaPhi_RelativeDifference_byFoldingmap_op_" + histTag; - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #eta", 1); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #phi", 2); - - histname = "TrackEtaPhiInner_" + histTag; - tkmes.TrackEtaPhiInner = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TrackEtaPhiInner->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaPhiInner->setAxisTitle("Track #phi", 2); - - histname = "TrackEtaPhiOuter_" + histTag; - tkmes.TrackEtaPhiOuter = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TrackEtaPhiOuter->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaPhiOuter->setAxisTitle("Track #phi", 2); - - - - if (doThetaPlots_) { - histname = "TrackTheta_" + histTag; - tkmes.TrackTheta = ibooker.book1D(histname, histname, ThetaBin, ThetaMin, ThetaMax); - tkmes.TrackTheta->setAxisTitle("Track #theta", 1); - tkmes.TrackTheta->setAxisTitle("Number of Tracks",2); + tkmes.TrackPx->Fill(px); + tkmes.TrackPy->Fill(py); } - histname = "TrackQ_" + histTag; - tkmes.TrackQ = ibooker.book1D(histname, histname, TrackQBin, TrackQMin, TrackQMax); - tkmes.TrackQ->setAxisTitle("Track Charge", 1); - tkmes.TrackQ->setAxisTitle("Number of Tracks",2); - - histname = "TrackQoverP_" + histTag; - tkmes.TrackQoverP = ibooker.book1D(histname, histname, 10*TrackQBin, TrackQMin, TrackQMax); - tkmes.TrackQoverP->setAxisTitle("Track QoverP", 1); - tkmes.TrackQoverP->setAxisTitle("Number of Tracks",2); - - histname = "TrackPErrOverP_" + histTag; - tkmes.TrackPErr = ibooker.book1D(histname, histname, pErrBin, pErrMin, pErrMax); - tkmes.TrackPErr->setAxisTitle("track error(p)/p", 1); - tkmes.TrackPErr->setAxisTitle("Number of Tracks",2); - - histname = "TrackPtErrOverPt_" + histTag; - tkmes.TrackPtErr = ibooker.book1D(histname, histname, ptErrBin, ptErrMin, ptErrMax); - tkmes.TrackPtErr->setAxisTitle("track error(p_{T})/p_{T}", 1); - tkmes.TrackPtErr->setAxisTitle("Number of Tracks",2); - - histname = "TrackPtErrOverPtVsEta_" + histTag; - tkmes.TrackPtErrVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, ptErrMin, ptErrMax); - tkmes.TrackPtErrVsEta->setAxisTitle("Track #eta",1); - tkmes.TrackPtErrVsEta->setAxisTitle("track error(p_{T})/p_{T}", 2); + tkmes.TrackPz->Fill(pz); + tkmes.TrackPt->Fill(pt); - if (doTrackPxPyPlots_) { - histname = "TrackPxErrOverPx_" + histTag; - tkmes.TrackPxErr = ibooker.book1D(histname, histname, pxErrBin, pxErrMin, pxErrMax); - tkmes.TrackPxErr->setAxisTitle("track error(p_{x})/p_{x}", 1); - tkmes.TrackPxErr->setAxisTitle("Number of Tracks",2); - - histname = "TrackPyErrOverPy_" + histTag; - tkmes.TrackPyErr = ibooker.book1D(histname, histname, pyErrBin, pyErrMin, pyErrMax); - tkmes.TrackPyErr->setAxisTitle("track error(p_{y})/p_{y}", 1); - tkmes.TrackPyErr->setAxisTitle("Number of Tracks",2); + if (track.quality(reco::TrackBase::highPurity)) { + tkmes.TrackPtHighPurity->Fill(pt); + tkmes.Quality->Fill(reco::TrackBase::highPurity, 1.); + } + if (track.quality(reco::TrackBase::tight)) { + tkmes.TrackPtTight->Fill(pt); + tkmes.Quality->Fill(reco::TrackBase::tight, 1.); + } + if (track.quality(reco::TrackBase::loose)) { + tkmes.TrackPtLoose->Fill(pt); + tkmes.Quality->Fill(reco::TrackBase::loose, 1.); } - histname = "TrackPzErrOverPz_" + histTag; - tkmes.TrackPzErr = ibooker.book1D(histname, histname, pzErrBin, pzErrMin, pzErrMax); - tkmes.TrackPzErr->setAxisTitle("track error(p_{z})/p_{z}", 1); - tkmes.TrackPzErr->setAxisTitle("Number of Tracks",2); - - histname = "TrackPhiErr_" + histTag; - tkmes.TrackPhiErr = ibooker.book1D(histname, histname, phiErrBin, phiErrMin, phiErrMax); - tkmes.TrackPhiErr->setAxisTitle("track error(#phi)"); - tkmes.TrackPhiErr->setAxisTitle("Number of Tracks",2); - - histname = "TrackEtaErr_" + histTag; - tkmes.TrackEtaErr = ibooker.book1D(histname, histname, etaErrBin, etaErrMin, etaErrMax); - tkmes.TrackEtaErr->setAxisTitle("track error(#eta)"); - tkmes.TrackEtaErr->setAxisTitle("Number of Tracks",2); - - // rec hit profiles - ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties"); - histname = "NumberOfRecHitsPerTrackVsPhi_" + histTag; - tkmes.NumberOfRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitBin, RecHitMin, RecHitMax,""); - tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1); - tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of RecHits in each Track",2); - if (doThetaPlots_) { - histname = "NumberOfRecHitsPerTrackVsTheta_" + histTag; - tkmes.NumberOfRecHitsPerTrackVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecHitBin, RecHitMin, RecHitMax,""); - tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Track #phi",1); - tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Number of RecHits in each Track",2); + // angles + tkmes.TrackPhi->Fill(phi); + tkmes.TrackEta->Fill(eta); + if (track.quality(reco::TrackBase::highPurity)) { + tkmes.TrackEtaHighPurity->Fill(eta); + } + if (track.quality(reco::TrackBase::tight)) { + tkmes.TrackEtaTight->Fill(eta); + } + if (track.quality(reco::TrackBase::loose)) { + tkmes.TrackEtaLoose->Fill(eta); } - histname = "NumberOfRecHitsPerTrackVsEta_" + histTag; - tkmes.NumberOfRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitBin, RecHitMin, RecHitMax,""); - tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1); - tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of RecHits in each Track",2); - - histname = "NumberOfValidRecHitsPerTrackVsPhi_" + histTag; - tkmes.NumberOfValidRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitMin, RecHitMax,""); - tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1); - tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Number of valid RecHits in each Track",2); - - histname = "NumberOfValidRecHitsPerTrackVsEta_" + histTag; - tkmes.NumberOfValidRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitMin, RecHitMax,""); - tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1); - tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Number of valid RecHits in each Track",2); - - histname = "NumberOfValidRecHitsPerTrackVsPt_" + histTag; - tkmes.NumberOfValidRecHitsPerTrackVsPt = ibooker.bookProfile(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax, RecHitMin, RecHitMax,""); - tkmes.NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]",1); - tkmes.NumberOfValidRecHitsPerTrackVsPt->setAxisTitle("Number of valid RecHits in each Track",2); - - ////////////////////////////////////////// - histname = "NumberOfLayersPerTrackVsPhi_" + histTag; - tkmes.NumberOfLayersPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecLayBin, RecLayMin, RecLayMax,""); - tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi",1); - tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of Layers in each Track",2); - if (doThetaPlots_) { - histname = "NumberOfLayersPerTrackVsTheta_" + histTag; - tkmes.NumberOfLayersPerTrackVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecLayBin, RecLayMin, RecLayMax,""); - tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Track #phi",1); - tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Number of Layers in each Track",2); + tkmes.TrackEtaPhi->Fill(eta, phi); + tkmes.TrackEtaPhiInverted->Fill(eta, -1 * phi); + tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, 3.141592654 + phi); + tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, phi - 3.141592654); + tkmes.TkEtaPhi_Ratio_byFoldingmap->getTH2F()->Divide( + tkmes.TrackEtaPhi->getTH2F(), tkmes.TrackEtaPhiInverted->getTH2F(), 1., 1., ""); + tkmes.TkEtaPhi_Ratio_byFoldingmap_op->getTH2F()->Divide( + tkmes.TrackEtaPhi->getTH2F(), tkmes.TrackEtaPhiInvertedoutofphase->getTH2F(), 1., 1., ""); + + int nx = tkmes.TrackEtaPhi->getTH2F()->GetNbinsX(); + int ny = tkmes.TrackEtaPhi->getTH2F()->GetNbinsY(); + + for (int ii = 1; ii <= nx; ii++) { + for (int jj = 1; jj <= ny; jj++) { + double Sum1 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii, jj) + + tkmes.TrackEtaPhiInverted->getTH2F()->GetBinContent(ii, jj); + double Sum2 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii, jj) + + tkmes.TrackEtaPhiInvertedoutofphase->getTH2F()->GetBinContent(ii, jj); + + double Sub1 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii, jj) - + tkmes.TrackEtaPhiInverted->getTH2F()->GetBinContent(ii, jj); + double Sub2 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii, jj) - + tkmes.TrackEtaPhiInvertedoutofphase->getTH2F()->GetBinContent(ii, jj); + + if (Sum1 == 0 || Sum2 == 0) { + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->getTH2F()->SetBinContent(ii, jj, 1); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->getTH2F()->SetBinContent(ii, jj, 1); + } else { + double ratio1 = Sub1 / Sum1; + double ratio2 = Sub2 / Sum2; + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->getTH2F()->SetBinContent(ii, jj, ratio1); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->getTH2F()->SetBinContent(ii, jj, ratio2); + } + } } - histname = "NumberOfLayersPerTrackVsEta_" + histTag; - tkmes.NumberOfLayersPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecLayBin, RecLayMin, RecLayMax,""); - tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta",1); - tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of Layers in each Track",2); - if (doThetaPlots_) { - histname = "Chi2oNDFVsTheta_" + histTag; - tkmes.Chi2oNDFVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax,""); - tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta",1); - tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf",2); + //pT histograms to create efficiency vs pT plot for only the more inefficient region. + + if (eta < 0. && phi < -1.6) { + tkmes.TrackPtZone1->Fill(pt); } - if (doAllPlots_) { - histname = "Chi2oNDFVsPhi_" + histTag; - tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax,""); - tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi",1); - tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf",2); - - histname = "Chi2oNDFVsEta_" + histTag; - tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax,""); - tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta",1); - tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf",2); - - histname = "Chi2ProbVsPhi_" + histTag; - tkmes.Chi2ProbVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax); - tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi" ,1); - tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability",2); - - histname = "Chi2ProbVsEta_" + histTag; - tkmes.Chi2ProbVsEta = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax); - tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta" ,1); - tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability",2); + if (eta < 0. && phi < 0 && phi >= -1.6) { + tkmes.TrackPtZone2->Fill(pt); + } + if (eta < 0. && phi < 1.6 && phi >= 0) { + tkmes.TrackPtZone3->Fill(pt); + } + if (eta < 0. && phi >= 1.6) { + tkmes.TrackPtZone4->Fill(pt); + } + if (eta >= 0. && phi < -1.6) { + tkmes.TrackPtZone5->Fill(pt); + } + if (eta >= 0. && phi < 0 && phi >= -1.6) { + tkmes.TrackPtZone6->Fill(pt); + } + if (eta >= 0. && phi < 1.6 && phi >= 0) { + tkmes.TrackPtZone7->Fill(pt); + } + if (eta >= 0. && phi >= 1.6) { + tkmes.TrackPtZone8->Fill(pt); } - // now put the MEs in the map - TkParameterMEMap.insert( std::make_pair(sname, tkmes) ); - -} + float A[8]; + A[0] = tkmes.TrackPtZone1->getTH1()->Integral(); + A[1] = tkmes.TrackPtZone2->getTH1()->Integral(); + A[2] = tkmes.TrackPtZone3->getTH1()->Integral(); + A[3] = tkmes.TrackPtZone4->getTH1()->Integral(); + A[4] = tkmes.TrackPtZone5->getTH1()->Integral(); + A[5] = tkmes.TrackPtZone6->getTH1()->Integral(); + A[6] = tkmes.TrackPtZone7->getTH1()->Integral(); + A[7] = tkmes.TrackPtZone8->getTH1()->Integral(); + + int WZ = 0; + float minA = A[0]; + for (int w = 1; w < 8; w++) { + if (minA > A[w]) { + minA = A[w]; + WZ = w; + } + } + switch (WZ) { + case 1: + tkmes.Ratio_byFolding->getTH1()->Divide( + tkmes.TrackPtZone1->getTH1(), tkmes.TrackPtZone4->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide( + tkmes.TrackPtZone1->getTH1(), tkmes.TrackPtZone2->getTH1(), 1., 1., "B"); + break; + case 2: + tkmes.Ratio_byFolding->getTH1()->Divide( + tkmes.TrackPtZone2->getTH1(), tkmes.TrackPtZone3->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide( + tkmes.TrackPtZone2->getTH1(), tkmes.TrackPtZone1->getTH1(), 1., 1., "B"); + break; + case 3: + tkmes.Ratio_byFolding->getTH1()->Divide( + tkmes.TrackPtZone3->getTH1(), tkmes.TrackPtZone2->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide( + tkmes.TrackPtZone3->getTH1(), tkmes.TrackPtZone4->getTH1(), 1., 1., "B"); + break; + case 4: + tkmes.Ratio_byFolding->getTH1()->Divide( + tkmes.TrackPtZone4->getTH1(), tkmes.TrackPtZone1->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide( + tkmes.TrackPtZone4->getTH1(), tkmes.TrackPtZone3->getTH1(), 1., 1., "B"); + break; + case 5: + tkmes.Ratio_byFolding->getTH1()->Divide( + tkmes.TrackPtZone5->getTH1(), tkmes.TrackPtZone8->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide( + tkmes.TrackPtZone5->getTH1(), tkmes.TrackPtZone6->getTH1(), 1., 1., "B"); + break; + case 6: + tkmes.Ratio_byFolding->getTH1()->Divide( + tkmes.TrackPtZone6->getTH1(), tkmes.TrackPtZone7->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide( + tkmes.TrackPtZone6->getTH1(), tkmes.TrackPtZone5->getTH1(), 1., 1., "B"); + break; + case 7: + tkmes.Ratio_byFolding->getTH1()->Divide( + tkmes.TrackPtZone7->getTH1(), tkmes.TrackPtZone6->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide( + tkmes.TrackPtZone7->getTH1(), tkmes.TrackPtZone8->getTH1(), 1., 1., "B"); + break; + case 8: + tkmes.Ratio_byFolding->getTH1()->Divide( + tkmes.TrackPtZone8->getTH1(), tkmes.TrackPtZone5->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide( + tkmes.TrackPtZone8->getTH1(), tkmes.TrackPtZone7->getTH1(), 1., 1., "B"); + break; + } + tkmes.Ratio_byFolding->setAxisTitle("Efficiency(Ratio)_Zone" + std::to_string(WZ), 2); + tkmes.Ratio_byFolding2->setAxisTitle("Efficiency(Ratio)_Zone" + std::to_string(WZ), 2); -// fill histograms at differnt measurement points -// ---------------------------------------------------------------------------------// -void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname) -{ - //get the kinematic parameters - double p, px, py, pz, pt, theta, phi, eta, q; - double pxerror, pyerror, pzerror, pterror, perror, phierror, etaerror; - - auto phiIn = track.innerPosition().phi(); - auto etaIn = track.innerPosition().eta(); - auto phiOut = track.outerPosition().phi(); - auto etaOut = track.outerPosition().eta(); - - - if (sname == "default") { - - p = track.p(); - px = track.px(); - py = track.py(); - pz = track.pz(); - pt = track.pt(); - phi = track.phi(); - theta = track.theta(); - eta = track.eta(); - q = track.charge(); - - pterror = (pt) ? track.ptError()/(pt*pt) : 0.0; - pxerror = -1.0; - pyerror = -1.0; - pzerror = -1.0; - perror = -1.0; - phierror = track.phiError(); - etaerror = track.etaError(); - - } else { - - edm::ESHandle theB; - iSetup.get().get("TransientTrackBuilder",theB); - reco::TransientTrack TransTrack = theB->build(track); - - TrajectoryStateOnSurface TSOS; - - if (sname == "OuterSurface") TSOS = TransTrack.outermostMeasurementState(); - else if (sname == "InnerSurface") TSOS = TransTrack.innermostMeasurementState(); - else if (sname == "ImpactPoint") TSOS = TransTrack.impactPointState(); - - p = TSOS.globalMomentum().mag(); - px = TSOS.globalMomentum().x(); - py = TSOS.globalMomentum().y(); - pz = TSOS.globalMomentum().z(); - pt = TSOS.globalMomentum().perp(); - phi = TSOS.globalMomentum().phi(); - theta = TSOS.globalMomentum().theta(); - eta = TSOS.globalMomentum().eta(); - q = TSOS.charge(); - - //get the error of the kinimatic parameters - AlgebraicSymMatrix66 errors = TSOS.cartesianError().matrix(); - double partialPterror = errors(3,3)*pow(TSOS.globalMomentum().x(),2) + errors(4,4)*pow(TSOS.globalMomentum().y(),2); - pterror = sqrt(partialPterror)/TSOS.globalMomentum().perp(); - pxerror = sqrt(errors(3,3))/TSOS.globalMomentum().x(); - pyerror = sqrt(errors(4,4))/TSOS.globalMomentum().y(); - pzerror = sqrt(errors(5,5))/TSOS.globalMomentum().z(); - perror = sqrt(partialPterror+errors(5,5)*pow(TSOS.globalMomentum().z(),2))/TSOS.globalMomentum().mag(); - phierror = sqrt(TSOS.curvilinearError().matrix()(2,2)); - etaerror = sqrt(TSOS.curvilinearError().matrix()(1,1))*fabs(sin(TSOS.globalMomentum().theta())); + tkmes.TrackEtaPhiInner->Fill(etaIn, phiIn); + tkmes.TrackEtaPhiOuter->Fill(etaOut, phiOut); + if (doThetaPlots_) { + tkmes.TrackTheta->Fill(theta); + } + tkmes.TrackQ->Fill(q); + if (p > 0.) { + tkmes.TrackQoverP->Fill(q / p); } + // errors + tkmes.TrackPtErr->Fill(pterror); + tkmes.TrackPtErrVsEta->Fill(eta, pterror); + if (doTrackPxPyPlots_) { + tkmes.TrackPxErr->Fill(pxerror); + tkmes.TrackPyErr->Fill(pyerror); + } + tkmes.TrackPzErr->Fill(pzerror); + tkmes.TrackPErr->Fill(perror); + tkmes.TrackPhiErr->Fill(phierror); + tkmes.TrackEtaErr->Fill(etaerror); - std::map::iterator iPos = TkParameterMEMap.find(sname); - if (iPos != TkParameterMEMap.end()) { + int nRecHits = track.hitPattern().numberOfAllHits(reco::HitPattern::TRACK_HITS); + int nValidRecHits = track.numberOfValidHits(); + // rec hits + tkmes.NumberOfRecHitsPerTrackVsPhi->Fill(phi, nRecHits); + if (doThetaPlots_) { + tkmes.NumberOfRecHitsPerTrackVsTheta->Fill(theta, nRecHits); + } + tkmes.NumberOfRecHitsPerTrackVsEta->Fill(eta, nRecHits); - TkParameterMEs tkmes = iPos->second; - - // momentum - tkmes.TrackP->Fill(p); - if (doTrackPxPyPlots_) { - tkmes.TrackPx->Fill(px); - tkmes.TrackPy->Fill(py); - } - tkmes.TrackPz->Fill(pz); - tkmes.TrackPt->Fill(pt); + tkmes.NumberOfValidRecHitsPerTrackVsPhi->Fill(phi, nValidRecHits); + tkmes.NumberOfValidRecHitsPerTrackVsEta->Fill(eta, nValidRecHits); + tkmes.NumberOfValidRecHitsPerTrackVsPt->Fill(pt, nValidRecHits); - if (track.quality(reco::TrackBase::highPurity)) { - tkmes.TrackPtHighPurity->Fill(pt); - tkmes.Quality->Fill(reco::TrackBase::highPurity,1.); - } - if (track.quality(reco::TrackBase::tight)) { - tkmes.TrackPtTight->Fill(pt); - tkmes.Quality->Fill(reco::TrackBase::tight,1.); - } - if (track.quality(reco::TrackBase::loose)) { - tkmes.TrackPtLoose->Fill(pt); - tkmes.Quality->Fill(reco::TrackBase::loose,1.); - } - - // angles - tkmes.TrackPhi->Fill(phi); - tkmes.TrackEta->Fill(eta); - if (track.quality(reco::TrackBase::highPurity)) { - tkmes.TrackEtaHighPurity->Fill(eta); - } - if (track.quality(reco::TrackBase::tight)) { - tkmes.TrackEtaTight->Fill(eta); - } - if (track.quality(reco::TrackBase::loose)) { - tkmes.TrackEtaLoose->Fill(eta); - } + int nLayers = track.hitPattern().trackerLayersWithMeasurement(); + // rec layers + tkmes.NumberOfLayersPerTrackVsPhi->Fill(phi, nLayers); + if (doThetaPlots_) { + tkmes.NumberOfLayersPerTrackVsTheta->Fill(theta, nLayers); + } + tkmes.NumberOfLayersPerTrackVsEta->Fill(eta, nLayers); - tkmes.TrackEtaPhi->Fill(eta,phi); - tkmes.TrackEtaPhiInverted->Fill(eta,-1*phi); - tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta,3.141592654+phi); - tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta,phi- 3.141592654 ); - tkmes.TkEtaPhi_Ratio_byFoldingmap->getTH2F()->Divide(tkmes.TrackEtaPhi->getTH2F(),tkmes.TrackEtaPhiInverted->getTH2F(),1.,1.,""); - tkmes.TkEtaPhi_Ratio_byFoldingmap_op->getTH2F()->Divide(tkmes.TrackEtaPhi->getTH2F(),tkmes.TrackEtaPhiInvertedoutofphase->getTH2F(),1.,1.,""); - - int nx = tkmes.TrackEtaPhi->getTH2F()->GetNbinsX(); - int ny = tkmes.TrackEtaPhi->getTH2F()->GetNbinsY(); - - for (int ii=1; ii<=nx; ii++){ - for (int jj=1; jj<=ny; jj++){ - - double Sum1 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii,jj) + tkmes.TrackEtaPhiInverted->getTH2F()->GetBinContent(ii,jj); - double Sum2 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii,jj) + tkmes.TrackEtaPhiInvertedoutofphase->getTH2F()->GetBinContent(ii,jj); - - double Sub1 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii,jj) - tkmes.TrackEtaPhiInverted->getTH2F()->GetBinContent(ii,jj); - double Sub2 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii,jj) - tkmes.TrackEtaPhiInvertedoutofphase->getTH2F()->GetBinContent(ii,jj); - - if (Sum1 == 0 || Sum2 ==0){ - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->getTH2F()->SetBinContent(ii,jj,1); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->getTH2F()->SetBinContent(ii,jj,1); - }else{ - double ratio1 = Sub1/Sum1; - double ratio2 = Sub2/Sum2; - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->getTH2F()->SetBinContent(ii,jj,ratio1); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->getTH2F()->SetBinContent(ii,jj,ratio2); - } - } - } - - -//pT histograms to create efficiency vs pT plot for only the more inefficient region. - - if(eta < 0. && phi < -1.6) {tkmes.TrackPtZone1->Fill(pt);} - if(eta < 0. && phi < 0 && phi >= -1.6) {tkmes.TrackPtZone2->Fill(pt);} - if(eta < 0. && phi < 1.6 && phi >= 0) {tkmes.TrackPtZone3->Fill(pt);} - if(eta < 0. && phi >= 1.6) {tkmes.TrackPtZone4->Fill(pt);} - if(eta >= 0. && phi < -1.6) {tkmes.TrackPtZone5->Fill(pt);} - if(eta >= 0. && phi < 0 && phi >= -1.6) {tkmes.TrackPtZone6->Fill(pt);} - if(eta >= 0. && phi < 1.6 && phi >= 0) {tkmes.TrackPtZone7->Fill(pt);} - if(eta >= 0. && phi >= 1.6) {tkmes.TrackPtZone8->Fill(pt);} - - float A [8]; - A[0] = tkmes.TrackPtZone1->getTH1()->Integral(); - A[1] = tkmes.TrackPtZone2->getTH1()->Integral(); - A[2] = tkmes.TrackPtZone3->getTH1()->Integral(); - A[3] = tkmes.TrackPtZone4->getTH1()->Integral(); - A[4] = tkmes.TrackPtZone5->getTH1()->Integral(); - A[5] = tkmes.TrackPtZone6->getTH1()->Integral(); - A[6] = tkmes.TrackPtZone7->getTH1()->Integral(); - A[7] = tkmes.TrackPtZone8->getTH1()->Integral(); - - int WZ = 0; - float minA = A[0]; - for(int w=1;w<8;w++){ - if( minA > A[w]){ - minA = A[w]; - WZ=w; - } - } - - switch(WZ){ - case 1: - tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone1->getTH1(),tkmes.TrackPtZone4->getTH1(),1.,1.,"B"); - tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone1->getTH1(),tkmes.TrackPtZone2->getTH1(),1.,1.,"B"); - break; - case 2: - tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone2->getTH1(),tkmes.TrackPtZone3->getTH1(),1.,1.,"B"); - tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone2->getTH1(),tkmes.TrackPtZone1->getTH1(),1.,1.,"B"); - break; - case 3: - tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone3->getTH1(),tkmes.TrackPtZone2->getTH1(),1.,1.,"B"); - tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone3->getTH1(),tkmes.TrackPtZone4->getTH1(),1.,1.,"B"); - break; - case 4: - tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone4->getTH1(),tkmes.TrackPtZone1->getTH1(),1.,1.,"B"); - tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone4->getTH1(),tkmes.TrackPtZone3->getTH1(),1.,1.,"B"); - break; - case 5: - tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone5->getTH1(),tkmes.TrackPtZone8->getTH1(),1.,1.,"B"); - tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone5->getTH1(),tkmes.TrackPtZone6->getTH1(),1.,1.,"B"); - break; - case 6: - tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone6->getTH1(),tkmes.TrackPtZone7->getTH1(),1.,1.,"B"); - tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone6->getTH1(),tkmes.TrackPtZone5->getTH1(),1.,1.,"B"); - break; - case 7: - tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone7->getTH1(),tkmes.TrackPtZone6->getTH1(),1.,1.,"B"); - tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone7->getTH1(),tkmes.TrackPtZone8->getTH1(),1.,1.,"B"); - break; - case 8: - tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPtZone8->getTH1(),tkmes.TrackPtZone5->getTH1(),1.,1.,"B"); - tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPtZone8->getTH1(),tkmes.TrackPtZone7->getTH1(),1.,1.,"B"); - break; -} - tkmes.Ratio_byFolding->setAxisTitle("Efficiency(Ratio)_Zone" + std::to_string(WZ),2); - tkmes.Ratio_byFolding2->setAxisTitle("Efficiency(Ratio)_Zone" + std::to_string(WZ),2); + double chi2prob = TMath::Prob(track.chi2(), (int)track.ndof()); + double chi2oNDF = track.normalizedChi2(); - tkmes.TrackEtaPhiInner->Fill(etaIn,phiIn); - tkmes.TrackEtaPhiOuter->Fill(etaOut,phiOut); + tkmes.Chi2oNDFVsEta->Fill(eta, chi2oNDF); + tkmes.Chi2oNDFVsPt->Fill(pt, chi2oNDF); + tkmes.Chi2oNDFVsNHits->Fill(nRecHits, chi2oNDF); + if (doAllPlots_) { + // general properties if (doThetaPlots_) { - tkmes.TrackTheta->Fill(theta); - } - tkmes.TrackQ->Fill(q); - if (p > 0.) { - tkmes.TrackQoverP->Fill(q/p); - } - // errors - tkmes.TrackPtErr->Fill(pterror); - tkmes.TrackPtErrVsEta->Fill(eta,pterror); - if (doTrackPxPyPlots_) { - tkmes.TrackPxErr->Fill(pxerror); - tkmes.TrackPyErr->Fill(pyerror); - } - tkmes.TrackPzErr->Fill(pzerror); - tkmes.TrackPErr->Fill(perror); - tkmes.TrackPhiErr->Fill(phierror); - tkmes.TrackEtaErr->Fill(etaerror); - - int nRecHits = track.hitPattern().numberOfAllHits(reco::HitPattern::TRACK_HITS); - int nValidRecHits = track.numberOfValidHits(); - // rec hits - tkmes.NumberOfRecHitsPerTrackVsPhi->Fill(phi, nRecHits); - if (doThetaPlots_) { - tkmes.NumberOfRecHitsPerTrackVsTheta->Fill(theta,nRecHits); - } - tkmes.NumberOfRecHitsPerTrackVsEta->Fill(eta, nRecHits); - - tkmes.NumberOfValidRecHitsPerTrackVsPhi->Fill(phi, nValidRecHits); - tkmes.NumberOfValidRecHitsPerTrackVsEta->Fill(eta, nValidRecHits); - tkmes.NumberOfValidRecHitsPerTrackVsPt ->Fill(pt, nValidRecHits); - - int nLayers = track.hitPattern().trackerLayersWithMeasurement(); - // rec layers - tkmes.NumberOfLayersPerTrackVsPhi->Fill(phi, nLayers); - if (doThetaPlots_) { - tkmes.NumberOfLayersPerTrackVsTheta->Fill(theta, nLayers); - } - tkmes.NumberOfLayersPerTrackVsEta->Fill(eta, nLayers); - - double chi2prob = TMath::Prob(track.chi2(),(int)track.ndof()); - double chi2oNDF = track.normalizedChi2(); - - tkmes.Chi2oNDFVsEta->Fill(eta, chi2oNDF); - tkmes.Chi2oNDFVsPt->Fill(pt, chi2oNDF); - tkmes.Chi2oNDFVsNHits->Fill(nRecHits, chi2oNDF); - - if(doAllPlots_) { - - // general properties - if (doThetaPlots_) { - tkmes.Chi2oNDFVsTheta->Fill(theta, chi2oNDF); - } - tkmes.Chi2oNDFVsPhi->Fill(phi, chi2oNDF); - tkmes.Chi2ProbVsPhi->Fill(phi, chi2prob); - tkmes.Chi2ProbVsEta->Fill(eta, chi2prob); + tkmes.Chi2oNDFVsTheta->Fill(theta, chi2oNDF); } - + tkmes.Chi2oNDFVsPhi->Fill(phi, chi2oNDF); + tkmes.Chi2ProbVsPhi->Fill(phi, chi2prob); + tkmes.Chi2ProbVsEta->Fill(eta, chi2prob); } - + } } +void TrackAnalyzer::bookHistosForTrackerSpecific(DQMStore::IBooker& ibooker) { + // parameters from the configuration + std::string QualName = conf_->getParameter("Quality"); + std::string AlgoName = conf_->getParameter("AlgoName"); -void TrackAnalyzer::bookHistosForTrackerSpecific(DQMStore::IBooker & ibooker) -{ - - // parameters from the configuration - std::string QualName = conf_->getParameter("Quality"); - std::string AlgoName = conf_->getParameter("AlgoName"); - - // use the AlgoName and Quality Name - std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; + // use the AlgoName and Quality Name + std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; - int PhiBin = conf_->getParameter( "PhiBin"); - double PhiMin = conf_->getParameter("PhiMin"); - double PhiMax = conf_->getParameter("PhiMax"); + int PhiBin = conf_->getParameter("PhiBin"); + double PhiMin = conf_->getParameter("PhiMin"); + double PhiMax = conf_->getParameter("PhiMax"); - int EtaBin = conf_->getParameter( "EtaBin"); - double EtaMin = conf_->getParameter("EtaMin"); - double EtaMax = conf_->getParameter("EtaMax"); - - int PtBin = conf_->getParameter( "TrackPtBin"); - double PtMin = conf_->getParameter("TrackPtMin"); - double PtMax = conf_->getParameter("TrackPtMax"); - - // book hit property histograms - // ---------------------------------------------------------------------------------// - ibooker.setCurrentFolder(TopFolder_+"/HitProperties"); - - - - std::vector subdetectors = conf_->getParameter >("subdetectors"); - int detBin = conf_->getParameter("subdetectorBin"); - - for ( auto det : subdetectors ) { - - // hits properties - ibooker.setCurrentFolder(TopFolder_+"/HitProperties/"+det); - - TkRecHitsPerSubDetMEs recHitsPerSubDet_mes; - - recHitsPerSubDet_mes.detectorTag = det; - int detID = -1; - if ( det == "TIB" ) detID = StripSubdetector::TIB; // 3 - if ( det == "TOB" ) detID = StripSubdetector::TOB; // 5 - if ( det == "TID" ) detID = StripSubdetector::TID; // 4 - if ( det == "TEC" ) detID = StripSubdetector::TEC; // 6 - if ( det == "PixBarrel" ) detID = PixelSubdetector::PixelBarrel; // 1 - if ( det == "PixEndcap" ) detID = PixelSubdetector::PixelEndcap; // 2 - if ( det == "Pixel" ) detID = 0; - if ( det == "Strip" ) detID = 7; - - recHitsPerSubDet_mes.detectorId = detID; - - histname = "NumberOfRecHitsPerTrack_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfRecHitsPerTrack = ibooker.book1D(histname, histname, detBin, -0.5, double(detBin)-0.5); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of " + det + " valid RecHits in each Track",1); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfRecHitsPerTrackVsPhi_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin)-0.5,""); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of " + det + " valid RecHits in each Track",2); - - histname = "NumberOfRecHitsPerTrackVsEta_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin)-0.5,""); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of " + det + " valid RecHits in each Track",2); - - histname = "NumberOfRecHitsPerTrackVsPt_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPt = ibooker.bookProfile(histname, histname, PtBin, PtMin, PtMax, detBin, -0.5, double(detBin)-0.5,""); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]",1); - recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPt->setAxisTitle("Number of " + det + " valid RecHits in each Track",2); - - histname = "NumberOfLayersPerTrack_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfLayersPerTrack = ibooker.book1D(histname, histname, detBin, -0.5, double(detBin)-0.5); - recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of " + det + " valid Layers in each Track",1); - recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of Tracks", 2); - - histname = "NumberOfLayersPerTrackVsPhi_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin)-0.5,""); - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi",1); - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of " + det + " valid Layers in each Track",2); - - histname = "NumberOfLayersPerTrackVsEta_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin)-0.5,""); - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta",1); - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of " + det + " valid Layers in each Track",2); - - histname = "NumberOfLayersPerTrackVsPt_" + det + "_" + CategoryName; - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPt = ibooker.bookProfile(histname, histname, PtBin, PtMin, PtMax, detBin, -0.5, double(detBin)-0.5,""); - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]",1); - recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPt->setAxisTitle("Number of " + det + " valid Layers in each Track",2); - - TkRecHitsPerSubDetMEMap.insert(std::pair(det,recHitsPerSubDet_mes)); - - - } + int EtaBin = conf_->getParameter("EtaBin"); + double EtaMin = conf_->getParameter("EtaMin"); + double EtaMax = conf_->getParameter("EtaMax"); + int PtBin = conf_->getParameter("TrackPtBin"); + double PtMin = conf_->getParameter("TrackPtMin"); + double PtMax = conf_->getParameter("TrackPtMax"); + // book hit property histograms + // ---------------------------------------------------------------------------------// + ibooker.setCurrentFolder(TopFolder_ + "/HitProperties"); + + std::vector subdetectors = conf_->getParameter >("subdetectors"); + int detBin = conf_->getParameter("subdetectorBin"); + + for (auto det : subdetectors) { + // hits properties + ibooker.setCurrentFolder(TopFolder_ + "/HitProperties/" + det); + + TkRecHitsPerSubDetMEs recHitsPerSubDet_mes; + + recHitsPerSubDet_mes.detectorTag = det; + int detID = -1; + if (det == "TIB") + detID = StripSubdetector::TIB; // 3 + if (det == "TOB") + detID = StripSubdetector::TOB; // 5 + if (det == "TID") + detID = StripSubdetector::TID; // 4 + if (det == "TEC") + detID = StripSubdetector::TEC; // 6 + if (det == "PixBarrel") + detID = PixelSubdetector::PixelBarrel; // 1 + if (det == "PixEndcap") + detID = PixelSubdetector::PixelEndcap; // 2 + if (det == "Pixel") + detID = 0; + if (det == "Strip") + detID = 7; + + recHitsPerSubDet_mes.detectorId = detID; + + histname = "NumberOfRecHitsPerTrack_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfRecHitsPerTrack = + ibooker.book1D(histname, histname, detBin, -0.5, double(detBin) - 0.5); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of " + det + " valid RecHits in each Track", 1); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfRecHitsPerTrackVsPhi_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi = + ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin) - 0.5, ""); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi", 1); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of " + det + " valid RecHits in each Track", + 2); + + histname = "NumberOfRecHitsPerTrackVsEta_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta = + ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin) - 0.5, ""); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta", 1); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of " + det + " valid RecHits in each Track", + 2); + + histname = "NumberOfRecHitsPerTrackVsPt_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPt = + ibooker.bookProfile(histname, histname, PtBin, PtMin, PtMax, detBin, -0.5, double(detBin) - 0.5, ""); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); + recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPt->setAxisTitle("Number of " + det + " valid RecHits in each Track", + 2); + + histname = "NumberOfLayersPerTrack_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfLayersPerTrack = + ibooker.book1D(histname, histname, detBin, -0.5, double(detBin) - 0.5); + recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of " + det + " valid Layers in each Track", 1); + recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfLayersPerTrackVsPhi_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi = + ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin) - 0.5, ""); + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi", 1); + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of " + det + " valid Layers in each Track", + 2); + + histname = "NumberOfLayersPerTrackVsEta_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta = + ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin) - 0.5, ""); + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta", 1); + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of " + det + " valid Layers in each Track", + 2); + + histname = "NumberOfLayersPerTrackVsPt_" + det + "_" + CategoryName; + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPt = + ibooker.bookProfile(histname, histname, PtBin, PtMin, PtMax, detBin, -0.5, double(detBin) - 0.5, ""); + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPt->setAxisTitle("Track p_{T} [GeV]", 1); + recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPt->setAxisTitle("Number of " + det + " valid Layers in each Track", + 2); + + TkRecHitsPerSubDetMEMap.insert(std::pair(det, recHitsPerSubDet_mes)); + } } +void TrackAnalyzer::fillHistosForTrackerSpecific(const reco::Track& track) { + double phi = track.phi(); + double eta = track.eta(); + double pt = track.pt(); -void TrackAnalyzer::fillHistosForTrackerSpecific(const reco::Track & track) -{ - - double phi = track.phi(); - double eta = track.eta(); - double pt = track.pt(); - - for ( std::map::iterator it = TkRecHitsPerSubDetMEMap.begin(); - it != TkRecHitsPerSubDetMEMap.end(); it++ ) { - - int nValidLayers = 0; + for (std::map::iterator it = TkRecHitsPerSubDetMEMap.begin(); + it != TkRecHitsPerSubDetMEMap.end(); + it++) { + int nValidLayers = 0; int nValidRecHits = 0; int substr = it->second.detectorId; - switch(substr) { - case 0 : - nValidLayers = track.hitPattern().pixelBarrelLayersWithMeasurement() - + track.hitPattern().pixelEndcapLayersWithMeasurement(); // case 0: pixel - nValidRecHits = track.hitPattern().numberOfValidPixelBarrelHits() - + track.hitPattern().numberOfValidPixelEndcapHits(); // case 0: pixel - break; - case StripSubdetector::TIB : - nValidLayers = track.hitPattern().stripTIBLayersWithMeasurement(); // case 3: strip TIB - nValidRecHits = track.hitPattern().numberOfValidStripTIBHits(); // case 3: strip TIB - break; - case StripSubdetector::TID : - nValidLayers = track.hitPattern().stripTIDLayersWithMeasurement(); // case 4: strip TID - nValidRecHits = track.hitPattern().numberOfValidStripTIDHits(); // case 4: strip TID - break; - case StripSubdetector::TOB : - nValidLayers = track.hitPattern().stripTOBLayersWithMeasurement(); // case 5: strip TOB - nValidRecHits = track.hitPattern().numberOfValidStripTOBHits(); // case 5: strip TOB - break; - case StripSubdetector::TEC : - nValidLayers = track.hitPattern().stripTECLayersWithMeasurement(); // case 6: strip TEC - nValidRecHits = track.hitPattern().numberOfValidStripTECHits(); // case 6: strip TEC - break; - case PixelSubdetector::PixelBarrel : - nValidLayers = track.hitPattern().pixelBarrelLayersWithMeasurement(); // case 1: pixel PXB - nValidRecHits = track.hitPattern().numberOfValidPixelBarrelHits(); // case 1: pixel PXB - break; - case PixelSubdetector::PixelEndcap : - nValidLayers = track.hitPattern().pixelEndcapLayersWithMeasurement(); // case 2: pixel PXF - nValidRecHits = track.hitPattern().numberOfValidPixelEndcapHits(); // case 2: pixel PXF - break; - case 7 : - nValidLayers = track.hitPattern().stripTIBLayersWithMeasurement() // case 7: strip - + track.hitPattern().stripTIDLayersWithMeasurement() - + track.hitPattern().stripTOBLayersWithMeasurement() - + track.hitPattern().stripTECLayersWithMeasurement(); - nValidRecHits = track.hitPattern().numberOfValidStripTIBHits() // case 7: strip - + track.hitPattern().numberOfValidStripTIDHits() - + track.hitPattern().numberOfValidStripTOBHits() - + track.hitPattern().numberOfValidStripTECHits(); - break; - default : - break; + switch (substr) { + case 0: + nValidLayers = track.hitPattern().pixelBarrelLayersWithMeasurement() + + track.hitPattern().pixelEndcapLayersWithMeasurement(); // case 0: pixel + nValidRecHits = track.hitPattern().numberOfValidPixelBarrelHits() + + track.hitPattern().numberOfValidPixelEndcapHits(); // case 0: pixel + break; + case StripSubdetector::TIB: + nValidLayers = track.hitPattern().stripTIBLayersWithMeasurement(); // case 3: strip TIB + nValidRecHits = track.hitPattern().numberOfValidStripTIBHits(); // case 3: strip TIB + break; + case StripSubdetector::TID: + nValidLayers = track.hitPattern().stripTIDLayersWithMeasurement(); // case 4: strip TID + nValidRecHits = track.hitPattern().numberOfValidStripTIDHits(); // case 4: strip TID + break; + case StripSubdetector::TOB: + nValidLayers = track.hitPattern().stripTOBLayersWithMeasurement(); // case 5: strip TOB + nValidRecHits = track.hitPattern().numberOfValidStripTOBHits(); // case 5: strip TOB + break; + case StripSubdetector::TEC: + nValidLayers = track.hitPattern().stripTECLayersWithMeasurement(); // case 6: strip TEC + nValidRecHits = track.hitPattern().numberOfValidStripTECHits(); // case 6: strip TEC + break; + case PixelSubdetector::PixelBarrel: + nValidLayers = track.hitPattern().pixelBarrelLayersWithMeasurement(); // case 1: pixel PXB + nValidRecHits = track.hitPattern().numberOfValidPixelBarrelHits(); // case 1: pixel PXB + break; + case PixelSubdetector::PixelEndcap: + nValidLayers = track.hitPattern().pixelEndcapLayersWithMeasurement(); // case 2: pixel PXF + nValidRecHits = track.hitPattern().numberOfValidPixelEndcapHits(); // case 2: pixel PXF + break; + case 7: + nValidLayers = track.hitPattern().stripTIBLayersWithMeasurement() // case 7: strip + + track.hitPattern().stripTIDLayersWithMeasurement() + + track.hitPattern().stripTOBLayersWithMeasurement() + + track.hitPattern().stripTECLayersWithMeasurement(); + nValidRecHits = track.hitPattern().numberOfValidStripTIBHits() // case 7: strip + + track.hitPattern().numberOfValidStripTIDHits() + + track.hitPattern().numberOfValidStripTOBHits() + track.hitPattern().numberOfValidStripTECHits(); + break; + default: + break; } //Fill Layers and RecHits - it->second.NumberOfRecHitsPerTrack -> Fill(nValidRecHits); - it->second.NumberOfRecHitsPerTrackVsPhi -> Fill(phi, nValidRecHits); - it->second.NumberOfRecHitsPerTrackVsEta -> Fill(eta, nValidRecHits); - it->second.NumberOfRecHitsPerTrackVsPt -> Fill(pt, nValidRecHits); - - it->second.NumberOfLayersPerTrack -> Fill(nValidLayers); - it->second.NumberOfLayersPerTrackVsPhi -> Fill(phi, nValidLayers); - it->second.NumberOfLayersPerTrackVsEta -> Fill(eta, nValidLayers); - it->second.NumberOfLayersPerTrackVsPt -> Fill(pt, nValidLayers); + it->second.NumberOfRecHitsPerTrack->Fill(nValidRecHits); + it->second.NumberOfRecHitsPerTrackVsPhi->Fill(phi, nValidRecHits); + it->second.NumberOfRecHitsPerTrackVsEta->Fill(eta, nValidRecHits); + it->second.NumberOfRecHitsPerTrackVsPt->Fill(pt, nValidRecHits); + + it->second.NumberOfLayersPerTrack->Fill(nValidLayers); + it->second.NumberOfLayersPerTrackVsPhi->Fill(phi, nValidLayers); + it->second.NumberOfLayersPerTrackVsEta->Fill(eta, nValidLayers); + it->second.NumberOfLayersPerTrackVsPt->Fill(pt, nValidLayers); } - } // // -- Set Lumi Flag // -void TrackAnalyzer::setLumiFlag() { - +void TrackAnalyzer::setLumiFlag() { TkParameterMEs tkmes; - if ( Chi2oNDF_lumiFlag ) Chi2oNDF_lumiFlag -> setLumiFlag(); - if ( NumberOfRecHitsPerTrack_lumiFlag ) NumberOfRecHitsPerTrack_lumiFlag -> setLumiFlag(); + if (Chi2oNDF_lumiFlag) + Chi2oNDF_lumiFlag->setLumiFlag(); + if (NumberOfRecHitsPerTrack_lumiFlag) + NumberOfRecHitsPerTrack_lumiFlag->setLumiFlag(); } // -// -- Apply SoftReset +// -- Apply SoftReset // -void TrackAnalyzer::doSoftReset(DQMStore * dqmStore_) { +void TrackAnalyzer::doSoftReset(DQMStore* dqmStore_) { TkParameterMEs tkmes; dqmStore_->softReset(Chi2oNDF); dqmStore_->softReset(NumberOfRecHitsPerTrack); } // -// -- Apply Reset +// -- Apply Reset // void TrackAnalyzer::doReset() { TkParameterMEs tkmes; - if ( Chi2oNDF_lumiFlag ) Chi2oNDF_lumiFlag -> Reset(); - if ( NumberOfRecHitsPerTrack_lumiFlag ) NumberOfRecHitsPerTrack_lumiFlag -> Reset(); + if (Chi2oNDF_lumiFlag) + Chi2oNDF_lumiFlag->Reset(); + if (NumberOfRecHitsPerTrack_lumiFlag) + NumberOfRecHitsPerTrack_lumiFlag->Reset(); } // // -- Remove SoftReset // -void TrackAnalyzer::undoSoftReset(DQMStore * dqmStore_) { +void TrackAnalyzer::undoSoftReset(DQMStore* dqmStore_) { TkParameterMEs tkmes; dqmStore_->disableSoftReset(Chi2oNDF); dqmStore_->disableSoftReset(NumberOfRecHitsPerTrack); } - - diff --git a/DQM/TrackingMonitor/src/TrackingMonitor.cc b/DQM/TrackingMonitor/src/TrackingMonitor.cc index 1d97a2daf5301..74f69e0ff3114 100644 --- a/DQM/TrackingMonitor/src/TrackingMonitor.cc +++ b/DQM/TrackingMonitor/src/TrackingMonitor.cc @@ -22,10 +22,10 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/Registry.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" -#include "TrackingTools/Records/interface/TransientRecHitRecord.h" +#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "TrackingTools/PatternTools/interface/TSCBLBuilderNoMaterial.h" #include "TrackingTools/PatternTools/interface/TSCPBuilderNoMaterial.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" @@ -40,80 +40,83 @@ #include #ifdef VI_DEBUG -#define COUT(x) std::cout << x << ' ' +#define COUT(x) std::cout << x << ' ' #else -#define COUT(x) LogDebug(x) +#define COUT(x) LogDebug(x) #endif - -// TrackingMonitor +// TrackingMonitor // ----------------------------------------------------------------------------------// -TrackingMonitor::TrackingMonitor(const edm::ParameterSet& iConfig) - : confID_ ( iConfig.id() ) - , theTrackBuildingAnalyzer( new TrackBuildingAnalyzer(iConfig) ) - , NumberOfTracks(nullptr) - , NumberOfMeanRecHitsPerTrack(nullptr) - , NumberOfMeanLayersPerTrack(nullptr) - // , NumberOfGoodTracks(NULL) - , FractionOfGoodTracks(nullptr) - , NumberOfTrackingRegions(nullptr) - , NumberOfSeeds(nullptr) - , NumberOfSeeds_lumiFlag(nullptr) - , NumberOfTrackCandidates(nullptr) - , FractionCandidatesOverSeeds(nullptr) - // , NumberOfGoodTrkVsClus(NULL) - , NumberEventsOfVsLS(nullptr) - , NumberOfTracksVsLS(nullptr) - // , NumberOfGoodTracksVsLS(NULL) - , GoodTracksFractionVsLS(nullptr) - // , GoodTracksNumberOfRecHitsPerTrackVsLS(NULL) - // ADD by Mia for PU monitoring - // vertex plots to be moved in ad hoc class - , NumberOfGoodPVtxVsLS(nullptr) - , NumberOfGoodPVtxWO0VsLS(nullptr) - , NumberEventsOfVsBX (nullptr) - , NumberOfTracksVsBX(nullptr) - , GoodTracksFractionVsBX(nullptr) - , NumberOfRecHitsPerTrackVsBX(nullptr) - , NumberOfGoodPVtxVsBX(nullptr) - , NumberOfGoodPVtxWO0VsBX(nullptr) - , NumberOfTracksVsBXlumi(nullptr) - , NumberOfTracksVsGoodPVtx(nullptr) - , NumberOfTracksVsPUPVtx(nullptr) - , NumberEventsOfVsGoodPVtx(nullptr) - , GoodTracksFractionVsGoodPVtx(nullptr) - , NumberOfRecHitsPerTrackVsGoodPVtx(nullptr) - , NumberOfPVtxVsGoodPVtx(nullptr) - , NumberOfPixelClustersVsGoodPVtx(nullptr) - , NumberOfStripClustersVsGoodPVtx(nullptr) - , NumberEventsOfVsLUMI(nullptr) - , NumberOfTracksVsLUMI(nullptr) - , GoodTracksFractionVsLUMI(nullptr) - , NumberOfRecHitsPerTrackVsLUMI(nullptr) - , NumberOfGoodPVtxVsLUMI(nullptr) - , NumberOfGoodPVtxWO0VsLUMI(nullptr) - , NumberOfPixelClustersVsLUMI(nullptr) - , NumberOfStripClustersVsLUMI(nullptr) - , NumberOfTracks_lumiFlag(nullptr) - // , NumberOfGoodTracks_lumiFlag(NULL) - - , builderName ( iConfig.getParameter("TTRHBuilder")) - , doTrackerSpecific_ ( iConfig.getParameter("doTrackerSpecific") ) - , doLumiAnalysis ( iConfig.getParameter("doLumiAnalysis")) - , doProfilesVsLS_ ( iConfig.getParameter("doProfilesVsLS")) - , doAllPlots ( iConfig.getParameter("doAllPlots")) - , doGeneralPropertiesPlots_( iConfig.getParameter("doGeneralPropertiesPlots")) - , doHitPropertiesPlots_ ( iConfig.getParameter("doHitPropertiesPlots")) - , doPUmonitoring_ ( iConfig.getParameter("doPUmonitoring") ) - , genTriggerEventFlag_(new GenericTriggerEventFlag(iConfig.getParameter("genericTriggerEventPSet"),consumesCollector(), *this)) - , numSelection_ (iConfig.getParameter("numCut")) - , denSelection_ (iConfig.getParameter("denCut")) - , pvNDOF_ ( iConfig.getParameter ("pvNDOF") ) -{ - - edm::ConsumesCollector c{ consumesCollector() }; - theTrackAnalyzer = new dqm::TrackAnalyzer( iConfig,c ); +TrackingMonitor::TrackingMonitor(const edm::ParameterSet& iConfig) + : confID_(iConfig.id()), + theTrackBuildingAnalyzer(new TrackBuildingAnalyzer(iConfig)), + NumberOfTracks(nullptr), + NumberOfMeanRecHitsPerTrack(nullptr), + NumberOfMeanLayersPerTrack(nullptr) + // , NumberOfGoodTracks(NULL) + , + FractionOfGoodTracks(nullptr), + NumberOfTrackingRegions(nullptr), + NumberOfSeeds(nullptr), + NumberOfSeeds_lumiFlag(nullptr), + NumberOfTrackCandidates(nullptr), + FractionCandidatesOverSeeds(nullptr) + // , NumberOfGoodTrkVsClus(NULL) + , + NumberEventsOfVsLS(nullptr), + NumberOfTracksVsLS(nullptr) + // , NumberOfGoodTracksVsLS(NULL) + , + GoodTracksFractionVsLS(nullptr) + // , GoodTracksNumberOfRecHitsPerTrackVsLS(NULL) + // ADD by Mia for PU monitoring + // vertex plots to be moved in ad hoc class + , + NumberOfGoodPVtxVsLS(nullptr), + NumberOfGoodPVtxWO0VsLS(nullptr), + NumberEventsOfVsBX(nullptr), + NumberOfTracksVsBX(nullptr), + GoodTracksFractionVsBX(nullptr), + NumberOfRecHitsPerTrackVsBX(nullptr), + NumberOfGoodPVtxVsBX(nullptr), + NumberOfGoodPVtxWO0VsBX(nullptr), + NumberOfTracksVsBXlumi(nullptr), + NumberOfTracksVsGoodPVtx(nullptr), + NumberOfTracksVsPUPVtx(nullptr), + NumberEventsOfVsGoodPVtx(nullptr), + GoodTracksFractionVsGoodPVtx(nullptr), + NumberOfRecHitsPerTrackVsGoodPVtx(nullptr), + NumberOfPVtxVsGoodPVtx(nullptr), + NumberOfPixelClustersVsGoodPVtx(nullptr), + NumberOfStripClustersVsGoodPVtx(nullptr), + NumberEventsOfVsLUMI(nullptr), + NumberOfTracksVsLUMI(nullptr), + GoodTracksFractionVsLUMI(nullptr), + NumberOfRecHitsPerTrackVsLUMI(nullptr), + NumberOfGoodPVtxVsLUMI(nullptr), + NumberOfGoodPVtxWO0VsLUMI(nullptr), + NumberOfPixelClustersVsLUMI(nullptr), + NumberOfStripClustersVsLUMI(nullptr), + NumberOfTracks_lumiFlag(nullptr) + // , NumberOfGoodTracks_lumiFlag(NULL) + + , + builderName(iConfig.getParameter("TTRHBuilder")), + doTrackerSpecific_(iConfig.getParameter("doTrackerSpecific")), + doLumiAnalysis(iConfig.getParameter("doLumiAnalysis")), + doProfilesVsLS_(iConfig.getParameter("doProfilesVsLS")), + doAllPlots(iConfig.getParameter("doAllPlots")), + doGeneralPropertiesPlots_(iConfig.getParameter("doGeneralPropertiesPlots")), + doHitPropertiesPlots_(iConfig.getParameter("doHitPropertiesPlots")), + doPUmonitoring_(iConfig.getParameter("doPUmonitoring")), + genTriggerEventFlag_(new GenericTriggerEventFlag( + iConfig.getParameter("genericTriggerEventPSet"), consumesCollector(), *this)), + numSelection_(iConfig.getParameter("numCut")), + denSelection_(iConfig.getParameter("denCut")), + pvNDOF_(iConfig.getParameter("pvNDOF")) { + edm::ConsumesCollector c{consumesCollector()}; + theTrackAnalyzer = new dqm::TrackAnalyzer(iConfig, c); // input tags for collections from the configuration bsSrc_ = iConfig.getParameter("beamSpot"); @@ -121,601 +124,596 @@ TrackingMonitor::TrackingMonitor(const edm::ParameterSet& iConfig) bsSrcToken_ = consumes(bsSrc_); pvSrcToken_ = mayConsume(pvSrc_); - lumiscalersToken_ = consumes(iConfig.getParameter("scal") ); + lumiscalersToken_ = consumes(iConfig.getParameter("scal")); edm::InputTag alltrackProducer = iConfig.getParameter("allTrackProducer"); - edm::InputTag trackProducer = iConfig.getParameter("TrackProducer"); - edm::InputTag tcProducer = iConfig.getParameter("TCProducer"); - edm::InputTag seedProducer = iConfig.getParameter("SeedProducer"); - allTrackToken_ = consumes >(alltrackProducer); - trackToken_ = consumes >(trackProducer); - trackCandidateToken_ = consumes(tcProducer); - seedToken_ = consumes >(seedProducer); - seedStopInfoToken_ = consumes >(tcProducer); + edm::InputTag trackProducer = iConfig.getParameter("TrackProducer"); + edm::InputTag tcProducer = iConfig.getParameter("TCProducer"); + edm::InputTag seedProducer = iConfig.getParameter("SeedProducer"); + allTrackToken_ = consumes >(alltrackProducer); + trackToken_ = consumes >(trackProducer); + trackCandidateToken_ = consumes(tcProducer); + seedToken_ = consumes >(seedProducer); + seedStopInfoToken_ = consumes >(tcProducer); doMVAPlots = iConfig.getParameter("doMVAPlots"); - if(doMVAPlots) { - mvaQualityTokens_ = edm::vector_transform(iConfig.getParameter >("MVAProducers"), - [&](const std::string& tag) { - return std::make_tuple(consumes(edm::InputTag(tag, "MVAValues")), - consumes(edm::InputTag(tag, "QualityMasks"))); - }); + if (doMVAPlots) { + mvaQualityTokens_ = edm::vector_transform( + iConfig.getParameter >("MVAProducers"), [&](const std::string& tag) { + return std::make_tuple(consumes(edm::InputTag(tag, "MVAValues")), + consumes(edm::InputTag(tag, "QualityMasks"))); + }); mvaTrackToken_ = consumes >(iConfig.getParameter("TrackProducerForMVA")); } doRegionPlots = iConfig.getParameter("doRegionPlots"); doRegionCandidatePlots = iConfig.getParameter("doRegionCandidatePlots"); - if(doRegionPlots) { + if (doRegionPlots) { const auto& regionTag = iConfig.getParameter("RegionProducer"); - if(!regionTag.label().empty()) { + if (!regionTag.label().empty()) { regionToken_ = consumes >(regionTag); } const auto& regionLayersTag = iConfig.getParameter("RegionSeedingLayersProducer"); - if(!regionLayersTag.label().empty()) { - if(!regionToken_.isUninitialized()) { - throw cms::Exception("Configuration") << "Only one of 'RegionProducer' and 'RegionSeedingLayersProducer' can be non-empty, now both are."; + if (!regionLayersTag.label().empty()) { + if (!regionToken_.isUninitialized()) { + throw cms::Exception("Configuration") + << "Only one of 'RegionProducer' and 'RegionSeedingLayersProducer' can be non-empty, now both are."; } regionLayerSetsToken_ = consumes(regionLayersTag); - } - else if(regionToken_.isUninitialized()) { - throw cms::Exception("Configuration") << "With doRegionPlots=True either 'RegionProducer' or 'RegionSeedingLayersProducer' must be non-empty, now both are empty."; + } else if (regionToken_.isUninitialized()) { + throw cms::Exception("Configuration") << "With doRegionPlots=True either 'RegionProducer' or " + "'RegionSeedingLayersProducer' must be non-empty, now both are empty."; } - if(doRegionCandidatePlots) { + if (doRegionCandidatePlots) { regionCandidateToken_ = consumes(iConfig.getParameter("RegionCandidates")); } } edm::InputTag stripClusterInputTag_ = iConfig.getParameter("stripCluster"); edm::InputTag pixelClusterInputTag_ = iConfig.getParameter("pixelCluster"); - stripClustersToken_ = mayConsume > (stripClusterInputTag_); - pixelClustersToken_ = mayConsume > (pixelClusterInputTag_); + stripClustersToken_ = mayConsume >(stripClusterInputTag_); + pixelClustersToken_ = mayConsume >(pixelClusterInputTag_); doFractionPlot_ = true; - if (alltrackProducer.label()==trackProducer.label()) doFractionPlot_ = false; - - Quality_ = iConfig.getParameter("Quality"); + if (alltrackProducer.label() == trackProducer.label()) + doFractionPlot_ = false; + + Quality_ = iConfig.getParameter("Quality"); AlgoName_ = iConfig.getParameter("AlgoName"); - + // get flag from the configuration - doPlotsVsBXlumi_ = iConfig.getParameter("doPlotsVsBXlumi"); - if ( doPlotsVsBXlumi_ ) - theLumiDetails_ = new GetLumi( iConfig.getParameter("BXlumiSetup"), c ); + doPlotsVsBXlumi_ = iConfig.getParameter("doPlotsVsBXlumi"); + if (doPlotsVsBXlumi_) + theLumiDetails_ = new GetLumi(iConfig.getParameter("BXlumiSetup"), c); doPlotsVsGoodPVtx_ = iConfig.getParameter("doPlotsVsGoodPVtx"); - doPlotsVsLUMI_ = iConfig.getParameter("doPlotsVsLUMI"); - doPlotsVsBX_ = iConfig.getParameter("doPlotsVsBX"); - - if ( doPUmonitoring_ ) { - - std::vector primaryVertexInputTags = iConfig.getParameter >("primaryVertexInputTags"); - std::vector selPrimaryVertexInputTags = iConfig.getParameter >("selPrimaryVertexInputTags"); - std::vector pvLabels = iConfig.getParameter > ("pvLabels"); - - if (primaryVertexInputTags.size()==pvLabels.size() and primaryVertexInputTags.size()==selPrimaryVertexInputTags.size()) { - for (size_t i=0; i("doPlotsVsLUMI"); + doPlotsVsBX_ = iConfig.getParameter("doPlotsVsBX"); + + if (doPUmonitoring_) { + std::vector primaryVertexInputTags = + iConfig.getParameter >("primaryVertexInputTags"); + std::vector selPrimaryVertexInputTags = + iConfig.getParameter >("selPrimaryVertexInputTags"); + std::vector pvLabels = iConfig.getParameter >("pvLabels"); + + if (primaryVertexInputTags.size() == pvLabels.size() and + primaryVertexInputTags.size() == selPrimaryVertexInputTags.size()) { + for (size_t i = 0; i < primaryVertexInputTags.size(); i++) { + edm::InputTag iPVinputTag = primaryVertexInputTags[i]; + edm::InputTag iSelPVinputTag = selPrimaryVertexInputTags[i]; + std::string iPVlabel = pvLabels[i]; + + theVertexMonitor.push_back(new VertexMonitor(iConfig, iPVinputTag, iSelPVinputTag, iPVlabel, c)); } } } - } - -TrackingMonitor::~TrackingMonitor() -{ - if (theTrackAnalyzer) delete theTrackAnalyzer; - if (theTrackBuildingAnalyzer) delete theTrackBuildingAnalyzer; - if ( doPUmonitoring_ ) - for (size_t i=0; igetMapped(confID_); + assert(conf != nullptr); + std::string Quality = conf->getParameter("Quality"); + std::string AlgoName = conf->getParameter("AlgoName"); + MEFolderName = conf->getParameter("FolderName"); + + // test for the Quality veriable validity + if (!Quality_.empty()) { + if (Quality_ != "highPurity" && Quality_ != "tight" && Quality_ != "loose") { + edm::LogWarning("TrackingMonitor") << "Qualty Name is invalid, using no quality criterea by default"; + Quality_ = ""; + } + } + // use the AlgoName and Quality Name + std::string CategoryName = !Quality_.empty() ? AlgoName_ + "_" + Quality_ : AlgoName_; -void TrackingMonitor::bookHistograms(DQMStore::IBooker & ibooker, - edm::Run const & iRun, - edm::EventSetup const & iSetup) -{ - // parameters from the configuration - auto const* conf = edm::pset::Registry::instance()->getMapped(confID_); - assert(conf != nullptr); - std::string Quality = conf->getParameter("Quality"); - std::string AlgoName = conf->getParameter("AlgoName"); - MEFolderName = conf->getParameter("FolderName"); - - // test for the Quality veriable validity - if( !Quality_.empty()) { - if( Quality_ != "highPurity" && Quality_ != "tight" && Quality_ != "loose") { - edm::LogWarning("TrackingMonitor") << "Qualty Name is invalid, using no quality criterea by default"; - Quality_ = ""; - } - } - - // use the AlgoName and Quality Name - std::string CategoryName = !Quality_.empty() ? AlgoName_ + "_" + Quality_ : AlgoName_; - - // get binning from the configuration - int TKNoBin = conf->getParameter( "TkSizeBin"); - double TKNoMin = conf->getParameter("TkSizeMin"); - double TKNoMax = conf->getParameter("TkSizeMax"); - - int TCNoBin = conf->getParameter( "TCSizeBin"); - double TCNoMin = conf->getParameter("TCSizeMin"); - double TCNoMax = conf->getParameter("TCSizeMax"); - - int TKNoSeedBin = conf->getParameter( "TkSeedSizeBin"); - double TKNoSeedMin = conf->getParameter("TkSeedSizeMin"); - double TKNoSeedMax = conf->getParameter("TkSeedSizeMax"); - - int MeanHitBin = conf->getParameter( "MeanHitBin"); - double MeanHitMin = conf->getParameter("MeanHitMin"); - double MeanHitMax = conf->getParameter("MeanHitMax"); - - int MeanLayBin = conf->getParameter( "MeanLayBin"); - double MeanLayMin = conf->getParameter("MeanLayMin"); - double MeanLayMax = conf->getParameter("MeanLayMax"); - - int LSBin = conf->getParameter( "LSBin"); - int LSMin = conf->getParameter("LSMin"); - int LSMax = conf->getParameter("LSMax"); - - std::string StateName = conf->getParameter("MeasurementState"); - if ( - StateName != "OuterSurface" && - StateName != "InnerSurface" && - StateName != "ImpactPoint" && - StateName != "default" && - StateName != "All" - ) { - // print warning - edm::LogWarning("TrackingMonitor") << "State Name is invalid, using 'ImpactPoint' by default"; - } - - ibooker.setCurrentFolder(MEFolderName); - - // book the General Property histograms - // ---------------------------------------------------------------------------------// - - if (doGeneralPropertiesPlots_ || doAllPlots){ - - ibooker.setCurrentFolder(MEFolderName+"/GeneralProperties"); - - histname = "NumberOfTracks_" + CategoryName; - // MODIFY by Mia in order to cope w/ high multiplicity - NumberOfTracks = ibooker.book1D(histname, histname, 3*TKNoBin, TKNoMin, (TKNoMax+0.5)*3.-0.5); - NumberOfTracks->setAxisTitle("Number of Tracks per Event", 1); - NumberOfTracks->setAxisTitle("Number of Events", 2); - - histname = "NumberOfTracks_PUvtx_" + CategoryName; - NumberOfTracks_PUvtx = ibooker.book1D(histname, histname, 3*TKNoBin, TKNoMin, (TKNoMax+0.5)*3.-0.5); - NumberOfTracks_PUvtx->setAxisTitle("Number of Tracks per Event (matched a PU vertex)", 1); - NumberOfTracks_PUvtx->setAxisTitle("Number of Events", 2); - - histname = "NumberofTracks_Hardvtx_" + CategoryName; - NumberofTracks_Hardvtx = ibooker.book1D(histname, histname, TKNoBin/10, TKNoMin, (TKNoMax/10+0.5)*3.-0.5); - NumberofTracks_Hardvtx->setAxisTitle("Number of Tracks per Event (matched main vertex)", 1); - NumberofTracks_Hardvtx->setAxisTitle("Number of Events", 2); - - histname = "NumberofTracks_Hardvtx_PUvtx_" + CategoryName; - NumberofTracks_Hardvtx_PUvtx = ibooker.book1D(histname, histname, 2, 0., 2.); - NumberofTracks_Hardvtx_PUvtx->setAxisTitle("Number of Tracks per PU/Hard vertex", 1); - NumberofTracks_Hardvtx_PUvtx->setAxisTitle("Number of Tracks", 2); - NumberofTracks_Hardvtx_PUvtx->setBinLabel(1,"PU_Vertex"); - NumberofTracks_Hardvtx_PUvtx->setBinLabel(2,"Hard_Vertex"); - - histname = "NumberOfMeanRecHitsPerTrack_" + CategoryName; - NumberOfMeanRecHitsPerTrack = ibooker.book1D(histname, histname, MeanHitBin, MeanHitMin, MeanHitMax); - NumberOfMeanRecHitsPerTrack->setAxisTitle("Mean number of valid RecHits per Track", 1); - NumberOfMeanRecHitsPerTrack->setAxisTitle("Entries", 2); - - histname = "NumberOfMeanLayersPerTrack_" + CategoryName; - NumberOfMeanLayersPerTrack = ibooker.book1D(histname, histname, MeanLayBin, MeanLayMin, MeanLayMax); - NumberOfMeanLayersPerTrack->setAxisTitle("Mean number of Layers per Track", 1); - NumberOfMeanLayersPerTrack->setAxisTitle("Entries", 2); - - if (doFractionPlot_) { - histname = "FractionOfGoodTracks_" + CategoryName; - FractionOfGoodTracks = ibooker.book1D(histname, histname, 101, -0.005, 1.005); - FractionOfGoodTracks->setAxisTitle("Fraction of Tracks (w.r.t. generalTracks)", 1); - FractionOfGoodTracks->setAxisTitle("Entries", 2); - } - } - - if ( doLumiAnalysis ) { - // add by Mia in order to deal with LS transitions - ibooker.setCurrentFolder(MEFolderName+"/LSanalysis"); - - histname = "NumberOfTracks_lumiFlag_" + CategoryName; - NumberOfTracks_lumiFlag = ibooker.book1D(histname, histname, 3*TKNoBin, TKNoMin, (TKNoMax+0.5)*3.-0.5); - NumberOfTracks_lumiFlag->setAxisTitle("Number of Tracks per Event", 1); - NumberOfTracks_lumiFlag->setAxisTitle("Number of Events", 2); - - } + // get binning from the configuration + int TKNoBin = conf->getParameter("TkSizeBin"); + double TKNoMin = conf->getParameter("TkSizeMin"); + double TKNoMax = conf->getParameter("TkSizeMax"); - // book profile plots vs LS : - //--------------------------- + int TCNoBin = conf->getParameter("TCSizeBin"); + double TCNoMin = conf->getParameter("TCSizeMin"); + double TCNoMax = conf->getParameter("TCSizeMax"); + int TKNoSeedBin = conf->getParameter("TkSeedSizeBin"); + double TKNoSeedMin = conf->getParameter("TkSeedSizeMin"); + double TKNoSeedMax = conf->getParameter("TkSeedSizeMax"); - if ( doProfilesVsLS_ || doAllPlots) { - - ibooker.setCurrentFolder(MEFolderName+"/GeneralProperties"); - - histname = "NumberOfTracksVsLS_"+ CategoryName; - NumberOfTracksVsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax, TKNoMin, TKNoMax*3.,""); - NumberOfTracksVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); - NumberOfTracksVsLS->setAxisTitle("#Lumi section",1); - NumberOfTracksVsLS->setAxisTitle("Number of Tracks",2); - - histname = "NumberOfRecHitsPerTrackVsLS_" + CategoryName; - NumberOfRecHitsPerTrackVsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax,0.,200.,""); - NumberOfRecHitsPerTrackVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); - NumberOfRecHitsPerTrackVsLS->setAxisTitle("#Lumi section",1); - NumberOfRecHitsPerTrackVsLS->setAxisTitle("Mean number of Valid RecHits per track",2); - - histname = "NumberEventsVsLS_" + CategoryName; - NumberEventsOfVsLS = ibooker.book1D(histname,histname, LSBin,LSMin,LSMax); - NumberEventsOfVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); - NumberEventsOfVsLS->setAxisTitle("#Lumi section",1); - NumberEventsOfVsLS->setAxisTitle("Number of events",2); - - double GoodPVtxMin = conf->getParameter("GoodPVtxMin"); - double GoodPVtxMax = conf->getParameter("GoodPVtxMax"); - - histname = "NumberOfGoodPVtxVsLS_" + CategoryName; - NumberOfGoodPVtxVsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax,GoodPVtxMin,3.*GoodPVtxMax,""); - NumberOfGoodPVtxVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); - NumberOfGoodPVtxVsLS->setAxisTitle("#Lumi section",1); - NumberOfGoodPVtxVsLS->setAxisTitle("Mean number of good PV",2); - - histname = "NumberOfGoodPVtxWO0VsLS_" + CategoryName; - NumberOfGoodPVtxWO0VsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax,GoodPVtxMin,3.*GoodPVtxMax,""); - NumberOfGoodPVtxWO0VsLS->setAxisTitle("#Lumi section",1); - NumberOfGoodPVtxWO0VsLS->setAxisTitle("Mean number of good PV",2); - - if (doFractionPlot_) { - histname = "GoodTracksFractionVsLS_"+ CategoryName; - GoodTracksFractionVsLS = ibooker.bookProfile(histname,histname, LSBin,LSMin,LSMax,0,1.1,""); - GoodTracksFractionVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); - GoodTracksFractionVsLS->setAxisTitle("#Lumi section",1); - GoodTracksFractionVsLS->setAxisTitle("Fraction of Good Tracks",2); - } - - if ( doPlotsVsBX_ || doAllPlots ) { - ibooker.setCurrentFolder(MEFolderName+"/BXanalysis"); - int BXBin = 3564; double BXMin = 0.5; double BXMax = 3564.5; - - histname = "NumberEventsVsBX_" + CategoryName; - NumberEventsOfVsBX = ibooker.book1D(histname,histname, BXBin,BXMin,BXMax); - NumberEventsOfVsBX->setAxisTitle("BX",1); - NumberEventsOfVsBX->setAxisTitle("Number of events",2); - - histname = "NumberOfTracksVsBX_"+ CategoryName; - NumberOfTracksVsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax, TKNoMin, TKNoMax*3.,""); - NumberOfTracksVsBX->setAxisTitle("BX",1); - NumberOfTracksVsBX->setAxisTitle("Number of Tracks",2); - - histname = "NumberOfRecHitsPerTrackVsBX_" + CategoryName; - NumberOfRecHitsPerTrackVsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax,0.,200.,""); - NumberOfRecHitsPerTrackVsBX->setAxisTitle("BX",1); - NumberOfRecHitsPerTrackVsBX->setAxisTitle("Mean number of Valid RecHits per track",2); - - histname = "NumberOfGoodPVtxVsBX_" + CategoryName; - NumberOfGoodPVtxVsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax,GoodPVtxMin,3.*GoodPVtxMax,""); - NumberOfGoodPVtxVsBX->setAxisTitle("BX",1); - NumberOfGoodPVtxVsBX->setAxisTitle("Mean number of good PV",2); - - histname = "NumberOfGoodPVtxWO0VsBX_" + CategoryName; - NumberOfGoodPVtxWO0VsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax,GoodPVtxMin,3.*GoodPVtxMax,""); - NumberOfGoodPVtxWO0VsBX->setAxisTitle("BX",1); - NumberOfGoodPVtxWO0VsBX->setAxisTitle("Mean number of good PV",2); - - if (doFractionPlot_) { - histname = "GoodTracksFractionVsBX_"+ CategoryName; - GoodTracksFractionVsBX = ibooker.bookProfile(histname,histname, BXBin,BXMin,BXMax,0,1.1,""); - GoodTracksFractionVsBX->setAxisTitle("BX",1); - GoodTracksFractionVsBX->setAxisTitle("Fraction of Good Tracks",2); - } - } - - } - - // book PU monitoring plots : - //--------------------------- - - if ( doPUmonitoring_ ) { - - for (size_t i=0; iinitHisto(ibooker); - } - - if ( doPlotsVsGoodPVtx_ ) { - ibooker.setCurrentFolder(MEFolderName+"/PUmonitoring"); - // get binning from the configuration - int PVBin = conf->getParameter ("PVBin"); - float PVMin = conf->getParameter("PVMin"); - float PVMax = conf->getParameter("PVMax"); - - histname = "NumberOfTracksVsGoodPVtx"; - NumberOfTracksVsGoodPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,TKNoMin, TKNoMax*5.,""); - NumberOfTracksVsGoodPVtx->setAxisTitle("Number of PV",1); - NumberOfTracksVsGoodPVtx->setAxisTitle("Mean number of Tracks per Event",2); - - histname = "NumberOfTracksVsPUPVtx"; - NumberOfTracksVsPUPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,0., TKNoMax*5.,""); - NumberOfTracksVsPUPVtx->setAxisTitle("Number of PU",1); - NumberOfTracksVsPUPVtx->setAxisTitle("Mean number of Tracks per PUvtx",2); - - histname = "NumberEventsVsGoodPVtx"; - NumberEventsOfVsGoodPVtx = ibooker.book1D(histname,histname,PVBin,PVMin,PVMax); - NumberEventsOfVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1); - NumberEventsOfVsGoodPVtx->setAxisTitle("Number of events",2); - - if (doFractionPlot_) { - histname = "GoodTracksFractionVsGoodPVtx"; - GoodTracksFractionVsGoodPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,0., 1.1,""); - GoodTracksFractionVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1); - GoodTracksFractionVsGoodPVtx->setAxisTitle("Mean fraction of good tracks",2); - } - - histname = "NumberOfRecHitsPerTrackVsGoodPVtx"; - NumberOfRecHitsPerTrackVsGoodPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,0., 200.,""); - NumberOfRecHitsPerTrackVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1); - NumberOfRecHitsPerTrackVsGoodPVtx->setAxisTitle("Mean number of valid rechits per Tracks",2); - - histname = "NumberOfPVtxVsGoodPVtx"; - NumberOfPVtxVsGoodPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,0., 3.*PVMax,""); - NumberOfPVtxVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1); - NumberOfPVtxVsGoodPVtx->setAxisTitle("Mean number of vertices",2); - - double NClusPxMin = conf->getParameter("NClusPxMin"); - double NClusPxMax = conf->getParameter("NClusPxMax"); - histname = "NumberOfPixelClustersVsGoodPVtx"; - NumberOfPixelClustersVsGoodPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,NClusPxMin,3.*NClusPxMax,""); - NumberOfPixelClustersVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1); - NumberOfPixelClustersVsGoodPVtx->setAxisTitle("Mean number of pixel clusters",2); - - double NClusStrMin = conf->getParameter("NClusStrMin"); - double NClusStrMax = conf->getParameter("NClusStrMax"); - histname = "NumberOfStripClustersVsGoodPVtx"; - NumberOfStripClustersVsGoodPVtx = ibooker.bookProfile(histname,histname,PVBin,PVMin,PVMax,NClusStrMin,3.*NClusStrMax,""); - NumberOfStripClustersVsGoodPVtx->setAxisTitle("Number of good PV (PU)",1); - NumberOfStripClustersVsGoodPVtx->setAxisTitle("Mean number of strip clusters",2); - - } - + int MeanHitBin = conf->getParameter("MeanHitBin"); + double MeanHitMin = conf->getParameter("MeanHitMin"); + double MeanHitMax = conf->getParameter("MeanHitMax"); - if ( doPlotsVsLUMI_ || doAllPlots ) { - ibooker.setCurrentFolder(MEFolderName+"/LUMIanalysis"); - int LUMIBin = conf->getParameter("LUMIBin"); - float LUMIMin = conf->getParameter("LUMIMin"); - float LUMIMax = conf->getParameter("LUMIMax"); - - histname = "NumberEventsVsLUMI"; - NumberEventsOfVsLUMI = ibooker.book1D(histname,histname,LUMIBin,LUMIMin,LUMIMax); - NumberEventsOfVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); - NumberEventsOfVsLUMI->setAxisTitle("Number of events",2); - - histname = "NumberOfTracksVsLUMI"; - NumberOfTracksVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,0., 2000.,""); - NumberOfTracksVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); - NumberOfTracksVsLUMI->setAxisTitle("Mean number of vertices",2); - - if (doFractionPlot_) { - histname = "GoodTracksFractionVsLUMI"; - GoodTracksFractionVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,0., 1.1,""); - GoodTracksFractionVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); - GoodTracksFractionVsLUMI->setAxisTitle("Mean number of vertices",2); - } - - histname = "NumberOfRecHitsPerTrackVsLUMI"; - NumberOfRecHitsPerTrackVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,0., 200.,""); - NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); - NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("Mean number of vertices",2); - - double PVMin = conf->getParameter("PVMin"); - double PVMax = conf->getParameter("PVMax"); - - histname = "NumberOfGoodPVtxVsLUMI"; - NumberOfGoodPVtxVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,PVMin,3.*PVMax,""); - NumberOfGoodPVtxVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); - NumberOfGoodPVtxVsLUMI->setAxisTitle("Mean number of vertices",2); - - histname = "NumberOfGoodPVtxWO0VsLUMI"; - NumberOfGoodPVtxWO0VsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,PVMin,3.*PVMax,""); - NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); - NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("Mean number of vertices",2); - - double NClusPxMin = conf->getParameter("NClusPxMin"); - double NClusPxMax = conf->getParameter("NClusPxMax"); - histname = "NumberOfPixelClustersVsGoodPVtx"; - NumberOfPixelClustersVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,NClusPxMin,3.*NClusPxMax,""); - NumberOfPixelClustersVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); - NumberOfPixelClustersVsLUMI->setAxisTitle("Mean number of pixel clusters",2); - - double NClusStrMin = conf->getParameter("NClusStrMin"); - double NClusStrMax = conf->getParameter("NClusStrMax"); - histname = "NumberOfStripClustersVsLUMI"; - NumberOfStripClustersVsLUMI = ibooker.bookProfile(histname,histname,LUMIBin,LUMIMin,LUMIMax,NClusStrMin,3.*NClusStrMax,""); - NumberOfStripClustersVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]",1); - NumberOfStripClustersVsLUMI->setAxisTitle("Mean number of strip clusters",2); - - } - - - if ( doPlotsVsBXlumi_ ) { - ibooker.setCurrentFolder(MEFolderName+"/PUmonitoring"); - // get binning from the configuration - edm::ParameterSet BXlumiParameters = conf->getParameter("BXlumiSetup"); - int BXlumiBin = BXlumiParameters.getParameter("BXlumiBin"); - double BXlumiMin = BXlumiParameters.getParameter("BXlumiMin"); - double BXlumiMax = BXlumiParameters.getParameter("BXlumiMax"); - - histname = "NumberOfTracksVsBXlumi_"+ CategoryName; - NumberOfTracksVsBXlumi = ibooker.bookProfile(histname,histname, BXlumiBin,BXlumiMin,BXlumiMax, TKNoMin, 3.*TKNoMax,""); - NumberOfTracksVsBXlumi->setAxisTitle("lumi BX [10^{30}Hzcm^{-2}]",1); - NumberOfTracksVsBXlumi->setAxisTitle("Mean number of Tracks",2); - - } - - - theTrackAnalyzer->initHisto(ibooker, iSetup, *conf); - - // book the Seed Property histograms - // ---------------------------------------------------------------------------------// - - ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding"); - - doAllSeedPlots = conf->getParameter("doSeedParameterHistos"); - doSeedNumberPlot = conf->getParameter("doSeedNumberHisto"); - doSeedLumiAnalysis_ = conf->getParameter("doSeedLumiAnalysis"); - doSeedVsClusterPlot = conf->getParameter("doSeedVsClusterHisto"); - // if (doAllPlots) doAllSeedPlots=true; - - runTrackBuildingAnalyzerForSeed=(doAllSeedPlots || conf->getParameter("doSeedPTHisto") ||conf->getParameter("doSeedETAHisto") || conf->getParameter("doSeedPHIHisto") || conf->getParameter("doSeedPHIVsETAHisto") || conf->getParameter("doSeedThetaHisto") || conf->getParameter("doSeedQHisto") || conf->getParameter("doSeedDxyHisto") || conf->getParameter("doSeedDzHisto") || conf->getParameter("doSeedNRecHitsHisto") || conf->getParameter("doSeedNVsPhiProf")|| conf->getParameter("doSeedNVsEtaProf")); - - edm::InputTag seedProducer = conf->getParameter("SeedProducer"); - - if (doAllSeedPlots || doSeedNumberPlot){ - ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding"); - histname = "NumberOfSeeds_"+ seedProducer.label() + "_"+ CategoryName; - NumberOfSeeds = ibooker.book1D(histname, histname, TKNoSeedBin, TKNoSeedMin, TKNoSeedMax); - NumberOfSeeds->setAxisTitle("Number of Seeds per Event", 1); - NumberOfSeeds->setAxisTitle("Number of Events", 2); - - if ( doSeedLumiAnalysis_ ) { - ibooker.setCurrentFolder(MEFolderName+"/LSanalysis"); - histname = "NumberOfSeeds_lumiFlag_"+ seedProducer.label() + "_"+ CategoryName; - NumberOfSeeds_lumiFlag = ibooker.book1D(histname, histname, TKNoSeedBin, TKNoSeedMin, TKNoSeedMax); - NumberOfSeeds_lumiFlag->setAxisTitle("Number of Seeds per Event", 1); - NumberOfSeeds_lumiFlag->setAxisTitle("Number of Events", 2); - } - - } - - if (doAllSeedPlots || doSeedVsClusterPlot){ - ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding"); - - ClusterLabels= conf->getParameter >("ClusterLabels"); - - std::vector histoMin,histoMax; - std::vector histoBin; //these vectors are for max min and nbins in histograms - - int NClusPxBin = conf->getParameter( "NClusPxBin"); - double NClusPxMin = conf->getParameter("NClusPxMin"); - double NClusPxMax = conf->getParameter("NClusPxMax"); - - int NClusStrBin = conf->getParameter( "NClusStrBin"); - double NClusStrMin = conf->getParameter("NClusStrMin"); - double NClusStrMax = conf->getParameter("NClusStrMax"); - - setMaxMinBin(histoMin,histoMax,histoBin,NClusStrMin,NClusStrMax,NClusStrBin,NClusPxMin,NClusPxMax,NClusPxBin); - - for (uint i=0; i(ibooker.book2D(histname, histname, histoBin[i], histoMin[i], histoMax[i], - TKNoSeedBin, TKNoSeedMin, TKNoSeedMax))); - SeedsVsClusters[i]->setAxisTitle("Number of Clusters", 1); - SeedsVsClusters[i]->setAxisTitle("Number of Seeds", 2); - SeedsVsClusters[i]->getTH2F()->SetCanExtend(TH1::kAllAxes); - } - } - - if(doRegionPlots) { - ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding"); + int MeanLayBin = conf->getParameter("MeanLayBin"); + double MeanLayMin = conf->getParameter("MeanLayMin"); + double MeanLayMax = conf->getParameter("MeanLayMax"); + + int LSBin = conf->getParameter("LSBin"); + int LSMin = conf->getParameter("LSMin"); + int LSMax = conf->getParameter("LSMax"); + + std::string StateName = conf->getParameter("MeasurementState"); + if (StateName != "OuterSurface" && StateName != "InnerSurface" && StateName != "ImpactPoint" && + StateName != "default" && StateName != "All") { + // print warning + edm::LogWarning("TrackingMonitor") << "State Name is invalid, using 'ImpactPoint' by default"; + } + + ibooker.setCurrentFolder(MEFolderName); + + // book the General Property histograms + // ---------------------------------------------------------------------------------// + + if (doGeneralPropertiesPlots_ || doAllPlots) { + ibooker.setCurrentFolder(MEFolderName + "/GeneralProperties"); + + histname = "NumberOfTracks_" + CategoryName; + // MODIFY by Mia in order to cope w/ high multiplicity + NumberOfTracks = ibooker.book1D(histname, histname, 3 * TKNoBin, TKNoMin, (TKNoMax + 0.5) * 3. - 0.5); + NumberOfTracks->setAxisTitle("Number of Tracks per Event", 1); + NumberOfTracks->setAxisTitle("Number of Events", 2); + + histname = "NumberOfTracks_PUvtx_" + CategoryName; + NumberOfTracks_PUvtx = ibooker.book1D(histname, histname, 3 * TKNoBin, TKNoMin, (TKNoMax + 0.5) * 3. - 0.5); + NumberOfTracks_PUvtx->setAxisTitle("Number of Tracks per Event (matched a PU vertex)", 1); + NumberOfTracks_PUvtx->setAxisTitle("Number of Events", 2); + + histname = "NumberofTracks_Hardvtx_" + CategoryName; + NumberofTracks_Hardvtx = ibooker.book1D(histname, histname, TKNoBin / 10, TKNoMin, (TKNoMax / 10 + 0.5) * 3. - 0.5); + NumberofTracks_Hardvtx->setAxisTitle("Number of Tracks per Event (matched main vertex)", 1); + NumberofTracks_Hardvtx->setAxisTitle("Number of Events", 2); + + histname = "NumberofTracks_Hardvtx_PUvtx_" + CategoryName; + NumberofTracks_Hardvtx_PUvtx = ibooker.book1D(histname, histname, 2, 0., 2.); + NumberofTracks_Hardvtx_PUvtx->setAxisTitle("Number of Tracks per PU/Hard vertex", 1); + NumberofTracks_Hardvtx_PUvtx->setAxisTitle("Number of Tracks", 2); + NumberofTracks_Hardvtx_PUvtx->setBinLabel(1, "PU_Vertex"); + NumberofTracks_Hardvtx_PUvtx->setBinLabel(2, "Hard_Vertex"); + + histname = "NumberOfMeanRecHitsPerTrack_" + CategoryName; + NumberOfMeanRecHitsPerTrack = ibooker.book1D(histname, histname, MeanHitBin, MeanHitMin, MeanHitMax); + NumberOfMeanRecHitsPerTrack->setAxisTitle("Mean number of valid RecHits per Track", 1); + NumberOfMeanRecHitsPerTrack->setAxisTitle("Entries", 2); + + histname = "NumberOfMeanLayersPerTrack_" + CategoryName; + NumberOfMeanLayersPerTrack = ibooker.book1D(histname, histname, MeanLayBin, MeanLayMin, MeanLayMax); + NumberOfMeanLayersPerTrack->setAxisTitle("Mean number of Layers per Track", 1); + NumberOfMeanLayersPerTrack->setAxisTitle("Entries", 2); + + if (doFractionPlot_) { + histname = "FractionOfGoodTracks_" + CategoryName; + FractionOfGoodTracks = ibooker.book1D(histname, histname, 101, -0.005, 1.005); + FractionOfGoodTracks->setAxisTitle("Fraction of Tracks (w.r.t. generalTracks)", 1); + FractionOfGoodTracks->setAxisTitle("Entries", 2); + } + } + + if (doLumiAnalysis) { + // add by Mia in order to deal with LS transitions + ibooker.setCurrentFolder(MEFolderName + "/LSanalysis"); + + histname = "NumberOfTracks_lumiFlag_" + CategoryName; + NumberOfTracks_lumiFlag = ibooker.book1D(histname, histname, 3 * TKNoBin, TKNoMin, (TKNoMax + 0.5) * 3. - 0.5); + NumberOfTracks_lumiFlag->setAxisTitle("Number of Tracks per Event", 1); + NumberOfTracks_lumiFlag->setAxisTitle("Number of Events", 2); + } + + // book profile plots vs LS : + //--------------------------- + + if (doProfilesVsLS_ || doAllPlots) { + ibooker.setCurrentFolder(MEFolderName + "/GeneralProperties"); + + histname = "NumberOfTracksVsLS_" + CategoryName; + NumberOfTracksVsLS = ibooker.bookProfile(histname, histname, LSBin, LSMin, LSMax, TKNoMin, TKNoMax * 3., ""); + NumberOfTracksVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); + NumberOfTracksVsLS->setAxisTitle("#Lumi section", 1); + NumberOfTracksVsLS->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfRecHitsPerTrackVsLS_" + CategoryName; + NumberOfRecHitsPerTrackVsLS = ibooker.bookProfile(histname, histname, LSBin, LSMin, LSMax, 0., 200., ""); + NumberOfRecHitsPerTrackVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); + NumberOfRecHitsPerTrackVsLS->setAxisTitle("#Lumi section", 1); + NumberOfRecHitsPerTrackVsLS->setAxisTitle("Mean number of Valid RecHits per track", 2); + + histname = "NumberEventsVsLS_" + CategoryName; + NumberEventsOfVsLS = ibooker.book1D(histname, histname, LSBin, LSMin, LSMax); + NumberEventsOfVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); + NumberEventsOfVsLS->setAxisTitle("#Lumi section", 1); + NumberEventsOfVsLS->setAxisTitle("Number of events", 2); + + double GoodPVtxMin = conf->getParameter("GoodPVtxMin"); + double GoodPVtxMax = conf->getParameter("GoodPVtxMax"); + + histname = "NumberOfGoodPVtxVsLS_" + CategoryName; + NumberOfGoodPVtxVsLS = + ibooker.bookProfile(histname, histname, LSBin, LSMin, LSMax, GoodPVtxMin, 3. * GoodPVtxMax, ""); + NumberOfGoodPVtxVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); + NumberOfGoodPVtxVsLS->setAxisTitle("#Lumi section", 1); + NumberOfGoodPVtxVsLS->setAxisTitle("Mean number of good PV", 2); + + histname = "NumberOfGoodPVtxWO0VsLS_" + CategoryName; + NumberOfGoodPVtxWO0VsLS = + ibooker.bookProfile(histname, histname, LSBin, LSMin, LSMax, GoodPVtxMin, 3. * GoodPVtxMax, ""); + NumberOfGoodPVtxWO0VsLS->setAxisTitle("#Lumi section", 1); + NumberOfGoodPVtxWO0VsLS->setAxisTitle("Mean number of good PV", 2); + + if (doFractionPlot_) { + histname = "GoodTracksFractionVsLS_" + CategoryName; + GoodTracksFractionVsLS = ibooker.bookProfile(histname, histname, LSBin, LSMin, LSMax, 0, 1.1, ""); + GoodTracksFractionVsLS->getTH1()->SetCanExtend(TH1::kAllAxes); + GoodTracksFractionVsLS->setAxisTitle("#Lumi section", 1); + GoodTracksFractionVsLS->setAxisTitle("Fraction of Good Tracks", 2); + } + + if (doPlotsVsBX_ || doAllPlots) { + ibooker.setCurrentFolder(MEFolderName + "/BXanalysis"); + int BXBin = 3564; + double BXMin = 0.5; + double BXMax = 3564.5; + + histname = "NumberEventsVsBX_" + CategoryName; + NumberEventsOfVsBX = ibooker.book1D(histname, histname, BXBin, BXMin, BXMax); + NumberEventsOfVsBX->setAxisTitle("BX", 1); + NumberEventsOfVsBX->setAxisTitle("Number of events", 2); + + histname = "NumberOfTracksVsBX_" + CategoryName; + NumberOfTracksVsBX = ibooker.bookProfile(histname, histname, BXBin, BXMin, BXMax, TKNoMin, TKNoMax * 3., ""); + NumberOfTracksVsBX->setAxisTitle("BX", 1); + NumberOfTracksVsBX->setAxisTitle("Number of Tracks", 2); + + histname = "NumberOfRecHitsPerTrackVsBX_" + CategoryName; + NumberOfRecHitsPerTrackVsBX = ibooker.bookProfile(histname, histname, BXBin, BXMin, BXMax, 0., 200., ""); + NumberOfRecHitsPerTrackVsBX->setAxisTitle("BX", 1); + NumberOfRecHitsPerTrackVsBX->setAxisTitle("Mean number of Valid RecHits per track", 2); + + histname = "NumberOfGoodPVtxVsBX_" + CategoryName; + NumberOfGoodPVtxVsBX = + ibooker.bookProfile(histname, histname, BXBin, BXMin, BXMax, GoodPVtxMin, 3. * GoodPVtxMax, ""); + NumberOfGoodPVtxVsBX->setAxisTitle("BX", 1); + NumberOfGoodPVtxVsBX->setAxisTitle("Mean number of good PV", 2); + + histname = "NumberOfGoodPVtxWO0VsBX_" + CategoryName; + NumberOfGoodPVtxWO0VsBX = + ibooker.bookProfile(histname, histname, BXBin, BXMin, BXMax, GoodPVtxMin, 3. * GoodPVtxMax, ""); + NumberOfGoodPVtxWO0VsBX->setAxisTitle("BX", 1); + NumberOfGoodPVtxWO0VsBX->setAxisTitle("Mean number of good PV", 2); + + if (doFractionPlot_) { + histname = "GoodTracksFractionVsBX_" + CategoryName; + GoodTracksFractionVsBX = ibooker.bookProfile(histname, histname, BXBin, BXMin, BXMax, 0, 1.1, ""); + GoodTracksFractionVsBX->setAxisTitle("BX", 1); + GoodTracksFractionVsBX->setAxisTitle("Fraction of Good Tracks", 2); + } + } + } + + // book PU monitoring plots : + //--------------------------- + + if (doPUmonitoring_) { + for (size_t i = 0; i < theVertexMonitor.size(); i++) + theVertexMonitor[i]->initHisto(ibooker); + } + + if (doPlotsVsGoodPVtx_) { + ibooker.setCurrentFolder(MEFolderName + "/PUmonitoring"); + // get binning from the configuration + int PVBin = conf->getParameter("PVBin"); + float PVMin = conf->getParameter("PVMin"); + float PVMax = conf->getParameter("PVMax"); + + histname = "NumberOfTracksVsGoodPVtx"; + NumberOfTracksVsGoodPVtx = ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, TKNoMin, TKNoMax * 5., ""); + NumberOfTracksVsGoodPVtx->setAxisTitle("Number of PV", 1); + NumberOfTracksVsGoodPVtx->setAxisTitle("Mean number of Tracks per Event", 2); + + histname = "NumberOfTracksVsPUPVtx"; + NumberOfTracksVsPUPVtx = ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, 0., TKNoMax * 5., ""); + NumberOfTracksVsPUPVtx->setAxisTitle("Number of PU", 1); + NumberOfTracksVsPUPVtx->setAxisTitle("Mean number of Tracks per PUvtx", 2); + + histname = "NumberEventsVsGoodPVtx"; + NumberEventsOfVsGoodPVtx = ibooker.book1D(histname, histname, PVBin, PVMin, PVMax); + NumberEventsOfVsGoodPVtx->setAxisTitle("Number of good PV (PU)", 1); + NumberEventsOfVsGoodPVtx->setAxisTitle("Number of events", 2); + + if (doFractionPlot_) { + histname = "GoodTracksFractionVsGoodPVtx"; + GoodTracksFractionVsGoodPVtx = ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, 0., 1.1, ""); + GoodTracksFractionVsGoodPVtx->setAxisTitle("Number of good PV (PU)", 1); + GoodTracksFractionVsGoodPVtx->setAxisTitle("Mean fraction of good tracks", 2); + } + + histname = "NumberOfRecHitsPerTrackVsGoodPVtx"; + NumberOfRecHitsPerTrackVsGoodPVtx = ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, 0., 200., ""); + NumberOfRecHitsPerTrackVsGoodPVtx->setAxisTitle("Number of good PV (PU)", 1); + NumberOfRecHitsPerTrackVsGoodPVtx->setAxisTitle("Mean number of valid rechits per Tracks", 2); + + histname = "NumberOfPVtxVsGoodPVtx"; + NumberOfPVtxVsGoodPVtx = ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, 0., 3. * PVMax, ""); + NumberOfPVtxVsGoodPVtx->setAxisTitle("Number of good PV (PU)", 1); + NumberOfPVtxVsGoodPVtx->setAxisTitle("Mean number of vertices", 2); + + double NClusPxMin = conf->getParameter("NClusPxMin"); + double NClusPxMax = conf->getParameter("NClusPxMax"); + histname = "NumberOfPixelClustersVsGoodPVtx"; + NumberOfPixelClustersVsGoodPVtx = + ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, NClusPxMin, 3. * NClusPxMax, ""); + NumberOfPixelClustersVsGoodPVtx->setAxisTitle("Number of good PV (PU)", 1); + NumberOfPixelClustersVsGoodPVtx->setAxisTitle("Mean number of pixel clusters", 2); + + double NClusStrMin = conf->getParameter("NClusStrMin"); + double NClusStrMax = conf->getParameter("NClusStrMax"); + histname = "NumberOfStripClustersVsGoodPVtx"; + NumberOfStripClustersVsGoodPVtx = + ibooker.bookProfile(histname, histname, PVBin, PVMin, PVMax, NClusStrMin, 3. * NClusStrMax, ""); + NumberOfStripClustersVsGoodPVtx->setAxisTitle("Number of good PV (PU)", 1); + NumberOfStripClustersVsGoodPVtx->setAxisTitle("Mean number of strip clusters", 2); + } + + if (doPlotsVsLUMI_ || doAllPlots) { + ibooker.setCurrentFolder(MEFolderName + "/LUMIanalysis"); + int LUMIBin = conf->getParameter("LUMIBin"); + float LUMIMin = conf->getParameter("LUMIMin"); + float LUMIMax = conf->getParameter("LUMIMax"); + + histname = "NumberEventsVsLUMI"; + NumberEventsOfVsLUMI = ibooker.book1D(histname, histname, LUMIBin, LUMIMin, LUMIMax); + NumberEventsOfVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); + NumberEventsOfVsLUMI->setAxisTitle("Number of events", 2); + + histname = "NumberOfTracksVsLUMI"; + NumberOfTracksVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, 0., 2000., ""); + NumberOfTracksVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); + NumberOfTracksVsLUMI->setAxisTitle("Mean number of vertices", 2); + + if (doFractionPlot_) { + histname = "GoodTracksFractionVsLUMI"; + GoodTracksFractionVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, 0., 1.1, ""); + GoodTracksFractionVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); + GoodTracksFractionVsLUMI->setAxisTitle("Mean number of vertices", 2); + } + + histname = "NumberOfRecHitsPerTrackVsLUMI"; + NumberOfRecHitsPerTrackVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, 0., 200., ""); + NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); + NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("Mean number of vertices", 2); + + double PVMin = conf->getParameter("PVMin"); + double PVMax = conf->getParameter("PVMax"); - int regionBin = conf->getParameter( "RegionSizeBin"); - double regionMin = conf->getParameter("RegionSizeMin"); - double regionMax = conf->getParameter("RegionSizeMax"); + histname = "NumberOfGoodPVtxVsLUMI"; + NumberOfGoodPVtxVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, PVMin, 3. * PVMax, ""); + NumberOfGoodPVtxVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); + NumberOfGoodPVtxVsLUMI->setAxisTitle("Mean number of vertices", 2); - histname = "TrackingRegionsNumberOf_"+ seedProducer.label() + "_"+ CategoryName; - NumberOfTrackingRegions = ibooker.book1D(histname, histname, regionBin, regionMin, regionMax); - NumberOfTrackingRegions->setAxisTitle("Number of TrackingRegions per Event", 1); - NumberOfTrackingRegions->setAxisTitle("Number of Events", 2); - } + histname = "NumberOfGoodPVtxWO0VsLUMI"; + NumberOfGoodPVtxWO0VsLUMI = + ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, PVMin, 3. * PVMax, ""); + NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); + NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("Mean number of vertices", 2); - doTkCandPlots=conf->getParameter("doTrackCandHistos"); + double NClusPxMin = conf->getParameter("NClusPxMin"); + double NClusPxMax = conf->getParameter("NClusPxMax"); + histname = "NumberOfPixelClustersVsGoodPVtx"; + NumberOfPixelClustersVsLUMI = + ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, NClusPxMin, 3. * NClusPxMax, ""); + NumberOfPixelClustersVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); + NumberOfPixelClustersVsLUMI->setAxisTitle("Mean number of pixel clusters", 2); + + double NClusStrMin = conf->getParameter("NClusStrMin"); + double NClusStrMax = conf->getParameter("NClusStrMax"); + histname = "NumberOfStripClustersVsLUMI"; + NumberOfStripClustersVsLUMI = + ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, NClusStrMin, 3. * NClusStrMax, ""); + NumberOfStripClustersVsLUMI->setAxisTitle("scal lumi [10e30 Hz cm^{-2}]", 1); + NumberOfStripClustersVsLUMI->setAxisTitle("Mean number of strip clusters", 2); + } + + if (doPlotsVsBXlumi_) { + ibooker.setCurrentFolder(MEFolderName + "/PUmonitoring"); + // get binning from the configuration + edm::ParameterSet BXlumiParameters = conf->getParameter("BXlumiSetup"); + int BXlumiBin = BXlumiParameters.getParameter("BXlumiBin"); + double BXlumiMin = BXlumiParameters.getParameter("BXlumiMin"); + double BXlumiMax = BXlumiParameters.getParameter("BXlumiMax"); + + histname = "NumberOfTracksVsBXlumi_" + CategoryName; + NumberOfTracksVsBXlumi = + ibooker.bookProfile(histname, histname, BXlumiBin, BXlumiMin, BXlumiMax, TKNoMin, 3. * TKNoMax, ""); + NumberOfTracksVsBXlumi->setAxisTitle("lumi BX [10^{30}Hzcm^{-2}]", 1); + NumberOfTracksVsBXlumi->setAxisTitle("Mean number of Tracks", 2); + } + + theTrackAnalyzer->initHisto(ibooker, iSetup, *conf); + + // book the Seed Property histograms + // ---------------------------------------------------------------------------------// + + ibooker.setCurrentFolder(MEFolderName + "/TrackBuilding"); + + doAllSeedPlots = conf->getParameter("doSeedParameterHistos"); + doSeedNumberPlot = conf->getParameter("doSeedNumberHisto"); + doSeedLumiAnalysis_ = conf->getParameter("doSeedLumiAnalysis"); + doSeedVsClusterPlot = conf->getParameter("doSeedVsClusterHisto"); + // if (doAllPlots) doAllSeedPlots=true; + + runTrackBuildingAnalyzerForSeed = + (doAllSeedPlots || conf->getParameter("doSeedPTHisto") || conf->getParameter("doSeedETAHisto") || + conf->getParameter("doSeedPHIHisto") || conf->getParameter("doSeedPHIVsETAHisto") || + conf->getParameter("doSeedThetaHisto") || conf->getParameter("doSeedQHisto") || + conf->getParameter("doSeedDxyHisto") || conf->getParameter("doSeedDzHisto") || + conf->getParameter("doSeedNRecHitsHisto") || conf->getParameter("doSeedNVsPhiProf") || + conf->getParameter("doSeedNVsEtaProf")); + + edm::InputTag seedProducer = conf->getParameter("SeedProducer"); + + if (doAllSeedPlots || doSeedNumberPlot) { + ibooker.setCurrentFolder(MEFolderName + "/TrackBuilding"); + histname = "NumberOfSeeds_" + seedProducer.label() + "_" + CategoryName; + NumberOfSeeds = ibooker.book1D(histname, histname, TKNoSeedBin, TKNoSeedMin, TKNoSeedMax); + NumberOfSeeds->setAxisTitle("Number of Seeds per Event", 1); + NumberOfSeeds->setAxisTitle("Number of Events", 2); + + if (doSeedLumiAnalysis_) { + ibooker.setCurrentFolder(MEFolderName + "/LSanalysis"); + histname = "NumberOfSeeds_lumiFlag_" + seedProducer.label() + "_" + CategoryName; + NumberOfSeeds_lumiFlag = ibooker.book1D(histname, histname, TKNoSeedBin, TKNoSeedMin, TKNoSeedMax); + NumberOfSeeds_lumiFlag->setAxisTitle("Number of Seeds per Event", 1); + NumberOfSeeds_lumiFlag->setAxisTitle("Number of Events", 2); + } + } + + if (doAllSeedPlots || doSeedVsClusterPlot) { + ibooker.setCurrentFolder(MEFolderName + "/TrackBuilding"); + + ClusterLabels = conf->getParameter >("ClusterLabels"); + + std::vector histoMin, histoMax; + std::vector histoBin; //these vectors are for max min and nbins in histograms + + int NClusPxBin = conf->getParameter("NClusPxBin"); + double NClusPxMin = conf->getParameter("NClusPxMin"); + double NClusPxMax = conf->getParameter("NClusPxMax"); + + int NClusStrBin = conf->getParameter("NClusStrBin"); + double NClusStrMin = conf->getParameter("NClusStrMin"); + double NClusStrMax = conf->getParameter("NClusStrMax"); + + setMaxMinBin( + histoMin, histoMax, histoBin, NClusStrMin, NClusStrMax, NClusStrBin, NClusPxMin, NClusPxMax, NClusPxBin); + + for (uint i = 0; i < ClusterLabels.size(); i++) { + histname = "SeedsVsClusters_" + seedProducer.label() + "_Vs_" + ClusterLabels[i] + "_" + CategoryName; + SeedsVsClusters.push_back(dynamic_cast(ibooker.book2D( + histname, histname, histoBin[i], histoMin[i], histoMax[i], TKNoSeedBin, TKNoSeedMin, TKNoSeedMax))); + SeedsVsClusters[i]->setAxisTitle("Number of Clusters", 1); + SeedsVsClusters[i]->setAxisTitle("Number of Seeds", 2); + SeedsVsClusters[i]->getTH2F()->SetCanExtend(TH1::kAllAxes); + } + } + + if (doRegionPlots) { + ibooker.setCurrentFolder(MEFolderName + "/TrackBuilding"); + + int regionBin = conf->getParameter("RegionSizeBin"); + double regionMin = conf->getParameter("RegionSizeMin"); + double regionMax = conf->getParameter("RegionSizeMax"); + + histname = "TrackingRegionsNumberOf_" + seedProducer.label() + "_" + CategoryName; + NumberOfTrackingRegions = ibooker.book1D(histname, histname, regionBin, regionMin, regionMax); + NumberOfTrackingRegions->setAxisTitle("Number of TrackingRegions per Event", 1); + NumberOfTrackingRegions->setAxisTitle("Number of Events", 2); + } + + doTkCandPlots = conf->getParameter("doTrackCandHistos"); // if (doAllPlots) doTkCandPlots=true; - - if (doTkCandPlots){ - ibooker.setCurrentFolder(MEFolderName+"/TrackBuilding"); - - edm::InputTag tcProducer = conf->getParameter("TCProducer"); - - histname = "NumberOfTrackCandidates_"+ tcProducer.label() + "_"+ CategoryName; + + if (doTkCandPlots) { + ibooker.setCurrentFolder(MEFolderName + "/TrackBuilding"); + + edm::InputTag tcProducer = conf->getParameter("TCProducer"); + + histname = "NumberOfTrackCandidates_" + tcProducer.label() + "_" + CategoryName; NumberOfTrackCandidates = ibooker.book1D(histname, histname, TCNoBin, TCNoMin, TCNoMax); NumberOfTrackCandidates->setAxisTitle("Number of Track Candidates per Event", 1); NumberOfTrackCandidates->setAxisTitle("Number of Event", 2); - histname = "FractionOfCandOverSeeds_"+ tcProducer.label() + "_"+ CategoryName; + histname = "FractionOfCandOverSeeds_" + tcProducer.label() + "_" + CategoryName; FractionCandidatesOverSeeds = ibooker.book1D(histname, histname, 101, 0., 1.01); FractionCandidatesOverSeeds->setAxisTitle("Number of Track Candidates / Number of Seeds per Event", 1); FractionCandidatesOverSeeds->setAxisTitle("Number of Event", 2); - } - - theTrackBuildingAnalyzer->initHisto(ibooker,*conf); - - + + theTrackBuildingAnalyzer->initHisto(ibooker, *conf); + if (doLumiAnalysis) { - if ( NumberOfTracks_lumiFlag ) NumberOfTracks_lumiFlag -> setLumiFlag(); - theTrackAnalyzer->setLumiFlag(); + if (NumberOfTracks_lumiFlag) + NumberOfTracks_lumiFlag->setLumiFlag(); + theTrackAnalyzer->setLumiFlag(); } - if(doAllSeedPlots || doSeedNumberPlot){ - if ( doSeedLumiAnalysis_ ) + if (doAllSeedPlots || doSeedNumberPlot) { + if (doSeedLumiAnalysis_) NumberOfSeeds_lumiFlag->setLumiFlag(); } - + if (doTrackerSpecific_ || doAllPlots) { - - ClusterLabels= conf->getParameter >("ClusterLabels"); - - std::vector histoMin,histoMax; - std::vector histoBin; //these vectors are for max min and nbins in histograms - - int NClusStrBin = conf->getParameter( "NClusStrBin"); + ClusterLabels = conf->getParameter >("ClusterLabels"); + + std::vector histoMin, histoMax; + std::vector histoBin; //these vectors are for max min and nbins in histograms + + int NClusStrBin = conf->getParameter("NClusStrBin"); double NClusStrMin = conf->getParameter("NClusStrMin"); double NClusStrMax = conf->getParameter("NClusStrMax"); - - int NClusPxBin = conf->getParameter( "NClusPxBin"); + + int NClusPxBin = conf->getParameter("NClusPxBin"); double NClusPxMin = conf->getParameter("NClusPxMin"); double NClusPxMax = conf->getParameter("NClusPxMax"); - - int NTrk2DBin = conf->getParameter( "NTrk2DBin"); - double NTrk2DMin = conf->getParameter("NTrk2DMin"); - double NTrk2DMax = conf->getParameter("NTrk2DMax"); - - setMaxMinBin(histoMin,histoMax,histoBin, - NClusStrMin,NClusStrMax,NClusStrBin, - NClusPxMin, NClusPxMax, NClusPxBin); - - ibooker.setCurrentFolder(MEFolderName+"/HitProperties"); - - for (uint i=0; igetParameter("NTrk2DBin"); + double NTrk2DMin = conf->getParameter("NTrk2DMin"); + double NTrk2DMax = conf->getParameter("NTrk2DMax"); + + setMaxMinBin( + histoMin, histoMax, histoBin, NClusStrMin, NClusStrMax, NClusStrBin, NClusPxMin, NClusPxMax, NClusPxBin); + + ibooker.setCurrentFolder(MEFolderName + "/HitProperties"); + + for (uint i = 0; i < ClusterLabels.size(); i++) { + ibooker.setCurrentFolder(MEFolderName + "/HitProperties"); histname = "TracksVs" + ClusterLabels[i] + "Cluster_" + CategoryName; - NumberOfTrkVsClusters.push_back(dynamic_cast(ibooker.book2D(histname, histname, - histoBin[i], histoMin[i], histoMax[i], - NTrk2DBin,NTrk2DMin,NTrk2DMax - ))); + NumberOfTrkVsClusters.push_back(dynamic_cast( + ibooker.book2D(histname, histname, histoBin[i], histoMin[i], histoMax[i], NTrk2DBin, NTrk2DMin, NTrk2DMax))); std::string title = "Number of " + ClusterLabels[i] + " Clusters"; - if(ClusterLabels[i]=="Tot") - title = "# of Clusters in (Pixel+Strip) Detectors"; + if (ClusterLabels[i] == "Tot") + title = "# of Clusters in (Pixel+Strip) Detectors"; NumberOfTrkVsClusters[i]->setAxisTitle(title, 1); NumberOfTrkVsClusters[i]->setAxisTitle("Number of Tracks", 2); NumberOfTrkVsClusters[i]->getTH1()->SetCanExtend(TH1::kXaxis); } } - + // Initialize the GenericTriggerEventFlag - if ( genTriggerEventFlag_->on() ) genTriggerEventFlag_->initRun( iRun, iSetup ); - + if (genTriggerEventFlag_->on()) + genTriggerEventFlag_->initRun(iRun, iSetup); } /* @@ -729,435 +727,452 @@ void TrackingMonitor::beginRun(const edm::Run& iRun, const edm::EventSetup& iSet // - BeginLumi // ---------------------------------------------------------------------------------// -void TrackingMonitor::beginLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& eSetup) { - +void TrackingMonitor::beginLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& eSetup) { if (doLumiAnalysis) { - if ( NumberOfTracks_lumiFlag ) NumberOfTracks_lumiFlag -> Reset(); - theTrackAnalyzer->doReset(); + if (NumberOfTracks_lumiFlag) + NumberOfTracks_lumiFlag->Reset(); + theTrackAnalyzer->doReset(); } - if(doAllSeedPlots || doSeedNumberPlot) { - if ( doSeedLumiAnalysis_ ) + if (doAllSeedPlots || doSeedNumberPlot) { + if (doSeedLumiAnalysis_) NumberOfSeeds_lumiFlag->Reset(); } } // -- Analyse // ---------------------------------------------------------------------------------// -void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - - // Filter out events if Trigger Filtering is requested - if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( iEvent, iSetup) ) return; - - float lumi = -1.; - edm::Handle lumiScalers; - iEvent.getByToken(lumiscalersToken_, lumiScalers); - if ( lumiScalers.isValid() && !lumiScalers->empty() ) { - LumiScalersCollection::const_iterator scalit = lumiScalers->begin(); - lumi = scalit->instantLumi(); - } else - lumi = -1.; - - if (doPlotsVsLUMI_ || doAllPlots) - NumberEventsOfVsLUMI->Fill(lumi); - - // Analyse the tracks - // if the collection is empty, do not fill anything - // ---------------------------------------------------------------------------------// +void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + // Filter out events if Trigger Filtering is requested + if (genTriggerEventFlag_->on() && !genTriggerEventFlag_->accept(iEvent, iSetup)) + return; + + float lumi = -1.; + edm::Handle lumiScalers; + iEvent.getByToken(lumiscalersToken_, lumiScalers); + if (lumiScalers.isValid() && !lumiScalers->empty()) { + LumiScalersCollection::const_iterator scalit = lumiScalers->begin(); + lumi = scalit->instantLumi(); + } else + lumi = -1.; + + if (doPlotsVsLUMI_ || doAllPlots) + NumberEventsOfVsLUMI->Fill(lumi); + + // Analyse the tracks + // if the collection is empty, do not fill anything + // ---------------------------------------------------------------------------------// + + size_t bx = iEvent.bunchCrossing(); + if (doPlotsVsBX_ || doAllPlots) + NumberEventsOfVsBX->Fill(bx); + + // get the track collection + edm::Handle > trackHandle; + iEvent.getByToken(trackToken_, trackHandle); + + int numberOfTracks_den = 0; + edm::Handle > allTrackHandle; + iEvent.getByToken(allTrackToken_, allTrackHandle); + if (allTrackHandle.isValid()) { + for (edm::View::const_iterator track = allTrackHandle->begin(); track != allTrackHandle->end(); + ++track) { + if (denSelection_(*track)) + numberOfTracks_den++; + } + } - size_t bx = iEvent.bunchCrossing(); - if ( doPlotsVsBX_ || doAllPlots ) - NumberEventsOfVsBX->Fill(bx); + edm::Handle pvHandle; + iEvent.getByToken(pvSrcToken_, pvHandle); + reco::Vertex const* pv0 = nullptr; + if (pvHandle.isValid()) { + pv0 = &pvHandle->front(); + //--- pv fake (the pv collection should have size==1 and the pv==beam spot) + if (pv0->isFake() || + pv0->tracksSize() == 0 + // definition of goodOfflinePrimaryVertex + || pv0->ndof() < pvNDOF_ || pv0->z() > 24.) + pv0 = nullptr; + } + + if (trackHandle.isValid()) { + int numberOfTracks = trackHandle->size(); + int numberOfTracks_num = 0; + int numberOfTracks_pv0 = 0; + + const edm::View& trackCollection = *trackHandle; + // calculate the mean # rechits and layers + int totalRecHits = 0, totalLayers = 0; + + theTrackAnalyzer->setNumberOfGoodVertices(iEvent); + theTrackAnalyzer->setBX(iEvent); + theTrackAnalyzer->setLumi(iEvent, iSetup); + for (edm::View::const_iterator track = trackCollection.begin(); track != trackCollection.end(); + ++track) { + if (doPlotsVsBX_ || doAllPlots) + NumberOfRecHitsPerTrackVsBX->Fill(bx, track->numberOfValidHits()); + if (numSelection_(*track)) { + numberOfTracks_num++; + if (pv0 && std::abs(track->dz(pv0->position())) < 0.15) + ++numberOfTracks_pv0; + } - // get the track collection - edm::Handle > trackHandle; - iEvent.getByToken(trackToken_, trackHandle); + if (doProfilesVsLS_ || doAllPlots) + NumberOfRecHitsPerTrackVsLS->Fill(static_cast(iEvent.id().luminosityBlock()), + track->numberOfValidHits()); - int numberOfTracks_den = 0; - edm::Handle > allTrackHandle; - iEvent.getByToken(allTrackToken_,allTrackHandle); - if (allTrackHandle.isValid()) { - for ( edm::View::const_iterator track = allTrackHandle->begin(); - track != allTrackHandle->end(); ++track ) { + if (doPlotsVsLUMI_ || doAllPlots) + NumberOfRecHitsPerTrackVsLUMI->Fill(lumi, track->numberOfValidHits()); + + totalRecHits += track->numberOfValidHits(); + totalLayers += track->hitPattern().trackerLayersWithMeasurement(); + + // do analysis per track + theTrackAnalyzer->analyze(iEvent, iSetup, *track); + } - if ( denSelection_(*track) ) - numberOfTracks_den++; + double frac = -1.; + // if (numberOfAllTracks > 0) frac = static_cast(numberOfTracks)/static_cast(numberOfAllTracks); + if (numberOfTracks_den > 0) + frac = static_cast(numberOfTracks_num) / static_cast(numberOfTracks_den); + + if (doGeneralPropertiesPlots_ || doAllPlots) { + NumberOfTracks->Fill(double(numberOfTracks)); + NumberofTracks_Hardvtx->Fill(double(numberOfTracks_pv0)); + NumberOfTracks_PUvtx->Fill(double(numberOfTracks - numberOfTracks_pv0)); + NumberofTracks_Hardvtx_PUvtx->Fill(0.5, double(numberOfTracks_pv0)); + NumberofTracks_Hardvtx_PUvtx->Fill(1.5, double(numberOfTracks - numberOfTracks_pv0)); + if (doPlotsVsBX_ || doAllPlots) + NumberOfTracksVsBX->Fill(bx, numberOfTracks); + if (doPlotsVsLUMI_ || doAllPlots) + NumberOfTracksVsLUMI->Fill(lumi, numberOfTracks); + if (doFractionPlot_) { + FractionOfGoodTracks->Fill(frac); + + if (doFractionPlot_) { + if (doPlotsVsBX_ || doAllPlots) + GoodTracksFractionVsBX->Fill(bx, frac); + if (doPlotsVsLUMI_ || doAllPlots) + GoodTracksFractionVsLUMI->Fill(lumi, frac); + } + } + if (numberOfTracks > 0) { + double meanRecHits = static_cast(totalRecHits) / static_cast(numberOfTracks); + double meanLayers = static_cast(totalLayers) / static_cast(numberOfTracks); + NumberOfMeanRecHitsPerTrack->Fill(meanRecHits); + NumberOfMeanLayersPerTrack->Fill(meanLayers); } } - - edm::Handle< reco::VertexCollection > pvHandle; - iEvent.getByToken(pvSrcToken_, pvHandle ); - reco::Vertex const * pv0 = nullptr; - if (pvHandle.isValid()) { - pv0 = &pvHandle->front(); - //--- pv fake (the pv collection should have size==1 and the pv==beam spot) - if ( pv0->isFake() || pv0->tracksSize()==0 - // definition of goodOfflinePrimaryVertex - || pv0->ndof() < pvNDOF_ || pv0->z() > 24.) pv0 = nullptr; + + if (doProfilesVsLS_ || doAllPlots) { + float nLS = static_cast(iEvent.id().luminosityBlock()); + NumberEventsOfVsLS->Fill(nLS); + NumberOfTracksVsLS->Fill(nLS, numberOfTracks); + if (doFractionPlot_) + GoodTracksFractionVsLS->Fill(nLS, frac); } + if (doLumiAnalysis) { + NumberOfTracks_lumiFlag->Fill(numberOfTracks); + } - if (trackHandle.isValid()) { - - int numberOfTracks = trackHandle->size(); - int numberOfTracks_num = 0; - int numberOfTracks_pv0 = 0; - - const edm::View& trackCollection = *trackHandle; - // calculate the mean # rechits and layers - int totalRecHits = 0, totalLayers = 0; - - theTrackAnalyzer->setNumberOfGoodVertices(iEvent); - theTrackAnalyzer->setBX(iEvent); - theTrackAnalyzer->setLumi(iEvent,iSetup); - for ( edm::View::const_iterator track = trackCollection.begin(); - track != trackCollection.end(); ++track ) { - - if ( doPlotsVsBX_ || doAllPlots ) - NumberOfRecHitsPerTrackVsBX->Fill(bx,track->numberOfValidHits()); - if ( numSelection_(*track) ) { - numberOfTracks_num++; - if (pv0 && std::abs(track->dz(pv0->position()))<0.15) ++numberOfTracks_pv0; - } - - if ( doProfilesVsLS_ || doAllPlots) - NumberOfRecHitsPerTrackVsLS->Fill(static_cast(iEvent.id().luminosityBlock()),track->numberOfValidHits()); - - if (doPlotsVsLUMI_ || doAllPlots) - NumberOfRecHitsPerTrackVsLUMI->Fill(lumi,track->numberOfValidHits()); - - totalRecHits += track->numberOfValidHits(); - totalLayers += track->hitPattern().trackerLayersWithMeasurement(); - - // do analysis per track - theTrackAnalyzer->analyze(iEvent, iSetup, *track); - } + // Analyse the Track Building variables + // if the collection is empty, do not fill anything + // ---------------------------------------------------------------------------------// - double frac = -1.; - // if (numberOfAllTracks > 0) frac = static_cast(numberOfTracks)/static_cast(numberOfAllTracks); - if (numberOfTracks_den > 0) frac = static_cast(numberOfTracks_num)/static_cast(numberOfTracks_den); - - if (doGeneralPropertiesPlots_ || doAllPlots){ - NumberOfTracks -> Fill(double(numberOfTracks)); - NumberofTracks_Hardvtx->Fill(double(numberOfTracks_pv0)); - NumberOfTracks_PUvtx->Fill(double(numberOfTracks - numberOfTracks_pv0)); - NumberofTracks_Hardvtx_PUvtx->Fill(0.5,double(numberOfTracks_pv0)); - NumberofTracks_Hardvtx_PUvtx->Fill(1.5,double(numberOfTracks-numberOfTracks_pv0)); - if ( doPlotsVsBX_ || doAllPlots ) - NumberOfTracksVsBX -> Fill(bx,numberOfTracks); - if (doPlotsVsLUMI_ || doAllPlots) - NumberOfTracksVsLUMI -> Fill(lumi,numberOfTracks); - if (doFractionPlot_) { - FractionOfGoodTracks -> Fill(frac); - - if (doFractionPlot_) { - if ( doPlotsVsBX_ || doAllPlots ) - GoodTracksFractionVsBX -> Fill(bx, frac); - if (doPlotsVsLUMI_ || doAllPlots) - GoodTracksFractionVsLUMI -> Fill(lumi,frac); - } - } - if( numberOfTracks > 0 ) { - double meanRecHits = static_cast(totalRecHits) / static_cast(numberOfTracks); - double meanLayers = static_cast(totalLayers) / static_cast(numberOfTracks); - NumberOfMeanRecHitsPerTrack -> Fill(meanRecHits); - NumberOfMeanLayersPerTrack -> Fill(meanLayers); - } + // fill the TrackCandidate info + if (doTkCandPlots) { + // magnetic field + edm::ESHandle theMF; + iSetup.get().get(theMF); + + // get the candidate collection + edm::Handle theTCHandle; + iEvent.getByToken(trackCandidateToken_, theTCHandle); + const TrackCandidateCollection& theTCCollection = *theTCHandle; + + if (theTCHandle.isValid()) { + // get the beam spot + edm::Handle recoBeamSpotHandle; + iEvent.getByToken(bsSrcToken_, recoBeamSpotHandle); + const reco::BeamSpot& bs = *recoBeamSpotHandle; + + NumberOfTrackCandidates->Fill(theTCCollection.size()); + + // get the seed collection + edm::Handle > seedHandle; + iEvent.getByToken(seedToken_, seedHandle); + const edm::View& seedCollection = *seedHandle; + if (seedHandle.isValid() && !seedCollection.empty()) + FractionCandidatesOverSeeds->Fill(double(theTCCollection.size()) / double(seedCollection.size())); + + iSetup.get().get(builderName, theTTRHBuilder); + for (TrackCandidateCollection::const_iterator cand = theTCCollection.begin(); cand != theTCCollection.end(); + ++cand) { + theTrackBuildingAnalyzer->analyze(iEvent, iSetup, *cand, bs, theMF, theTTRHBuilder); + } + } else { + edm::LogWarning("TrackingMonitor") << "No Track Candidates in the event. Not filling associated histograms"; } - - if ( doProfilesVsLS_ || doAllPlots) { - float nLS = static_cast(iEvent.id().luminosityBlock()); - NumberEventsOfVsLS ->Fill(nLS); - NumberOfTracksVsLS ->Fill(nLS,numberOfTracks); - if (doFractionPlot_) - GoodTracksFractionVsLS->Fill(nLS,frac); + + if (doMVAPlots) { + // Get MVA and quality mask collections + std::vector mvaCollections; + std::vector qualityMaskCollections; + + edm::Handle > htracks; + iEvent.getByToken(mvaTrackToken_, htracks); + + edm::Handle hmva; + edm::Handle hqual; + for (const auto& tokenTpl : mvaQualityTokens_) { + iEvent.getByToken(std::get<0>(tokenTpl), hmva); + iEvent.getByToken(std::get<1>(tokenTpl), hqual); + + mvaCollections.push_back(hmva.product()); + qualityMaskCollections.push_back(hqual.product()); + } + theTrackBuildingAnalyzer->analyze(*htracks, mvaCollections, qualityMaskCollections); } - - if ( doLumiAnalysis ) { - NumberOfTracks_lumiFlag -> Fill(numberOfTracks); + } + + //plots for trajectory seeds + + if (doAllSeedPlots || doSeedNumberPlot || doSeedVsClusterPlot || runTrackBuildingAnalyzerForSeed) { + // get the seed collection + edm::Handle > seedHandle; + iEvent.getByToken(seedToken_, seedHandle); + + // fill the seed info + if (seedHandle.isValid()) { + const auto& seedCollection = *seedHandle; + + if (doAllSeedPlots || doSeedNumberPlot) { + NumberOfSeeds->Fill(seedCollection.size()); + if (doSeedLumiAnalysis_) + NumberOfSeeds_lumiFlag->Fill(seedCollection.size()); + } + + if (doAllSeedPlots || doSeedVsClusterPlot) { + std::vector NClus; + setNclus(iEvent, NClus); + for (uint i = 0; i < ClusterLabels.size(); i++) { + SeedsVsClusters[i]->Fill(NClus[i], seedCollection.size()); + } + } + + if (doAllSeedPlots || runTrackBuildingAnalyzerForSeed) { + edm::Handle > stopHandle; + iEvent.getByToken(seedStopInfoToken_, stopHandle); + const auto& seedStopInfo = *stopHandle; + + if (seedStopInfo.size() == seedCollection.size()) { + //here duplication of mag field and be informations is needed to allow seed and track cand histos to be independent + // magnetic field + edm::ESHandle theMF; + iSetup.get().get(theMF); + + // get the beam spot + edm::Handle recoBeamSpotHandle; + iEvent.getByToken(bsSrcToken_, recoBeamSpotHandle); + const reco::BeamSpot& bs = *recoBeamSpotHandle; + + iSetup.get().get(builderName, theTTRHBuilder); + for (size_t i = 0; i < seedCollection.size(); ++i) { + theTrackBuildingAnalyzer->analyze( + iEvent, iSetup, seedCollection[i], seedStopInfo[i], bs, theMF, theTTRHBuilder); + } + } else { + edm::LogWarning("TrackingMonitor") + << "Seed collection size (" << seedCollection.size() + << ") differs from seed stop info collection size (" << seedStopInfo.size() + << "). This is a sign of inconsistency in the configuration. Not filling associated histograms."; + } + } + + } else { + edm::LogWarning("TrackingMonitor") << "No Trajectory seeds in the event. Not filling associated histograms"; } - - - // Analyse the Track Building variables - // if the collection is empty, do not fill anything - // ---------------------------------------------------------------------------------// - - - // fill the TrackCandidate info - if (doTkCandPlots) { - // magnetic field - edm::ESHandle theMF; - iSetup.get().get(theMF); - - // get the candidate collection - edm::Handle theTCHandle; - iEvent.getByToken( trackCandidateToken_, theTCHandle ); - const TrackCandidateCollection& theTCCollection = *theTCHandle; - - if (theTCHandle.isValid()) { - - // get the beam spot - edm::Handle recoBeamSpotHandle; - iEvent.getByToken(bsSrcToken_, recoBeamSpotHandle ); - const reco::BeamSpot& bs = *recoBeamSpotHandle; - - NumberOfTrackCandidates->Fill(theTCCollection.size()); - - // get the seed collection - edm::Handle > seedHandle; - iEvent.getByToken(seedToken_, seedHandle ); - const edm::View& seedCollection = *seedHandle; - if (seedHandle.isValid() && !seedCollection.empty()) - FractionCandidatesOverSeeds->Fill(double(theTCCollection.size())/double(seedCollection.size())); - - iSetup.get().get(builderName,theTTRHBuilder); - for( TrackCandidateCollection::const_iterator cand = theTCCollection.begin(); cand != theTCCollection.end(); ++cand) { - - theTrackBuildingAnalyzer->analyze(iEvent, iSetup, *cand, bs, theMF, theTTRHBuilder); - } - } else { - edm::LogWarning("TrackingMonitor") << "No Track Candidates in the event. Not filling associated histograms"; - } - - if(doMVAPlots) { - // Get MVA and quality mask collections - std::vector mvaCollections; - std::vector qualityMaskCollections; - - edm::Handle > htracks; - iEvent.getByToken(mvaTrackToken_, htracks); - - edm::Handle hmva; - edm::Handle hqual; - for(const auto& tokenTpl: mvaQualityTokens_) { - iEvent.getByToken(std::get<0>(tokenTpl), hmva); - iEvent.getByToken(std::get<1>(tokenTpl), hqual); - - mvaCollections.push_back(hmva.product()); - qualityMaskCollections.push_back(hqual.product()); - } - theTrackBuildingAnalyzer->analyze(*htracks, mvaCollections, qualityMaskCollections); - } + } + + // plots for tracking regions + if (doRegionPlots) { + if (!regionToken_.isUninitialized()) { + edm::Handle > hregions; + iEvent.getByToken(regionToken_, hregions); + const auto& regions = *hregions; + NumberOfTrackingRegions->Fill(regions.size()); + + theTrackBuildingAnalyzer->analyze(regions); + } else if (!regionLayerSetsToken_.isUninitialized()) { + edm::Handle hregions; + iEvent.getByToken(regionLayerSetsToken_, hregions); + const auto& regions = *hregions; + NumberOfTrackingRegions->Fill(regions.regionsSize()); + + theTrackBuildingAnalyzer->analyze(regions); } - - //plots for trajectory seeds - - if (doAllSeedPlots || doSeedNumberPlot || doSeedVsClusterPlot || runTrackBuildingAnalyzerForSeed) { - - // get the seed collection - edm::Handle > seedHandle; - iEvent.getByToken(seedToken_, seedHandle ); - - // fill the seed info - if (seedHandle.isValid()) { - const auto& seedCollection = *seedHandle; - - if(doAllSeedPlots || doSeedNumberPlot) { - NumberOfSeeds->Fill(seedCollection.size()); - if ( doSeedLumiAnalysis_ ) - NumberOfSeeds_lumiFlag->Fill(seedCollection.size()); - } - - if(doAllSeedPlots || doSeedVsClusterPlot){ - - std::vector NClus; - setNclus(iEvent,NClus); - for (uint i=0; i< ClusterLabels.size(); i++){ - SeedsVsClusters[i]->Fill(NClus[i],seedCollection.size()); - } - } - - if (doAllSeedPlots || runTrackBuildingAnalyzerForSeed){ - edm::Handle > stopHandle; - iEvent.getByToken(seedStopInfoToken_, stopHandle); - const auto& seedStopInfo = *stopHandle; - - if(seedStopInfo.size() == seedCollection.size()) { - //here duplication of mag field and be informations is needed to allow seed and track cand histos to be independent - // magnetic field - edm::ESHandle theMF; - iSetup.get().get(theMF); - - // get the beam spot - edm::Handle recoBeamSpotHandle; - iEvent.getByToken(bsSrcToken_, recoBeamSpotHandle); - const reco::BeamSpot& bs = *recoBeamSpotHandle; - - iSetup.get().get(builderName,theTTRHBuilder); - for(size_t i=0; i < seedCollection.size(); ++i) { - theTrackBuildingAnalyzer->analyze(iEvent, iSetup, seedCollection[i], seedStopInfo[i], bs, theMF, theTTRHBuilder); - } - } - else { - edm::LogWarning("TrackingMonitor") << "Seed collection size (" << seedCollection.size() - << ") differs from seed stop info collection size (" << seedStopInfo.size() - << "). This is a sign of inconsistency in the configuration. Not filling associated histograms."; - } - } - - } else { - edm::LogWarning("TrackingMonitor") << "No Trajectory seeds in the event. Not filling associated histograms"; - } + + if (doRegionCandidatePlots) { + edm::Handle hcandidates; + iEvent.getByToken(regionCandidateToken_, hcandidates); + theTrackBuildingAnalyzer->analyze(*hcandidates); } - + } - // plots for tracking regions - if (doRegionPlots) { - if(!regionToken_.isUninitialized()) { - edm::Handle > hregions; - iEvent.getByToken(regionToken_, hregions); - const auto& regions = *hregions; - NumberOfTrackingRegions->Fill(regions.size()); + if (doTrackerSpecific_ || doAllPlots) { + std::vector NClus; + setNclus(iEvent, NClus); + for (uint i = 0; i < ClusterLabels.size(); i++) { + NumberOfTrkVsClusters[i]->Fill(NClus[i], numberOfTracks); + } + } - theTrackBuildingAnalyzer->analyze(regions); + if (doPUmonitoring_) { + // do vertex monitoring + for (size_t i = 0; i < theVertexMonitor.size(); i++) + theVertexMonitor[i]->analyze(iEvent, iSetup); + } + if (doPlotsVsGoodPVtx_) { + size_t totalNumGoodPV = 0; + if (pvHandle.isValid()) { + for (reco::VertexCollection::const_iterator pv = pvHandle->begin(); pv != pvHandle->end(); ++pv) { + //--- pv fake (the pv collection should have size==1 and the pv==beam spot) + if (pv->isFake() || pv->tracksSize() == 0) + continue; + + // definition of goodOfflinePrimaryVertex + if (pv->ndof() < pvNDOF_ || pv->z() > 24.) + continue; + totalNumGoodPV++; } - else if(!regionLayerSetsToken_.isUninitialized()) { - edm::Handle hregions; - iEvent.getByToken(regionLayerSetsToken_, hregions); - const auto& regions = *hregions; - NumberOfTrackingRegions->Fill(regions.regionsSize()); - theTrackBuildingAnalyzer->analyze(regions); - } + NumberEventsOfVsGoodPVtx->Fill(float(totalNumGoodPV)); + NumberOfTracksVsGoodPVtx->Fill(float(totalNumGoodPV), numberOfTracks); + if (totalNumGoodPV > 1) + NumberOfTracksVsPUPVtx->Fill(totalNumGoodPV - 1, + double(numberOfTracks - numberOfTracks_pv0) / double(totalNumGoodPV - 1)); + NumberOfPVtxVsGoodPVtx->Fill(float(totalNumGoodPV), pvHandle->size()); - if (doRegionCandidatePlots) { - edm::Handle hcandidates; - iEvent.getByToken(regionCandidateToken_, hcandidates); - theTrackBuildingAnalyzer->analyze(*hcandidates); + for (edm::View::const_iterator track = trackCollection.begin(); track != trackCollection.end(); + ++track) { + NumberOfRecHitsPerTrackVsGoodPVtx->Fill(float(totalNumGoodPV), track->numberOfValidHits()); } + + if (doProfilesVsLS_ || doAllPlots) + NumberOfGoodPVtxVsLS->Fill(static_cast(iEvent.id().luminosityBlock()), totalNumGoodPV); + if (doPlotsVsBX_ || doAllPlots) + NumberOfGoodPVtxVsBX->Fill(bx, float(totalNumGoodPV)); + + if (doFractionPlot_) + GoodTracksFractionVsGoodPVtx->Fill(float(totalNumGoodPV), frac); + + if (doPlotsVsLUMI_ || doAllPlots) + NumberOfGoodPVtxVsLUMI->Fill(lumi, float(totalNumGoodPV)); } - - if (doTrackerSpecific_ || doAllPlots) { - - std::vector NClus; - setNclus(iEvent,NClus); - for (uint i=0; i< ClusterLabels.size(); i++) { - NumberOfTrkVsClusters[i]->Fill(NClus[i],numberOfTracks); - } + + std::vector NClus; + setNclus(iEvent, NClus); + std::ostringstream ss; + ss << "VI stat " << totalNumGoodPV << ' ' << numberOfTracks; + for (uint i = 0; i < ClusterLabels.size(); i++) { + ss << ' ' << NClus[i]; + if (doPlotsVsLUMI_ || doAllPlots) { + if (ClusterLabels[i] == "Pix") + NumberOfPixelClustersVsLUMI->Fill(lumi, NClus[i]); + if (ClusterLabels[i] == "Strip") + NumberOfStripClustersVsLUMI->Fill(lumi, NClus[i]); + } + if (ClusterLabels[i] == "Pix") + NumberOfPixelClustersVsGoodPVtx->Fill(float(totalNumGoodPV), NClus[i]); + if (ClusterLabels[i] == "Strip") + NumberOfStripClustersVsGoodPVtx->Fill(float(totalNumGoodPV), NClus[i]); } - - if ( doPUmonitoring_ ) { - - // do vertex monitoring - for (size_t i=0; ianalyze(iEvent, iSetup); + COUT(MEFolderName) << ss.str() << std::endl; + if (doPlotsVsBXlumi_) { + double bxlumi = theLumiDetails_->getValue(iEvent); + NumberOfTracksVsBXlumi->Fill(bxlumi, numberOfTracks); } - if ( doPlotsVsGoodPVtx_ ) { - - size_t totalNumGoodPV = 0; - if (pvHandle.isValid()) { - - for (reco::VertexCollection::const_iterator pv = pvHandle->begin(); - pv != pvHandle->end(); ++pv) { - - //--- pv fake (the pv collection should have size==1 and the pv==beam spot) - if (pv->isFake() || pv->tracksSize()==0) continue; - - // definition of goodOfflinePrimaryVertex - if (pv->ndof() < pvNDOF_ || pv->z() > 24.) continue; - totalNumGoodPV++; - } - - NumberEventsOfVsGoodPVtx -> Fill( float(totalNumGoodPV) ); - NumberOfTracksVsGoodPVtx -> Fill( float(totalNumGoodPV), numberOfTracks ); - if (totalNumGoodPV>1) NumberOfTracksVsPUPVtx-> Fill( totalNumGoodPV-1, double(numberOfTracks-numberOfTracks_pv0)/double(totalNumGoodPV-1) ); - NumberOfPVtxVsGoodPVtx -> Fill(float(totalNumGoodPV),pvHandle->size()); - - for ( edm::View::const_iterator track = trackCollection.begin(); - track != trackCollection.end(); ++track ) { - - NumberOfRecHitsPerTrackVsGoodPVtx -> Fill(float(totalNumGoodPV), track->numberOfValidHits()); - } - - if ( doProfilesVsLS_ || doAllPlots) - NumberOfGoodPVtxVsLS->Fill(static_cast(iEvent.id().luminosityBlock()),totalNumGoodPV); - if ( doPlotsVsBX_ || doAllPlots ) - NumberOfGoodPVtxVsBX->Fill(bx, float(totalNumGoodPV)); - - if (doFractionPlot_) - GoodTracksFractionVsGoodPVtx->Fill(float(totalNumGoodPV),frac); - - if ( doPlotsVsLUMI_ || doAllPlots ) - NumberOfGoodPVtxVsLUMI->Fill(lumi,float(totalNumGoodPV)); - } - - std::vector NClus; - setNclus(iEvent,NClus); - std::ostringstream ss; - ss << "VI stat " << totalNumGoodPV << ' ' << numberOfTracks; - for (uint i=0; i< ClusterLabels.size(); i++){ - ss << ' ' << NClus[i]; - if ( doPlotsVsLUMI_ || doAllPlots ) { - if (ClusterLabels[i] =="Pix") NumberOfPixelClustersVsLUMI->Fill(lumi,NClus[i]); - if (ClusterLabels[i]=="Strip") NumberOfStripClustersVsLUMI->Fill(lumi,NClus[i]); - } - if (ClusterLabels[i] =="Pix") NumberOfPixelClustersVsGoodPVtx->Fill(float(totalNumGoodPV),NClus[i]); - if (ClusterLabels[i]=="Strip") NumberOfStripClustersVsGoodPVtx->Fill(float(totalNumGoodPV),NClus[i]); - } - COUT(MEFolderName) << ss.str() << std::endl; - if ( doPlotsVsBXlumi_ ) { - double bxlumi = theLumiDetails_->getValue(iEvent); - NumberOfTracksVsBXlumi -> Fill( bxlumi, numberOfTracks ); - } - - if ( doProfilesVsLS_ || doAllPlots ) if ( totalNumGoodPV != 0 ) NumberOfGoodPVtxWO0VsLS -> Fill(static_cast(iEvent.id().luminosityBlock()),float(totalNumGoodPV)); - if ( doPlotsVsBX_ || doAllPlots ) if ( totalNumGoodPV != 0 ) NumberOfGoodPVtxWO0VsBX -> Fill(bx, float(totalNumGoodPV)); - if ( doPlotsVsLUMI_ || doAllPlots ) if ( totalNumGoodPV != 0 ) NumberOfGoodPVtxWO0VsLUMI-> Fill(lumi,float(totalNumGoodPV)); - - } // PU monitoring - - } // trackHandle is valid - -} + if (doProfilesVsLS_ || doAllPlots) + if (totalNumGoodPV != 0) + NumberOfGoodPVtxWO0VsLS->Fill(static_cast(iEvent.id().luminosityBlock()), float(totalNumGoodPV)); + if (doPlotsVsBX_ || doAllPlots) + if (totalNumGoodPV != 0) + NumberOfGoodPVtxWO0VsBX->Fill(bx, float(totalNumGoodPV)); + if (doPlotsVsLUMI_ || doAllPlots) + if (totalNumGoodPV != 0) + NumberOfGoodPVtxWO0VsLUMI->Fill(lumi, float(totalNumGoodPV)); -void TrackingMonitor::endRun(const edm::Run&, const edm::EventSetup&) -{ + } // PU monitoring + + } // trackHandle is valid } -void TrackingMonitor::setMaxMinBin(std::vector &arrayMin, std::vector &arrayMax, std::vector &arrayBin, double smin, double smax, int sbin, double pmin, double pmax, int pbin) -{ +void TrackingMonitor::endRun(const edm::Run&, const edm::EventSetup&) {} + +void TrackingMonitor::setMaxMinBin(std::vector& arrayMin, + std::vector& arrayMax, + std::vector& arrayBin, + double smin, + double smax, + int sbin, + double pmin, + double pmax, + int pbin) { arrayMin.resize(ClusterLabels.size()); arrayMax.resize(ClusterLabels.size()); arrayBin.resize(ClusterLabels.size()); - for (uint i=0; i &arrayNclus) -{ +void TrackingMonitor::setNclus(const edm::Event& iEvent, std::vector& arrayNclus) { + int ncluster_pix = -1; + int ncluster_strip = -1; - int ncluster_pix=-1; - int ncluster_strip=-1; - - edm::Handle< edmNew::DetSetVector > strip_clusters; - iEvent.getByToken(stripClustersToken_, strip_clusters ); - edm::Handle< edmNew::DetSetVector > pixel_clusters; - iEvent.getByToken(pixelClustersToken_, pixel_clusters ); + edm::Handle > strip_clusters; + iEvent.getByToken(stripClustersToken_, strip_clusters); + edm::Handle > pixel_clusters; + iEvent.getByToken(pixelClustersToken_, pixel_clusters); if (strip_clusters.isValid() && pixel_clusters.isValid()) { - ncluster_pix = (*pixel_clusters).dataSize(); - ncluster_strip = (*strip_clusters).dataSize(); + ncluster_pix = (*pixel_clusters).dataSize(); + ncluster_strip = (*strip_clusters).dataSize(); } arrayNclus.resize(ClusterLabels.size()); - for (uint i=0; i Date: Tue, 25 Jun 2019 14:53:20 +0200 Subject: [PATCH 3/5] Fixing the title of some plots --- DQM/TrackingMonitor/interface/TrackAnalyzer.h | 16 +- DQM/TrackingMonitor/src/TrackAnalyzer.cc | 191 ++++++++++-------- 2 files changed, 116 insertions(+), 91 deletions(-) diff --git a/DQM/TrackingMonitor/interface/TrackAnalyzer.h b/DQM/TrackingMonitor/interface/TrackAnalyzer.h index 52169b3329aa6..9dc2e725b70e4 100644 --- a/DQM/TrackingMonitor/interface/TrackAnalyzer.h +++ b/DQM/TrackingMonitor/interface/TrackAnalyzer.h @@ -226,14 +226,14 @@ namespace dqm { MonitorElement* TrackPy; MonitorElement* TrackPz; MonitorElement* TrackPt; - MonitorElement* TrackPtZone1; - MonitorElement* TrackPtZone2; - MonitorElement* TrackPtZone3; - MonitorElement* TrackPtZone4; - MonitorElement* TrackPtZone5; - MonitorElement* TrackPtZone6; - MonitorElement* TrackPtZone7; - MonitorElement* TrackPtZone8; + MonitorElement* TrackPt_NegEta_Phi_btw_neg16_neg32; + MonitorElement* TrackPt_NegEta_Phi_btw_0_neg16; + MonitorElement* TrackPt_NegEta_Phi_btw_16_0; + MonitorElement* TrackPt_NegEta_Phi_btw_32_16; + MonitorElement* TrackPt_PosEta_Phi_btw_neg16_neg32; + MonitorElement* TrackPt_PosEta_Phi_btw_0_neg16; + MonitorElement* TrackPt_PosEta_Phi_btw_16_0; + MonitorElement* TrackPt_PosEta_Phi_btw_32_16; MonitorElement* Ratio_byFolding; MonitorElement* Ratio_byFolding2; MonitorElement* TrackPtHighPurity; diff --git a/DQM/TrackingMonitor/src/TrackAnalyzer.cc b/DQM/TrackingMonitor/src/TrackAnalyzer.cc index fdb8e6800d12b..cb8a021fa8dc0 100644 --- a/DQM/TrackingMonitor/src/TrackAnalyzer.cc +++ b/DQM/TrackingMonitor/src/TrackAnalyzer.cc @@ -1623,45 +1623,45 @@ void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibo tkmes.Quality->setBinLabel(ibin + 1, reco::TrackBase::qualityNames[ibin]); } - histname = "TrackPtZone1_" + histTag; - tkmes.TrackPtZone1 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone1->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone1->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPtZone2_" + histTag; - tkmes.TrackPtZone2 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone2->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone2->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPtZone3_" + histTag; - tkmes.TrackPtZone3 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone3->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone3->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPtZone4_" + histTag; - tkmes.TrackPtZone4 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone4->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone4->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPtZone5_" + histTag; - tkmes.TrackPtZone5 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone5->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone5->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPtZone6_" + histTag; - tkmes.TrackPtZone6 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone6->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone6->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPtZone7_" + histTag; - tkmes.TrackPtZone7 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone7->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone7->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPtZone8_" + histTag; - tkmes.TrackPtZone8 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtZone8->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtZone8->setAxisTitle("Number of Tracks", 2); + histname = "TrackPt_NegEta_Phi_btw_neg16_neg32_" + histTag; + tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_NegEta_Phi_btw_0_neg16_" + histTag; + tkmes.TrackPt_NegEta_Phi_btw_0_neg16 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_NegEta_Phi_btw_0_neg16->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_NegEta_Phi_btw_0_neg16->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_NegEta_Phi_btw_16_0_" + histTag; + tkmes.TrackPt_NegEta_Phi_btw_16_0 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_NegEta_Phi_btw_16_0->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_NegEta_Phi_btw_16_0->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_NegEta_Phi_btw_32_16_" + histTag; + tkmes.TrackPt_NegEta_Phi_btw_32_16 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_NegEta_Phi_btw_32_16->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_NegEta_Phi_btw_32_16->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_PosEta_Phi_btw_neg16_neg32_" + histTag; + tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_PosEta_Phi_btw_0_neg16_" + histTag; + tkmes.TrackPt_PosEta_Phi_btw_0_neg16 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_PosEta_Phi_btw_0_neg16->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_PosEta_Phi_btw_0_neg16->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_PosEta_Phi_btw_16_0_" + histTag; + tkmes.TrackPt_PosEta_Phi_btw_16_0 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_PosEta_Phi_btw_16_0->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_PosEta_Phi_btw_16_0->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_PosEta_Phi_btw_32_16_" + histTag; + tkmes.TrackPt_PosEta_Phi_btw_32_16 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_PosEta_Phi_btw_32_16->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_PosEta_Phi_btw_32_16->setAxisTitle("Number of Tracks", 2); histname = "Ratio_byFolding_" + histTag; tkmes.Ratio_byFolding = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); @@ -2056,43 +2056,44 @@ void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco } } - //pT histograms to create efficiency vs pT plot for only the more inefficient region. + //pT histograms to create efficiency vs pT plot, only for the most inefficient region. if (eta < 0. && phi < -1.6) { - tkmes.TrackPtZone1->Fill(pt); + tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->Fill(pt); } if (eta < 0. && phi < 0 && phi >= -1.6) { - tkmes.TrackPtZone2->Fill(pt); + tkmes.TrackPt_NegEta_Phi_btw_0_neg16->Fill(pt); } if (eta < 0. && phi < 1.6 && phi >= 0) { - tkmes.TrackPtZone3->Fill(pt); + tkmes.TrackPt_NegEta_Phi_btw_16_0->Fill(pt); } if (eta < 0. && phi >= 1.6) { - tkmes.TrackPtZone4->Fill(pt); + tkmes.TrackPt_NegEta_Phi_btw_32_16->Fill(pt); } if (eta >= 0. && phi < -1.6) { - tkmes.TrackPtZone5->Fill(pt); + tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->Fill(pt); } if (eta >= 0. && phi < 0 && phi >= -1.6) { - tkmes.TrackPtZone6->Fill(pt); + tkmes.TrackPt_PosEta_Phi_btw_0_neg16->Fill(pt); } if (eta >= 0. && phi < 1.6 && phi >= 0) { - tkmes.TrackPtZone7->Fill(pt); + tkmes.TrackPt_PosEta_Phi_btw_16_0->Fill(pt); } if (eta >= 0. && phi >= 1.6) { - tkmes.TrackPtZone8->Fill(pt); + tkmes.TrackPt_PosEta_Phi_btw_32_16->Fill(pt); } float A[8]; - A[0] = tkmes.TrackPtZone1->getTH1()->Integral(); - A[1] = tkmes.TrackPtZone2->getTH1()->Integral(); - A[2] = tkmes.TrackPtZone3->getTH1()->Integral(); - A[3] = tkmes.TrackPtZone4->getTH1()->Integral(); - A[4] = tkmes.TrackPtZone5->getTH1()->Integral(); - A[5] = tkmes.TrackPtZone6->getTH1()->Integral(); - A[6] = tkmes.TrackPtZone7->getTH1()->Integral(); - A[7] = tkmes.TrackPtZone8->getTH1()->Integral(); - + A[0] = tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1()->Integral(); + A[1] = tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1()->Integral(); + A[2] = tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1()->Integral(); + A[3] = tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1()->Integral(); + A[4] = tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1()->Integral(); + A[5] = tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1()->Integral(); + A[6] = tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1()->Integral(); + A[7] = tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1()->Integral(); + + //WZ (the worst zone) int WZ = 0; float minA = A[0]; for (int w = 1; w < 8; w++) { @@ -2104,56 +2105,80 @@ void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco switch (WZ) { case 1: - tkmes.Ratio_byFolding->getTH1()->Divide( - tkmes.TrackPtZone1->getTH1(), tkmes.TrackPtZone4->getTH1(), 1., 1., "B"); - tkmes.Ratio_byFolding2->getTH1()->Divide( - tkmes.TrackPtZone1->getTH1(), tkmes.TrackPtZone2->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1(), + tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1(), + 1., + 1., + "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1(), + tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1(), + 1., + 1., + "B"); break; case 2: tkmes.Ratio_byFolding->getTH1()->Divide( - tkmes.TrackPtZone2->getTH1(), tkmes.TrackPtZone3->getTH1(), 1., 1., "B"); - tkmes.Ratio_byFolding2->getTH1()->Divide( - tkmes.TrackPtZone2->getTH1(), tkmes.TrackPtZone1->getTH1(), 1., 1., "B"); + tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1(), tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1(), + tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1(), + 1., + 1., + "B"); break; case 3: tkmes.Ratio_byFolding->getTH1()->Divide( - tkmes.TrackPtZone3->getTH1(), tkmes.TrackPtZone2->getTH1(), 1., 1., "B"); + tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1(), tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1(), 1., 1., "B"); tkmes.Ratio_byFolding2->getTH1()->Divide( - tkmes.TrackPtZone3->getTH1(), tkmes.TrackPtZone4->getTH1(), 1., 1., "B"); + tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1(), tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1(), 1., 1., "B"); break; case 4: - tkmes.Ratio_byFolding->getTH1()->Divide( - tkmes.TrackPtZone4->getTH1(), tkmes.TrackPtZone1->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1(), + tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1(), + 1., + 1., + "B"); tkmes.Ratio_byFolding2->getTH1()->Divide( - tkmes.TrackPtZone4->getTH1(), tkmes.TrackPtZone3->getTH1(), 1., 1., "B"); + tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1(), tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1(), 1., 1., "B"); break; case 5: - tkmes.Ratio_byFolding->getTH1()->Divide( - tkmes.TrackPtZone5->getTH1(), tkmes.TrackPtZone8->getTH1(), 1., 1., "B"); - tkmes.Ratio_byFolding2->getTH1()->Divide( - tkmes.TrackPtZone5->getTH1(), tkmes.TrackPtZone6->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1(), + tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1(), + 1., + 1., + "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1(), + tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1(), + 1., + 1., + "B"); break; case 6: tkmes.Ratio_byFolding->getTH1()->Divide( - tkmes.TrackPtZone6->getTH1(), tkmes.TrackPtZone7->getTH1(), 1., 1., "B"); - tkmes.Ratio_byFolding2->getTH1()->Divide( - tkmes.TrackPtZone6->getTH1(), tkmes.TrackPtZone5->getTH1(), 1., 1., "B"); + tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1(), tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1(), + tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1(), + 1., + 1., + "B"); break; case 7: tkmes.Ratio_byFolding->getTH1()->Divide( - tkmes.TrackPtZone7->getTH1(), tkmes.TrackPtZone6->getTH1(), 1., 1., "B"); + tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1(), tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1(), 1., 1., "B"); tkmes.Ratio_byFolding2->getTH1()->Divide( - tkmes.TrackPtZone7->getTH1(), tkmes.TrackPtZone8->getTH1(), 1., 1., "B"); + tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1(), tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1(), 1., 1., "B"); break; case 8: - tkmes.Ratio_byFolding->getTH1()->Divide( - tkmes.TrackPtZone8->getTH1(), tkmes.TrackPtZone5->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1(), + tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1(), + 1., + 1., + "B"); tkmes.Ratio_byFolding2->getTH1()->Divide( - tkmes.TrackPtZone8->getTH1(), tkmes.TrackPtZone7->getTH1(), 1., 1., "B"); + tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1(), tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1(), 1., 1., "B"); break; } - tkmes.Ratio_byFolding->setAxisTitle("Efficiency(Ratio)_Zone" + std::to_string(WZ), 2); - tkmes.Ratio_byFolding2->setAxisTitle("Efficiency(Ratio)_Zone" + std::to_string(WZ), 2); + tkmes.Ratio_byFolding->setAxisTitle("Efficiency(Ratio)_" + std::to_string(WZ), 2); + tkmes.Ratio_byFolding2->setAxisTitle("Efficiency(Ratio)_" + std::to_string(WZ), 2); tkmes.TrackEtaPhiInner->Fill(etaIn, phiIn); tkmes.TrackEtaPhiOuter->Fill(etaOut, phiOut); From 341da94c35e1214accc0f8f105610e6b1153e276 Mon Sep 17 00:00:00 2001 From: Hugo Becerril Date: Mon, 1 Jul 2019 00:03:08 +0200 Subject: [PATCH 4/5] This change only produce the new plots in the Tracking workspace --- DQM/TrackingMonitor/src/TrackAnalyzer.cc | 173 ++++++++++++--------- DQM/TrackingMonitor/src/TrackingMonitor.cc | 13 +- 2 files changed, 111 insertions(+), 75 deletions(-) diff --git a/DQM/TrackingMonitor/src/TrackAnalyzer.cc b/DQM/TrackingMonitor/src/TrackAnalyzer.cc index cb8a021fa8dc0..80f56c93d67fe 100644 --- a/DQM/TrackingMonitor/src/TrackAnalyzer.cc +++ b/DQM/TrackingMonitor/src/TrackAnalyzer.cc @@ -770,6 +770,7 @@ void TrackAnalyzer::bookHistosForBeamSpot(DQMStore::IBooker& ibooker) { // use the AlgoName and Quality Name std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; + std::string Folder = TopFolder_.substr(0,2); // book the Beam Spot related histograms // ---------------------------------------------------------------------------------// @@ -852,11 +853,22 @@ void TrackAnalyzer::bookHistosForBeamSpot(DQMStore::IBooker& ibooker) { DistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 1); DistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks", 2); + if (Folder == "Tr") { + histname = "DistanceOfClosestApproachToBSdz_"; DistanceOfClosestApproachToBSdz = ibooker.book1D(histname + CategoryName, histname + CategoryName, 100, -1.1, 1.1); DistanceOfClosestApproachToBSdz->setAxisTitle("Track d_{z} wrt beam spot (cm)", 1); DistanceOfClosestApproachToBSdz->setAxisTitle("Number of Tracks", 2); + histname = "DistanceOfClosestApproachToBSVsEta_"; + DistanceOfClosestApproachToBSVsEta = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, DxyBin, DxyMin, DxyMax, ""); + DistanceOfClosestApproachToBSVsEta->getTH1()->SetCanExtend(TH1::kAllAxes); + DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track #eta", 1); + DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 2); + + } + histname = "AbsDistanceOfClosestApproachToBS_"; AbsDistanceOfClosestApproachToBS = ibooker.book1D(histname + CategoryName, histname + CategoryName, AbsDxyBin, AbsDxyMin, AbsDxyMax); @@ -870,13 +882,6 @@ void TrackAnalyzer::bookHistosForBeamSpot(DQMStore::IBooker& ibooker) { DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track #phi", 1); DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 2); - histname = "DistanceOfClosestApproachToBSVsEta_"; - DistanceOfClosestApproachToBSVsEta = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, DxyBin, DxyMin, DxyMax, ""); - DistanceOfClosestApproachToBSVsEta->getTH1()->SetCanExtend(TH1::kAllAxes); - DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track #eta", 1); - DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 2); - histname = "xPointOfClosestApproachVsZ0wrt000_"; xPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile( histname + CategoryName, histname + CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max, ""); @@ -1171,6 +1176,8 @@ void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe auto chi2prob = TMath::Prob(track.chi2(), (int)track.ndof()); auto chi2oNDF = track.normalizedChi2(); + std::string Folder = TopFolder_.substr(0,2); + if (doHitPropertiesPlots_ || doAllPlots_) { // rec hits NumberOfRecHitsPerTrack->Fill(nRecHits); @@ -1278,10 +1285,14 @@ void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe DistanceOfClosestApproachErrorVsDxy->Fill(track.dxy(bs.position()), track.dxyError()); DistanceOfClosestApproachToBS->Fill(track.dxy(bs.position())); + + if (Folder == "Tr") { DistanceOfClosestApproachToBSdz->Fill(track.dz(bs.position())); + DistanceOfClosestApproachToBSVsEta->Fill(track.eta(), track.dxy(bs.position())); + } + AbsDistanceOfClosestApproachToBS->Fill(std::abs(track.dxy(bs.position()))); DistanceOfClosestApproachToBSVsPhi->Fill(track.phi(), track.dxy(bs.position())); - DistanceOfClosestApproachToBSVsEta->Fill(track.eta(), track.dxy(bs.position())); zPointOfClosestApproachVsPhi->Fill(track.phi(), track.vz()); xPointOfClosestApproachVsZ0wrt000->Fill(track.dz(), track.vx()); yPointOfClosestApproachVsZ0wrt000->Fill(track.dz(), track.vy()); @@ -1448,7 +1459,8 @@ void TrackAnalyzer::fillHistosForEfficiencyFromHitPatter(const reco::Track& trac void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibooker) { // parameters from the configuration std::string QualName = conf_->getParameter("Quality"); - std::string AlgoName = conf_->getParameter("AlgoName"); + std::string AlgoName = conf_->getParameter("AlgoName"); + std::string Folder = TopFolder_.substr(0,2); // use the AlgoName and Quality Name std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; @@ -1599,6 +1611,36 @@ void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibo tkmes.TrackPt->setAxisTitle("Track p_{T} (GeV/c)", 1); tkmes.TrackPt->setAxisTitle("Number of Tracks", 2); + + + if (doTrackPxPyPlots_) { + histname = "TrackPx_" + histTag; + tkmes.TrackPx = ibooker.book1D(histname, histname, TrackPxBin, TrackPxMin, TrackPxMax); + tkmes.TrackPx->setAxisTitle("Track p_{x} (GeV/c)", 1); + tkmes.TrackPx->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPy_" + histTag; + tkmes.TrackPy = ibooker.book1D(histname, histname, TrackPyBin, TrackPyMin, TrackPyMax); + tkmes.TrackPy->setAxisTitle("Track p_{y} (GeV/c)", 1); + tkmes.TrackPy->setAxisTitle("Number of Tracks", 2); + } + histname = "TrackPz_" + histTag; + tkmes.TrackPz = ibooker.book1D(histname, histname, TrackPzBin, TrackPzMin, TrackPzMax); + tkmes.TrackPz->setAxisTitle("Track p_{z} (GeV/c)", 1); + tkmes.TrackPz->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPhi_" + histTag; + tkmes.TrackPhi = ibooker.book1D(histname, histname, PhiBin, PhiMin, PhiMax); + tkmes.TrackPhi->setAxisTitle("Track #phi", 1); + tkmes.TrackPhi->setAxisTitle("Number of Tracks", 2); + + histname = "TrackEta_" + histTag; + tkmes.TrackEta = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); + tkmes.TrackEta->setAxisTitle("Track #eta", 1); + tkmes.TrackEta->setAxisTitle("Number of Tracks", 2); + + if (Folder == "Tr") { + histname = "TrackPtHighPurity_" + histTag; tkmes.TrackPtHighPurity = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); tkmes.TrackPtHighPurity->setAxisTitle("Track p_{T} (GeV/c)", 1); @@ -1671,32 +1713,6 @@ void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibo tkmes.Ratio_byFolding2 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); tkmes.Ratio_byFolding2->setAxisTitle("Track p_{T} (GeV/c)", 1); - if (doTrackPxPyPlots_) { - histname = "TrackPx_" + histTag; - tkmes.TrackPx = ibooker.book1D(histname, histname, TrackPxBin, TrackPxMin, TrackPxMax); - tkmes.TrackPx->setAxisTitle("Track p_{x} (GeV/c)", 1); - tkmes.TrackPx->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPy_" + histTag; - tkmes.TrackPy = ibooker.book1D(histname, histname, TrackPyBin, TrackPyMin, TrackPyMax); - tkmes.TrackPy->setAxisTitle("Track p_{y} (GeV/c)", 1); - tkmes.TrackPy->setAxisTitle("Number of Tracks", 2); - } - histname = "TrackPz_" + histTag; - tkmes.TrackPz = ibooker.book1D(histname, histname, TrackPzBin, TrackPzMin, TrackPzMax); - tkmes.TrackPz->setAxisTitle("Track p_{z} (GeV/c)", 1); - tkmes.TrackPz->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPhi_" + histTag; - tkmes.TrackPhi = ibooker.book1D(histname, histname, PhiBin, PhiMin, PhiMax); - tkmes.TrackPhi->setAxisTitle("Track #phi", 1); - tkmes.TrackPhi->setAxisTitle("Number of Tracks", 2); - - histname = "TrackEta_" + histTag; - tkmes.TrackEta = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); - tkmes.TrackEta->setAxisTitle("Track #eta", 1); - tkmes.TrackEta->setAxisTitle("Number of Tracks", 2); - histname = "TrackEtaHighpurity_" + histTag; tkmes.TrackEtaHighPurity = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); tkmes.TrackEtaHighPurity->setAxisTitle("Track #eta", 1); @@ -1712,11 +1728,6 @@ void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibo tkmes.TrackEtaLoose->setAxisTitle("Track #eta", 1); tkmes.TrackEtaLoose->setAxisTitle("Number of Loose Tracks", 2); - histname = "TrackEtaPhi_" + histTag; - tkmes.TrackEtaPhi = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TrackEtaPhi->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaPhi->setAxisTitle("Track #phi", 2); - histname = "TrackEtaPhiInverted_" + histTag; tkmes.TrackEtaPhiInverted = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); tkmes.TrackEtaPhiInverted->setAxisTitle("Track #eta", 1); @@ -1752,6 +1763,18 @@ void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibo tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #eta", 1); tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #phi", 2); + histname = "TrackQoverP_" + histTag; + tkmes.TrackQoverP = ibooker.book1D(histname, histname, 10 * TrackQBin, TrackQMin, TrackQMax); + tkmes.TrackQoverP->setAxisTitle("Track QoverP", 1); + tkmes.TrackQoverP->setAxisTitle("Number of Tracks", 2); + + } + + histname = "TrackEtaPhi_" + histTag; + tkmes.TrackEtaPhi = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhi->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhi->setAxisTitle("Track #phi", 2); + histname = "TrackEtaPhiInner_" + histTag; tkmes.TrackEtaPhiInner = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); tkmes.TrackEtaPhiInner->setAxisTitle("Track #eta", 1); @@ -1773,11 +1796,6 @@ void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibo tkmes.TrackQ->setAxisTitle("Track Charge", 1); tkmes.TrackQ->setAxisTitle("Number of Tracks", 2); - histname = "TrackQoverP_" + histTag; - tkmes.TrackQoverP = ibooker.book1D(histname, histname, 10 * TrackQBin, TrackQMin, TrackQMax); - tkmes.TrackQoverP->setAxisTitle("Track QoverP", 1); - tkmes.TrackQoverP->setAxisTitle("Number of Tracks", 2); - histname = "TrackPErrOverP_" + histTag; tkmes.TrackPErr = ibooker.book1D(histname, histname, pErrBin, pErrMin, pErrMax); tkmes.TrackPErr->setAxisTitle("track error(p)/p", 1); @@ -1920,6 +1938,8 @@ void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco double p, px, py, pz, pt, theta, phi, eta, q; double pxerror, pyerror, pzerror, pterror, perror, phierror, etaerror; + std::string Folder = TopFolder_.substr(0,2); + auto phiIn = track.innerPosition().phi(); auto etaIn = track.innerPosition().eta(); auto phiOut = track.outerPosition().phi(); @@ -1994,36 +2014,16 @@ void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco tkmes.TrackPz->Fill(pz); tkmes.TrackPt->Fill(pt); - if (track.quality(reco::TrackBase::highPurity)) { - tkmes.TrackPtHighPurity->Fill(pt); - tkmes.Quality->Fill(reco::TrackBase::highPurity, 1.); - } - if (track.quality(reco::TrackBase::tight)) { - tkmes.TrackPtTight->Fill(pt); - tkmes.Quality->Fill(reco::TrackBase::tight, 1.); - } - if (track.quality(reco::TrackBase::loose)) { - tkmes.TrackPtLoose->Fill(pt); - tkmes.Quality->Fill(reco::TrackBase::loose, 1.); - } - // angles tkmes.TrackPhi->Fill(phi); tkmes.TrackEta->Fill(eta); - if (track.quality(reco::TrackBase::highPurity)) { - tkmes.TrackEtaHighPurity->Fill(eta); - } - if (track.quality(reco::TrackBase::tight)) { - tkmes.TrackEtaTight->Fill(eta); - } - if (track.quality(reco::TrackBase::loose)) { - tkmes.TrackEtaLoose->Fill(eta); - } - tkmes.TrackEtaPhi->Fill(eta, phi); + + if (Folder == "Tr") { + tkmes.TrackEtaPhiInverted->Fill(eta, -1 * phi); - tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, 3.141592654 + phi); - tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, phi - 3.141592654); + tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, 3.141592654 + -1*phi); + tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, -1*phi - 3.141592654); tkmes.TkEtaPhi_Ratio_byFoldingmap->getTH2F()->Divide( tkmes.TrackEtaPhi->getTH2F(), tkmes.TrackEtaPhiInverted->getTH2F(), 1., 1., ""); tkmes.TkEtaPhi_Ratio_byFoldingmap_op->getTH2F()->Divide( @@ -2180,6 +2180,34 @@ void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco tkmes.Ratio_byFolding->setAxisTitle("Efficiency(Ratio)_" + std::to_string(WZ), 2); tkmes.Ratio_byFolding2->setAxisTitle("Efficiency(Ratio)_" + std::to_string(WZ), 2); + if (track.quality(reco::TrackBase::highPurity)) { + tkmes.TrackPtHighPurity->Fill(pt); + tkmes.Quality->Fill(reco::TrackBase::highPurity, 1.); + } + if (track.quality(reco::TrackBase::tight)) { + tkmes.TrackPtTight->Fill(pt); + tkmes.Quality->Fill(reco::TrackBase::tight, 1.); + } + if (track.quality(reco::TrackBase::loose)) { + tkmes.TrackPtLoose->Fill(pt); + tkmes.Quality->Fill(reco::TrackBase::loose, 1.); + } + if (track.quality(reco::TrackBase::highPurity)) { + tkmes.TrackEtaHighPurity->Fill(eta); + } + if (track.quality(reco::TrackBase::tight)) { + tkmes.TrackEtaTight->Fill(eta); + } + if (track.quality(reco::TrackBase::loose)) { + tkmes.TrackEtaLoose->Fill(eta); + } + + if (p > 0.) { + tkmes.TrackQoverP->Fill(q / p); + } + + } + tkmes.TrackEtaPhiInner->Fill(etaIn, phiIn); tkmes.TrackEtaPhiOuter->Fill(etaOut, phiOut); @@ -2187,9 +2215,7 @@ void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco tkmes.TrackTheta->Fill(theta); } tkmes.TrackQ->Fill(q); - if (p > 0.) { - tkmes.TrackQoverP->Fill(q / p); - } + // errors tkmes.TrackPtErr->Fill(pterror); tkmes.TrackPtErrVsEta->Fill(eta, pterror); @@ -2210,7 +2236,6 @@ void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco tkmes.NumberOfRecHitsPerTrackVsTheta->Fill(theta, nRecHits); } tkmes.NumberOfRecHitsPerTrackVsEta->Fill(eta, nRecHits); - tkmes.NumberOfValidRecHitsPerTrackVsPhi->Fill(phi, nValidRecHits); tkmes.NumberOfValidRecHitsPerTrackVsEta->Fill(eta, nValidRecHits); tkmes.NumberOfValidRecHitsPerTrackVsPt->Fill(pt, nValidRecHits); diff --git a/DQM/TrackingMonitor/src/TrackingMonitor.cc b/DQM/TrackingMonitor/src/TrackingMonitor.cc index 74f69e0ff3114..bd0cea4d384ae 100644 --- a/DQM/TrackingMonitor/src/TrackingMonitor.cc +++ b/DQM/TrackingMonitor/src/TrackingMonitor.cc @@ -230,6 +230,7 @@ void TrackingMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& std::string Quality = conf->getParameter("Quality"); std::string AlgoName = conf->getParameter("AlgoName"); MEFolderName = conf->getParameter("FolderName"); + std::string Folder = MEFolderName.substr(0,2); // test for the Quality veriable validity if (!Quality_.empty()) { @@ -288,6 +289,8 @@ void TrackingMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& NumberOfTracks->setAxisTitle("Number of Tracks per Event", 1); NumberOfTracks->setAxisTitle("Number of Events", 2); + if (Folder == "Tr") { + histname = "NumberOfTracks_PUvtx_" + CategoryName; NumberOfTracks_PUvtx = ibooker.book1D(histname, histname, 3 * TKNoBin, TKNoMin, (TKNoMax + 0.5) * 3. - 0.5); NumberOfTracks_PUvtx->setAxisTitle("Number of Tracks per Event (matched a PU vertex)", 1); @@ -305,6 +308,8 @@ void TrackingMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& NumberofTracks_Hardvtx_PUvtx->setBinLabel(1, "PU_Vertex"); NumberofTracks_Hardvtx_PUvtx->setBinLabel(2, "Hard_Vertex"); + } + histname = "NumberOfMeanRecHitsPerTrack_" + CategoryName; NumberOfMeanRecHitsPerTrack = ibooker.book1D(histname, histname, MeanHitBin, MeanHitMin, MeanHitMax); NumberOfMeanRecHitsPerTrack->setAxisTitle("Mean number of valid RecHits per Track", 1); @@ -745,7 +750,9 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i // Filter out events if Trigger Filtering is requested if (genTriggerEventFlag_->on() && !genTriggerEventFlag_->accept(iEvent, iSetup)) return; - + auto const* conf = edm::pset::Registry::instance()->getMapped(confID_); + MEFolderName = conf->getParameter("FolderName"); + std::string Folder = MEFolderName.substr(0,2); float lumi = -1.; edm::Handle lumiScalers; iEvent.getByToken(lumiscalersToken_, lumiScalers); @@ -837,10 +844,14 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i if (doGeneralPropertiesPlots_ || doAllPlots) { NumberOfTracks->Fill(double(numberOfTracks)); + + if (Folder == "Tr") { NumberofTracks_Hardvtx->Fill(double(numberOfTracks_pv0)); NumberOfTracks_PUvtx->Fill(double(numberOfTracks - numberOfTracks_pv0)); NumberofTracks_Hardvtx_PUvtx->Fill(0.5, double(numberOfTracks_pv0)); NumberofTracks_Hardvtx_PUvtx->Fill(1.5, double(numberOfTracks - numberOfTracks_pv0)); + } + if (doPlotsVsBX_ || doAllPlots) NumberOfTracksVsBX->Fill(bx, numberOfTracks); if (doPlotsVsLUMI_ || doAllPlots) From 03484f913424380390f8dd755a2ece9349c4ae55 Mon Sep 17 00:00:00 2001 From: Hugo Becerril Date: Mon, 1 Jul 2019 00:26:55 +0200 Subject: [PATCH 5/5] Fix Format --- DQM/TrackingMonitor/src/TrackAnalyzer.cc | 647 ++++++++++----------- DQM/TrackingMonitor/src/TrackingMonitor.cc | 49 +- 2 files changed, 344 insertions(+), 352 deletions(-) diff --git a/DQM/TrackingMonitor/src/TrackAnalyzer.cc b/DQM/TrackingMonitor/src/TrackAnalyzer.cc index 80f56c93d67fe..f1abe45ff7599 100644 --- a/DQM/TrackingMonitor/src/TrackAnalyzer.cc +++ b/DQM/TrackingMonitor/src/TrackAnalyzer.cc @@ -770,7 +770,7 @@ void TrackAnalyzer::bookHistosForBeamSpot(DQMStore::IBooker& ibooker) { // use the AlgoName and Quality Name std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; - std::string Folder = TopFolder_.substr(0,2); + std::string Folder = TopFolder_.substr(0, 2); // book the Beam Spot related histograms // ---------------------------------------------------------------------------------// @@ -854,20 +854,19 @@ void TrackAnalyzer::bookHistosForBeamSpot(DQMStore::IBooker& ibooker) { DistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks", 2); if (Folder == "Tr") { - - histname = "DistanceOfClosestApproachToBSdz_"; - DistanceOfClosestApproachToBSdz = ibooker.book1D(histname + CategoryName, histname + CategoryName, 100, -1.1, 1.1); - DistanceOfClosestApproachToBSdz->setAxisTitle("Track d_{z} wrt beam spot (cm)", 1); - DistanceOfClosestApproachToBSdz->setAxisTitle("Number of Tracks", 2); - - histname = "DistanceOfClosestApproachToBSVsEta_"; - DistanceOfClosestApproachToBSVsEta = ibooker.bookProfile( - histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, DxyBin, DxyMin, DxyMax, ""); - DistanceOfClosestApproachToBSVsEta->getTH1()->SetCanExtend(TH1::kAllAxes); - DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track #eta", 1); - DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 2); - - } + histname = "DistanceOfClosestApproachToBSdz_"; + DistanceOfClosestApproachToBSdz = + ibooker.book1D(histname + CategoryName, histname + CategoryName, 100, -1.1, 1.1); + DistanceOfClosestApproachToBSdz->setAxisTitle("Track d_{z} wrt beam spot (cm)", 1); + DistanceOfClosestApproachToBSdz->setAxisTitle("Number of Tracks", 2); + + histname = "DistanceOfClosestApproachToBSVsEta_"; + DistanceOfClosestApproachToBSVsEta = ibooker.bookProfile( + histname + CategoryName, histname + CategoryName, EtaBin, EtaMin, EtaMax, DxyBin, DxyMin, DxyMax, ""); + DistanceOfClosestApproachToBSVsEta->getTH1()->SetCanExtend(TH1::kAllAxes); + DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track #eta", 1); + DistanceOfClosestApproachToBSVsEta->setAxisTitle("Track d_{xy} wrt beam spot (cm)", 2); + } histname = "AbsDistanceOfClosestApproachToBS_"; AbsDistanceOfClosestApproachToBS = @@ -1176,7 +1175,7 @@ void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe auto chi2prob = TMath::Prob(track.chi2(), (int)track.ndof()); auto chi2oNDF = track.normalizedChi2(); - std::string Folder = TopFolder_.substr(0,2); + std::string Folder = TopFolder_.substr(0, 2); if (doHitPropertiesPlots_ || doAllPlots_) { // rec hits @@ -1287,8 +1286,8 @@ void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe DistanceOfClosestApproachToBS->Fill(track.dxy(bs.position())); if (Folder == "Tr") { - DistanceOfClosestApproachToBSdz->Fill(track.dz(bs.position())); - DistanceOfClosestApproachToBSVsEta->Fill(track.eta(), track.dxy(bs.position())); + DistanceOfClosestApproachToBSdz->Fill(track.dz(bs.position())); + DistanceOfClosestApproachToBSVsEta->Fill(track.eta(), track.dxy(bs.position())); } AbsDistanceOfClosestApproachToBS->Fill(std::abs(track.dxy(bs.position()))); @@ -1459,8 +1458,8 @@ void TrackAnalyzer::fillHistosForEfficiencyFromHitPatter(const reco::Track& trac void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibooker) { // parameters from the configuration std::string QualName = conf_->getParameter("Quality"); - std::string AlgoName = conf_->getParameter("AlgoName"); - std::string Folder = TopFolder_.substr(0,2); + std::string AlgoName = conf_->getParameter("AlgoName"); + std::string Folder = TopFolder_.substr(0, 2); // use the AlgoName and Quality Name std::string CategoryName = !QualName.empty() ? AlgoName + "_" + QualName : AlgoName; @@ -1611,8 +1610,6 @@ void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibo tkmes.TrackPt->setAxisTitle("Track p_{T} (GeV/c)", 1); tkmes.TrackPt->setAxisTitle("Number of Tracks", 2); - - if (doTrackPxPyPlots_) { histname = "TrackPx_" + histTag; tkmes.TrackPx = ibooker.book1D(histname, histname, TrackPxBin, TrackPxMin, TrackPxMax); @@ -1640,134 +1637,132 @@ void TrackAnalyzer::bookHistosForState(std::string sname, DQMStore::IBooker& ibo tkmes.TrackEta->setAxisTitle("Number of Tracks", 2); if (Folder == "Tr") { + histname = "TrackPtHighPurity_" + histTag; + tkmes.TrackPtHighPurity = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtHighPurity->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtHighPurity->setAxisTitle("Number of High Purity Tracks", 2); + + histname = "TrackPtTight_" + histTag; + tkmes.TrackPtTight = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtTight->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtTight->setAxisTitle("Number of Tight Tracks", 2); + + histname = "TrackPtLoose_" + histTag; + tkmes.TrackPtLoose = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPtLoose->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPtLoose->setAxisTitle("Number of Loose Tracks", 2); + + histname = "Quality_"; + tkmes.Quality = ibooker.book1D(histname + CategoryName, histname + CategoryName, 3, 0., 3.); + tkmes.Quality->setAxisTitle("Track quality", 1); + tkmes.Quality->setAxisTitle("Number of Tracks", 2); + + for (size_t ibin = 0; ibin < 3; ibin++) { + tkmes.Quality->setBinLabel(ibin + 1, reco::TrackBase::qualityNames[ibin]); + } - histname = "TrackPtHighPurity_" + histTag; - tkmes.TrackPtHighPurity = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtHighPurity->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtHighPurity->setAxisTitle("Number of High Purity Tracks", 2); - - histname = "TrackPtTight_" + histTag; - tkmes.TrackPtTight = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtTight->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtTight->setAxisTitle("Number of Tight Tracks", 2); - - histname = "TrackPtLoose_" + histTag; - tkmes.TrackPtLoose = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPtLoose->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPtLoose->setAxisTitle("Number of Loose Tracks", 2); - - histname = "Quality_"; - tkmes.Quality = ibooker.book1D(histname + CategoryName, histname + CategoryName, 3, 0., 3.); - tkmes.Quality->setAxisTitle("Track quality", 1); - tkmes.Quality->setAxisTitle("Number of Tracks", 2); - - for (size_t ibin = 0; ibin < 3; ibin++) { - tkmes.Quality->setBinLabel(ibin + 1, reco::TrackBase::qualityNames[ibin]); - } - - histname = "TrackPt_NegEta_Phi_btw_neg16_neg32_" + histTag; - tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPt_NegEta_Phi_btw_0_neg16_" + histTag; - tkmes.TrackPt_NegEta_Phi_btw_0_neg16 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPt_NegEta_Phi_btw_0_neg16->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPt_NegEta_Phi_btw_0_neg16->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPt_NegEta_Phi_btw_16_0_" + histTag; - tkmes.TrackPt_NegEta_Phi_btw_16_0 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPt_NegEta_Phi_btw_16_0->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPt_NegEta_Phi_btw_16_0->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPt_NegEta_Phi_btw_32_16_" + histTag; - tkmes.TrackPt_NegEta_Phi_btw_32_16 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPt_NegEta_Phi_btw_32_16->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPt_NegEta_Phi_btw_32_16->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPt_PosEta_Phi_btw_neg16_neg32_" + histTag; - tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPt_PosEta_Phi_btw_0_neg16_" + histTag; - tkmes.TrackPt_PosEta_Phi_btw_0_neg16 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPt_PosEta_Phi_btw_0_neg16->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPt_PosEta_Phi_btw_0_neg16->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPt_PosEta_Phi_btw_16_0_" + histTag; - tkmes.TrackPt_PosEta_Phi_btw_16_0 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPt_PosEta_Phi_btw_16_0->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPt_PosEta_Phi_btw_16_0->setAxisTitle("Number of Tracks", 2); - - histname = "TrackPt_PosEta_Phi_btw_32_16_" + histTag; - tkmes.TrackPt_PosEta_Phi_btw_32_16 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.TrackPt_PosEta_Phi_btw_32_16->setAxisTitle("Track p_{T} (GeV/c)", 1); - tkmes.TrackPt_PosEta_Phi_btw_32_16->setAxisTitle("Number of Tracks", 2); - - histname = "Ratio_byFolding_" + histTag; - tkmes.Ratio_byFolding = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.Ratio_byFolding->setAxisTitle("Track p_{T} (GeV/c)", 1); - - histname = "Ratio_byFolding2_" + histTag; - tkmes.Ratio_byFolding2 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); - tkmes.Ratio_byFolding2->setAxisTitle("Track p_{T} (GeV/c)", 1); - - histname = "TrackEtaHighpurity_" + histTag; - tkmes.TrackEtaHighPurity = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); - tkmes.TrackEtaHighPurity->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaHighPurity->setAxisTitle("Number of High Purity Tracks", 2); - - histname = "TrackEtaTight_" + histTag; - tkmes.TrackEtaTight = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); - tkmes.TrackEtaTight->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaTight->setAxisTitle("Number of Tight Tracks", 2); - - histname = "TrackEtaLoose_" + histTag; - tkmes.TrackEtaLoose = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); - tkmes.TrackEtaLoose->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaLoose->setAxisTitle("Number of Loose Tracks", 2); - - histname = "TrackEtaPhiInverted_" + histTag; - tkmes.TrackEtaPhiInverted = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TrackEtaPhiInverted->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaPhiInverted->setAxisTitle("Track #phi", 2); - - histname = "TrackEtaPhiInvertedoutofphase_" + histTag; - tkmes.TrackEtaPhiInvertedoutofphase = - ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TrackEtaPhiInvertedoutofphase->setAxisTitle("Track #eta", 1); - tkmes.TrackEtaPhiInvertedoutofphase->setAxisTitle("Track #phi", 2); - - histname = "TkEtaPhi_Ratio_byFoldingmap_" + histTag; - tkmes.TkEtaPhi_Ratio_byFoldingmap = - ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #eta", 1); - tkmes.TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #phi", 2); - - histname = "TkEtaPhi_Ratio_byFoldingmap_op_" + histTag; - tkmes.TkEtaPhi_Ratio_byFoldingmap_op = - ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #eta", 1); - tkmes.TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #phi", 2); - - histname = "TkEtaPhi_RelativeDifference_byFoldingmap_" + histTag; - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap = - ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #eta", 1); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #phi", 2); - - histname = "TkEtaPhi_RelativeDifference_byFoldingmap_op_" + histTag; - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op = - ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #eta", 1); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #phi", 2); - - histname = "TrackQoverP_" + histTag; - tkmes.TrackQoverP = ibooker.book1D(histname, histname, 10 * TrackQBin, TrackQMin, TrackQMax); - tkmes.TrackQoverP->setAxisTitle("Track QoverP", 1); - tkmes.TrackQoverP->setAxisTitle("Number of Tracks", 2); - + histname = "TrackPt_NegEta_Phi_btw_neg16_neg32_" + histTag; + tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_NegEta_Phi_btw_0_neg16_" + histTag; + tkmes.TrackPt_NegEta_Phi_btw_0_neg16 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_NegEta_Phi_btw_0_neg16->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_NegEta_Phi_btw_0_neg16->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_NegEta_Phi_btw_16_0_" + histTag; + tkmes.TrackPt_NegEta_Phi_btw_16_0 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_NegEta_Phi_btw_16_0->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_NegEta_Phi_btw_16_0->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_NegEta_Phi_btw_32_16_" + histTag; + tkmes.TrackPt_NegEta_Phi_btw_32_16 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_NegEta_Phi_btw_32_16->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_NegEta_Phi_btw_32_16->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_PosEta_Phi_btw_neg16_neg32_" + histTag; + tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_PosEta_Phi_btw_0_neg16_" + histTag; + tkmes.TrackPt_PosEta_Phi_btw_0_neg16 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_PosEta_Phi_btw_0_neg16->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_PosEta_Phi_btw_0_neg16->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_PosEta_Phi_btw_16_0_" + histTag; + tkmes.TrackPt_PosEta_Phi_btw_16_0 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_PosEta_Phi_btw_16_0->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_PosEta_Phi_btw_16_0->setAxisTitle("Number of Tracks", 2); + + histname = "TrackPt_PosEta_Phi_btw_32_16_" + histTag; + tkmes.TrackPt_PosEta_Phi_btw_32_16 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.TrackPt_PosEta_Phi_btw_32_16->setAxisTitle("Track p_{T} (GeV/c)", 1); + tkmes.TrackPt_PosEta_Phi_btw_32_16->setAxisTitle("Number of Tracks", 2); + + histname = "Ratio_byFolding_" + histTag; + tkmes.Ratio_byFolding = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.Ratio_byFolding->setAxisTitle("Track p_{T} (GeV/c)", 1); + + histname = "Ratio_byFolding2_" + histTag; + tkmes.Ratio_byFolding2 = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax); + tkmes.Ratio_byFolding2->setAxisTitle("Track p_{T} (GeV/c)", 1); + + histname = "TrackEtaHighpurity_" + histTag; + tkmes.TrackEtaHighPurity = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); + tkmes.TrackEtaHighPurity->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaHighPurity->setAxisTitle("Number of High Purity Tracks", 2); + + histname = "TrackEtaTight_" + histTag; + tkmes.TrackEtaTight = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); + tkmes.TrackEtaTight->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaTight->setAxisTitle("Number of Tight Tracks", 2); + + histname = "TrackEtaLoose_" + histTag; + tkmes.TrackEtaLoose = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax); + tkmes.TrackEtaLoose->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaLoose->setAxisTitle("Number of Loose Tracks", 2); + + histname = "TrackEtaPhiInverted_" + histTag; + tkmes.TrackEtaPhiInverted = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhiInverted->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhiInverted->setAxisTitle("Track #phi", 2); + + histname = "TrackEtaPhiInvertedoutofphase_" + histTag; + tkmes.TrackEtaPhiInvertedoutofphase = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TrackEtaPhiInvertedoutofphase->setAxisTitle("Track #eta", 1); + tkmes.TrackEtaPhiInvertedoutofphase->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_Ratio_byFoldingmap_" + histTag; + tkmes.TkEtaPhi_Ratio_byFoldingmap = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #eta", 1); + tkmes.TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_Ratio_byFoldingmap_op_" + histTag; + tkmes.TkEtaPhi_Ratio_byFoldingmap_op = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #eta", 1); + tkmes.TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_RelativeDifference_byFoldingmap_" + histTag; + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #eta", 1); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #phi", 2); + + histname = "TkEtaPhi_RelativeDifference_byFoldingmap_op_" + histTag; + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op = + ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #eta", 1); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #phi", 2); + + histname = "TrackQoverP_" + histTag; + tkmes.TrackQoverP = ibooker.book1D(histname, histname, 10 * TrackQBin, TrackQMin, TrackQMax); + tkmes.TrackQoverP->setAxisTitle("Track QoverP", 1); + tkmes.TrackQoverP->setAxisTitle("Number of Tracks", 2); } histname = "TrackEtaPhi_" + histTag; @@ -1938,7 +1933,7 @@ void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco double p, px, py, pz, pt, theta, phi, eta, q; double pxerror, pyerror, pzerror, pterror, perror, phierror, etaerror; - std::string Folder = TopFolder_.substr(0,2); + std::string Folder = TopFolder_.substr(0, 2); auto phiIn = track.innerPosition().phi(); auto etaIn = track.innerPosition().eta(); @@ -2020,192 +2015,190 @@ void TrackAnalyzer::fillHistosForState(const edm::EventSetup& iSetup, const reco tkmes.TrackEtaPhi->Fill(eta, phi); if (Folder == "Tr") { - - tkmes.TrackEtaPhiInverted->Fill(eta, -1 * phi); - tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, 3.141592654 + -1*phi); - tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, -1*phi - 3.141592654); - tkmes.TkEtaPhi_Ratio_byFoldingmap->getTH2F()->Divide( - tkmes.TrackEtaPhi->getTH2F(), tkmes.TrackEtaPhiInverted->getTH2F(), 1., 1., ""); - tkmes.TkEtaPhi_Ratio_byFoldingmap_op->getTH2F()->Divide( - tkmes.TrackEtaPhi->getTH2F(), tkmes.TrackEtaPhiInvertedoutofphase->getTH2F(), 1., 1., ""); - - int nx = tkmes.TrackEtaPhi->getTH2F()->GetNbinsX(); - int ny = tkmes.TrackEtaPhi->getTH2F()->GetNbinsY(); - - for (int ii = 1; ii <= nx; ii++) { - for (int jj = 1; jj <= ny; jj++) { - double Sum1 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii, jj) + - tkmes.TrackEtaPhiInverted->getTH2F()->GetBinContent(ii, jj); - double Sum2 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii, jj) + - tkmes.TrackEtaPhiInvertedoutofphase->getTH2F()->GetBinContent(ii, jj); - - double Sub1 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii, jj) - - tkmes.TrackEtaPhiInverted->getTH2F()->GetBinContent(ii, jj); - double Sub2 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii, jj) - - tkmes.TrackEtaPhiInvertedoutofphase->getTH2F()->GetBinContent(ii, jj); - - if (Sum1 == 0 || Sum2 == 0) { - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->getTH2F()->SetBinContent(ii, jj, 1); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->getTH2F()->SetBinContent(ii, jj, 1); - } else { - double ratio1 = Sub1 / Sum1; - double ratio2 = Sub2 / Sum2; - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->getTH2F()->SetBinContent(ii, jj, ratio1); - tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->getTH2F()->SetBinContent(ii, jj, ratio2); + tkmes.TrackEtaPhiInverted->Fill(eta, -1 * phi); + tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, 3.141592654 + -1 * phi); + tkmes.TrackEtaPhiInvertedoutofphase->Fill(eta, -1 * phi - 3.141592654); + tkmes.TkEtaPhi_Ratio_byFoldingmap->getTH2F()->Divide( + tkmes.TrackEtaPhi->getTH2F(), tkmes.TrackEtaPhiInverted->getTH2F(), 1., 1., ""); + tkmes.TkEtaPhi_Ratio_byFoldingmap_op->getTH2F()->Divide( + tkmes.TrackEtaPhi->getTH2F(), tkmes.TrackEtaPhiInvertedoutofphase->getTH2F(), 1., 1., ""); + + int nx = tkmes.TrackEtaPhi->getTH2F()->GetNbinsX(); + int ny = tkmes.TrackEtaPhi->getTH2F()->GetNbinsY(); + + for (int ii = 1; ii <= nx; ii++) { + for (int jj = 1; jj <= ny; jj++) { + double Sum1 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii, jj) + + tkmes.TrackEtaPhiInverted->getTH2F()->GetBinContent(ii, jj); + double Sum2 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii, jj) + + tkmes.TrackEtaPhiInvertedoutofphase->getTH2F()->GetBinContent(ii, jj); + + double Sub1 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii, jj) - + tkmes.TrackEtaPhiInverted->getTH2F()->GetBinContent(ii, jj); + double Sub2 = tkmes.TrackEtaPhi->getTH2F()->GetBinContent(ii, jj) - + tkmes.TrackEtaPhiInvertedoutofphase->getTH2F()->GetBinContent(ii, jj); + + if (Sum1 == 0 || Sum2 == 0) { + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->getTH2F()->SetBinContent(ii, jj, 1); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->getTH2F()->SetBinContent(ii, jj, 1); + } else { + double ratio1 = Sub1 / Sum1; + double ratio2 = Sub2 / Sum2; + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap->getTH2F()->SetBinContent(ii, jj, ratio1); + tkmes.TkEtaPhi_RelativeDifference_byFoldingmap_op->getTH2F()->SetBinContent(ii, jj, ratio2); + } } } - } - //pT histograms to create efficiency vs pT plot, only for the most inefficient region. + //pT histograms to create efficiency vs pT plot, only for the most inefficient region. - if (eta < 0. && phi < -1.6) { - tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->Fill(pt); - } - if (eta < 0. && phi < 0 && phi >= -1.6) { - tkmes.TrackPt_NegEta_Phi_btw_0_neg16->Fill(pt); - } - if (eta < 0. && phi < 1.6 && phi >= 0) { - tkmes.TrackPt_NegEta_Phi_btw_16_0->Fill(pt); - } - if (eta < 0. && phi >= 1.6) { - tkmes.TrackPt_NegEta_Phi_btw_32_16->Fill(pt); - } - if (eta >= 0. && phi < -1.6) { - tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->Fill(pt); - } - if (eta >= 0. && phi < 0 && phi >= -1.6) { - tkmes.TrackPt_PosEta_Phi_btw_0_neg16->Fill(pt); - } - if (eta >= 0. && phi < 1.6 && phi >= 0) { - tkmes.TrackPt_PosEta_Phi_btw_16_0->Fill(pt); - } - if (eta >= 0. && phi >= 1.6) { - tkmes.TrackPt_PosEta_Phi_btw_32_16->Fill(pt); - } - - float A[8]; - A[0] = tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1()->Integral(); - A[1] = tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1()->Integral(); - A[2] = tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1()->Integral(); - A[3] = tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1()->Integral(); - A[4] = tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1()->Integral(); - A[5] = tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1()->Integral(); - A[6] = tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1()->Integral(); - A[7] = tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1()->Integral(); - - //WZ (the worst zone) - int WZ = 0; - float minA = A[0]; - for (int w = 1; w < 8; w++) { - if (minA > A[w]) { - minA = A[w]; - WZ = w; + if (eta < 0. && phi < -1.6) { + tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->Fill(pt); + } + if (eta < 0. && phi < 0 && phi >= -1.6) { + tkmes.TrackPt_NegEta_Phi_btw_0_neg16->Fill(pt); + } + if (eta < 0. && phi < 1.6 && phi >= 0) { + tkmes.TrackPt_NegEta_Phi_btw_16_0->Fill(pt); + } + if (eta < 0. && phi >= 1.6) { + tkmes.TrackPt_NegEta_Phi_btw_32_16->Fill(pt); + } + if (eta >= 0. && phi < -1.6) { + tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->Fill(pt); + } + if (eta >= 0. && phi < 0 && phi >= -1.6) { + tkmes.TrackPt_PosEta_Phi_btw_0_neg16->Fill(pt); + } + if (eta >= 0. && phi < 1.6 && phi >= 0) { + tkmes.TrackPt_PosEta_Phi_btw_16_0->Fill(pt); + } + if (eta >= 0. && phi >= 1.6) { + tkmes.TrackPt_PosEta_Phi_btw_32_16->Fill(pt); } - } - switch (WZ) { - case 1: - tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1(), - tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1(), - 1., - 1., - "B"); - tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1(), - tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1(), - 1., - 1., - "B"); - break; - case 2: - tkmes.Ratio_byFolding->getTH1()->Divide( - tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1(), tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1(), 1., 1., "B"); - tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1(), - tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1(), - 1., - 1., - "B"); - break; - case 3: - tkmes.Ratio_byFolding->getTH1()->Divide( - tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1(), tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1(), 1., 1., "B"); - tkmes.Ratio_byFolding2->getTH1()->Divide( - tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1(), tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1(), 1., 1., "B"); - break; - case 4: - tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1(), - tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1(), - 1., - 1., - "B"); - tkmes.Ratio_byFolding2->getTH1()->Divide( - tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1(), tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1(), 1., 1., "B"); - break; - case 5: - tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1(), - tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1(), - 1., - 1., - "B"); - tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1(), - tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1(), - 1., - 1., - "B"); - break; - case 6: - tkmes.Ratio_byFolding->getTH1()->Divide( - tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1(), tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1(), 1., 1., "B"); - tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1(), - tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1(), - 1., - 1., - "B"); - break; - case 7: - tkmes.Ratio_byFolding->getTH1()->Divide( - tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1(), tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1(), 1., 1., "B"); - tkmes.Ratio_byFolding2->getTH1()->Divide( - tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1(), tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1(), 1., 1., "B"); - break; - case 8: - tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1(), - tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1(), - 1., - 1., - "B"); - tkmes.Ratio_byFolding2->getTH1()->Divide( - tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1(), tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1(), 1., 1., "B"); - break; - } - tkmes.Ratio_byFolding->setAxisTitle("Efficiency(Ratio)_" + std::to_string(WZ), 2); - tkmes.Ratio_byFolding2->setAxisTitle("Efficiency(Ratio)_" + std::to_string(WZ), 2); + float A[8]; + A[0] = tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1()->Integral(); + A[1] = tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1()->Integral(); + A[2] = tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1()->Integral(); + A[3] = tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1()->Integral(); + A[4] = tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1()->Integral(); + A[5] = tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1()->Integral(); + A[6] = tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1()->Integral(); + A[7] = tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1()->Integral(); + + //WZ (the worst zone) + int WZ = 0; + float minA = A[0]; + for (int w = 1; w < 8; w++) { + if (minA > A[w]) { + minA = A[w]; + WZ = w; + } + } - if (track.quality(reco::TrackBase::highPurity)) { - tkmes.TrackPtHighPurity->Fill(pt); - tkmes.Quality->Fill(reco::TrackBase::highPurity, 1.); - } - if (track.quality(reco::TrackBase::tight)) { - tkmes.TrackPtTight->Fill(pt); - tkmes.Quality->Fill(reco::TrackBase::tight, 1.); - } - if (track.quality(reco::TrackBase::loose)) { - tkmes.TrackPtLoose->Fill(pt); - tkmes.Quality->Fill(reco::TrackBase::loose, 1.); - } - if (track.quality(reco::TrackBase::highPurity)) { - tkmes.TrackEtaHighPurity->Fill(eta); - } - if (track.quality(reco::TrackBase::tight)) { - tkmes.TrackEtaTight->Fill(eta); - } - if (track.quality(reco::TrackBase::loose)) { - tkmes.TrackEtaLoose->Fill(eta); - } + switch (WZ) { + case 1: + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1(), + tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1(), + 1., + 1., + "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1(), + tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1(), + 1., + 1., + "B"); + break; + case 2: + tkmes.Ratio_byFolding->getTH1()->Divide( + tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1(), tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1(), + tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1(), + 1., + 1., + "B"); + break; + case 3: + tkmes.Ratio_byFolding->getTH1()->Divide( + tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1(), tkmes.TrackPt_NegEta_Phi_btw_0_neg16->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide( + tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1(), tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1(), 1., 1., "B"); + break; + case 4: + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1(), + tkmes.TrackPt_NegEta_Phi_btw_neg16_neg32->getTH1(), + 1., + 1., + "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide( + tkmes.TrackPt_NegEta_Phi_btw_32_16->getTH1(), tkmes.TrackPt_NegEta_Phi_btw_16_0->getTH1(), 1., 1., "B"); + break; + case 5: + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1(), + tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1(), + 1., + 1., + "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1(), + tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1(), + 1., + 1., + "B"); + break; + case 6: + tkmes.Ratio_byFolding->getTH1()->Divide( + tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1(), tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide(tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1(), + tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1(), + 1., + 1., + "B"); + break; + case 7: + tkmes.Ratio_byFolding->getTH1()->Divide( + tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1(), tkmes.TrackPt_PosEta_Phi_btw_0_neg16->getTH1(), 1., 1., "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide( + tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1(), tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1(), 1., 1., "B"); + break; + case 8: + tkmes.Ratio_byFolding->getTH1()->Divide(tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1(), + tkmes.TrackPt_PosEta_Phi_btw_neg16_neg32->getTH1(), + 1., + 1., + "B"); + tkmes.Ratio_byFolding2->getTH1()->Divide( + tkmes.TrackPt_PosEta_Phi_btw_32_16->getTH1(), tkmes.TrackPt_PosEta_Phi_btw_16_0->getTH1(), 1., 1., "B"); + break; + } + tkmes.Ratio_byFolding->setAxisTitle("Efficiency(Ratio)_" + std::to_string(WZ), 2); + tkmes.Ratio_byFolding2->setAxisTitle("Efficiency(Ratio)_" + std::to_string(WZ), 2); - if (p > 0.) { - tkmes.TrackQoverP->Fill(q / p); - } + if (track.quality(reco::TrackBase::highPurity)) { + tkmes.TrackPtHighPurity->Fill(pt); + tkmes.Quality->Fill(reco::TrackBase::highPurity, 1.); + } + if (track.quality(reco::TrackBase::tight)) { + tkmes.TrackPtTight->Fill(pt); + tkmes.Quality->Fill(reco::TrackBase::tight, 1.); + } + if (track.quality(reco::TrackBase::loose)) { + tkmes.TrackPtLoose->Fill(pt); + tkmes.Quality->Fill(reco::TrackBase::loose, 1.); + } + if (track.quality(reco::TrackBase::highPurity)) { + tkmes.TrackEtaHighPurity->Fill(eta); + } + if (track.quality(reco::TrackBase::tight)) { + tkmes.TrackEtaTight->Fill(eta); + } + if (track.quality(reco::TrackBase::loose)) { + tkmes.TrackEtaLoose->Fill(eta); + } + if (p > 0.) { + tkmes.TrackQoverP->Fill(q / p); + } } tkmes.TrackEtaPhiInner->Fill(etaIn, phiIn); diff --git a/DQM/TrackingMonitor/src/TrackingMonitor.cc b/DQM/TrackingMonitor/src/TrackingMonitor.cc index bd0cea4d384ae..d582cc707679d 100644 --- a/DQM/TrackingMonitor/src/TrackingMonitor.cc +++ b/DQM/TrackingMonitor/src/TrackingMonitor.cc @@ -230,7 +230,7 @@ void TrackingMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& std::string Quality = conf->getParameter("Quality"); std::string AlgoName = conf->getParameter("AlgoName"); MEFolderName = conf->getParameter("FolderName"); - std::string Folder = MEFolderName.substr(0,2); + std::string Folder = MEFolderName.substr(0, 2); // test for the Quality veriable validity if (!Quality_.empty()) { @@ -290,25 +290,24 @@ void TrackingMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& NumberOfTracks->setAxisTitle("Number of Events", 2); if (Folder == "Tr") { - - histname = "NumberOfTracks_PUvtx_" + CategoryName; - NumberOfTracks_PUvtx = ibooker.book1D(histname, histname, 3 * TKNoBin, TKNoMin, (TKNoMax + 0.5) * 3. - 0.5); - NumberOfTracks_PUvtx->setAxisTitle("Number of Tracks per Event (matched a PU vertex)", 1); - NumberOfTracks_PUvtx->setAxisTitle("Number of Events", 2); - - histname = "NumberofTracks_Hardvtx_" + CategoryName; - NumberofTracks_Hardvtx = ibooker.book1D(histname, histname, TKNoBin / 10, TKNoMin, (TKNoMax / 10 + 0.5) * 3. - 0.5); - NumberofTracks_Hardvtx->setAxisTitle("Number of Tracks per Event (matched main vertex)", 1); - NumberofTracks_Hardvtx->setAxisTitle("Number of Events", 2); - - histname = "NumberofTracks_Hardvtx_PUvtx_" + CategoryName; - NumberofTracks_Hardvtx_PUvtx = ibooker.book1D(histname, histname, 2, 0., 2.); - NumberofTracks_Hardvtx_PUvtx->setAxisTitle("Number of Tracks per PU/Hard vertex", 1); - NumberofTracks_Hardvtx_PUvtx->setAxisTitle("Number of Tracks", 2); - NumberofTracks_Hardvtx_PUvtx->setBinLabel(1, "PU_Vertex"); - NumberofTracks_Hardvtx_PUvtx->setBinLabel(2, "Hard_Vertex"); - - } + histname = "NumberOfTracks_PUvtx_" + CategoryName; + NumberOfTracks_PUvtx = ibooker.book1D(histname, histname, 3 * TKNoBin, TKNoMin, (TKNoMax + 0.5) * 3. - 0.5); + NumberOfTracks_PUvtx->setAxisTitle("Number of Tracks per Event (matched a PU vertex)", 1); + NumberOfTracks_PUvtx->setAxisTitle("Number of Events", 2); + + histname = "NumberofTracks_Hardvtx_" + CategoryName; + NumberofTracks_Hardvtx = + ibooker.book1D(histname, histname, TKNoBin / 10, TKNoMin, (TKNoMax / 10 + 0.5) * 3. - 0.5); + NumberofTracks_Hardvtx->setAxisTitle("Number of Tracks per Event (matched main vertex)", 1); + NumberofTracks_Hardvtx->setAxisTitle("Number of Events", 2); + + histname = "NumberofTracks_Hardvtx_PUvtx_" + CategoryName; + NumberofTracks_Hardvtx_PUvtx = ibooker.book1D(histname, histname, 2, 0., 2.); + NumberofTracks_Hardvtx_PUvtx->setAxisTitle("Number of Tracks per PU/Hard vertex", 1); + NumberofTracks_Hardvtx_PUvtx->setAxisTitle("Number of Tracks", 2); + NumberofTracks_Hardvtx_PUvtx->setBinLabel(1, "PU_Vertex"); + NumberofTracks_Hardvtx_PUvtx->setBinLabel(2, "Hard_Vertex"); + } histname = "NumberOfMeanRecHitsPerTrack_" + CategoryName; NumberOfMeanRecHitsPerTrack = ibooker.book1D(histname, histname, MeanHitBin, MeanHitMin, MeanHitMax); @@ -752,7 +751,7 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i return; auto const* conf = edm::pset::Registry::instance()->getMapped(confID_); MEFolderName = conf->getParameter("FolderName"); - std::string Folder = MEFolderName.substr(0,2); + std::string Folder = MEFolderName.substr(0, 2); float lumi = -1.; edm::Handle lumiScalers; iEvent.getByToken(lumiscalersToken_, lumiScalers); @@ -846,10 +845,10 @@ void TrackingMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& i NumberOfTracks->Fill(double(numberOfTracks)); if (Folder == "Tr") { - NumberofTracks_Hardvtx->Fill(double(numberOfTracks_pv0)); - NumberOfTracks_PUvtx->Fill(double(numberOfTracks - numberOfTracks_pv0)); - NumberofTracks_Hardvtx_PUvtx->Fill(0.5, double(numberOfTracks_pv0)); - NumberofTracks_Hardvtx_PUvtx->Fill(1.5, double(numberOfTracks - numberOfTracks_pv0)); + NumberofTracks_Hardvtx->Fill(double(numberOfTracks_pv0)); + NumberOfTracks_PUvtx->Fill(double(numberOfTracks - numberOfTracks_pv0)); + NumberofTracks_Hardvtx_PUvtx->Fill(0.5, double(numberOfTracks_pv0)); + NumberofTracks_Hardvtx_PUvtx->Fill(1.5, double(numberOfTracks - numberOfTracks_pv0)); } if (doPlotsVsBX_ || doAllPlots)