CMS 3D CMS Logo

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

#include <CaloOnlineTools/HcalOnlineDb/interface/HcalChannelQualityXml.h>

Inheritance diagram for HcalChannelQualityXml:
HcalChannelDataXml XMLDOMBlock

Classes

struct  _ChannelQuality
 

Public Types

typedef struct
HcalChannelQualityXml::_ChannelQuality 
ChannelQuality
 

Public Member Functions

DOMElement * add_data (DOMNode *_dataset, int _channel_status, int _on_off, std::string _comment)
 
DOMNode * add_hcal_channel_dataset (int ieta, int iphi, int depth, std::string subdetector, int _channel_status, int _on_off, std::string _comment)
 
int addChannelQualityGeom (std::map< int, ChannelQuality > &_cq)
 
int addChannelToGeomIdMap (int ieta, int iphi, int depth, std::string subdetector, int _channel_status, int _on_off, std::string _comment)
 
int dumpIovsFromOmdsToStdout (std::string tag)
 
int dumpTagsFromOmdsToStdout (void)
 
int getBaseLineFromOmds (std::string _tag, int _iov_begin)
 
std::vector< int > getIovsFromOmds (std::string tag)
 
std::vector< std::string > getTagsFromOmds (void)
 
 HcalChannelQualityXml ()
 
int makeXmlFromAsciiStream (int _runnumber, int _iov_begin, int _iov_end, std::string _tag, std::string _elements_comment, std::string _base="hex")
 
int readStatusWordFromStdin (std::string base="hex")
 
int set_all_channels_on_off (int _hb, int _he, int _hf, int _ho)
 
int set_all_channels_status (uint32_t _hb, uint32_t _he, uint32_t _hf, uint32_t _ho)
 
int writeBaseLineFromOmdsToStdout (std::string _tag, int _iov_begin, std::string base="hex")
 
int writeStatusWordToStdout (std::string base="hex")
 
virtual ~HcalChannelQualityXml ()
 
- Public Member Functions inherited from HcalChannelDataXml
DOMNode * add_dataset (void)
 
DOMNode * add_hcal_channel (DOMNode *_dataset, int ieta, int iphi, int depth, std::string subdetector)
 
DOMElement * get_channel_element (DOMNode *_dataset)
 
DOMElement * get_data_element (DOMNode *_dataset)
 
 HcalChannelDataXml ()
 
int init_data (void)
 
DOMNode * set_elements_comment (std::string value)
 
DOMNode * set_elements_dataset_id (int id)
 
DOMNode * set_elements_detector_name (std::string value)
 
DOMNode * set_elements_iov_begin (int value)
 
DOMNode * set_elements_iov_end (int value)
 
DOMNode * set_elements_iov_id (int id)
 
DOMNode * set_elements_tag_id (int value)
 
DOMNode * set_elements_tag_mode (std::string value)
 
DOMNode * set_elements_tag_name (std::string value)
 
DOMNode * set_header_channel_map (std::string name)
 
DOMNode * set_header_run_number (int run)
 
DOMNode * set_header_table_name (std::string name)
 
DOMNode * set_header_type (std::string type)
 
DOMNode * set_maps_dataset_idref (int value)
 
DOMNode * set_maps_iov_idref (int value)
 
DOMNode * set_maps_tag_idref (int value)
 
virtual ~HcalChannelDataXml ()
 
- Public Member Functions inherited from XMLDOMBlock
DOMElement * add_element (DOMElement *parent, XMLCh *tagname, XMLCh *value)
 
DOMDocument * getDocument (void)
 
DOMDocument * getDocumentConst (void) const
 
DOMDocument * getNewDocument (std::string xmlFileName)
 
std::string & getString (void)
 
std::string & getString (DOMNode *_node)
 
const char * getTagAttribute (const std::string &tagName, const std::string &attrName, int _item=0)
 
const char * getTagValue (const std::string &tagName, int _item=0, DOMDocument *_document=NULL)
 
