CMS 3D CMS Logo

Classes | Public Member Functions | Protected Member Functions | Protected Attributes

SiStripBaseServiceFromDQM< T > Class Template Reference

#include <SiStripBaseServiceFromDQM.h>

Inheritance diagram for SiStripBaseServiceFromDQM< T >:
SiStripCondObjBuilderBase< T >

List of all members.

Classes

struct  StringNotMatch

Public Member Functions

virtual bool checkForCompatibility (std::string ss)
 Check is the transfer is needed.
virtual void getMetaDataString (std::stringstream &ss)
 Used to fill the logDB.
 SiStripBaseServiceFromDQM (const edm::ParameterSet &)
virtual ~SiStripBaseServiceFromDQM ()

Protected Member Functions

void getModuleFolderList (std::vector< std::string > &mfolders)
 Fill the mfolders vector with the full list of directories for all the modules.
MonitorElementgetModuleHistogram (const uint32_t detId, const std::string &name)
uint32_t getRunNumber () const
 Returns the run number from the cfg.
bool goToDir (const std::string &name)
 Uses DQM utilities to access the requested dir.
void openRequestedFile ()
 Uses DQMStore to access the DQM file.

Protected Attributes

DQMStoredqmStore_
boost::shared_ptr
< SiStripFolderOrganizer
folderOrganizer_
edm::ParameterSet iConfig_

Detailed Description

template<class T>
class SiStripBaseServiceFromDQM< T >

Author:
M. De Mattia @ Base class for methods shared between all services reading from DQM and writing in the Database.

Definition at line 30 of file SiStripBaseServiceFromDQM.h.


Constructor & Destructor Documentation

template<class T >
SiStripBaseServiceFromDQM< T >::SiStripBaseServiceFromDQM ( const edm::ParameterSet iConfig) [explicit]

Definition at line 82 of file SiStripBaseServiceFromDQM.h.

References SiStripCondObjBuilderBase< T >::obj_.

                                                                                     :
  SiStripCondObjBuilderBase<T>::SiStripCondObjBuilderBase(iConfig),
  iConfig_(iConfig),
  folderOrganizer_(boost::shared_ptr<SiStripFolderOrganizer>(new SiStripFolderOrganizer))
{
  // Needed because this is a template inheriting from another template, so it cannot
  // access directly unnamed (independent from the template parameters) members.
  this->obj_ = 0;
}
template<class T >
SiStripBaseServiceFromDQM< T >::~SiStripBaseServiceFromDQM ( ) [virtual]

Definition at line 93 of file SiStripBaseServiceFromDQM.h.

{
}

Member Function Documentation

template<class T >
bool SiStripBaseServiceFromDQM< T >::checkForCompatibility ( std::string  ss) [virtual]

Check is the transfer is needed.

Reimplemented from SiStripCondObjBuilderBase< T >.

Definition at line 197 of file SiStripBaseServiceFromDQM.h.

{
  std::stringstream localString;
  getMetaDataString(localString);
  if( ss == localString.str() ) return false;

  return true;
}
template<class T >
void SiStripBaseServiceFromDQM< T >::getMetaDataString ( std::stringstream &  ss) [virtual]

Used to fill the logDB.

Reimplemented from SiStripCondObjBuilderBase< T >.

Definition at line 190 of file SiStripBaseServiceFromDQM.h.

References gather_cfg::cout.

{
  std::cout << "SiStripPedestalsDQMService::getMetaDataString" << std::endl;
  ss << "Run " << getRunNumber() << std::endl;
}
template<class T >
void SiStripBaseServiceFromDQM< T >::getModuleFolderList ( std::vector< std::string > &  mfolders) [protected]

Fill the mfolders vector with the full list of directories for all the modules.

Definition at line 141 of file SiStripBaseServiceFromDQM.h.

