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  theSplitHit(0),
7  theMatchedHit(theHit),
8  theSubDetId(0),
9  theLayerNumber(0),
10  theRingNumber(0),
11  theCylinderNumber(0),
12  theLocalError(0.),
13  theLargerError(0.)
14 
15 {
16  init(theGeometry);
17 }
18 
20  const TrackerGeometry* theGeometry) :
21  theSplitHit(theHit),
22  theMatchedHit(0),
23  theSubDetId(0),
24  theLayerNumber(0),
25  theRingNumber(0),
26  theCylinderNumber(0),
27  theLocalError(0.),
28  theLargerError(0.)
29 
30 {
31  init(theGeometry);
32 }
33 
34 void
35 TrackerRecHit::init(const TrackerGeometry* theGeometry) {
36 
37  const DetId& theDetId = hit()->geographicalId();
38  theGeomDet = theGeometry->idToDet(theDetId);
39  theSubDetId = theDetId.subdetId();
41  TIBDetId tibid(theDetId.rawId());
42  theLayerNumber = tibid.layer();
44  forward = false;
45  } else if ( theSubDetId == StripSubdetector::TOB ) {
46  TOBDetId tobid(theDetId.rawId());
47  theLayerNumber = tobid.layer();
49  forward = false;
50  } else if ( theSubDetId == StripSubdetector::TID) {
51  TIDDetId tidid(theDetId.rawId());
52  theLayerNumber = tidid.wheel();
54  theRingNumber = tidid.ring();
55  forward = true;
56  } else if ( theSubDetId == StripSubdetector::TEC ) {
57  TECDetId tecid(theDetId.rawId());
58  theLayerNumber = tecid.wheel();
60  theRingNumber = tecid.ring();
61  forward = true;
62  } else if ( theSubDetId == PixelSubdetector::PixelBarrel ) {
63  PXBDetId pxbid(theDetId.rawId());
64  theLayerNumber = pxbid.layer();
66  forward = false;
67  } else if ( theSubDetId == PixelSubdetector::PixelEndcap ) {
68  PXFDetId pxfid(theDetId.rawId());
69  theLayerNumber = pxfid.disk();
71  forward = true;
72  }
73 
74 }
75 
76 bool
77 //TrackerRecHit::isOnRequestedDet(const std::vector<unsigned int>& whichDet) const {
78 TrackerRecHit::isOnRequestedDet(const std::vector<unsigned int>& whichDet, const std::string& seedingAlgo) const {
79 
80  bool isOnDet = false;
81 
82  for ( unsigned idet=0; idet<whichDet.size(); ++idet ) {
83 
84  switch ( whichDet[idet] ) {
85 
86  case 1:
87  //Pixel Barrel
88  isOnDet = theSubDetId==1;
89  break;
90 
91  case 2:
92  //Pixel Disks
93  isOnDet = theSubDetId==2;
94  break;
95 
96  case 3:
97  //Inner Barrel
98  isOnDet = theSubDetId==3 && theLayerNumber < 4;
99  break;
100 
101  case 4:
102  //Inner Disks
103  isOnDet = theSubDetId==4 && theRingNumber < 3;
104  break;
105 
106  case 5:
107  //Outer Barrel
108  if(seedingAlgo == "TobTecLayerPairs"){
109  isOnDet = theSubDetId==5 && theLayerNumber <3;
110  }else {
111  isOnDet = false;
112  }
113  break;
114 
115  case 6:
116  //Tracker EndCap
117  if(seedingAlgo == "PixelLessPairs"){
118  isOnDet = theSubDetId==6 && theLayerNumber < 6 && theRingNumber < 3;
119  }else if (seedingAlgo == "TobTecLayerPairs"){
120  // isOnDet = theSubDetId==6 && theLayerNumber < 8 && theRingNumber < 5;
121  isOnDet = theSubDetId==6 && theLayerNumber < 8 && theRingNumber == 5;
122  } else if (seedingAlgo == "MixedTriplets"){
123  // isOnDet = theSubDetId==6 && theLayerNumber == 2 && theRingNumber == 1;
124  isOnDet = theSubDetId==6 && theLayerNumber < 4 && theRingNumber == 1;
125  } else {
126  isOnDet = theSubDetId==6;
127  std::cout << "DEBUG - this should never happen" << std::endl;
128  }
129 
130  break;
131 
132  default:
133  // Should not happen
134  isOnDet = false;
135  break;
136 
137  }
138 
139  if ( isOnDet ) break;
140 
141  }
142 
143  return isOnDet;
144 }
145 
146 bool
147 TrackerRecHit::makesAPairWith(const TrackerRecHit& anotherHit) const {
148 
149  bool isAProperPair = false;
150 
151  unsigned int anotherSubDetId = anotherHit.subDetId();
152  unsigned int anotherLayerNumber = anotherHit.layerNumber();
153  isAProperPair =
154  // First hit on PXB1
155  ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
156  ( anotherSubDetId == 1 && anotherLayerNumber == 2) ||
157  ( anotherSubDetId == 1 && anotherLayerNumber == 3) ||
158  ( anotherSubDetId == 2 && anotherLayerNumber == 1) ||
159  ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) ||
160  // First hit on PXB2
161  ( ( theSubDetId == 1 && theLayerNumber == 2 ) && (
162  ( anotherSubDetId == 1 && anotherLayerNumber == 3) ||
163  ( anotherSubDetId == 2 && anotherLayerNumber == 1) ||
164  ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) ||
165  // First Hit on PXD1
166  ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
167  ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) ) ||
168  // First Hit on PXD2
169  ( ( theSubDetId == 2 && theLayerNumber == 2 ) && (
170  ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ||
171  ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ) ||
172  // First Hit on TEC1
173  ( ( theSubDetId == 6 && theLayerNumber == 1 ) &&
174  ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
175  // First Hit on TEC2
176  ( ( theSubDetId == 6 && theLayerNumber == 2 ) &&
177  ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) ) ||
178 
179  //Pixelless Pairs
180  // First Hit on TIB1
181  ( ( theSubDetId == 3 && theLayerNumber == 1 ) &&
182  (( anotherSubDetId == 3 && anotherLayerNumber == 2 ) ||
183  ( anotherSubDetId == 4 && anotherLayerNumber == 1 )) ) ||
184  // First Hit on TID1
185  ( ( theSubDetId == 4 && theLayerNumber == 1 ) &&
186  ( anotherSubDetId == 4 && anotherLayerNumber == 2 ) ) ||
187  // First Hit on TID2
188  ( ( theSubDetId == 4 && theLayerNumber == 2 ) &&
189  ( anotherSubDetId == 4 && anotherLayerNumber == 3 ) ) ||
190  // First Hit on TID3
191  ( ( theSubDetId == 4 && theLayerNumber == 3 ) &&
192  ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ) ||
193  // First Hit on TEC3
194  ( ( theSubDetId == 6 && theLayerNumber == 3 ) &&
195  ( ( anotherSubDetId == 6 && anotherLayerNumber == 4 ) ||
196  ( anotherSubDetId == 6 && anotherLayerNumber == 5 )) ) ||
197  // First Hit on TEC4
198  ( ( theSubDetId == 6 && theLayerNumber == 4 ) &&
199  ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
200 
201  //Tob-Tec pairs
202  //first hit on TOB1
203  ( ( theSubDetId == 5 && theLayerNumber == 1 ) &&
204  (( anotherSubDetId == 5 && anotherLayerNumber == 2 ) ||
205  ( anotherSubDetId == 6 && anotherLayerNumber == 1 )) ) ||
206  // First Hit on TEC1
207  ( ( theSubDetId == 6 && theLayerNumber == 1 ) &&
208  ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
209  // First Hit on TEC2
210  ( ( theSubDetId == 6 && theLayerNumber == 2 ) &&
211  ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) ) ||
212  // First Hit on TEC3
213  ( ( theSubDetId == 6 && theLayerNumber == 3 ) &&
214  ( anotherSubDetId == 6 && anotherLayerNumber == 4 ) ) ||
215  // ??? ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
216  // First Hit on TEC4
217  ( ( theSubDetId == 6 && theLayerNumber == 4 ) &&
218  ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
219  // First Hit on TEC5
220  ( ( theSubDetId == 6 && theLayerNumber == 5 ) &&
221  ( anotherSubDetId == 6 && anotherLayerNumber == 6 ) ) ||
222  // First Hit on TEC6
223  ( ( theSubDetId == 6 && theLayerNumber == 6 ) &&
224  ( anotherSubDetId == 6 && anotherLayerNumber == 7 ) ) ;
225 
226  return isAProperPair;
227 
228 }
229 
230 bool
232 
233  bool isAProperPair = false;
234 
235  unsigned int anotherSubDetId = anotherHit.subDetId();
236  unsigned int anotherLayerNumber = anotherHit.layerNumber();
237  isAProperPair =
238  // First hit on PXB1
239  ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
240  ( anotherSubDetId == 1 && anotherLayerNumber == 2) ||
241  ( anotherSubDetId == 2 && anotherLayerNumber == 1) ) ) ||
242  // First hit on PXB2
243  ( ( theSubDetId == 1 && theLayerNumber == 2 ) &&
244  ( anotherSubDetId == 1 && anotherLayerNumber == 3) ) ||
245  // First Hit on PXD1
246  ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
247  ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ||
248  // First Hit on PXD2
249  ( ( theSubDetId == 2 && theLayerNumber == 2 ) &&
250  ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) );
251 
252  return isAProperPair;
253 
254 }
255 
256 bool
258  const TrackerRecHit& yetAnotherHit ) const {
259 
260  bool isAProperTriplet = false;
261 
262  unsigned int anotherSubDetId = anotherHit.subDetId();
263  unsigned int anotherLayerNumber = anotherHit.layerNumber();
264  unsigned int yetAnotherSubDetId = yetAnotherHit.subDetId();
265  unsigned int yetAnotherLayerNumber = yetAnotherHit.layerNumber();
266  isAProperTriplet =
267  // First hit on PXB1, second on PXB2
268  ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
269  ( anotherSubDetId == 1 && anotherLayerNumber == 2) && (
270  ( yetAnotherSubDetId == 1 && yetAnotherLayerNumber == 3) ||
271  ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 1) ||
272  ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ) ||
273  // First hit on PXB1, second on PXB3
274  ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
275  ( anotherSubDetId == 1 && anotherLayerNumber == 3) &&
276  ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ||
277  // First hit on PXB2, second on PXB3
278  ( ( theSubDetId == 1 && theLayerNumber == 2 ) &&
279  ( anotherSubDetId == 1 && anotherLayerNumber == 3) &&
280  ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ||
281  // First Hit on PXB1, second on PXD1
282  ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
283  ( anotherSubDetId == 2 && anotherLayerNumber == 1) && (
284  ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 2) ||
285  ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 1) ||
286  ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 2) ) ) ||
287  // First Hit on PXD1, second on PXD2
288  ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
289  ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) && (
290  ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 1 ) ||
291  ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 2 ) ) ) ||
292  // First hit on TIB1 (pixel less)
293  ( ( theSubDetId == 3 && theLayerNumber == 1 ) &&
294  ( anotherSubDetId == 3 && anotherLayerNumber == 2 ) &&
295  ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 3 ) );
296 
297  return isAProperTriplet;
298 
299 }
300 
301 
302 
303 
unsigned int theLayerNumber
unsigned int theCylinderNumber
TrackerRecHit()
Default Constructor.
Definition: TrackerRecHit.h:29
unsigned int theRingNumber
bool makesATripletWith(const TrackerRecHit &anotherHit, const TrackerRecHit &yetAnotherHit) const
Check if a triplet is on the proper combination of detectors.
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
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
Definition: DetId.h:20
unsigned int layerNumber() const
The Layer Number.
Definition: TrackerRecHit.h:81
const GSSiTrackerRecHit2DLocalPos * hit() const
Definition: TrackerRecHit.h:73
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:78
tuple cout
Definition: gather_cfg.py:121
void init(const TrackerGeometry *theGeometry)
Initialization at construction time.
DetId geographicalId() const