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 
23 
24 template <typename T>
25 class TTTrack : public TTTrack_TrackWord {
26 private:
28  std::vector<edm::Ref<edmNew::DetSetVector<TTStub<T> >, TTStub<T> > > theStubRefs;
31  double theRInv;
32  double thePhi;
33  double theTanL;
34  double theEta;
35  double theD0;
36  double theZ0;
37  unsigned int thePhiSector;
39  double theChi2;
40  unsigned int NumFitPars;
41  unsigned int theHitPattern;
42  float an_MVA_Value;
45  double theBField; // needed for unpacking
46  static constexpr unsigned int Npars4 = 4;
47  static constexpr unsigned int Npars5 = 5;
48  static constexpr float MagConstant = 0.3;
49 
50 public:
52  TTTrack();
53  TTTrack(std::vector<edm::Ref<edmNew::DetSetVector<TTStub<T> >, TTStub<T> > > aStubs);
54 
55  TTTrack(double aRinv,
56  double aphi,
57  double aeta,
58  double az0,
59  double ad0,
60  double aChi2,
61  unsigned int aHitpattern,
62  unsigned int nPar,
63  double Bfield);
64 
66  ~TTTrack();
67 
69  std::vector<edm::Ref<edmNew::DetSetVector<TTStub<T> >, TTStub<T> > > getStubRefs() const { return theStubRefs; }
70  void addStubRef(edm::Ref<edmNew::DetSetVector<TTStub<T> >, TTStub<T> > aStub) { theStubRefs.push_back(aStub); }
71  void setStubRefs(std::vector<edm::Ref<edmNew::DetSetVector<TTStub<T> >, TTStub<T> > > aStubs) {
72  theStubRefs = aStubs;
73  }
74 
76  GlobalVector momentum() const;
77  GlobalVector getMomentum(unsigned int npar = Npars4) const;
78 
80  double rInv() const;
81  double getRInv(unsigned int npar = Npars4) const;
82 
84  double phi() const;
85 
87  double tanL() const;
88 
90  double d0() const;
91 
93  double z0() const;
94 
96  double eta() const;
97 
99  GlobalPoint POCA() const;
100  GlobalPoint getPOCA(unsigned int npar = Npars4) const;
101 
103  unsigned int PhiSector() const { return thePhiSector; }
104  unsigned int getSector() const { return thePhiSector; }
105  void setPhiSector(unsigned int aSector) { thePhiSector = aSector; }
106 
108  unsigned int TrackSeed() const { return theTrackSeed; }
109  void setTrackSeed(int aSeed) { theTrackSeed = aSeed; }
110 
112  double chi2() const;
113  double chi2Red() const;
114  double getChi2(unsigned int npar = 4) const;
115  double getChi2Red(unsigned int npar = 4) const;
116 
118  double getStubPtConsistency(unsigned int npar = 4) const;
119  void setStubPtConsistency(double aPtConsistency);
120 
121  void setFitParNo(unsigned int aFitParNo);
122 
123  void setTrackWordBits();
124  void testTrackWordBits();
125 
127  std::string print(unsigned int i = 0) const;
128 
129 };
130 
138 template <typename T>
141  theStubRefs.clear();
142  theMomentum = GlobalVector(0.0, 0.0, 0.0);
143  theRInv = 0.0;
144  thePOCA = GlobalPoint(0.0, 0.0, 0.0);
145  thePhiSector = 0;
146  theTrackSeed = 0;
147  theChi2 = 0.0;
148  theStubPtConsistency = 0.0;
149  NumFitPars = 0;
150 }
151 
153 template <typename T>
155  theStubRefs = aStubs;
156  theMomentum = GlobalVector(0.0, 0.0, 0.0);
157  theRInv = 0.0;
158  thePOCA = GlobalPoint(0.0, 0.0, 0.0);
159  thePhiSector = 0;
160  theTrackSeed = 0;
161  theChi2 = 0.0;
162  theStubPtConsistency = 0.0;
163  NumFitPars = 0;
164 }
165 
167 template <typename T>
168 TTTrack<T>::TTTrack(double aRinv,
169  double aphi,
170  double aeta,
171  double az0,
172  double ad0,
173  double aChi2,
174  unsigned int aHitPattern,
175  unsigned int nPar,
176  double aBfield) {
177  theStubRefs.clear();
178  double thePT = MagConstant * aRinv * aBfield;
179  theMomentum = GlobalVector(GlobalVector::Cylindrical(thePT, aphi, thePT * sinh(aeta)));
180  theRInv = aRinv;
181  thePOCA = GlobalPoint(ad0 * cos(aphi), ad0 * sin(aphi), az0);
182  thePhiSector = 0; // must be set externally
183  theTrackSeed = 0; // must be set externally
184  theChi2 = aChi2;
185  theStubPtConsistency = 0.0; // must be set externally
186  NumFitPars = nPar;
187  theHitPattern = aHitPattern;
188  theBField = aBfield;
189  // should probably fill the momentum vectur
190 }
191 
193 template <typename T>
195 
196 template <typename T>
197 void TTTrack<T>::setFitParNo(unsigned int nPar) {
198  NumFitPars = nPar;
199 
200  return;
201 }
202 
203 // Note that these calls return the floating point values. If a TTTrack is made with only ditized values,
204 // the unpacked values must come from the TTTrack_Trackword member functions.
205 
206 template <typename T>
208  if (NumFitPars == Npars5 || NumFitPars == Npars4) {
209  return theMomentum;
210  } else
211  return GlobalVector(0.0, 0.0, 0.0);
212 }
213 
214 template <typename T>
215 GlobalVector TTTrack<T>::getMomentum(unsigned int npar) const {
216  return momentum();
217 }
218 
219 template <typename T>
220 double TTTrack<T>::rInv() const {
221  if (NumFitPars == Npars5 || NumFitPars == Npars4) {
222  return theRInv;
223  } else
224  return 0.0;
225 }
226 
227 template <typename T>
228 double TTTrack<T>::getRInv(unsigned int npar) const { //backwards compatibility
229 
230  return rInv();
231 }
232 
233 template <typename T>
234 double TTTrack<T>::tanL() const {
235  if (NumFitPars == Npars5 || NumFitPars == Npars4) {
236  return theTanL;
237  } else
238  return 0.0;
239 }
240 
241 template <typename T>
242 double TTTrack<T>::eta() const {
243  if (NumFitPars == Npars5 || NumFitPars == Npars4) {
244  return theEta;
245  } else
246  return 0.0;
247 }
248 
249 template <typename T>
250 double TTTrack<T>::phi() const {
251  if (NumFitPars == Npars5 || NumFitPars == Npars4) {
252  return thePhi;
253  } else
254  return 0.0;
255 }
256 
257 template <typename T>
258 double TTTrack<T>::d0() const {
259  if (NumFitPars == Npars5 || NumFitPars == Npars4) {
260  return theD0;
261  } else
262  return 0.0;
263 }
264 
265 template <typename T>
266 double TTTrack<T>::z0() const {
267  if (NumFitPars == Npars5 || NumFitPars == Npars4) {
268  return theZ0;
269  } else
270  return 0.0;
271 }
272 
273 template <typename T>
275  if (NumFitPars == Npars5 || NumFitPars == Npars4) {
276  return thePOCA;
277  } else
278  return GlobalPoint(0.0, 0.0, 0.0);
279 }
280 
281 template <typename T>
282 GlobalPoint TTTrack<T>::getPOCA(unsigned int npar) const //backwards compatibility
283 {
284  return POCA();
285 }
286 
288 template <typename T>
289 double TTTrack<T>::chi2() const {
290  if (NumFitPars == Npars5 || NumFitPars == Npars4) {
291  return theChi2;
292  } else
293  return 0.0;
294 }
295 
296 template <typename T>
297 double TTTrack<T>::getChi2(unsigned int npar) const //backwards compatibility
298 {
299  return chi2();
300 }
301 
303 template <typename T>
304 double TTTrack<T>::chi2Red() const {
305  if (NumFitPars == Npars5 || NumFitPars == Npars4) {
306  return theChi2 / (2 * theStubRefs.size() - NumFitPars);
307  } else
308  return 0.0;
309 }
310 
311 template <typename T>
312 double TTTrack<T>::getChi2Red(unsigned int npar) const //backwards compatibility
313 {
314  return chi2Red();
315 }
316 
318 template <typename T>
319 void TTTrack<T>::setStubPtConsistency(double aStubPtConsistency) {
320  theStubPtConsistency = aStubPtConsistency;
321 
322  return;
323 }
324 
326 template <typename T>
327 double TTTrack<T>::getStubPtConsistency(unsigned int npar) const {
328  if (NumFitPars == Npars5 || NumFitPars == Npars4) {
329  return theStubPtConsistency;
330  } else
331  return 0.0;
332 }
333 
335 template <typename T>
337  if (!(NumFitPars == Npars4 || NumFitPars == Npars5)) {
338  edm::LogError("TTTrack") << " setTrackWordBits method is called with NumFitPars=" << NumFitPars
339  << " only possible values are 4/5" << std::endl;
340  return;
341  }
342 
343  unsigned int sparebits = 0;
344 
345  // missing conversion of global phi to difference from sector center phi
346 
348 
349  return;
350 }
351 
353 template <typename T>
355  // float rPhi = theMomentum.phi(); // this needs to be phi relative to center of sector ****
356  //float rEta = theMomentum.eta();
357  //float rZ0 = thePOCA.z();
358  //float rD0 = thePOCA.perp();
359 
360  //this is meant for debugging only.
361 
362  //std::cout << " phi " << rPhi << " " << get_iphi() << std::endl;
363  //std::cout << " eta " << rEta << " " << get_ieta() << std::endl;
364  //std::cout << " Z0 " << rZ0 << " " << get_iz0() << std::endl;
365  //std::cout << " D0 " << rD0 << " " << get_id0() << std::endl;
366  //std::cout << " Rinv " << theRInv << " " << get_iRinv() << std::endl;
367  //std::cout << " chi2 " << theChi2 << " " << get_ichi2() << std::endl;
368 
369  return;
370 }
371 
373 template <typename T>
374 std::string TTTrack<T>::print(unsigned int i) const {
375  std::string padding("");
376  for (unsigned int j = 0; j != i; ++j) {
377  padding += "\t";
378  }
379 
380  std::stringstream output;
381  output << padding << "TTTrack:\n";
382  padding += '\t';
383  output << '\n';
384  unsigned int iStub = 0;
385 
386  typename std::vector<edm::Ref<edmNew::DetSetVector<TTStub<T> >, TTStub<T> > >::const_iterator stubIter;
387  for (stubIter = theStubRefs.begin(); stubIter != theStubRefs.end(); ++stubIter) {
388  output << padding << "stub: " << iStub++ << ", DetId: " << ((*stubIter)->getDetId()).rawId() << '\n';
389  }
390 
391  return output.str();
392 }
393 
394 template <typename T>
395 std::ostream& operator<<(std::ostream& os, const TTTrack<T>& aTTTrack) {
396  return (os << aTTTrack.print());
397 }
398 
399 #endif
double getRInv(unsigned int npar=Npars4) const
Definition: TTTrack.h:228
void setTrackSeed(int aSeed)
Definition: TTTrack.h:109
std::string print(unsigned int i=0) const
Information.
Definition: TTTrack.h:374
double theRInv
Definition: TTTrack.h:31
GlobalVector momentum() const
Track momentum.
Definition: TTTrack.h:207
double getStubPtConsistency(unsigned int npar=4) const
Stub Pt consistency.
Definition: TTTrack.h:327
GlobalVector getMomentum(unsigned int npar=Npars4) const
Definition: TTTrack.h:215
void testTrackWordBits()
Test bits in 96-bit Track word.
Definition: TTTrack.h:354
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > getStubRefs() const
Track components.
Definition: TTTrack.h:69
GlobalPoint POCA() const
POCA.
Definition: TTTrack.h:274
static float MagConstant
Definition: TTTrack.h:48
double theZ0
Definition: TTTrack.h:36
static unsigned int Npars5
Definition: TTTrack.h:47
~TTTrack()
Destructor.
Definition: TTTrack.h:194
std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > theStubRefs
Data members.
Definition: TTTrack.h:28
double eta() const
Track eta.
Definition: TTTrack.h:242
TTTrack()
Constructors.
Definition: TTTrack.h:140
unsigned int PhiSector() const
Phi Sector.
Definition: TTTrack.h:103
unsigned int getSector() const
Definition: TTTrack.h:104
void setFitParNo(unsigned int aFitParNo)
Definition: TTTrack.h:197
double phi() const
Track phi.
Definition: TTTrack.h:250
GlobalVector theMomentum
Definition: TTTrack.h:29
double theD0
Definition: TTTrack.h:35
int theTrackSeed
Definition: TTTrack.h:44
double rInv() const
Track curvature.
Definition: TTTrack.h:220
void setTrackWord(const GlobalVector &Momentum, const GlobalPoint &POCA, double theRinv, double theChi2, double theBendChi2, unsigned int theHitPattern, unsigned int iSpare)
static unsigned int Npars4
Definition: TTTrack.h:46
unsigned int TrackSeed() const
Track seeding (for debugging)
Definition: TTTrack.h:108
double theTanL
Definition: TTTrack.h:33
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
unsigned int thePhiSector
Definition: TTTrack.h:37
unsigned int theHitPattern
Definition: TTTrack.h:41
float an_MVA_Value
Definition: TTTrack.h:42
double z0() const
Track z0.
Definition: TTTrack.h:266
double thePhi
Definition: TTTrack.h:32
void addStubRef(edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > aStub)
Definition: TTTrack.h:70
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
void setStubPtConsistency(double aPtConsistency)
StubPtConsistency.
Definition: TTTrack.h:319
void setStubRefs(std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > aStubs)
Definition: TTTrack.h:71
double chi2Red() const
Chi2 reduced.
Definition: TTTrack.h:304
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:25
void setPhiSector(unsigned int aSector)
Definition: TTTrack.h:105
double getChi2Red(unsigned int npar=4) const
Definition: TTTrack.h:312
float another_MVA_Value
Definition: TTTrack.h:43
double theStubPtConsistency
Definition: TTTrack.h:38
double chi2() const
Chi2.
Definition: TTTrack.h:289
double tanL() const
Track tanL.
Definition: TTTrack.h:234
double theBField
Definition: TTTrack.h:45
double theEta
Definition: TTTrack.h:34
double getChi2(unsigned int npar=4) const
Definition: TTTrack.h:297
GlobalPoint getPOCA(unsigned int npar=Npars4) const
Definition: TTTrack.h:282
double theChi2
Definition: TTTrack.h:39
double d0() const
Track d0.
Definition: TTTrack.h:258
unsigned int NumFitPars
Definition: TTTrack.h:40
GlobalPoint thePOCA
Definition: TTTrack.h:30
void setTrackWordBits()
Set bits in 96-bit Track word.
Definition: TTTrack.h:336
#define constexpr
Global3DVector GlobalVector
Definition: GlobalVector.h:10