Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:07

0001 #ifndef RecoLocalMuon_DTRecHitReader_H
0002 #define RecoLocalMuon_DTRecHitReader_H
0003 
0004 /** \class DTRecHitReader
0005  *  Basic analyzer class which accesses 1D DTRecHits
0006  *  and plot resolution comparing them with muon simhits
0007  *
0008  *  \author G. Cerminara - INFN Torino
0009  */
0010 
0011 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0012 #include "DataFormats/Common/interface/Handle.h"
0013 
0014 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0015 
0016 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0017 
0018 #include "DTRecHitHistograms.h"
0019 
0020 #include <vector>
0021 #include <map>
0022 #include <string>
0023 
0024 namespace edm {
0025   class ParameterSet;
0026   class Event;
0027   class EventSetup;
0028 }  // namespace edm
0029 
0030 class PSimHit;
0031 class TFile;
0032 class DTLayer;
0033 class DTWireId;
0034 
0035 class DTGeometry;
0036 class MuonGeometryRecord;
0037 
0038 class DTRecHitReader : public edm::one::EDAnalyzer<> {
0039 public:
0040   /// Constructor
0041   DTRecHitReader(const edm::ParameterSet& pset);
0042 
0043   /// Destructor
0044   ~DTRecHitReader() override;
0045 
0046   // Operations
0047 
0048   /// Perform the real analysis
0049   void analyze(const edm::Event& event, const edm::EventSetup& eventSetup) override;
0050 
0051 protected:
0052 private:
0053   // Select the mu simhit closest to the rechit
0054   const PSimHit* findBestMuSimHit(const DTLayer* layer,
0055                                   const DTWireId& wireId,
0056                                   const std::vector<const PSimHit*>& simhits,
0057                                   float recHitDistFromWire);
0058 
0059   // Map simhits per wireId
0060   std::map<DTWireId, std::vector<const PSimHit*> > mapSimHitsPerWire(const edm::Handle<edm::PSimHitContainer>& simhits);
0061 
0062   // Compute SimHit distance from wire
0063   double findSimHitDist(const DTLayer* layer, const DTWireId& wireId, const PSimHit* hit);
0064 
0065   // Histograms
0066   H1DRecHit* hRHitPhi;
0067   H1DRecHit* hRHitZ_W0;
0068   H1DRecHit* hRHitZ_W1;
0069   H1DRecHit* hRHitZ_W2;
0070   H1DRecHit* hRHitZ_All;
0071 
0072   // The file which will store the histos
0073   TFile* theFile;
0074   // Switch for debug output
0075   bool debug;
0076   // Root file name
0077   std::string rootFileName;
0078   std::string simHitLabel;
0079   std::string recHitLabel;
0080 
0081   edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomToken_;
0082 };
0083 
0084 #endif