CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripBadComponentsDQMService Class Reference

#include <SiStripBadComponentsDQMService.h>

Inheritance diagram for SiStripBadComponentsDQMService:
SiStripCondObjBuilderBase< SiStripBadStrip >

Public Member Functions

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

Private Member Functions

void getModuleFolderList (DQMStore *dqm_store, std::vector< std::string > &mfolders)
 
uint32_t getRunNumber () const
 
bool goToDir (DQMStore *dqm_store, std::string name)
 
void openRequestedFile ()
 
void readBadComponents ()
 

Private Attributes

DQMStoredqmStore_
 
edm::FileInPath fp_
 
edm::ParameterSet iConfig_
 
bool notAlreadyRead_
 

Additional Inherited Members

- Protected Attributes inherited from SiStripCondObjBuilderBase< SiStripBadStrip >
edm::ParameterSet _pset
 
SiStripBadStripobj_
 

Detailed Description

Author
M. De Mattia, S. Dutta, D. Giordano to read modules flagged by the DQM as bad and write in the database.

Definition at line 22 of file SiStripBadComponentsDQMService.h.

Constructor & Destructor Documentation

SiStripBadComponentsDQMService::SiStripBadComponentsDQMService ( const edm::ParameterSet iConfig,
const edm::ActivityRegistry aReg 
)
explicit

Definition at line 14 of file SiStripBadComponentsDQMService.cc.

References SiStripCondObjBuilderBase< SiStripBadStrip >::obj_.

14  :
16  iConfig_(iConfig),
17  fp_(iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))),
18  notAlreadyRead_(true)
19 {
20  obj_ = 0;
21  edm::LogInfo("SiStripBadComponentsDQMService") << "[SiStripBadComponentsDQMService::SiStripBadComponentsDQMService]";
22 }
T getUntrackedParameter(std::string const &, T const &) const
SiStripCondObjBuilderBase(const edm::ParameterSet &pset)
SiStripBadComponentsDQMService::~SiStripBadComponentsDQMService ( )

Definition at line 24 of file SiStripBadComponentsDQMService.cc.

25 {
26  edm::LogInfo("SiStripBadComponentsDQMService") << "[SiStripBadComponentsDQMService::~SiStripBadComponentsDQMService]";
27 }

Member Function Documentation

bool SiStripBadComponentsDQMService::checkForCompatibility ( std::string  ss)
virtual

Check is the transfer is needed.

Reimplemented from SiStripCondObjBuilderBase< SiStripBadStrip >.

Definition at line 36 of file SiStripBadComponentsDQMService.cc.

References getMetaDataString().

37 {
38  std::stringstream localString;
39  getMetaDataString(localString);
40  if( ss == localString.str() ) return false;
41 
42  return true;
43 }
void getMetaDataString(std::stringstream &ss)
Used to fill the logDB.
void SiStripBadComponentsDQMService::getMetaDataString ( std::stringstream &  ss)
virtual
void SiStripBadComponentsDQMService::getModuleFolderList ( DQMStore dqm_store,
std::vector< std::string > &  mfolders 
)
private

Definition at line 167 of file SiStripBadComponentsDQMService.cc.

