CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( 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_, matC_, matK_, matV_, n_stubs_, nSkipped_, tmtt::Stub::r(), r_, settings_, 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  }
const L1track3D & candidate() const
Definition: KalmanState.h:59
unsigned int hitPattern() const
Definition: KalmanState.h:66
Stub * stub() const
Definition: KalmanState.h:57
unsigned int kalmanChi2RphiScale() const
Definition: Settings.h:326
const KalmanState * last_state_
Definition: KalmanState.h:83
bool barrel() const
Definition: Stub.h:201
const Settings * settings_
Definition: KalmanState.h:79
double chi2rphi() const
Definition: KalmanState.h:63
unsigned nSkipped_
Definition: KalmanState.h:94
unsigned int kalmanChi2RphiScale_
Definition: KalmanState.h:91
const Settings * settings() const
Definition: KalmanState.h:37
static const std::string kLayer("layer")
float r() const
Definition: Stub.h:108
L1track3D l1track3D_
Definition: KalmanState.h:95
const KalmanState * last_state() const
Definition: KalmanState.h:47
float z() const
Definition: Stub.h:109
unsigned int hitPattern_
Definition: KalmanState.h:96
unsigned n_stubs_
Definition: KalmanState.h:92
double chi2rz() const
Definition: KalmanState.h:64

Member Function Documentation

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

Definition at line 42 of file KalmanState.h.

References barrel_.

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

42 { return barrel_; }
const L1track3D& tmtt::KalmanState::candidate ( ) const
inline

Definition at line 59 of file KalmanState.h.

References l1track3D_.

Referenced by tmtt::KFbase::kalmanUpdate(), and tmtt::KFParamsComb::matrixV().

59 { return l1track3D_; }
L1track3D l1track3D_
Definition: KalmanState.h:95
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_; }
double tmtt::KalmanState::chi2rphi ( ) const
inline
double tmtt::KalmanState::chi2rz ( ) const
inline

Definition at line 64 of file KalmanState.h.

References chi2rz_.

Referenced by tmtt::KFbase::adjustChi2(), tmtt::KFbase::fit(), and setChi2().

64 { return chi2rz_; }
double tmtt::KalmanState::chi2scaled ( ) const
inline

Definition at line 62 of file KalmanState.h.

References chi2rphi_, chi2rz_, and kalmanChi2RphiScale_.

Referenced by tmtt::KFbase::doKF(), and tmtt::KFParamsComb::isGoodState().

62 { return chi2rphi_ / kalmanChi2RphiScale_ + chi2rz_; } // Improves electron performance.
unsigned int kalmanChi2RphiScale_
Definition: KalmanState.h:91
bool tmtt::KalmanState::good ( const TP tp) const

Definition at line 58 of file KalmanState.cc.

References tmtt::Stub::assocTPs(), last_state(), and stub().

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
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
const std::set< const TP * > & assocTPs() const
Definition: Stub.h:164
unsigned int tmtt::KalmanState::hitPattern ( ) const
inline

Definition at line 66 of file KalmanState.h.

References hitPattern_.

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

66 { return hitPattern_; } // Bit-encoded KF layers the fitted track has stubs in.
unsigned int hitPattern_
Definition: KalmanState.h:96
const KalmanState* tmtt::KalmanState::last_state ( ) const
inline

Definition at line 47 of file KalmanState.h.

References last_state_.

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

47 { return last_state_; }
const KalmanState * last_state_
Definition: KalmanState.h:83
const KalmanState * tmtt::KalmanState::last_update_state ( ) const

Definition at line 79 of file KalmanState.cc.

References last_state(), and stub().

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
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_; }
const TMatrixD& tmtt::KalmanState::matrixC ( ) const
inline

Definition at line 51 of file KalmanState.h.

References matC_.

Referenced by tmtt::KFbase::kalmanUpdate(), and tmtt::KFParamsComb::trackParams_BeamConstr().

51 { return matC_; }
const TMatrixD& tmtt::KalmanState::matrixK ( ) const
inline

Definition at line 53 of file KalmanState.h.

References matK_.

