CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
MTDTopology Class Reference

#include <MTDTopology.h>

Classes

struct  ETLfaceLayout
 

Public Types

using ETLValues = std::vector< ETLfaceLayout >
 

Public Member Functions

int getMTDTopologyMode () const
 
size_t hshiftETL (const uint32_t detid, const int horizontalShift) const
 
 MTDTopology (const int &topologyMode, const ETLValues &etl)
 
size_t vshiftETL (const uint32_t detid, const int verticalShift, size_t &closest) const
 

Static Public Member Functions

static bool orderETLSector (const GeomDet *&gd1, const GeomDet *&gd2)
 

Private Attributes

const ETLValues etlVals_
 
const int mtdTopologyMode_
 

Static Private Attributes

static constexpr size_t failIndex_
 

Detailed Description

Definition at line 13 of file MTDTopology.h.

Member Typedef Documentation

◆ ETLValues

using MTDTopology::ETLValues = std::vector<ETLfaceLayout>

Definition at line 23 of file MTDTopology.h.

Constructor & Destructor Documentation

◆ MTDTopology()

MTDTopology::MTDTopology ( const int &  topologyMode,
const ETLValues etl 
)

Definition at line 5 of file MTDTopology.cc.

6  : mtdTopologyMode_(topologyMode), etlVals_(etl) {}
const ETLValues etlVals_
Definition: MTDTopology.h:42
const int mtdTopologyMode_
Definition: MTDTopology.h:40

Member Function Documentation

◆ getMTDTopologyMode()

int MTDTopology::getMTDTopologyMode ( ) const
inline

◆ hshiftETL()

size_t MTDTopology::hshiftETL ( const uint32_t  detid,
const int  horizontalShift 
) const

Definition at line 23 of file MTDTopology.cc.

References MTDTopologyMode::btlv3etlv8, ALCARECOPPSCalTrackBasedSel_cff::detid, ETLDetId::discSide(), etlVals_, failIndex_, getMTDTopologyMode(), ETLDetId::modType(), callgraph::module, ETLDetId::module(), and ETLDetId::sensor().

Referenced by MTDDetSector::hshift().

23  {
24  ETLDetId start_mod(detid);
25 
26  if (horizontalShift == 0) {
27  edm::LogWarning("MTDTopology") << "asking of a null horizotalShift in ETL";
28  return failIndex_;
29  }
30  int hsh = horizontalShift > 0 ? 1 : -1;
31 
32  int sensor = start_mod.sensor();
33  int module = start_mod.module();
34  uint32_t modtyp = start_mod.modType();
35  uint32_t discside = start_mod.discSide();
36  int geomDetIndex;
37 
38  // distinguish numbering in prev8 / v8 geometries
39  if (getMTDTopologyMode() == static_cast<int>(MTDTopologyMode::Mode::btlv3etlv8)) {
40  geomDetIndex = 2 * (module - 1) + sensor;
41  } else {
42  geomDetIndex = module;
43  }
44 
45  // ilayout number coincides at present with disc face, use this
46 
47  size_t iHome = (modtyp == etlVals_[discside].idDetType1_) ? 0 : 1;
48  size_t iLeft = (etlVals_[discside].idDetType1_ == 1) ? 0 : 1;
49 
50  // for left type modules the position according to the default order is module - 1, for the rigth type modules the total number of left modules must be added
51 
52  size_t nmodOffset = (modtyp == 1) ? 0 : etlVals_[discside].start_copy_[iLeft].back() - 1;
53 
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;
60  }
61  break;
62  }
63  }
64 
65  return failIndex_;
66 }
int getMTDTopologyMode() const
Definition: MTDTopology.h:27
const ETLValues etlVals_
Definition: MTDTopology.h:42
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:16
static constexpr size_t failIndex_
Definition: MTDTopology.h:44
Log< level::Warning, false > LogWarning

◆ orderETLSector()

bool MTDTopology::orderETLSector ( const GeomDet *&  gd1,
const GeomDet *&  gd2 
)
static

Definition at line 8 of file MTDTopology.cc.

References GeomDet::geographicalId(), MTDDetId::mtdRR(), and DetId::rawId().

Referenced by ETLDetLayerGeometryBuilder::buildLayer().

8  {
9  ETLDetId det1(gd1->geographicalId().rawId());
10  ETLDetId det2(gd2->geographicalId().rawId());
11 
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();
18  } else {
19  return det1.sensor() < det2.sensor();
20  }
21 }
int mtdRR() const
Definition: MTDDetId.h:64
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:16

◆ vshiftETL()