const char * getTagValue (const std::string &tagName, int _item, DOMElement *_document)
 
std::string getTimestamp (time_t _time)
 
XMLDOMBlockoperator+= (const XMLDOMBlock &other)
 
void parse (InputSource &_source)
 
DOMNode * setTagAttribute (const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
 
DOMNode * setTagAttribute (DOMElement *_elem, const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
 
DOMNode * setTagAttribute (const std::string &tagName, const std::string &attrName, const int &attrValue, int _item=0)
 
DOMNode * setTagAttribute (DOMElement *_elem, const std::string &tagName, const std::string &attrName, const int &attrValue, int _item=0)
 
DOMNode * setTagValue (const std::string &tagName, const std::string &tagValue, int _item=0, DOMDocument *_document=NULL)
 
DOMNode * setTagValue (DOMElement *_elem, const std::string &tagName, const std::string &tagValue, int _item=0)
 
DOMNode * setTagValue (const std::string &tagName, const int &tagValue, int _item=0, DOMDocument *_document=NULL)
 
DOMNode * setTagValue (DOMElement *_elem, const std::string &tagName, const int &tagValue, int _item=0)
 
int write (std::string target="stdout")
 
 XMLDOMBlock ()
 
 XMLDOMBlock (std::string xmlFileName)
 
 XMLDOMBlock (InputSource &_source)
 
 XMLDOMBlock (std::string _root, int rootElementName)
 
virtual ~XMLDOMBlock ()
 

Public Attributes

std::map< int, ChannelQualitydetid_cq
 
std::map< int, ChannelQualitygeomid_cq
 

Private Member Functions

std::string get_random_comment (void)
 

Private Attributes

HcalAssistant hAss
 

Additional Inherited Members

- Protected Member Functions inherited from XMLDOMBlock
int init (std::string _root)
 
- Protected Attributes inherited from HcalChannelDataXml
MemBufInputSource * _dataset
 
MemBufInputSource * _root
 
std::string channel_map
 
std::string comment
 
int data_set_id
 
int data_set_idref
 
std::string dataset_comment
 
int dataset_count
 
std::string detector_name
 
std::string extension_table_name
 
time_t global_timestamp
 
HcalAssistant hcal_ass
 
int iov_begin
 
int iov_end
 
int iov_id
 
int iov_idref
 
int run_number
 
int tag_id
 
int tag_idref
 
std::string tag_mode
 
std::string tag_name
 
std::string type_name
 
std::string username
 
- Protected Attributes inherited from XMLDOMBlock
DOMDocument * document
 
ErrorHandler * errHandler
 
XercesDOMParser * parser
 
std::string * the_string
 
std::string theFileName
 
XMLProcessortheProcessor
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 25 of file HcalChannelQualityXml.h.

Member Typedef Documentation

Constructor & Destructor Documentation

HcalChannelQualityXml::HcalChannelQualityXml ( )

Definition at line 40 of file HcalChannelQualityXml.cc.

References comment.

59 {
60  extension_table_name="HCAL_CHANNEL_QUALITY_V1";
61  type_name="HCAL Channel Quality [V1]";
62  run_number = -1;
63  channel_map = "HCAL_CHANNELS";
64  data_set_id = -1;
65  iov_id = 1;
66  iov_begin = 1;
67  iov_end = -1;
68  tag_id = 2;
69  tag_mode = "auto";
70  tag_name = "test_channel_quality_tag_name";
71  detector_name = "HCAL";
73  tag_idref = 2;
74  iov_idref = 1;
75  data_set_idref = -1;
76  //
77  geomid_cq.clear();
78  detid_cq.clear();
79  //
80  //hAss.getListOfChannelsFromDb();
81  //
82  init_data();
83 }
std::string getRandomQuote(void)
std::string extension_table_name
std::map< int, ChannelQuality > detid_cq
std::map< int, ChannelQuality > geomid_cq
HcalChannelQualityXml::~HcalChannelQualityXml ( )
virtual

Definition at line 86 of file HcalChannelQualityXml.cc.

87 {
88 }

Member Function Documentation

DOMElement * HcalChannelQualityXml::add_data ( DOMNode *  _dataset,
int  _channel_status,
int  _on_off,
std::string  _comment 
)

Definition at line 91 of file HcalChannelQualityXml.cc.

References XMLProcessor::_toXMLCh().

91  {
92  DOMElement * _data_elem = get_data_element(_dataset);
93  add_element(_data_elem, XMLProcessor::_toXMLCh("CHANNEL_STATUS_WORD"), XMLProcessor::_toXMLCh(_channel_status));
94  add_element(_data_elem, XMLProcessor::_toXMLCh("CHANNEL_ON_OFF_STATE"), XMLProcessor::_toXMLCh(_on_off));
95  add_element(_data_elem, XMLProcessor::_toXMLCh("COMMENT_DESCRIPTION"), XMLProcessor::_toXMLCh(_comment));
96  //
97  return _data_elem;
98 }
MemBufInputSource * _dataset
DOMElement * get_data_element(DOMNode *_dataset)
static XMLCh * _toXMLCh(std::string temp)
Definition: XMLProcessor.h:184
DOMElement * add_element(DOMElement *parent, XMLCh *tagname, XMLCh *value)
Definition: XMLDOMBlock.cc:523
DOMNode * HcalChannelQualityXml::add_hcal_channel_dataset ( int  ieta,
int  iphi,
int  depth,
std::string  subdetector,
int  _channel_status,
int  _on_off,
std::string  _comment 
)

Definition at line 101 of file HcalChannelQualityXml.cc.

102  {
103  DOMNode * _dataset = add_dataset();
104  add_hcal_channel(_dataset, ieta, iphi, depth, subdetector);
105  add_data(_dataset, _channel_status, _on_off, _comment);
106  return _dataset;
107 }
MemBufInputSource * _dataset
DOMNode * add_dataset(void)
DOMElement * add_data(DOMNode *_dataset, int _channel_status, int _on_off, std::string _comment)
DOMNode * add_hcal_channel(DOMNode *_dataset, int ieta, int iphi, int depth, std::string subdetector)
int HcalChannelQualityXml::addChannelQualityGeom ( std::map< int, ChannelQuality > &  _cq)

Definition at line 256 of file HcalChannelQualityXml.cc.

256  {
257  int _n_channels = 0;
258  for (std::map<int,ChannelQuality>::const_iterator _chan=_cq.begin();
259  _chan!=_cq.end();
260  _chan++
261  ){
263  hAss.getHcalIphi(_chan->first),
264  hAss.getHcalDepth(_chan->first),
266  _chan->second.status,
267  _chan->second.onoff,
268  _chan->second.comment
269  );
270  _n_channels++;
271  }
272  return _n_channels;
273 }
std::string getSubdetectorString(HcalSubdetector _det)
HcalSubdetector getHcalSubdetector(int _geomId)
int getHcalDepth(int _geomId)
DOMNode * add_hcal_channel_dataset(int ieta, int iphi, int depth, std::string subdetector, int _channel_status, int _on_off, std::string _comment)
int getHcalIeta(int _geomId)
int getHcalIphi(int _geomId)
int HcalChannelQualityXml::addChannelToGeomIdMap ( int  ieta,
int  iphi,
int  depth,
std::string  subdetector,
int  _channel_status,
int  _on_off,
std::string  _comment 
)

Definition at line 276 of file HcalChannelQualityXml.cc.

References HcalChannelQualityXml::_ChannelQuality::comment, HcalChannelQualityXml::_ChannelQuality::onoff, and HcalChannelQualityXml::_ChannelQuality::status.

277  {
278  int _geomId = hAss.getGeomId(hAss.getSubdetector(subdetector),
279  ieta,
280  iphi,
281  depth);
283  _cq.status = _channel_status;
284  _cq.onoff = _on_off;
285  _cq.comment = _comment;
286  if (geomid_cq.find(_geomId)==geomid_cq.end()){
287  geomid_cq.insert(std::pair<int, HcalChannelQualityXml::ChannelQuality>(_geomId,_cq));
288  }
289  else{
290  geomid_cq[_geomId]=_cq;
291  }
292  return 0;
293 }
int getGeomId(HcalSubdetector _det, int _ieta, int _iphi, int _depth)
HcalSubdetector getSubdetector(std::string _det)
std::map< int, ChannelQuality > geomid_cq
int HcalChannelQualityXml::dumpIovsFromOmdsToStdout ( std::string  tag)

Definition at line 454 of file HcalChannelQualityXml.cc.

References gather_cfg::cout.

454  {
455  std::vector<int> _iovs = getIovsFromOmds(tag);
456  for (std::vector<int>::const_iterator tag=_iovs.begin(); tag!=_iovs.end(); tag++){
457  std::cout << *tag << std::endl;
458  }
459  return _iovs.size();
460 }
std::vector< int > getIovsFromOmds(std::string tag)
tuple cout
Definition: gather_cfg.py:121
int HcalChannelQualityXml::dumpTagsFromOmdsToStdout ( void  )

Definition at line 412 of file HcalChannelQualityXml.cc.

References gather_cfg::cout, and GlobalPosition_Frontier_DevDB_cff::tag.

412  {
413  std::vector<std::string> _tags = getTagsFromOmds();
414  for (std::vector<std::string>::const_iterator tag=_tags.begin(); tag!=_tags.end(); tag++){
415  std::cout << *tag << std::endl;
416  }
417  return _tags.size();
418 }
std::vector< std::string > getTagsFromOmds(void)
tuple cout
Definition: gather_cfg.py:121
std::string HcalChannelQualityXml::get_random_comment ( void  )
private

Definition at line 180 of file HcalChannelQualityXml.cc.

180  {
181  return hcal_ass.getRandomQuote();
182 }
std::string getRandomQuote(void)
int HcalChannelQualityXml::getBaseLineFromOmds ( std::string  _tag,
int  _iov_begin 
)

Definition at line 189 of file HcalChannelQualityXml.cc.

References dtNoiseDBValidation_cfg::cerr, HcalChannelQualityXml::_ChannelQuality::comment, results_mgr::conn, ConnectionManager::connect(), ConnectionManager::disconnect(), alignCSCRings::e, ConnectionManager::getStatement(), HcalChannelQualityXml::_ChannelQuality::onoff, o2o::query, HcalChannelQualityXml::_ChannelQuality::status, AlCaHLTBitMon_QueryRunRegistry::string, and toolbox::toString().

189  {
190  static ConnectionManager conn;
191  conn.connect();
192  std::string query = "select ";
193  //query += " sp.record_id as record_id ";
194  query += " sp.subdet as subdetector ";
195  query += " ,sp.ieta as IETA ";
196  query += " ,sp.iphi as IPHI ";
197  query += " ,sp.depth as DEPTH ";
198  query += " ,sp.channel_status_word as STATUS_WORD ";
199  query += " ,sp.channel_on_off_state as ON_OFF ";
200  query += " ,sp.commentdescription ";
201  //query += " ,sp.channel_map_id detid ";
202  //query += " ,sp.interval_of_validity_begin as IOV_BEGIN ";
203  //query += " ,sp.interval_of_validity_end as IOV_END ";
204  query += "from ";
205  query += " ( ";
206  query += " select MAX(cq.record_id) as record_id ";
207  query += " ,MAX(cq.interval_of_validity_begin) as iov_begin ";
208  query += " ,cq.channel_map_id ";
209  query += " from ";
210  query += " cms_hcl_hcal_cond.v_hcal_channel_quality cq ";
211  query += " where ";
212  query += " tag_name=:1 ";
213  query += " and";
214  query += " cq.interval_of_validity_begin<=:2";
215  query += " group by ";
216  query += " cq.channel_map_id ";
217  query += " order by ";
218  query += " cq.channel_map_id ";
219  query += " ) fp ";
220  query += "inner join ";
221  query += " cms_hcl_hcal_cond.v_hcal_channel_quality sp ";
222  query += "on ";
223  query += " fp.record_id=sp.record_id ";
224  int _n_channels = 0;
225  try {
226  oracle::occi::Statement* stmt = conn.getStatement(query);
227  stmt->setString(1,_tag);
228  stmt->setInt(2,_iov_begin);
229  oracle::occi::ResultSet *rs = stmt->executeQuery();
230  geomid_cq.clear();
231  //detid_cq.clear();
232  while (rs->next()) {
233  _n_channels++;
234  int _geomId = hAss.getGeomId(hAss.getSubdetector(rs->getString(1)),
235  rs->getInt(2),
236  rs->getInt(3),
237  rs->getInt(4)
238  );
240  _cq.status = rs->getInt(5);
241  _cq.onoff = rs->getInt(6);
242  _cq.comment = rs->getString(7);
243  geomid_cq.insert(std::pair<int, HcalChannelQualityXml::ChannelQuality>(_geomId, _cq));
244  }
245  }
246  catch (SQLException& e) {
247  std::cerr << ::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()) << std::endl;
248  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()));
249  }
250  conn.disconnect();
251  return _n_channels;
252 }
oracle::occi::Statement * getStatement(const std::string &query)
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
int getGeomId(HcalSubdetector _det, int _ieta, int _iphi, int _depth)
std::string toString(const char *format,...)
Definition: xdaq_compat.cc:4
HcalSubdetector getSubdetector(std::string _det)
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
tuple query
Definition: o2o.py:269
std::map< int, ChannelQuality > geomid_cq
tuple conn
Definition: results_mgr.py:53
std::vector< int > HcalChannelQualityXml::getIovsFromOmds ( std::string  tag)