53 { return matK_; }
const TMatrixD& tmtt::KalmanState::matrixV ( ) const
inline

Definition at line 55 of file KalmanState.h.

References matV_.

55 { return matV_; }
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_); }
unsigned tmtt::KalmanState::nSkippedLayers ( ) const
inline

Definition at line 43 of file KalmanState.h.

References nSkipped_.

Referenced by tmtt::KFbase::doKF(), tmtt::KFbase::fit(), and tmtt::KFParamsComb::isGoodState().

43 { return nSkipped_; }
unsigned nSkipped_
Definition: KalmanState.h:94
unsigned tmtt::KalmanState::nStubLayers ( ) const
inline

Definition at line 65 of file KalmanState.h.

References n_stubs_.

Referenced by tmtt::KFbase::doKF(), tmtt::KFbase::fit(), and tmtt::KFParamsComb::isGoodState().

65 { return n_stubs_; }
unsigned n_stubs_
Definition: KalmanState.h:92
double tmtt::KalmanState::r ( ) const
inline

Definition at line 45 of file KalmanState.h.

References r_.

45 { return r_; }
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
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 chi2rphi() const
Definition: KalmanState.h:63
double chi2rz() const
Definition: KalmanState.h:64
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* tmtt::KalmanState::stub ( ) const
inline

Definition at line 57 of file KalmanState.h.

References stub_.

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

57 { return stub_; }
std::vector< Stub * > tmtt::KalmanState::stubs ( ) const

Definition at line 89 of file KalmanState.cc.

References last_state(), and stub().

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

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
const TVectorD& tmtt::KalmanState::vectorX ( ) const
inline
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

bool tmtt::KalmanState::barrel_
private

Definition at line 93 of file KalmanState.h.

Referenced by barrel(), and KalmanState().

double tmtt::KalmanState::chi2rphi_
private

Definition at line 89 of file KalmanState.h.

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

double tmtt::KalmanState::chi2rz_
private

Definition at line 90 of file KalmanState.h.

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

unsigned int tmtt::KalmanState::hitPattern_
private

Definition at line 96 of file KalmanState.h.

Referenced by hitPattern(), and KalmanState().

unsigned int tmtt::KalmanState::kalmanChi2RphiScale_
private

Definition at line 91 of file KalmanState.h.

Referenced by chi2scaled(), and KalmanState().

int tmtt::KalmanState::kLayer_
private

Definition at line 80 of file KalmanState.h.

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

L1track3D tmtt::KalmanState::l1track3D_
private

Definition at line 95 of file KalmanState.h.

Referenced by candidate().

const KalmanState* tmtt::KalmanState::last_state_
private

Definition at line 83 of file KalmanState.h.

Referenced by last_state().

TMatrixD tmtt::KalmanState::matC_
private

Definition at line 85 of file KalmanState.h.

Referenced by KalmanState(), and matrixC().

TMatrixD tmtt::KalmanState::matK_
private

Definition at line 86 of file KalmanState.h.

Referenced by KalmanState(), and matrixK().

TMatrixD tmtt::KalmanState::matV_
private

Definition at line 87 of file KalmanState.h.

Referenced by KalmanState(), and matrixV().

unsigned tmtt::KalmanState::n_stubs_
private

Definition at line 92 of file KalmanState.h.

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

unsigned tmtt::KalmanState::nSkipped_
private

Definition at line 94 of file KalmanState.h.

Referenced by KalmanState(), and nSkippedLayers().

double tmtt::KalmanState::r_
private

Definition at line 81 of file KalmanState.h.

Referenced by KalmanState(), and r().

const Settings* tmtt::KalmanState::settings_
private

Definition at line 79 of file KalmanState.h.

Referenced by KalmanState(), and settings().

Stub* tmtt::KalmanState::stub_
private

Definition at line 88 of file KalmanState.h.

Referenced by stub().

TVectorD tmtt::KalmanState::vecX_
private

Definition at line 84 of file KalmanState.h.

Referenced by reducedChi2(), and vectorX().

double tmtt::KalmanState::z_
private

Definition at line 82 of file KalmanState.h.

Referenced by KalmanState(), and z().