CMS 3D CMS Logo

List of all members | Static Public Member Functions | Private Member Functions | Static Private Member Functions
ETLDetLayerGeometryBuilder Class Reference

#include <ETLDetLayerGeometryBuilder.h>

Static Public Member Functions

static std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > buildLayers (const MTDGeometry &geo, const MTDTopology &topo)
 

Private Member Functions

 ETLDetLayerGeometryBuilder ()
 

Static Private Member Functions

static MTDRingForwardDoubleLayerbuildLayer (int endcap, int layer, std::vector< unsigned > &rings, const MTDGeometry &geo)
 
static MTDSectorForwardDoubleLayerbuildLayerNew (int endcap, int layer, std::vector< unsigned > &sectors, const MTDGeometry &geo, const MTDTopology &topo)
 
static bool isFront (int layer, int ring, int module)
 
static MTDDetRingmakeDetRing (std::vector< const GeomDet * > &geomDets)
 
static MTDDetSectormakeDetSector (std::vector< const GeomDet * > &geomDets, const MTDTopology &topo)
 

Detailed Description

Build the ETL DetLayers.

Author
L. Gray - FNAL

Definition at line 21 of file ETLDetLayerGeometryBuilder.h.

Constructor & Destructor Documentation

◆ ETLDetLayerGeometryBuilder()

ETLDetLayerGeometryBuilder::ETLDetLayerGeometryBuilder ( )
inlineprivate

Definition at line 30 of file ETLDetLayerGeometryBuilder.h.

30 {}

Member Function Documentation

◆ buildLayer()

MTDRingForwardDoubleLayer * ETLDetLayerGeometryBuilder::buildLayer ( int  endcap,
int  layer,
std::vector< unsigned > &  rings,
const MTDGeometry geo 
)
staticprivate

Definition at line 77 of file ETLDetLayerGeometryBuilder.cc.

80  {
82 
83  vector<const ForwardDetRing*> frontRings, backRings;
84 
85  for (unsigned ring : rings) {
86  vector<const GeomDet*> frontGeomDets, backGeomDets;
87  for (unsigned module = 1; module <= ETLDetId::kETLmoduleMask; ++module) {
88  ETLDetId detId(endcap, ring, module, 0);
89  const GeomDet* geomDet = geo.idToDet(detId);
90  // we sometimes loop over more chambers than there are in ring
91  bool isInFront = isFront(layer, ring, module);
92  if (geomDet != nullptr) {
93  if (isInFront) {
94  frontGeomDets.push_back(geomDet);
95  } else {
96  backGeomDets.push_back(geomDet);
97  }
98  LogTrace("MTDDetLayers") << "get ETL module " << std::hex << ETLDetId(endcap, layer, ring, module).rawId()
99  << std::dec << " at R=" << geomDet->position().perp()
100  << ", phi=" << geomDet->position().phi() << ", z= " << geomDet->position().z()
101  << " isFront? " << isInFront;
102  }
103  }
104 
105  if (!backGeomDets.empty()) {
106  backRings.push_back(makeDetRing(backGeomDets));
107  }
108 
109  if (!frontGeomDets.empty()) {
110  frontRings.push_back(makeDetRing(frontGeomDets));
111  assert(!backGeomDets.empty());
112  float frontz = frontRings[0]->position().z();
113  float backz = backRings[0]->position().z();
114  assert(std::abs(frontz) < std::abs(backz));
115  }
116  }
117 
118  // How should they be sorted?
119  // precomputed_value_sort(muDetRods.begin(), muDetRods.end(), geomsort::ExtractZ<GeometricSearchDet,float>());
120  result = new MTDRingForwardDoubleLayer(frontRings, backRings);
121  LogTrace("MTDDetLayers") << "New MTDRingForwardLayer with " << frontRings.size() << " and " << backRings.size()
122  << " rings, at Z " << result->position().z()
123  << " R1: " << result->specificSurface().innerRadius()
124  << " R2: " << result->specificSurface().outerRadius();
125  return result;
126 }

References funct::abs(), cms::cuda::assert(), TauDecayModes::dec, makeMuonMisalignmentScenario::endcap, MTDGeometry::idToDet(), ETLDetId::kETLmoduleMask, phase1PixelTopology::layer, LogTrace, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), GeomDet::position(), DetId::rawId(), mps_fire::result, relativeConstraints::ring, and PV3DBase< T, PVType, FrameType >::z().