Definition at line 465 of file HcalChannelQualityXml.cc.

References dtNoiseDBValidation_cfg::cerr, results_mgr::conn, ConnectionManager::connect(), ConnectionManager::disconnect(), alignCSCRings::e, ConnectionManager::getStatement(), o2o::query, AlCaHLTBitMon_QueryRunRegistry::string, and toolbox::toString().

465  {
466  std::vector<int> _iovs;
467  static ConnectionManager conn;
468  conn.connect();
469  std::string query = "select distinct cq.interval_of_validity_begin, min(record_id) as mrid ";
470  query += "from ";
471  query += "cms_hcl_hcal_cond.v_hcal_channel_quality cq ";
472  query += "where ";
473  query += "tag_name=:1 ";
474  query += "group by cq.interval_of_validity_begin ";
475  query += "order by mrid desc ";
476  int _n_iovs = 0;
477  try {
478  oracle::occi::Statement* stmt = conn.getStatement(query);
479  stmt->setString(1,tag);
480  oracle::occi::ResultSet *rs = stmt->executeQuery();
481  while (rs->next()) {
482  _n_iovs++;
483  _iovs.push_back( rs->getInt(1) );
484  }
485  }
486  catch (SQLException& e) {
487  std::cerr << ::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()) << std::endl;
488  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()));
489  }
490  conn.disconnect();
491  return _iovs;
492 }
oracle::occi::Statement * getStatement(const std::string &query)
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
std::string toString(const char *format,...)
Definition: xdaq_compat.cc:4
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
tuple query
Definition: o2o.py:269
tuple conn
Definition: results_mgr.py:53
std::vector< std::string > HcalChannelQualityXml::getTagsFromOmds ( void  )

