23 vector<DetLayer*>
result[2];
30 vector<unsigned> rings;
33 rings.push_back(
ring);
37 result[
endcap].push_back(thelayer);
43 unsigned int nSector(1);
44 switch (mtdTopologyMode) {
52 throw cms::Exception(
"MTDDetLayers") <<
"Not implemented scenario " << mtdTopologyMode;
60 sectors.reserve(nSector + 1);
61 for (
unsigned sector = 1; sector <= nSector; ++sector) {
62 sectors.push_back(sector);
66 result[
endcap].push_back(thelayer);
73 pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[1], result[0]);
79 vector<unsigned>& rings,
83 vector<const ForwardDetRing*> frontRings, backRings;
85 for (
unsigned ring : rings) {
86 vector<const GeomDet*> frontGeomDets, backGeomDets;
92 if (geomDet !=
nullptr) {
94 frontGeomDets.push_back(geomDet);
96 backGeomDets.push_back(geomDet);
101 <<
" isFront? " << isInFront;
105 if (!backGeomDets.empty()) {
106 backRings.push_back(makeDetRing(backGeomDets));
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();
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();
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();
144 std::vector<const MTDDetSector*> frontSectors, backSectors;
146 LogDebug(
"MTDDetLayers") <<
"ETL dets array size = " << geo.
detsETL().size();
148 for (
unsigned sector : sectors) {
149 std::vector<const GeomDet*> frontGeomDets, backGeomDets;
150 LogDebug(
"MTDDetLayers") <<
"endcap = " << endcap <<
" layer = " << layer <<
" sector = " << sector;
152 unsigned int nfront(0), nback(0);
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();
163 if (theMod.discSide() == 0) {
166 LogTrace(
"MTDDetLayers") <<
"Front " << theMod.discSide() <<
" " << nfront;
168 frontGeomDets.emplace_back(det);
170 }
else if (theMod.discSide() == 1) {
173 LogTrace(
"MTDDetLayers") <<
"Back " << theMod.discSide() <<
" " << nback;
175 backGeomDets.emplace_back(det);
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));
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();
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)
209 LogTrace(
"MTDDetLayers") <<
"ETLDetLayerGeometryBuilder::makeDetSector new MTDDetSector with " << std::fixed
210 << std::setw(14) << geomDets.size() <<
" modules \n"
static MTDDetRing * makeDetRing(std::vector< const GeomDet * > &geomDets)
ExtractPhi< GeomDet, float > DetPhi
const DetContainer & detsETL() const
Geom::Phi< T > phi() const
int getMTDTopologyMode() const
constexpr uint32_t rawId() const
get the raw id
static bool isFront(int layer, int ring, int module)
constexpr std::array< uint8_t, layerIndexSize > layer
const Surface::PositionType & position() const
The position (origin of the R.F.)
const MTDGeomDet * idToDet(DetId) const override
Abs< T >::type abs(const T &t)
static bool orderETLSector(const GeomDet *&gd1, const GeomDet *&gd2)
static constexpr int kETLv1maxRing
static constexpr int kETLv5maxSector
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
static constexpr int kETLv4maxSector
static const uint32_t kETLmoduleMask
Detector identifier class for the Endcap Timing Layer.
static std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > buildLayers(const MTDGeometry &geo, const MTDTopology &topo)
virtual const BoundDisk & specificSurface() const final
static constexpr int kETLv4nDisc
static MTDRingForwardDoubleLayer * buildLayer(int endcap, int layer, std::vector< unsigned > &rings, const MTDGeometry &geo)
static constexpr int kETLv1nDisc
static MTDDetSector * makeDetSector(std::vector< const GeomDet * > &geomDets, const MTDTopology &topo)
static MTDSectorForwardDoubleLayer * buildLayerNew(int endcap, int layer, std::vector< unsigned > §ors, const MTDGeometry &geo, const MTDTopology &topo)