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.

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  }

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_.

Member Function Documentation

◆ barrel()

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

Definition at line 42 of file KalmanState.h.

42 { return barrel_; }

References barrel_.

◆ candidate()

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

Definition at line 59 of file KalmanState.h.

59 { return l1track3D_; }

References l1track3D_.

◆ chi2()

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

Definition at line 61 of file KalmanState.h.

61 { return chi2rphi_ + chi2rz_; }

References chi2rphi_, and chi2rz_.

Referenced by reducedChi2().

◆ chi2rphi()

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

Definition at line 63 of file KalmanState.h.

63 { return chi2rphi_; }

References chi2rphi_.

Referenced by setChi2().

◆ chi2rz()

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

Definition at line 64 of file KalmanState.h.

64 { return chi2rz_; }

References chi2rz_.

Referenced by setChi2().

◆ chi2scaled()

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

Definition at line 62 of file KalmanState.h.

62 { return chi2rphi_ / kalmanChi2RphiScale_ + chi2rz_; } // Improves electron performance.

References chi2rphi_, chi2rz_, and kalmanChi2RphiScale_.

◆ good()

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

Definition at line 58 of file KalmanState.cc.

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  }

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

◆ hitPattern()

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

Definition at line 66 of file KalmanState.h.

66 { return hitPattern_; } // Bit-encoded KF layers the fitted track has stubs in.

References hitPattern_.

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

◆ last_state()

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

Definition at line 47 of file KalmanState.h.

47 { return last_state_; }

References last_state_.

Referenced by KalmanState().

◆ 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  }

◆ layer()

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

Definition at line 41 of file KalmanState.h.

41 { return kLayer_; }

References kLayer_.

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

◆ matrixC()

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

Definition at line 51 of file KalmanState.h.

51 { return matC_; }

References matC_.

◆ matrixK()

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

Definition at line 53 of file KalmanState.h.

53 { return matK_; }

References matK_.

◆ matrixV()

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

Definition at line 55 of file KalmanState.h.

55 { return matV_; }

References matV_.

◆ nextLayer()

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

Definition at line 39 of file KalmanState.h.

39 { return (1 + kLayer_); }

References kLayer_.

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

◆ nSkippedLayers()

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

Definition at line 43 of file KalmanState.h.

43 { return nSkipped_; }

References nSkipped_.

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

◆ nStubLayers()

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

Definition at line 65 of file KalmanState.h.

65 { return n_stubs_; }

References n_stubs_.

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

◆ r()

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

Definition at line 45 of file KalmanState.h.

45 { return r_; }

References r_.

◆ reducedChi2()

double tmtt::KalmanState::reducedChi2 ( ) const

Definition at line 72 of file KalmanState.cc.

72  {
73  if (2 * n_stubs_ - vecX_.GetNrows() > 0)
74  return (this->chi2()) / (2 * n_stubs_ - vecX_.GetNrows());
75  else
76  return 0;
77  }

References chi2(), n_stubs_, and vecX_.

◆ setChi2()

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

Definition at line 73 of file KalmanState.h.

73  {
75  chi2rz_ = chi2rz;
76  }

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

◆ settings()

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

Definition at line 37 of file KalmanState.h.

37 { return settings_; }

References settings_.

◆ stub()

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

Definition at line 57 of file KalmanState.h.

57 { return stub_; }

References stub_.

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

◆ stubs()

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

Definition at line 89 of file KalmanState.cc.

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  }

References groupFilesInBlocks::reverse, and stub().

◆ vectorX()

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

Definition at line 49 of file KalmanState.h.

49 { return vecX_; }

References vecX_.

◆ z()

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

Definition at line 46 of file KalmanState.h.

46 { return z_; }

References z_.

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

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().

tmtt::KalmanState::chi2rz
double chi2rz() const
Definition: KalmanState.h:64
tmtt::KalmanState::matV_
TMatrixD matV_
Definition: KalmanState.h:87
tmtt::KalmanState::settings_
const Settings * settings_
Definition: KalmanState.h:79
tmtt::KalmanState::kalmanChi2RphiScale_
unsigned int kalmanChi2RphiScale_
Definition: KalmanState.h:91
tmtt::KalmanState::n_stubs_
unsigned n_stubs_
Definition: KalmanState.h:92
tmtt::KalmanState::l1track3D_
L1track3D l1track3D_
Definition: KalmanState.h:95
tmtt::Stub::assocTPs
const std::set< const TP * > & assocTPs() const
Definition: Stub.h:164
tmtt::Stub::r
float r() const
Definition: Stub.h:108
tmtt::KalmanState::chi2
double chi2() const
Definition: KalmanState.h:61
tmtt::KalmanState::chi2rphi
double chi2rphi() const
Definition: KalmanState.h:63
tmtt::KalmanState::chi2rz_
double chi2rz_
Definition: KalmanState.h:90
tmtt::KalmanState::last_state
const KalmanState * last_state() const
Definition: KalmanState.h:47
tmtt::KalmanState::z_
double z_
Definition: KalmanState.h:82
tmtt::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: KalmanState.cc:9
groupFilesInBlocks.reverse
reverse
Definition: groupFilesInBlocks.py:131
tmtt::KalmanState::chi2rphi_
double chi2rphi_
Definition: KalmanState.h:89
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
tmtt::Stub::z
float z() const
Definition: Stub.h:109
tmtt::KalmanState::r_
double r_
Definition: KalmanState.h:81
tmtt::KalmanState::candidate
const L1track3D & candidate() const
Definition: KalmanState.h:59
tmtt::KalmanState::matK_
TMatrixD matK_
Definition: KalmanState.h:86
tmtt::KalmanState::settings
const Settings * settings() const
Definition: KalmanState.h:37
tmtt::Settings::kalmanChi2RphiScale
unsigned int kalmanChi2RphiScale() const
Definition: Settings.h:324
tmtt::KalmanState::hitPattern_
unsigned int hitPattern_
Definition: KalmanState.h:96
tmtt::KalmanState::vecX_
TVectorD vecX_
Definition: KalmanState.h:84
tmtt::KalmanState::barrel_
bool barrel_
Definition: KalmanState.h:93
tmtt::Stub::barrel
bool barrel() const
Definition: Stub.h:201
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
tmtt::KalmanState::stub
Stub * stub() const
Definition: KalmanState.h:57
tmtt::KalmanState::hitPattern
unsigned int hitPattern() const
Definition: KalmanState.h:66
tmtt::KalmanState::kLayer_
int kLayer_
Definition: KalmanState.h:80
tmtt::KalmanState::last_state_
const KalmanState * last_state_
Definition: KalmanState.h:83
tmtt::KalmanState::nSkipped_
unsigned nSkipped_
Definition: KalmanState.h:94
tmtt::KalmanState::matC_
TMatrixD matC_
Definition: KalmanState.h:85
kLayer
static const std::string kLayer("layer")
tmtt::KalmanState::stub_
Stub * stub_
Definition: KalmanState.h:88