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