CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions
RoadSearchDetIdHelper Class Reference

#include <RoadSearchDetIdHelper.h>

Public Member Functions

 RoadSearchDetIdHelper ()
 
 ~RoadSearchDetIdHelper ()
 

Static Public Member Functions

static bool detIdsOnSameLayer (DetId id1, DetId id2)
 
static bool IsGluedRPhi (const DetId id)
 
static bool IsMatched (const DetId id)
 
static bool IsSingleRPhi (const DetId id)
 
static bool IsStereo (const DetId id)
 
static std::string Print (const DetId id)
 
static DetId ReturnRPhiId (const DetId id)
 

Detailed Description

Definition at line 32 of file RoadSearchDetIdHelper.h.

Constructor & Destructor Documentation

RoadSearchDetIdHelper::RoadSearchDetIdHelper ( )

Definition at line 19 of file RoadSearchDetIdHelper.cc.

19  {
20 }
RoadSearchDetIdHelper::~RoadSearchDetIdHelper ( )

Definition at line 22 of file RoadSearchDetIdHelper.cc.

22  {
23 }

Member Function Documentation

bool RoadSearchDetIdHelper::detIdsOnSameLayer ( DetId  id1,
DetId  id2 
)
static

Definition at line 342 of file RoadSearchDetIdHelper.cc.

References PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, DetId::rawId(), query::result, DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

342  {
343  //
344  // check whether two detids are on the same layer
345  //
346 
347  // return value
348  bool result = false;
349 
350  // check if both rings belong to same subdetector
351  if ( (unsigned int)id1.subdetId() == StripSubdetector::TIB &&
352  (unsigned int)id2.subdetId() == StripSubdetector::TIB ) {
353  // make TIBDetId instance
354  TIBDetId id1TIB(id1.rawId());
355  TIBDetId id2TIB(id2.rawId());
356  // check whether both rings are on the same TIB layer
357  if ( id1TIB.layer() == id2TIB.layer() ) {
358  result = true;
359  }
360  } else if ( (unsigned int)id1.subdetId() == StripSubdetector::TOB &&
361  (unsigned int)id2.subdetId() == StripSubdetector::TOB ) {
362  // make TOBDetId instance
363  TOBDetId id1TOB(id1.rawId());
364  TOBDetId id2TOB(id2.rawId());
365  // check whether both rings are on the same TOB layer
366  if ( id1TOB.layer() == id2TOB.layer() ) {
367  result = true;
368  }
369  } else if ( (unsigned int)id1.subdetId() == StripSubdetector::TID &&
370  (unsigned int)id2.subdetId() == StripSubdetector::TID) {
371  // make TIDDetId instance
372  TIDDetId id1TID(id1.rawId());
373  TIDDetId id2TID(id2.rawId());
374  // check whether both rings are on the same TID wheel
375  if ( id1TID.wheel() == id2TID.wheel() ) {
376  result = true;
377  }
378  } else if ( (unsigned int)id1.subdetId() == StripSubdetector::TEC &&
379  (unsigned int)id2.subdetId() == StripSubdetector::TEC ) {
380  // make TECDetId instance
381  TECDetId id1TEC(id1.rawId());
382  TECDetId id2TEC(id2.rawId());
383  // check whether both rings are on the same TEC wheel
384  if ( id1TEC.wheel() == id2TEC.wheel() ) {
385  result = true;
386  }
387  } else if ( (unsigned int)id1.subdetId() == PixelSubdetector::PixelBarrel &&
388  (unsigned int)id2.subdetId() == PixelSubdetector::PixelBarrel) {
389  // make PXBDetId instance
390  PXBDetId id1PXB(id1.rawId());
391  PXBDetId id2PXB(id2.rawId());
392  // check whether both rings are on the same PXB layer
393  if ( id1PXB.layer() == id2PXB.layer() ) {
394  result = true;
395  }
396  } else if ( (unsigned int)id1.subdetId() == PixelSubdetector::PixelEndcap &&
397  (unsigned int)id2.subdetId() == PixelSubdetector::PixelEndcap) {
398  // make PXFDetId instance
399  PXFDetId id1PXF(id1.rawId());
400  PXFDetId id2PXF(id2.rawId());
401  // check whether both rings are on the same PXF disk
402  if ( id1PXF.disk() == id2PXF.disk() ) {
403  result = true;
404  }
405  }
406 
407  return result;
408 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
tuple result
Definition: query.py:137
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
bool RoadSearchDetIdHelper::IsGluedRPhi ( const DetId  id)
static

Definition at line 225 of file RoadSearchDetIdHelper.cc.

References SiStripDetId::glued(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, DetId::rawId(), query::result, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by Print().

225  {
226 
227  // return value
228  bool result = true;
229 
230  if ( (unsigned int)id.subdetId() == StripSubdetector::TIB ) {
231  TIBDetId tibid(id.rawId());
232  if ( !tibid.glued() ) {
233  result = false;
234  } else {
235  if ( (tibid.rawId()-2) != tibid.glued() ) {
236  result = false;
237  }
238  }
239  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TOB ) {
240  TOBDetId tobid(id.rawId());
241  if ( !tobid.glued() ) {
242  result = false;
243  } else {
244  if ( (tobid.rawId()-2) != tobid.glued() ) {
245  result = false;
246  }
247  }
248  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TID ) {
249  TIDDetId tidid(id.rawId());
250  if ( !tidid.glued() ) {
251  result = false;
252  } else {
253  if ( (tidid.rawId()-2) != tidid.glued() ) {
254  result = false;
255  }
256  }
257  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TEC ) {
258  TECDetId tecid(id.rawId());
259  if ( !tecid.glued() ) {
260  result = false;
261  } else {
262  if ( (tecid.rawId()-2) != tecid.glued() ) {
263  result = false;
264  }
265  }
266  } else if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelBarrel ) {
267  result = false;
268  } else if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelEndcap ) {
269  result = false;
270  }
271 
272  return result;
273 }
tuple result
Definition: query.py:137
bool RoadSearchDetIdHelper::IsMatched ( const DetId  id)
static

