CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Static Public Member Functions | Private Member Functions | Static Private Member Functions
MuonCSCDetLayerGeometryBuilder Class Reference

#include <MuonCSCDetLayerGeometryBuilder.h>

Static Public Member Functions

static std::pair< std::vector
< DetLayer * >, std::vector
< DetLayer * > > 
buildLayers (const CSCGeometry &geo)
 

Private Member Functions

 MuonCSCDetLayerGeometryBuilder ()
 

Static Private Member Functions

static MuRingForwardDoubleLayerbuildLayer (int endcap, int station, std::vector< int > &rings, const CSCGeometry &geo)
 
static bool isFront (int station, int ring, int chamber)
 
static MuDetRingmakeDetRing (std::vector< const GeomDet * > &geomDets)
 

Detailed Description

Build the CSC DetLayers.

Author
N. Amapane - CERN

Definition at line 18 of file MuonCSCDetLayerGeometryBuilder.h.

Constructor & Destructor Documentation

MuonCSCDetLayerGeometryBuilder::MuonCSCDetLayerGeometryBuilder ( )
inlineprivate

Definition at line 26 of file MuonCSCDetLayerGeometryBuilder.h.

26 {}

Member Function Documentation

MuRingForwardDoubleLayer * MuonCSCDetLayerGeometryBuilder::buildLayer ( int  endcap,
int  station,
std::vector< int > &  rings,
const CSCGeometry geo 
)
staticprivate

Definition at line 60 of file MuonCSCDetLayerGeometryBuilder.cc.

References cms::cuda::assert(), CSCDetId, CSCGeometry::idToDet(), LogTrace, CSCDetId::maxChamberId(), metname, CSCDetId::minChamberId(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), GeomDet::position(), mps_fire::result, relativeConstraints::ring, AlCaHLTBitMon_QueryRunRegistry::string, and PV3DBase< T, PVType, FrameType >::z().

63  {
64  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonCSCDetLayerGeometryBuilder";
66 
67  vector<const ForwardDetRing*> frontRings, backRings;
68 
69  for (vector<int>::iterator ring = rings.begin(); ring != rings.end(); ring++) {
70  vector<const GeomDet*> frontGeomDets, backGeomDets;
71  for (int chamber = CSCDetId::minChamberId(); chamber <= CSCDetId::maxChamberId(); chamber++) {
72  CSCDetId detId(endcap, station, (*ring), chamber, 0);
73  const GeomDet* geomDet = geo.idToDet(detId);
74  // we sometimes loop over more chambers than there are in ring
75  bool isInFront = isFront(station, *ring, chamber);
76  if (geomDet != nullptr) {
77  if (isInFront) {
78  frontGeomDets.push_back(geomDet);
79  } else {
80  backGeomDets.push_back(geomDet);
81  }
82  LogTrace(metname) << "get CSC chamber " << CSCDetId(endcap, station, (*ring), chamber, 0)
83  << " at R=" << geomDet->position().perp() << ", phi=" << geomDet->position().phi()
84  << ", z= " << geomDet->position().z() << " isFront? " << isInFront;
85  }
86  }
87 
88  if (!backGeomDets.empty()) {
89  backRings.push_back(makeDetRing(backGeomDets));
90  }
91 
92  if (!frontGeomDets.empty()) {
93  frontRings.push_back(makeDetRing(frontGeomDets));
94  assert(!backGeomDets.empty());
95  float frontz = frontRings[0]->position().z();
96  float backz = backRings[0]->position().z();
97  assert(fabs(frontz) < fabs(backz));
98  }
99  }
100 
101  // How should they be sorted?
102  // precomputed_value_sort(muDetRods.begin(), muDetRods.end(), geomsort::ExtractZ<GeometricSearchDet,float>());
103  result = new MuRingForwardDoubleLayer(frontRings, backRings);
104  LogTrace(metname) << "New MuRingForwardLayer with " << frontRings.size() << " and " << backRings.size()
105  << " rings, at Z " << result->position().z() << " R1: " << result->specificSurface().innerRadius()
106  << " R2: " << result->specificSurface().outerRadius();
107  return result;
108 }
T perp() const
Definition: PV3DBase.h:69
const std::string metname
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
static bool isFront(int station, int ring, int chamber)
assert(be >=bs)
#define LogTrace(id)
static int minChamberId()
Definition: CSCDetId.h:240
tuple result
Definition: mps_fire.py:311
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
T z() const
Definition: PV3DBase.h:61
static MuDetRing * makeDetRing(std::vector< const GeomDet * > &geomDets)
static int maxChamberId()
Definition: CSCDetId.h:241
const GeomDet * idToDet(DetId) const override
Definition: CSCGeometry.cc:91
pair< vector< DetLayer * >, vector< DetLayer * > > MuonCSCDetLayerGeometryBuilder::buildLayers ( const CSCGeometry geo)
static

