CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ChamberSegmentUtility.cc
Go to the documentation of this file.
1 
26 
27 #include <iostream>
28 #include <map>
29 #include <vector>
30 #include <iostream>
31 
32 using namespace edm;
33 using namespace std;
34 using namespace reco;
35 
37 {
38 
39  Setup.get<MuonGeometryRecord>().get(cscGeometry);
40  Event.getByLabel("cscSegments", CSCSegments);
41  Setup.get<MuonGeometryRecord>().get(dtGeom);
42  Event.getByLabel("dt4DSegments", all4DSegments);
43 
44  unsigned int index = 0;
45  for ( CSCSegmentCollection::id_iterator chamberId = CSCSegments->id_begin();
46  chamberId != CSCSegments->id_end(); ++chamberId, ++index ) {
47 
48  CSCSegmentCollection::range range = CSCSegments->get((*chamberId));
49 
50  for (CSCSegmentCollection::const_iterator segment = range.first;
51  segment!=range.second; ++segment) {
52  if ((*chamberId).station() == 1) cscsegMap[1].push_back(*segment);
53  if ((*chamberId).station() == 2) cscsegMap[2].push_back(*segment);
54  if ((*chamberId).station() == 3) cscsegMap[3].push_back(*segment);
55  if ((*chamberId).station() == 4) cscsegMap[4].push_back(*segment);
56  }
57  }
58 
59  DTRecSegment4DCollection::id_iterator chamberIdIt;
60  for (chamberIdIt = all4DSegments->id_begin();
61  chamberIdIt != all4DSegments->id_end();
62  ++chamberIdIt){
63 
64  DTRecSegment4DCollection::range range = all4DSegments->get((*chamberIdIt));
65 
66  for (DTRecSegment4DCollection::const_iterator segment = range.first;
67  segment!=range.second; ++segment){
68 
69  if ((*chamberIdIt).station() == 1) dtsegMap[1].push_back(*segment);
70  if ((*chamberIdIt).station() == 2) dtsegMap[2].push_back(*segment);
71  if ((*chamberIdIt).station() == 3) dtsegMap[3].push_back(*segment);
72  if ((*chamberIdIt).station() == 4) dtsegMap[4].push_back(*segment);
73  }
74  }
75 
76 
77 }
78 
79 
80 
82 {
83 
84  // loop on segments 4D
85  unsigned int index = 0;
86  for ( CSCSegmentCollection::id_iterator chamberId = CSCSegments->id_begin();
87  chamberId != CSCSegments->id_end(); ++chamberId, ++index ) {
88 
89  if ((*chamberId).chamber() != sel.chamber()) continue;
90 
91  // Get the range for the corresponding ChamberId
92  CSCSegmentCollection::range range = CSCSegments->get((*chamberId));
93 
94  // Loop over the rechits of this DetUnit
95  for (CSCSegmentCollection::const_iterator segment = range.first;
96  segment!=range.second; ++segment) {
97  cscseg.push_back(*segment);
98  }
99  }
100  return cscseg;
101 }
102 
103 
104 
106 {
107 
108  // loop on segments 4D
109  DTRecSegment4DCollection::id_iterator chamberIdIt;
110  for (chamberIdIt = all4DSegments->id_begin();
111  chamberIdIt != all4DSegments->id_end();
112  ++chamberIdIt){
113 
114  if (*chamberIdIt != sel) continue;
115 
116  // Get the range for the corresponding ChamberId
117  DTRecSegment4DCollection::range range = all4DSegments->get((*chamberIdIt));
118 
119  // Loop over the rechits of this DetUnit
120  for (DTRecSegment4DCollection::const_iterator segment = range.first;
121  segment!=range.second; ++segment){
122  dtseg.push_back(*segment);
123  }
124  }
125  return dtseg;
126 }
127 
128 
129 
130 vector<CSCRecHit2D> ChamberSegmentUtility::getCSCRHmap(const CSCSegment& selected)
131 {
132 
133  vector<CSCRecHit2D> allchRH;
134 
135  // loop on segments 4D
136  unsigned int index = 0;
137  for ( CSCSegmentCollection::id_iterator chamberId = CSCSegments->id_begin();
138  chamberId != CSCSegments->id_end(); ++chamberId, ++index ) {
139 
140  // Get the range for the corresponding ChamberId
141  CSCSegmentCollection::range range = CSCSegments->get((*chamberId));
142 
143  // Loop over the rechits of this DetUnit
144  for (CSCSegmentCollection::const_iterator segment = range.first;
145  segment!=range.second; ++segment) {
146 
147  if((*segment).parameters() == selected.parameters()) {
148  allchRH = (*segment).specificRecHits();
149  }
150  }
151  }
152  return allchRH;
153 }
154 
155 
156 vector<DTRecHit1D> ChamberSegmentUtility::getDTRHmap(const DTRecSegment4D& selected)
157 {
158 
159  vector<DTRecHit1D> allchRH;
160  phiSegRH.clear();
161  zSegRH.clear();
162 
163  // loop on segments 4D
164  DTRecSegment4DCollection::id_iterator chamberIdIt;
165  for (chamberIdIt = all4DSegments->id_begin();
166  chamberIdIt != all4DSegments->id_end();
167  ++chamberIdIt){
168 
169  // Get the range for the corresponding ChamberId
170  DTRecSegment4DCollection::range range = all4DSegments->get((*chamberIdIt));
171 
172  // Loop over the rechits of this DetUnit
173  for (DTRecSegment4DCollection::const_iterator segment = range.first;
174  segment!=range.second; ++segment){
175 
176  if((*segment).parameters() == selected.parameters()) {
177  if((*segment).hasPhi()){
178  const DTChamberRecSegment2D* phiSeg = (*segment).phiSegment();
179  phiSegRH = phiSeg->specificRecHits();
180  }
181  if((*segment).hasZed()){
182  const DTSLRecSegment2D* zSeg = (*segment).zSegment();
183  zSegRH = zSeg->specificRecHits();
184  }
185 
186  // RecHits will be ordered later
187  for (vector<DTRecHit1D>::const_iterator itphi = phiSegRH.begin(); itphi != phiSegRH.end(); itphi++) allchRH.push_back(*itphi);
188  for (vector<DTRecHit1D>::iterator itz = zSegRH.begin(); itz < zSegRH.end(); itz++) allchRH.push_back(*itz);
189 
190  }
191  }
192  }
193  return allchRH;
194 }
195 
196 
197 
ChamberSegmentUtility(const edm::Event &, const edm::EventSetup &)
int chamber() const
Definition: CSCDetId.h:70
AlgebraicVector parameters() const
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
std::vector< DTRecSegment4D > getDTSegmentsInChamber(DTChamberId)
std::vector< CSCSegment > getCSCSegmentsInChamber(CSCDetId)
std::vector< CSCRecHit2D > getCSCRHmap(const CSCSegment &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
const T & get() const
Definition: EventSetup.h:55
std::vector< DTRecHit1D > getDTRHmap(const DTRecSegment4D &)