CMS 3D CMS Logo

BTLDetLayerGeometryBuilder.cc
Go to the documentation of this file.
1 //#define EDM_ML_DEBUG
2 
4 
10 
13 
15 
16 #include <iostream>
17 
18 using namespace std;
19 
21 
23 
24 vector<DetLayer*> BTLDetLayerGeometryBuilder::buildLayers(const MTDGeometry& geo, const MTDTopology& topo) {
25  vector<DetLayer*> detlayers;
26  vector<MTDTrayBarrelLayer*> result;
27 
28  vector<const DetRod*> btlDetTrays;
29 
30  const int mtdTopologyMode = topo.getMTDTopologyMode();
32 
33  if (btlL != BTLDetId::CrysLayout::v2 && btlL != BTLDetId::CrysLayout::v3) {
34  for (unsigned tray = 1; tray <= BTLDetId::HALF_ROD; ++tray) {
35  vector<const GeomDet*> geomDets;
36  for (unsigned module = 1; module <= BTLDetId::kModulesPerRODBarPhiFlat; ++module) {
37  for (unsigned side = 0; side <= 1; ++side) {
38  const GeomDet* geomDet = geo.idToDet(BTLDetId(side, tray, module, 0, 1));
39  if (geomDet != nullptr) {
40  geomDets.push_back(geomDet);
41  LogTrace("MTDDetLayers") << "get BTL module " << std::hex << BTLDetId(side, tray, module, 0, 1).rawId()
42  << std::dec << " at R=" << geomDet->position().perp()
43  << ", phi=" << geomDet->position().phi();
44  }
45  }
46  }
47 
48  if (!geomDets.empty()) {
49  precomputed_value_sort(geomDets.begin(), geomDets.end(), geomsort::DetZ());
50  btlDetTrays.push_back(new MTDDetTray(geomDets));
51  LogTrace("MTDDetLayers") << " New BTLDetTray with " << geomDets.size()
52  << " modules at R=" << btlDetTrays.back()->position().perp()
53  << ", phi=" << btlDetTrays.back()->position().phi();
54  }
55  }
56 
57  precomputed_value_sort(btlDetTrays.begin(), btlDetTrays.end(), geomsort::ExtractPhi<GeometricSearchDet, float>());
58  result.push_back(new MTDTrayBarrelLayer(btlDetTrays));
59  LogTrace("MTDDetLayers") << "BTLDetLayerGeometryBuilder: new MTDTrayBarrelLayer with " << btlDetTrays.size()
60  << " rods, at R " << result.back()->specificSurface().radius();
61  } else {
62  vector<const GeomDet*> geomDets;
63 
64  // logical tracking trays are now rows along z of modules, 3 per each mechanical tray, running from -z to z
65  // MTDGeometry is already built with the proper ordering, it is enough to exploit that
66  const uint32_t modulesPerDetTray =
68  geomDets.reserve(modulesPerDetTray);
69 
70  uint32_t index(0);
71  for (const auto& det : geo.detsBTL()) {
72  index++;
73  geomDets.emplace_back(det);
74  if (index == modulesPerDetTray) {
75  btlDetTrays.emplace_back(new MTDDetTray(geomDets));
76  LogTrace("MTDDetLayers") << " New BTLDetTray with " << geomDets.size()
77  << " modules at R=" << btlDetTrays.back()->position().perp()
78  << ", phi=" << btlDetTrays.back()->position().phi();
79  index = 0;
80  geomDets.clear();
81  }
82  }
83 
84  result.emplace_back(new MTDTrayBarrelLayer(btlDetTrays));
85  LogTrace("MTDDetLayers") << "BTLDetLayerGeometryBuilder: new MTDTrayBarrelLayer with " << btlDetTrays.size()
86  << " rods, at R " << result.back()->specificSurface().radius();
87  }
88 
89  for (vector<MTDTrayBarrelLayer*>::const_iterator it = result.begin(); it != result.end(); it++)
90  detlayers.push_back((DetLayer*)(*it));
91 
92  return detlayers;
93 }
static std::vector< DetLayer * > buildLayers(const MTDGeometry &geo, const MTDTopology &topo)
Operations.
int getMTDTopologyMode() const
Definition: MTDTopology.h:27
T perp() const
Definition: PV3DBase.h:69
CrysLayout
Definition: BTLDetId.h:46
const DetContainer & detsBTL() const
Definition: MTDGeometry.cc:159
static constexpr uint32_t kCrystalTypes
Definition: BTLDetId.h:38
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
#define LogTrace(id)
ExtractZ< GeomDet, float > DetZ
Definition: DetSorting.h:50
static constexpr uint32_t HALF_ROD
range constants, need two sets for the time being (one for tiles and one for bars) ...
Definition: BTLDetId.h:31
static constexpr uint32_t kModulesPerRODBarPhiFlat
Definition: BTLDetId.h:32
static constexpr uint32_t kModulesPerTrkV2
Definition: BTLDetId.h:37
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:171
static constexpr uint32_t kModulesPerRUV2
Definition: BTLDetId.h:35
virtual ~BTLDetLayerGeometryBuilder()
Destructor.
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
static constexpr uint32_t kRUPerTypeV2
Definition: BTLDetId.h:34
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:19
BTLDetId::CrysLayout crysLayoutFromTopoMode(const int &topoMode)