File indexing completed on 2024-09-07 04:34:56
0001 #ifndef CalibMuon_DTCalibration_DTResidualCalibration_h
0002 #define CalibMuon_DTCalibration_DTResidualCalibration_h
0003
0004
0005
0006
0007
0008
0009 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "FWCore/Framework/interface/Frameworkfwd.h"
0012 #include "FWCore/Utilities/interface/InputTag.h"
0013 #include "FWCore/Framework/interface/ESHandle.h"
0014
0015 #include "CalibMuon/DTCalibration/interface/DTSegmentSelector.h"
0016 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0017 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
0018
0019 #include <string>
0020 #include <vector>
0021 #include <map>
0022
0023 class TFile;
0024 class TH1F;
0025 class TH2F;
0026 class DTGeometry;
0027 class DTSuperLayerId;
0028 class DTLayerId;
0029
0030 class DTResidualCalibration : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0031 public:
0032
0033 DTResidualCalibration(const edm::ParameterSet& pset);
0034
0035 ~DTResidualCalibration() override;
0036
0037 void beginJob() override;
0038 void beginRun(const edm::Run&, const edm::EventSetup&) override;
0039 void endJob() override;
0040 void endRun(const edm::Run&, const edm::EventSetup&) override {}
0041 void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
0042
0043 protected:
0044 private:
0045 unsigned int nevent;
0046 unsigned int segmok, segmbad;
0047
0048 float segmentToWireDistance(const DTRecHit1D& recHit1D, const DTRecSegment4D& segment);
0049
0050 void bookHistos(DTSuperLayerId slId);
0051 void bookHistos(DTLayerId slId);
0052
0053 void fillHistos(DTSuperLayerId slId, float distance, float residualOnDistance);
0054 void fillHistos(DTLayerId slId, float distance, float residualOnDistance);
0055
0056 DTSegmentSelector* select_;
0057 const double histRange_;
0058 const edm::EDGetTokenT<DTRecSegment4DCollection> segment4DToken_;
0059 const std::string rootBaseDir_;
0060
0061 const bool detailedAnalysis_;
0062 TFile* rootFile_;
0063
0064 const DTGeometry* dtGeom_;
0065 const edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomToken_;
0066
0067
0068 std::map<DTSuperLayerId, TH1F*> histoMapTH1F_;
0069 std::map<DTSuperLayerId, TH2F*> histoMapTH2F_;
0070
0071 std::map<DTLayerId, TH1F*> histoMapPerLayerTH1F_;
0072 std::map<DTLayerId, TH2F*> histoMapPerLayerTH2F_;
0073 };
0074 #endif