Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:05

0001 #ifndef TrackingMonitor_H
0002 #define TrackingMonitor_H
0003 // -*- C++ -*-
0004 //
0005 // Package:    TrackingMonitor
0006 // Class:      TrackingMonitor
0007 //
0008 /**\class TrackingMonitor TrackingMonitor.cc DQM/TrackerMonitorTrack/src/TrackingMonitor.cc
0009 Monitoring source for general quantities related to tracks.
0010 */
0011 // Original Author:  Suchandra Dutta, Giorgia Mila
0012 //         Created:  Thu 28 22:45:30 CEST 2008
0013 
0014 #include <memory>
0015 #include <fstream>
0016 #include <vector>
0017 
0018 #include "FWCore/Utilities/interface/EDGetToken.h"
0019 #include "FWCore/Utilities/interface/ESGetToken.h"
0020 #include "FWCore/Framework/interface/Frameworkfwd.h"
0021 #include "FWCore/Framework/interface/Event.h"
0022 #include "FWCore/Framework/interface/MakerMacros.h"
0023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0024 #include "FWCore/ServiceRegistry/interface/Service.h"
0025 #include "DQMServices/Core/interface/DQMStore.h"
0026 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0027 
0028 #include "DataFormats/Candidate/interface/CandidateFwd.h"
0029 
0030 #include "DataFormats/VertexReco/interface/Vertex.h"
0031 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0032 
0033 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
0034 #include "DataFormats/TrackCandidate/interface/TrackCandidate.h"
0035 
0036 #include "DataFormats/TrackReco/interface/SeedStopInfo.h"
0037 
0038 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
0039 
0040 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
0041 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
0042 
0043 #include "DataFormats/Scalers/interface/LumiScalers.h"
0044 #include "DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h"
0045 
0046 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
0047 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionsSeedingLayerSets.h"
0048 
0049 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
0050 
0051 #include "MagneticField/Engine/interface/MagneticField.h"
0052 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0053 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
0054 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0055 
0056 class TrackAnalyzer;
0057 class TrackBuildingAnalyzer;
0058 class VertexMonitor;
0059 class GetLumi;
0060 class TProfile;
0061 class GenericTriggerEventFlag;
0062 
0063 class TrackingMonitor : public DQMEDAnalyzer {
0064 public:
0065   using MVACollection = std::vector<float>;
0066   using QualityMaskCollection = std::vector<unsigned char>;
0067 
0068   explicit TrackingMonitor(const edm::ParameterSet&);
0069   ~TrackingMonitor() override;
0070 
0071   virtual void setMaxMinBin(
0072       std::vector<double>&, std::vector<double>&, std::vector<int>&, double, double, int, double, double, int);
0073   virtual void setNclus(const edm::Event&, std::vector<int>&);
0074 
0075   void analyze(const edm::Event&, const edm::EventSetup&) override;
0076   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0077 
0078 private:
0079   void doProfileX(TH2* th2, MonitorElement* me);
0080   void doProfileX(MonitorElement* th2m, MonitorElement* me);
0081 
0082   // ----------member data ---------------------------
0083 
0084   std::string MEFolderName;
0085   std::string histname;  //for naming the histograms according to algorithm used
0086 
0087   //        DQMStore * dqmStore_;
0088 
0089   edm::ParameterSetID confID_;
0090 
0091   // the track analyzer
0092   edm::InputTag bsSrc_;
0093   edm::InputTag pvSrc_;
0094   edm::EDGetTokenT<reco::BeamSpot> bsSrcToken_;
0095   edm::EDGetTokenT<reco::VertexCollection> pvSrcToken_;
0096 
0097   edm::EDGetTokenT<edm::View<reco::Track>> allTrackToken_;
0098   edm::EDGetTokenT<edm::View<reco::Track>> trackToken_;
0099   edm::EDGetTokenT<TrackCandidateCollection> trackCandidateToken_;
0100   edm::EDGetTokenT<edm::View<TrajectorySeed>> seedToken_;
0101   edm::EDGetTokenT<std::vector<SeedStopInfo>> seedStopInfoToken_;
0102   edm::EDGetTokenT<std::vector<std::unique_ptr<TrackingRegion>>> regionToken_;
0103   edm::EDGetTokenT<TrackingRegionsSeedingLayerSets> regionLayerSetsToken_;
0104   edm::EDGetTokenT<reco::CandidateView> regionCandidateToken_;
0105 
0106   edm::EDGetTokenT<LumiScalersCollection> lumiscalersToken_;
0107   edm::EDGetTokenT<OnlineLuminosityRecord> metaDataToken_;
0108 
0109   edm::InputTag stripClusterInputTag_;
0110   edm::InputTag pixelClusterInputTag_;
0111   edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster>> stripClustersToken_;
0112   edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster>> pixelClustersToken_;
0113 
0114   std::vector<std::tuple<edm::EDGetTokenT<MVACollection>, edm::EDGetTokenT<QualityMaskCollection>>> mvaQualityTokens_;
0115   edm::EDGetTokenT<edm::View<reco::Track>> mvaTrackToken_;
0116 
0117   edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magneticFieldToken_;
0118   edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> transientTrackingRecHitBuilderToken_;
0119 
0120   std::string Quality_;
0121   std::string AlgoName_;
0122 
0123   tadqm::TrackAnalyzer* theTrackAnalyzer;
0124   TrackBuildingAnalyzer* theTrackBuildingAnalyzer;
0125   std::vector<VertexMonitor*> theVertexMonitor;
0126   GetLumi* theLumiDetails_;
0127 
0128   // Tracks
0129   MonitorElement* NumberOfTracks;
0130   MonitorElement* NumberOfTracks_PUvtx;
0131   MonitorElement* NumberofTracks_Hardvtx;
0132   MonitorElement* NumberofTracks_Hardvtx_PUvtx;
0133   MonitorElement* NumberOfMeanRecHitsPerTrack;
0134   MonitorElement* NumberOfMeanLayersPerTrack;
0135 
0136   // Good Tracks
0137   MonitorElement* FractionOfGoodTracks;
0138 
0139   // Tracking regions
0140   MonitorElement* NumberOfTrackingRegions;
0141 
0142   // Track Seeds
0143   MonitorElement* NumberOfSeeds;
0144   MonitorElement* NumberOfSeeds_lumiFlag;
0145   std::vector<MonitorElement*> SeedsVsClusters;
0146   std::vector<std::string> ClusterLabels;
0147 
0148   // Track Candidates
0149   MonitorElement* NumberOfTrackCandidates;
0150   MonitorElement* FractionCandidatesOverSeeds;
0151 
0152   // Cluster Properties
0153   std::vector<MonitorElement*> NumberOfTrkVsClusters;
0154   MonitorElement* NumberOfTrkVsClus;
0155   MonitorElement* NumberOfTrkVsStripClus;
0156   MonitorElement* NumberOfTrkVsPixelClus;
0157 
0158   // Monitoring vs LS
0159   MonitorElement* NumberEventsOfVsLS;
0160   MonitorElement* NumberOfTracksVsLS;
0161   MonitorElement* GoodTracksFractionVsLS;
0162   MonitorElement* NumberOfRecHitsPerTrackVsLS;
0163   MonitorElement* NumberOfGoodPVtxVsLS;
0164   MonitorElement* NumberOfGoodPVtxWO0VsLS;
0165 
0166   // Monitoring vs BX
0167   MonitorElement* NumberEventsOfVsBX;
0168   MonitorElement* NumberOfTracksVsBX;
0169   MonitorElement* GoodTracksFractionVsBX;
0170   MonitorElement* NumberOfRecHitsPerTrackVsBX;
0171   MonitorElement* NumberOfGoodPVtxVsBX;
0172   MonitorElement* NumberOfGoodPVtxWO0VsBX;
0173 
0174   MonitorElement* NumberOfTracksVsBXlumi;
0175 
0176   // Monitoring PU
0177   MonitorElement* NumberOfTracksVsGoodPVtx;
0178   MonitorElement* NumberOfTracksVsPUPVtx;
0179   MonitorElement* NumberEventsOfVsGoodPVtx;
0180   MonitorElement* GoodTracksFractionVsGoodPVtx;
0181   MonitorElement* NumberOfRecHitsPerTrackVsGoodPVtx;
0182   MonitorElement* NumberOfPVtxVsGoodPVtx;
0183   MonitorElement* NumberOfPixelClustersVsGoodPVtx;
0184   MonitorElement* NumberOfStripClustersVsGoodPVtx;
0185 
0186   // Monitoring vs lumi
0187   MonitorElement* NumberEventsOfVsLUMI;
0188   MonitorElement* NumberOfTracksVsLUMI;
0189   MonitorElement* GoodTracksFractionVsLUMI;
0190   MonitorElement* NumberOfRecHitsPerTrackVsLUMI;
0191   MonitorElement* NumberOfGoodPVtxVsLUMI;
0192   MonitorElement* NumberOfGoodPVtxWO0VsLUMI;
0193   MonitorElement* NumberOfPixelClustersVsLUMI;
0194   MonitorElement* NumberOfStripClustersVsLUMI;
0195 
0196   // add in order to deal with LS transitions
0197   MonitorElement* NumberOfTracks_lumiFlag;
0198 
0199   std::string builderName;
0200 
0201   bool doTrackerSpecific_;
0202   bool doLumiAnalysis;
0203   bool doProfilesVsLS_;
0204   bool doAllSeedPlots;
0205   bool doAllPlots;
0206   bool doDCAPlots_;
0207   bool doGeneralPropertiesPlots_;
0208   bool doHitPropertiesPlots_;
0209   bool doTkCandPlots;
0210   bool doMVAPlots;
0211   bool doRegionPlots;
0212   bool doRegionCandidatePlots;
0213   bool doSeedNumberPlot;
0214   bool doSeedLumiAnalysis_;
0215   bool doSeedVsClusterPlot;
0216   bool runTrackBuildingAnalyzerForSeed;
0217   // ADD by Mia in order to have GoodTrack plots only for collision
0218   bool doPUmonitoring_;
0219   bool doPlotsVsBXlumi_;
0220   bool doPlotsVsGoodPVtx_;
0221   bool doPlotsVsLUMI_;
0222   bool doPlotsVsBX_;
0223   bool doFractionPlot_;
0224 
0225   GenericTriggerEventFlag* genTriggerEventFlag_;
0226 
0227   StringCutObjectSelector<reco::Track, true> numSelection_;
0228   StringCutObjectSelector<reco::Track, true> denSelection_;
0229   int pvNDOF_;
0230   const bool forceSCAL_;
0231 };
0232 
0233 #endif  //define TrackingMonitor_H