CMS 3D CMS Logo

ConverterToTTTrack.cc
Go to the documentation of this file.
3 
4 using namespace std;
5 
6 namespace tmtt {
7 
8  //=== Convert L1fittedTrack or L1track3D (track candidates after/before fit) to TTTrack format.
9 
10  TTTrack<Ref_Phase2TrackerDigi_> ConverterToTTTrack::makeTTTrack(const L1trackBase* trk,
11  unsigned int iPhiSec,
12  unsigned int iEtaReg) const {
13  unsigned int nPar, hitPattern;
14  double d0, z0, tanL, chi2rphi, chi2rz;
15 
16  const L1fittedTrack* fitTrk = dynamic_cast<const L1fittedTrack*>(trk);
17 
18  // Handle variables that differ for L1fittedTrack & L1track3D
19  if (fitTrk == nullptr) {
20  // This is an L1track3D type (track before fit)
21  nPar = 4; // Before fit, TMTT algorithm assumes 4 helix params
22  // Set to zero variables that are unavailable for this track type.
23  hitPattern = 0;
24  d0 = 0.;
25  z0 = 0;
26  tanL = 0;
27  chi2rphi = 0.;
28  chi2rz = 0;
29  } else {
30  // This is an L1fittedTrack type (track after fit)
31  if (not fitTrk->accepted())
32  throw cms::Exception("LogicError") << "ConverterToTTTrack ERROR: requested to convert invalid L1fittedTrack";
33  nPar = fitTrk->nHelixParam(); // Number of helix parameters in track fit
34  hitPattern = fitTrk->hitPattern();
35  d0 = fitTrk->d0();
36  z0 = fitTrk->z0();
37  tanL = fitTrk->tanLambda();
38  chi2rphi = fitTrk->chi2rphi();
39  chi2rz = fitTrk->chi2rz();
40  }
41 
42  const double& rinv = invPtToInvR_ * trk->qOverPt();
43  const double& phi0 = trk->phi0();
44  constexpr double mva = -1.; // MVA quality flags not yet set.
45  const double& magneticField = settings_->magneticField();
46 
48  rinv, phi0, tanL, z0, d0, chi2rphi, chi2rz, mva, mva, mva, hitPattern, nPar, magneticField);
49 
50  // Set references to stubs on this track.
51  std::vector<TTStubRef> ttstubrefs = this->stubRefs(trk);
52  track.setStubRefs(ttstubrefs);
53 
54  // Note which (eta,phi) sector this track was reconstructed in.
55  track.setPhiSector(iPhiSec);
56  track.setEtaSector(iEtaReg);
57 
58  track.setStubPtConsistency(-1); // not yet filled.
59 
60  return track;
61  }
62 
63  //=== Get references to stubs on track. (Works for either L1track3D or L1fittedTrack).
64 
65  std::vector<TTStubRef> ConverterToTTTrack::stubRefs(const L1trackBase* trk) const {
66  std::vector<TTStubRef> ttstubrefs;
67  const std::vector<Stub*>& stubs = trk->stubs();
68  for (Stub* s : stubs) {
69  const TTStubRef& ref = s->ttStubRef();
70  ttstubrefs.push_back(ref);
71  }
72  return ttstubrefs;
73  }
74 
75 } // namespace tmtt
float d0() const
virtual const std::vector< Stub * > & stubs() const =0
float tanLambda() const
virtual float phi0() const =0
float chi2rphi() const
virtual float qOverPt() const =0
float nHelixParam() const
static constexpr float d0
=== This is the base class for the linearised chi-squared track fit algorithms.
Definition: Array2D.h:16
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:49
float chi2rz() const
bool accepted() const
unsigned int hitPattern() const
float z0() const