CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
tmtt::KalmanState Class Reference

#include <KalmanState.h>

Public Member Functions

bool barrel () const
 
const L1track3Dcandidate () const
 
double chi2 () const
 
double chi2rphi () const
 
double chi2rz () const
 
double chi2scaled () const
 
bool good (const TP *tp) const
 
unsigned int hitPattern () const
 
 KalmanState (const Settings *settings, const L1track3D &candidate, unsigned nSkipped, int kLayer, const KalmanState *last_state, const TVectorD &vecX, const TMatrixD &matC, const TMatrixD &matK, const TMatrixD &matV, Stub *stub, double chi2rphi, double chi2rz)
 
const KalmanStatelast_state () const
 
const KalmanStatelast_update_state () const
 
int layer () const
 
const TMatrixD & matrixC () const
 
const TMatrixD & matrixK () const
 
const TMatrixD & matrixV () const
 
unsigned nextLayer () const
 
unsigned nSkippedLayers () const
 
unsigned nStubLayers () const
 
double r () const
 
double reducedChi2 () const
 
void setChi2 (double chi2rphi, double chi2rz)
 
const Settingssettings () const
 
Stubstub () const
 
std::vector< Stub * > stubs () const
 
const TVectorD & vectorX () const
 
double z () const
 

Private Attributes

bool barrel_
 
double chi2rphi_
 
double chi2rz_
 
unsigned int hitPattern_
 
unsigned int kalmanChi2RphiScale_
 
int kLayer_
 
L1track3D l1track3D_
 
const KalmanStatelast_state_
 
TMatrixD matC_
 
TMatrixD matK_
 
TMatrixD matV_
 
unsigned n_stubs_
 
unsigned nSkipped_
 
double r_
 
const Settingssettings_
 
Stubstub_
 
TVectorD vecX_
 
double z_
 

Detailed Description

Definition at line 22 of file KalmanState.h.

Constructor & Destructor Documentation

◆ KalmanState()

KalmanState::KalmanState ( const Settings settings,
const L1track3D candidate,
unsigned  nSkipped,
int  kLayer,
const KalmanState last_state,
const TVectorD &  vecX,
const TMatrixD &  matC,
const TMatrixD &  matK,
const TMatrixD &  matV,
Stub stub,
double  chi2rphi,
double  chi2rz 
)

Definition at line 9 of file KalmanState.cc.

References tmtt::Stub::barrel(), barrel_, hitPattern(), hitPattern_, tmtt::Settings::kalmanChi2RphiScale(), kalmanChi2RphiScale_, kLayer_, last_state(), matC_, matK_, matV_, n_stubs_, nSkipped_, tmtt::Stub::r(), r_, settings_, stub(), tmtt::Stub::z(), and z_.

22  kLayer_(kLayer),
24  vecX_(vecX),
25  stub_(stub),
27  chi2rz_(chi2rz),
28  nSkipped_(nSkipped),
30  matC_.Clear();
31  matC_.ResizeTo(matC.GetNrows(), matC.GetNcols());
32  matC_ = matC;
33  matK_.ResizeTo(matK.GetNrows(), matK.GetNcols());
34  matK_ = matK;
35  matV_.ResizeTo(matV.GetNrows(), matV.GetNcols());
36  matV_ = matV;
38 
39  hitPattern_ = 0;
40  if (last_state != nullptr)
41  hitPattern_ = last_state->hitPattern(); // Bit encoded list of hit layers
42  if (stub != nullptr && kLayer_ >= 0)
43  hitPattern_ |= (1 << (kLayer_));
44 
45  r_ = 0.1;
46  z_ = 0;
47  barrel_ = true;
48 
49  if (stub != nullptr) {
50  r_ = stub->r();
51  z_ = stub->z();
52  barrel_ = stub->barrel();
53  }
54 
55  n_stubs_ = 1 + kLayer_ - nSkipped_;
56  }
float r() const
Definition: Stub.h:108
const Settings * settings() const
Definition: KalmanState.h:37
const KalmanState * last_state() const
Definition: KalmanState.h:47
double chi2rz() const
Definition: KalmanState.h:64
Stub * stub() const
Definition: KalmanState.h:57
float z() const
Definition: Stub.h:109
const KalmanState * last_state_
Definition: KalmanState.h:83
const Settings * settings_
Definition: KalmanState.h:79
unsigned nSkipped_
Definition: KalmanState.h:94
unsigned int kalmanChi2RphiScale_
Definition: KalmanState.h:91
static const std::string kLayer("layer")
bool barrel() const
Definition: Stub.h:201
L1track3D l1track3D_
Definition: KalmanState.h:95
unsigned int hitPattern_
Definition: KalmanState.h:96
double chi2rphi() const
Definition: KalmanState.h:63
unsigned n_stubs_
Definition: KalmanState.h:92
const L1track3D & candidate() const
Definition: KalmanState.h:59
unsigned int kalmanChi2RphiScale() const
Definition: Settings.h:326
unsigned int hitPattern() const
Definition: KalmanState.h:66

