CMS 3D CMS Logo

DTRecHitQuality.h

Go to the documentation of this file.
00001 #ifndef Validation_DTRecHits_H
00002 #define Validation_DTRecHits_H
00003 
00013 #include "FWCore/Framework/interface/EDAnalyzer.h"
00014 
00015 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
00016 
00017 #include "DataFormats/MuonDetId/interface/DTWireId.h"
00018 #include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
00019 #include "DataFormats/DTRecHit/interface/DTRecSegment2DCollection.h"
00020 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
00021 #include "Histograms.h"
00022 
00023 #include <vector>
00024 #include <map>
00025 #include <string>
00026 
00027 namespace edm {
00028   class ParameterSet;
00029   class Event;
00030   class EventSetup;
00031 }
00032 
00033 class PSimHit;
00034 class TFile;
00035 class DTLayer;
00036 class DTWireId;
00037 class DTGeometry;
00038 
00039 class DTRecHitQuality : public edm::EDAnalyzer {
00040 public:
00042   DTRecHitQuality(const edm::ParameterSet& pset);
00043 
00045   virtual ~DTRecHitQuality();
00046 
00047   // Operations
00048 
00050   void analyze(const edm::Event & event, const edm::EventSetup& eventSetup);
00051   // Write the histos to file
00052   void endJob();
00053 
00054 protected:
00055 
00056 private: 
00057 
00058 
00059   // The file which will store the histos
00060   TFile *theFile;
00061   // Switch for debug output
00062   bool debug;
00063   // Root file name
00064   std::string rootFileName;
00065   std::string simHitLabel;
00066   std::string recHitLabel;
00067   std::string segment2DLabel;
00068   std::string segment4DLabel;
00069 
00070   // Switches for analysis at various steps
00071   bool doStep1;
00072   bool doStep2;
00073   bool doStep3;
00074 
00075   // Return a map between DTRecHit1DPair and wireId
00076   std::map<DTWireId, std::vector<DTRecHit1DPair> >
00077     map1DRecHitsPerWire(const DTRecHitCollection* dt1DRecHitPairs);
00078 
00079   // Return a map between DTRecHit1D and wireId
00080   std::map<DTWireId, std::vector<DTRecHit1D> >
00081     map1DRecHitsPerWire(const DTRecSegment2DCollection* segment2Ds);
00082 
00083   // Return a map between DTRecHit1D and wireId
00084   std::map<DTWireId, std::vector<DTRecHit1D> >
00085     map1DRecHitsPerWire(const DTRecSegment4DCollection* segment4Ds);
00086 
00087   // Compute SimHit distance from wire (cm)
00088   float simHitDistFromWire(const DTLayer* layer,
00089                            DTWireId wireId,
00090                            const PSimHit& hit);
00091 
00092   // Compute SimHit impact angle (in direction perp to wire)
00093   float simHitImpactAngle(const DTLayer* layer,
00094                            DTWireId wireId,
00095                            const PSimHit& hit);
00096 
00097   // Compute SimHit distance from FrontEnd
00098   float simHitDistFromFE(const DTLayer* layer,
00099                            DTWireId wireId,
00100                            const PSimHit& hit);
00101 
00102   // Find the RecHit closest to the muon SimHit
00103 //   const DTRecHit1DPair* 
00104 //   findBestRecHit(const DTLayer* layer,
00105 //               DTWireId wireId,
00106 //               const std::vector<DTRecHit1DPair>& recHits,
00107 //               const float simHitDist);
00108   template  <typename type>
00109   const type* 
00110   findBestRecHit(const DTLayer* layer,
00111                                   DTWireId wireId,
00112                                   const std::vector<type>& recHits,
00113                                   const float simHitDist);
00114 
00115 
00116 
00117 
00118   // Compute the distance from wire (cm) of a hits in a DTRecHit1DPair
00119   float recHitDistFromWire(const DTRecHit1DPair& hitPair, const DTLayer* layer);
00120   // Compute the distance from wire (cm) of a hits in a DTRecHit1D
00121   float recHitDistFromWire(const DTRecHit1D& recHit, const DTLayer* layer);
00122 
00123   // Return the error on the measured (cm) coordinate
00124   float recHitPositionError(const DTRecHit1DPair& recHit);
00125   float recHitPositionError(const DTRecHit1D& recHit);
00126 
00127 
00128   // Does the real job
00129   template  <typename type>
00130   void compute(const DTGeometry *dtGeom,
00131                std::map<DTWireId, std::vector<PSimHit> > simHitsPerWire,
00132                std::map<DTWireId, std::vector<type> > recHitsPerWire,
00133                int step);
00134 
00135   HRes1DHit *hRes_S1RPhi;  // RecHits, 1. step, RPh
00136   HRes1DHit *hRes_S2RPhi;     // RecHits, 2. step, RPhi
00137   HRes1DHit *hRes_S3RPhi;     // RecHits, 3. step, RPhi
00138 
00139   HRes1DHit *hRes_S1RZ;         // RecHits, 1. step, RZ
00140   HRes1DHit *hRes_S2RZ;     // RecHits, 2. step, RZ
00141   HRes1DHit *hRes_S3RZ;     // RecHits, 3. step, RZ
00142 
00143   HRes1DHit *hRes_S1RZ_W0;   // RecHits, 1. step, RZ, wheel 0
00144   HRes1DHit *hRes_S2RZ_W0;   // RecHits, 2. step, RZ, wheel 0
00145   HRes1DHit *hRes_S3RZ_W0;   // RecHits, 3. step, RZ, wheel 0
00146 
00147   HRes1DHit *hRes_S1RZ_W1;   // RecHits, 1. step, RZ, wheel +-1
00148   HRes1DHit *hRes_S2RZ_W1;   // RecHits, 2. step, RZ, wheel +-1
00149   HRes1DHit *hRes_S3RZ_W1;   // RecHits, 3. step, RZ, wheel +-1
00150 
00151   HRes1DHit *hRes_S1RZ_W2;   // RecHits, 1. step, RZ, wheel +-2
00152   HRes1DHit *hRes_S2RZ_W2;   // RecHits, 2. step, RZ, wheel +-2
00153   HRes1DHit *hRes_S3RZ_W2;   // RecHits, 3. step, RZ, wheel +-2
00154 
00155 
00156   HEff1DHit *hEff_S1RPhi;     // RecHits, 1. step, RPhi
00157   HEff1DHit *hEff_S2RPhi;     // RecHits, 2. step, RPhi
00158   HEff1DHit *hEff_S3RPhi;     // RecHits, 3. step, RPhi
00159 
00160   HEff1DHit *hEff_S1RZ;         // RecHits, 1. step, RZ
00161   HEff1DHit *hEff_S2RZ;     // RecHits, 2. step, RZ
00162   HEff1DHit *hEff_S3RZ;     // RecHits, 3. step, RZ
00163 
00164   HEff1DHit *hEff_S1RZ_W0;   // RecHits, 1. step, RZ, wheel 0
00165   HEff1DHit *hEff_S2RZ_W0;   // RecHits, 2. step, RZ, wheel 0
00166   HEff1DHit *hEff_S3RZ_W0;   // RecHits, 3. step, RZ, wheel 0
00167 
00168   HEff1DHit *hEff_S1RZ_W1;   // RecHits, 1. step, RZ, wheel +-1
00169   HEff1DHit *hEff_S2RZ_W1;   // RecHits, 2. step, RZ, wheel +-1
00170   HEff1DHit *hEff_S3RZ_W1;   // RecHits, 3. step, RZ, wheel +-1
00171 
00172   HEff1DHit *hEff_S1RZ_W2;   // RecHits, 1. step, RZ, wheel +-2
00173   HEff1DHit *hEff_S2RZ_W2;   // RecHits, 2. step, RZ, wheel +-2
00174   HEff1DHit *hEff_S3RZ_W2;   // RecHits, 3. step, RZ, wheel +-2
00175 };
00176 #endif
00177 
00178 
00179 
00180 

Generated on Tue Jun 9 17:49:02 2009 for CMSSW by  doxygen 1.5.4