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
64
|
#include "Geometry/HGCalMapping/interface/HGCalMappingTools.h"
#include <iostream>
#include <fstream>
#include <sstream>
namespace hgcal {
namespace mappingtools {
//
void HGCalEntityList::buildFrom(std::string url) {
std::string line;
std::ifstream file(url);
//parse the lines to build the list of entities
size_t iline(0);
while (std::getline(file, line)) {
HGCalEntityRow row;
std::stringstream s;
s << line;
HGCalEntityAttr attr;
while (s >> attr)
row.push_back(attr);
if (iline == 0)
setHeader(row);
else
addRow(row);
iline += 1;
}
}
//
uint16_t getEcondErx(uint16_t chip, uint16_t half) { return chip * 2 + half; }
//
uint32_t getElectronicsId(
bool zside, uint16_t fedid, uint16_t captureblock, uint16_t econdidx, int cellchip, int cellhalf, int cellseq) {
uint16_t econderx = getEcondErx(cellchip, cellhalf);
return HGCalElectronicsId(zside, fedid, captureblock, econdidx, econderx, cellseq).raw();
}
//
uint32_t getSiDetId(bool zside, int moduleplane, int moduleu, int modulev, int celltype, int celliu, int celliv) {
DetId::Detector det = moduleplane <= 26 ? DetId::Detector::HGCalEE : DetId::Detector::HGCalHSi;
int zp(zside ? 1 : -1);
return HGCSiliconDetId(det, zp, celltype, moduleplane, moduleu, modulev, celliu, celliv).rawId();
}
//
uint32_t getSiPMDetId(bool zside, int moduleplane, int modulev, int celltype, int celliu, int celliv) {
int layer = moduleplane - 25;
int type = 0; // depends on SiPM size to be updated with new geometry
int ring = (zside ? celliu : (-1) * celliu);
int iphi = modulev * 8 + celliv + 1;
return HGCScintillatorDetId(type, layer, ring, iphi, false, celltype).rawId();
}
} // namespace mappingtools
} // namespace hgcal
|