◆ buildLayerNew()

MTDSectorForwardDoubleLayer * ETLDetLayerGeometryBuilder::buildLayerNew ( int  endcap,
int  layer,
std::vector< unsigned > &  sectors,
const MTDGeometry geo,
const MTDTopology topo 
)
staticprivate

Definition at line 140 of file ETLDetLayerGeometryBuilder.cc.

141  {
143 
144  std::vector<const MTDDetSector*> frontSectors, backSectors;
145 
146  LogDebug("MTDDetLayers") << "ETL dets array size = " << geo.detsETL().size();
147 
148  for (unsigned sector : sectors) {
149  std::vector<const GeomDet*> frontGeomDets, backGeomDets;
150  LogDebug("MTDDetLayers") << "endcap = " << endcap << " layer = " << layer << " sector = " << sector;
151 #ifdef EDM_ML_DEBUG
152  unsigned int nfront(0), nback(0);
153 #endif
154  for (auto det : geo.detsETL()) {
155  ETLDetId theMod(det->geographicalId().rawId());
156  if (theMod.mtdSide() == endcap && theMod.nDisc() == layer && theMod.sector() == static_cast<int>(sector)) {
157  LogTrace("MTDLayerDump") << std::fixed << "ETLDetId " << theMod.rawId() << " side = " << std::setw(4)
158  << theMod.mtdSide() << " Disc/Side/Sector = " << std::setw(4) << theMod.nDisc() << " "
159  << std::setw(4) << theMod.discSide() << " " << std::setw(4) << theMod.sector()
160  << " mod/type = " << std::setw(4) << theMod.module() << " " << std::setw(4)
161  << theMod.modType() << " pos = " << det->position();
162  // front layer face
163  if (theMod.discSide() == 0) {
164 #ifdef EDM_ML_DEBUG
165  nfront++;
166  LogTrace("MTDDetLayers") << "Front " << theMod.discSide() << " " << nfront;
167 #endif
168  frontGeomDets.emplace_back(det);
169  // back layer face
170  } else if (theMod.discSide() == 1) {
171 #ifdef EDM_ML_DEBUG
172  nback++;
173  LogTrace("MTDDetLayers") << "Back " << theMod.discSide() << " " << nback;
174 #endif
175  backGeomDets.emplace_back(det);
176  }
177  }
178  }
179 
180  if (!backGeomDets.empty()) {
181  std::sort(backGeomDets.begin(), backGeomDets.end(), topo.orderETLSector);
182  LogDebug("MTDDetLayers") << "backGeomDets size = " << backGeomDets.size();
183  backSectors.emplace_back(makeDetSector(backGeomDets, topo));
184  }
185 
186  if (!frontGeomDets.empty()) {
187  std::sort(frontGeomDets.begin(), frontGeomDets.end(), topo.orderETLSector);
188  LogDebug("MTDDetLayers") << "frontGeomDets size = " << frontGeomDets.size();
189  frontSectors.emplace_back(makeDetSector(frontGeomDets, topo));
190  assert(!backGeomDets.empty());
191  float frontz = frontSectors.back()->position().z();
192  float backz = backSectors.back()->position().z();
193  assert(std::abs(frontz) < std::abs(backz));
194  }
195  }
196 
197  result = new MTDSectorForwardDoubleLayer(frontSectors, backSectors);
198  LogTrace("MTDDetLayers") << "New MTDSectorForwardDoubleLayer with " << std::fixed << std::setw(14)
199  << frontSectors.size() << " and " << std::setw(14) << backSectors.size() << " rings, at Z "
200  << std::setw(14) << result->specificSurface().position().z() << " R1: " << std::setw(14)
201  << result->specificSurface().innerRadius() << " R2: " << std::setw(14)
202  << result->specificSurface().outerRadius();
203 
204  return result;
205 }

References funct::abs(), cms::cuda::assert(), MTDGeometry::detsETL(), makeMuonMisalignmentScenario::endcap, alignBH_cfg::fixed, phase1PixelTopology::layer, LogDebug, LogTrace, MTDTopology::orderETLSector(), mps_fire::result, volumeBasedMagneticField_160812_cfi::sectors, and jetUpdater_cfi::sort.

