Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-21 22:39:40

0001 
0002 #ifndef DTCalibValidationFromMuons_H
0003 #define DTCalibValidationFromMuons_H
0004 
0005 /** \class DTCalibValidationFromMuons
0006  *  Analysis on DT residuals to validate the kFactor
0007  *
0008  *
0009  *  \author G. Mila - INFN Torino
0010  */
0011 
0012 #include "FWCore/Framework/interface/Frameworkfwd.h"
0013 #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "FWCore/Framework/interface/EDAnalyzer.h"
0016 #include "FWCore/Framework/interface/LuminosityBlock.h"
0017 
0018 #include "DQMServices/Core/interface/DQMStore.h"
0019 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0020 
0021 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0022 #include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
0023 #include "DataFormats/DTRecHit/interface/DTRecSegment2DCollection.h"
0024 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
0025 
0026 #include "DataFormats/MuonReco/interface/Muon.h"
0027 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0028 #include "RecoMuon/TrackingTools/interface/MuonSegmentMatcher.h"
0029 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0030 
0031 #include "FWCore/Framework/interface/ESHandle.h"
0032 
0033 #include <string>
0034 #include <map>
0035 #include <vector>
0036 
0037 // To remove into CMSSW versions before 20X; removed in CMSSW 10_5_X onwards
0038 // To add into CMSSW versions before 20X
0039 //class DaqMonitorBEInterface;
0040 
0041 class DTGeometry;
0042 class DTChamber;
0043 
0044 // FR class DTCalibValidationFromMuons: public edm::EDAnalyzer{
0045 class DTCalibValidationFromMuons : public DQMEDAnalyzer {
0046 public:
0047   /// Constructor
0048   DTCalibValidationFromMuons(const edm::ParameterSet& pset);
0049 
0050   /// Destructor
0051   ~DTCalibValidationFromMuons() override;
0052 
0053   /// BeginRun
0054   void dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) override;
0055 
0056   // Operations
0057   void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
0058 
0059 protected:
0060   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0061 
0062 private:
0063   // Switch for verbosity
0064   //bool debug;
0065   edm::ParameterSet parameters;
0066   int wrongSegment;
0067   int rightSegment;
0068   int nevent;
0069   // the geometry
0070   edm::ESGetToken<DTGeometry, MuonGeometryRecord> muonGeomToken_;
0071   const DTGeometry* dtGeom;
0072 
0073   // Label of 4D segments in the event
0074   edm::EDGetTokenT<DTRecSegment4DCollection> segment4DToken_;
0075 
0076   // Label of muons in the event
0077   edm::EDGetTokenT<reco::MuonCollection> muonToken_;
0078 
0079   // Compute the distance from wire (cm) of a hits in a DTRecHit1DPair
0080   float recHitDistFromWire(const DTRecHit1DPair& hitPair, const DTLayer* layer);
0081   // Compute the distance from wire (cm) of a hits in a DTRecHit1D
0082   float recHitDistFromWire(const DTRecHit1D& recHit, const DTLayer* layer);
0083   // Compute the position with respect to the wire (cm) of a hits in a DTRecHit1DPair
0084   float recHitPosition(
0085       const DTRecHit1DPair& hitPair, const DTLayer* layer, const DTChamber* chamber, float segmPos, int sl);
0086   // Compute the position with respect to the wire (cm) of a hits in a DTRecHit1D
0087   float recHitPosition(const DTRecHit1D& recHit, const DTLayer* layer, const DTChamber* chamber, float segmPos, int sl);
0088 
0089   // Does the real job
0090   void compute(const DTGeometry* dtGeom, const DTRecSegment4D& segment);
0091 
0092   // Book a set of histograms for a give chamber
0093   void bookHistos(DTSuperLayerId slId, int step);
0094   // Fill a set of histograms for a give chamber
0095   void fillHistos(DTSuperLayerId slId,
0096                   float distance,
0097                   float residualOnDistance,
0098                   float position,
0099                   float residualOnPosition,
0100                   int step);
0101 
0102   std::map<std::pair<DTSuperLayerId, int>, std::vector<MonitorElement*> > histosPerSL;
0103 };
0104 #endif
0105 
0106 /* Local Variables: */
0107 /* show-trailing-whitespace: t */
0108 /* truncate-lines: t */
0109 /* End: */