References DQMStore::cd(), DQMStore::getSubdirs(), DQMStore::goUp(), DQMStore::pwd(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by readBadComponents().

168 {
169  std::string currDir = dqm_store->pwd();
170  if (currDir.find("module_") != std::string::npos) {
171  // std::string mId = currDir.substr(currDir.find("module_")+7, 9);
172  mfolders.push_back(currDir);
173  } else {
174  std::vector<std::string> subdirs = dqm_store->getSubdirs();
175  for( std::vector<std::string>::const_iterator it = subdirs.begin();
176  it != subdirs.end(); ++it) {
177  dqm_store->cd(*it);
178  getModuleFolderList(dqm_store, mfolders);
179  dqm_store->goUp();
180  }
181  }
182 }
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1644
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:632
void getModuleFolderList(DQMStore *dqm_store, std::vector< std::string > &mfolders)
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:666
const std::string & pwd(void) const
Definition: DQMStore.cc:627
void SiStripBadComponentsDQMService::getObj ( SiStripBadStrip *&  obj)
inlinevirtual
uint32_t SiStripBadComponentsDQMService::getRunNumber ( ) const
private

Definition at line 145 of file SiStripBadComponentsDQMService.cc.

References edm::ParameterSet::getParameter(), and iConfig_.

Referenced by getMetaDataString().

145  {
146  edm::LogInfo("SiStripBadComponentsDQMService") << "[SiStripBadComponentsDQMService::getRunNumber] " << iConfig_.getParameter<uint32_t>("RunNb");
147  return iConfig_.getParameter<uint32_t>("RunNb");
148 }
T getParameter(std::string const &) const
bool SiStripBadComponentsDQMService::goToDir ( DQMStore dqm_store,
std::string  name 
)
private

Definition at line 150 of file SiStripBadComponentsDQMService.cc.

References DQMStore::cd(), TrackerOfflineValidation_Dqm_cff::dirName, DQMStore::getSubdirs(), DQMStore::goUp(), DQMStore::pwd(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by readBadComponents().

151 {
152  std::string currDir = dqm_store->pwd();
153  std::string dirName = currDir.substr(currDir.find_last_of("/")+1);
154  if (dirName.find(name) == 0) {
155  return true;
156  }
157  std::vector<std::string> subDirVec = dqm_store->getSubdirs();
158  for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
159  ic != subDirVec.end(); ic++) {
160  dqm_store->cd(*ic);
161  if (!goToDir(dqm_store, name)) dqm_store->goUp();
162  else return true;
163  }
164  return false;
165 }
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1644
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:632
bool goToDir(DQMStore *dqm_store, std::string name)
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:666
const std::string & pwd(void) const
Definition: DQMStore.cc:627
void SiStripBadComponentsDQMService::openRequestedFile ( )
private

Definition at line 126 of file SiStripBadComponentsDQMService.cc.

References dqmStore_, convertXMLtoSQLite_cfg::fileName, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), iConfig_, DQMStore::open(), cppFunctionSkipper::operator, DQMStore::setVerbose(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by readBadComponents().

127 {
129 
130  // ** FIXME ** //
131  dqmStore_->setVerbose(0); //add config param
132 
133  if( iConfig_.getParameter<bool>("accessDQMFile") ){
134 
136 
137  edm::LogInfo("SiStripBadComponentsDQMService") << "[SiStripBadComponentsDQMService::openRequestedFile] Accessing root File" << fileName;
138 
139  dqmStore_->open(fileName, false);
140  } else {
141  edm::LogInfo("SiStripBadComponentsDQMService") << "[SiStripBadComponentsDQMService::openRequestedFile] Accessing dqmStore stream in Online Operation";
142  }
143 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setVerbose(unsigned level)
Definition: DQMStore.cc:619
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:2840
void SiStripBadComponentsDQMService::readBadComponents ( )
private

Definition at line 45 of file SiStripBadComponentsDQMService.cc.

References DQMStore::cd(), gather_cfg::cout, DQMStore::dirExists(), RefreshWebPage::dname, dqmStore_, SiStripBadStrip::encode(), archive::flag, fp_, edm::FileInPath::fullPath(), DQMStore::getContents(), getModuleFolderList(), goToDir(), LogDebug, notAlreadyRead_, SiStripCondObjBuilderBase< SiStripBadStrip >::obj_, openRequestedFile(), SiStripBadStrip::put(), DQMStore::pwd(), matplotRender::reader, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getMetaDataString(), and getObj().

46 {
47  // Do this only if it was not already read
48  if( notAlreadyRead_ ) {
49  //*LOOP OVER THE LIST OF SUMMARY OBJECTS TO INSERT IN DB*//
50 
52 
53  std::cout << "[readBadComponents]: opened requested file" << std::endl;
54 
55  obj_=new SiStripBadStrip();
56 
58 
59  dqmStore_->cd();
60 
61  std::string mdir = "MechanicalView";
62  if (!goToDir(dqmStore_, mdir)) return;
63  std::string mechanicalview_dir = dqmStore_->pwd();
64 
65  std::vector<std::string> subdet_folder;
66  subdet_folder.push_back("TIB");
67  subdet_folder.push_back("TOB");
68  subdet_folder.push_back("TEC/side_1");
69  subdet_folder.push_back("TEC/side_2");
70  subdet_folder.push_back("TID/side_1");
71  subdet_folder.push_back("TID/side_2");
72 
73  int nDetsTotal = 0;
74  int nDetsWithErrorTotal = 0;
75  for( std::vector<std::string>::const_iterator im = subdet_folder.begin(); im != subdet_folder.end(); ++im ) {
76  std::string dname = mechanicalview_dir + "/" + (*im);
77  if (!dqmStore_->dirExists(dname)) continue;
78 
79  dqmStore_->cd(dname);
80  std::vector<std::string> module_folders;
81  getModuleFolderList(dqmStore_, module_folders);
82  int nDets = module_folders.size();
83 
84  int nDetsWithError = 0;
85  std::string bad_module_folder = dname + "/" + "BadModuleList";
86  if (dqmStore_->dirExists(bad_module_folder)) {
87  std::vector<MonitorElement *> meVec = dqmStore_->getContents(bad_module_folder);
88  for( std::vector<MonitorElement *>::const_iterator it = meVec.begin(); it != meVec.end(); ++it ) {
89  nDetsWithError++;
90  std::cout << (*it)->getName() << " " << (*it)->getIntValue() << std::endl;
91  uint32_t detId = boost::lexical_cast<uint32_t>((*it)->getName());
92  short flag = (*it)->getIntValue();
93 
94  std::vector<unsigned int> theSiStripVector;
95 
96  unsigned short firstBadStrip=0, NconsecutiveBadStrips=0;
97  unsigned int theBadStripRange;
98 
99  // for(std::vector<uint32_t>::const_iterator is=BadApvList_.begin(); is!=BadApvList_.end(); ++is){
100 
101  // firstBadStrip=(*is)*128;
102  NconsecutiveBadStrips=reader.getNumberOfApvsAndStripLength(detId).first*128;
103 
104  theBadStripRange = obj_->encode(firstBadStrip,NconsecutiveBadStrips,flag);
105 
106  LogDebug("SiStripBadComponentsDQMService") << "detid " << detId << " \t"
107  << ", flag " << flag
108  << std::endl;
109 
110  theSiStripVector.push_back(theBadStripRange);
111  // }
112 
113  SiStripBadStrip::Range range(theSiStripVector.begin(),theSiStripVector.end());
114  if ( !obj_->put(detId,range) ) {
115  edm::LogError("SiStripBadFiberBuilder")<<"[SiStripBadFiberBuilder::analyze] detid already exists"<<std::endl;
116  }
117  }
118  }
119  nDetsTotal += nDets;
120  nDetsWithErrorTotal += nDetsWithError;
121  }
122  dqmStore_->cd();
123  }
124 }
#define LogDebug(id)
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:632
void getModuleFolderList(DQMStore *dqm_store, std::vector< std::string > &mfolders)
bool goToDir(DQMStore *dqm_store, std::string name)
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1722
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:720
std::pair< ContainerIterator, ContainerIterator > Range
tuple cout
Definition: gather_cfg.py:121
std::string fullPath() const
Definition: FileInPath.cc:165
bool put(const uint32_t &detID, const InputVector &vect)
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
const std::string & pwd(void) const
Definition: DQMStore.cc:627

Member Data Documentation

DQMStore* SiStripBadComponentsDQMService::dqmStore_
private

Definition at line 45 of file SiStripBadComponentsDQMService.h.

Referenced by openRequestedFile(), and readBadComponents().

edm::FileInPath SiStripBadComponentsDQMService::fp_
private

Definition at line 48 of file SiStripBadComponentsDQMService.h.

Referenced by readBadComponents().

edm::ParameterSet SiStripBadComponentsDQMService::iConfig_
private

Definition at line 47 of file SiStripBadComponentsDQMService.h.

Referenced by getRunNumber(), and openRequestedFile().

bool SiStripBadComponentsDQMService::notAlreadyRead_
private

Definition at line 50 of file SiStripBadComponentsDQMService.h.

Referenced by readBadComponents().