Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef TrackBuildingAnalyzer_H
0002 #define TrackBuildingAnalyzer_H
0003 // -*- C++ -*-
0004 //
0005 //
0006 /**\class TrackBuildingAnalyzer TrackBuildingAnalyzer.cc 
0007 Monitoring source for general quantities related to tracks.
0008 */
0009 // Original Author:  Ryan Kelley
0010 //         Created:  Sat 28 13;30:00 CEST 2009
0011 //
0012 
0013 // system includes
0014 #include <memory>
0015 #include <fstream>
0016 
0017 // user includes
0018 #include "DQMServices/Core/interface/DQMStore.h"
0019 #include "DataFormats/Candidate/interface/CandidateFwd.h"
0020 #include "DataFormats/TrackCandidate/interface/TrackCandidate.h"
0021 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
0022 #include "DataFormats/TrackReco/interface/SeedStopInfo.h"
0023 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
0024 #include "FWCore/Framework/interface/Event.h"
0025 #include "FWCore/Framework/interface/Frameworkfwd.h"
0026 #include "FWCore/Framework/interface/MakerMacros.h"
0027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0028 #include "FWCore/ServiceRegistry/interface/Service.h"
0029 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
0030 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionsSeedingLayerSets.h"
0031 #include "TrackingTools/Records/interface/TransientTrackRecord.h"
0032 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
0033 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
0034 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
0035 
0036 class TrackBuildingAnalyzer {
0037 public:
0038   typedef dqm::legacy::DQMStore DQMStore;
0039   typedef dqm::legacy::MonitorElement MonitorElement;
0040   using MVACollection = std::vector<float>;
0041   using QualityMaskCollection = std::vector<unsigned char>;
0042 
0043   TrackBuildingAnalyzer(const edm::ParameterSet&);
0044   ~TrackBuildingAnalyzer() = default;
0045   void initHisto(DQMStore::IBooker& ibooker, const edm::ParameterSet&);
0046   void analyze(const edm::Event& iEvent,
0047                const edm::EventSetup& iSetup,
0048                const TrajectorySeed& seed,
0049                const SeedStopInfo& stopInfo,
0050                const reco::BeamSpot& bs,
0051                const MagneticField& theMF,
0052                const TransientTrackingRecHitBuilder& theTTRHBuilder);
0053   void analyze(const edm::Event& iEvent,
0054                const edm::EventSetup& iSetup,
0055                const TrackCandidate& candidate,
0056                const reco::BeamSpot& bs,
0057                const MagneticField& theMF,
0058                const TransientTrackingRecHitBuilder& theTTRHBuilder);
0059   void analyze(const edm::View<reco::Track>& trackCollection,
0060                const std::vector<const MVACollection*>& mvaCollections,
0061                const std::vector<const QualityMaskCollection*>& qualityMaskCollections);
0062   void analyze(const reco::CandidateView& regionCandidates);
0063   void analyze(const std::vector<std::unique_ptr<TrackingRegion>>& regions);
0064   void analyze(const TrackingRegionsSeedingLayerSets& regions);
0065 
0066 private:
0067   void fillHistos(const edm::EventSetup& iSetup, const reco::Track& track, std::string sname);
0068   void bookHistos(std::string sname, DQMStore::IBooker& ibooker);
0069 
0070   template <typename T>
0071   void analyzeRegions(const T& regions);
0072 
0073   // ----------member data ---------------------------
0074 
0075   // Regions covered by tracking regions
0076   MonitorElement* TrackingRegionEta = nullptr;
0077   MonitorElement* TrackingRegionPhi = nullptr;
0078   MonitorElement* TrackingRegionPhiVsEta = nullptr;
0079   double etaBinWidth = 0.;
0080   double phiBinWidth = 0.;
0081   // Candidates used for tracking regions
0082   MonitorElement* TrackingRegionCandidatePt = nullptr;
0083   MonitorElement* TrackingRegionCandidateEta = nullptr;
0084   MonitorElement* TrackingRegionCandidatePhi = nullptr;
0085   MonitorElement* TrackingRegionCandidatePhiVsEta = nullptr;
0086 
0087   // Track Seeds
0088   MonitorElement* SeedPt = nullptr;
0089   MonitorElement* SeedEta = nullptr;
0090   MonitorElement* SeedPhi = nullptr;
0091   MonitorElement* SeedPhiVsEta = nullptr;
0092   MonitorElement* SeedTheta = nullptr;
0093   MonitorElement* SeedQ = nullptr;
0094   MonitorElement* SeedDxy = nullptr;
0095   MonitorElement* SeedDz = nullptr;
0096   MonitorElement* NumberOfRecHitsPerSeed = nullptr;
0097   MonitorElement* NumberOfRecHitsPerSeedVsPhiProfile = nullptr;
0098   MonitorElement* NumberOfRecHitsPerSeedVsEtaProfile = nullptr;
0099 
0100   MonitorElement* seedStoppingSource = nullptr;
0101   MonitorElement* seedStoppingSourceVsPhi = nullptr;
0102   MonitorElement* seedStoppingSourceVsEta = nullptr;
0103 
0104   MonitorElement* numberOfTrajCandsPerSeed = nullptr;
0105   MonitorElement* numberOfTrajCandsPerSeedVsPhi = nullptr;
0106   MonitorElement* numberOfTrajCandsPerSeedVsEta = nullptr;
0107 
0108   MonitorElement* seedStoppingSourceVsNumberOfTrajCandsPerSeed = nullptr;
0109 
0110   // Track Candidate
0111   MonitorElement* TrackCandPt = nullptr;
0112   MonitorElement* TrackCandEta = nullptr;
0113   MonitorElement* TrackCandPhi = nullptr;
0114   MonitorElement* TrackCandPhiVsEta = nullptr;
0115   MonitorElement* TrackCandTheta = nullptr;
0116   MonitorElement* TrackCandQ = nullptr;
0117   MonitorElement* TrackCandDxy = nullptr;
0118   MonitorElement* TrackCandDz = nullptr;
0119   MonitorElement* NumberOfRecHitsPerTrackCand = nullptr;
0120   MonitorElement* NumberOfRecHitsPerTrackCandVsPhiProfile = nullptr;
0121   MonitorElement* NumberOfRecHitsPerTrackCandVsEtaProfile = nullptr;
0122 
0123   MonitorElement* stoppingSource = nullptr;
0124   MonitorElement* stoppingSourceVSeta = nullptr;
0125   MonitorElement* stoppingSourceVSphi = nullptr;
0126 
0127   std::vector<MonitorElement*> trackMVAs;
0128   std::vector<MonitorElement*> trackMVAsHP;
0129   std::vector<MonitorElement*> trackMVAsVsPtProfile;
0130   std::vector<MonitorElement*> trackMVAsHPVsPtProfile;
0131   std::vector<MonitorElement*> trackMVAsVsEtaProfile;
0132   std::vector<MonitorElement*> trackMVAsHPVsEtaProfile;
0133 
0134   std::string histname;  //for naming the histograms according to algorithm used
0135 
0136   //to disable some plots
0137   const bool doAllPlots;
0138   const bool doAllSeedPlots;
0139   const bool doTCPlots;
0140   const bool doAllTCPlots;
0141   const bool doPT;
0142   const bool doETA;
0143   const bool doPHI;
0144   const bool doPHIVsETA;
0145   const bool doTheta;
0146   const bool doQ;
0147   const bool doDxy;
0148   const bool doDz;
0149   const bool doNRecHits;
0150   const bool doProfPHI;
0151   const bool doProfETA;
0152   const bool doStopSource;
0153   const bool doMVAPlots;
0154   const bool doRegionPlots;
0155   const bool doRegionCandidatePlots;
0156 };
0157 #endif