◆ buildLayers()

pair< vector< DetLayer * >, vector< DetLayer * > > ETLDetLayerGeometryBuilder::buildLayers ( const MTDGeometry geo,
const MTDTopology topo 
)
static

return.first=forward (+Z), return.second=backward (-Z) both vectors are sorted inside-out

Definition at line 21 of file ETLDetLayerGeometryBuilder.cc.

22  {
23  vector<DetLayer*> result[2]; // one for each endcap
24 
25  const int mtdTopologyMode = topo.getMTDTopologyMode();
26  if (mtdTopologyMode <= static_cast<int>(MTDTopologyMode::Mode::barphiflat)) {
27  for (unsigned endcap = 0; endcap < 2; ++endcap) {
28  // there is only one layer for ETL right now, maybe more later
29  for (unsigned layer = 0; layer < ETLDetId::kETLv1nDisc; ++layer) {
30  vector<unsigned> rings;
31  rings.reserve(ETLDetId::kETLv1maxRing + 1);
32  for (unsigned ring = 1; ring <= ETLDetId::kETLv1maxRing; ++ring) {
33  rings.push_back(ring);
34  }
35  MTDRingForwardDoubleLayer* thelayer = buildLayer(endcap, layer, rings, geo);
36  if (thelayer)
37  result[endcap].push_back(thelayer);
38  }
39  }
40  } else {
41  // number of layers is identical for post TDR scenarios, pick v4
42  // loop on number of sectors per face, two faces per disc (i.e. layer) taken into account in layer building (front/back)
43  unsigned int nSector(1);
44  switch (mtdTopologyMode) {
45  case static_cast<int>(MTDTopologyMode::Mode::btlv1etlv4):
46  nSector *= ETLDetId::kETLv4maxSector;
47  break;
48  case static_cast<int>(MTDTopologyMode::Mode::btlv1etlv5):
49  nSector *= ETLDetId::kETLv5maxSector;
50  break;
51  default:
52  throw cms::Exception("MTDDetLayers") << "Not implemented scenario " << mtdTopologyMode;
53  break;
54  }
55 
56  for (unsigned endcap = 0; endcap < 2; ++endcap) {
57  // number of layers is two, identical for post TDR scenarios, pick v4
58  for (unsigned layer = 1; layer <= ETLDetId::kETLv4nDisc; ++layer) {
59  vector<unsigned> sectors;
60  sectors.reserve(nSector + 1);
61  for (unsigned sector = 1; sector <= nSector; ++sector) {
62  sectors.push_back(sector);
63  }
65  if (thelayer)
66  result[endcap].push_back(thelayer);
67  }
68  }
69  }
70  //
71  // the first entry is Z+ ( MTD side 1), the second is Z- (MTD side 0)
72  //
73  pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[1], result[0]);
74  return res_pair;
75 }

References MTDTopologyMode::barphiflat, MTDTopologyMode::btlv1etlv4, MTDTopologyMode::btlv1etlv5, makeMuonMisalignmentScenario::endcap, Exception, MTDTopology::getMTDTopologyMode(), ETLDetId::kETLv1maxRing, ETLDetId::kETLv1nDisc, ETLDetId::kETLv4maxSector, ETLDetId::kETLv4nDisc, ETLDetId::kETLv5maxSector, phase1PixelTopology::layer, mps_fire::result, relativeConstraints::ring, and volumeBasedMagneticField_160812_cfi::sectors.

Referenced by MTDDetLayerGeometry::buildLayers().

◆ isFront()

bool ETLDetLayerGeometryBuilder::isFront ( int  layer,
int  ring,
int  module 
)
staticprivate

Definition at line 128 of file ETLDetLayerGeometryBuilder.cc.

128 { return (module + 1) % 2; }

◆ makeDetRing()

MTDDetRing * ETLDetLayerGeometryBuilder::makeDetRing ( std::vector< const GeomDet * > &  geomDets)
staticprivate

Definition at line 130 of file ETLDetLayerGeometryBuilder.cc.