Definition at line 423 of file HcalChannelQualityXml.cc.

References dtNoiseDBValidation_cfg::cerr, results_mgr::conn, ConnectionManager::connect(), ConnectionManager::disconnect(), alignCSCRings::e, ConnectionManager::getStatement(), o2o::query, AlCaHLTBitMon_QueryRunRegistry::string, and toolbox::toString().

423  {
424  std::vector<std::string> _tags;
425  static ConnectionManager conn;
426  conn.connect();
427  std::string query = "select distinct tag_name, min(record_id) as mrid ";
428  query += "from ";
429  query += "cms_hcl_hcal_cond.v_hcal_channel_quality cq ";
430  query += "group by tag_name ";
431  query += "order by mrid desc ";
432  int _n_tags = 0;
433  try {
434  oracle::occi::Statement* stmt = conn.getStatement(query);
435  oracle::occi::ResultSet *rs = stmt->executeQuery();
436  while (rs->next()) {
437  _n_tags++;
438  _tags.push_back( rs->getString(1) );
439  }
440  }
441  catch (SQLException& e) {
442  std::cerr << ::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()) << std::endl;
443  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()));
444  }
445  conn.disconnect();
446  return _tags;
447 }
oracle::occi::Statement * getStatement(const std::string &query)
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
std::string toString(const char *format,...)
Definition: xdaq_compat.cc:4
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
tuple query
Definition: o2o.py:269
tuple conn
Definition: results_mgr.py:53
int HcalChannelQualityXml::makeXmlFromAsciiStream ( int  _runnumber,
int  _iov_begin,
int  _iov_end,
std::string  _tag,
std::string  _elements_comment,
std::string  _base = "hex" 
)

