Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:10

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     int codedvetothreshold;
0040     std::vector<unsigned int> lut;
0041     std::vector<uint64_t> mask;
0042   } Config;
0043 
0044   LutXml();
0045   LutXml(XERCES_CPP_NAMESPACE::InputSource& _source);
0046   LutXml(std::string filename);
0047   ~LutXml() override;
0048 
0049   void init(void);
0050   void addLut(Config& _config, XMLDOMBlock* checksums_xml = nullptr);
0051   std::string& getCurrentBrick(void);
0052 
0053   std::vector<unsigned int>* getLutFast(uint32_t det_id);
0054   //
0055   //_____ following removed as a xalan-c component_____________________
0056   //
0057   //std::vector<unsigned int> getLut( int lut_type, int crate, int slot, int topbottom, int fiber, int fiber_channel );
0058 
0059   HcalSubdetector subdet_from_crate(int crate, int slot, int fiber);
0060   int a_to_i(char* inbuf);
0061   int create_lut_map(void);
0062 
0063   static std::string get_checksum(std::vector<unsigned int>& lut);
0064 
0065   //
0066   //_____ following removed as a xalan-c component_____________________
0067   //
0068   //int test_xpath( std::string filename );
0069   int test_access(std::string filename);
0070 
0071   //LutXml & operator+=( const LutXml & other);
0072 
0073   //Iterators and find
0074   typedef std::map<uint32_t, std::vector<unsigned int> >::const_iterator const_iterator;
0075   const_iterator begin() const;
0076   const_iterator end() const;
0077   const_iterator find(uint32_t) const;
0078 
0079 protected:
0080   XMLCh* root;
0081   XMLCh* brick;
0082   XERCES_CPP_NAMESPACE::DOMElement* addParameter(std::string _name, std::string _type, std::string _value);
0083   XERCES_CPP_NAMESPACE::DOMElement* addParameter(std::string _name, std::string _type, int _value);
0084 
0085   template <typename T>
0086   XERCES_CPP_NAMESPACE::DOMElement* addData(std::string _elements, std::string _encoding, const T& _lut);
0087 
0088   XERCES_CPP_NAMESPACE::DOMElement* add_checksum(XERCES_CPP_NAMESPACE::DOMDocument* parent, Config& config);
0089 
0090   XERCES_CPP_NAMESPACE::DOMElement* brickElem;
0091 
0092   //std::map<uint32_t,std::vector<unsigned int> > * lut_map;
0093   std::map<uint32_t, std::vector<unsigned int> > lut_map;
0094 };
0095 
0096 #endif