CMS 3D CMS Logo

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 
24 // Builds the forward (first) and backward (second) layers - NOTE: Currently just one layer, all 'front'
25 // Builds chambers (for segments) only, me0RecHits not used in track finding
26 pair<vector<DetLayer*>, vector<DetLayer*> >
28 
29  vector<DetLayer*> result[2];
30  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonME0DetLayerGeometryBuilder";
31  LogTrace(metname) << "Starting endcaplayers ";
32  for (int endcap = -1; endcap<=1; endcap+=2) {
33  int iendcap = (endcap==1) ? 0 : 1; // +1: forward, -1: backward
34  int layer = 0;// only need to make layer 0 for segments
35  vector<int> rolls, chambers;
36  rolls.push_back(0);
38  chambers.push_back(chamber);
39 
40  LogTrace(metname) << "Encap = " << endcap
41  << "Chambers = " << chambers.size()
42  << "Rolls = " << rolls.size();
43  MuRingForwardLayer* ringLayer = buildLayer(endcap, layer, chambers, rolls, geo);
44 
45  if (ringLayer) result[iendcap].push_back(ringLayer);
46  }
47  pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[0], result[1]);
48 
49  return res_pair;
50 
51 }
52 
55  int layer,
56  vector<int>& chambers,
57  vector<int>& rolls,
58  const ME0Geometry& geo) {
59 
60  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonME0DetLayerGeometryBuilder";
61  MuRingForwardLayer * result = nullptr;
62  vector<const ForwardDetRing*> frontRings, backRings;
63 
64  LogTrace(metname) << "Starting to Build Layer ";
65 
66  for (vector<int>::iterator roll = rolls.begin(); roll!=rolls.end(); roll++) {
67  LogTrace(metname) << "On a roll ";
68 
69  vector<const GeomDet*> frontDets, backDets;
70 
71  for(std::vector<int>::iterator chamber=chambers.begin(); chamber<chambers.end(); chamber++) {
72  ME0DetId me0Id(endcap,layer,(*chamber), (*roll));
73  const GeomDet* geomDet = geo.idToDet(me0Id);
74 
75  if (geomDet !=nullptr) {
76  bool isInFront = isFront(me0Id);
77  if(isInFront)
78  {
79  frontDets.push_back(geomDet);
80  }
81  else
82  {
83  backDets.push_back(geomDet);
84  }
85  }
86  }
87 
88  if (!frontDets.empty()) {
89  precomputed_value_sort(frontDets.begin(), frontDets.end(), geomsort::DetPhi());
90  frontRings.push_back(new MuDetRing(frontDets));
91  LogTrace(metname) << "New front ring with " << frontDets.size()
92  << " chambers at z="<< frontRings.back()->position().z();
93  }
94  if (!backDets.empty()) {
95  precomputed_value_sort(backDets.begin(), backDets.end(), geomsort::DetPhi());
96  backRings.push_back(new MuDetRing(backDets));
97  LogTrace(metname) << "New back ring with " << backDets.size()
98  << " chambers at z="<< backRings.back()->position().z();
99  }
100 
101  }
102 
103  LogTrace(metname) << "About to make a MuRingForwardLayer";
104  if(!frontRings.empty()) result = new MuRingForwardLayer(frontRings);
105  else result = nullptr;
106  if(result != nullptr){
107  LogTrace(metname) << "New MuRingForwardLayer with " << frontRings.size()
108  << " and " << backRings.size()
109  << " rings, at Z " << result->position().z()
110  << " R1: " << result->specificSurface().innerRadius()
111  << " R2: " << result->specificSurface().outerRadius();
112  }
113  return result;
114 
115 }
116 
117 
119 {
120 
121  //ME0s do not currently have an arrangement of which are front and which are back, going to always return true
122 
123  bool result = true;
124  return result;
125 }
126 
127 MuDetRing * MuonME0DetLayerGeometryBuilder::makeDetRing(vector<const GeomDet*> & geomDets)
128 {
129  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonME0DetLayerGeometryBuilder";
130 
131 
132  precomputed_value_sort(geomDets.begin(), geomDets.end(), geomsort::DetPhi());
133  MuDetRing * result = new MuDetRing(geomDets);
134  LogTrace(metname) << "New MuDetRing with " << geomDets.size()
135  << " chambers at z="<< result->position().z()
136  << " R1: " << result->specificSurface().innerRadius()
137  << " R2: " << result->specificSurface().outerRadius();
138  return result;
139 }
static const int minChamberId
Definition: ME0DetId.h:89
static const int maxChamberId
Definition: ME0DetId.h:90
ExtractPhi< GeomDet, float > DetPhi
Definition: DetSorting.h:39
const std::string metname
#define LogTrace(id)
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)
const GeomDet * idToDet(DetId) const override
Definition: ME0Geometry.cc:42
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