Definition at line 381 of file HcalChannelQualityXml.cc.

References TablePrint::write.

388 {
390  set_header_run_number(_runnumber);
391  set_elements_iov_begin(_iov_begin);
392  set_elements_iov_end(_iov_end);
393  set_elements_tag_name(_tag);
394  set_elements_comment(_elements_comment);
396  write();
397  return 0;
398 }
int write(std::string target="stdout")
Definition: XMLDOMBlock.cc:322
DOMNode * set_header_run_number(int run)
DOMNode * set_elements_iov_begin(int value)
DOMNode * set_elements_comment(std::string value)
int readStatusWordFromStdin(std::string base="hex")
std::map< int, ChannelQuality > geomid_cq
DOMNode * set_elements_iov_end(int value)
DOMNode * set_elements_tag_name(std::string value)
int addChannelQualityGeom(std::map< int, ChannelQuality > &_cq)
int HcalChannelQualityXml::readStatusWordFromStdin ( std::string  base = "hex")

Definition at line 296 of file HcalChannelQualityXml.cc.

References dtNoiseDBValidation_cfg::cerr, HcalChannelQualityXml::_ChannelQuality::comment, cmsRelvalreport::exit, HcalChannelQualityXml::_ChannelQuality::onoff, HcalChannelQualityXml::_ChannelQuality::status, and AlCaHLTBitMon_QueryRunRegistry::string.

