CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/Validation/DTRecHits/plugins/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 #include "DQMServices/Core/interface/DQMStore.h"
00023 #include "DQMServices/Core/interface/MonitorElement.h"
00024 #include "FWCore/ServiceRegistry/interface/Service.h"
00025 #include "FWCore/Utilities/interface/InputTag.h"
00026 
00027 
00028 #include <vector>
00029 #include <map>
00030 #include <string>
00031 
00032 namespace edm {
00033   class ParameterSet;
00034   class Event;
00035   class EventSetup;
00036 }
00037 
00038 class PSimHit;
00039 class TFile;
00040 class DTLayer;
00041 class DTWireId;
00042 class DTGeometry;
00043 
00044 class DTRecHitQuality : public edm::EDAnalyzer {
00045 public:
00047   DTRecHitQuality(const edm::ParameterSet& pset);
00048 
00050   virtual ~DTRecHitQuality();
00051 
00052   // Operations
00053 
00055   void analyze(const edm::Event & event, const edm::EventSetup& eventSetup);
00056   // Write the histos to file
00057 
00058   void endJob();
00059 void endLuminosityBlock(edm::LuminosityBlock const& lumiSeg,
00060                                          edm::EventSetup const& c);
00061 
00062 protected:
00063 
00064 private: 
00065 
00066 
00067   // The file which will store the histos
00068   //TFile *theFile;
00069   // Switch for debug output
00070   bool debug;
00071   // Root file name
00072   std::string rootFileName;
00073   edm::InputTag simHitLabel;
00074   edm::InputTag recHitLabel;
00075   edm::InputTag segment2DLabel;
00076   edm::InputTag segment4DLabel;
00077 
00078   // Switches for analysis at various steps
00079   bool doStep1;
00080   bool doStep2;
00081   bool doStep3;
00082   bool local;
00083   // Return a map between DTRecHit1DPair and wireId
00084   std::map<DTWireId, std::vector<DTRecHit1DPair> >
00085     map1DRecHitsPerWire(const DTRecHitCollection* dt1DRecHitPairs);
00086 
00087   // Return a map between DTRecHit1D and wireId
00088   std::map<DTWireId, std::vector<DTRecHit1D> >
00089     map1DRecHitsPerWire(const DTRecSegment2DCollection* segment2Ds);
00090 
00091   // Return a map between DTRecHit1D and wireId
00092   std::map<DTWireId, std::vector<DTRecHit1D> >
00093     map1DRecHitsPerWire(const DTRecSegment4DCollection* segment4Ds);
00094 
00095   // Compute SimHit distance from wire (cm)
00096   float simHitDistFromWire(const DTLayer* layer,
00097                            DTWireId wireId,
00098                            const PSimHit& hit);
00099 
00100   // Compute SimHit impact angle (in direction perp to wire)
00101   float simHitImpactAngle(const DTLayer* layer,
00102                            DTWireId wireId,
00103                            const PSimHit& hit);
00104 
00105   // Compute SimHit distance from FrontEnd
00106   float simHitDistFromFE(const DTLayer* layer,
00107                            DTWireId wireId,
00108                            const PSimHit& hit);
00109 
00110   // Find the RecHit closest to the muon SimHit
00111 //   const DTRecHit1DPair* 
00112 //   findBestRecHit(const DTLayer* layer,
00113 //               DTWireId wireId,
00114 //               const std::vector<DTRecHit1DPair>& recHits,
00115 //               const float simHitDist);
00116   template  <typename type>
00117   const type* 
00118   findBestRecHit(const DTLayer* layer,
00119                                   DTWireId wireId,
00120                                   const std::vector<type>& recHits,
00121                                   const float simHitDist);
00122 
00123 
00124 
00125 
00126   // Compute the distance from wire (cm) of a hits in a DTRecHit1DPair
00127   float recHitDistFromWire(const DTRecHit1DPair& hitPair, const DTLayer* layer);
00128   // Compute the distance from wire (cm) of a hits in a DTRecHit1D
00129   float recHitDistFromWire(const DTRecHit1D& recHit, const DTLayer* layer);
00130 
00131   // Return the error on the measured (cm) coordinate
00132   float recHitPositionError(const DTRecHit1DPair& recHit);
00133   float recHitPositionError(const DTRecHit1D& recHit);
00134 
00135 
00136   // Does the real job
00137   template  <typename type>
00138   void compute(const DTGeometry *dtGeom,
00139                std::map<DTWireId, std::vector<PSimHit> > simHitsPerWire,
00140                std::map<DTWireId, std::vector<type> > recHitsPerWire,
00141                int step);
00142   //HRes1DHit * hRes_S1RPhi;
00143   HRes1DHit *hRes_S1RPhi;  // RecHits, 1. step, RPh
00144   HRes1DHit *hRes_S2RPhi;     // RecHits, 2. step, RPhi
00145   HRes1DHit *hRes_S3RPhi;     // RecHits, 3. step, RPhi
00146 
00147   HRes1DHit *hRes_S1RZ;         // RecHits, 1. step, RZ
00148   HRes1DHit *hRes_S2RZ;     // RecHits, 2. step, RZ
00149   HRes1DHit *hRes_S3RZ;     // RecHits, 3. step, RZ
00150 
00151   HRes1DHit *hRes_S1RZ_W0;   // RecHits, 1. step, RZ, wheel 0
00152   HRes1DHit *hRes_S2RZ_W0;   // RecHits, 2. step, RZ, wheel 0
00153   HRes1DHit *hRes_S3RZ_W0;   // RecHits, 3. step, RZ, wheel 0
00154 
00155   HRes1DHit *hRes_S1RZ_W1;   // RecHits, 1. step, RZ, wheel +-1
00156   HRes1DHit *hRes_S2RZ_W1;   // RecHits, 2. step, RZ, wheel +-1
00157   HRes1DHit *hRes_S3RZ_W1;   // RecHits, 3. step, RZ, wheel +-1
00158 
00159   HRes1DHit *hRes_S1RZ_W2;   // RecHits, 1. step, RZ, wheel +-2
00160   HRes1DHit *hRes_S2RZ_W2;   // RecHits, 2. step, RZ, wheel +-2
00161   HRes1DHit *hRes_S3RZ_W2;   // RecHits, 3. step, RZ, wheel +-2
00162 
00163   HRes1DHit *hRes_S1RPhi_W0;   // RecHits, 1. step, RPhi, wheel 0
00164   HRes1DHit *hRes_S2RPhi_W0;   // RecHits, 2. step, RPhi, wheel 0
00165   HRes1DHit *hRes_S3RPhi_W0;   // RecHits, 3. step, RPhi, wheel 0
00166 
00167   HRes1DHit *hRes_S1RPhi_W1;   // RecHits, 1. step, RPhi, wheel +-1
00168   HRes1DHit *hRes_S2RPhi_W1;   // RecHits, 2. step, RPhi, wheel +-1
00169   HRes1DHit *hRes_S3RPhi_W1;   // RecHits, 3. step, RPhi, wheel +-1
00170 
00171   HRes1DHit *hRes_S1RPhi_W2;   // RecHits, 1. step, RPhi, wheel +-2
00172   HRes1DHit *hRes_S2RPhi_W2;   // RecHits, 2. step, RPhi, wheel +-2
00173   HRes1DHit *hRes_S3RPhi_W2;   // RecHits, 3. step, RPhi, wheel +-2
00174 
00175   HEff1DHit *hEff_S1RPhi;     // RecHits, 1. step, RPhi
00176   HEff1DHit *hEff_S2RPhi;     // RecHits, 2. step, RPhi
00177   HEff1DHit *hEff_S3RPhi;     // RecHits, 3. step, RPhi
00178 
00179   HEff1DHit *hEff_S1RZ;         // RecHits, 1. step, RZ
00180   HEff1DHit *hEff_S2RZ;     // RecHits, 2. step, RZ
00181   HEff1DHit *hEff_S3RZ;     // RecHits, 3. step, RZ
00182 
00183   HEff1DHit *hEff_S1RZ_W0;   // RecHits, 1. step, RZ, wheel 0
00184   HEff1DHit *hEff_S2RZ_W0;   // RecHits, 2. step, RZ, wheel 0
00185   HEff1DHit *hEff_S3RZ_W0;   // RecHits, 3. step, RZ, wheel 0
00186 
00187   HEff1DHit *hEff_S1RZ_W1;   // RecHits, 1. step, RZ, wheel +-1
00188   HEff1DHit *hEff_S2RZ_W1;   // RecHits, 2. step, RZ, wheel +-1
00189   HEff1DHit *hEff_S3RZ_W1;   // RecHits, 3. step, RZ, wheel +-1
00190 
00191   HEff1DHit *hEff_S1RZ_W2;   // RecHits, 1. step, RZ, wheel +-2
00192   HEff1DHit *hEff_S2RZ_W2;   // RecHits, 2. step, RZ, wheel +-2
00193   HEff1DHit *hEff_S3RZ_W2;   // RecHits, 3. step, RZ, wheel +-2
00194   DQMStore* dbe_;
00195   bool doall;
00196 };
00197 #endif
00198 
00199 
00200 
00201