CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/DQM/SiPixelMonitorClient/interface/SiPixelActionExecutor.h

Go to the documentation of this file.
00001 #ifndef _SiPixelActionExecutor_h_
00002 #define _SiPixelActionExecutor_h_
00003 
00004 #include "DQMServices/Core/interface/MonitorElement.h"
00005 #include "DQMServices/Core/interface/DQMStore.h"
00006 #include "DQM/SiPixelMonitorClient/interface/SiPixelConfigParser.h"
00007 #include "DQM/SiPixelMonitorClient/interface/SiPixelConfigWriter.h"
00008 #include "DQMServices/ClientConfig/interface/QTestHandle.h"
00009 #include "FWCore/Framework/interface/Event.h"
00010 #include "FWCore/Framework/interface/EventSetup.h"
00011 #include "FWCore/Framework/interface/ESHandle.h"
00012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00013 #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h"
00014 #include "CondFormats/SiPixelObjects/interface/DetectorIndex.h"
00015 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h"
00016 #include "CondFormats/SiPixelObjects/interface/SiPixelFrameConverter.h"
00017 #include <fstream>
00018 #include <map>
00019 #include <vector>
00020 #include <string>
00021 
00022 // For Tracker Map
00023 enum funcType {EachBinContent, Entries, Mean, Sum, WeightedSum};
00024 #define PI_12 0.261799
00025 #define PI    3.141592
00026 #define PI_2  1.570796
00027 
00028 #define NLev1           4               // Number of HalfCylinders in Endcap or number of Shells in Barrel, which is bigger
00029 #define NLev2           3               // Number of Disks in Endcap or number of Layers in Barrel, which is bigger
00030 #define NLev3           22              // Number of Blades in Endcap or number of Ladders in Barrel, which is bigger
00031 #define NLev4           7               // Number of Modules - different for Endcap and Barrel, which is bigger
00032 
00033 #define NCyl            4
00034 #define NDisk           2
00035 #define NBlade          12
00036 #define NModuleE        7
00037 
00038 #define NShell          4
00039 #define NLayer          3
00040 //#define NLadders      LayNum * 6 + 4          // where LayNum is number of interesting Layer => 10, 16, 22
00041 #define NModuleB        4
00042 
00043 #define NPoints         5
00044 
00045 // End for Tracker Map
00046 
00047 class SiPixelActionExecutor {
00048 
00049  public:
00050 
00051   SiPixelActionExecutor(            bool                           offlineXMLfile,
00052                                     bool                           Tier0Flag);
00053  ~SiPixelActionExecutor();
00054 
00055  void createSummary(                DQMStore                     * bei);
00056  void bookDeviations(               DQMStore                     * bei);
00057  void bookEfficiency(               DQMStore                     * bei);
00058  void createEfficiency(             DQMStore                     * bei);
00059  void fillEfficiency(               DQMStore                     * bei,
00060                                     bool                           isbarrel);
00061  void bookOccupancyPlots(           DQMStore                     * bei,
00062                                     bool                           hiRes,
00063                                                                         bool                            isbarrel);
00064  void bookOccupancyPlots(           DQMStore                     * bei,
00065                                     bool                           hiRes);
00066  void createOccupancy(              DQMStore                     * bei);
00067  void setupQTests(                  DQMStore                     * bei);
00068  void checkQTestResults(            DQMStore                     * bei);
00069  void createTkMap(                  DQMStore                     * bei, 
00070                                     std::string                    mEName,
00071                                     std::string                    theTKType);
00072  bool readConfiguration(            int                          & tkmap_freq, 
00073                                     int                          & sum_barrel_freq, 
00074                                     int                          & sum_endcap_freq, 
00075                                     int                          & sum_grandbarrel_freq, 
00076                                     int                          & sum_grandendcap_freq,
00077                                     int                          & message_limit,
00078                                     int                          & source_type,
00079                                     int                          & calib_type);
00080  bool readConfiguration(            int                          & tkmap_freq, 
00081                                     int                          & summary_freq);
00082  void readConfiguration(            );
00083  void createLayout(                 DQMStore                     * bei);
00084  void fillLayout(                   DQMStore                     * bei);
00085  int getTkMapMENames(               std::vector<std::string>     & names);
00086  void dumpModIds(                   DQMStore                     * bei,
00087                                     edm::EventSetup const        & eSetup);
00088  void dumpBarrelModIds(             DQMStore                     * bei,
00089                                     edm::EventSetup const        & eSetup);
00090  void dumpEndcapModIds(             DQMStore                     * bei,
00091                                     edm::EventSetup const        & eSetup);
00092  void dumpRefValues(                   DQMStore                  * bei,
00093                                     edm::EventSetup const        & eSetup);
00094  void dumpBarrelRefValues(             DQMStore                  * bei,
00095                                     edm::EventSetup const        & eSetup);
00096  void dumpEndcapRefValues(             DQMStore                  * bei,
00097                                     edm::EventSetup const        & eSetup);
00098  void createMaps(DQMStore* bei, std::string type, std::string name, funcType ff);
00099  void bookTrackerMaps(DQMStore* bei, std::string name);
00100 
00101 
00102 private:
00103   
00104   
00105   MonitorElement* getSummaryME(     DQMStore                     * bei, 
00106                                     std::string                    me_name);
00107   MonitorElement* getFEDSummaryME(  DQMStore                     * bei, 
00108                                     std::string                    me_name);
00109   void GetBladeSubdirs(DQMStore* bei, std::vector<std::string>& blade_subdirs); 
00110   void fillSummary(                 DQMStore                     * bei, 
00111                                     std::string                    dir_name,
00112                                     std::vector<std::string>     & me_names,
00113                                     bool isbarrel);
00114   void fillDeviations(              DQMStore                     * bei);
00115   void fillFEDErrorSummary(         DQMStore                     * bei, 
00116                                     std::string                    dir_name,
00117                                     std::vector<std::string>     & me_names);
00118   void fillGrandBarrelSummaryHistos(DQMStore                     * bei, 
00119                                     std::vector<std::string>     & me_names);
00120   void fillGrandEndcapSummaryHistos(DQMStore                     * bei, 
00121                                     std::vector<std::string>     & me_names);
00122   void getGrandSummaryME(           DQMStore                     * bei,
00123                                     int                            nbin, 
00124                                     std::string                  & me_name, 
00125                                     std::vector<MonitorElement*> & mes);
00126  
00127   void fillOccupancy(               DQMStore                     * bei,
00128                                     bool isbarrel);
00129 
00130   SiPixelConfigParser* configParser_;
00131   SiPixelConfigWriter* configWriter_;
00132   edm::ESHandle<SiPixelFedCablingMap> theCablingMap;
00133   
00134   std::vector<std::string> summaryMENames;
00135   std::vector<std::string> tkMapMENames;
00136   
00137   int message_limit_;
00138   int source_type_;
00139   int calib_type_;  
00140   int ndet_;
00141   bool offlineXMLfile_;
00142   bool Tier0Flag_;
00143   
00144   QTestHandle* qtHandler_;
00145   
00146   MonitorElement * OccupancyMap;
00147   MonitorElement * PixelOccupancyMap;
00148   MonitorElement * HitEfficiency_L1;
00149   MonitorElement * HitEfficiency_L2;
00150   MonitorElement * HitEfficiency_L3;
00151   MonitorElement * HitEfficiency_Dp1;
00152   MonitorElement * HitEfficiency_Dp2;
00153   MonitorElement * HitEfficiency_Dm1;
00154   MonitorElement * HitEfficiency_Dm2;
00155   MonitorElement * DEV_adc_Barrel;
00156   MonitorElement * DEV_ndigis_Barrel;
00157   MonitorElement * DEV_charge_Barrel;
00158   MonitorElement * DEV_nclusters_Barrel;
00159   MonitorElement * DEV_size_Barrel;
00160   MonitorElement * DEV_adc_Endcap;
00161   MonitorElement * DEV_ndigis_Endcap;
00162   MonitorElement * DEV_charge_Endcap;
00163   MonitorElement * DEV_nclusters_Endcap;
00164   MonitorElement * DEV_size_Endcap;
00165   
00166   
00167   int createMap(Double_t map[][NLev2][NLev3][NLev4], std::string type, DQMStore* bei, funcType ff, bool isBarrel);
00168   void getData(Double_t map[][NLev2][NLev3][NLev4], std::string type, DQMStore* bei, funcType ff, Int_t i, Int_t j, Int_t k, Int_t l);
00169   void prephistosB(MonitorElement* me[NCyl], DQMStore *bei, const Double_t map[][NLev2][NLev3][NLev4], std::string name, Double_t min, Double_t max);
00170   void prephistosE(MonitorElement* me[NCyl], DQMStore *bei, const Double_t map[][NLev2][NLev3][NLev4], std::string name, Double_t min, Double_t max);
00171   Double_t mapMax(const Double_t map[][NLev2][NLev3][NLev4], bool isBarrel); 
00172   Double_t mapMin(const Double_t map[][NLev2][NLev3][NLev4], bool isBarrel);
00173 
00174   TH2F * temp_H;
00175   TH2F * temp_1x2;
00176   TH2F * temp_1x5;
00177   TH2F * temp_2x3;
00178   TH2F * temp_2x4;
00179   TH2F * temp_2x5;
00180   
00181 };
00182 #endif