CMS 3D CMS Logo

TTTrack.h
Go to the documentation of this file.
1 
13 #ifndef L1_TRACK_TRIGGER_TRACK_FORMAT_H
14 #define L1_TRACK_TRIGGER_TRACK_FORMAT_H
15 
21 
22 template< typename T >
23 class TTTrack
24 {
25  private:
27  std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > >
33  double theRInv4Par;
34  double theRInv5Par;
35  unsigned int theSector;
36  unsigned int theWedge;
39  double theChi24Par;
40  double theChi25Par;
43 
44  public:
46  TTTrack();
47  TTTrack( std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > aStubs );
48 
50  ~TTTrack();
51 
53  std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > getStubRefs() const { return theStubRefs; }
54  void addStubRef( edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > aStub ) { theStubRefs.push_back( aStub ); }
55  void setStubRefs( std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > aStubs ) { theStubRefs = aStubs; }
56 
58  GlobalVector getMomentum(unsigned int nPar=4) const;
59  void setMomentum( GlobalVector aMomentum, unsigned int nPar=5);
60 
62  double getRInv(unsigned int nPar=4) const;
63  void setRInv( double aRInv, unsigned int nPar=5 );
64 
66  GlobalPoint getPOCA(unsigned int nPar=4) const;
67  void setPOCA( GlobalPoint aPOCA, unsigned int nPar=5 );
68 
70  unsigned int getSector() const { return theSector; }
71  void setSector( unsigned int aSector ) { theSector = aSector; }
72  unsigned int getWedge() const { return theWedge; }
73  void setWedge( unsigned int aWedge ) { theWedge = aWedge; }
74 
76  double getChi2(unsigned int nPar=4) const;
77  double getChi2Red(unsigned int nPar=4) const;
78  void setChi2( double aChi2, unsigned int nPar=5 );
79 
81  double getStubPtConsistency(unsigned int nPar=4) const;
82  void setStubPtConsistency( double aPtConsistency, unsigned int nPar=5 );
83 
84  void setFitParNo( unsigned int aFitParNo ) { return; }
85 
86 /*
89  uint32_t getSuperStrip() const { return 0; }
90 */
92  bool isTheSameAs( TTTrack< T > aTrack ) const;
93 
95  bool hasStubInBarrel( unsigned int aLayer ) const;
96 
98  std::string print( unsigned int i = 0 ) const;
99 
100  private:
101 
102  bool checkValidArgs(unsigned int nPar) const;
103  bool checkValidArgsForSet(unsigned int nPar) const;
104 
105 
106 };
107 
115 template< typename T >
118 {
119  theStubRefs.clear();
120  theMomentum4Par = GlobalVector(0.0,0.0,0.0);
121  theMomentum5Par = GlobalVector(0.0,0.0,0.0);
122  theRInv4Par = 0.0;
123  theRInv5Par = 0.0;
124  thePOCA4Par = GlobalPoint(0.0,0.0,0.0);
125  thePOCA5Par = GlobalPoint(0.0,0.0,0.0);
126  theSector = 0;
127  theWedge = 0;
128  theChi24Par = 0.0;
129  theChi25Par = 0.0;
132  valid4ParFit = false;
133  valid5ParFit = false;
134 }
135 
137 template< typename T >
139 {
140  theStubRefs = aStubs;
141  theMomentum4Par = GlobalVector(0.0,0.0,0.0);
142  theMomentum5Par = GlobalVector(0.0,0.0,0.0);
143  theRInv4Par = 0.0;
144  theRInv5Par = 0.0;
145  thePOCA4Par = GlobalPoint(0.0,0.0,0.0);
146  thePOCA5Par = GlobalPoint(0.0,0.0,0.0);
147  theSector = 0;
148  theWedge = 0;
149  theChi24Par = 0.0;
150  theChi25Par = 0.0;
153  valid4ParFit = false;
154  valid5ParFit = false;
155 }
156 
158 template< typename T >
160 
161 template< typename T >
162 void TTTrack< T >::setMomentum( GlobalVector aMomentum, unsigned int nPar ) {
163 
164  if (!checkValidArgsForSet(nPar)) return;
165 
166  if (nPar==4) {
167  valid4ParFit = true;
168  theMomentum4Par=aMomentum;
169  }
170 
171  if (nPar==5) {
172  valid5ParFit = true;
173  theMomentum5Par=aMomentum;
174  }
175 
176  return;
177 
178 
179 }
180 
181 
182 template< typename T >
183 GlobalVector TTTrack< T >::getMomentum(unsigned int nPar) const{
184 
185  if (!checkValidArgs(nPar))
186  return GlobalVector(0.0,0.0,0.0);
187 
188  if (nPar==4) {
189  return theMomentum4Par;
190  }
191 
192  if (nPar==5) {
193  return theMomentum5Par;
194  }
195 
196  return GlobalVector(0.0,0.0,0.0);
197 
198 
199 }
200 
201 
202 template< typename T >
203 void TTTrack< T >::setRInv(double aRInv, unsigned int nPar) {
204 
205  if (!checkValidArgsForSet(nPar)) return;
206 
207  if (nPar==4) {
208  valid4ParFit = true;
209  theRInv4Par=aRInv;
210  }
211 
212  if (nPar==5) {
213  valid5ParFit = true;
214  theRInv5Par=aRInv;
215  }
216 
217  return;
218 
219 }
220 
221 
222 template< typename T >
223 double TTTrack< T >::getRInv(unsigned int nPar) const {
224 
225  if (!checkValidArgs(nPar)) return 0.0;
226 
227  if (nPar==4) {
228  return theRInv4Par;
229  }
230 
231  if (nPar==5) {
232  return theRInv5Par;
233  }
234 
235  return 0.0;
236 
237 }
238 
239 
240 template< typename T >
241 void TTTrack< T >::setPOCA(GlobalPoint aPOCA, unsigned int nPar){
242 
243  if (!checkValidArgsForSet(nPar)) return;
244 
245  if (nPar==4) {
246  valid4ParFit = true;
247  thePOCA4Par=aPOCA;
248  }
249 
250  if (nPar==5) {
251  valid5ParFit = true;
252  thePOCA5Par=aPOCA;
253  }
254 
255  return;
256 
257 }
258 
259 template< typename T >
260 GlobalPoint TTTrack< T >::getPOCA(unsigned int nPar) const
261 {
262 
263  if (!checkValidArgs(nPar)) return GlobalPoint(0.0,0.0,0.0);
264 
265  if (nPar==4) {
266  return thePOCA4Par;
267  }
268 
269  if (nPar==5) {
270  return thePOCA5Par;
271  }
272 
273  return GlobalPoint(0.0,0.0,0.0);
274 
275 }
276 
278 template< typename T >
279 void TTTrack< T >::setChi2(double aChi2, unsigned int nPar) {
280 
281  if (!checkValidArgsForSet(nPar)) return;
282 
283  if (nPar==4) {
284  valid4ParFit = true;
285  theChi24Par=aChi2;
286  }
287 
288  if (nPar==5) {
289  valid5ParFit = true;
290  theChi25Par=aChi2;
291  }
292 
293  return;
294 
295 }
296 
297 
298 
300 template< typename T >
301 double TTTrack< T >::getChi2(unsigned int nPar) const
302 {
303 
304  if (!checkValidArgs(nPar)) return 0.0;
305 
306  if (nPar==4) {
307  return theChi24Par;
308  }
309 
310  if (nPar==5) {
311  return theChi25Par;
312  }
313 
314  return 0.0;
315 
316 }
317 
318 
319 
321 template< typename T >
322 double TTTrack< T >::getChi2Red(unsigned int nPar) const
323 {
324 
325  if (!checkValidArgs(nPar)) return 0.0;
326 
327  if (nPar==4) {
328  return theChi24Par/( 2*theStubRefs.size() - 4 );
329  }
330 
331  if (nPar==5) {
332  return theChi25Par/( 2*theStubRefs.size() - 5 );
333  }
334 
335  return 0.0;
336 
337 }
338 
339 
341 template< typename T >
342 void TTTrack< T >::setStubPtConsistency(double aStubPtConsistency, unsigned int nPar) {
343 
344  if (!checkValidArgsForSet(nPar)) return;
345 
346  if (nPar==4) {
347  valid4ParFit = true;
348  theStubPtConsistency4Par=aStubPtConsistency;
349  }
350 
351  if (nPar==5) {
352  valid5ParFit = true;
353  theStubPtConsistency5Par=aStubPtConsistency;
354  }
355 
356  return;
357 
358 }
359 
360 
361 
363 template< typename T >
364 double TTTrack< T >::getStubPtConsistency(unsigned int nPar) const
365 {
366 
367  if (!checkValidArgs(nPar)) return 0.0;
368 
369  if (nPar==4) {
371  }
372 
373  if (nPar==5) {
375  }
376 
377  return 0.0;
378 
379 }
380 
381 
382 
383 
384 
386 template< typename T>
388 {
390  std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > otherStubRefs = aTrack.getStubRefs();
391 
393  unsigned int nShared = 0;
394  for ( unsigned int i = 0; i < theStubRefs.size() && nShared < 2; i++)
395  {
396  for ( unsigned int j = 0; j < otherStubRefs.size() && nShared < 2; j++)
397  {
398  if ( theStubRefs.at(i) == otherStubRefs.at(j) )
399  {
400  nShared++;
401  }
402  }
403  }
404 
406  return ( nShared > 1 );
407 }
408 
410 template< typename T >
411 bool TTTrack< T >::hasStubInBarrel( unsigned int aLayer ) const
412 {
413  for ( unsigned int i = 0; i < theStubRefs.size(); i++)
414  {
415  DetId detid = theStubRefs.at(i)->getDetId();
416  if ( detid.subdetId()==StripSubdetector::TOB )
417  {
418  return true;
419  }
420  }
421 
422  return false;
423 }
424 
425 
427 template< typename T >
428 std::string TTTrack< T >::print( unsigned int i ) const
429 {
430  std::string padding("");
431  for ( unsigned int j = 0; j != i; ++j )
432  {
433  padding+="\t";
434  }
435 
436  std::stringstream output;
437  output<<padding<<"TTTrack:\n";
438  padding+='\t';
439  output << '\n';
440  unsigned int iStub = 0;
441 
442  typename std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > >::const_iterator stubIter;
443  for ( stubIter = theStubRefs.begin();
444  stubIter!= theStubRefs.end();
445  ++stubIter )
446  {
447  output << padding << "stub: " << iStub++ << ", DetId: " << ((*stubIter)->getDetId()).rawId() << '\n';
448  }
449 
450  return output.str();
451 }
452 
453 
454 template< typename T >
455 bool TTTrack< T >::checkValidArgs(unsigned int nPar) const {
456 
457  if (!(nPar==4||nPar==5)) {
458  edm::LogError("TTTrack") << " A getter method was called with nPar = "<< nPar <<
459  " but only authorized values are 4 and 5" << std::endl;
460  return false;
461  }
462 
463  if ((nPar==4)&&!valid4ParFit) {
464  edm::LogError("TTTrack") << " You try to get info with nPar="<<nPar<<" but no valid 4 parameter fit info is present, use 5 instead"<<std::endl;
465  return false;
466  }
467 
468  if ((nPar==5)&&!valid5ParFit) {
469  edm::LogError("TTTrack") << " You try to get info with nPar="<<nPar<<" but no valid 5 parameter fit info is present, use 4 instead"<<std::endl;
470  return false;
471  }
472 
473  return true;
474 
475 }
476 template< typename T >
477 bool TTTrack< T >::checkValidArgsForSet(unsigned int nPar) const {
478 
479  if (!(nPar==4||nPar==5)) {
480  edm::LogError("TTTrack") << " A setter method is called with nPar="<<nPar<< " only possible values are 4/5" << std::endl;
481  return false;
482  }
483 
484  return true;
485 
486 }
487 
488 template< typename T >
489 std::ostream& operator << ( std::ostream& os, const TTTrack< T >& aTTTrack ) { return ( os << aTTTrack.print() ); }
490 
491 
492 #endif
GlobalPoint thePOCA4Par
Definition: TTTrack.h:31
void setChi2(double aChi2, unsigned int nPar=5)
Chi2.
Definition: TTTrack.h:279
GlobalPoint getPOCA(unsigned int nPar=4) const
POCA.
Definition: TTTrack.h:260
std::string print(unsigned int i=0) const
Information.
Definition: TTTrack.h:428
double getChi2(unsigned int nPar=4) const
Chi2.
Definition: TTTrack.h:301
GlobalVector getMomentum(unsigned int nPar=4) const
Track momentum.
Definition: TTTrack.h:183
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
bool hasStubInBarrel(unsigned int aLayer) const
Additional quality criteria.
Definition: TTTrack.h:411
GlobalVector theMomentum5Par
Definition: TTTrack.h:30
~TTTrack()
Destructor.
Definition: TTTrack.h:159
void setPOCA(GlobalPoint aPOCA, unsigned int nPar=5)
Definition: TTTrack.h:241
double theChi24Par
Definition: TTTrack.h:39
TTTrack()
Constructors.
Definition: TTTrack.h:117
void setRInv(double aRInv, unsigned int nPar=5)
Definition: TTTrack.h:203
bool valid5ParFit
Definition: TTTrack.h:42
GlobalVector theMomentum4Par
Definition: TTTrack.h:29
unsigned int getSector() const
Sector.
Definition: TTTrack.h:70
void setFitParNo(unsigned int aFitParNo)
Definition: TTTrack.h:84
unsigned int getWedge() const
Definition: TTTrack.h:72
bool isTheSameAs(TTTrack< T > aTrack) const
Duplicate identification.
Definition: TTTrack.h:387
double theStubPtConsistency4Par
Definition: TTTrack.h:37
double theRInv5Par
Definition: TTTrack.h:34
std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > theStubRefs
Data members.
Definition: TTTrack.h:28
unsigned int theWedge
Definition: TTTrack.h:36
double getRInv(unsigned int nPar=4) const
Track curvature.
Definition: TTTrack.h:223
void setMomentum(GlobalVector aMomentum, unsigned int nPar=5)
Definition: TTTrack.h:162
double theChi25Par
Definition: TTTrack.h:40
bool valid4ParFit
Definition: TTTrack.h:41
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
double getStubPtConsistency(unsigned int nPar=4) const
Stub Pt consistency.
Definition: TTTrack.h:364
double theStubPtConsistency5Par
Definition: TTTrack.h:38
void addStubRef(edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > aStub)
Definition: TTTrack.h:54
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
void setStubPtConsistency(double aPtConsistency, unsigned int nPar=5)
StubPtConsistency.
Definition: TTTrack.h:342
bool checkValidArgsForSet(unsigned int nPar) const
Definition: TTTrack.h:477
Definition: DetId.h:18
void setStubRefs(std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > aStubs)
Definition: TTTrack.h:55
std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > getStubRefs() const
Track components.
Definition: TTTrack.h:53
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:23
void setWedge(unsigned int aWedge)
Definition: TTTrack.h:73
unsigned int theSector
Definition: TTTrack.h:35
bool checkValidArgs(unsigned int nPar) const
Definition: TTTrack.h:455
double theRInv4Par
Definition: TTTrack.h:33
void setSector(unsigned int aSector)
Definition: TTTrack.h:71
GlobalPoint thePOCA5Par
Definition: TTTrack.h:32
Global3DVector GlobalVector
Definition: GlobalVector.h:10
double getChi2Red(unsigned int nPar=4) const
Chi2 reduced.
Definition: TTTrack.h:322