296  {
297  std::string _row;
298  int _lines = 0;
299  ChannelQuality _cq;
300  _cq.onoff = 0;
301  _cq.status = 0;
302  _cq.comment = "filled from an ASCII stream";
303  geomid_cq.clear();
304  while ( getline( std::cin, _row ) > 0 ){
305  //#(empty) eta phi dep det value DetId(optional)
306  int _eta, _phi, _dep, _value;
307  char _det[32];
308  int _read;
309  if ( base.find("hex")!=std::string::npos ){
310  const char * _format = "%d %d %d %s %X";
311  _read = sscanf( _row . c_str(), _format,
312  &_eta, &_phi, &_dep, _det, &_value
313  );
314  }
315  else if ( base.find("dec")!=std::string::npos ){
316  const char * _format = "%d %d %d %s %d";
317  _read = sscanf( _row . c_str(), _format,
318  &_eta, &_phi, &_dep, _det, &_value
319  );
320  }
321  else{
322  std::cerr << "Undefined or invalid base. Specify hex or dec. Exiting..." << std::endl;
323  exit(-1);
324  }
325  if ( _read == 5 ){
326  _lines++;
327 
328  int _geomId = hAss.getGeomId(hAss.getSubdetector(std::string(_det))
329  , _eta, _phi, _dep);
330  _cq.status = _value;
331  _cq.onoff = (_value & 65536)>>15;
332  geomid_cq.insert(std::pair<int, HcalChannelQualityXml::ChannelQuality>(_geomId, _cq));
333  //std::cerr << "Line: " << _geomId << " " << _cq.status << std::endl;
334  }
335  }
336  return _lines;
337 }
tuple base
Main Program
Definition: newFWLiteAna.py:92
int getGeomId(HcalSubdetector _det, int _ieta, int _iphi, int _depth)
struct HcalChannelQualityXml::_ChannelQuality ChannelQuality
HcalSubdetector getSubdetector(std::string _det)
std::map< int, ChannelQuality > geomid_cq
int HcalChannelQualityXml::set_all_channels_on_off ( int  _hb,
int  _he,
int  _hf,
int  _ho 
)

