CbmRoot
CbmKFStsHit.cxx
Go to the documentation of this file.
1 
2 #include "CbmKFStsHit.h"
3 
4 #include "CbmKF.h"
5 #include "CbmKFMaterial.h"
6 #include "CbmKFTrackInterface.h"
7 
8 #include "CbmMvdHit.h"
9 #include "CbmStsAddress.h"
10 #include "CbmStsHit.h"
11 #include "CbmStsSetup.h"
12 //#include <ios.h>
13 using std::ios;
14 using std::vector;
15 
17 
19 
21 
22  CbmKF* KF = CbmKF::Instance();
23  int id = 1000 + CbmStsSetup::Instance()->GetStationNumber(h->GetAddress());
24 
26 
27  if (MaterialIndex >= 0)
29  else {
31  0;
32  tube = &st_tube;
33  }
34  TVector3 pos, err;
35  h->Position(pos);
36  h->PositionError(err);
37 
38  FitPoint.x = pos.X();
39  FitPoint.y = pos.Y();
40  FitPoint.z = pos.Z();
41 #if 1
42  FitPoint.V[0] = err.X() * err.X();
43  FitPoint.V[1] = h->GetDxy();
44  FitPoint.V[2] = err.Y() * err.Y();
45 #else
46  FitPoint.V[0] = 3.000e-06;
47  FitPoint.V[1] = -1.120e-05;
48  FitPoint.V[2] = 8.357e-05;
49 #endif // 0
50 }
51 
52 
54 
55  CbmKF* KF = CbmKF::Instance();
56  int id = 1100 + h->GetStationNr();
57  // cout << " station " << h->GetStationNr() << " has id " << id << flush;
59  // cout << " and material index = " << MaterialIndex << endl;
60 
61  if (MaterialIndex >= 0)
63  else {
65  0;
66  tube = &st_tube;
67  }
68  TVector3 pos, err;
69  h->Position(pos);
70  h->PositionError(err);
71 
72  FitPoint.x = pos.X();
73  FitPoint.y = pos.Y();
74  FitPoint.z = pos.Z();
75 
76  FitPoint.V[0] = err.X() * err.X();
77  FitPoint.V[1] = 0.;
78  FitPoint.V[2] = err.Y() * err.Y();
79 }
80 
81 
83  Bool_t downstream,
84  Double_t& QP0) {
85  Bool_t err = 0;
86  Double_t zfst, zlst, zend;
87  if (downstream) {
88  zfst = tube->z - tube->ZThickness / 4.;
89  zlst = tube->z + tube->ZThickness / 4.;
90  zend = tube->z + tube->ZThickness / 2.;
91  } else {
92  zfst = tube->z + tube->ZThickness / 4.;
93  zlst = tube->z - tube->ZThickness / 4.;
94  zend = tube->z - tube->ZThickness / 2.;
95  }
96  Double_t zthick = tube->ZThickness / 2.;
97 
98  err = err || tube->Pass(zfst, zthick, track, downstream, QP0);
99  err = err || track.Propagate(FitPoint.z, QP0);
100  err = err || FitPoint.Filter(track);
101  err = err || tube->Pass(zlst, zthick, track, downstream, QP0);
102  err = err || track.Propagate(zend, QP0);
103  return err;
104 }
105 
106 
108 //
109 // mathAddMeasurements: the implementation of the Probabilistic
110 // Data Association Filter for the MAPS
111 //
112 //
113 // Author : Dmitry Emeliyanov, RAL, dmitry.emeliyanov@cern.ch
114 //
116 
118  vector<CbmKFStsHit*>& vpHits,
119  Bool_t downstream,
120  Double_t* QP0,
121  double gateX,
122  double gateY,
123  int& best_hit_idx) {
124 
125  best_hit_idx = 0;
126  if (vpHits.empty()) return;
127 
128  double qp0 = (QP0) ? *QP0 : track.GetTrack()[4];
129 
130  CbmKFStsHit* h = (*vpHits.begin());
131 
132  vector<CbmKFPixelMeasurement*> vm;
133  vm.clear();
134  for (vector<CbmKFStsHit*>::iterator phIt = vpHits.begin();
135  phIt != vpHits.end();
136  ++phIt) {
137  vm.push_back(&((*phIt)->FitPoint));
138  }
139 
140  CbmKFTube* tube = h->tube;
141 
142  Double_t zfst, zlst, zend;
143  if (downstream) {
144  zfst = tube->z - tube->ZThickness / 4.;
145  zlst = tube->z + tube->ZThickness / 4.;
146  zend = tube->z + tube->ZThickness / 2.;
147  } else {
148  zfst = tube->z + tube->ZThickness / 4.;
149  zlst = tube->z - tube->ZThickness / 4.;
150  zend = tube->z - tube->ZThickness / 2.;
151  }
152  Double_t zthick = tube->ZThickness / 2.;
153 
154  tube->Pass(zfst, zthick, track, downstream, qp0);
155  track.Propagate(h->FitPoint.z, qp0);
156 
157  vector<double> vProb;
158  vProb.clear();
159 
160  CbmKFPixelMeasurement::FilterPDAF(track, vm, gateX, gateY, vProb);
161 
162  int idx = 0;
163  double bestProb = 0.0;
164 
165  for (vector<double>::iterator probIt = vProb.begin(); probIt != vProb.end();
166  ++probIt) {
167  if ((*probIt) > bestProb) {
168  bestProb = (*probIt);
169  best_hit_idx = idx;
170  }
171  idx++;
172  }
173  vProb.clear();
174 
175  tube->Pass(zlst, zthick, track, downstream, qp0);
176  track.Propagate(zend, qp0);
177 
178  if (QP0) *QP0 = qp0;
179 }
CbmKFTube::z
Double_t z
Definition: CbmKFMaterial.h:92
CbmKFTube::RR
Double_t RR
Definition: CbmKFMaterial.h:93
CbmKFStsHit
Definition: CbmKFStsHit.h:11
CbmKF.h
CbmKFStsHit::Filter
Int_t Filter(CbmKFTrackInterface &track, Bool_t downstream, Double_t &QP0)
Definition: CbmKFStsHit.cxx:82
CbmKFStsHit.h
CbmKFTrackInterface::GetTrack
virtual Double_t * GetTrack()
Is it electron.
Definition: CbmKFTrackInterface.cxx:33
CbmStsSetup.h
CbmKFPixelMeasurement::FilterPDAF
static void FilterPDAF(CbmKFTrackInterface &track, std::vector< CbmKFPixelMeasurement * > &vm, double gateX, double gateY, std::vector< double > &vProb)
Definition: CbmKFPixelMeasurement.cxx:96
CbmKFMaterial::ZThickness
Double_t ZThickness
Definition: CbmKFMaterial.h:30
CbmKF::GetMaterialIndex
Int_t GetMaterialIndex(Int_t uid)
Definition: CbmKF.cxx:328
CbmStsSetup::Instance
static CbmStsSetup * Instance()
Definition: CbmStsSetup.cxx:293
CbmKF
Definition: CbmKF.h:33
CbmKFTube::R
Double_t R
Definition: CbmKFMaterial.h:93
CbmKFTrackInterface.h
CbmMvdHit
Definition: CbmMvdHit.h:29
CbmKFStsHit::Create
void Create(CbmStsHit *h)
Definition: CbmKFStsHit.cxx:20
CbmKFPixelMeasurement::z
Double_t z
Definition: CbmKFPixelMeasurement.h:23
CbmStsHit
data class for a reconstructed 3-d hit in the STS
Definition: CbmStsHit.h:31
ClassImp
ClassImp(CbmKFStsHit)
CbmKF::Instance
static CbmKF * Instance()
Definition: CbmKF.h:39
CbmKFHit::MaterialIndex
Int_t MaterialIndex
Definition: CbmKFHit.h:22
h
Data class with information on a STS local track.
CbmStsSetup::GetStationNumber
Int_t GetStationNumber(Int_t address)
Definition: CbmStsSetup.cxx:187
CbmKF::vMaterial
std::vector< CbmKFMaterial * > vMaterial
Definition: CbmKF.h:71
CbmKFTube::rr
Double_t rr
Definition: CbmKFMaterial.h:93
CbmKFTube::dz
Double_t dz
Definition: CbmKFMaterial.h:92
CbmKFTube::r
Double_t r
Definition: CbmKFMaterial.h:93
CbmKFStsHit::FitPoint
CbmKFPixelMeasurement FitPoint
Definition: CbmKFStsHit.h:15
CbmKFTrackInterface
Definition: CbmKFTrackInterface.h:26
CbmKFStsHit::tube
CbmKFTube * tube
Definition: CbmKFStsHit.h:18
CbmKFTube
Definition: CbmKFMaterial.h:77
CbmKFMaterial.h
CbmKFMaterial::Pass
virtual Int_t Pass(Double_t ZCross, Double_t ZThick, CbmKFTrackInterface &track, Bool_t downstream, Double_t &QP0)
Definition: CbmKFMaterial.cxx:25
CbmMvdHit.h
pos
TVector3 pos
Definition: CbmMvdSensorDigiToHitTask.cxx:60
CbmStsAddress.h
CbmKFPixelMeasurement::Filter
Int_t Filter(CbmKFTrackInterface &track)
Definition: CbmKFPixelMeasurement.cxx:9
CbmKFTrackInterface::Propagate
Int_t Propagate(Double_t z_out, Double_t QP0)
Definition: CbmKFTrackInterface.cxx:449
st_tube
static CbmKFTube st_tube
Definition: CbmKFStsHit.cxx:18
CbmKFStsHit::FilterPDAF
static void FilterPDAF(CbmKFTrackInterface &track, std::vector< CbmKFStsHit * > &vpHits, Bool_t downstream, Double_t *QP0, double gateX, double gateY, int &best_hit_idx)
Definition: CbmKFStsHit.cxx:117
CbmStsHit.h
Data class for a reconstructed hit in the STS.