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 MTDSectorForwardDoubleLayerbuildLayer (int endcap, int layer, std::vector< unsigned > &sectors, const MTDGeometry &geo, const MTDTopology &topo)
 
static bool isFront (int layer, int ring, int module)
 
static MTDDetSectormakeDetSector (std::vector< const GeomDet *> &geomDets, const MTDTopology &topo)
 

Detailed Description

Build the ETL DetLayers.

Author
L. Gray - FNAL

Definition at line 19 of file ETLDetLayerGeometryBuilder.h.

Constructor & Destructor Documentation

◆ ETLDetLayerGeometryBuilder()

ETLDetLayerGeometryBuilder::ETLDetLayerGeometryBuilder ( )
inlineprivate

Definition at line 28 of file ETLDetLayerGeometryBuilder.h.

28 {}

Member Function Documentation

◆ buildLayer()

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

Definition at line 60 of file ETLDetLayerGeometryBuilder.cc.

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

61  {
63 
64  std::vector<const MTDDetSector*> frontSectors, backSectors;
65 
66  LogDebug("MTDDetLayers") << "ETL dets array size = " << geo.detsETL().size();
67 
68  for (unsigned sector : sectors) {
69  std::vector<const GeomDet*> frontGeomDets, backGeomDets;
70  LogDebug("MTDDetLayers") << "endcap = " << endcap << " layer = " << layer << " sector = " << sector;
71 #ifdef EDM_ML_DEBUG
72  unsigned int nfront(0), nback(0);
73 #endif
74  for (auto det : geo.detsETL()) {
75  ETLDetId theMod(det->geographicalId().rawId());
76  if (theMod.mtdSide() == endcap && theMod.nDisc() == layer && theMod.sector() == static_cast<int>(sector)) {
77  LogTrace("MTDLayerDump") << std::fixed << "ETLDetId " << theMod.rawId() << " side = " << std::setw(4)
78  << theMod.mtdSide() << " Disc/Side/Sector = " << std::setw(4) << theMod.nDisc() << " "
79  << std::setw(4) << theMod.discSide() << " " << std::setw(4) << theMod.sector()
80  << " mod/type = " << std::setw(4) << theMod.module() << " " << std::setw(4)
81  << theMod.modType() << " pos = " << det->position();
82  // front layer face
83  if (theMod.discSide() == 0) {
84 #ifdef EDM_ML_DEBUG
85  nfront++;
86  LogTrace("MTDDetLayers") << "Front " << theMod.discSide() << " " << nfront;
87 #endif
88  frontGeomDets.emplace_back(det);
89  // back layer face
90  } else if (theMod.discSide() == 1) {
91 #ifdef EDM_ML_DEBUG
92  nback++;
93  LogTrace("MTDDetLayers") << "Back " << theMod.discSide() << " " << nback;
94 #endif
95  backGeomDets.emplace_back(det);
96  }
97  }
98  }
99 
100  if (!backGeomDets.empty()) {
101  std::sort(backGeomDets.begin(), backGeomDets.end(), topo.orderETLSector);
102  LogDebug("MTDDetLayers") << "backGeomDets size = " << backGeomDets.size();
103  backSectors.emplace_back(makeDetSector(backGeomDets, topo));
104  }
105 
106  if (!frontGeomDets.empty()) {
107  std::sort(frontGeomDets.begin(), frontGeomDets.end(), topo.orderETLSector);
108  LogDebug("MTDDetLayers") << "frontGeomDets size = " << frontGeomDets.size();
109  frontSectors.emplace_back(makeDetSector(frontGeomDets, topo));
110  assert(!backGeomDets.empty());
111  float frontz = frontSectors.back()->position().z();
112  float backz = backSectors.back()->position().z();
113  assert(std::abs(frontz) < std::abs(backz));
114  }
115  }
116 
117  result = new MTDSectorForwardDoubleLayer(frontSectors, backSectors);
118  LogTrace("MTDDetLayers") << "New MTDSectorForwardDoubleLayer with " << std::fixed << std::setw(14)
119  << frontSectors.size() << " and " << std::setw(14) << backSectors.size() << " rings, at Z "
120  << std::setw(14) << result->specificSurface().position().z() << " R1: " << std::setw(14)
121  << result->specificSurface().innerRadius() << " R2: " << std::setw(14)
122  << result->specificSurface().outerRadius();
123 
124  return result;
125 }
static MTDDetSector * makeDetSector(std::vector< const GeomDet *> &geomDets, const MTDTopology &topo)
const DetContainer & detsETL() const
Definition: MTDGeometry.cc:161
assert(be >=bs)
#define LogTrace(id)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static bool orderETLSector(const GeomDet *&gd1, const GeomDet *&gd2)
Definition: MTDTopology.cc:8
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:16
#define LogDebug(id)

