CMS 3D CMS Logo

ETLDetLayerGeometryBuilder.cc
Go to the documentation of this file.
2 
7 
10 
12 
13 #include <iostream>
14 
15 using namespace std;
16 
17 pair<vector<DetLayer*>, vector<DetLayer*> > ETLDetLayerGeometryBuilder::buildLayers(const MTDGeometry& geo) {
18  vector<DetLayer*> result[2]; // one for each endcap
19 
20  for (unsigned endcap = 0; endcap < 2; ++endcap) {
21  // there is only one layer for ETL right now, maybe more later
22  for (unsigned layer = 0; layer <= 0; ++layer) {
23  vector<unsigned> rings;
24  for (unsigned ring = 1; ring <= 12; ++ring) {
25  rings.push_back(ring);
26  }
27  MTDRingForwardDoubleLayer* thelayer = buildLayer(endcap, layer, rings, geo);
28  if (thelayer)
29  result[endcap].push_back(thelayer);
30  }
31  }
32  pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[0], result[1]);
33  return res_pair;
34 }
35 
37  int layer,
38  vector<unsigned>& rings,
39  const MTDGeometry& geo) {
40  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|ETLDetLayerGeometryBuilder";
42 
43  vector<const ForwardDetRing*> frontRings, backRings;
44 
45  for (unsigned ring : rings) {
46  vector<const GeomDet*> frontGeomDets, backGeomDets;
47  for (unsigned module = 1; module <= ETLDetId::kETLmoduleMask; ++module) {
48  ETLDetId detId(endcap, ring, module, 0);
49  const GeomDet* geomDet = geo.idToDet(detId);
50  // we sometimes loop over more chambers than there are in ring
51  bool isInFront = isFront(layer, ring, module);
52  if (geomDet != nullptr) {
53  if (isInFront) {
54  frontGeomDets.push_back(geomDet);
55  } else {
56  backGeomDets.push_back(geomDet);
57  }
58  LogTrace(metname) << "get ETL module " << std::hex << ETLDetId(endcap, layer, ring, module).rawId() << std::dec
59  << " at R=" << geomDet->position().perp() << ", phi=" << geomDet->position().phi()
60  << ", z= " << geomDet->position().z() << " isFront? " << isInFront << std::endl;
61  }
62  }
63 
64  if (!backGeomDets.empty()) {
65  backRings.push_back(makeDetRing(backGeomDets));
66  }
67 
68  if (!frontGeomDets.empty()) {
69  frontRings.push_back(makeDetRing(frontGeomDets));
70  assert(!backGeomDets.empty());
71  float frontz = frontRings[0]->position().z();
72  float backz = backRings[0]->position().z();
73  assert(fabs(frontz) < fabs(backz));
74  }
75  }
76 
77  // How should they be sorted?
78  // precomputed_value_sort(muDetRods.begin(), muDetRods.end(), geomsort::ExtractZ<GeometricSearchDet,float>());
79  result = new MTDRingForwardDoubleLayer(frontRings, backRings);
80  LogTrace(metname) << "New MTDRingForwardLayer with " << frontRings.size() << " and " << backRings.size()
81  << " rings, at Z " << result->position().z() << " R1: " << result->specificSurface().innerRadius()
82  << " R2: " << result->specificSurface().outerRadius() << std::endl;
83  return result;
84 }
85 
86 bool ETLDetLayerGeometryBuilder::isFront(int layer, int ring, int module) { return (module + 1) % 2; }
87 
88 MTDDetRing* ETLDetLayerGeometryBuilder::makeDetRing(vector<const GeomDet*>& geomDets) {
89  const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|ETLDetLayerGeometryBuilder";
90 
91  precomputed_value_sort(geomDets.begin(), geomDets.end(), geomsort::DetPhi());
92  MTDDetRing* result = new MTDDetRing(geomDets);
93  LogTrace(metname) << "New MTDDetRing with " << geomDets.size() << " chambers at z=" << result->position().z()
94  << " R1: " << result->specificSurface().innerRadius()
95  << " R2: " << result->specificSurface().outerRadius() << std::endl;
96  ;
97  return result;
98 }
GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
MessageLogger.h
GeomDet
Definition: GeomDet.h:27
MTDRingForwardDoubleLayer
Definition: MTDRingForwardDoubleLayer.h:19
cms::cuda::assert
assert(be >=bs)
ETLDetId
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
ETLDetId.h
precomputed_value_sort.h
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetSorting.h
geomsort::DetPhi
ExtractPhi< GeomDet, float > DetPhi
Definition: DetSorting.h:37
MTDGeometry::idToDet
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:171
ETLDetLayerGeometryBuilder::buildLayer
static MTDRingForwardDoubleLayer * buildLayer(int endcap, int layer, std::vector< unsigned > &rings, const MTDGeometry &geo)
Definition: ETLDetLayerGeometryBuilder.cc:36
ETLDetLayerGeometryBuilder.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MTDRingForwardDoubleLayer.h
MTDDetRing.h
module
Definition: vlib.h:198
ETLDetLayerGeometryBuilder::makeDetRing
static MTDDetRing * makeDetRing(std::vector< const GeomDet * > &geomDets)
Definition: ETLDetLayerGeometryBuilder.cc:88
ETLDetLayerGeometryBuilder::buildLayers
static std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > buildLayers(const MTDGeometry &geo)
Definition: ETLDetLayerGeometryBuilder.cc:17
MTDGeometry
Definition: MTDGeometry.h:14
GeomDet.h
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
ETLDetId::kETLmoduleMask
static const uint32_t kETLmoduleMask
Definition: ETLDetId.h:18
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
ETLDetLayerGeometryBuilder::isFront
static bool isFront(int layer, int ring, int module)
Definition: ETLDetLayerGeometryBuilder.cc:86
mps_fire.result
result
Definition: mps_fire.py:303
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
precomputed_value_sort
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
Definition: precomputed_value_sort.h:17
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
MTDDetRing
Definition: MTDDetRing.h:16
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:43