130  {
131  precomputed_value_sort(geomDets.begin(), geomDets.end(), geomsort::DetPhi());
132  MTDDetRing* result = new MTDDetRing(geomDets);
133  LogTrace("MTDDetLayers") << "ETLDetLayerGeometryBuilder: new MTDDetRing with " << geomDets.size()
134  << " chambers at z=" << result->position().z()
135  << " R1: " << result->specificSurface().innerRadius()
136  << " R2: " << result->specificSurface().outerRadius();
137  return result;
138 }

References LogTrace, precomputed_value_sort(), and mps_fire::result.

◆ makeDetSector()

MTDDetSector * ETLDetLayerGeometryBuilder::makeDetSector ( std::vector< const GeomDet * > &  geomDets,
const MTDTopology topo 
)
staticprivate

Definition at line 207 of file ETLDetLayerGeometryBuilder.cc.

207  {
208  MTDDetSector* result = new MTDDetSector(geomDets, topo);
209  LogTrace("MTDDetLayers") << "ETLDetLayerGeometryBuilder::makeDetSector new MTDDetSector with " << std::fixed
210  << std::setw(14) << geomDets.size() << " modules \n"
211  << (*result);
212 
213  return result;
214 }

References alignBH_cfg::fixed, LogTrace, and mps_fire::result.

GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
GeomDet
Definition: GeomDet.h:27
MTDRingForwardDoubleLayer
Definition: MTDRingForwardDoubleLayer.h:19
ETLDetLayerGeometryBuilder::makeDetSector
static MTDDetSector * makeDetSector(std::vector< const GeomDet * > &geomDets, const MTDTopology &topo)
Definition: ETLDetLayerGeometryBuilder.cc:207
cms::cuda::assert
assert(be >=bs)
MTDTopologyMode::Mode::barphiflat
ETLDetId
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
ETLDetId::kETLv4nDisc
static constexpr int kETLv4nDisc
Definition: ETLDetId.h:42
MTDTopology::getMTDTopologyMode
int getMTDTopologyMode() const
Definition: MTDTopology.h:27
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
MTDGeometry::detsETL
const DetContainer & detsETL() const
Definition: MTDGeometry.cc:161
MTDTopologyMode::Mode::btlv1etlv5
geomsort::DetPhi
ExtractPhi< GeomDet, float > DetPhi
Definition: DetSorting.h:37
MTDGeometry::idToDet
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:171
ETLDetLayerGeometryBuilder::buildLayer
static MTDRingForwardDoubleLayer * buildLayer(int endcap, int layer, std::vector< unsigned > &rings, const MTDGeometry &geo)
Definition: ETLDetLayerGeometryBuilder.cc:77
ETLDetLayerGeometryBuilder::buildLayerNew
static MTDSectorForwardDoubleLayer * buildLayerNew(int endcap, int layer, std::vector< unsigned > &sectors, const MTDGeometry &geo, const MTDTopology &topo)
Definition: ETLDetLayerGeometryBuilder.cc:140
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
MTDSectorForwardDoubleLayer
Definition: MTDSectorForwardDoubleLayer.h:11
ETLDetLayerGeometryBuilder::makeDetRing
static MTDDetRing * makeDetRing(std::vector< const GeomDet * > &geomDets)
Definition: ETLDetLayerGeometryBuilder.cc:130
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
ETLDetId::kETLmoduleMask
static const uint32_t kETLmoduleMask
Definition: ETLDetId.h:24
MTDTopology::orderETLSector
static bool orderETLSector(const GeomDet *&gd1, const GeomDet *&gd2)
Definition: MTDTopology.cc:7
Exception
Definition: hltDiff.cc:245
ETLDetId::kETLv1maxRing
static constexpr int kETLv1maxRing
Definition: ETLDetId.h:28
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
ETLDetLayerGeometryBuilder::isFront
static bool isFront(int layer, int ring, int module)
Definition: ETLDetLayerGeometryBuilder.cc:128
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
MTDDetSector
Definition: MTDDetSector.h:12
volumeBasedMagneticField_160812_cfi.sectors
sectors
Definition: volumeBasedMagneticField_160812_cfi.py:59
precomputed_value_sort
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
Definition: precomputed_value_sort.h:17
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
MTDDetRing
Definition: MTDDetRing.h:16
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
MTDTopologyMode::Mode::btlv1etlv4
ETLDetId::kETLv1nDisc
static constexpr int kETLv1nDisc
Definition: ETLDetId.h:30