{
  std::string currDir = dqmStore_->pwd();
  if (currDir.find("module_") != std::string::npos)  {
    //    std::string mId = currDir.substr(currDir.find("module_")+7, 9);
    mfolders.push_back(currDir);
  } else {
    std::vector<std::string> subdirs = dqmStore_->getSubdirs();
    for( std::vector<std::string>::const_iterator it = subdirs.begin();
         it != subdirs.end(); ++it) {
      dqmStore_->cd(*it);
      getModuleFolderList(mfolders);
      dqmStore_->goUp();
    }
  }
}
template<class T>
MonitorElement* SiStripBaseServiceFromDQM< T >::getModuleHistogram ( const uint32_t  detId,
const std::string &  name 
) [protected]

Returns a pointer to the monitoring element corresponding to the given detId and name.
The name convention for module histograms is NAME__det__DETID. The name provided must be NAME, removing all the __det__DETID part. This latter part will be built and attached internally using the provided detId.

template<class T >
uint32_t SiStripBaseServiceFromDQM< T >::getRunNumber ( ) const [protected]

Returns the run number from the cfg.

Definition at line 183 of file SiStripBaseServiceFromDQM.h.

{
  edm::LogInfo("SiStripBaseServiceFromDQM") <<  "[SiStripBaseServiceFromDQM::getRunNumber] " << iConfig_.getParameter<uint32_t>("RunNb");
  return iConfig_.getParameter<uint32_t>("RunNb");
}
template<class T >
bool SiStripBaseServiceFromDQM< T >::goToDir ( const std::string &  name) [protected]

Uses DQM utilities to access the requested dir.

Definition at line 118 of file SiStripBaseServiceFromDQM.h.

References TrackerOfflineValidation_Dqm_cff::dirName.

{
  std::string currDir = dqmStore_->pwd();
  std::string dirName = currDir.substr(currDir.find_last_of("/")+1);
  // Protection vs directories written with a trailing "/"
  if( dirName.length() == 0 ) {
    std::string currDirCopy(currDir, 0, currDir.length()-1);
    dirName = currDirCopy.substr(currDirCopy.find_last_of("/")+1);
  }
  if (dirName.find(name) == 0) {
    return true;
  }
  std::vector<std::string> subDirVec = dqmStore_->getSubdirs();
  for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
       ic != subDirVec.end(); ic++) {
    dqmStore_->cd(*ic);
    if (!goToDir(name))  dqmStore_->goUp();
    else return true;
  }
  return false;
}
template<class T >
void SiStripBaseServiceFromDQM< T >::openRequestedFile ( ) [protected]

Uses DQMStore to access the DQM file.

Definition at line 98 of file SiStripBaseServiceFromDQM.h.

References convertXMLtoSQLite_cfg::fileName, and cmsCodeRules::cppFunctionSkipper::operator.

{
  dqmStore_ = edm::Service<DQMStore>().operator->();

  // ** FIXME ** // 
  dqmStore_->setVerbose(0); //add config param

  if( iConfig_.getParameter<bool>("accessDQMFile") ){
    
    std::string fileName = iConfig_.getUntrackedParameter<std::string>("FILE_NAME","");
    
    edm::LogInfo("SiStripBaseServiceFromDQM") <<  "[SiStripBaseServiceFromDQM::openRequestedFile] Accessing root File" << fileName;

    dqmStore_->open(fileName, false); 
  } else {
    edm::LogInfo("SiStripBaseServiceFromDQM") <<  "[SiStripBaseServiceFromDQM::openRequestedFile] Accessing dqmStore stream in Online Operation";
  }
}

Member Data Documentation

template<class T>
DQMStore* SiStripBaseServiceFromDQM< T >::dqmStore_ [protected]

Definition at line 60 of file SiStripBaseServiceFromDQM.h.

template<class T>
boost::shared_ptr<SiStripFolderOrganizer> SiStripBaseServiceFromDQM< T >::folderOrganizer_ [protected]

Definition at line 62 of file SiStripBaseServiceFromDQM.h.

template<class T>
edm::ParameterSet SiStripBaseServiceFromDQM< T >::iConfig_ [protected]