return.first=forward (+Z), return.second=backward (-Z) both vectors are sorted inside-out

Definition at line 17 of file MuonCSCDetLayerGeometryBuilder.cc.

References Reference_intrackfit_cff::endcap, mps_fire::i, phase1PixelTopology::layer, CSCDetId::maxRingId(), CSCDetId::maxStationId(), CSCDetId::minRingId(), mps_fire::result, relativeConstraints::ring, and relativeConstraints::station.

Referenced by MuonDetLayerGeometryESProducer::produce().

17  {
18  vector<DetLayer*> result[2]; // one for each endcap
19 
20  for (int i = 0; i < 2; i++) {
21  int endcap = i + 1;
22 
23  // ME/1/1a (= station 1, ring 4) and ME/1/1b (= station 1, ring 1)
24  {
25  vector<int> rings;
26  rings.push_back(4);
27  rings.push_back(1);
28 
29  MuRingForwardDoubleLayer* layer = buildLayer(endcap, 1, rings, geo);
30  if (layer)
31  result[i].push_back(layer);
32  }
33 
34  // ME/1/2 and 1/3 (= station 1, ring 2 and 3)
35  {
36  vector<int> rings;
37  rings.push_back(2);
38  rings.push_back(3);
39 
40  MuRingForwardDoubleLayer* layer = buildLayer(endcap, 1, rings, geo);
41  if (layer)
42  result[i].push_back(layer);
43  }
44 
45  // Stations 2,3,4
46  for (int station = 2; station <= CSCDetId::maxStationId(); station++) {
47  vector<int> rings;
48  for (int ring = CSCDetId::minRingId(); ring <= CSCDetId::maxRingId(); ring++) {
49  rings.push_back(ring);
50  }
51  MuRingForwardDoubleLayer* layer = buildLayer(endcap, station, rings, geo);
52  if (layer)
53  result[i].push_back(layer);
54  }
55  }
56  pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[0], result[1]);
57  return res_pair;
58 }
static int minRingId()
Definition: CSCDetId.h:238
static int maxStationId()
Definition: CSCDetId.h:237
static int maxRingId()
Definition: CSCDetId.h:239
constexpr std::array< uint8_t, layerIndexSize > layer
tuple result
Definition: mps_fire.py:311
static MuRingForwardDoubleLayer * buildLayer(int endcap, int station, std::vector< int > &rings, const CSCGeometry &geo)
bool MuonCSCDetLayerGeometryBuilder::isFront ( int  station,
int  ring,
int  chamber 
)
staticprivate

Definition at line 110 of file MuonCSCDetLayerGeometryBuilder.cc.

References mps_fire::result.

110  {
111  bool result = false;
112 
113  bool isOverlapping = !(station == 1 && ring == 3);
114  // not overlapping means back
115  if (isOverlapping) {
116  bool isEven = (chamber % 2 == 0);
117  // odd chambers are bolted to the iron, which faces
118  // forward in 1&2, backward in 3&4, so...
119  result = (station < 3) ? isEven : !isEven;
120  }
121  return result;
122 }
tuple result
Definition: mps_fire.py:311
MuDetRing * MuonCSCDetLayerGeometryBuilder::makeDetRing ( std::vector< const GeomDet * > &  geomDets)
staticprivate

Definition at line 124 of file MuonCSCDetLayerGeometryBuilder.cc.

References LogTrace, metname, precomputed_value_sort(), mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

124  {
125  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonCSCDetLayerGeometryBuilder";
126 
127  precomputed_value_sort(geomDets.begin(), geomDets.end(), geomsort::DetPhi());
128  MuDetRing* result = new MuDetRing(geomDets);
129  LogTrace(metname) << "New MuDetRing with " << geomDets.size() << " chambers at z=" << result->position().z()
130  << " R1: " << result->specificSurface().innerRadius()
131  << " R2: " << result->specificSurface().outerRadius();
132  return result;
133 }
ExtractPhi< GeomDet, float > DetPhi
Definition: DetSorting.h:37
const std::string metname
#define LogTrace(id)
tuple result
Definition: mps_fire.py:311
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)