CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/DQM/SiPixelMonitorClient/src/SiPixelTrackerMapCreator.cc

Go to the documentation of this file.
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 <iostream>
00014 #include <sstream>
00015 #include "TText.h"
00016 using namespace std;
00017 
00018 //==============================================================================
00019 // -- Constructor
00020 // 
00021 SiPixelTrackerMapCreator::SiPixelTrackerMapCreator(string themEName, 
00022                                                    string theTKType,
00023                                                    bool   offlineXMLfile_) 
00024 {
00025 //  cout << ACYellow << ACBold 
00026 //       << "[SiPixelTrackerMapCreator::SiPixelTrackerMapCreator()]" 
00027 //       << ACPlain << " ctor" << endl ;
00028        
00029   mEName = themEName ;
00030   TKType = theTKType ;
00031 //cout<<"ME and type for new TrackerMap are: "<<themEName<<" , "<<theTKType<<endl;
00032   stringstream title ;
00033   title.str("") ; 
00034   title << themEName ;
00035         
00036   trackerMap      = new SiPixelTrackerMap(title.str());
00037   if (infoExtractor_ == 0) infoExtractor_  = new SiPixelInformationExtractor(offlineXMLfile_);
00038 }
00039 
00040 //==============================================================================
00041 // -- Destructor
00042 //
00043 SiPixelTrackerMapCreator::~SiPixelTrackerMapCreator() 
00044 {
00045 //  if (trackerMap)     delete trackerMap;
00046 //  if (infoExtractor_) delete infoExtractor_;
00047 //  cout << ACYellow << ACBold 
00048 //       << "[SiPixelTrackerMapCreator::~SiPixelTrackerMapCreator()]" 
00049 //       << ACPlain << " dtor" << endl ;
00050 }
00051 
00052 //------------------------------------------------------------------------------
00056 void SiPixelTrackerMapCreator::create(DQMStore * bei) 
00057 {
00058 //   cout << ACYellow << ACBold
00059 //      << "[SiPixelTrackerMapCreator::create()] "
00060 //      << ACPlain 
00061 //      << " Creating tracker map for ME: " 
00062 //      << mEName 
00063 //      << endl;
00064 
00065   vector<MonitorElement*> mEList ;
00066   map<string, int>        mEHash ;
00067   
00068   infoExtractor_->selectMEList(bei, mEName, mEList) ;
00069   infoExtractor_->getMEList(   bei,         mEHash) ;
00070   
00071   int nImages = mEHash.size() ;
00072   
00073   for(vector<MonitorElement*>::iterator it=mEList.begin(); it!=mEList.end(); it++)
00074   {
00075     paintTkMap(*it);
00076   }
00077 
00078   trackerMap->print(true, TKType);  
00079 //cout<<"Going to create inner frame now! Still in TMC::create"<<endl;
00080   ofstream innerFrame ;
00081 
00082   innerFrame.open( "rightEmbedded.html", ios::out );
00083   
00084   if( !innerFrame )
00085   {
00086    cout << ACRed << ACBold
00087         << "[SiPixelTrackerMapCreator::create()] "
00088         << ACCyan << ACBold
00089         << "Could not open rightEmbedded.html"
00090         << ACPlain
00091         << endl ;
00092    return ;
00093   }
00094   
00095   innerFrame << "<html>                                                                    " << "\n"
00096              << "<!--                                                                      " << "\n"
00097              << " Author: D. Menasce                                                       " << "\n"
00098              << " Pixel Tracker Map                                " << "\n"
00099              << "-->                                                                       " << "\n"
00100              << "                                                                          " << "\n"
00101              << "<meta http-equiv='pragma'                                                 " << "\n"
00102              << "      content   ='no-cache'>                                              " << "\n"
00103              << "                                                                          " << "\n"
00104              << "<head>                                                                    " << "\n"
00105              << " <link   rel  = 'stylesheet'                                              " << "\n"
00106              << "         type = 'text/css'                                                " << "\n"
00107              << "         href = 'css_files/wz_dragdrop.css>'                              " << "\n"
00108              << " <link   rel  = 'stylesheet'                                              " << "\n"
00109              << "         type = 'text/css'                                                " << "\n"
00110              << "         href = 'css_files/magnifier.css'>                                " << "\n"
00111              << " <script type = 'text/javascript'                                         " << "\n"
00112              << "         src  = 'js_files/magnifier.js'>                                  " << "\n"
00113              << " </script>                                                                " << "\n"
00114              << " <script type = 'text/javascript'                                         " << "\n"
00115              << "         src  = 'js_files/wz_dragdrop.js'>                                " << "\n"
00116              << " </script>                                                                " << "\n"
00117              << " <script type = 'text/javascript'                                         " << "\n"
00118              << "         src  = 'js_files/DMLibrary.js'>                                  " << "\n"
00119              << " </script>                                                                " << "\n"
00120              << "                                                                          " << "\n"
00121              << "</head>                                                                   " << "\n"
00122              << "                                                                          " << "\n"
00123              << "<body bgcolor='#414141'>                                                  " << "\n"
00124              << "                                                                          " << "\n"
00125              << " <center>                                                                 " << "\n"
00126              << "                                                                          " << endl ;
00127   for( int img=1; img<=nImages; img++)
00128   {
00129     stringstream sId, sNm ;
00130     sId.str(""); sId << "binding"   << img ;
00131     sNm.str(""); sNm << "baseImage" << img ;
00132     string sid = sId.str() ;
00133     string snm = sNm.str() ;
00134     innerFrame << "  <div   id          = 'binding'                                                        " << "\n" 
00135                << "         name        = '" << sid << "'>                                                 " << "\n" 
00136                << "   <img  id          = '" << snm << "'                                                  " << "\n" 
00137                << "         name        = '" << snm << "'                                                  " << "\n" 
00138                << "         src         = 'images/EmptyPlot.png'                                           " << "\n" 
00139                << "         alt         = 'picture geometry:800x600'                                       " << "\n" 
00140                << "         onload      = 'RightEmbedded.innerLoading(\"" << sid << "\",\"" << snm << "\")'" << "\n"
00141                << "         onclick     = 'RightEmbedded.innerTransport(event)'                            " << "\n"
00142                << "         onmouseover = 'this.T_SHADOWWIDTH=4;                                           " << "\n"
00143                << "                        this.T_OPACITY    =70;                                          " << "\n"
00144                << "                        this.T_FONTCOLOR  =\"#000000\";                                 " << "\n"
00145                << "                        this.T_WIDTH      =200;                                         " << "\n"
00146                << "                        return escape(\"Click to send to pan/zoom area\")'              " << "\n"
00147                << "         width       = '267'                                                            " << "\n"
00148                << "         height      = '200' />                                                         " << "\n"
00149                << "  </div>                                                                                " << endl ;
00150   }
00151   innerFrame << "                                                                          " << "\n"
00152              << "</center>                                                                 " << "\n"
00153              << "                                                                          " << "\n"
00154              << "<script type = 'text/javascript'                                          " << "\n"
00155              << "        src  = 'js_files/rightEmbedded.js'>                               " << "\n"
00156              << "</script>                                                                 " << "\n"
00157              << "                                                                          " << "\n"
00158              << "<script type='text/javascript'                                            " << "\n"
00159              << "        src ='js_files/wz_tooltip.js'>                                    " << "\n"
00160              << "</script>                                                                 " << "\n"
00161              << "</html>                                                                   " << endl ;
00162   innerFrame.close() ; 
00163 //  cout<<"leaving TMC::create."<<endl;                                                                     
00164 }
00165 
00166 //==============================================================================
00167 // -- Draw Monitor Elements
00168 //
00169 void SiPixelTrackerMapCreator::paintTkMap(MonitorElement * mE) 
00170 {
00171 //  double sts;
00172 //  int    rval, gval, bval, detId;
00173 //  cout<<"Inside SiPixelTrackerMapCreator::paintTkMap: me= "<<mE->getName()<<endl;
00174 }
00175 
00176 //==============================================================================
00177 // -- Browse through monitorable and get values needed by TrackerMap
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 }