Member Function Documentation

◆ barrel()

bool tmtt::KalmanState::barrel ( ) const
inline

Definition at line 42 of file KalmanState.h.

References barrel_.

42 { return barrel_; }

◆ candidate()

const L1track3D& tmtt::KalmanState::candidate ( ) const
inline

Definition at line 59 of file KalmanState.h.

References l1track3D_.

59 { return l1track3D_; }
L1track3D l1track3D_
Definition: KalmanState.h:95

◆ chi2()

double tmtt::KalmanState::chi2 ( void  ) const
inline

Definition at line 61 of file KalmanState.h.

References chi2rphi_, and chi2rz_.

Referenced by reducedChi2().

61 { return chi2rphi_ + chi2rz_; }

◆ chi2rphi()

double tmtt::KalmanState::chi2rphi ( ) const
inline

Definition at line 63 of file KalmanState.h.

References chi2rphi_.

Referenced by setChi2().

63 { return chi2rphi_; }

◆ chi2rz()

double tmtt::KalmanState::chi2rz ( ) const
inline

Definition at line 64 of file KalmanState.h.

References chi2rz_.

Referenced by setChi2().

64 { return chi2rz_; }

◆ chi2scaled()

double tmtt::KalmanState::chi2scaled ( ) const
inline

Definition at line 62 of file KalmanState.h.

References chi2rphi_, chi2rz_, and kalmanChi2RphiScale_.

62 { return chi2rphi_ / kalmanChi2RphiScale_ + chi2rz_; } // Improves electron performance.
unsigned int kalmanChi2RphiScale_
Definition: KalmanState.h:91

◆ good()

bool tmtt::KalmanState::good ( const TP tp) const

Definition at line 58 of file KalmanState.cc.

References tmtt::Stub::assocTPs(), stub(), and cmsswSequenceInfo::tp.

58  {
59  const KalmanState *state = this;
60  while (state) {
61  Stub *stub = state->stub();
62  if (stub != nullptr) {
63  const set<const TP *> &tps = stub->assocTPs();
64  if (tps.find(tp) == tps.end())
65  return false;
66  }
67  state = state->last_state();
68  }
69  return true;
70  }
Stub * stub() const
Definition: KalmanState.h:57
const std::set< const TP * > & assocTPs() const
Definition: Stub.h:164
KalmanState(const Settings *settings, const L1track3D &candidate, unsigned nSkipped, int kLayer, const KalmanState *last_state, const TVectorD &vecX, const TMatrixD &matC, const TMatrixD &matK, const TMatrixD &matV, Stub *stub, double chi2rphi, double chi2rz)
Definition: KalmanState.cc:9

◆ hitPattern()

unsigned int tmtt::KalmanState::hitPattern ( ) const
inline

Definition at line 66 of file KalmanState.h.

References hitPattern_.

Referenced by tmtt::KFbase::doKF(), and KalmanState().

66 { return hitPattern_; } // Bit-encoded KF layers the fitted track has stubs in.
unsigned int hitPattern_
Definition: KalmanState.h:96

◆ last_state()

const KalmanState* tmtt::KalmanState::last_state ( ) const
inline

Definition at line 47 of file KalmanState.h.

References last_state_.

Referenced by KalmanState().

47 { return last_state_; }
const KalmanState * last_state_
Definition: KalmanState.h:83

◆ last_update_state()

const KalmanState * tmtt::KalmanState::last_update_state ( ) const

Definition at line 79 of file KalmanState.cc.

