CMS 3D CMS Logo

SiStripSummaryCreator Class Reference

#include <DQM/SiStripMonitorClient/interface/SiStripSummaryCreator.h>

List of all members.

Public Member Functions

void createLayout (DQMStore *dqm_store)
void createSummary (DQMStore *dqm_store)
void fillLayout (DQMStore *dqm_store)
int getFrequency ()
bool readConfiguration ()
void setSummaryMENames (std::map< std::string, std::string > &me_names)
 SiStripSummaryCreator ()
virtual ~SiStripSummaryCreator ()

Private Member Functions

void fillGrandSummaryHistos (DQMStore *dqm_store)
void fillHistos (int ival, int istep, std::string htype, MonitorElement *me_src, MonitorElement *me)
void fillSummaryHistos (DQMStore *dqm_store)
MonitorElementgetSummaryME (DQMStore *dqm_store, std::string &name, std::string htype)

Private Attributes

SiStripConfigWriterconfigWriter_
int summaryFrequency_
std::map< std::string,
std::string > 
summaryMEMap


Detailed Description

Definition at line 14 of file SiStripSummaryCreator.h.


Constructor & Destructor Documentation

SiStripSummaryCreator::SiStripSummaryCreator (  ) 

Definition at line 13 of file SiStripSummaryCreator.cc.

References configWriter_, summaryFrequency_, and summaryMEMap.

00013                                              {
00014   edm::LogInfo("SiStripSummaryCreator") << 
00015     " Creating SiStripSummaryCreator " << "\n" ;
00016   summaryMEMap.clear();
00017   configWriter_ = 0;
00018   summaryFrequency_ = -1;
00019 }

SiStripSummaryCreator::~SiStripSummaryCreator (  )  [virtual]

Definition at line 23 of file SiStripSummaryCreator.cc.

References configWriter_, and summaryMEMap.

00023                                               {
00024   edm::LogInfo("SiStripSummaryCreator") << 
00025     " Deleting SiStripSummaryCreator " << "\n" ;
00026   summaryMEMap.clear();
00027   if (configWriter_) delete configWriter_;
00028 }


Member Function Documentation

void SiStripSummaryCreator::createLayout ( DQMStore dqm_store  ) 

Definition at line 302 of file SiStripSummaryCreator.cc.

00302                                                             {
00303   /*  if (configWriter_ == 0) {
00304     configWriter_ = new SiStripConfigWriter();
00305     if (!configWriter_->init()) return;
00306   }
00307   string currDir = dqm_store->pwd();   
00308   if (currDir.find("layer") != string::npos) {
00309     string name = "Default";
00310    configWriter_->createLayout(name);
00311    configWriter_->createRow();
00312     fillLayout(dqm_store);
00313   } else {
00314     vector<string> subdirs = dqm_store->getSubdirs();
00315     for (vector<string>::const_iterator it = subdirs.begin();
00316          it != subdirs.end(); it++) {
00317       dqm_store->cd(*it);
00318       createLayout(dqm_store);
00319       dqm_store->goUp();
00320     }
00321   } 
00322   string fname = "test.xml";
00323   configWriter_->write(fname); 
00324   if (configWriter_) delete configWriter_;
00325   configWriter_ = 0;*/
00326 }

void SiStripSummaryCreator::createSummary ( DQMStore dqm_store  ) 

Definition at line 62 of file SiStripSummaryCreator.cc.

References DQMStore::cd(), fillGrandSummaryHistos(), fillSummaryHistos(), DQMStore::getSubdirs(), DQMStore::goUp(), it, DQMStore::pwd(), and summaryMEMap.

Referenced by SiStripActionExecutor::createSummary(), and SiStripActionExecutor::createSummaryOffline().

00062                                                              {
00063   if (summaryMEMap.size() == 0) return;
00064   string currDir = dqm_store->pwd();
00065   vector<string> subdirs = dqm_store->getSubdirs();
00066   int nmod = 0;
00067   for (vector<string>::const_iterator it = subdirs.begin();
00068        it != subdirs.end(); it++) {
00069     if ( (*it).find("module_") == string::npos) continue;
00070     nmod++;       
00071   }  
00072   if (nmod > 0) {
00073     fillSummaryHistos(dqm_store);
00074   } else {  
00075     for (vector<string>::const_iterator it = subdirs.begin();
00076        it != subdirs.end(); it++) {
00077       dqm_store->cd(*it);
00078       createSummary(dqm_store);
00079       dqm_store->goUp();
00080     }
00081     fillGrandSummaryHistos(dqm_store);
00082   }
00083 }

