CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/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/CSCALCTDigi.h"
00031 #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h"
00032 #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h"
00033 #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h"
00034 #include "DataFormats/CSCDigi/interface/CSCWireDigi.h"
00035 #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
00036 #include "DataFormats/CSCDigi/interface/CSCStripDigi.h"
00037 #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
00038 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00039 #include <DataFormats/CSCRecHit/interface/CSCRecHit2D.h>
00040 #include <DataFormats/CSCRecHit/interface/CSCSegmentCollection.h>
00041 #include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
00042 
00043 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
00044 #include "Geometry/CSCGeometry/interface/CSCChamber.h"
00045 #include "Geometry/CSCGeometry/interface/CSCLayer.h"
00046 #include "Geometry/CSCGeometry/interface/CSCLayerGeometry.h"
00047 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00048 
00049 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00050 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00051 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00052 #include "DataFormats/GeometryVector/interface/LocalVector.h"
00053 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
00054 
00055 #include "CommonTools/Statistics/interface/ChiSquaredProbability.h"
00056 
00057 #include "DQMServices/Core/interface/DQMStore.h"
00058 #include "DQMServices/Core/interface/MonitorElement.h"
00059 
00060 #include "CondFormats/CSCObjects/interface/CSCCrateMap.h"
00061 #include "CondFormats/DataRecord/interface/CSCCrateMapRcd.h"
00062 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
00063 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00064 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00065 
00066 #include "EventFilter/CSCRawToDigi/interface/CSCCLCTData.h"
00067 #include "EventFilter/CSCRawToDigi/interface/CSCDCCExaminer.h"
00068 #include "EventFilter/CSCRawToDigi/interface/CSCDCCEventData.h"
00069 #include "EventFilter/CSCRawToDigi/interface/CSCDDUEventData.h"
00070 #include "EventFilter/CSCRawToDigi/interface/CSCEventData.h"
00071 #include "EventFilter/CSCRawToDigi/interface/CSCTMBData.h"
00072 #include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h"
00073 
00074 class CSCOfflineMonitor : public edm::EDAnalyzer {
00075 public:
00077   CSCOfflineMonitor(const edm::ParameterSet& pset);
00078 
00080   virtual ~CSCOfflineMonitor();
00081 
00082   // Operations
00083   void beginJob(void);
00084   void finalize(); 
00085   virtual void endRun( edm::Run const &, edm::EventSetup const & ) ; // call finialize() 
00086   virtual void endJob() ; // call finalize()
00087 
00088 
00090   void analyze(const edm::Event & event, const edm::EventSetup& eventSetup);
00091 
00092 
00093 protected:
00094 
00095 private: 
00096 
00097   bool finalizedHistograms_;
00098 
00099   edm::ParameterSet param;
00100   edm::InputTag stripDigiTag_;
00101   edm::InputTag wireDigiTag_;
00102   edm::InputTag alctDigiTag_;
00103   edm::InputTag clctDigiTag_;
00104   edm::InputTag cscRecHitTag_;
00105   edm::InputTag cscSegTag_; 
00106   edm::InputTag FEDRawDataCollectionTag_; 
00107 
00108   // some useful functions
00109 
00110   // modules:
00111   void  doOccupancies(edm::Handle<CSCStripDigiCollection> strips, edm::Handle<CSCWireDigiCollection> wires,
00112                       edm::Handle<CSCRecHit2DCollection> recHits, edm::Handle<CSCSegmentCollection> cscSegments,
00113                       edm::Handle<CSCCLCTDigiCollection> clcts);
00114   void  doStripDigis(edm::Handle<CSCStripDigiCollection> strips);
00115   void  doWireDigis(edm::Handle<CSCWireDigiCollection> wires);
00116   void  doRecHits(edm::Handle<CSCRecHit2DCollection> recHits,edm::Handle<CSCStripDigiCollection> strips,
00117                   edm::ESHandle<CSCGeometry> cscGeom);
00118   void  doPedestalNoise(edm::Handle<CSCStripDigiCollection> strips);
00119   void  doSegments(edm::Handle<CSCSegmentCollection> cscSegments, edm::ESHandle<CSCGeometry> cscGeom);
00120   void  doResolution(edm::Handle<CSCSegmentCollection> cscSegments, edm::ESHandle<CSCGeometry> cscGeom);
00121   void  doEfficiencies(edm::Handle<CSCWireDigiCollection> wires, edm::Handle<CSCStripDigiCollection> strips,
00122                        edm::Handle<CSCRecHit2DCollection> recHits, edm::Handle<CSCSegmentCollection> cscSegments,
00123                        edm::ESHandle<CSCGeometry> cscGeom);
00124   void  doBXMonitor(edm::Handle<CSCALCTDigiCollection> alcts, edm::Handle<CSCCLCTDigiCollection> clcts, const edm::Event & event, const edm::EventSetup& eventSetup);
00125 
00126 
00127   // used by modules:
00128   float      fitX(CLHEP::HepMatrix sp, CLHEP::HepMatrix ep);
00129   float      getSignal(const CSCStripDigiCollection& stripdigis, CSCDetId idRH, int centerStrip);
00130   int        typeIndex(CSCDetId id, int flag = 1);
00131   int        chamberSerial(CSCDetId id);
00132 
00133   // for efficiency calculation
00134   // these functions handle Stoyan's efficiency code
00135   void  fillEfficiencyHistos(int bin, int flag);
00136   void  getEfficiency(float bin, float Norm, std::vector<float> &eff);
00137   void  histoEfficiency(TH1F *readHisto, MonitorElement *writeHisto);
00138   double lineParametrization(double z1Position, double z2Position, double z1Direction){
00139     double parameterLine = (z2Position-z1Position)/z1Direction;
00140     return parameterLine;
00141   }
00142   double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine){
00143     double extrapolatedPosition = initPosition + initDirection*parameterOfTheLine;
00144     return extrapolatedPosition; 
00145   }
00146   bool withinSensitiveRegion(LocalPoint localPos, const std::vector<float> layerBounds,
00147                              int station, int ring, float shiftFromEdge, float shiftFromDeadZone);
00148 
00149   // for BX monitor plots
00150   void harvestChamberMeans(MonitorElement* meMean1D, MonitorElement *meMean2D, TH2F *hNum, MonitorElement *meDenom);
00151   void normalize(MonitorElement* me);
00152 
00153   // DQM
00154   DQMStore* dbe;
00155 
00156   // Wire digis
00157   MonitorElement *hWirenGroupsTotal;
00158   std::vector<MonitorElement*> hWireTBin;
00159   std::vector<MonitorElement*> hWireNumber;
00160 
00161   // Strip Digis
00162   MonitorElement *hStripNFired;
00163   std::vector<MonitorElement*> hStripNumber;
00164   std::vector<MonitorElement*> hStripPed;
00165 
00166   // recHits
00167   MonitorElement *hRHnrechits;
00168   std::vector<MonitorElement*> hRHGlobal;
00169   std::vector<MonitorElement*> hRHSumQ;
00170   std::vector<MonitorElement*> hRHTiming;
00171   std::vector<MonitorElement*> hRHTimingAnode;
00172   std::vector<MonitorElement*> hRHRatioQ;
00173   std::vector<MonitorElement*> hRHstpos;
00174   std::vector<MonitorElement*> hRHsterr;
00175 
00176   // Segments
00177   MonitorElement *hSnSegments;
00178   MonitorElement *hSnhitsAll;
00179   std::vector<MonitorElement*> hSnhits;
00180   MonitorElement *hSChiSqAll;
00181   std::vector<MonitorElement*> hSChiSq;
00182   MonitorElement *hSChiSqProbAll;
00183   std::vector<MonitorElement*> hSChiSqProb;
00184   MonitorElement *hSGlobalTheta;
00185   MonitorElement *hSGlobalPhi;
00186   MonitorElement *hSTimeCathode;
00187   MonitorElement *hSTimeCombined;
00188   MonitorElement *hSTimeVsZ;
00189   MonitorElement *hSTimeVsTOF;
00190 
00191   // Resolution
00192   std::vector<MonitorElement*> hSResid;
00193 
00194   // occupancy histos
00195   MonitorElement *hOWires;
00196   MonitorElement *hOWiresAndCLCT;
00197   MonitorElement *hOStrips;
00198   MonitorElement *hOStripsAndWiresAndCLCT;
00199   MonitorElement *hORecHits;
00200   MonitorElement *hOSegments;
00201   MonitorElement *hOWireSerial;
00202   MonitorElement *hOStripSerial;
00203   MonitorElement *hORecHitsSerial;
00204   MonitorElement *hOSegmentsSerial;
00205   MonitorElement *hCSCOccupancy;
00206 
00207   // Efficiency
00208   TH1F *hSSTE;
00209   TH1F *hRHSTE;
00210   MonitorElement *hSEff;
00211   MonitorElement *hRHEff;
00212   TH2F *hSSTE2;
00213   TH2F *hRHSTE2;
00214   TH2F *hStripSTE2;
00215   TH2F *hWireSTE2;
00216   MonitorElement *hSEff2;
00217   MonitorElement *hRHEff2;
00218   MonitorElement *hStripEff2;
00219   MonitorElement *hWireEff2;
00220   MonitorElement *hStripReadoutEff2;
00221   TH2F *hEffDenominator;
00222   MonitorElement *hSensitiveAreaEvt;
00223 
00224   // BX monitor
00225   MonitorElement *hALCTgetBX;
00226   MonitorElement *hALCTgetBXSerial;
00227   MonitorElement *hALCTgetBXChamberMeans;
00228   MonitorElement *hALCTgetBX2DMeans;
00229   MonitorElement *hALCTgetBX2Denominator;
00230   TH2F *hALCTgetBX2DNumerator;
00231 
00232   MonitorElement *hALCTMatch;
00233   MonitorElement *hALCTMatchSerial;
00234   MonitorElement *hALCTMatchChamberMeans;
00235   MonitorElement *hALCTMatch2DMeans;
00236   MonitorElement *hALCTMatch2Denominator;
00237   TH2F *hALCTMatch2DNumerator;
00238   
00239   MonitorElement *hCLCTL1A;
00240   MonitorElement *hCLCTL1ASerial;
00241   MonitorElement *hCLCTL1AChamberMeans;
00242   MonitorElement *hCLCTL1A2DMeans;
00243   MonitorElement *hCLCTL1A2Denominator;
00244   TH2F *hCLCTL1A2DNumerator;
00245 
00246 
00247 };
00248 #endif