79  {
80  const KalmanState *state = this;
81  while (state) {
82  if (state->stub() != nullptr)
83  return state;
84  state = state->last_state();
85  }
86  return nullptr;
87  }
KalmanState(const Settings *settings, const L1track3D &candidate, unsigned nSkipped, int kLayer, const KalmanState *last_state, const TVectorD &vecX, const TMatrixD &matC, const TMatrixD &matK, const TMatrixD &matV, Stub *stub, double chi2rphi, double chi2rz)
Definition: KalmanState.cc:9

◆ layer()

int tmtt::KalmanState::layer ( ) const
inline

Definition at line 41 of file KalmanState.h.

References kLayer_.

Referenced by geometryXMLparser.DTAlignable::index(), and geometryXMLparser.CSCAlignable::index().

41 { return kLayer_; }

◆ matrixC()

const TMatrixD& tmtt::KalmanState::matrixC ( ) const
inline

Definition at line 51 of file KalmanState.h.

References matC_.

51 { return matC_; }

◆ matrixK()

const TMatrixD& tmtt::KalmanState::matrixK ( ) const
inline

Definition at line 53 of file KalmanState.h.

References matK_.

53 { return matK_; }

◆ matrixV()

const TMatrixD& tmtt::KalmanState::matrixV ( ) const
inline

Definition at line 55 of file KalmanState.h.

References matV_.

55 { return matV_; }

◆ nextLayer()

unsigned tmtt::KalmanState::nextLayer ( ) const
inline

Definition at line 39 of file KalmanState.h.

References kLayer_.

Referenced by tmtt::KFbase::doKF().

39 { return (1 + kLayer_); }

◆ nSkippedLayers()

unsigned tmtt::KalmanState::nSkippedLayers ( ) const
inline

Definition at line 43 of file KalmanState.h.

References nSkipped_.

Referenced by tmtt::KFbase::doKF().

43 { return nSkipped_; }
unsigned nSkipped_
Definition: KalmanState.h:94

◆ nStubLayers()

unsigned tmtt::KalmanState::nStubLayers ( ) const
inline

Definition at line 65 of file KalmanState.h.

References n_stubs_.

Referenced by tmtt::KFbase::doKF().

65 { return n_stubs_; }
unsigned n_stubs_
Definition: KalmanState.h:92

◆ r()

double tmtt::KalmanState::r ( ) const
inline

Definition at line 45 of file KalmanState.h.

References r_.

45 { return r_; }

◆ reducedChi2()

double tmtt::KalmanState::reducedChi2 ( ) const

Definition at line 72 of file KalmanState.cc.

References chi2(), n_stubs_, and vecX_.

72  {
73  if (2 * n_stubs_ - vecX_.GetNrows() > 0)
74  return (this->chi2()) / (2 * n_stubs_ - vecX_.GetNrows());
75  else
76  return 0;
77  }
double chi2() const
Definition: KalmanState.h:61
unsigned n_stubs_
Definition: KalmanState.h:92

◆ setChi2()

void tmtt::KalmanState::setChi2 ( double  chi2rphi,
double  chi2rz 
)
inline

Definition at line 73 of file KalmanState.h.

References chi2rphi(), chi2rphi_, chi2rz(), and chi2rz_.

73  {
75  chi2rz_ = chi2rz;
76  }
double chi2rz() const
Definition: KalmanState.h:64
double chi2rphi() const
Definition: KalmanState.h:63

◆ settings()

const Settings* tmtt::KalmanState::settings ( ) const
inline

Definition at line 37 of file KalmanState.h.

References settings_.

37 { return settings_; }
const Settings * settings_
Definition: KalmanState.h:79

◆ stub()

Stub* tmtt::KalmanState::stub ( ) const
inline

Definition at line 57 of file KalmanState.h.

References stub_.

Referenced by good(), KalmanState(), and stubs().

57 { return stub_; }

◆ stubs()

std::vector< Stub * > tmtt::KalmanState::stubs ( ) const

Definition at line 89 of file KalmanState.cc.

References groupFilesInBlocks::reverse, and stub().

