CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Private Member Functions
MuonGEMDetLayerGeometryBuilder Class Reference

#include <MuonGEMDetLayerGeometryBuilder.h>

Public Member Functions

 MuonGEMDetLayerGeometryBuilder ()
 Constructor (disabled, only static access is allowed) More...
 
virtual ~MuonGEMDetLayerGeometryBuilder ()
 Destructor. More...
 

Static Public Member Functions

static std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > buildEndcapLayers (const GEMGeometry &geo)
 

Static Private Member Functions

static MuRingForwardDoubleLayerbuildLayer (int endcap, std::vector< int > &rings, int station, int layer, std::vector< int > &chambers, std::vector< int > &rolls, const GEMGeometry &geo)
 
static bool isFront (const GEMDetId &gemId)
 
static MuDetRingmakeDetRing (std::vector< const GeomDet * > &geomDets)
 

Detailed Description

Build the GEM DetLayers.

Author
R. Radogna

Definition at line 20 of file MuonGEMDetLayerGeometryBuilder.h.

Constructor & Destructor Documentation

MuonGEMDetLayerGeometryBuilder::MuonGEMDetLayerGeometryBuilder ( )
inline
MuonGEMDetLayerGeometryBuilder::~MuonGEMDetLayerGeometryBuilder ( )
virtual

Destructor.

Definition at line 20 of file MuonGEMDetLayerGeometryBuilder.cc.

Referenced by MuonGEMDetLayerGeometryBuilder().

20  {
21 }

Member Function Documentation

pair< vector< DetLayer * >, vector< DetLayer * > > MuonGEMDetLayerGeometryBuilder::buildEndcapLayers ( const GEMGeometry geo)
static

Builds the forward (+Z, return.first) and backward (-Z, return.second) layers. Both vectors are sorted inside-out

Definition at line 26 of file MuonGEMDetLayerGeometryBuilder.cc.

References relativeConstraints::chamber, chambers, makeMuonMisalignmentScenario::endcap, GEMDetId::maxChamberId, GEMDetId::maxLayerId, GEMDetId::maxRingId, GEMDetId::maxRollId, GEMDetId::maxStationId, GEMDetId::minChamberId, GEMDetId::minLayerId, GEMDetId::minRingId, GEMDetId::minRollId, GEMDetId::minStationId, mps_fire::result, relativeConstraints::ring, and relativeConstraints::station.

Referenced by MuonGEMDetLayerGeometryBuilder(), and MuonDetLayerGeometryESProducer::produce().

26  {
27 
28  vector<DetLayer*> result[2];
29 
30  for (int endcap = -1; endcap<=1; endcap+=2) {
31  int iendcap = (endcap==1) ? 0 : 1; // +1: forward, -1: backward
32 
34  for(int layer = GEMDetId::minLayerId+1; layer <= GEMDetId::maxLayerId; ++layer) {
35 
36  vector<int> rolls, rings, chambers;
37  for(int ring = GEMDetId::minRingId; ring <= GEMDetId::maxRingId; ++ring) rings.push_back(ring);
39  chambers.push_back(chamber);
40  for(int roll = GEMDetId::minRollId+1; roll <= GEMDetId::maxRollId; ++roll)
41  rolls.push_back(roll);
42 
43  MuRingForwardDoubleLayer* ringLayer = buildLayer(endcap, rings, station, layer, chambers, rolls, geo);
44 
45  if (ringLayer) result[iendcap].push_back(ringLayer);
46  }
47  }
48  }
49  pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[0], result[1]);
50 
51  return res_pair;
52 }
static const int minRingId
Definition: GEMDetId.h:97
static const int minChamberId
Definition: GEMDetId.h:103
static const int maxRollId
Definition: GEMDetId.h:111
static const int maxChamberId
Definition: GEMDetId.h:104
static const int maxLayerId
Definition: GEMDetId.h:108
static const int minRollId
Definition: GEMDetId.h:110
static const int maxStationId
Definition: GEMDetId.h:101
static const int minStationId
Definition: GEMDetId.h:100
static const int maxRingId
Definition: GEMDetId.h:98
static const int minLayerId
Definition: GEMDetId.h:107
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
static MuRingForwardDoubleLayer * buildLayer(int endcap, std::vector< int > &rings, int station, int layer, std::vector< int > &chambers, std::vector< int > &rolls, const GEMGeometry &geo)
MuRingForwardDoubleLayer * MuonGEMDetLayerGeometryBuilder::buildLayer ( int  endcap,
std::vector< int > &  rings,
int  station,
int  layer,
std::vector< int > &  chambers,
std::vector< int > &  rolls,
const GEMGeometry geo 
)
staticprivate

