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 26 of file HcalChannelQualityXml.h.

Member Typedef Documentation

Constructor & Destructor Documentation

HcalChannelQualityXml::HcalChannelQualityXml ( )

Definition at line 37 of file HcalChannelQualityXml.cc.

References comment.

56 {
57  extension_table_name="HCAL_CHANNEL_QUALITY_V1";
58  type_name="HCAL Channel Quality [V1]";
59  run_number = -1;
60  channel_map = "HCAL_CHANNELS";
61  data_set_id = -1;
62  iov_id = 1;
63  iov_begin = 1;
64  iov_end = -1;
65  tag_id = 2;
66  tag_mode = "auto";
67  tag_name = "test_channel_quality_tag_name";
68  detector_name = "HCAL";
70  tag_idref = 2;
71  iov_idref = 1;
72  data_set_idref = -1;
73  //
74  geomid_cq.clear();
75  detid_cq.clear();
76  //
77  //hAss.getListOfChannelsFromDb();
78  //
79  init_data();
80 }
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 83 of file HcalChannelQualityXml.cc.

84 {
85 }

Member Function Documentation

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

Definition at line 88 of file HcalChannelQualityXml.cc.

References XMLProcessor::_toXMLCh().

88  {
89  DOMElement * _data_elem = get_data_element(_dataset);
90  add_element(_data_elem, XMLProcessor::_toXMLCh("CHANNEL_STATUS_WORD"), XMLProcessor::_toXMLCh(_channel_status));
91  add_element(_data_elem, XMLProcessor::_toXMLCh("CHANNEL_ON_OFF_STATE"), XMLProcessor::_toXMLCh(_on_off));
92  add_element(_data_elem, XMLProcessor::_toXMLCh("COMMENT_DESCRIPTION"), XMLProcessor::_toXMLCh(_comment));
93  //
94  return _data_elem;
95 }
MemBufInputSource * _dataset
DOMElement * get_data_element(DOMNode *_dataset)
static XMLCh * _toXMLCh(std::string temp)
Definition: XMLProcessor.h:185
DOMElement * add_element(DOMElement *parent, XMLCh *tagname, XMLCh *value)
Definition: XMLDOMBlock.cc:524
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 98 of file HcalChannelQualityXml.cc.

99  {
100  DOMNode * _dataset = add_dataset();
101  add_hcal_channel(_dataset, ieta, iphi, depth, subdetector);
102  add_data(_dataset, _channel_status, _on_off, _comment);
103  return _dataset;
104 }
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 253 of file HcalChannelQualityXml.cc.

253  {
254  int _n_channels = 0;
255  for (std::map<int,ChannelQuality>::const_iterator _chan=_cq.begin();
256  _chan!=_cq.end();
257  _chan++
258  ){
260  hAss.getHcalIphi(_chan->first),
261  hAss.getHcalDepth(_chan->first),
263  _chan->second.status,
264  _chan->second.onoff,
265  _chan->second.comment
266  );
267  _n_channels++;
268  }
269  return _n_channels;
270 }
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 273 of file HcalChannelQualityXml.cc.

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

274  {
275  int _geomId = hAss.getGeomId(hAss.getSubdetector(subdetector),
276  ieta,
277  iphi,
278  depth);
280  _cq.status = _channel_status;
281  _cq.onoff = _on_off;
282  _cq.comment = _comment;
283  if (geomid_cq.find(_geomId)==geomid_cq.end()){
284  geomid_cq.insert(std::pair<int, HcalChannelQualityXml::ChannelQuality>(_geomId,_cq));
285  }
286  else{
287  geomid_cq[_geomId]=_cq;
288  }
289  return 0;
290 }
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 451 of file HcalChannelQualityXml.cc.

References gather_cfg::cout.

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

Definition at line 409 of file HcalChannelQualityXml.cc.

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

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

Definition at line 177 of file HcalChannelQualityXml.cc.

177  {
178  return hcal_ass.getRandomQuote();
179 }
std::string getRandomQuote(void)
int HcalChannelQualityXml::getBaseLineFromOmds ( std::string  _tag,
int  _iov_begin 
)

Definition at line 186 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, and toString().

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

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

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

Definition at line 420 of file HcalChannelQualityXml.cc.

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

420  {
421  std::vector<std::string> _tags;
422  static ConnectionManager conn;
423  conn.connect();
424  std::string query = "select distinct tag_name, min(record_id) as mrid ";
425  query += "from ";
426  query += "cms_hcl_hcal_cond.v_hcal_channel_quality cq ";
427  query += "group by tag_name ";
428  query += "order by mrid desc ";
429  int _n_tags = 0;
430  try {
431  oracle::occi::Statement* stmt = conn.getStatement(query);
432  oracle::occi::ResultSet *rs = stmt->executeQuery();
433  while (rs->next()) {
434  _n_tags++;
435  _tags.push_back( rs->getString(1) );
436  }
437  }
438  catch (SQLException& e) {
439  std::cerr << ::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()) << std::endl;
440  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,::toolbox::toString("Oracle exception : %s",e.getMessage().c_str()));
441  }
442  conn.disconnect();
443  return _tags;
444 }
oracle::occi::Statement * getStatement(const std::string &query)
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
std::string toString(const std::pair< T, T > &aT)
Definition: CaloEllipse.h:72
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:21
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 378 of file HcalChannelQualityXml.cc.