void SiStripSummaryCreator::fillGrandSummaryHistos ( DQMStore dqm_store  )  [private]

Definition at line 131 of file SiStripSummaryCreator.cc.

References DQMStore::cd(), fillHistos(), DQMStore::getContents(), MonitorElement::getName(), MonitorElement::getNbinsX(), DQMStore::getSubdirs(), getSummaryME(), DQMStore::goUp(), it, me, name, DQMStore::pwd(), and summaryMEMap.

Referenced by createSummary().

00131                                                                       {
00132   map<string, MonitorElement*> MEMap;
00133   string currDir = dqm_store->pwd();
00134   string dir_name =  currDir.substr(currDir.find_last_of("/")+1);
00135   if ((dir_name.find("SiStrip") == 0) ||
00136       (dir_name.find("Collector") == 0) ||
00137       (dir_name.find("MechanicalView") == 0) ||
00138       (dir_name.find("FU") == 0) ) return;
00139   vector<string> subdirs = dqm_store->getSubdirs();
00140   if (subdirs.size() == 0) return;;
00141   for (map<string,string>::const_iterator isum = summaryMEMap.begin();
00142        isum != summaryMEMap.end(); isum++) {
00143     string name, summary_name;
00144     name = isum->first;
00145     if (isum->second == "sum" || isum->second == "sum")    
00146       summary_name = "Summary_" + isum->first;
00147     else 
00148       summary_name = "Summary_Mean" + isum->first;
00149     string htype = isum->second;
00150     int ibinStep =0;
00151     for (vector<string>::const_iterator it = subdirs.begin();
00152          it != subdirs.end(); it++) {
00153       dqm_store->cd(*it);
00154       vector<MonitorElement*> contents = dqm_store->getContents(dqm_store->pwd());
00155       dqm_store->goUp();
00156       for (vector<MonitorElement *>::const_iterator im = contents.begin();
00157                 im != contents.end(); im++) {
00158         MonitorElement * me_i = (*im);
00159         if (!me_i) continue;
00160         string name_i = me_i->getName();
00161         if (name_i.find((summary_name)) != string::npos) {
00162           
00163           map<string, MonitorElement*>::iterator iPos = MEMap.find(name); 
00164           MonitorElement* me; 
00165           if (iPos == MEMap.end()) {
00166             if (htype == "sum" || htype == "Sum") {
00167               me = getSummaryME(dqm_store, name, htype);
00168             } else {
00169               me = getSummaryME(dqm_store, name, "bin-by-bin");              
00170             }
00171             MEMap.insert(pair<string, MonitorElement*>(name, me));
00172           } else  me =  iPos->second;
00173           if (htype == "sum" || htype == "Sum") {
00174             fillHistos(0, ibinStep, htype, me_i, me);
00175           } else {
00176             fillHistos(0, ibinStep,"bin-by-bin", me_i, me);
00177           }
00178           ibinStep += me_i->getNbinsX();
00179           break;
00180         }
00181       }
00182     }
00183   }
00184 }

void SiStripSummaryCreator::fillHistos ( int  ival,
int  istep,
std::string  htype,
MonitorElement me_src,
MonitorElement me 
) [private]

Referenced by fillGrandSummaryHistos(), and fillSummaryHistos().

void SiStripSummaryCreator::fillLayout ( DQMStore dqm_store  ) 

void SiStripSummaryCreator::fillSummaryHistos ( DQMStore dqm_store  )  [private]

Definition at line 87 of file SiStripSummaryCreator.cc.

References DQMStore::cd(), fillHistos(), DQMStore::getContents(), MonitorElement::getName(), MonitorElement::getNbinsX(), DQMStore::getSubdirs(), getSummaryME(), DQMStore::goUp(), it, me, name, DQMStore::pwd(), and summaryMEMap.

Referenced by createSummary().

