00001 #ifndef _SiPixelInformationExtractor_h_ 00002 #define _SiPixelInformationExtractor_h_ 00003 00004 #include "DQMServices/Core/interface/MonitorElement.h" 00005 00006 #include "DQM/SiPixelMonitorClient/interface/SiPixelConfigParser.h" 00007 #include "DQM/SiPixelMonitorClient/interface/SiPixelConfigWriter.h" 00008 #include "DQM/SiPixelMonitorClient/interface/SiPixelActionExecutor.h" 00009 #include "DQM/SiPixelMonitorClient/interface/SiPixelLayoutParser.h" 00010 00011 #include "FWCore/Framework/interface/Event.h" 00012 #include "FWCore/Framework/interface/EventSetup.h" 00013 #include "FWCore/Framework/interface/ESHandle.h" 00014 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00015 00016 #include "DataFormats/SiPixelDigi/interface/PixelDigi.h" 00017 #include "DataFormats/Common/interface/DetSetVector.h" 00018 #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" 00019 #include "CondFormats/SiPixelObjects/interface/DetectorIndex.h" 00020 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" 00021 #include "CondFormats/SiPixelObjects/interface/SiPixelFrameConverter.h" 00022 00023 #include "xgi/Utils.h" 00024 #include "xgi/Method.h" 00025 00026 #include "TCanvas.h" 00027 #include "TPaveText.h" 00028 #include "TF1.h" 00029 #include "TH2F.h" 00030 #include "TGaxis.h" 00031 #include "qstring.h" 00032 00033 #include <fstream> 00034 #include <sstream> 00035 #include <map> 00036 #include <vector> 00037 #include <string> 00038 #include <map> 00039 #include <boost/cstdint.hpp> 00040 00041 class DQMStore; 00042 class SiPixelEDAClient; 00043 class SiPixelWebInterface; 00044 class SiPixelHistoPlotter; 00045 class SiPixelInformationExtractor { 00046 00047 public: 00048 00049 SiPixelInformationExtractor( bool offlineXMLfile); 00050 ~SiPixelInformationExtractor(); 00051 00052 void getSingleModuleHistos( DQMStore * bei, 00053 const std::multimap<std::string, std::string>& req_map, 00054 xgi::Output * out); 00055 void getHistosFromPath( DQMStore * bei, 00056 const std::multimap<std::string, std::string>& req_map, 00057 xgi::Output * out); 00058 void getTrackerMapHistos( DQMStore * bei, 00059 const std::multimap<std::string, std::string>& req_map, 00060 xgi::Output * out); 00061 00062 00063 void readModuleAndHistoList( DQMStore * bei, 00064 xgi::Output * out); 00065 void readModuleHistoTree( DQMStore * bei, 00066 std::string & str_name, 00067 xgi::Output * out); 00068 void readSummaryHistoTree( DQMStore * bei, 00069 std::string & str_name, 00070 xgi::Output * out); 00071 void readAlarmTree( DQMStore * bei, 00072 std::string & str_name, 00073 xgi::Output * out); 00074 void readStatusMessage( DQMStore * bei, 00075 std::multimap<std::string, std::string>& req_map, 00076 xgi::Output * out); 00077 void computeStatus( MonitorElement * mE, 00078 double & colorValue, 00079 std::pair<double,double> & norm) ; 00080 void getNormalization( MonitorElement * mE, 00081 std::pair<double,double> & norm, 00082 QString theMEType) ; 00083 void getNormalization2D( MonitorElement * mE, 00084 std::pair<double,double> & normX, 00085 std::pair<double,double> & normY, 00086 QString theMEType) ; 00087 void sendTkUpdatedStatus( DQMStore * bei, 00088 xgi::Output * out, 00089 std::string & meName, 00090 std::string & theTKType) ; 00091 void selectMEList( DQMStore * bei, 00092 std::string & name, 00093 std::vector<MonitorElement*> & mes); 00094 void getMEList( DQMStore * bei, 00095 std::map<std::string, int> & mEHash); 00096 int getDetId( MonitorElement * mE) ; 00097 void getIMGCImage( const std::multimap<std::string, std::string>& req_map, 00098 xgi::Output * out); 00099 void getIMGCImage( std::multimap<std::string, std::string>& req_map, 00100 xgi::Output * out); 00101 std::string getMEType( MonitorElement * mE) ; 00102 00103 void readConfiguration(); 00104 bool readConfiguration( std::map<std::string,std::vector< std::string> > & layoutMap, 00105 std::map<std::string,std::map<std::string,std::string> > & qtestsMap, 00106 std::map<std::string,std::vector<std::string> > & meQTestsMap); 00107 00108 void bookGlobalQualityFlag (DQMStore * bei, 00109 float noiseRate, 00110 bool Tier0Flag); 00111 00112 void computeGlobalQualityFlag (DQMStore * bei, 00113 bool init, 00114 int nFEDs, 00115 bool Tier0Flag); 00116 00117 void fillGlobalQualityPlot (DQMStore * bei, 00118 bool init, 00119 edm::EventSetup const & eSetup, 00120 int nFEDs, 00121 bool Tier0Flag); 00122 00123 void findNoisyPixels ( DQMStore * bei, 00124 bool init, 00125 float noiseRate, 00126 int noiseRateDenominator, 00127 edm::EventSetup const & eSetup); 00128 00129 void createImages (DQMStore * bei); 00130 00131 private: 00132 00133 void fillModuleAndHistoList( DQMStore * bei, 00134 std::vector<std::string> & modules, 00135 std::map<std::string,std::string> & histos); 00136 void getItemList( const std::multimap<std::string, std::string> & req_map, 00137 std::string item_name, 00138 std::vector<std::string> & items); 00139 void printModuleHistoList( DQMStore * bei, 00140 std::ostringstream & str_val); 00141 void printSummaryHistoList( DQMStore * bei, 00142 std::ostringstream & str_val); 00143 void printAlarmList( DQMStore * bei, 00144 std::ostringstream & str_val); 00145 bool goToDir( DQMStore * bei, 00146 std::string & sname); 00147 bool hasItem( std::multimap<std::string, std::string> & req_map, 00148 std::string item_name); 00149 std::string getItemValue( const std::multimap<std::string, std::string> & req_map, 00150 std::string item_name); 00151 std::string getItemValue( std::multimap<std::string, std::string> & req_map, 00152 std::string item_name); 00153 void createDummiesFromLayout(); 00154 void selectImage( std::string & name, 00155 int status); 00156 void selectImage( std::string & name, 00157 std::vector<QReport*> & reports); 00158 void selectColor( std::string & col, 00159 int status); 00160 void selectColor( std::string & col, 00161 std::vector<QReport*> & reports); 00162 00163 void setHTMLHeader( xgi::Output * out); 00164 void setXMLHeader( xgi::Output * out); 00165 void setPlainHeader( xgi::Output * out); 00166 00167 int alarmCounter_; 00168 00169 SiPixelConfigParser * configParser_ ; 00170 SiPixelConfigWriter * configWriter_ ; 00171 SiPixelActionExecutor * actionExecutor_; 00172 SiPixelLayoutParser * layoutParser_ ; 00173 00174 std::map<std::string, 00175 std::vector< std::string> > layoutMap; 00176 std::map<std::string, 00177 std::map<std::string, 00178 std::string> > qtestsMap; 00179 std::map<std::string, 00180 std::vector<std::string> > meQTestsMap; 00181 00182 00183 bool readReference_; 00184 bool readQTestMap_; 00185 bool readMeMap_; 00186 bool flagHotModule_; 00187 bool offlineXMLfile_; 00188 00189 float qflag_, bpix_flag_, shellmI_flag_, shellmO_flag_, shellpI_flag_; 00190 float shellpO_flag_, fpix_flag_, hcylmI_flag_, hcylmO_flag_; 00191 float hcylpI_flag_, hcylpO_flag_; 00192 int allMods_, bpix_mods_, shellmI_mods_, shellmO_mods_, shellpI_mods_; 00193 int shellpO_mods_, fpix_mods_, hcylmI_mods_, hcylmO_mods_; 00194 int hcylpI_mods_, hcylpO_mods_; 00195 int errorMods_, err_bpix_mods_, err_shellmI_mods_, err_shellmO_mods_; 00196 int err_shellpI_mods_, err_shellpO_mods_, err_fpix_mods_, err_hcylmI_mods_; 00197 int err_hcylmO_mods_, err_hcylpI_mods_, err_hcylpO_mods_; 00198 00199 TH2F * allmodsEtaPhi; 00200 TH2F * errmodsEtaPhi; 00201 TH2F * goodmodsEtaPhi; 00202 TH2F * allmodsMap; 00203 TH2F * errmodsMap; 00204 TH2F * goodmodsMap; 00205 int count; 00206 int errcount; 00207 bool gotDigis; 00208 00209 ofstream myfile_; 00210 int nevents_; 00211 std::map< uint32_t , std::vector< std::pair< std::pair<int,int> , float > > > noisyDetIds_; 00212 bool endOfModules_; 00213 edm::ESHandle<SiPixelFedCablingMap> theCablingMap; 00214 MonitorElement * EventRateBarrelPixels; 00215 MonitorElement * EventRateEndcapPixels; 00216 00217 MonitorElement * SummaryReport; 00218 MonitorElement * SummaryReportMap; 00219 MonitorElement * SummaryBarrel; 00220 MonitorElement * SummaryShellmI; 00221 MonitorElement * SummaryShellmO; 00222 MonitorElement * SummaryShellpI; 00223 MonitorElement * SummaryShellpO; 00224 MonitorElement * SummaryEndcap; 00225 MonitorElement * SummaryHCmI; 00226 MonitorElement * SummaryHCmO; 00227 MonitorElement * SummaryHCpI; 00228 MonitorElement * SummaryHCpO; 00229 00230 MonitorElement * EndcapNdigisFREQProjection; 00231 MonitorElement * BarrelNdigisFREQProjection; 00232 00233 00234 SiPixelHistoPlotter* histoPlotter_; 00235 }; 00236 #endif