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 4 of file MTDTopology.cc.

5  : mtdTopologyMode_(topologyMode), etlVals_(etl) {}

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 20 of file MTDTopology.cc.

20  {
21  ETLDetId start_mod(detid);
22 
23  if (horizontalShift == 0) {
24  edm::LogWarning("MTDTopology") << "asking of a null horizotalShift in ETL";
25  return failIndex_;
26  }
27  int hsh = horizontalShift > 0 ? 1 : -1;
28 
29  int module = start_mod.module();
30  uint32_t modtyp = start_mod.modType();
31  uint32_t discside = start_mod.discSide();
32 
33  // ilayout number coincides at present with disc face, use this
34 
35  size_t iHome = (modtyp == etlVals_[discside].idDetType1_) ? 0 : 1;
36  size_t iLeft = (etlVals_[discside].idDetType1_ == 1) ? 0 : 1;
37 
38  // 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
39 
40  size_t nmodOffset = (modtyp == 1) ? 0 : etlVals_[discside].start_copy_[iLeft].back() - 1;
41 
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;
48  }
49  break;
50  }
51  }
52 
53  return failIndex_;
54 }

References ETLDetId::discSide(), etlVals_, failIndex_, ETLDetId::modType(), callgraph::module, and ETLDetId::module().

Referenced by MTDDetSector::hshift().

◆ orderETLSector()

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

Definition at line 7 of file MTDTopology.cc.

7  {
8  ETLDetId det1(gd1->geographicalId().rawId());
9  ETLDetId det2(gd2->geographicalId().rawId());
10 
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();
15  } else {
16  return det1.module() < det2.module();
17  }
18 }

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

Referenced by ETLDetLayerGeometryBuilder::buildLayerNew().

◆ vshiftETL()

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

Definition at line 56 of file MTDTopology.cc.

56  {
57  closest = failIndex_;
58 
59  ETLDetId start_mod(detid);
60 
61  if (verticalShift == 0) {
62  edm::LogWarning("MTDTopology") << "asking of a null verticalShift in ETL";
63  return failIndex_;
64  }
65  int vsh = verticalShift > 0 ? 1 : -1;
66 
67  int module = start_mod.module();
68  uint32_t modtyp = start_mod.modType();
69  uint32_t discside = start_mod.discSide();
70 
71  // ilayout number coincides at present with disc face, use this
72 
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;
76 
77  // for right type modules the offset of the total number of left modules needs to be added,
78  // 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
79 
80  size_t nmodOffset = (modtyp == 1) ? etlVals_[discside].start_copy_[iLeft].back() - 1 : 0;
81 
82  size_t iBin(etlVals_[discside].start_copy_[iHome].size()); // never allowed
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]) {
86  iBin = iloop;
87  break;
88  }
89  }
90 
91  if (iBin == etlVals_[discside].start_copy_[iHome].size()) {
92  edm::LogWarning("MTDTopology") << "Module number not compatible with layout, abort";
93  return failIndex_;
94  }
95 
96  // define the interval of interest for the other type according to the vertical shift sign
97 
98  int iBinOther(iBin);
99  if (iHome == 0 && vsh < 0) {
100  iBinOther = iBin - 1;
101  }
102  if (iHome == 1 && vsh > 0) {
103  iBinOther = iBin + 1;
104  }
105  if (iBinOther < 0 || iBinOther >= static_cast<int>(etlVals_[discside].start_copy_[iOther].size()) - 1) {
106  return failIndex_;
107  }
108 
109  // determine the position of the other type corresponding to the same column of the home type
110 
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;
122  }
123  if (closest < failIndex_) {
124  closest = closest + nmodOffset - 1;
125  return failIndex_;
126  } else {
127  // number of module shifted by 1 wrt the position in the array (i.e. module 1 has index 0)
128  return etlVals_[discside].start_copy_[iOther][iBinOther] + vpos - 1 -
129  etlVals_[discside].offset_[iOther][iBinOther] + nmodOffset - 1;
130  }
131 }

References ETLDetId::discSide(), etlVals_, failIndex_, ETLDetId::modType(), callgraph::module, ETLDetId::module(), and findQualityFiles::size.

Referenced by MTDDetSector::vshift().

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_
staticconstexprprivate
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().

MTDTopology::etlVals_
const ETLValues etlVals_
Definition: MTDTopology.h:42
MTDTopology::failIndex_
static constexpr size_t failIndex_
Definition: MTDTopology.h:44
ETLDetId
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
MTDDetId::mtdRR
int mtdRR() const
Definition: MTDDetId.h:64
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
callgraph.module
module
Definition: callgraph.py:61
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
MTDTopology::mtdTopologyMode_
const int mtdTopologyMode_
Definition: MTDTopology.h:40
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443