Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:41:53

0001 #ifndef CaloOnlineTools_HcalOnlineDb_LutXml_h
0002 #define CaloOnlineTools_HcalOnlineDb_LutXml_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     CaloOnlineTools/HcalOnlineDb
0006 // Class  :     LutXml
0007 //
0008 /**\class LutXml LutXml.h CalibCalorimetry/HcalTPGAlgos/interface/LutXml.h
0009 
0010  Description: <one line class summary>
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Gena Kukartsev, kukarzev@fnal.gov
0018 //         Created:  Tue Mar 18 14:30:33 CDT 2008
0019 //
0020 
0021 #include <vector>
0022 #include <map>
0023 #include "CalibCalorimetry/HcalTPGAlgos/interface/XMLDOMBlock.h"
0024 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0025 #include <cstdint>
0026 
0027 class LutXml : public XMLDOMBlock {
0028 public:
0029   typedef struct _Config {
0030     _Config();
0031     std::string infotype;
0032     int ieta, iphi, depth, crate, slot, topbottom, fiber, fiberchan, lut_type;
0033     std::string creationtag;
0034     std::string creationstamp;
0035     std::string formatrevision;
0036     std::string targetfirmware;
0037     int generalizedindex;
0038     int weight;
0039     std::vector<unsigned int> lut;
0040     std::vector<uint64_t> mask;
0041   } Config;
0042 
0043   LutXml();
0044   LutXml(XERCES_CPP_NAMESPACE::InputSource& _source);
0045   LutXml(std::string filename);
0046   ~LutXml() override;
0047 
0048   void init(void);
0049   void addLut(Config& _config, XMLDOMBlock* checksums_xml = nullptr);
0050   std::string& getCurrentBrick(void);
0051 
0052   std::vector<unsigned int>* getLutFast(uint32_t det_id);
0053   //
0054   //_____ following removed as a xalan-c component_____________________
0055   //
0056   //std::vector<unsigned int> getLut( int lut_type, int crate, int slot, int topbottom, int fiber, int fiber_channel );
0057 
0058   HcalSubdetector subdet_from_crate(int crate, int slot, int fiber);
0059   int a_to_i(char* inbuf);
0060   int create_lut_map(void);
0061 
0062   static std::string get_checksum(std::vector<unsigned int>& lut);
0063 
0064   //
0065   //_____ following removed as a xalan-c component_____________________
0066   //
0067   //int test_xpath( std::string filename );
0068   int test_access(std::string filename);
0069 
0070   //LutXml & operator+=( const LutXml & other);
0071 
0072   //Iterators and find
0073   typedef std::map<uint32_t, std::vector<unsigned int> >::const_iterator const_iterator;
0074   const_iterator begin() const;
0075   const_iterator end() const;
0076   const_iterator find(uint32_t) const;
0077 
0078 protected:
0079   XMLCh* root;
0080   XMLCh* brick;
0081   XERCES_CPP_NAMESPACE::DOMElement* addParameter(std::string _name, std::string _type, std::string _value);
0082   XERCES_CPP_NAMESPACE::DOMElement* addParameter(std::string _name, std::string _type, int _value);
0083 
0084   template <typename T>
0085   XERCES_CPP_NAMESPACE::DOMElement* addData(std::string _elements, std::string _encoding, const T& _lut);
0086 
0087   XERCES_CPP_NAMESPACE::DOMElement* add_checksum(XERCES_CPP_NAMESPACE::DOMDocument* parent, Config& config);
0088 
0089   XERCES_CPP_NAMESPACE::DOMElement* brickElem;
0090 
0091   //std::map<uint32_t,std::vector<unsigned int> > * lut_map;
0092   std::map<uint32_t, std::vector<unsigned int> > lut_map;
0093 };
0094 
0095 #endif