Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:27

0001 #ifndef ElectronicsMap_h
0002 #define ElectronicsMap_h
0003 
0004 /**
0005  *  file:       ElectronicsMap.h
0006  *  Author:     Viktor Khristenko
0007  *
0008  *  Description:
0009  *      HcalElectronicsMap is slow. Upon beginRun hash what you need
0010  *from emap. Preserve only uint32_t. When you look things up, you know what is
0011  *the key and you know what is the output as you define it up infront.
0012  */
0013 
0014 #include "DQM/HcalCommon/interface/HashFilter.h"
0015 #include "DQM/HcalCommon/interface/HashMapper.h"
0016 #include "DQM/HcalCommon/interface/HcalCommonHeaders.h"
0017 
0018 #include "string"
0019 #include <unordered_map>
0020 
0021 namespace hcaldqm {
0022   namespace electronicsmap {
0023     enum ElectronicsMapType {
0024       fHcalElectronicsMap = 0,
0025       fD2EHashMap = 1,
0026       fT2EHashMap = 2,
0027       fE2DHashMap = 3,
0028       fE2THashMap = 4,
0029       nElectronicsMapType = 5
0030     };
0031 
0032     class ElectronicsMap {
0033     public:
0034       ElectronicsMap() : _emap(nullptr) {}
0035       //    define how to use upon construction
0036       ElectronicsMap(ElectronicsMapType etype) : _etype(etype), _emap(nullptr) {}
0037       ~ElectronicsMap() {}
0038 
0039       void initialize(HcalElectronicsMap const *, ElectronicsMapType etype = fHcalElectronicsMap);
0040 
0041       //    filter is to filter things you do not need out
0042       void initialize(HcalElectronicsMap const *, ElectronicsMapType, filter::HashFilter const &);
0043       uint32_t lookup(DetId const &);
0044       uint32_t lookup(HcalDetId const &);
0045       uint32_t lookup(HcalElectronicsId const &);
0046 
0047       void print();
0048 
0049     private:
0050       //    configures how to use emap
0051       ElectronicsMapType _etype;
0052 
0053       //    2 choices either use as HcalElectronicsMap or as ur hash
0054       typedef std::unordered_map<uint32_t, uint32_t> EMapType;
0055       EMapType _ids;
0056 
0057       //
0058       HcalElectronicsMap const *_emap;
0059     };
0060   }  // namespace electronicsmap
0061 }  // namespace hcaldqm
0062 
0063 #endif