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 bool
79 TrackerRecHit::isOnRequestedDet(const std::vector<std::vector<TrajectorySeedProducer::LayerSpec> >& theLayersInSets) const{
80 
81  for(unsigned int i=0; i<theLayersInSets.size(); ++i) {
82  if(theLayersInSets[i][0].subDet==theSubDetId && theLayersInSets[i][0].idLayer==theLayerNumber) return true;
83  }
84 
85  return false;
86 }
87 
88 bool
89 TrackerRecHit::isOnRequestedDet(const std::vector<std::vector<TrajectorySeedProducer::LayerSpec> >& theLayersInSets, const TrackerRecHit& theSeedHitSecond) const{
90 
91  for(unsigned int i=0; i<theLayersInSets.size(); ++i){
92  if( theLayersInSets[i][0].subDet==theSubDetId && theLayersInSets[i][0].idLayer==theLayerNumber &&
93  theLayersInSets[i][1].subDet==theSeedHitSecond.subDetId() && theLayersInSets[i][1].idLayer==theSeedHitSecond.layerNumber()
94  ) return true;
95  }
96  return false;
97 }
98 
99 bool
100 TrackerRecHit::isOnRequestedDet(const std::vector<std::vector<TrajectorySeedProducer::LayerSpec> >& theLayersInSets, const TrackerRecHit& theSeedHitSecond, const TrackerRecHit& theSeedHitThird) const{
101 
102  for(unsigned int i=0; i<theLayersInSets.size(); ++i){
103  if( theLayersInSets[i][0].subDet==theSubDetId && theLayersInSets[i][0].idLayer==theLayerNumber &&
104  theLayersInSets[i][1].subDet==theSeedHitSecond.subDetId() && theLayersInSets[i][1].idLayer==theSeedHitSecond.layerNumber() &&
105  theLayersInSets[i][2].subDet==theSeedHitThird.subDetId() && theLayersInSets[i][2].idLayer==theSeedHitThird.layerNumber()
106  ) return true;
107  }
108  return false;
109 }
110 
111 
112 bool
113 //TrackerRecHit::isOnRequestedDet(const std::vector<unsigned int>& whichDet) const {
114 TrackerRecHit::isOnRequestedDet(const std::vector<unsigned int>& whichDet, const std::string& seedingAlgo) const {
115 
116  bool isOnDet = false;
117 
118  for ( unsigned idet=0; idet<whichDet.size(); ++idet ) {
119 
120  switch ( whichDet[idet] ) {
121 
122  case 1:
123  //Pixel Barrel
124  isOnDet = theSubDetId==1;
125  break;
126 
127  case 2:
128  //Pixel Disks
129  isOnDet = theSubDetId==2;
130  break;
131 
132  case 3:
133  //Inner Barrel
134  isOnDet = theSubDetId==3 && theLayerNumber < 4;
135  break;
136 
137  case 4:
138  //Inner Disks
139  isOnDet = theSubDetId==4 && theRingNumber < 3;
140  break;
141 
142  case 5:
143  //Outer Barrel
144  if(seedingAlgo == "TobTecLayerPairs"){
145  isOnDet = theSubDetId==5 && theLayerNumber <3;
146  }else {
147  isOnDet = false;
148  }
149  break;
150 
151  case 6:
152  //Tracker EndCap
153  if(seedingAlgo == "PixelLessPairs"){
154  isOnDet = theSubDetId==6 && theLayerNumber < 6 && theRingNumber < 3;
155  }else if (seedingAlgo == "TobTecLayerPairs"){
156  // isOnDet = theSubDetId==6 && theLayerNumber < 8 && theRingNumber < 5;
157  isOnDet = theSubDetId==6 && theLayerNumber < 8 && theRingNumber == 5;
158  } else if (seedingAlgo == "MixedTriplets"){
159  // isOnDet = theSubDetId==6 && theLayerNumber == 2 && theRingNumber == 1;
160  isOnDet = theSubDetId==6 && theLayerNumber < 4 && theRingNumber == 1;
161  } else {
162  isOnDet = theSubDetId==6;
163  std::cout << "DEBUG - this should never happen" << std::endl;
164  }
165 
166  break;
167 
168  default:
169  // Should not happen
170  isOnDet = false;
171  break;
172 
173  }
174 
175  if ( isOnDet ) break;
176 
177  }
178 
179  return isOnDet;
180 }
181 
182 bool
183 TrackerRecHit::makesAPairWith(const TrackerRecHit& anotherHit) const {
184 
185  bool isAProperPair = false;
186 
187  unsigned int anotherSubDetId = anotherHit.subDetId();
188  unsigned int anotherLayerNumber = anotherHit.layerNumber();
189  isAProperPair =
190  // First hit on PXB1
191  ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
192  ( anotherSubDetId == 1 && anotherLayerNumber == 2) ||
193  ( anotherSubDetId == 1 && anotherLayerNumber == 3) ||
194  ( anotherSubDetId == 2 && anotherLayerNumber == 1) ||
195  ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) ||
196  // First hit on PXB2
197  ( ( theSubDetId == 1 && theLayerNumber == 2 ) && (
198  ( anotherSubDetId == 1 && anotherLayerNumber == 3) ||
199  ( anotherSubDetId == 2 && anotherLayerNumber == 1) ||
200  ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) ||
201  // First Hit on PXD1
202  ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
203  ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) ) ||
204  // First Hit on PXD2
205  ( ( theSubDetId == 2 && theLayerNumber == 2 ) && (
206  ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ||
207  ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ) ||
208  // First Hit on TEC1
209  ( ( theSubDetId == 6 && theLayerNumber == 1 ) &&
210  ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
211  // First Hit on TEC2
212  ( ( theSubDetId == 6 && theLayerNumber == 2 ) &&
213  ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) ) ||
214 
215  //Pixelless Pairs
216  // First Hit on TIB1
217  ( ( theSubDetId == 3 && theLayerNumber == 1 ) &&
218  (( anotherSubDetId == 3 && anotherLayerNumber == 2 ) ||
219  ( anotherSubDetId == 4 && anotherLayerNumber == 1 )) ) ||
220  // First Hit on TID1
221  ( ( theSubDetId == 4 && theLayerNumber == 1 ) &&
222  ( anotherSubDetId == 4 && anotherLayerNumber == 2 ) ) ||
223  // First Hit on TID2
224  ( ( theSubDetId == 4 && theLayerNumber == 2 ) &&
225  ( anotherSubDetId == 4 && anotherLayerNumber == 3 ) ) ||
226  // First Hit on TID3
227  ( ( theSubDetId == 4 && theLayerNumber == 3 ) &&
228  ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ) ||
229  // First Hit on TEC3
230  ( ( theSubDetId == 6 && theLayerNumber == 3 ) &&
231  ( ( anotherSubDetId == 6 && anotherLayerNumber == 4 ) ||
232  ( anotherSubDetId == 6 && anotherLayerNumber == 5 )) ) ||
233  // First Hit on TEC4
234  ( ( theSubDetId == 6 && theLayerNumber == 4 ) &&
235  ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
236 
237  //Tob-Tec pairs
238  //first hit on TOB1
239  ( ( theSubDetId == 5 && theLayerNumber == 1 ) &&
240  (( anotherSubDetId == 5 && anotherLayerNumber == 2 ) ||
241  ( anotherSubDetId == 6 && anotherLayerNumber == 1 )) ) ||
242  // First Hit on TEC1
243  ( ( theSubDetId == 6 && theLayerNumber == 1 ) &&
244  ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
245  // First Hit on TEC2
246  ( ( theSubDetId == 6 && theLayerNumber == 2 ) &&
247  ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) ) ||
248  // First Hit on TEC3
249  ( ( theSubDetId == 6 && theLayerNumber == 3 ) &&
250  ( anotherSubDetId == 6 && anotherLayerNumber == 4 ) ) ||
251  // ??? ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
252  // First Hit on TEC4
253  ( ( theSubDetId == 6 && theLayerNumber == 4 ) &&
254  ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
255  // First Hit on TEC5
256  ( ( theSubDetId == 6 && theLayerNumber == 5 ) &&
257  ( anotherSubDetId == 6 && anotherLayerNumber == 6 ) ) ||
258  // First Hit on TEC6
259  ( ( theSubDetId == 6 && theLayerNumber == 6 ) &&
260  ( anotherSubDetId == 6 && anotherLayerNumber == 7 ) ) ;
261 
262  return isAProperPair;
263 
264 }
265 
266 bool
268 
269  bool isAProperPair = false;
270 
271  unsigned int anotherSubDetId = anotherHit.subDetId();
272  unsigned int anotherLayerNumber = anotherHit.layerNumber();
273  isAProperPair =
274  // First hit on PXB1
275  ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
276  ( anotherSubDetId == 1 && anotherLayerNumber == 2) ||
277  ( anotherSubDetId == 2 && anotherLayerNumber == 1) ) ) ||
278  // First hit on PXB2
279  ( ( theSubDetId == 1 && theLayerNumber == 2 ) &&
280  ( anotherSubDetId == 1 && anotherLayerNumber == 3) ) ||
281  // First Hit on PXD1
282  ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
283  ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ||
284  // First Hit on PXD2
285  ( ( theSubDetId == 2 && theLayerNumber == 2 ) &&
286  ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) );
287 
288  return isAProperPair;
289 
290 }
291 
292 bool
294  const TrackerRecHit& yetAnotherHit ) const {
295 
296  bool isAProperTriplet = false;
297 
298  unsigned int anotherSubDetId = anotherHit.subDetId();
299  unsigned int anotherLayerNumber = anotherHit.layerNumber();
300  unsigned int yetAnotherSubDetId = yetAnotherHit.subDetId();
301  unsigned int yetAnotherLayerNumber = yetAnotherHit.layerNumber();
302  isAProperTriplet =
303  // First hit on PXB1, second on PXB2
304  ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
305  ( anotherSubDetId == 1 && anotherLayerNumber == 2) && (
306  ( yetAnotherSubDetId == 1 && yetAnotherLayerNumber == 3) ||
307  ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 1) ||
308  ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ) ||
309  // First hit on PXB1, second on PXB3
310  ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
311  ( anotherSubDetId == 1 && anotherLayerNumber == 3) &&
312  ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ||
313  // First hit on PXB2, second on PXB3
314  ( ( theSubDetId == 1 && theLayerNumber == 2 ) &&
315  ( anotherSubDetId == 1 && anotherLayerNumber == 3) &&
316  ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ||
317  // First Hit on PXB1, second on PXD1
318  ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
319  ( anotherSubDetId == 2 && anotherLayerNumber == 1) && (
320  ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 2) ||
321  ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 1) ||
322  ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 2) ) ) ||
323  // First Hit on PXD1, second on PXD2
324  ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
325  ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) && (
326  ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 1 ) ||
327  ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 2 ) ) ) ||
328  // First hit on TIB1 (pixel less)
329  ( ( theSubDetId == 3 && theLayerNumber == 1 ) &&
330  ( anotherSubDetId == 3 && anotherLayerNumber == 2 ) &&
331  ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 3 ) );
332 
333  return isAProperTriplet;
334 
335 }
336 
337 
338 
339 
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:29
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:37
virtual const GeomDet * idToDet(DetId) const
unsigned int pxbLayer(const DetId &id) const
Definition: DetId.h:18
unsigned int layerNumber() const
The Layer Number.
Definition: TrackerRecHit.h:84
const GSSiTrackerRecHit2DLocalPos * hit() const
Definition: TrackerRecHit.h:76
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:81
tuple cout
Definition: gather_cfg.py:121
DetId geographicalId() const
unsigned int tecWheel(const DetId &id) const
unsigned int tobLayer(const DetId &id) const