5 : mtdTopologyMode_(topologyMode), etlVals_(etl) {}
11 if (det1.mtdRR() != det2.mtdRR()) {
12 return det1.
mtdRR() < det2.mtdRR();
13 }
else if (det1.modType() != det2.modType()) {
14 return det1.modType() < det2.modType();
16 return det1.module() < det2.module();
23 if (horizontalShift == 0) {
24 edm::LogWarning(
"MTDTopology") <<
"asking of a null horizotalShift in ETL";
27 int hsh = horizontalShift > 0 ? 1 : -1;
29 int module = start_mod.
module();
30 uint32_t modtyp = start_mod.
modType();
31 uint32_t discside = start_mod.
discSide();
35 size_t iHome = (modtyp ==
etlVals_[discside].idDetType1_) ? 0 : 1;
36 size_t iLeft = (
etlVals_[discside].idDetType1_ == 1) ? 0 : 1;
40 size_t nmodOffset = (modtyp == 1) ? 0 :
etlVals_[discside].start_copy_[iLeft].back() - 1;
42 for (
size_t iloop = 0; iloop <
etlVals_[discside].start_copy_[iHome].size() - 1; iloop++) {
43 if (module >=
etlVals_[discside].start_copy_[iHome][iloop] &&
44 module <
etlVals_[discside].start_copy_[iHome][iloop + 1]) {
45 if (module + hsh >=
etlVals_[discside].start_copy_[iHome][iloop] &&
46 module + hsh <
etlVals_[discside].start_copy_[iHome][iloop + 1]) {
47 return module + hsh - 1 + nmodOffset;
61 if (verticalShift == 0) {
62 edm::LogWarning(
"MTDTopology") <<
"asking of a null verticalShift in ETL";
65 int vsh = verticalShift > 0 ? 1 : -1;
67 int module = start_mod.
module();
68 uint32_t modtyp = start_mod.
modType();
69 uint32_t discside = start_mod.
discSide();
73 size_t iHome = (modtyp ==
etlVals_[discside].idDetType1_) ? 0 : 1;
74 size_t iOther = (iHome == 0) ? 1 : 0;
75 size_t iLeft = (
etlVals_[discside].idDetType1_ == 1) ? 0 : 1;
80 size_t nmodOffset = (modtyp == 1) ?
etlVals_[discside].start_copy_[iLeft].back() - 1 : 0;
82 size_t iBin(
etlVals_[discside].start_copy_[iHome].
size());
83 for (
size_t iloop = 0; iloop <
etlVals_[discside].start_copy_[iHome].size() - 1; iloop++) {
84 if (module >=
etlVals_[discside].start_copy_[iHome][iloop] &&
85 module <
etlVals_[discside].start_copy_[iHome][iloop + 1]) {
91 if (iBin ==
etlVals_[discside].start_copy_[iHome].
size()) {
92 edm::LogWarning(
"MTDTopology") <<
"Module number not compatible with layout, abort";
99 if (iHome == 0 && vsh < 0) {
100 iBinOther = iBin - 1;
102 if (iHome == 1 && vsh > 0) {
103 iBinOther = iBin + 1;
105 if (iBinOther < 0 || iBinOther >= static_cast<int>(
etlVals_[discside].start_copy_[iOther].
size()) - 1) {
111 int vpos =
etlVals_[discside].offset_[iHome][iBin] + module -
etlVals_[discside].start_copy_[iHome][iBin] + 1;
112 if (vpos <=
etlVals_[discside].offset_[iOther][iBinOther]) {
113 closest =
etlVals_[discside].start_copy_[iOther][iBinOther];
114 }
else if (vpos >
etlVals_[discside].offset_[iOther][iBinOther] +
115 etlVals_[discside].start_copy_[iOther][iBinOther + 1] -
116 etlVals_[discside].start_copy_[iOther][iBinOther] ||
117 (vpos ==
etlVals_[discside].offset_[iOther][iBinOther] +
118 etlVals_[discside].start_copy_[iOther][iBinOther + 1] -
119 etlVals_[discside].start_copy_[iOther][iBinOther] &&
120 iBinOther + 1 == static_cast<int>(
etlVals_[discside].start_copy_[iOther].
size()))) {
121 closest =
etlVals_[discside].start_copy_[iOther][iBinOther + 1] - 1;
124 closest = closest + nmodOffset - 1;
128 return etlVals_[discside].start_copy_[iOther][iBinOther] + vpos - 1 -
129 etlVals_[discside].offset_[iOther][iBinOther] + nmodOffset - 1;