00001
00008 #include "DQM/SiPixelMonitorClient/interface/SiPixelTrackerMapCreator.h"
00009 #include "DQM/SiPixelMonitorClient/interface/SiPixelInformationExtractor.h"
00010 #include "DQM/SiPixelMonitorClient/interface/ANSIColors.h"
00011 #include "DQMServices/Core/interface/MonitorElement.h"
00012 #include "DQMServices/Core/interface/DQMStore.h"
00013 #include <qstring.h>
00014 #include <qregexp.h>
00015 #include <iostream>
00016 #include <sstream>
00017 #include "TText.h"
00018 using namespace std;
00019
00020
00021
00022
00023 SiPixelTrackerMapCreator::SiPixelTrackerMapCreator(string themEName,
00024 string theTKType,
00025 bool offlineXMLfile_)
00026 {
00027 cout << ACYellow << ACBold
00028 << "[SiPixelTrackerMapCreator::SiPixelTrackerMapCreator()]"
00029 << ACPlain << " ctor" << endl ;
00030
00031 mEName = themEName ;
00032 TKType = theTKType ;
00033
00034 stringstream title ;
00035 title.str("") ;
00036 title << themEName ;
00037
00038 trackerMap = new SiPixelTrackerMap(title.str());
00039 if (infoExtractor_ == 0) infoExtractor_ = new SiPixelInformationExtractor(offlineXMLfile_);
00040 }
00041
00042
00043
00044
00045 SiPixelTrackerMapCreator::~SiPixelTrackerMapCreator()
00046 {
00047 if (trackerMap) delete trackerMap;
00048 if (infoExtractor_) delete infoExtractor_;
00049 cout << ACYellow << ACBold
00050 << "[SiPixelTrackerMapCreator::~SiPixelTrackerMapCreator()]"
00051 << ACPlain << " dtor" << endl ;
00052 }
00053
00054
00058 void SiPixelTrackerMapCreator::create(DQMStore * bei)
00059 {
00060
00061
00062
00063
00064
00065
00066
00067 vector<MonitorElement*> mEList ;
00068 map<string, int> mEHash ;
00069
00070 infoExtractor_->selectMEList(bei, mEName, mEList) ;
00071 infoExtractor_->getMEList( bei, mEHash) ;
00072
00073 int nImages = mEHash.size() ;
00074
00075 for(vector<MonitorElement*>::iterator it=mEList.begin(); it!=mEList.end(); it++)
00076 {
00077 paintTkMap(*it);
00078 }
00079
00080 trackerMap->print(true, TKType);
00081
00082 ofstream innerFrame ;
00083
00084 innerFrame.open( "rightEmbedded.html", ios::out );
00085
00086 if( !innerFrame )
00087 {
00088 cout << ACRed << ACBold
00089 << "[SiPixelTrackerMapCreator::create()] "
00090 << ACCyan << ACBold
00091 << "Could not open rightEmbedded.html"
00092 << ACPlain
00093 << endl ;
00094 return ;
00095 }
00096
00097 innerFrame << "<html> " << "\n"
00098 << "<!-- " << "\n"
00099 << " Author: D. Menasce " << "\n"
00100 << " Test widget for the Pixel Tracker Map " << "\n"
00101 << "--> " << "\n"
00102 << " " << "\n"
00103 << "<meta https-equiv='pragma' " << "\n"
00104 << " content ='no-cache'> " << "\n"
00105 << " " << "\n"
00106 << "<head> " << "\n"
00107 << " <link rel = 'stylesheet' " << "\n"
00108 << " type = 'text/css' " << "\n"
00109 << " href = 'css_files/wz_dragdrop.css>' " << "\n"
00110 << " <link rel = 'stylesheet' " << "\n"
00111 << " type = 'text/css' " << "\n"
00112 << " href = 'css_files/magnifier.css'> " << "\n"
00113 << " <script type = 'text/javascript' " << "\n"
00114 << " src = 'js_files/magnifier.js'> " << "\n"
00115 << " </script> " << "\n"
00116 << " <script type = 'text/javascript' " << "\n"
00117 << " src = 'js_files/wz_dragdrop.js'> " << "\n"
00118 << " </script> " << "\n"
00119 << " <script type = 'text/javascript' " << "\n"
00120 << " src = 'js_files/DMLibrary.js'> " << "\n"
00121 << " </script> " << "\n"
00122 << " " << "\n"
00123 << "</head> " << "\n"
00124 << " " << "\n"
00125 << "<body bgcolor='#414141'> " << "\n"
00126 << " " << "\n"
00127 << " <center> " << "\n"
00128 << " " << endl ;
00129 for( int img=1; img<=nImages; img++)
00130 {
00131 stringstream sId, sNm ;
00132 sId.str(""); sId << "binding" << img ;
00133 sNm.str(""); sNm << "baseImage" << img ;
00134 string sid = sId.str() ;
00135 string snm = sNm.str() ;
00136 innerFrame << " <div id = 'binding' " << "\n"
00137 << " name = '" << sid << "'> " << "\n"
00138 << " <img id = '" << snm << "' " << "\n"
00139 << " name = '" << snm << "' " << "\n"
00140 << " src = 'images/EmptyPlot.png' " << "\n"
00141 << " alt = 'picture geometry:800x600' " << "\n"
00142 << " onload = 'RightEmbedded.innerLoading(\"" << sid << "\",\"" << snm << "\")'" << "\n"
00143 << " onclick = 'RightEmbedded.innerTransport(event)' " << "\n"
00144 << " onmouseover = 'this.T_SHADOWWIDTH=4; " << "\n"
00145 << " this.T_OPACITY =70; " << "\n"
00146 << " this.T_FONTCOLOR =\"#000000\"; " << "\n"
00147 << " this.T_WIDTH =200; " << "\n"
00148 << " return escape(\"Click to send to pan/zoom area\")' " << "\n"
00149 << " width = '267' " << "\n"
00150 << " height = '200' /> " << "\n"
00151 << " </div> " << endl ;
00152 }
00153 innerFrame << " " << "\n"
00154 << "</center> " << "\n"
00155 << " " << "\n"
00156 << "<script type = 'text/javascript' " << "\n"
00157 << " src = 'js_files/rightEmbedded.js'> " << "\n"
00158 << "</script> " << "\n"
00159 << " " << "\n"
00160 << "<script type='text/javascript' " << "\n"
00161 << " src ='js_files/wz_tooltip.js'> " << "\n"
00162 << "</script> " << "\n"
00163 << "</html> " << endl ;
00164 innerFrame.close() ;
00165 }
00166
00167
00168
00169
00170 void SiPixelTrackerMapCreator::paintTkMap(MonitorElement * mE)
00171 {
00172
00173
00174 }
00175
00176
00177
00178
00179 bool SiPixelTrackerMapCreator::exploreBeiStructure(DQMStore* bei)
00180 {
00181 cout << ACCyan << ACBold
00182 << "[SiPixelTrackerMapCreator::create()] "
00183 << ACRed << ACReverse
00184 << "List of histograms in"
00185 << ACPlain
00186 << " "
00187 << ACBlue << ACBold
00188 << bei->pwd()
00189 << ACPlain << endl ;
00190
00191
00192 vector<string> histoList = bei->getMEs();
00193
00194 for (vector<string>::const_iterator it = histoList.begin(); it != histoList.end(); it++)
00195 {
00196 cout << ACCyan << ACBold
00197 << "[SiPixelTrackerMapCreator::create()] "
00198 << ACRed << ACReverse
00199 << "Histogram:"
00200 << ACPlain
00201 << " "
00202 << *it
00203 << ACPlain << endl ;
00204 }
00205
00206 vector<string> subDirs = bei->getSubdirs();
00207
00208 for (vector<string>::const_iterator it = subDirs.begin(); it != subDirs.end(); it++)
00209 {
00210 bei->cd(*it);
00211 cout << ACCyan << ACBold
00212 << "[SiPixelTrackerMapCreator::create()] "
00213 << ACRed << ACBold
00214 << "Moved down to"
00215 << ACPlain
00216 << " "
00217 << ACBlue << ACBold
00218 << bei->pwd()
00219 << ACPlain << endl ;
00220 exploreBeiStructure(bei);
00221 bei->goUp();
00222 cout << ACCyan << ACBold
00223 << "[SiPixelTrackerMapCreator::create()] "
00224 << ACRed << ACBold
00225 << "Now back to"
00226 << ACPlain
00227 << " "
00228 << ACBlue << ACBold
00229 << bei->pwd()
00230 << ACPlain << endl ;
00231 }
00232 return true ;
00233 }