00087                                                                  {
00088   string currDir = dqm_store->pwd();
00089   map<string, MonitorElement*> MEMap;
00090   vector<string> subdirs = dqm_store->getSubdirs();
00091   if (subdirs.size() ==0) return;
00092   
00093 
00094   for (map<string,string>::const_iterator isum = summaryMEMap.begin();
00095        isum != summaryMEMap.end(); isum++) {    
00096     string name = isum->first;
00097     int iBinStep = 0;
00098     int ndet = 0;
00099     string htype = isum->second;
00100     for (vector<string>::const_iterator it = subdirs.begin();
00101          it != subdirs.end(); it++) {
00102       if ( (*it).find("module_") == string::npos) continue;
00103       dqm_store->cd(*it);
00104       ndet++;
00105       vector<MonitorElement*> contents = dqm_store->getContents(dqm_store->pwd());
00106       dqm_store->goUp();
00107       for (vector<MonitorElement *>::const_iterator im = contents.begin();
00108                 im != contents.end(); im++) {
00109         MonitorElement * me_i = (*im);
00110         if (!me_i) continue;
00111         string name_i = me_i->getName();
00112         if (name_i.find(name) == string::npos) continue;
00113         map<string, MonitorElement*>::iterator iPos = MEMap.find(name); 
00114         MonitorElement* me;
00115         // Get the Summary ME
00116         if (iPos == MEMap.end()){
00117             me = getSummaryME(dqm_store, name, htype);
00118             MEMap.insert(pair<string, MonitorElement*>(name, me));
00119         } else  me =  iPos->second;
00120         // Fill it now
00121         fillHistos(ndet, iBinStep, htype, me_i, me); 
00122         iBinStep += me_i->getNbinsX();
00123         break;
00124       }
00125     }
00126   }
00127 }

int SiStripSummaryCreator::getFrequency (  )  [inline]

Definition at line 27 of file SiStripSummaryCreator.h.

References summaryFrequency_.

Referenced by SiStripActionExecutor::readConfiguration().

00027 { return summaryFrequency_;}

MonitorElement* SiStripSummaryCreator::getSummaryME ( DQMStore dqm_store,
std::string &  name,
std::string  htype 
) [private]

Referenced by fillGrandSummaryHistos(), and fillSummaryHistos().

bool SiStripSummaryCreator::readConfiguration (  ) 

Definition at line 32 of file SiStripSummaryCreator.cc.

References GenMuonPlsPt100GeV_cfg::cout, DQMParserBase::getDocument(), SiStripConfigParser::getFrequencyForSummary(), SiStripConfigParser::getMENamesForSummary(), summaryFrequency_, and summaryMEMap.

Referenced by SiStripActionExecutor::readConfiguration().

00032                                               {
00033     summaryMEMap.clear();
00034   SiStripConfigParser config_parser;
00035   string localPath = string("DQM/SiStripMonitorClient/data/sistrip_monitorelement_config.xml");
00036   config_parser.getDocument(edm::FileInPath(localPath).fullPath());
00037   if (!config_parser.getFrequencyForSummary(summaryFrequency_)){
00038     cout << "SiStripSummaryCreator::readConfiguration: Failed to read Summary configuration parameters!! ";
00039     summaryFrequency_ = -1;
00040     return false;
00041   }  
00042   if (!config_parser.getMENamesForSummary(summaryMEMap)) {
00043     cout << "SiStripSummaryCreator::readConfiguration: Failed to read Summary configuration parameters!! ";
00044     return false;
00045   }
00046   return true;
00047 }

void SiStripSummaryCreator::setSummaryMENames ( std::map< std::string, std::string > &  me_names  ) 


Member Data Documentation

SiStripConfigWriter* SiStripSummaryCreator::configWriter_ [private]

Definition at line 43 of file SiStripSummaryCreator.h.

Referenced by SiStripSummaryCreator(), and ~SiStripSummaryCreator().

int SiStripSummaryCreator::summaryFrequency_ [private]

Definition at line 44 of file SiStripSummaryCreator.h.

Referenced by getFrequency(), readConfiguration(), and SiStripSummaryCreator().

std::map<std::string, std::string> SiStripSummaryCreator::summaryMEMap [private]

Definition at line 40 of file SiStripSummaryCreator.h.

Referenced by createSummary(), fillGrandSummaryHistos(), fillSummaryHistos(), readConfiguration(), SiStripSummaryCreator(), and ~SiStripSummaryCreator().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:32:34 2009 for CMSSW by  doxygen 1.5.4