CMS 3D CMS Logo

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