CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/CaloOnlineTools/HcalOnlineDb/interface/HcalChannelQualityXml.h

Go to the documentation of this file.
00001 #ifndef CaloOnlineTools_HcalOnlineDb_HcalChannelQualityXml_h
00002 #define CaloOnlineTools_HcalOnlineDb_HcalChannelQualityXml_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     CaloOnlineTools/HcalOnlineDb
00006 // Class  :     HcalChannelQualityXml
00007 // 
00016 //
00017 // Original Author:  Gena Kukartsev, kukarzev@fnal.gov
00018 //         Created:  Wed Jul 01 06:42:00 CDT 2009
00019 // $Id: HcalChannelQualityXml.h,v 1.7 2009/10/26 02:55:16 kukartse Exp $
00020 //
00021 
00022 #include <map>
00023 #include <string>
00024 #include "CaloOnlineTools/HcalOnlineDb/interface/HcalChannelDataXml.h"
00025 
00026 class HcalChannelQualityXml : public HcalChannelDataXml
00027 {
00028   
00029  public:
00030 
00031   typedef struct _ChannelQuality{
00032     _ChannelQuality();
00033     int status;
00034     int onoff;
00035     std::string comment;
00036   } ChannelQuality;
00037       
00038   HcalChannelQualityXml();
00039   virtual ~HcalChannelQualityXml();
00040   
00041   // read ASCII stream with channel status word (cat ascii file)
00042   // and generate corresponding XML
00043   int makeXmlFromAsciiStream(int _runnumber,
00044                              int _iov_begin,
00045                              int _iov_end,
00046                              std::string _tag,
00047                              std::string _elements_comment,
00048                              std::string _base="hex"
00049                              );
00050 
00051   // get baseline channel status from a tag for a given IOV
00052   // and output it in the ASCII format to stdout
00053   int writeBaseLineFromOmdsToStdout(std::string _tag, int _iov_begin, std::string base="hex");
00054 
00055   // read ASCII stream with channel status word (cat ascii file)
00056   int readStatusWordFromStdin(std::string base="hex");
00057 
00058   // write ASCII stream with channel status word
00059   int writeStatusWordToStdout(std::string base = "hex"); // status and detId in hex or dec
00060 
00061   // add dataset to the XML document
00062   DOMNode * add_hcal_channel_dataset( int ieta, int iphi, int depth, std::string subdetector,
00063                                       int _channel_status, int _on_off, std::string _comment );
00064 
00065   // add channel to the geomid_cq map (XML has not changed)
00066   int addChannelToGeomIdMap( int ieta, int iphi, int depth, std::string subdetector,
00067                              int _channel_status, int _on_off, std::string _comment );
00068 
00069   // add data tag inside a dataset tag
00070   DOMElement * add_data( DOMNode * _dataset, int _channel_status, int _on_off, std::string _comment );
00071 
00072   // add XML for all HCAL channels onoff entries
00073   int set_all_channels_on_off( int _hb, int _he, int _hf, int _ho);
00074 
00075   // add XML for all HCAL channels status entries
00076   int set_all_channels_status( uint32_t _hb, uint32_t _he, uint32_t _hf, uint32_t _ho);
00077 
00078   // get baseline channel status from a tag for a given IOV
00079   int getBaseLineFromOmds(std::string _tag, int _iov_begin);
00080 
00081   // adds to XML datasets for channels in the map
00082   int addChannelQualityGeom(std::map<int,ChannelQuality> & _cq); // the map key is geom hash as in HcalAssistant
00083 
00084   // reads tags from OMDS and dumps them to stdout newest first
00085   // returns number of available tags
00086   int dumpTagsFromOmdsToStdout(void);
00087 
00088   // reads a sorted list of tags, newest first
00089   std::vector<std::string> getTagsFromOmds(void);
00090 
00091   // Reads IOVs available for a given tag from OMDS and dumps them
00092   // to stdout newest first.
00093   // Returns the number of available IOVs
00094   int dumpIovsFromOmdsToStdout(std::string tag);
00095 
00096   // reads a sorted list of IOVs for a given tag, newest first
00097   std::vector<int> getIovsFromOmds(std::string tag);
00098 
00099 
00100   std::map<int,ChannelQuality> detid_cq; // HcalDetId as key
00101   std::map<int,ChannelQuality> geomid_cq; // geomId as key
00102 
00103  private:
00104   std::string get_random_comment( void );
00105   HcalAssistant hAss; // HcalDetId and proprietary channel hash
00106 };
00107 
00108 #endif