size_t MTDTopology::vshiftETL ( const uint32_t  detid,
const int  verticalShift,
size_t &  closest 
) const

Definition at line 68 of file MTDTopology.cc.

References MTDTopologyMode::btlv3etlv8, pv::closest(), ALCARECOPPSCalTrackBasedSel_cff::detid, ETLDetId::discSide(), etlVals_, failIndex_, getMTDTopologyMode(), ETLDetId::modType(), callgraph::module, ETLDetId::module(), ETLDetId::sensor(), and findQualityFiles::size.

Referenced by MTDDetSector::vshift().

68  {
70 
71  ETLDetId start_mod(detid);
72 
73  if (verticalShift == 0) {
74  edm::LogWarning("MTDTopology") << "asking of a null verticalShift in ETL";
75  return failIndex_;
76  }
77  int vsh = verticalShift > 0 ? 1 : -1;
78 
79  int sensor = start_mod.sensor();
80  int module = start_mod.module();
81  uint32_t modtyp = start_mod.modType();
82  uint32_t discside = start_mod.discSide();
83  int geomDetIndex;
84 
85  // distinguish numbering in prev8 / v8 geometries
86  if (getMTDTopologyMode() == static_cast<int>(MTDTopologyMode::Mode::btlv3etlv8)) {
87  geomDetIndex = 2 * (module - 1) + sensor;
88  } else {
89  geomDetIndex = module;
90  }
91 
92  // ilayout number coincides at present with disc face, use this
93 
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;
97 
98  // for right type modules the offset of the total number of left modules needs to be added,
99  // what matters here is the other type, i.e. if the starting module is left the vertical shift moves towards a right type, and viceversa
100 
101  size_t nmodOffset = (modtyp == 1) ? etlVals_[discside].start_copy_[iLeft].back() - 1 : 0;
102 
103  size_t iBin(etlVals_[discside].start_copy_[iHome].size()); // never allowed
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]) {
107  iBin = iloop;
108  break;
109  }
110  }
111 
112  if (iBin == etlVals_[discside].start_copy_[iHome].size()) {
113  edm::LogWarning("MTDTopology") << "Module number not compatible with layout, abort";
114  return failIndex_;
115  }
116 
117  // define the interval of interest for the other type according to the vertical shift sign
118 
119  int iBinOther(iBin);
120  if (iHome == 0 && vsh < 0) {
121  iBinOther = iBin - 1;
122  }
123  if (iHome == 1 && vsh > 0) {
124  iBinOther = iBin + 1;
125  }
126  if (iBinOther < 0 || iBinOther >= static_cast<int>(etlVals_[discside].start_copy_[iOther].size()) - 1) {
127  return failIndex_;
128  }
129 
130  // determine the position of the other type corresponding to the same column of the home type
131 
132  int vpos = etlVals_[discside].offset_[iHome][iBin] + geomDetIndex - etlVals_[discside].start_copy_[iHome][iBin] + 1;
133  if (vpos <= etlVals_[discside].offset_[iOther][iBinOther]) {
134  closest = etlVals_[discside].start_copy_[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()))) {
142  closest = etlVals_[discside].start_copy_[iOther][iBinOther + 1] - 1;
143  }
144  if (closest < failIndex_) {
145  closest = closest + nmodOffset - 1;
146  return failIndex_;
147  } else {
148  // number of module shifted by 1 wrt the position in the array (i.e. module 1 has index 0)
149  return etlVals_[discside].start_copy_[iOther][iBinOther] + vpos - 1 -
150  etlVals_[discside].offset_[iOther][iBinOther] + nmodOffset - 1;
151  }
152 }
size
Write out results.
int getMTDTopologyMode() const
Definition: MTDTopology.h:27
int closest(std::vector< int > const &vec, int value)
const ETLValues etlVals_
Definition: MTDTopology.h:42
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:16
static constexpr size_t failIndex_
Definition: MTDTopology.h:44
Log< level::Warning, false > LogWarning

Member Data Documentation

◆ etlVals_

const ETLValues MTDTopology::etlVals_
private

Definition at line 42 of file MTDTopology.h.

Referenced by hshiftETL(), and vshiftETL().

◆ failIndex_

constexpr size_t MTDTopology::failIndex_
staticprivate
Initial value:

Definition at line 44 of file MTDTopology.h.

Referenced by hshiftETL(), and vshiftETL().

◆ mtdTopologyMode_

const int MTDTopology::mtdTopologyMode_
private

Definition at line 40 of file MTDTopology.h.

Referenced by getMTDTopologyMode().