6 : mtdTopologyMode_(topologyMode), etlVals_(etl) {}
12 if (det1.mtdRR() != det2.mtdRR()) {
13 return det1.
mtdRR() < det2.mtdRR();
14 }
else if (det1.modType() != det2.modType()) {
15 return det1.modType() < det2.modType();
16 }
else if (det1.module() != det2.module()) {
17 return det1.module() < det2.module();
19 return det1.sensor() < det2.sensor();
26 if (horizontalShift == 0) {
27 edm::LogWarning(
"MTDTopology") <<
"asking of a null horizotalShift in ETL";
30 int hsh = horizontalShift > 0 ? 1 : -1;
32 int sensor = start_mod.
sensor();
34 uint32_t modtyp = start_mod.
modType();
35 uint32_t discside = start_mod.
discSide();
40 geomDetIndex = 2 * (
module - 1) + sensor;
47 size_t iHome = (modtyp ==
etlVals_[discside].idDetType1_) ? 0 : 1;
48 size_t iLeft = (
etlVals_[discside].idDetType1_ == 1) ? 0 : 1;
52 size_t nmodOffset = (modtyp == 1) ? 0 :
etlVals_[discside].start_copy_[iLeft].back() - 1;
54 for (
size_t iloop = 0; iloop <
etlVals_[discside].start_copy_[iHome].size() - 1; iloop++) {
55 if (geomDetIndex >=
etlVals_[discside].start_copy_[iHome][iloop] &&
56 geomDetIndex <
etlVals_[discside].start_copy_[iHome][iloop + 1]) {
57 if (geomDetIndex + hsh >=
etlVals_[discside].start_copy_[iHome][iloop] &&
58 geomDetIndex + hsh <
etlVals_[discside].start_copy_[iHome][iloop + 1]) {
59 return geomDetIndex + hsh - 1 + nmodOffset;
73 if (verticalShift == 0) {
74 edm::LogWarning(
"MTDTopology") <<
"asking of a null verticalShift in ETL";
77 int vsh = verticalShift > 0 ? 1 : -1;
79 int sensor = start_mod.
sensor();
81 uint32_t modtyp = start_mod.
modType();
82 uint32_t discside = start_mod.
discSide();
87 geomDetIndex = 2 * (
module - 1) + sensor;
94 size_t iHome = (modtyp ==
etlVals_[discside].idDetType1_) ? 0 : 1;
95 size_t iOther = (iHome == 0) ? 1 : 0;
96 size_t iLeft = (
etlVals_[discside].idDetType1_ == 1) ? 0 : 1;
101 size_t nmodOffset = (modtyp == 1) ?
etlVals_[discside].start_copy_[iLeft].back() - 1 : 0;
103 size_t iBin(
etlVals_[discside].start_copy_[iHome].
size());
104 for (
size_t iloop = 0; iloop <
etlVals_[discside].start_copy_[iHome].size() - 1; iloop++) {
105 if (geomDetIndex >=
etlVals_[discside].start_copy_[iHome][iloop] &&
106 geomDetIndex <
etlVals_[discside].start_copy_[iHome][iloop + 1]) {
112 if (iBin ==
etlVals_[discside].start_copy_[iHome].
size()) {
113 edm::LogWarning(
"MTDTopology") <<
"Module number not compatible with layout, abort";
120 if (iHome == 0 && vsh < 0) {
121 iBinOther = iBin - 1;
123 if (iHome == 1 && vsh > 0) {
124 iBinOther = iBin + 1;
126 if (iBinOther < 0 || iBinOther >= static_cast<int>(
etlVals_[discside].start_copy_[iOther].
size()) - 1) {
132 int vpos =
etlVals_[discside].offset_[iHome][iBin] + geomDetIndex -
etlVals_[discside].start_copy_[iHome][iBin] + 1;
133 if (vpos <=
etlVals_[discside].offset_[iOther][iBinOther]) {
135 }
else if (vpos >
etlVals_[discside].offset_[iOther][iBinOther] +
136 etlVals_[discside].start_copy_[iOther][iBinOther + 1] -
137 etlVals_[discside].start_copy_[iOther][iBinOther] ||
138 (vpos ==
etlVals_[discside].offset_[iOther][iBinOther] +
139 etlVals_[discside].start_copy_[iOther][iBinOther + 1] -
140 etlVals_[discside].start_copy_[iOther][iBinOther] &&
141 iBinOther + 1 == static_cast<int>(
etlVals_[discside].start_copy_[iOther].
size()))) {
149 return etlVals_[discside].start_copy_[iOther][iBinOther] + vpos - 1 -
150 etlVals_[discside].offset_[iOther][iBinOther] + nmodOffset - 1;
size_t hshiftETL(const uint32_t detid, const int horizontalShift) const
int getMTDTopologyMode() const
int closest(std::vector< int > const &vec, int value)
std::vector< ETLfaceLayout > ETLValues
MTDTopology(const int &topologyMode, const ETLValues &etl)
static bool orderETLSector(const GeomDet *&gd1, const GeomDet *&gd2)
DetId geographicalId() const
The label of this GeomDet.
constexpr uint32_t rawId() const
get the raw id
Detector identifier class for the Endcap Timing Layer.
size_t vshiftETL(const uint32_t detid, const int verticalShift, size_t &closest) const
static constexpr size_t failIndex_
Log< level::Warning, false > LogWarning