CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/L1TMonitorClient/interface/L1TOccupancyClient.h

Go to the documentation of this file.
00001 #ifndef DQM_L1TMONITORCLIENT_L1TOCCUPANCYCLIENT_H
00002 #define DQM_L1TMONITORCLIENT_L1TOCCUPANCYCLIENT_H
00003 
00004 #include "FWCore/Framework/interface/Frameworkfwd.h"
00005 #include "FWCore/Framework/interface/Event.h"
00006 #include "FWCore/Framework/interface/MakerMacros.h"
00007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00008 #include <FWCore/Framework/interface/EDAnalyzer.h>
00009 
00010 #include "DQMServices/Core/interface/DQMStore.h"
00011 #include "DQMServices/Core/interface/MonitorElement.h"
00012 #include "FWCore/Framework/interface/LuminosityBlock.h"
00013 #include "DQM/L1TMonitorClient/interface/L1TOccupancyClientHistogramService.h"
00014 
00015 #include <memory>
00016 #include <iostream>
00017 #include <fstream>
00018 #include <string>
00019 #include <vector>
00020 #include <map>
00021 #include <TH1F.h>
00022 #include <TH1D.h>
00023 #include <TH2F.h>
00024 #include <TF1.h>
00025 #include <TProfile2D.h>
00026 #include <TNamed.h>
00027 #include <TRandom3.h>
00028 
00029 class L1TOccupancyClient: public edm::EDAnalyzer {
00030 
00031   public:
00032 
00034     L1TOccupancyClient(const edm::ParameterSet& ps);
00035   
00037     virtual ~L1TOccupancyClient();
00038  
00039   protected:
00040 
00042     void beginJob(void);
00043     void endJob();
00044 
00046     void beginRun(const edm::Run& r, const edm::EventSetup& c);
00047     void endRun  (const edm::Run& r, const edm::EventSetup& c);
00048 
00049     void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,const edm::EventSetup& context);
00050     void endLuminosityBlock  (const edm::LuminosityBlock& lumiSeg,const edm::EventSetup& c);       // DQM Client Diagnostic
00051 
00053     void analyze(const edm::Event& e, const edm::EventSetup& c) ;
00054   
00055     //DQM test routines
00056     double xySymmetry(edm::ParameterSet ps, 
00057                      std::string test_name, 
00058                      std::vector<std::pair<int,double> >& deadChannels, 
00059                      std::vector<std::pair<int,double> >& statDev, 
00060                      bool& enoughStats);  // Performs the checking of enough statistics and invokes compareWithStrip()
00061 
00062   private:
00063 
00064     edm::ParameterSet                   parameters_; //parameter set from python
00065     DQMStore*                           dbe_;        //store service
00066     L1TOccupancyClientHistogramService* hservice_;   //histogram service
00067     TFile*                              file_;       //output file for test results
00068 
00069     // bool
00070     bool verbose_;    //verbose mode
00071 
00072     // vector
00073     std::vector<edm::ParameterSet>        tests_;      // all tests defined in python file
00074     std::vector<edm::ParameterSet*> mValidTests; // Valid tests
00075     // map
00076     std::map<std::string,MonitorElement*> meResults;      
00077     std::map<std::string,MonitorElement*> meDifferential; 
00078     std::map<std::string,MonitorElement*> meCertification;
00079 
00080   private:
00081 
00082     // performs the actual test
00083     int compareWithStrip(TH2F* histo, 
00084                          std::string test, 
00085                          int binStrip, 
00086                          int nBins, 
00087                          int axis, 
00088                          double avg, 
00089                          edm::ParameterSet ps,
00090                          std::vector<std::pair<int,double> >& deadChannels);
00091 
00092     // Gets the bin-number of a bin with content and on axis
00093     void getBinCoordinateOnAxisWithValue(TH2F* h2f, 
00094                                            double content, 
00095                                            int& coord, 
00096                                            int axis);  
00097 
00098     // Puts out the bad and masked channels of a specific test to h2f   
00099     void printDeadChannels(std::vector<std::pair<int,double> > deadChannels, 
00100                            TH2F* h2f, 
00101                            std::vector<std::pair<int,double> > statDev, 
00102                            std::string test_name); 
00103 
00104     // Gets the average (avrgMode=1 arithmetic, avrgMode=2 median) for a specific binStrip in histo h2f for a specific test
00105     double getAvrg(TH2F* h2f, std::string test, int axis, int nBins, int binStrip, int avrgMode); 
00106 
00107 };
00108 
00109 #endif