26 using namespace geomsort;
31 for(vector<const DetLayer*>::const_iterator it = allDetLayers.begin(); it != allDetLayers.end(); ++it)
39 for(
auto const it : csclayers.first) {
40 cscLayers_fw.push_back(it);
41 allForward.push_back(it);
43 detLayersMap[ makeDetLayerId(it) ] = it;
46 for(
auto const it: csclayers.second) {
47 cscLayers_bk.push_back(it);
48 allBackward.push_back(it);
50 detLayersMap[ makeDetLayerId(it) ] = it;
55 LogDebug(
"Muon|RecoMuon|MuonDetLayerGeometry") <<
"Adding GEMlayers "<<std::endl;
56 for(
auto const it : gemlayers.first) {
57 gemLayers_fw.push_back(it);
58 allForward.push_back(it);
59 detLayersMap[ makeDetLayerId(it) ] = it;
60 LogDebug(
"Muon|RecoMuon|MuonDetLayerGeometry") <<
"Adding GEMforward "<<std::endl;
62 for(
auto const it: gemlayers.second) {
63 gemLayers_bk.push_back(it);
64 allBackward.push_back(it);
65 detLayersMap[ makeDetLayerId(it) ] = it;
66 LogDebug(
"Muon|RecoMuon|MuonDetLayerGeometry") <<
"Adding GEMbackward "<<std::endl;
73 LogDebug(
"Muon|RecoMuon|MuonDetLayerGeometry") <<
"Adding ME0layers "<<std::endl;
75 for(
auto const it : me0layers.first) {
76 me0Layers_fw.push_back(it);
77 allForward.push_back(it);
79 detLayersMap[ makeDetLayerId(it) ] = it;
80 LogDebug(
"Muon|RecoMuon|MuonDetLayerGeometry") <<
"Adding ME0forward "<<std::endl;
82 for(
auto const it : me0layers.second) {
83 me0Layers_bk.push_back(it);
84 allBackward.push_back(it);
86 detLayersMap[ makeDetLayerId(it) ] = it;
87 LogDebug(
"Muon|RecoMuon|MuonDetLayerGeometry") <<
"Adding ME0backward "<<std::endl;
93 for(
auto const it: barrelLayers) {
94 rpcLayers_barrel.push_back(it);
95 allBarrel.push_back(it);
97 detLayersMap[ makeDetLayerId(it) ] = it;
99 for(
auto const it: endcapLayers.first) {
100 rpcLayers_fw.push_back(it);
101 allForward.push_back(it);
103 detLayersMap[ makeDetLayerId(it) ] = it;
106 for(
auto const it: endcapLayers.second) {
107 rpcLayers_bk.push_back(it);
108 allBackward.push_back(it);
110 detLayersMap[ makeDetLayerId(it) ] = it;
117 for(
auto const it : dtlayers) {
118 dtLayers.push_back(it);
119 allBarrel.push_back(it);
121 detLayersMap[ makeDetLayerId(it) ] = it;
132 if(
id.
ring() == 1 ||
id.ring() == 4)
134 else if(
id.
ring() == 2 ||
id.ring() == 3)
137 throw cms::Exception(
"InvalidCSCRing")<<
" Invalid CSC Ring: "<<
id.ring()<<endl;
164 const vector<const DetLayer*>&
169 const vector<const DetLayer*>&
171 return cscLayers_all;
175 const vector<const DetLayer*>&
181 const vector<const DetLayer*>&
187 const vector<const DetLayer*>&
189 return gemLayers_all;
193 const vector<const DetLayer*>&
199 const vector<const DetLayer*>&
209 const vector<const DetLayer*>&
211 return me0Layers_all;
215 const vector<const DetLayer*>&
221 const vector<const DetLayer*>&
228 const vector<const DetLayer*>&
230 return rpcLayers_all;
234 const vector<const DetLayer*>&
236 return rpcLayers_barrel;
240 const vector<const DetLayer*>&
242 return rpcLayers_endcap;
246 const vector<const DetLayer*>&
252 const vector<const DetLayer*>&
258 const vector<const DetLayer*>&
264 const vector<const DetLayer*>&
269 const vector<const DetLayer*>&
275 const vector<const DetLayer*>&
281 const vector<const DetLayer*>&
288 const vector<const DetLayer*>&
290 return allEndcapCscGem;
294 const vector<const DetLayer*>&
296 return allCscGemForward;
300 const vector<const DetLayer*>&
302 return allCscGemBackward;
307 const vector<const DetLayer*>&
309 return allEndcapCscME0;
313 const vector<const DetLayer*>&
315 return allCscME0Forward;
319 const vector<const DetLayer*>&
321 return allCscME0Backward;
334 if(cscId.station() == 1)
336 if(cscId.ring() == 1 || cscId.ring() == 4)
337 id =
CSCDetId(cscId.endcap(),1,1,0,0);
338 else if(cscId.ring() == 2 || cscId.ring() == 3)
339 id =
CSCDetId(cscId.endcap(),1,2,0,0);
341 throw cms::Exception(
"InvalidCSCRing")<<
" Invalid CSC Ring: "<<cscId.ring()<<endl;
343 else id =
CSCDetId(cscId.endcap(),cscId.station(),0,0,0);
352 id =
RPCDetId(rpcId.region(),0,rpcId.station(),0,rpcId.layer(),0,0);
356 id =
GEMDetId(gemId.region(),1,gemId.station(),gemId.layer(),0,0);
360 id =
ME0DetId(me0Id.region(),me0Id.layer(),0,0);
361 LogDebug(
"Muon|RecoMuon|MuonDetLayerGeometry") <<
" Found an ME0DetId: " << me0Id.rawId()
362 <<
",id: "<<
id.rawId()<<std::endl;
367 std::map<DetId,const DetLayer*>::const_iterator layer = detLayersMap.find(
id);
368 if (layer == detLayersMap.end())
return 0;
369 return layer->second;
403 cscLayers_all.reserve(cscLayers_bk.size()+cscLayers_fw.size());
404 std::copy(cscLayers_bk.begin(),cscLayers_bk.end(),back_inserter(cscLayers_all));
405 std::reverse(cscLayers_all.begin(),cscLayers_all.end());
406 std::copy(cscLayers_fw.begin(),cscLayers_fw.end(),back_inserter(cscLayers_all));
409 gemLayers_all.reserve(gemLayers_bk.size()+gemLayers_fw.size());
410 std::copy(gemLayers_bk.begin(),gemLayers_bk.end(),back_inserter(gemLayers_all));
411 std::reverse(gemLayers_all.begin(),gemLayers_all.end());
412 std::copy(gemLayers_fw.begin(),gemLayers_fw.end(),back_inserter(gemLayers_all));
415 me0Layers_all.reserve(me0Layers_bk.size()+me0Layers_fw.size());
416 std::copy(me0Layers_bk.begin(),me0Layers_bk.end(),back_inserter(me0Layers_all));
417 std::reverse(me0Layers_all.begin(),me0Layers_all.end());
418 std::copy(me0Layers_fw.begin(),me0Layers_fw.end(),back_inserter(me0Layers_all));
421 rpcLayers_endcap.reserve(rpcLayers_bk.size()+rpcLayers_fw.size());
422 std::copy(rpcLayers_bk.begin(),rpcLayers_bk.end(),back_inserter(rpcLayers_endcap));
423 std::reverse(rpcLayers_endcap.begin(),rpcLayers_endcap.end());
424 std::copy(rpcLayers_fw.begin(),rpcLayers_fw.end(),back_inserter(rpcLayers_endcap));
427 rpcLayers_all.reserve(rpcLayers_bk.size()+rpcLayers_barrel.size()+rpcLayers_fw.size());
428 std::copy(rpcLayers_bk.begin(),rpcLayers_bk.end(),back_inserter(rpcLayers_all));
429 std::reverse(rpcLayers_all.begin(),rpcLayers_all.end());
430 std::copy(rpcLayers_barrel.begin(),rpcLayers_barrel.end(),back_inserter(rpcLayers_all));
431 std::copy(rpcLayers_fw.begin(),rpcLayers_fw.end(),back_inserter(rpcLayers_all));
434 allEndcap.reserve(allBackward.size()+allForward.size());
435 std::copy(allBackward.begin(),allBackward.end(),back_inserter(allEndcap));
436 std::reverse(allEndcap.begin(),allEndcap.end());
437 std::copy(allForward.begin(),allForward.end(),back_inserter(allEndcap));
440 allEndcapCscGem.reserve(cscLayers_bk.size()+cscLayers_fw.size()+gemLayers_bk.size()+gemLayers_fw.size());
441 std::copy(cscLayers_bk.begin(),cscLayers_bk.end(),back_inserter(allEndcapCscGem));
442 std::copy(gemLayers_bk.begin(),gemLayers_bk.end(),back_inserter(allEndcapCscGem));
443 std::reverse(allEndcapCscGem.begin(),allEndcapCscGem.end());
444 std::copy(cscLayers_fw.begin(),cscLayers_fw.end(),back_inserter(allEndcapCscGem));
445 std::copy(gemLayers_fw.begin(),gemLayers_fw.end(),back_inserter(allEndcapCscGem));
448 allCscGemForward.reserve(cscLayers_fw.size()+gemLayers_fw.size());
449 std::copy(cscLayers_fw.begin(),cscLayers_fw.end(),back_inserter(allCscGemForward));
450 std::copy(gemLayers_fw.begin(),gemLayers_fw.end(),back_inserter(allCscGemForward));
453 allCscGemBackward.reserve(cscLayers_bk.size()+gemLayers_bk.size());
454 std::copy(cscLayers_bk.begin(),cscLayers_bk.end(),back_inserter(allCscGemBackward));
455 std::copy(gemLayers_bk.begin(),gemLayers_bk.end(),back_inserter(allCscGemBackward));
458 allCscME0Forward.reserve(cscLayers_fw.size()+me0Layers_fw.size());
459 std::copy(cscLayers_fw.begin(),cscLayers_fw.end(),back_inserter(allCscME0Forward));
460 std::copy(me0Layers_fw.begin(),me0Layers_fw.end(),back_inserter(allCscME0Forward));
463 allCscME0Backward.reserve(cscLayers_bk.size()+me0Layers_bk.size());
464 std::copy(cscLayers_bk.begin(),cscLayers_bk.end(),back_inserter(allCscME0Backward));
465 std::copy(me0Layers_bk.begin(),me0Layers_bk.end(),back_inserter(allCscME0Backward));
468 allEndcapCscME0.reserve(cscLayers_bk.size()+cscLayers_fw.size()+me0Layers_bk.size()+me0Layers_fw.size());
469 std::copy(cscLayers_bk.begin(),cscLayers_bk.end(),back_inserter(allEndcapCscME0));
470 std::copy(me0Layers_bk.begin(),me0Layers_bk.end(),back_inserter(allEndcapCscME0));
471 std::reverse(allEndcapCscME0.begin(),allEndcapCscME0.end());
472 std::copy(cscLayers_fw.begin(),cscLayers_fw.end(),back_inserter(allEndcapCscME0));
473 std::copy(me0Layers_fw.begin(),me0Layers_fw.end(),back_inserter(allEndcapCscME0));
476 allDetLayers.reserve(allBackward.size()+allBarrel.size()+allForward.size());
477 std::copy(allBackward.begin(),allBackward.end(),back_inserter(allDetLayers));
478 std::reverse(allDetLayers.begin(),allDetLayers.end());
479 std::copy(allBarrel.begin(),allBarrel.end(),back_inserter(allDetLayers));
480 std::copy(allForward.begin(),allForward.end(),back_inserter(allDetLayers));
484 for (
auto l : allDetLayers)
485 (*
const_cast<DetLayer*
>(
l)).setSeqNum(sq++);
const std::vector< const DetLayer * > & allEndcapCscME0Layers() const
return all endcap DetLayers (CSC+ME0), -Z to +Z
const std::vector< const DetLayer * > & backwardGEMLayers() const
return the backward (-Z) GEM DetLayers, inside-out
const std::vector< const DetLayer * > & allCscGemBackwardLayers() const
return all endcap DetLayers (CSC+GEM), -Z to +Z
void addME0Layers(const std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > &gemlayers)
const std::vector< const DetLayer * > & allEndcapLayers() const
return all endcap DetLayers (CSC+RPC+GEM+ME0), -Z to +Z
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
const std::vector< const DetLayer * > & forwardRPCLayers() const
return the forward (+Z) RPC DetLayers, inside-out
virtual const DetLayer * idToLayer(const DetId &detId) const override
return the DetLayer which correspond to a certain DetId
void addDTLayers(const std::vector< DetLayer * > &dtlayers)
const std::vector< const DetLayer * > & allCSCLayers() const
return the CSC DetLayers (endcap), -Z to +Z
const std::vector< const DetLayer * > & forwardME0Layers() const
return the forward (+Z) ME0 DetLayers, inside-out
uint32_t rawId() const
get the raw id
const std::vector< const DetLayer * > & allCscME0ForwardLayers() const
return all endcap DetLayers (CSC+ME0), -Z to +Z
const std::vector< const DetLayer * > & allForwardLayers() const
return all forward (+Z) layers (CSC+RPC+GEM+ME0), inside-out
void addGEMLayers(const std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > &gemlayers)
const std::vector< const DetLayer * > & allBarrelLayers() const
return all barrel DetLayers (DT+RPC), inside-out
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
MuonDetLayerGeometry()
Constructor.
const std::vector< const DetLayer * > & endcapRPCLayers() const
return the endcap RPC DetLayers, -Z to +Z
const std::vector< const DetLayer * > & allME0Layers() const
return the ME0 DetLayers (endcap), -Z to +Z
const std::vector< const DetLayer * > & allDTLayers() const
return the DT DetLayers (barrel), inside-out
const std::vector< const DetLayer * > & backwardME0Layers() const
return the backward (-Z) ME0 DetLayers, inside-out
const std::vector< const DetLayer * > & forwardCSCLayers() const
return the forward (+Z) CSC DetLayers, inside-out
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
virtual const std::vector< const GeomDet * > & basicComponents() const =0
DetId makeDetLayerId(const DetLayer *detLayer) const
virtual ~MuonDetLayerGeometry()
Destructor.
const std::vector< const DetLayer * > & allCscME0BackwardLayers() const
return all endcap DetLayers (CSC+ME0), -Z to +Z
void addRPCLayers(const std::vector< DetLayer * > &barrelRPCLayers, const std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > &endcapRPCLayers)
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
const std::vector< const DetLayer * > & allBackwardLayers() const
return all backward (-Z) layers (CSC+RPC+GEM+ME0), inside-out
const std::vector< const DetLayer * > & allGEMLayers() const
return the GEM DetLayers (endcap), -Z to +Z
const std::vector< const DetLayer * > & allLayers() const
return all layers (DT+CSC+RPC+GEM), order: backward, barrel, forward
const std::vector< const DetLayer * > & forwardGEMLayers() const
return the forward (+Z) GEM DetLayers, inside-out
const std::vector< const DetLayer * > & backwardCSCLayers() const
return the backward (-Z) CSC DetLayers, inside-out
const std::vector< const DetLayer * > & allCscGemForwardLayers() const
return all endcap DetLayers (CSC+GEM), -Z to +Z
const std::vector< const DetLayer * > & barrelRPCLayers() const
return the barrel RPC DetLayers, inside-out
const std::vector< const DetLayer * > & allEndcapCscGemLayers() const
return all endcap DetLayers (CSC+GEM), -Z to +Z
const std::vector< const DetLayer * > & backwardRPCLayers() const
return the backward (-Z) RPC DetLayers, inside-out
void addCSCLayers(const std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > &csclayers)
const std::vector< const DetLayer * > & allRPCLayers() const
return all RPC DetLayers, order: backward, barrel, forward