Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef RecoLocalMuon_CSCSegmentReader_H
0002 #define RecoLocalMuon_CSCSegmentReader_H
0003 
0004 /** \class CSCSegmentReader
0005  *  Basic analyzer class which accesses CSCSegment
0006  *  and plot efficiency of the builder
0007  *  [This hasn't been used in many years but I am loath to delete code.]
0008  */
0009 
0010 #include <FWCore/Framework/interface/Event.h>
0011 #include <FWCore/Framework/interface/EventSetup.h>
0012 #include <FWCore/Framework/interface/one/EDAnalyzer.h>
0013 #include <FWCore/Framework/interface/ESHandle.h>
0014 #include <FWCore/Framework/interface/Frameworkfwd.h>
0015 #include <DataFormats/Common/interface/Handle.h>
0016 #include <FWCore/MessageLogger/interface/MessageLogger.h>
0017 
0018 #include <SimDataFormats/Track/interface/SimTrackContainer.h>
0019 #include <SimDataFormats/TrackingHit/interface/PSimHitContainer.h>
0020 #include <DataFormats/CSCRecHit/interface/CSCSegmentCollection.h>
0021 
0022 #include <Geometry/CSCGeometry/interface/CSCGeometry.h>
0023 #include <Geometry/Records/interface/MuonGeometryRecord.h>
0024 
0025 #include <vector>
0026 #include <map>
0027 #include <string>
0028 
0029 #include "TFile.h"
0030 #include "TH1F.h"
0031 
0032 class CSCSegmentReader : public edm::one::EDAnalyzer<> {
0033 public:
0034   /// Constructor
0035   CSCSegmentReader(const edm::ParameterSet& pset);
0036 
0037   /// Destructor
0038   virtual ~CSCSegmentReader();
0039 
0040   // Operations
0041 
0042   /// Perform the real analysis
0043   void analyze(const edm::Event& event, const edm::EventSetup& eventSetup);
0044 
0045   /// Phi and theta resolution of the built segments
0046   void resolution(const edm::Handle<edm::PSimHitContainer> sH,
0047                   const edm::Handle<CSCRecHit2DCollection> rH,
0048                   const edm::Handle<CSCSegmentCollection> seg,
0049                   const CSCGeometry* geom);
0050 
0051   /// Simulation info
0052   void simInfo(const edm::Handle<edm::SimTrackContainer> simTracks);
0053 
0054   /// Segment building info
0055   void recInfo(const edm::Handle<edm::PSimHitContainer> sH,
0056                const edm::Handle<CSCRecHit2DCollection> rH,
0057                const edm::Handle<CSCSegmentCollection> seg,
0058                const CSCGeometry* geom);
0059 
0060   /// Find best rec segment for set of muon sim hits
0061   int bestMatch(CSCDetId id0,
0062                 const edm::Handle<edm::PSimHitContainer> simHits,
0063                 const edm::Handle<CSCSegmentCollection> cscSegments,
0064                 const CSCGeometry* geom);
0065 
0066 protected:
0067 private:
0068   std::string filename;
0069   TH1F *heff0, *heff1, *heff2, *heff3, *hchi2, *hpt, *heta, *hx, *hy;
0070   TH1I *hrechit, *hsegment;
0071   TH1F *hphiDir[9], *hthetaDir[9];
0072   TH1F *hdxOri[9], *hdyOri[9];
0073 
0074   edm::ESGetToken<CSCGeometry, MuonGeometryRecord> geomToken_;
0075   edm::EDGetTokenT<edm::SimTrackContainer> simTracksToken_;
0076   edm::EDGetTokenT<edm::PSimHitContainer> simHitsToken_;
0077   edm::EDGetTokenT<CSCRecHit2DCollection> recHitsToken_;
0078   edm::EDGetTokenT<CSCSegmentCollection> cscSegmentsToken_;
0079 
0080   TFile* file;
0081   std::map<std::string, int> segMap1;
0082   std::map<std::string, int> segMap2;
0083   std::map<std::string, int> segMap3;
0084   std::map<std::string, int> chaMap1;
0085   std::map<std::string, int> chaMap2;
0086   std::map<std::string, int> chaMap3;
0087   int minLayerWithRechitChamber;
0088   int minRechitSegment;
0089   int minLayerWithSimhitChamber;
0090   double maxPhi, maxTheta;
0091   int simhit;
0092   int maxNhits;
0093   int minNhits;
0094   //    int n6hitSegmentMC[9];
0095   //    int n6hitSegmentReco[9];
0096   int near_segment;
0097 };
0098 
0099 #endif