1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#ifndef ElectronicsMap_h
#define ElectronicsMap_h
/**
* file: ElectronicsMap.h
* Author: Viktor Khristenko
*
* Description:
* HcalElectronicsMap is slow. Upon beginRun hash what you need
*from emap. Preserve only uint32_t. When you look things up, you know what is
*the key and you know what is the output as you define it up infront.
*/
#include "DQM/HcalCommon/interface/HashFilter.h"
#include "DQM/HcalCommon/interface/HashMapper.h"
#include "DQM/HcalCommon/interface/HcalCommonHeaders.h"
#include "string"
#include <unordered_map>
namespace hcaldqm {
namespace electronicsmap {
enum ElectronicsMapType {
fHcalElectronicsMap = 0,
fD2EHashMap = 1,
fT2EHashMap = 2,
fE2DHashMap = 3,
fE2THashMap = 4,
nElectronicsMapType = 5
};
class ElectronicsMap {
public:
ElectronicsMap() : _emap(nullptr) {}
// define how to use upon construction
ElectronicsMap(ElectronicsMapType etype) : _etype(etype), _emap(nullptr) {}
~ElectronicsMap() {}
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype = fHcalElectronicsMap);
// filter is to filter things you do not need out
void initialize(HcalElectronicsMap const *, ElectronicsMapType, filter::HashFilter const &);
uint32_t lookup(DetId const &);
uint32_t lookup(HcalDetId const &);
uint32_t lookup(HcalElectronicsId const &);
void print();
private:
// configures how to use emap
ElectronicsMapType _etype;
// 2 choices either use as HcalElectronicsMap or as ur hash
typedef std::unordered_map<uint32_t, uint32_t> EMapType;
EMapType _ids;
//
HcalElectronicsMap const *_emap;
};
} // namespace electronicsmap
} // namespace hcaldqm
#endif
|