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 int mtdTopologyMode)
 

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)
 
static bool isFront (int layer, int ring, int module)
 
static MTDDetRingmakeDetRing (std::vector< const GeomDet * > &geomDets)
 
static MTDDetSectormakeDetSector (std::vector< const GeomDet * > &geomDets)
 
static bool orderGeomDets (const GeomDet *&, const GeomDet *&)
 

Detailed Description

Build the ETL DetLayers.

Author
L. Gray - FNAL

Definition at line 20 of file ETLDetLayerGeometryBuilder.h.

Constructor & Destructor Documentation

◆ ETLDetLayerGeometryBuilder()

ETLDetLayerGeometryBuilder::ETLDetLayerGeometryBuilder ( )
inlineprivate

Definition at line 29 of file ETLDetLayerGeometryBuilder.h.

29 {}

Member Function Documentation

◆ buildLayer()

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

Definition at line 73 of file ETLDetLayerGeometryBuilder.cc.

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

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 
)
staticprivate

Definition at line 136 of file ETLDetLayerGeometryBuilder.cc.

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

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

◆ buildLayers()

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

References MTDTopologyMode::barphiflat, MTDTopologyMode::btlv1etlv4, MTDTopologyMode::btlv1etlv5, makeMuonMisalignmentScenario::endcap, Exception, 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 124 of file ETLDetLayerGeometryBuilder.cc.

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

◆ makeDetRing()

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

Definition at line 126 of file ETLDetLayerGeometryBuilder.cc.

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

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

◆ makeDetSector()

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

Definition at line 205 of file ETLDetLayerGeometryBuilder.cc.

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

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

◆ orderGeomDets()

bool ETLDetLayerGeometryBuilder::orderGeomDets ( const GeomDet *&  gd1,
const GeomDet *&  gd2 
)
staticprivate

Definition at line 214 of file ETLDetLayerGeometryBuilder.cc.

214  {
215  return gd1->geographicalId().rawId() < gd2->geographicalId().rawId();
216 }

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

GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
ETLDetLayerGeometryBuilder::orderGeomDets
static bool orderGeomDets(const GeomDet *&, const GeomDet *&)
Definition: ETLDetLayerGeometryBuilder.cc:214
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
GeomDet
Definition: GeomDet.h:27
MTDRingForwardDoubleLayer
Definition: MTDRingForwardDoubleLayer.h:19
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
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:73
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
ETLDetLayerGeometryBuilder::buildLayerNew
static MTDSectorForwardDoubleLayer * buildLayerNew(int endcap, int layer, std::vector< unsigned > &sectors, const MTDGeometry &geo)
Definition: ETLDetLayerGeometryBuilder.cc:136
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
ETLDetLayerGeometryBuilder::makeDetSector
static MTDDetSector * makeDetSector(std::vector< const GeomDet * > &geomDets)
Definition: ETLDetLayerGeometryBuilder.cc:205
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:126
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
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:124
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:11
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