CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackerRecHit.cc
Go to the documentation of this file.
3 
5  const TrackerGeometry* theGeometry,
6  const TrackerTopology* tTopo) :
7  theSplitHit(0),
8  theMatchedHit(theHit),
9  theSubDetId(0),
10  theLayerNumber(0),
11  theRingNumber(0),
12  theCylinderNumber(0),
13  theLocalError(0.),
14  theLargerError(0.)
15 
16 {
17  init(theGeometry, tTopo);
18 }
19 
21  const TrackerGeometry* theGeometry,
22  const TrackerTopology* tTopo ) :
23  theSplitHit(theHit),
24  theMatchedHit(0),
25  theSubDetId(0),
26  theLayerNumber(0),
27  theRingNumber(0),
28  theCylinderNumber(0),
29  theLocalError(0.),
30  theLargerError(0.)
31 
32 {
33  init(theGeometry,tTopo);
34 }
35 
36 void
37 TrackerRecHit::init(const TrackerGeometry* theGeometry, const TrackerTopology *tTopo) {
38 
39  const DetId& theDetId = hit()->geographicalId();
40  theGeomDet = theGeometry->idToDet(theDetId);
41  theSubDetId = theDetId.subdetId();
43 
44  theLayerNumber = tTopo->tibLayer(theDetId);
46  forward = false;
47  } else if ( theSubDetId == StripSubdetector::TOB ) {
48 
49  theLayerNumber = tTopo->tobLayer(theDetId);
51  forward = false;
52  } else if ( theSubDetId == StripSubdetector::TID) {
53 
54  theLayerNumber = tTopo->tidWheel(theDetId);
56  theRingNumber = tTopo->tidRing(theDetId);
57  forward = true;
58  } else if ( theSubDetId == StripSubdetector::TEC ) {
59 
60  theLayerNumber = tTopo->tecWheel(theDetId);
62  theRingNumber = tTopo->tecRing(theDetId);
63  forward = true;
64  } else if ( theSubDetId == PixelSubdetector::PixelBarrel ) {
65 
66  theLayerNumber = tTopo->pxbLayer(theDetId);
68  forward = false;
69  } else if ( theSubDetId == PixelSubdetector::PixelEndcap ) {
70 
71  theLayerNumber = tTopo->pxfDisk(theDetId);
73  forward = true;
74  }
75 
76 }
77 
78 
79 bool
80 TrackerRecHit::isOnRequestedDet(const std::vector<std::string>& layerList) const {
81 
82  std::cout << "layerList.size() = " << layerList.size() << std::endl;
83  bool isOnDet = false;
84 
85  int subdet = 0; // 1 = PXB, 2 = PXD, 3 = TIB, 4 = TID, 5 = TOB, 6 = TEC, 0 = not valid
86  int idLayer = 0;
87  int side = 0; // 0 = barrel, -1 = neg. endcap, +1 = pos. endcap
88 
89  for (unsigned i=0; i<layerList.size();i++) {
90  std::string name = layerList[i];
91  std::cout << "------- Name = " << name << std::endl;
92 
93  //
94  // BPIX
95  //
96  if (name.substr(0,4) == "BPix") {
97  subdet = 1;
98  idLayer = atoi(name.substr(4,1).c_str());
99  side=0;
100  }
101  //
102  // FPIX
103  //
104  else if (name.substr(0,4) == "FPix") {
105  subdet = 2;
106  idLayer = atoi(name.substr(4,1).c_str());
107  if ( name.find("pos") != std::string::npos ) {
108  side = +1;
109  } else {
110  side = -1;
111  }
112  }
113  //
114  // TIB
115  //
116  else if (name.substr(0,3) == "TIB") {
117  subdet = 3;
118  idLayer = atoi(name.substr(3,1).c_str());
119  side=0;
120  }
121  //
122  // TID
123  //
124  else if (name.substr(0,3) == "TID") {
125  subdet = 4;
126  idLayer = atoi(name.substr(3,1).c_str());
127  if ( name.find("pos") !=std::string::npos ) {
128  side = +1;
129  } else {
130  side = -1;
131  }
132  }
133  //
134  // TOB
135  //
136  else if (name.substr(0,3) == "TOB") {
137  subdet = 5;
138  idLayer = atoi(name.substr(3,1).c_str());
139  side = 0;
140  }
141  //
142  // TEC
143  //
144  else if (name.substr(0,3) == "TEC") {
145  subdet = 6;
146  idLayer = atoi(name.substr(3,1).c_str());
147  if ( name.find("pos") != std::string::npos ) {
148  side = +1;
149  } else {
150  side = -1;
151  }
152  }
153 
154  std::cout << "subdet = " << subdet << std::endl;
155  std::cout << "idLayer = " << idLayer << std::endl;
156  std::cout << "side = " << side << std::endl;
157 
158  }
159 
161 
162 
163 
164  return isOnDet;
165 }
166 
167 bool
168 //TrackerRecHit::isOnRequestedDet(const std::vector<unsigned int>& whichDet) const {
169 TrackerRecHit::isOnRequestedDet(const std::vector<unsigned int>& whichDet, const std::string& seedingAlgo) const {
170 
171  bool isOnDet = false;
172 
173  for ( unsigned idet=0; idet<whichDet.size(); ++idet ) {
174 
175  switch ( whichDet[idet] ) {
176 
177  case 1:
178  //Pixel Barrel
179  isOnDet = theSubDetId==1;
180  break;
181 
182  case 2:
183  //Pixel Disks
184  isOnDet = theSubDetId==2;
185  break;
186 
187  case 3:
188  //Inner Barrel
189  isOnDet = theSubDetId==3 && theLayerNumber < 4;
190  break;
191 
192  case 4:
193  //Inner Disks
194  isOnDet = theSubDetId==4 && theRingNumber < 3;
195  break;
196 
197  case 5:
198  //Outer Barrel
199  if(seedingAlgo == "TobTecLayerPairs"){
200  isOnDet = theSubDetId==5 && theLayerNumber <3;
201  }else {
202  isOnDet = false;
203  }
204  break;
205 
206  case 6:
207  //Tracker EndCap
208  if(seedingAlgo == "PixelLessPairs"){
209  isOnDet = theSubDetId==6 && theLayerNumber < 6 && theRingNumber < 3;
210  }else if (seedingAlgo == "TobTecLayerPairs"){
211  // isOnDet = theSubDetId==6 && theLayerNumber < 8 && theRingNumber < 5;
212  isOnDet = theSubDetId==6 && theLayerNumber < 8 && theRingNumber == 5;
213  } else if (seedingAlgo == "MixedTriplets"){
214  // isOnDet = theSubDetId==6 && theLayerNumber == 2 && theRingNumber == 1;
215  isOnDet = theSubDetId==6 && theLayerNumber < 4 && theRingNumber == 1;
216  } else {
217  isOnDet = theSubDetId==6;
218  std::cout << "DEBUG - this should never happen" << std::endl;
219  }
220 
221  break;
222 
223  default:
224  // Should not happen
225  isOnDet = false;
226  break;
227 
228  }
229 
230  if ( isOnDet ) break;
231 
232  }
233 
234  return isOnDet;
235 }
236 
237 bool
238 TrackerRecHit::makesAPairWith(const TrackerRecHit& anotherHit) const {
239 
240  bool isAProperPair = false;
241 
242  unsigned int anotherSubDetId = anotherHit.subDetId();
243  unsigned int anotherLayerNumber = anotherHit.layerNumber();
244  isAProperPair =
245  // First hit on PXB1
246  ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
247  ( anotherSubDetId == 1 && anotherLayerNumber == 2) ||
248  ( anotherSubDetId == 1 && anotherLayerNumber == 3) ||
249  ( anotherSubDetId == 2 && anotherLayerNumber == 1) ||
250  ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) ||
251  // First hit on PXB2
252  ( ( theSubDetId == 1 && theLayerNumber == 2 ) && (
253  ( anotherSubDetId == 1 && anotherLayerNumber == 3) ||
254  ( anotherSubDetId == 2 && anotherLayerNumber == 1) ||
255  ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) ||
256  // First Hit on PXD1
257  ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
258  ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) ) ||
259  // First Hit on PXD2
260  ( ( theSubDetId == 2 && theLayerNumber == 2 ) && (
261  ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ||
262  ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ) ||
263  // First Hit on TEC1
264  ( ( theSubDetId == 6 && theLayerNumber == 1 ) &&
265  ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
266  // First Hit on TEC2
267  ( ( theSubDetId == 6 && theLayerNumber == 2 ) &&
268  ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) ) ||
269 
270  //Pixelless Pairs
271  // First Hit on TIB1
272  ( ( theSubDetId == 3 && theLayerNumber == 1 ) &&
273  (( anotherSubDetId == 3 && anotherLayerNumber == 2 ) ||
274  ( anotherSubDetId == 4 && anotherLayerNumber == 1 )) ) ||
275  // First Hit on TID1
276  ( ( theSubDetId == 4 && theLayerNumber == 1 ) &&
277  ( anotherSubDetId == 4 && anotherLayerNumber == 2 ) ) ||
278  // First Hit on TID2
279  ( ( theSubDetId == 4 && theLayerNumber == 2 ) &&
280  ( anotherSubDetId == 4 && anotherLayerNumber == 3 ) ) ||
281  // First Hit on TID3
282  ( ( theSubDetId == 4 && theLayerNumber == 3 ) &&
283  ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ) ||
284  // First Hit on TEC3
285  ( ( theSubDetId == 6 && theLayerNumber == 3 ) &&
286  ( ( anotherSubDetId == 6 && anotherLayerNumber == 4 ) ||
287  ( anotherSubDetId == 6 && anotherLayerNumber == 5 )) ) ||
288  // First Hit on TEC4
289  ( ( theSubDetId == 6 && theLayerNumber == 4 ) &&
290  ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
291 
292  //Tob-Tec pairs
293  //first hit on TOB1
294  ( ( theSubDetId == 5 && theLayerNumber == 1 ) &&
295  (( anotherSubDetId == 5 && anotherLayerNumber == 2 ) ||
296  ( anotherSubDetId == 6 && anotherLayerNumber == 1 )) ) ||
297  // First Hit on TEC1
298  ( ( theSubDetId == 6 && theLayerNumber == 1 ) &&
299  ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
300  // First Hit on TEC2
301  ( ( theSubDetId == 6 && theLayerNumber == 2 ) &&
302  ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) ) ||
303  // First Hit on TEC3
304  ( ( theSubDetId == 6 && theLayerNumber == 3 ) &&
305  ( anotherSubDetId == 6 && anotherLayerNumber == 4 ) ) ||
306  // ??? ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
307  // First Hit on TEC4
308  ( ( theSubDetId == 6 && theLayerNumber == 4 ) &&
309  ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
310  // First Hit on TEC5
311  ( ( theSubDetId == 6 && theLayerNumber == 5 ) &&
312  ( anotherSubDetId == 6 && anotherLayerNumber == 6 ) ) ||
313  // First Hit on TEC6
314  ( ( theSubDetId == 6 && theLayerNumber == 6 ) &&
315  ( anotherSubDetId == 6 && anotherLayerNumber == 7 ) ) ;
316 
317  return isAProperPair;
318 
319 }
320 
321 bool
323 
324  bool isAProperPair = false;
325 
326  unsigned int anotherSubDetId = anotherHit.subDetId();
327  unsigned int anotherLayerNumber = anotherHit.layerNumber();
328  isAProperPair =
329  // First hit on PXB1
330  ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
331  ( anotherSubDetId == 1 && anotherLayerNumber == 2) ||
332  ( anotherSubDetId == 2 && anotherLayerNumber == 1) ) ) ||
333  // First hit on PXB2
334  ( ( theSubDetId == 1 && theLayerNumber == 2 ) &&
335  ( anotherSubDetId == 1 && anotherLayerNumber == 3) ) ||
336  // First Hit on PXD1
337  ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
338  ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ||
339  // First Hit on PXD2
340  ( ( theSubDetId == 2 && theLayerNumber == 2 ) &&
341  ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) );
342 
343  return isAProperPair;
344 
345 }
346 
347 bool
349  const TrackerRecHit& yetAnotherHit ) const {
350 
351  bool isAProperTriplet = false;
352 
353  unsigned int anotherSubDetId = anotherHit.subDetId();
354  unsigned int anotherLayerNumber = anotherHit.layerNumber();
355  unsigned int yetAnotherSubDetId = yetAnotherHit.subDetId();
356  unsigned int yetAnotherLayerNumber = yetAnotherHit.layerNumber();
357  isAProperTriplet =
358  // First hit on PXB1, second on PXB2
359  ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
360  ( anotherSubDetId == 1 && anotherLayerNumber == 2) && (
361  ( yetAnotherSubDetId == 1 && yetAnotherLayerNumber == 3) ||
362  ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 1) ||
363  ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ) ||
364  // First hit on PXB1, second on PXB3
365  ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
366  ( anotherSubDetId == 1 && anotherLayerNumber == 3) &&
367  ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ||
368  // First hit on PXB2, second on PXB3
369  ( ( theSubDetId == 1 && theLayerNumber == 2 ) &&
370  ( anotherSubDetId == 1 && anotherLayerNumber == 3) &&
371  ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ||
372  // First Hit on PXB1, second on PXD1
373  ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
374  ( anotherSubDetId == 2 && anotherLayerNumber == 1) && (
375  ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 2) ||
376  ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 1) ||
377  ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 2) ) ) ||
378  // First Hit on PXD1, second on PXD2
379  ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
380  ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) && (
381  ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 1 ) ||
382  ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 2 ) ) ) ||
383  // First hit on TIB1 (pixel less)
384  ( ( theSubDetId == 3 && theLayerNumber == 1 ) &&
385  ( anotherSubDetId == 3 && anotherLayerNumber == 2 ) &&
386  ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 3 ) );
387 
388  return isAProperTriplet;
389 
390 }
391 
392 
393 
394 
int i
Definition: DBlmapReader.cc:9
unsigned int theLayerNumber
unsigned int tibLayer(const DetId &id) const
unsigned int tidRing(const DetId &id) const
unsigned int pxfDisk(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
unsigned int tidWheel(const DetId &id) const
unsigned int theCylinderNumber
TrackerRecHit()
Default Constructor.
Definition: TrackerRecHit.h:27
unsigned int theRingNumber
bool makesATripletWith(const TrackerRecHit &anotherHit, const TrackerRecHit &yetAnotherHit) const
Check if a triplet is on the proper combination of detectors.
void init(const TrackerGeometry *theGeometry, const TrackerTopology *tTopo)
Initialization at construction time.
unsigned int theSubDetId
const GeomDet * theGeomDet
bool makesAPairWith3rd(const TrackerRecHit &anotherHit) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
virtual const GeomDet * idToDet(DetId) const
unsigned int pxbLayer(const DetId &id) const
Definition: DetId.h:20
unsigned int layerNumber() const
The Layer Number.
Definition: TrackerRecHit.h:82
const GSSiTrackerRecHit2DLocalPos * hit() const
Definition: TrackerRecHit.h:74
bool makesAPairWith(const TrackerRecHit &anotherHit) const
Check if a pair is on the proper combination of detectors.
bool isOnRequestedDet(const std::vector< unsigned int > &whichDet, const std::string &seedingAlgo) const
Check if the hit is on one of the requested detector.
unsigned int subDetId() const
The subdet Id.
Definition: TrackerRecHit.h:79
tuple cout
Definition: gather_cfg.py:121
DetId geographicalId() const
unsigned int tecWheel(const DetId &id) const
unsigned int tobLayer(const DetId &id) const