CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Protected Member Functions | Protected Attributes
SiStripBaseServiceFromDQM< T > Class Template Reference

#include <SiStripBaseServiceFromDQM.h>

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

Classes

struct  StringNotMatch
 

Public Member Functions

virtual bool checkForCompatibility (std::string ss)
 Check is the transfer is needed. More...
 
virtual void getMetaDataString (std::stringstream &ss)
 Used to fill the logDB. More...
 
 SiStripBaseServiceFromDQM (const edm::ParameterSet &)
 
virtual ~SiStripBaseServiceFromDQM ()
 
- Public Member Functions inherited from SiStripCondObjBuilderBase< T >
virtual void getObj (T *&obj)
 
virtual void initialize ()
 
 SiStripCondObjBuilderBase (const edm::ParameterSet &pset)
 
virtual ~SiStripCondObjBuilderBase ()
 

Protected Member Functions

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

Protected Attributes

DQMStoredqmStore_
 
boost::shared_ptr
< SiStripFolderOrganizer
folderOrganizer_
 
edm::ParameterSet iConfig_
 
- Protected Attributes inherited from SiStripCondObjBuilderBase< T >
edm::ParameterSet _pset
 
Tobj_
 

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_.

82  :
84  iConfig_(iConfig),
85  folderOrganizer_(boost::shared_ptr<SiStripFolderOrganizer>(new SiStripFolderOrganizer))
86 {
87  // Needed because this is a template inheriting from another template, so it cannot
88  // access directly unnamed (independent from the template parameters) members.
89  this->obj_ = 0;
90 }
boost::shared_ptr< SiStripFolderOrganizer > folderOrganizer_
SiStripCondObjBuilderBase(const edm::ParameterSet &pset)
template<class T >
SiStripBaseServiceFromDQM< T >::~SiStripBaseServiceFromDQM ( )
virtual

Definition at line 93 of file SiStripBaseServiceFromDQM.h.

94 {
95 }

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.

198 {
199  std::stringstream localString;
200  getMetaDataString(localString);
201  if( ss == localString.str() ) return false;
202 
203  return true;
204 }
virtual void getMetaDataString(std::stringstream &ss)
Used to fill the logDB.
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.

191 {
192  std::cout << "SiStripPedestalsDQMService::getMetaDataString" << std::endl;
193  ss << "Run " << getRunNumber() << std::endl;
194 }
uint32_t getRunNumber() const
Returns the run number from the cfg.
tuple cout
Definition: gather_cfg.py:121
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.

142 {
143  std::string currDir = dqmStore_->pwd();
144  if (currDir.find("module_") != std::string::npos) {
145  // std::string mId = currDir.substr(currDir.find("module_")+7, 9);
146  mfolders.push_back(currDir);
147  } else {
148  std::vector<std::string> subdirs = dqmStore_->getSubdirs();
149  for( std::vector<std::string>::const_iterator it = subdirs.begin();
150  it != subdirs.end(); ++it) {
151  dqmStore_->cd(*it);
152  getModuleFolderList(mfolders);
153  dqmStore_->goUp();
154  }
155  }
156 }
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1419
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:406
void getModuleFolderList(std::vector< std::string > &mfolders)
Fill the mfolders vector with the full list of directories for all the modules.
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:440
const std::string & pwd(void) const
Definition: DQMStore.cc:401
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.

184 {
185  edm::LogInfo("SiStripBaseServiceFromDQM") << "[SiStripBaseServiceFromDQM::getRunNumber] " << iConfig_.getParameter<uint32_t>("RunNb");
186  return iConfig_.getParameter<uint32_t>("RunNb");
187 }
T getParameter(std::string const &) const
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.

119 {
120  std::string currDir = dqmStore_->pwd();
121  std::string dirName = currDir.substr(currDir.find_last_of("/")+1);
122  // Protection vs directories written with a trailing "/"
123  if( dirName.length() == 0 ) {
124  std::string currDirCopy(currDir, 0, currDir.length()-1);
125  dirName = currDirCopy.substr(currDirCopy.find_last_of("/")+1);
126  }
127  if (dirName.find(name) == 0) {
128  return true;
129  }
130  std::vector<std::string> subDirVec = dqmStore_->getSubdirs();
131  for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
132  ic != subDirVec.end(); ic++) {
133  dqmStore_->cd(*ic);
134  if (!goToDir(name)) dqmStore_->goUp();
135  else return true;
136  }
137  return false;
138 }
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1419
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:406
bool goToDir(const std::string &name)
Uses DQM utilities to access the requested dir.
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:440
const std::string & pwd(void) const
Definition: DQMStore.cc:401
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 cppFunctionSkipper::operator.

99 {
101 
102  // ** FIXME ** //
103  dqmStore_->setVerbose(0); //add config param
104 
105  if( iConfig_.getParameter<bool>("accessDQMFile") ){
106 
107  std::string fileName = iConfig_.getUntrackedParameter<std::string>("FILE_NAME","");
108 
109  edm::LogInfo("SiStripBaseServiceFromDQM") << "[SiStripBaseServiceFromDQM::openRequestedFile] Accessing root File" << fileName;
110 
111  dqmStore_->open(fileName, false);
112  } else {
113  edm::LogInfo("SiStripBaseServiceFromDQM") << "[SiStripBaseServiceFromDQM::openRequestedFile] Accessing dqmStore stream in Online Operation";
114  }
115 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setVerbose(unsigned level)
Definition: DQMStore.cc:393
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:2432

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

Definition at line 61 of file SiStripBaseServiceFromDQM.h.