test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 CSCDetId, CSCGeometry::idToDet(), LogTrace, CSCDetId::maxChamberId(), metname, CSCDetId::minChamberId(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), GeomDet::position(), query::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 != 0)
77  {
78  if(isInFront)
79  {
80  frontGeomDets.push_back(geomDet);
81  }
82  else
83  {
84  backGeomDets.push_back(geomDet);
85  }
86  LogTrace(metname) << "get CSC chamber "
87  << CSCDetId(endcap, station, (*ring), chamber, 0)
88  << " at R=" << geomDet->position().perp()
89  << ", phi=" << geomDet->position().phi()
90  << ", z= " << geomDet->position().z()
91  << " isFront? " << isInFront;
92  }
93  }
94 
95  if(!backGeomDets.empty())
96  {
97  backRings.push_back(makeDetRing(backGeomDets));
98  }
99 
100  if(!frontGeomDets.empty())
101  {
102  frontRings.push_back(makeDetRing(frontGeomDets));
103  assert(!backGeomDets.empty());
104  float frontz = frontRings[0]->position().z();
105  float backz = backRings[0]->position().z();
106  assert(fabs(frontz) < fabs(backz));
107  }
108  }
109 
110  // How should they be sorted?
111  // precomputed_value_sort(muDetRods.begin(), muDetRods.end(), geomsort::ExtractZ<GeometricSearchDet,float>());
112  result = new MuRingForwardDoubleLayer(frontRings, backRings);
113  LogTrace(metname) << "New MuRingForwardLayer with " << frontRings.size()
114  << " and " << backRings.size()
115  << " rings, at Z " << result->position().z()
116  << " R1: " << result->specificSurface().innerRadius()
117  << " R2: " << result->specificSurface().outerRadius();
118  return result;
119 }
T perp() const
Definition: PV3DBase.h:72
const std::string metname
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
static bool isFront(int station, int ring, int chamber)
static int minChamberId()
Definition: CSCDetId.h:255
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:41
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
#define LogTrace(id)
static MuDetRing * makeDetRing(std::vector< const GeomDet * > &geomDets)
static int maxChamberId()
Definition: CSCDetId.h:256
virtual const GeomDet * idToDet(DetId) const override
Definition: CSCGeometry.cc:99
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 18 of file MuonCSCDetLayerGeometryBuilder.cc.

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

Referenced by MuonDetLayerGeometryESProducer::produce().

18  {
19 
20  vector<DetLayer*> result[2]; // one for each endcap
21 
22  for(int i=0; i<2; i++) {
23 
24  int endcap = i+1;
25 
26  // ME/1/1a (= station 1, ring 4) and ME/1/1b (= station 1, ring 1)
27  {
28  vector<int> rings;
29  rings.push_back(4);
30  rings.push_back(1);
31 
32  MuRingForwardDoubleLayer* layer = buildLayer(endcap, 1, rings, geo);
33  if (layer) result[i].push_back(layer);
34  }
35 
36  // ME/1/2 and 1/3 (= station 1, ring 2 and 3)
37  {
38  vector<int> rings;
39  rings.push_back(2);
40  rings.push_back(3);
41 
42  MuRingForwardDoubleLayer* layer = buildLayer(endcap, 1, rings, geo);
43  if (layer) result[i].push_back(layer);
44  }
45 
46  // Stations 2,3,4
47  for(int station = 2; station <= CSCDetId::maxStationId(); station++) {
48  vector<int> rings;
49  for(int ring = CSCDetId::minRingId(); ring <= CSCDetId::maxRingId(); ring++) {
50  rings.push_back(ring);
51  }
52  MuRingForwardDoubleLayer* layer = buildLayer(endcap, station, rings, geo);
53  if (layer) result[i].push_back(layer);
54  }
55  }
56  pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[0], result[1]);
57  return res_pair;
58 }
int i
Definition: DBlmapReader.cc:9
static int minRingId()
Definition: CSCDetId.h:253
static int maxStationId()
Definition: CSCDetId.h:252
static int maxRingId()
Definition: CSCDetId.h:254
tuple result
Definition: query.py:137
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 122 of file MuonCSCDetLayerGeometryBuilder.cc.

References query::result.

123 {
124  bool result = false;
125 
126  bool isOverlapping = !(station == 1 && ring == 3);
127  // not overlapping means back
128  if(isOverlapping)
129  {
130  bool isEven = (chamber%2==0);
131  // odd chambers are bolted to the iron, which faces
132  // forward in 1&2, backward in 3&4, so...
133  result = (station<3) ? isEven : !isEven;
134  }
135  return result;
136 }
tuple result
Definition: query.py:137
MuDetRing * MuonCSCDetLayerGeometryBuilder::makeDetRing ( std::vector< const GeomDet * > &  geomDets)
staticprivate

Definition at line 140 of file MuonCSCDetLayerGeometryBuilder.cc.

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

141 {
142  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonCSCDetLayerGeometryBuilder";
143 
144 
145  precomputed_value_sort(geomDets.begin(), geomDets.end(), geomsort::DetPhi());
146  MuDetRing * result = new MuDetRing(geomDets);
147  LogTrace(metname) << "New MuDetRing with " << geomDets.size()
148  << " chambers at z="<< result->position().z()
149  << " R1: " << result->specificSurface().innerRadius()
150  << " R2: " << result->specificSurface().outerRadius();
151  return result;
152 }
ExtractPhi< GeomDet, float > DetPhi
Definition: DetSorting.h:39
const std::string metname
tuple result
Definition: query.py:137
#define LogTrace(id)
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)