CMS 3D CMS Logo

MuonGEMDetLayerGeometryBuilder.cc
Go to the documentation of this file.
2 
9 
12 
14 
15 #include <iostream>
16 
17 using namespace std;
18 
20 
21 // Builds the forward (first) and backward (second) layers
22 // Builds etaPartitions (for rechits)
23 pair<vector<DetLayer*>, vector<DetLayer*> > MuonGEMDetLayerGeometryBuilder::buildEndcapLayers(const GEMGeometry& geo) {
24  vector<DetLayer*> endcapLayers[2];
25 
26  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonGEMDetLayerGeometryBuilder";
27  for (auto st : geo.stations()) {
28  const int maxLayerId = (st->station() == GEMDetId::minStationId0) ? GEMDetId::maxLayerId0 : GEMDetId::maxLayerId;
29  for (int layer = GEMDetId::minLayerId + 1; layer <= maxLayerId; ++layer) {
30  ForwardDetLayer* forwardLayer = nullptr;
31  vector<const ForwardDetRing*> frontRings, backRings;
32 
33  for (int roll = GEMDetId::minRollId + 1; roll <= GEMDetId::maxRollId; ++roll) {
34  vector<const GeomDet*> frontDets, backDets;
35 
36  for (auto sc : st->superChambers()) {
37  auto ch = sc->chamber(layer);
38  if (ch == nullptr)
39  continue;
40 
41  auto etaP = ch->etaPartition(roll);
42  if (etaP == nullptr)
43  continue;
44 
45  bool isInFront = isFront(etaP->id());
46  if (isInFront) {
47  frontDets.push_back(etaP);
48  } else {
49  backDets.push_back(etaP);
50  }
51  }
52 
53  if (!frontDets.empty()) {
54  precomputed_value_sort(frontDets.begin(), frontDets.end(), geomsort::DetPhi());
55  frontRings.push_back(new MuDetRing(frontDets));
56  LogTrace(metname) << "New front ring with " << frontDets.size()
57  << " chambers at z=" << frontRings.back()->position().z();
58  }
59  if (!backDets.empty()) {
60  precomputed_value_sort(backDets.begin(), backDets.end(), geomsort::DetPhi());
61  backRings.push_back(new MuDetRing(backDets));
62  LogTrace(metname) << "New back ring with " << backDets.size()
63  << " chambers at z=" << backRings.back()->position().z();
64  }
65  }
66 
67  if (!frontRings.empty()) {
68  if (st->station() == GEMDetId::minStationId0)
69  forwardLayer = new MuRingForwardLayer(frontRings);
70  else if (!backRings.empty())
71  forwardLayer = new MuRingForwardDoubleLayer(frontRings, backRings);
72  }
73 
74  if (forwardLayer != nullptr) {
75  LogTrace(metname) << "New MuRingForwardLayer with " << frontRings.size() << " and " << backRings.size()
76  << " rings, at Z " << forwardLayer->position().z()
77  << " R1: " << forwardLayer->specificSurface().innerRadius()
78  << " R2: " << forwardLayer->specificSurface().outerRadius();
79 
80  int iendcap = (st->region() == 1) ? 0 : 1;
81  endcapLayers[iendcap].push_back(forwardLayer);
82  }
83  }
84  }
85 
86  pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(endcapLayers[0], endcapLayers[1]);
87  return res_pair;
88 }
89 
91  // ME0s do not currently have an arrangement of which are front and which are back, going to always return true
92  if (gemId.station() == GEMDetId::minStationId0)
93  return true;
94 
95  return (gemId.chamber() % 2 == 0);
96 }
97 
98 MuDetRing* MuonGEMDetLayerGeometryBuilder::makeDetRing(vector<const GeomDet*>& geomDets) {
99  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonGEMDetLayerGeometryBuilder";
100 
101  precomputed_value_sort(geomDets.begin(), geomDets.end(), geomsort::DetPhi());
102  MuDetRing* result = new MuDetRing(geomDets);
103  LogTrace(metname) << "New MuDetRing with " << geomDets.size() << " chambers at z=" << result->position().z()
104  << " R1: " << result->specificSurface().innerRadius()
105  << " R2: " << result->specificSurface().outerRadius();
106  return result;
107 }
MuonGEMDetLayerGeometryBuilder.h
MessageLogger.h
MuRingForwardDoubleLayer.h
MuonGEMDetLayerGeometryBuilder::isFront
static bool isFront(const GEMDetId &gemId)
Definition: MuonGEMDetLayerGeometryBuilder.cc:90
GEMGeometry::stations
const std::vector< const GEMStation * > & stations() const
Return a vector of all GEM stations.
Definition: GEMGeometry.cc:32
MuonGEMDetLayerGeometryBuilder::~MuonGEMDetLayerGeometryBuilder
virtual ~MuonGEMDetLayerGeometryBuilder()
Destructor.
Definition: MuonGEMDetLayerGeometryBuilder.cc:19
GEMDetId::minLayerId
static constexpr int32_t minLayerId
Definition: GEMDetId.h:30
GeometricSearchDet::position
virtual const Surface::PositionType & position() const
Returns position of the surface.
Definition: GeometricSearchDet.h:31
precomputed_value_sort.h
MuDetRing
Definition: MuDetRing.h:16
GEMDetId::maxRollId
static constexpr int32_t maxRollId
Definition: GEMDetId.h:36
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetSorting.h
MuRingForwardLayer
Definition: MuRingForwardLayer.h:18
geomsort::DetPhi
ExtractPhi< GeomDet, float > DetPhi
Definition: DetSorting.h:37
GEMDetId::minStationId0
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:183
GEMDetId::maxLayerId0
static constexpr int32_t maxLayerId0
Definition: GEMDetId.h:31
GEMDetId
Definition: GEMDetId.h:18
MuonGEMDetLayerGeometryBuilder::buildEndcapLayers
static std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > buildEndcapLayers(const GEMGeometry &geo)
Definition: MuonGEMDetLayerGeometryBuilder.cc:23
MuonGEMDetLayerGeometryBuilder::makeDetRing
static MuDetRing * makeDetRing(std::vector< const GeomDet * > &geomDets)
Definition: MuonGEMDetLayerGeometryBuilder.cc:98
GeomDet.h
GEMDetId.h
std
Definition: JetResolutionObject.h:76
ForwardDetLayer
Definition: ForwardDetLayer.h:22
GEMDetId::maxLayerId
static constexpr int32_t maxLayerId
Definition: GEMDetId.h:32
MuRodBarrelLayer.h
MuDetRing.h
GEMDetId::minRollId
static constexpr int32_t minRollId
Definition: GEMDetId.h:35
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:179
GEMGeometry
Definition: GEMGeometry.h:24
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
precomputed_value_sort
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
Definition: precomputed_value_sort.h:17
MuRingForwardDoubleLayer
Definition: MuRingForwardDoubleLayer.h:19
ForwardDetLayer::specificSurface
virtual const BoundDisk & specificSurface() const final
Definition: ForwardDetLayer.h:39
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40
MuDetRod.h