CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/DQMOffline/Muon/src/CSCOfflineMonitor.h

Go to the documentation of this file.
00001 #ifndef RecoLocalMuon_CSCOfflineMonitor_H
00002 #define RecoLocalMuon_CSCOfflineMonitor_H
00003 
00016 // user include files
00017 #include "FWCore/Framework/interface/MakerMacros.h"
00018 #include "FWCore/Framework/interface/Frameworkfwd.h"
00019 #include "FWCore/Framework/interface/EDAnalyzer.h"
00020 #include "FWCore/Framework/interface/EDFilter.h"
00021 #include "FWCore/Framework/interface/Event.h"
00022 #include "DataFormats/Common/interface/Handle.h"
00023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00024 #include "FWCore/Framework/interface/EventSetup.h"
00025 #include "FWCore/Framework/interface/ESHandle.h"
00026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00027 #include "FWCore/ServiceRegistry/interface/Service.h"
00028 #include <FWCore/Utilities/interface/InputTag.h>
00029 
00030 #include "DataFormats/CSCDigi/interface/CSCWireDigi.h"
00031 #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
00032 #include "DataFormats/CSCDigi/interface/CSCStripDigi.h"
00033 #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
00034 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00035 #include <DataFormats/CSCRecHit/interface/CSCRecHit2D.h>
00036 #include <DataFormats/CSCRecHit/interface/CSCSegmentCollection.h>
00037 #include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
00038 
00039 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
00040 #include "Geometry/CSCGeometry/interface/CSCChamber.h"
00041 #include "Geometry/CSCGeometry/interface/CSCLayer.h"
00042 #include "Geometry/CSCGeometry/interface/CSCLayerGeometry.h"
00043 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00044 
00045 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00046 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00047 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00048 #include "DataFormats/GeometryVector/interface/LocalVector.h"
00049 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
00050 
00051 #include "CommonTools/Statistics/interface/ChiSquaredProbability.h"
00052 
00053 #include "DQMServices/Core/interface/DQMStore.h"
00054 #include "DQMServices/Core/interface/MonitorElement.h"
00055 
00056 class CSCOfflineMonitor : public edm::EDAnalyzer {
00057 public:
00059   CSCOfflineMonitor(const edm::ParameterSet& pset);
00060 
00062   virtual ~CSCOfflineMonitor();
00063 
00064   // Operations
00065   void beginJob(void);
00066   void endJob(void); 
00067  
00068 
00070   void analyze(const edm::Event & event, const edm::EventSetup& eventSetup);
00071 
00072 
00073 protected:
00074 
00075 private: 
00076 
00077   edm::ParameterSet param;
00078   edm::InputTag stripDigiTag_;
00079   edm::InputTag wireDigiTag_;
00080   edm::InputTag cscRecHitTag_;
00081   edm::InputTag cscSegTag_; 
00082 
00083 
00084   // some useful functions
00085 
00086   // modules:
00087   void  doOccupancies(edm::Handle<CSCStripDigiCollection> strips, edm::Handle<CSCWireDigiCollection> wires,
00088                       edm::Handle<CSCRecHit2DCollection> recHits, edm::Handle<CSCSegmentCollection> cscSegments);
00089   void  doStripDigis(edm::Handle<CSCStripDigiCollection> strips);
00090   void  doWireDigis(edm::Handle<CSCWireDigiCollection> wires);
00091   void  doRecHits(edm::Handle<CSCRecHit2DCollection> recHits,edm::Handle<CSCStripDigiCollection> strips,
00092                   edm::ESHandle<CSCGeometry> cscGeom);
00093   void  doPedestalNoise(edm::Handle<CSCStripDigiCollection> strips);
00094   void  doSegments(edm::Handle<CSCSegmentCollection> cscSegments, edm::ESHandle<CSCGeometry> cscGeom);
00095   void  doResolution(edm::Handle<CSCSegmentCollection> cscSegments, edm::ESHandle<CSCGeometry> cscGeom);
00096   void  doEfficiencies(edm::Handle<CSCWireDigiCollection> wires, edm::Handle<CSCStripDigiCollection> strips,
00097                        edm::Handle<CSCRecHit2DCollection> recHits, edm::Handle<CSCSegmentCollection> cscSegments,
00098                        edm::ESHandle<CSCGeometry> cscGeom);
00099 
00100   // used by modules:
00101   float      fitX(CLHEP::HepMatrix sp, CLHEP::HepMatrix ep);
00102   float      getSignal(const CSCStripDigiCollection& stripdigis, CSCDetId idRH, int centerStrip);
00103   int        typeIndex(CSCDetId id, int flag = 1);
00104   int        chamberSerial(CSCDetId id);
00105 
00106   // for efficiency calculation
00107   // these functions handle Stoyan's efficiency code
00108   void  fillEfficiencyHistos(int bin, int flag);
00109   void  getEfficiency(float bin, float Norm, std::vector<float> &eff);
00110   void  histoEfficiency(TH1F *readHisto, MonitorElement *writeHisto);
00111   double lineParametrization(double z1Position, double z2Position, double z1Direction){
00112     double parameterLine = (z2Position-z1Position)/z1Direction;
00113     return parameterLine;
00114   }
00115   double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine){
00116     double extrapolatedPosition = initPosition + initDirection*parameterOfTheLine;
00117     return extrapolatedPosition; 
00118   }
00119   bool withinSensitiveRegion(LocalPoint localPos, const std::vector<float> layerBounds,
00120                              int station, int ring, float shiftFromEdge, float shiftFromDeadZone);
00121 
00122 
00123 
00124   // DQM
00125   DQMStore* dbe;
00126 
00127   // Wire digis
00128   MonitorElement *hWirenGroupsTotal;
00129   std::vector<MonitorElement*> hWireTBin;
00130   std::vector<MonitorElement*> hWireNumber;
00131 
00132   // Strip Digis
00133   MonitorElement *hStripNFired;
00134   std::vector<MonitorElement*> hStripNumber;
00135   std::vector<MonitorElement*> hStripPed;
00136 
00137   // recHits
00138   MonitorElement *hRHnrechits;
00139   std::vector<MonitorElement*> hRHGlobal;
00140   std::vector<MonitorElement*> hRHSumQ;
00141   std::vector<MonitorElement*> hRHTiming;
00142   std::vector<MonitorElement*> hRHRatioQ;
00143   std::vector<MonitorElement*> hRHstpos;
00144   std::vector<MonitorElement*> hRHsterr;
00145 
00146   // Segments
00147   MonitorElement *hSnSegments;
00148   MonitorElement *hSnhitsAll;
00149   std::vector<MonitorElement*> hSnhits;
00150   MonitorElement *hSChiSqAll;
00151   std::vector<MonitorElement*> hSChiSq;
00152   MonitorElement *hSChiSqProbAll;
00153   std::vector<MonitorElement*> hSChiSqProb;
00154   MonitorElement *hSGlobalTheta;
00155   MonitorElement *hSGlobalPhi;
00156 
00157   // Resolution
00158   std::vector<MonitorElement*> hSResid;
00159 
00160   // occupancy histos
00161   MonitorElement *hOWires;
00162   MonitorElement *hOStrips;
00163   MonitorElement *hORecHits;
00164   MonitorElement *hOSegments;
00165   MonitorElement *hOWireSerial;
00166   MonitorElement *hOStripSerial;
00167   MonitorElement *hORecHitsSerial;
00168   MonitorElement *hOSegmentsSerial;
00169   MonitorElement *hCSCOccupancy;
00170 
00171   // Efficiency
00172   TH1F *hSSTE;
00173   TH1F *hRHSTE;
00174   MonitorElement *hSEff;
00175   MonitorElement *hRHEff;
00176   TH2F *hSSTE2;
00177   TH2F *hRHSTE2;
00178   TH2F *hStripSTE2;
00179   TH2F *hWireSTE2;
00180   MonitorElement *hSEff2;
00181   MonitorElement *hRHEff2;
00182   MonitorElement *hStripEff2;
00183   MonitorElement *hWireEff2;
00184   TH2F *hEffDenominator;
00185   MonitorElement *hSensitiveAreaEvt;
00186 
00187 
00188 
00189 };
00190 #endif