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 // 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);
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 }
MessageLogger.h
GeomDet
Definition: GeomDet.h:27
MuonME0DetLayerGeometryBuilder::makeDetRing
static MuDetRing * makeDetRing(std::vector< const GeomDet * > &geomDets)
Definition: MuonME0DetLayerGeometryBuilder.cc:109
ME0Geometry
Definition: ME0Geometry.h:12
ME0DetId.h
ME0Geometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: ME0Geometry.cc:24
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
precomputed_value_sort.h
MuDetRing
Definition: MuDetRing.h:16
ME0DetId::maxChamberId
static constexpr int maxChamberId
Definition: ME0DetId.h:67
MuonME0DetLayerGeometryBuilder::buildLayer
static MuRingForwardLayer * buildLayer(int endcap, int layer, std::vector< int > &chambers, std::vector< int > &rolls, const ME0Geometry &geo)
Definition: MuonME0DetLayerGeometryBuilder.cc:48
DetSorting.h
MuRingForwardLayer
Definition: MuRingForwardLayer.h:18
geomsort::DetPhi
ExtractPhi< GeomDet, float > DetPhi
Definition: DetSorting.h:37
ME0DetId::minChamberId
static constexpr int minChamberId
Definition: ME0DetId.h:66
MuonME0DetLayerGeometryBuilder::~MuonME0DetLayerGeometryBuilder
virtual ~MuonME0DetLayerGeometryBuilder()
Destructor.
Definition: MuonME0DetLayerGeometryBuilder.cc:21
MuRingForwardLayer.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonME0DetLayerGeometryBuilder::buildEndcapLayers
static std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > buildEndcapLayers(const ME0Geometry &geo)
Definition: MuonME0DetLayerGeometryBuilder.cc:25
MuonME0DetLayerGeometryBuilder.h
chambers
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
ME0DetId
Definition: ME0DetId.h:16
GeomDet.h
std
Definition: JetResolutionObject.h:76
ClusterizingHistogram.h
MuRodBarrelLayer.h
MuDetRing.h
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
precomputed_value_sort
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
Definition: precomputed_value_sort.h:17
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40
MuDetRod.h
MuonME0DetLayerGeometryBuilder::isFront
static bool isFront(const ME0DetId &me0Id)
Definition: MuonME0DetLayerGeometryBuilder.cc:102