89  {
90  std::vector<Stub *> all_stubs;
91 
92  const KalmanState *state = this;
93  while (state) {
94  Stub *stub = state->stub();
95  if (stub != nullptr)
96  all_stubs.push_back(stub);
97  state = state->last_state();
98  }
99  std::reverse(all_stubs.begin(), all_stubs.end()); // Put innermost stub first.
100  return all_stubs;
101  }
Stub * stub() const
Definition: KalmanState.h:57
KalmanState(const Settings *settings, const L1track3D &candidate, unsigned nSkipped, int kLayer, const KalmanState *last_state, const TVectorD &vecX, const TMatrixD &matC, const TMatrixD &matK, const TMatrixD &matV, Stub *stub, double chi2rphi, double chi2rz)
Definition: KalmanState.cc:9

◆ vectorX()

const TVectorD& tmtt::KalmanState::vectorX ( ) const
inline

Definition at line 49 of file KalmanState.h.

References vecX_.

49 { return vecX_; }

◆ z()

double tmtt::KalmanState::z ( ) const
inline

Definition at line 46 of file KalmanState.h.

References z_.

Referenced by geometryXMLparser.Alignable::pos(), and ntupleDataFormat._HitObject::r3D().

46 { return z_; }

Member Data Documentation

◆ barrel_

bool tmtt::KalmanState::barrel_
private

Definition at line 93 of file KalmanState.h.

Referenced by barrel(), and KalmanState().

◆ chi2rphi_

double tmtt::KalmanState::chi2rphi_
private

Definition at line 89 of file KalmanState.h.

Referenced by chi2(), chi2rphi(), chi2scaled(), and setChi2().

◆ chi2rz_

double tmtt::KalmanState::chi2rz_
private

Definition at line 90 of file KalmanState.h.

Referenced by chi2(), chi2rz(), chi2scaled(), and setChi2().

◆ hitPattern_

unsigned int tmtt::KalmanState::hitPattern_
private

Definition at line 96 of file KalmanState.h.

Referenced by hitPattern(), and KalmanState().

◆ kalmanChi2RphiScale_

unsigned int tmtt::KalmanState::kalmanChi2RphiScale_
private

Definition at line 91 of file KalmanState.h.

Referenced by chi2scaled(), and KalmanState().

◆ kLayer_

int tmtt::KalmanState::kLayer_
private

Definition at line 80 of file KalmanState.h.

Referenced by KalmanState(), layer(), and nextLayer().

◆ l1track3D_

L1track3D tmtt::KalmanState::l1track3D_
private

Definition at line 95 of file KalmanState.h.

Referenced by candidate().

◆ last_state_

const KalmanState* tmtt::KalmanState::last_state_
private

Definition at line 83 of file KalmanState.h.

Referenced by last_state().

◆ matC_

TMatrixD tmtt::KalmanState::matC_
private

Definition at line 85 of file KalmanState.h.

Referenced by KalmanState(), and matrixC().

◆ matK_

TMatrixD tmtt::KalmanState::matK_
private

Definition at line 86 of file KalmanState.h.

Referenced by KalmanState(), and matrixK().

◆ matV_

TMatrixD tmtt::KalmanState::matV_
private

Definition at line 87 of file KalmanState.h.

Referenced by KalmanState(), and matrixV().

◆ n_stubs_

unsigned tmtt::KalmanState::n_stubs_
private

Definition at line 92 of file KalmanState.h.

Referenced by KalmanState(), nStubLayers(), and reducedChi2().

◆ nSkipped_

unsigned tmtt::KalmanState::nSkipped_
private

Definition at line 94 of file KalmanState.h.

Referenced by KalmanState(), and nSkippedLayers().

◆ r_

double tmtt::KalmanState::r_
private

Definition at line 81 of file KalmanState.h.

Referenced by KalmanState(), and r().

◆ settings_

const Settings* tmtt::KalmanState::settings_
private

Definition at line 79 of file KalmanState.h.

Referenced by KalmanState(), and settings().

◆ stub_

Stub* tmtt::KalmanState::stub_
private

Definition at line 88 of file KalmanState.h.

Referenced by stub().

◆ vecX_

TVectorD tmtt::KalmanState::vecX_
private

Definition at line 84 of file KalmanState.h.

Referenced by reducedChi2(), and vectorX().

◆ z_

double tmtt::KalmanState::z_
private

Definition at line 82 of file KalmanState.h.

Referenced by KalmanState(), and z().