CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MuonME0DetLayerGeometryBuilder.cc
Go to the documentation of this file.
2 
5 //#include <RecoMuon/DetLayers/interface/MuRingForwardDoubleLayer.h>
10 
14 
16 
17 #include <iostream>
18 
19 using namespace std;
20 
22 
23 // Builds the forward (first) and backward (second) layers - NOTE: Currently just one layer, all 'front'
24 // Builds chambers (for segments) only, me0RecHits not used in track finding
25 pair<vector<DetLayer*>, vector<DetLayer*> > MuonME0DetLayerGeometryBuilder::buildEndcapLayers(const ME0Geometry& geo) {
26  vector<DetLayer*> result[2];
27  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonME0DetLayerGeometryBuilder";
28  LogTrace(metname) << "Starting endcaplayers ";
29  for (int endcap = -1; endcap <= 1; endcap += 2) {
30  int iendcap = (endcap == 1) ? 0 : 1; // +1: forward, -1: backward
31  int layer = 0; // only need to make layer 0 for segments
32  vector<int> rolls, chambers;
33  rolls.push_back(0);
34  for (int chamber = ME0DetId::minChamberId + 1; chamber <= ME0DetId::maxChamberId; chamber++)
35  chambers.push_back(chamber);
36 
37  LogTrace(metname) << "Encap = " << endcap << "Chambers = " << chambers.size() << "Rolls = " << rolls.size();
38  MuRingForwardLayer* ringLayer = buildLayer(endcap, layer, chambers, rolls, geo);
39 
40  if (ringLayer)
41  result[iendcap].push_back(ringLayer);
42  }
43  pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[0], result[1]);
44 
45  return res_pair;
46 }
47 
49  int endcap, int layer, vector<int>& chambers, vector<int>& rolls, const ME0Geometry& geo) {
50  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonME0DetLayerGeometryBuilder";
51  MuRingForwardLayer* result = nullptr;
52  vector<const ForwardDetRing*> frontRings, backRings;
53 
54  LogTrace(metname) << "Starting to Build Layer ";
55 
56  for (vector<int>::iterator roll = rolls.begin(); roll != rolls.end(); roll++) {
57  LogTrace(metname) << "On a roll ";
58 
59  vector<const GeomDet*> frontDets, backDets;
60 
61  for (std::vector<int>::iterator chamber = chambers.begin(); chamber < chambers.end(); chamber++) {
62  ME0DetId me0Id(endcap, layer, (*chamber), (*roll));
63  const GeomDet* geomDet = geo.idToDet(me0Id);
64 
65  if (geomDet != nullptr) {
66  bool isInFront = isFront(me0Id);
67  if (isInFront) {
68  frontDets.push_back(geomDet);
69  } else {
70  backDets.push_back(geomDet);
71  }
72  }
73  }
74 
75  if (!frontDets.empty()) {
76  precomputed_value_sort(frontDets.begin(), frontDets.end(), geomsort::DetPhi());
77  frontRings.push_back(new MuDetRing(frontDets));
78  LogTrace(metname) << "New front ring with " << frontDets.size()
79  << " chambers at z=" << frontRings.back()->position().z();
80  }
81  if (!backDets.empty()) {
82  precomputed_value_sort(backDets.begin(), backDets.end(), geomsort::DetPhi());
83  backRings.push_back(new MuDetRing(backDets));
84  LogTrace(metname) << "New back ring with " << backDets.size()
85  << " chambers at z=" << backRings.back()->position().z();
86  }
87  }
88 
89  LogTrace(metname) << "About to make a MuRingForwardLayer";
90  if (!frontRings.empty())
91  result = new MuRingForwardLayer(frontRings);
92  else
93  result = nullptr;
94  if (result != nullptr) {
95  LogTrace(metname) << "New MuRingForwardLayer with " << frontRings.size() << " and " << backRings.size()
96  << " rings, at Z " << result->position().z() << " R1: " << result->specificSurface().innerRadius()
97  << " R2: " << result->specificSurface().outerRadius();
98  }
99  return result;
100 }
101 
103  //ME0s do not currently have an arrangement of which are front and which are back, going to always return true
104 
105  bool result = true;
106  return result;
107 }
108 
109 MuDetRing* MuonME0DetLayerGeometryBuilder::makeDetRing(vector<const GeomDet*>& geomDets) {
110  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonME0DetLayerGeometryBuilder";
111 
112  precomputed_value_sort(geomDets.begin(), geomDets.end(), geomsort::DetPhi());
113  MuDetRing* result = new MuDetRing(geomDets);
114  LogTrace(metname) << "New MuDetRing with " << geomDets.size() << " chambers at z=" << result->position().z()
115  << " R1: " << result->specificSurface().innerRadius()
116  << " R2: " << result->specificSurface().outerRadius();
117  return result;
118 }
ExtractPhi< GeomDet, float > DetPhi
Definition: DetSorting.h:37
static constexpr int maxChamberId
Definition: ME0DetId.h:67
const std::string metname
#define LogTrace(id)
const GeomDet * idToDet(DetId) const override
Definition: ME0Geometry.cc:24
constexpr std::array< uint8_t, layerIndexSize > layer
tuple result
Definition: mps_fire.py:311
static constexpr int minChamberId
Definition: ME0DetId.h:66
static MuDetRing * makeDetRing(std::vector< const GeomDet * > &geomDets)
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
static std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > buildEndcapLayers(const ME0Geometry &geo)
static bool isFront(const ME0DetId &me0Id)
static MuRingForwardLayer * buildLayer(int endcap, int layer, std::vector< int > &chambers, std::vector< int > &rolls, const ME0Geometry &geo)
static char chambers[264][20]
Definition: ReadPGInfo.cc:243