Definition at line 110 of file HcalChannelQualityXml.cc.

References HcalChannelIterator::begin(), HcalChannelIterator::end(), HcalChannelIterator::getDepth(), HcalChannelIterator::getHcalSubdetector(), HcalChannelIterator::getIeta(), HcalChannelIterator::getIphi(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalChannelIterator::initHBEFListFromLmapAscii(), HcalChannelIterator::next(), and AlCaHLTBitMon_QueryRunRegistry::string.

110  {
111  HcalChannelIterator iter;
113  std::string _subdetector = "";
114  int _onoff = -1;
115  std::string _comment = get_random_comment();
116  for (iter.begin(); !iter.end(); iter.next()){
117  HcalSubdetector _det = iter.getHcalSubdetector();
118  if (_det == HcalBarrel){
119  _subdetector = "HB";
120  _onoff = _hb;
121  }
122  else if (_det == HcalEndcap){
123  _subdetector = "HE";
124  _onoff = _he;
125  }
126  if (_det == HcalForward){
127  _subdetector = "HF";
128  _onoff = _hf;
129  }
130  if (_det == HcalOuter){
131  _subdetector = "HO";
132  _onoff = _ho;
133  }
134  add_hcal_channel_dataset( iter.getIeta(), iter.getIphi(), iter.getDepth(), _subdetector,
135  0, _onoff, _comment );
136 
137  }
138 
139  return 0;
140 }
std::string get_random_comment(void)
DOMNode * add_hcal_channel_dataset(int ieta, int iphi, int depth, std::string subdetector, int _channel_status, int _on_off, std::string _comment)
HcalSubdetector
Definition: HcalAssistant.h:31
HcalSubdetector getHcalSubdetector(void)
int HcalChannelQualityXml::set_all_channels_status ( uint32_t  _hb,
uint32_t  _he,
uint32_t  _hf,
uint32_t  _ho 
)

Definition at line 143 of file HcalChannelQualityXml.cc.

References HcalChannelIterator::begin(), HcalChannelIterator::end(), HcalChannelIterator::getDepth(), HcalChannelIterator::getHcalSubdetector(), HcalChannelIterator::getIeta(), HcalChannelIterator::getIphi(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalChannelIterator::initHBEFListFromLmapAscii(), HcalChannelIterator::next(), and AlCaHLTBitMon_QueryRunRegistry::string.

146  {
147  HcalChannelIterator iter;
149  std::string _subdetector = "";
150  uint32_t _status = 0;
151  int _onoff = 0;
152  std::string _comment = get_random_comment();
153  for (iter.begin(); !iter.end(); iter.next()){
154  HcalSubdetector _det = iter.getHcalSubdetector();
155  if (_det == HcalBarrel){
156  _subdetector = "HB";
157  _status = _hb;
158  }
159  else if (_det == HcalEndcap){
160  _subdetector = "HE";
161  _status = _he;
162  }
163  else if (_det == HcalForward){
164  _subdetector = "HF";
165  _status = _hf;
166  }
167  else if (_det == HcalOuter){
168  _subdetector = "HO";
169  _status = _ho;
170  }
171  else continue;
172  add_hcal_channel_dataset( iter.getIeta(), iter.getIphi(), iter.getDepth(), _subdetector,
173  _status, _onoff, _comment );
174  }
175  return 0;
176 }
std::string get_random_comment(void)
DOMNode * add_hcal_channel_dataset(int ieta, int iphi, int depth, std::string subdetector, int _channel_status, int _on_off, std::string _comment)
HcalSubdetector
Definition: HcalAssistant.h:31
HcalSubdetector getHcalSubdetector(void)
int HcalChannelQualityXml::writeBaseLineFromOmdsToStdout ( std::string  _tag,
int  _iov_begin,
std::string  base = "hex" 
)

Definition at line 401 of file HcalChannelQualityXml.cc.

401  {
402  getBaseLineFromOmds(_tag, _iov_begin);
404  return 0;
405 }
tuple base
Main Program
Definition: newFWLiteAna.py:92
int getBaseLineFromOmds(std::string _tag, int _iov_begin)
int writeStatusWordToStdout(std::string base="hex")
int HcalChannelQualityXml::writeStatusWordToStdout ( std::string  base = "hex")

Definition at line 340 of file HcalChannelQualityXml.cc.

References dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, and cmsRelvalreport::exit.

340  {
341  int _lines = 0;
342  char _buf[128];
343  int _detId = 0; // dummy as it is optional in the ASCII file
344  sprintf(_buf, "# eta phi dep det value DetId");
345  std::cout << _buf << std::endl;
346  for (std::map<int,ChannelQuality>::const_iterator _cq = geomid_cq.begin();
347  _cq != geomid_cq.end();
348  _cq++){
349  _lines++;
350  _detId = hAss.getRawIdFromCmssw(_cq->first);
351  if ( base.find("hex")!=std::string::npos ){
352  sprintf(_buf," %16d%16d%16d%16s%16.8X%11.8X",
353  hAss.getHcalIeta(_cq->first),
354  hAss.getHcalIphi(_cq->first),
355  hAss.getHcalDepth(_cq->first),
356  hAss.getSubdetectorString(hAss.getHcalSubdetector(_cq->first)).c_str(),
357  _cq->second.status,
358  _detId
359  );
360  }
361  else if ( base.find("dec")!=std::string::npos ){
362  sprintf(_buf," %16d%16d%16d%16s%16d%11.8d",
363  hAss.getHcalIeta(_cq->first),
364  hAss.getHcalIphi(_cq->first),
365  hAss.getHcalDepth(_cq->first),
366  hAss.getSubdetectorString(hAss.getHcalSubdetector(_cq->first)).c_str(),
367  _cq->second.status,
368  _detId
369  );
370  }
371  else{
372  std::cerr << "Undefined or invalid base. Specify hex or dec. Exiting..." << std::endl;
373  exit(-1);
374  }
375  std::cout << _buf << std::endl;
376  }
377  return _lines;
378 }
tuple base
Main Program
Definition: newFWLiteAna.py:92
std::string getSubdetectorString(HcalSubdetector _det)
HcalSubdetector getHcalSubdetector(int _geomId)
int getHcalDepth(int _geomId)
int getRawIdFromCmssw(int _geomId)
int getHcalIeta(int _geomId)
tuple cout
Definition: gather_cfg.py:121
std::map< int, ChannelQuality > geomid_cq
int getHcalIphi(int _geomId)

Member Data Documentation

std::map<int,ChannelQuality> HcalChannelQualityXml::detid_cq

Definition at line 99 of file HcalChannelQualityXml.h.

std::map<int,ChannelQuality> HcalChannelQualityXml::geomid_cq

Definition at line 100 of file HcalChannelQualityXml.h.

HcalAssistant HcalChannelQualityXml::hAss
private

Definition at line 104 of file HcalChannelQualityXml.h.