Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:35:11

0001 #ifndef HCALConfigDBTools_XMLTools_LMap_h
0002 #define HCALConfigDBTools_XMLTools_LMap_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     XMLTools
0006 // Class  :     LMap
0007 //
0008 /**\class LMap LMap.h CaloOnlineTools/HcalOnlineDb/interface/LMap.h
0009 
0010  Description: interface to the HCAL logical map
0011 
0012  Usage:
0013     std::shared_ptr<LMap> the_map(new LMap);
0014     the_map -> read( "your-accessor-string", "optional map type" );
0015 
0016 */
0017 //
0018 // Original Author:  Gena Kukartsev, kukarzev@fnal.gov
0019 //         Created:  Tue Nov 06 14:30:33 CDT 2007
0020 //
0021 
0022 // system include files
0023 #include <vector>
0024 #include <cstring>
0025 #include <fstream>
0026 #include <memory>
0027 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabase.hh"
0028 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0029 #include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h"
0030 
0031 class LMapRow {
0032 public:
0033   LMapRow() {}
0034   ~LMapRow() {}
0035 
0036   int side;
0037   int eta, phi, dphi, depth;
0038   //string det;
0039   HcalSubdetector det;
0040   std::string rbx;
0041   int wedge, rm, pixel, qie, adc, rm_fi, fi_ch;
0042   int crate, htr;    // crate-slot
0043   std::string fpga;  // top-bottom
0044   int htr_fi;        // fiber
0045   int dcc_sl, spigo, dcc, slb;
0046   std::string slbin, slbin2, slnam;
0047   int rctcra, rctcar, rctcon;
0048   std::string rctnam;
0049   int fedid;
0050 
0051   std::string let_code;  // specific to HO
0052 
0053 private:
0054 };
0055 
0056 class LMapDetId {
0057 public:
0058   LMapDetId() {}
0059   ~LMapDetId() {}
0060 
0061   int side;
0062   int eta, phi, depth;
0063   std::string subdetector;
0064 };
0065 
0066 class LMap {
0067 public:
0068   LMap();
0069   ~LMap();
0070 
0071   // type = "HNEF" or "HO", matters for
0072   int read(std::string accessor, std::string type = "HBEF");
0073   std::map<int, LMapRow>& get_map(void);
0074 
0075 private:
0076   class impl;
0077   std::shared_ptr<impl> p_impl;
0078 };
0079 
0080 class EMap {
0081 public:
0082   EMap() {}
0083   EMap(std::string filename) { read_map(filename); }
0084   EMap(const HcalElectronicsMap* map);
0085   ~EMap() {}
0086 
0087   class EMapRow {
0088   public:
0089     int rawId, crate, slot, dcc, spigot, fiber, fiberchan, ieta, iphi, idepth;
0090     std::string topbottom, subdet;
0091     // ZDC channels:
0092     // section: ZDC EM, ZDC HAD, ZDC LUM(?)
0093     int zdc_zside, zdc_channel;
0094     std::string zdc_section;
0095 
0096     EMapRow() {
0097       rawId = 0;
0098       crate = 0;
0099       slot = 0;
0100       dcc = 0;
0101       spigot = 0;
0102       fiber = 0;
0103       fiberchan = 0;
0104       ieta = 0;
0105       iphi = 0;
0106       idepth = 0;
0107       topbottom = "";
0108       subdet = "";
0109       zdc_zside = 0;
0110       zdc_channel = 0;
0111       zdc_section = "UNKNOWN";
0112     }
0113     ~EMapRow() {}
0114 
0115     bool operator<(const EMapRow& other) const;
0116 
0117   };  // end of class EMapRow
0118 
0119   int read_map(std::string filename);
0120 
0121   std::vector<EMap::EMapRow>& get_map(void);
0122 
0123 protected:
0124   std::vector<EMapRow> map;
0125 };  // end of class EMap
0126 
0127 class LMap_test {
0128 public:
0129   LMap_test();
0130   ~LMap_test() {}
0131 
0132   int test_read(std::string accessor, std::string type = "HBEF");
0133 
0134 private:
0135   std::shared_ptr<LMap> _lmap;
0136 };
0137 
0138 class EMap_test {
0139 public:
0140   EMap_test() {}
0141   ~EMap_test() {}
0142 
0143   int test_read_map(std::string filename);
0144 };  // end of class EMap_test
0145 
0146 #endif