◆ 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 19 of file ETLDetLayerGeometryBuilder.cc.

References makeMuonMisalignmentScenario::endcap, MTDTopologyMode::etlLayoutFromTopoMode(), Exception, MTDTopology::getMTDTopologyMode(), ETLDetId::kETLv4maxSector, ETLDetId::kETLv4nDisc, ETLDetId::kETLv5maxSector, mps_fire::result, nano_mu_digi_cff::sector, mergeVDriftHistosByStation::sectors, ETLDetId::v4, ETLDetId::v5, and ETLDetId::v8.

Referenced by MTDDetLayerGeometry::buildLayers().

20  {
21  vector<DetLayer*> result[2]; // one for each endcap
22 
23  const int mtdTopologyMode = topo.getMTDTopologyMode();
25  // number of layers is identical for post TDR scenarios, pick v4
26  // loop on number of sectors per face, two faces per disc (i.e. layer) taken into account in layer building (front/back)
27  unsigned int nSector(1);
28  if (etlL == ETLDetId::EtlLayout::v4) {
29  nSector *= ETLDetId::kETLv4maxSector;
30  } else if (etlL == ETLDetId::EtlLayout::v5) {
31  nSector *= ETLDetId::kETLv5maxSector;
32  } else if (etlL == ETLDetId::EtlLayout::v8) {
33  nSector *= ETLDetId::kETLv5maxSector;
34  } else {
35  throw cms::Exception("MTDDetLayers") << "Not implemented scenario " << mtdTopologyMode;
36  }
37 
38  for (unsigned endcap = 0; endcap < 2; ++endcap) {
39  // number of layers is two, identical for post TDR scenarios, pick v4
40  for (unsigned layer = 1; layer <= ETLDetId::kETLv4nDisc; ++layer) {
41  vector<unsigned> sectors;
42  sectors.reserve(nSector + 1);
43  for (unsigned sector = 1; sector <= nSector; ++sector) {
44  sectors.push_back(sector);
45  }
46  MTDSectorForwardDoubleLayer* thelayer = buildLayer(endcap, layer, sectors, geo, topo);
47  if (thelayer)
48  result[endcap].push_back(thelayer);
49  }
50  }
51  //
52  // the first entry is Z+ ( MTD side 1), the second is Z- (MTD side 0)
53  //
54  pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[1], result[0]);
55  return res_pair;
56 }
int getMTDTopologyMode() const
Definition: MTDTopology.h:27
static MTDSectorForwardDoubleLayer * buildLayer(int endcap, int layer, std::vector< unsigned > &sectors, const MTDGeometry &geo, const MTDTopology &topo)
static constexpr int kETLv5maxSector
Definition: ETLDetId.h:48
ETLDetId::EtlLayout etlLayoutFromTopoMode(const int &topoMode)
static constexpr int kETLv4maxSector
Definition: ETLDetId.h:43
static constexpr int kETLv4nDisc
Definition: ETLDetId.h:45

◆ isFront()

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

Definition at line 58 of file ETLDetLayerGeometryBuilder.cc.

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

◆ makeDetSector()

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

Definition at line 127 of file ETLDetLayerGeometryBuilder.cc.

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

127  {
128  MTDDetSector* result = new MTDDetSector(geomDets, topo);
129  LogTrace("MTDDetLayers") << "ETLDetLayerGeometryBuilder::makeDetSector new MTDDetSector with " << std::fixed
130  << std::setw(14) << geomDets.size() << " modules \n"
131  << (*result);
132 
133  return result;
134 }
#define LogTrace(id)