Definition at line 55 of file MuonGEMDetLayerGeometryBuilder.cc.

References relativeConstraints::chamber, GEMGeometry::idToDet(), LogTrace, metname, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), GeomDet::position(), precomputed_value_sort(), mps_fire::result, relativeConstraints::ring, AlCaHLTBitMon_QueryRunRegistry::string, and PV3DBase< T, PVType, FrameType >::z().

Referenced by MuonGEMDetLayerGeometryBuilder().

59  {
60 
61  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonGEMDetLayerGeometryBuilder";
62  MuRingForwardDoubleLayer * result = nullptr;
63  vector<const ForwardDetRing*> frontRings, backRings;
64 
65 
66  for (std::vector<int>::iterator ring=rings.begin(); ring!=rings.end()-2;ring++){
67 
68  for (vector<int>::iterator roll = rolls.begin(); roll!=rolls.end(); roll++) {
69 
70  vector<const GeomDet*> frontDets, backDets;
71 
72  for(std::vector<int>::iterator chamber=chambers.begin(); chamber<chambers.end(); chamber++) {
73  GEMDetId gemId(endcap,(*ring), station,layer,(*chamber), (*roll));
74 
75  const GeomDet* geomDet = geo.idToDet(gemId);
76 
77  if (geomDet !=nullptr) {
78  bool isInFront = isFront(gemId);
79  if(isInFront)
80  {
81  frontDets.push_back(geomDet);
82  }
83  else
84  {
85  backDets.push_back(geomDet);
86  }
87  LogTrace(metname) << "get GEM Endcap roll "
88  << gemId
89  << (isInFront ? "front" : "back ")
90  << " at R=" << geomDet->position().perp()
91  << ", phi=" << geomDet->position().phi()
92  << ", Z=" << geomDet->position().z();
93  }
94  }
95 
96  if (!frontDets.empty()) {
97  precomputed_value_sort(frontDets.begin(), frontDets.end(), geomsort::DetPhi());
98  frontRings.push_back(new MuDetRing(frontDets));
99  LogTrace(metname) << "New front ring with " << frontDets.size()
100  << " chambers at z="<< frontRings.back()->position().z();
101  }
102  if (!backDets.empty()) {
103  precomputed_value_sort(backDets.begin(), backDets.end(), geomsort::DetPhi());
104  backRings.push_back(new MuDetRing(backDets));
105  LogTrace(metname) << "New back ring with " << backDets.size()
106  << " chambers at z="<< backRings.back()->position().z();
107  }
108 
109  }
110 
111  }
112 
113  // How should they be sorted?
114  // precomputed_value_sort(muDetRods.begin(), muDetRods.end(), geomsort::ExtractZ<GeometricSearchDet,float>());
115  if(!backRings.empty() && !frontRings.empty()) result = new MuRingForwardDoubleLayer(frontRings, backRings);
116  else result = nullptr;
117  if(result != nullptr){
118  LogTrace(metname) << "New MuRingForwardLayer with " << frontRings.size()
119  << " and " << backRings.size()
120  << " rings, at Z " << result->position().z()
121  << " R1: " << result->specificSurface().innerRadius()
122  << " R2: " << result->specificSurface().outerRadius();
123  }
124  return result;
125 
126 }
ExtractPhi< GeomDet, float > DetPhi
Definition: DetSorting.h:39
T perp() const
Definition: PV3DBase.h:72
const std::string metname
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:48
T z() const
Definition: PV3DBase.h:64
static bool isFront(const GEMDetId &gemId)
#define LogTrace(id)
const GeomDet * idToDet(DetId) const override
Definition: GEMGeometry.cc:38
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
bool MuonGEMDetLayerGeometryBuilder::isFront ( const GEMDetId gemId)
staticprivate

Definition at line 129 of file MuonGEMDetLayerGeometryBuilder.cc.

References relativeConstraints::chamber, GEMDetId::chamber(), and mps_fire::result.

Referenced by MuonGEMDetLayerGeometryBuilder().

130 {
131 
132  bool result = false;
133  int chamber = gemId.chamber();
134 
135  if(chamber%2 == 0) result = !result;
136 
137  return result;
138 }
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: GEMDetId.h:74
MuDetRing * MuonGEMDetLayerGeometryBuilder::makeDetRing ( std::vector< const GeomDet * > &  geomDets)
staticprivate

Definition at line 140 of file MuonGEMDetLayerGeometryBuilder.cc.

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

Referenced by MuonGEMDetLayerGeometryBuilder().

141 {
142  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonGEMDetLayerGeometryBuilder";
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
#define LogTrace(id)
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)