Definition at line 125 of file RoadSearchDetIdHelper.cc.

References SiStripDetId::glued(), TOBDetId::layer(), TIBDetId::layer(), query::result, TIDDetId::ring(), TECDetId::ring(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by Print(), and ReturnRPhiId().

125  {
126 
127  // return value
128  bool result = false;
129 
130  if ( (unsigned int)id.subdetId() == StripSubdetector::TIB ) {
131  TIBDetId tibid(id.rawId());
132  if ( !tibid.glued() ) {
133  if ( tibid.layer() == 1 ||
134  tibid.layer() == 2 ) {
135  result = true;
136  }
137  }
138  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TOB ) {
139  TOBDetId tobid(id.rawId());
140  if ( !tobid.glued() ) {
141  if ( tobid.layer() == 1 ||
142  tobid.layer() == 2 ) {
143  result = true;
144  }
145  }
146  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TID ) {
147  TIDDetId tidid(id.rawId());
148  if ( !tidid.glued() ) {
149  if ( tidid.ring() == 1 ||
150  tidid.ring() == 2 ) {
151  result = true;
152  }
153  }
154  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TEC ) {
155  TECDetId tecid(id.rawId());
156  if ( !tecid.glued() ) {
157  if ( tecid.ring() == 1 ||
158  tecid.ring() == 2 ||
159  tecid.ring() == 5 ) {
160  result = true;
161  }
162  }
163  }
164 
165  return result;
166 }
tuple result
Definition: query.py:137
bool RoadSearchDetIdHelper::IsSingleRPhi ( const DetId  id)
static

Definition at line 168 of file RoadSearchDetIdHelper.cc.

References SiStripDetId::glued(), TOBDetId::layer(), TIBDetId::layer(), DetId::rawId(), query::result, TIDDetId::ring(), TECDetId::ring(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by Print().

168  {
169 
170  // return value
171  bool result = true;
172 
173  if ( (unsigned int)id.subdetId() == StripSubdetector::TIB ) {
174  TIBDetId tibid(id.rawId());
175  if ( !tibid.glued() ) {
176  if ( tibid.layer() == 1 ||
177  tibid.layer() == 2 ) {
178  result = false;
179  }
180  } else {
181  result = false;
182  }
183  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TOB ) {
184  TOBDetId tobid(id.rawId());
185  if ( !tobid.glued() ) {
186  if ( tobid.layer() == 1 ||
187  tobid.layer() == 2 ) {
188  result = false;
189  }
190  } else {
191  if ( (tobid.rawId()-2) != tobid.glued() ) {
192  result = false;
193  }
194  }
195  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TID ) {
196  TIDDetId tidid(id.rawId());
197  if ( !tidid.glued() ) {
198  if ( tidid.ring() == 1 ||
199  tidid.ring() == 2 ) {
200  result = false;
201  }
202  } else {
203  if ( (tidid.rawId()-2) != tidid.glued() ) {
204  result = false;
205  }
206  }
207  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TEC ) {
208  TECDetId tecid(id.rawId());
209  if ( !tecid.glued() ) {
210  if ( tecid.ring() == 1 ||
211  tecid.ring() == 2 ||
212  tecid.ring() == 5 ) {
213  result = false;
214  }
215  } else {
216  if ( (tecid.rawId()-2) != tecid.glued() ) {
217  result = false;
218  }
219  }
220  }
221 
222  return result;
223 }
tuple result
Definition: query.py:137
bool RoadSearchDetIdHelper::IsStereo ( const DetId  id)
static

Definition at line 275 of file RoadSearchDetIdHelper.cc.

References SiStripDetId::glued(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, DetId::rawId(), query::result, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by Print(), and ReturnRPhiId().

275  {
276 
277  // return value
278  bool result = true;
279 
280  if ( (unsigned int)id.subdetId() == StripSubdetector::TIB ) {
281  TIBDetId tibid(id.rawId());
282  if ( !tibid.glued() ) {
283  result = false;
284  } else {
285  if ( (tibid.rawId()-1) != tibid.glued() ) {
286  result = false;
287  }
288  }
289  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TOB ) {
290  TOBDetId tobid(id.rawId());
291  if ( !tobid.glued() ) {
292  result = false;
293  } else {
294  if ( (tobid.rawId()-1) != tobid.glued() ) {
295  result = false;
296  }
297  }
298  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TID ) {
299  TIDDetId tidid(id.rawId());
300  if ( !tidid.glued() ) {
301  result = false;
302  } else {
303  if ( (tidid.rawId()-1) != tidid.glued() ) {
304  result = false;
305  }
306  }
307  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TEC ) {
308  TECDetId tecid(id.rawId());
309  if ( !tecid.glued() ) {
310  result = false;
311  } else {
312  if ( (tecid.rawId()-1) != tecid.glued() ) {
313  result = false;
314  }
315  }
316  } else if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelBarrel ) {
317  result = false;
318  } else if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelEndcap ) {
319  result = false;
320  }
321 
322  return result;
323 }
tuple result
Definition: query.py:137
std::string RoadSearchDetIdHelper::Print ( const DetId  id)
static

Definition at line 25 of file RoadSearchDetIdHelper.cc.

References PXFDetId::blade(), PXFDetId::disk(), IsGluedRPhi(), IsMatched(), IsSingleRPhi(), IsStereo(), PXBDetId::ladder(), PXBDetId::layer(), TOBDetId::layer(), TIBDetId::layer(), PXBDetId::module(), PXFDetId::module(), TOBDetId::module(), TIBDetId::module(), TIDDetId::module(), TECDetId::module(), convertSQLitetoXML_cfg::output, TECDetId::petal(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TIDDetId::ring(), TECDetId::ring(), TOBDetId::rod(), PXFDetId::side(), TIDDetId::side(), TECDetId::side(), TIBDetId::string(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, TIDDetId::wheel(), and TECDetId::wheel().

25  {
26  //
27  // print DetId composition according to the type
28  //
29 
30  std::ostringstream output;
31 
32  if ( (unsigned int)id.subdetId() == StripSubdetector::TIB ) {
33  TIBDetId tibid(id.rawId());
34  output << "TIB ring Detid: " << id.rawId()
35  << " layer: " << tibid.layer()
36  << " fw(0)/bw(1): " << tibid.string()[0]
37  << " int(0)/ext(1): " << tibid.string()[1]
38  << " string: " << tibid.string()[2]
39  << " module: " << tibid.module();
40  if ( IsMatched(tibid) ) {
41  output << " corresponding to matched detunit of glued sensor";
42  } else if ( IsGluedRPhi(tibid) ) {
43  output << " corresponding to rphi detunit of glued sensor";
44  } else if ( IsStereo(tibid) ) {
45  output << " corresponding to stereo detunit of glued sensor";
46  } else if ( IsSingleRPhi(tibid) ) {
47  output << " corresponding to rphi detunit of single sensor";
48  }
49  output << std::endl;
50  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TOB ) {
51  TOBDetId tobid(id.rawId());
52  output << "TOB ring Detid: " << id.rawId()
53  << " layer: " << tobid.layer()
54  << " fw(0)/bw(1): " << tobid.rod()[0]
55  << " rod: " << tobid.rod()[1]
56  << " detector: " << tobid.module();
57  if ( IsMatched(tobid) ) {
58  output << " corresponding to matched detunit of glued sensor";
59  } else if ( IsGluedRPhi(tobid) ) {
60  output << " corresponding to rphi detunit of glued sensor";
61  } else if ( IsStereo(tobid) ) {
62  output << " corresponding to stereo detunit of glued sensor";
63  } else if ( IsSingleRPhi(tobid) ) {
64  output << " corresponding to rphi detunit of single sensor";
65  }
66  output << std::endl;
67  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TID ) {
68  TIDDetId tidid(id.rawId());
69  output << "TID ring Detid: " << id.rawId()
70  << " side neg(1)/pos(2): " << tidid.side()
71  << " wheel: " << tidid.wheel()
72  << " ring: " << tidid.ring()
73  << " detector fw(0)/bw(1): " << tidid.module()[0]
74  << " detector: " << tidid.module()[1];
75  if ( IsMatched(tidid) ) {
76  output << " corresponding to matched detunit of glued sensor";
77  } else if ( IsGluedRPhi(tidid) ) {
78  output << " corresponding to rphi detunit of glued sensor";
79  } else if ( IsStereo(tidid) ) {
80  output << " corresponding to stereo detunit of glued sensor";
81  } else if ( IsSingleRPhi(tidid) ) {
82  output << " corresponding to rphi detunit of single sensor";
83  }
84  output << std::endl;
85  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TEC ) {
86  TECDetId tecid(id.rawId());
87  output << "TEC ring DetId: " << id.rawId()
88  << " side neg(1)/pos(2): " << tecid.side()
89  << " wheel: " << tecid.wheel()
90  << " petal fw(0)/bw(1): " << tecid.petal()[0]
91  << " petal: " << tecid.petal()[1]
92  << " ring: " << tecid.ring()
93  << " module: " << tecid.module();
94  if ( IsMatched(tecid) ) {
95  output << " corresponding to matched detunit of glued sensor";
96  } else if ( IsGluedRPhi(tecid) ) {
97  output << " corresponding to rphi detunit of glued sensor";
98  } else if ( IsStereo(tecid) ) {
99  output << " corresponding to stereo detunit of glued sensor";
100  } else if ( IsSingleRPhi(tecid) ) {
101  output << " corresponding to rphi detunit of single sensor";
102  }
103  output << std::endl;
104  } else if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelBarrel ) {
105  PXBDetId pxbid(id.rawId());
106  output << "PXB ring DetId: " << id.rawId()
107  << " layer: " << pxbid.layer()
108  << " ladder: " << pxbid.ladder()
109  << " detector: " << pxbid.module()
110  << std::endl;
111  } else if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelEndcap ) {
112  PXFDetId pxfid(id.rawId());
113  output << "PXF ring DetId: " << id.rawId()
114  << " side: " << pxfid.side()
115  << " disk: " << pxfid.disk()
116  << " blade: " << pxfid.blade()
117  << " detector: " << pxfid.module()
118  << std::endl;
119  }
120 
121 
122  return output.str();
123 }
static bool IsGluedRPhi(const DetId id)
static bool IsSingleRPhi(const DetId id)
static bool IsMatched(const DetId id)
static bool IsStereo(const DetId id)
DetId RoadSearchDetIdHelper::ReturnRPhiId ( const DetId  id)
static

Definition at line 325 of file RoadSearchDetIdHelper.cc.

References errorMatrix2Lands_multiChannel::id, IsMatched(), and IsStereo().

Referenced by Roads::getRoadSeed().

325  {
326  //
327  // return corresponding rphi id
328  //
329 
330  if ( IsMatched(id) ) {
331  return DetId(id.rawId()+2);
332  } else if ( IsStereo(id) ) {
333  return DetId(id.rawId()+1);
334  } else {
335  return id;
336  }
337 
338  return id;
339 }
Definition: DetId.h:20
static bool IsMatched(const DetId id)
static bool IsStereo(const DetId id)