CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
MTDSectorForwardDoubleLayer
buildLayerNew (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 ( )
inlineprivate

Definition at line 30 of file ETLDetLayerGeometryBuilder.h.

30 {}

Member Function Documentation

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

Definition at line 77 of file ETLDetLayerGeometryBuilder.cc.

References funct::abs(), cms::cuda::assert(), TauDecayModes::dec, MTDGeometry::idToDet(), ETLDetId::kETLmoduleMask, LogTrace, callgraph::module, 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().

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 }
static MTDDetRing * makeDetRing(std::vector< const GeomDet * > &geomDets)
T perp() const
Definition: PV3DBase.h:69
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
assert(be >=bs)
#define LogTrace(id)
static bool isFront(int layer, int ring, int module)
constexpr std::array< uint8_t, layerIndexSize > layer
tuple result
Definition: mps_fire.py:311
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
T z() const
Definition: PV3DBase.h:61
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:171
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const uint32_t kETLmoduleMask
Definition: ETLDetId.h:24
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
tuple module
Definition: callgraph.py:69
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.

References funct::abs(), cms::cuda::assert(), MTDGeometry::detsETL(), LogDebug, LogTrace, MTDTopology::orderETLSector(), mps_fire::result, and ForwardDetLayer::specificSurface().

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 }
const DetContainer & detsETL() const
Definition: MTDGeometry.cc:161
assert(be >=bs)
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize > layer
tuple result
Definition: mps_fire.py:311
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static bool orderETLSector(const GeomDet *&gd1, const GeomDet *&gd2)
Definition: MTDTopology.cc:7
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
virtual const BoundDisk & specificSurface() const final
static MTDDetSector * makeDetSector(std::vector< const GeomDet * > &geomDets, const MTDTopology &topo)
#define LogDebug(id)
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.

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

Referenced by MTDDetLayerGeometry::buildLayers().

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  }
64  MTDSectorForwardDoubleLayer* thelayer = buildLayerNew(endcap, layer, sectors, geo, topo);
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 }
int getMTDTopologyMode() const
Definition: MTDTopology.h:27
constexpr std::array< uint8_t, layerIndexSize > layer
tuple result
Definition: mps_fire.py:311
static constexpr int kETLv1maxRing
Definition: ETLDetId.h:28
static constexpr int kETLv5maxSector
Definition: ETLDetId.h:45
static constexpr int kETLv4maxSector
Definition: ETLDetId.h:40
static constexpr int kETLv4nDisc
Definition: ETLDetId.h:42
static MTDRingForwardDoubleLayer * buildLayer(int endcap, int layer, std::vector< unsigned > &rings, const MTDGeometry &geo)
static constexpr int kETLv1nDisc
Definition: ETLDetId.h:30
static MTDSectorForwardDoubleLayer * buildLayerNew(int endcap, int layer, std::vector< unsigned > &sectors, const MTDGeometry &geo, const MTDTopology &topo)
bool ETLDetLayerGeometryBuilder::isFront ( int  layer,
int  ring,
int  module 
)
staticprivate

Definition at line 128 of file ETLDetLayerGeometryBuilder.cc.

128 { return (module + 1) % 2; }
tuple module
Definition: callgraph.py:69
MTDDetRing * ETLDetLayerGeometryBuilder::makeDetRing ( std::vector< const GeomDet * > &  geomDets)
staticprivate

Definition at line 130 of file ETLDetLayerGeometryBuilder.cc.

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

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 }
ExtractPhi< GeomDet, float > DetPhi
Definition: DetSorting.h:37
#define LogTrace(id)
tuple result
Definition: mps_fire.py:311
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
MTDDetSector * ETLDetLayerGeometryBuilder::makeDetSector ( std::vector< const GeomDet * > &  geomDets,
const MTDTopology topo 
)
staticprivate

Definition at line 207 of file ETLDetLayerGeometryBuilder.cc.

References LogTrace, and mps_fire::result.

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 }
#define LogTrace(id)
tuple result
Definition: mps_fire.py:311