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 58 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, volumeBasedMagneticField_160812_cfi::sectors, and jetUpdater_cfi::sort.

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

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 {
33  throw cms::Exception("MTDDetLayers") << "Not implemented scenario " << mtdTopologyMode;
34  }
35 
36  for (unsigned endcap = 0; endcap < 2; ++endcap) {
37  // number of layers is two, identical for post TDR scenarios, pick v4
38  for (unsigned layer = 1; layer <= ETLDetId::kETLv4nDisc; ++layer) {
39  vector<unsigned> sectors;
40  sectors.reserve(nSector + 1);
41  for (unsigned sector = 1; sector <= nSector; ++sector) {
42  sectors.push_back(sector);
43  }
44  MTDSectorForwardDoubleLayer* thelayer = buildLayer(endcap, layer, sectors, geo, topo);
45  if (thelayer)
46  result[endcap].push_back(thelayer);
47  }
48  }
49  //
50  // the first entry is Z+ ( MTD side 1), the second is Z- (MTD side 0)
51  //
52  pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[1], result[0]);
53  return res_pair;
54 }
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:45
ETLDetId::EtlLayout etlLayoutFromTopoMode(const int &topoMode)
static constexpr int kETLv4maxSector
Definition: ETLDetId.h:40
static constexpr int kETLv4nDisc
Definition: ETLDetId.h:42

◆ isFront()

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

Definition at line 56 of file ETLDetLayerGeometryBuilder.cc.

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

◆ makeDetSector()

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

Definition at line 125 of file ETLDetLayerGeometryBuilder.cc.

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

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