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
|
#ifndef DataFormats_L1THGCal_HGCalTowerID_h
#define DataFormats_L1THGCal_HGCalTowerID_h
#include <cstdint>
// NOTE: in the current implementation HGCalTowerID can only
// accomodate 127 bins per coordinate x2 zsides
namespace l1t {
class HGCalTowerID {
public:
HGCalTowerID() : HGCalTowerID(0) {}
HGCalTowerID(uint32_t rawId) : rawId_(rawId) {}
HGCalTowerID(short subdetIsNode, short zside, unsigned short coord1, unsigned short coord2) {
rawId_ = (((subdetIsNode & subDetMask) << subDetShift) | ((coord1 & coordMask) << coord1Shift) |
((coord2 & coordMask) << coord2Shift) | ((zside > 0) & zsideMask) << zsideShift);
}
short subdet() const { return (rawId_ >> subDetShift) & subDetMask; }
short zside() const { return ((rawId_ >> zsideShift) & zsideMask) ? 1 : -1; }
unsigned short iEta() const { return (rawId_ >> coord1Shift) & coordMask; }
unsigned short iPhi() const { return (rawId_ >> coord2Shift) & coordMask; }
unsigned short rawId() const { return rawId_; }
static const int subDetMask = 0x1; // two for now 0 is HGC and 1 is HFNose
static const int subDetShift = 16;
static const int zsideMask = 0x1;
static const int zsideShift = 15;
static const int coordMask = 0x007F;
static const int coord1Shift = 7;
static const int coord2Shift = 0;
private:
uint32_t rawId_;
};
struct HGCalTowerCoord {
HGCalTowerCoord(uint32_t rawId, float eta, float phi) : rawId(rawId), eta(eta), phi(phi) {}
const uint32_t rawId;
const float eta;
const float phi;
};
} // namespace l1t
#endif
|