References TablePrint::write.

385 {
387  set_header_run_number(_runnumber);
388  set_elements_iov_begin(_iov_begin);
389  set_elements_iov_end(_iov_end);
390  set_elements_tag_name(_tag);
391  set_elements_comment(_elements_comment);
393  write();
394  return 0;
395 }
int write(std::string target="stdout")
Definition: XMLDOMBlock.cc:323
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 293 of file HcalChannelQualityXml.cc.

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

293  {
294  std::string _row;
295  int _lines = 0;
296  ChannelQuality _cq;
297  _cq.onoff = 0;
298  _cq.status = 0;
299  _cq.comment = "filled from an ASCII stream";
300  geomid_cq.clear();
301  while ( getline( std::cin, _row ) > 0 ){
302  //#(empty) eta phi dep det value DetId(optional)
303  int _eta, _phi, _dep, _value;
304  char _det[32];
305  int _read;
306  if ( base.find("hex")!=std::string::npos ){
307  const char * _format = "%d %d %d %s %X";
308  _read = sscanf( _row . c_str(), _format,
309  &_eta, &_phi, &_dep, _det, &_value
310  );
311  }
312  else if ( base.find("dec")!=std::string::npos ){
313  const char * _format = "%d %d %d %s %d";
314  _read = sscanf( _row . c_str(), _format,
315  &_eta, &_phi, &_dep, _det, &_value
316  );
317  }
318  else{
319  std::cerr << "Undefined or invalid base. Specify hex or dec. Exiting..." << std::endl;
320  exit(-1);
321  }
322  if ( _read == 5 ){
323  _lines++;
324 
325  int _geomId = hAss.getGeomId(hAss.getSubdetector(std::string(_det))
326  , _eta, _phi, _dep);
327  _cq.status = _value;
328  _cq.onoff = (_value & 65536)>>15;
329  geomid_cq.insert(std::pair<int, HcalChannelQualityXml::ChannelQuality>(_geomId, _cq));
330  //std::cerr << "Line: " << _geomId << " " << _cq.status << std::endl;
331  }
332  }
333  return _lines;
334 }
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 107 of file HcalChannelQualityXml.cc.

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

107  {
108  HcalChannelIterator iter;
110  std::string _subdetector = "";
111  int _onoff = -1;
112  std::string _comment = get_random_comment();
113  for (iter.begin(); !iter.end(); iter.next()){
114  HcalSubdetector _det = iter.getHcalSubdetector();
115  if (_det == HcalBarrel){
116  _subdetector = "HB";
117  _onoff = _hb;
118  }
119  else if (_det == HcalEndcap){
120  _subdetector = "HE";
121  _onoff = _he;
122  }
123  if (_det == HcalForward){
124  _subdetector = "HF";
125  _onoff = _hf;
126  }
127  if (_det == HcalOuter){
128  _subdetector = "HO";
129  _onoff = _ho;
130  }
131  add_hcal_channel_dataset( iter.getIeta(), iter.getIphi(), iter.getDepth(), _subdetector,
132  0, _onoff, _comment );
133 
134  }
135 
136  return 0;
137 }
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:32
HcalSubdetector getHcalSubdetector(void)
int HcalChannelQualityXml::set_all_channels_status ( uint32_t  _hb,
uint32_t  _he,
uint32_t  _hf,
uint32_t  _ho 
)

Definition at line 140 of file HcalChannelQualityXml.cc.

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

143  {
144  HcalChannelIterator iter;
146  std::string _subdetector = "";
147  uint32_t _status = 0;
148  int _onoff = 0;
149  std::string _comment = get_random_comment();
150  for (iter.begin(); !iter.end(); iter.next()){
151  HcalSubdetector _det = iter.getHcalSubdetector();
152  if (_det == HcalBarrel){
153  _subdetector = "HB";
154  _status = _hb;
155  }
156  else if (_det == HcalEndcap){
157  _subdetector = "HE";
158  _status = _he;
159  }
160  else if (_det == HcalForward){
161  _subdetector = "HF";
162  _status = _hf;
163  }
164  else if (_det == HcalOuter){
165  _subdetector = "HO";
166  _status = _ho;
167  }
168  else continue;
169  add_hcal_channel_dataset( iter.getIeta(), iter.getIphi(), iter.getDepth(), _subdetector,
170  _status, _onoff, _comment );
171  }
172  return 0;
173 }
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:32
HcalSubdetector getHcalSubdetector(void)
int HcalChannelQualityXml::writeBaseLineFromOmdsToStdout ( std::string  _tag,
int  _iov_begin,
std::string  base = "hex" 
)

Definition at line 398 of file HcalChannelQualityXml.cc.

398  {
399  getBaseLineFromOmds(_tag, _iov_begin);
401  return 0;
402 }
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 337 of file HcalChannelQualityXml.cc.

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

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

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

Definition at line 101 of file HcalChannelQualityXml.h.

HcalAssistant HcalChannelQualityXml::hAss
private

Definition at line 105 of file HcalChannelQualityXml.h.