Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-01-24 01:11:29

0001 #ifndef MonitorTrackResiduals_H
0002 #define MonitorTrackResiduals_H
0003 
0004 // -*- C++ -*-
0005 //
0006 // Package:    TrackerMonitorTrack
0007 // Class:      MonitorTrackResiduals
0008 //
0009 /**\class MonitorTrackResiduals MonitorTrackResiduals.h
0010 DQM/TrackerMonitorTrack/interface/MonitorTrackResiduals.cc Monitoring source for
0011 track residuals on each detector module
0012 */
0013 // Original Author:  Israel Goitom
0014 //         Created:  Fri May 26 14:12:01 CEST 2006
0015 // Author:  Marcel Schneider
0016 //         Extended to Pixel Residuals.
0017 #include "Alignment/OfflineValidation/interface/TrackerValidationVariables.h"
0018 #include "CalibTracker/SiStripCommon/interface/TkDetMap.h"
0019 #include "DQM/SiStripCommon/interface/TkHistoMap.h"
0020 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0021 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0022 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0023 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0024 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0025 #include "FWCore/Framework/interface/Frameworkfwd.h"
0026 #include "FWCore/Framework/interface/MakerMacros.h"
0027 #include "FWCore/Framework/interface/Run.h"
0028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0029 #include "FWCore/Utilities/interface/ESGetToken.h"
0030 #include "DQMServices/Core/interface/DQMStore.h"
0031 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0032 
0033 #include <fstream>
0034 #include <memory>
0035 
0036 class GenericTriggerEventFlag;
0037 namespace edm {
0038   class Event;
0039 }
0040 
0041 enum TrackerType { TRACKERTYPE_STRIP, TRACKERTYPE_PIXEL };
0042 
0043 template <TrackerType pixel_or_strip>
0044 class MonitorTrackResidualsBase : public DQMEDAnalyzer {
0045 public:
0046   // constructors and EDAnalyzer Methods
0047   explicit MonitorTrackResidualsBase(const edm::ParameterSet &);
0048   ~MonitorTrackResidualsBase() override;
0049   void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override;
0050   void analyze(const edm::Event &, const edm::EventSetup &) override;
0051   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0052 
0053 private:
0054   // Own methods
0055   void createMEs(DQMStore::IBooker &, const edm::EventSetup &);
0056   std::pair<std::string, int32_t> findSubdetAndLayer(uint32_t ModuleID, const TrackerTopology *tTopo);
0057 
0058   struct HistoPair {
0059     HistoPair() {
0060       base = nullptr;
0061       normed = nullptr;
0062     };
0063     MonitorElement *base;
0064     MonitorElement *normed;
0065   };
0066   struct HistoXY {
0067     HistoPair x;
0068     HistoPair y;
0069   };
0070   typedef std::map<std::pair<std::string, int32_t>, HistoXY> HistoSet;
0071 
0072   HistoSet m_SubdetLayerResiduals;
0073   HistoSet m_ModuleResiduals;
0074   std::unique_ptr<TkHistoMap> tkhisto_ResidualsMean;
0075 
0076   edm::ParameterSet conf_;
0077   edm::ParameterSet Parameters;
0078   edm::EDGetTokenT<reco::VertexCollection> offlinePrimaryVerticesToken_;
0079 
0080   edm::ESGetToken<TkDetMap, TrackerTopologyRcd> tkDetMapToken_;
0081   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopologyRunToken_;
0082   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> trackerGeometryToken_;
0083   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopologyEventToken_;
0084 
0085   unsigned long long m_cacheID_;
0086   bool ModOn;
0087   bool applyVertexCut_;
0088 
0089   GenericTriggerEventFlag *genTriggerEventFlag_;
0090   TrackerValidationVariables avalidator_;
0091 };
0092 
0093 // Naming is for legacy reasons.
0094 typedef MonitorTrackResidualsBase<TRACKERTYPE_STRIP> MonitorTrackResiduals;
0095 typedef MonitorTrackResidualsBase<TRACKERTYPE_PIXEL> SiPixelMonitorTrackResiduals;
0096 
0097 #endif