BmnRoot
Loading...
Searching...
No Matches
BmnKFStsHit.cxx
Go to the documentation of this file.
1// -------------------------------------------------------------------------
2// ----- BmnKFStsHit source file -----
3// ----- Created 27/03/21 by A.Zinchenko, D.Zinchenko -----
4// ----- (from CbmKFStsHit.cxx) -----
5// -------------------------------------------------------------------------
6
7#include "BmnKFStsHit.h"
8
9#include "CbmKF.h"
10#include "CbmKFTrackInterface.h"
11#include "CbmKFMaterial.h"
12
13#include "CbmStsHit.h"
14#include "CbmStsSensor.h"
15//#include "CbmMvdHit.h"
16//#include <ios.h>
17using std::vector;
18using std::ios;
19
20//AZ static CbmKFTube st_tube;
21
23
24 CbmKF *KF = CbmKF::Instance();
25 int id = 1000+h->GetStationNr();
27 Int_t ista = h->GetStationNr(), isec = h->GetSectorNr(), isen = h->GetSensorNr();
28 CbmStsSensor* sensor = KF->StsDigi->GetSensor(ista, isec, isen);
29 Double_t phis[2] = {sensor->GetStereoF(), sensor->GetStereoB()};
30
31 //AZ if( MaterialIndex>=0 ) tube = (CbmKFTube*)KF->vMaterial[MaterialIndex];
32 if ( MaterialIndex>=0 ) {
33 //AZ - adjust hit position
35 st_tube = *tube;
36 st_tube.z = h->GetZ();
37 st_tube.ZReference = h->GetZ();
38 tube = &st_tube;
39 }
40 else{
42 tube = &st_tube;
43 }
44 TVector3 pos, err;
45 h->Position(pos);
46 h->PositionError(err);
47
48 //FitPoint.x = pos.X();
49 //FitPoint.y = pos.Y();
50 //FitPoint.z = pos.Z();
51 fX = pos.X();
52 fY = pos.Y();
53 fZ = pos.Z();
54 Double_t sigma2 = err.X() * err.X();
55#if 1
56 for (Int_t j = 0; j < 2; ++j) {
57 Double_t u = fX * cos(phis[j]) + fY * sin(phis[j]);
58 //FitPoint[j].Set(z, u, phi, sigma2);
59 FitPoint[j].Set(fZ, u, phis[j], sigma2);
60 }
61 //FitPoint.V[0] = err.X() * err.X();
62 //FitPoint.V[1] = h->GetCovXY();
63 //FitPoint.V[2] = err.Y() * err.Y();
64#else
65 FitPoint.V[0] = 3.000e-06;
66 FitPoint.V[1] = -1.120e-05;
67 FitPoint.V[2] = 8.357e-05;
68#endif // 0
69
70}
71
72/*
73void CbmKFStsHit::Create( CbmMvdHit *h ){
74
75 CbmKF *KF = CbmKF::Instance();
76 int id = 1100+h->GetStationNr();
77// cout << " station " << h->GetStationNr() << " has id " << id << flush;
78 MaterialIndex = KF->GetMaterialIndex( id );
79// cout << " and material index = " << MaterialIndex << endl;
80
81 if( MaterialIndex>=0 ) tube = (CbmKFTube*)KF->vMaterial[MaterialIndex];
82 else{
83 st_tube.z = st_tube.dz = st_tube.r = st_tube.R = st_tube.rr = st_tube.RR = 0;
84 tube = &st_tube;
85 }
86 TVector3 pos, err;
87 h->Position(pos);
88 h->PositionError(err);
89
90 FitPoint.x = pos.X();
91 FitPoint.y = pos.Y();
92 FitPoint.z = pos.Z();
93
94 FitPoint.V[0] = err.X() * err.X();
95 FitPoint.V[1] = 0.;
96 FitPoint.V[2] = err.Y() * err.Y();
97}
98*/
99
100Int_t BmnKFStsHit::Filter( CbmKFTrackInterface &track, Bool_t downstream, Double_t &QP0 ){
101 Bool_t err = 0;
102 Double_t zfst, zlst, zend;
103 if( downstream )
104 {
105 zfst = tube->z - tube->ZThickness/4.;
106 zlst = tube->z + tube->ZThickness/4.;
107 zend = tube->z + tube->ZThickness/2.;
108 }
109 else
110 {
111 zfst = tube->z + tube->ZThickness/4.;
112 zlst = tube->z - tube->ZThickness/4.;
113 zend = tube->z - tube->ZThickness/2.;
114 }
115 Double_t zthick = tube->ZThickness/2.;
116
117 err = err || tube->Pass( zfst, zthick, track, downstream, QP0 );
118 //AZ err = err || track.Propagate( FitPoint.z, QP0 );
119 //AZ err = err || FitPoint.Filter( track );
120 err = err || track.Propagate( FitPoint[0].z, QP0 );
121 err = err || FitPoint[0].Filter( track );
122 err = err || FitPoint[1].Filter( track );
123 err = err || tube->Pass( zlst, zthick, track, downstream, QP0 );
124 err = err || track.Propagate( zend, QP0 );
125 return err;
126}
127
128
130//
131// mathAddMeasurements: the implementation of the Probabilistic
132// Data Association Filter for the MAPS
133//
134//
135// Author : Dmitry Emeliyanov, RAL, dmitry.emeliyanov@cern.ch
136//
138/*
139void CbmKFStsHit::FilterPDAF( CbmKFTrackInterface &track,
140 vector<CbmKFStsHit*> &vpHits,
141 Bool_t downstream, Double_t *QP0,
142 double gateX, double gateY, int &best_hit_idx ){
143
144 best_hit_idx=0;
145 if( vpHits.empty() ) return;
146
147 double qp0 = (QP0)? *QP0 : track.GetTrack()[4];
148
149 CbmKFStsHit* h=(*vpHits.begin());
150
151 vector<CbmKFPixelMeasurement*> vm;
152 vm.clear();
153 for(vector<CbmKFStsHit*>::iterator phIt=vpHits.begin(); phIt!=vpHits.end();++phIt){
154 vm.push_back(&((*phIt)->FitPoint));
155 }
156
157 CbmKFTube *tube = h->tube;
158
159 Double_t zfst, zlst, zend;
160 if( downstream )
161 {
162 zfst = tube->z - tube->ZThickness/4.;
163 zlst = tube->z + tube->ZThickness/4.;
164 zend = tube->z + tube->ZThickness/2.;
165 }
166 else
167 {
168 zfst = tube->z + tube->ZThickness/4.;
169 zlst = tube->z - tube->ZThickness/4.;
170 zend = tube->z - tube->ZThickness/2.;
171 }
172 Double_t zthick = tube->ZThickness/2.;
173
174 tube->Pass( zfst, zthick, track, downstream, qp0 );
175 track.Propagate( h->FitPoint.z, qp0 );
176
177 vector<double> vProb;
178 vProb.clear();
179
180 CbmKFPixelMeasurement::FilterPDAF(track, vm, gateX, gateY, vProb );
181
182 int idx=0;
183 double bestProb=0.0;
184
185 for(vector<double>::iterator probIt=vProb.begin(); probIt!=vProb.end();++probIt){
186 if((*probIt)>bestProb){
187 bestProb=(*probIt);
188 best_hit_idx=idx;
189 }
190 idx++;
191 }
192 vProb.clear();
193
194 tube->Pass( zlst, zthick, track, downstream, qp0 );
195 track.Propagate( zend, qp0 );
196
197 if( QP0 ) *QP0 = qp0;
198}
199*/
friend F32vec4 sin(const F32vec4 &a)
Definition P4_F32vec4.h:124
friend F32vec4 cos(const F32vec4 &a)
Definition P4_F32vec4.h:125
CbmKFTube st_tube
Definition BmnKFStsHit.h:29
Int_t Filter(CbmKFTrackInterface &track, Bool_t downstream, Double_t &QP0)
CbmKFTube * tube
Definition BmnKFStsHit.h:27
Double_t fX
Definition BmnKFStsHit.h:28
Double_t fZ
Definition BmnKFStsHit.h:28
CbmKFUMeasurement FitPoint[2]
Definition BmnKFStsHit.h:26
void Create(CbmStsHit *h)
Double_t fY
Definition BmnKFStsHit.h:28
Int_t MaterialIndex
Definition CbmKFHit.h:23
Double_t ZReference
virtual Int_t Pass(Double_t ZCross, Double_t ZThick, CbmKFTrackInterface &track, Bool_t downstream, Double_t &QP0)
Double_t ZThickness
Int_t Propagate(Double_t z_out, Double_t QP0, Bool_t line=false)
Double_t R
Double_t rr
Double_t RR
Double_t r
Double_t dz
Double_t z
void Set(Double_t z, Double_t u, Double_t phi, Double_t sigma2)
Int_t Filter(CbmKFTrackInterface &track)
Definition CbmKF.h:28
std::vector< CbmKFMaterial * > vMaterial
Definition CbmKF.h:58
static CbmKF * Instance()
Definition CbmKF.h:35
Int_t GetMaterialIndex(Int_t uid)
Definition CbmKF.cxx:459
CbmStsDigiScheme * StsDigi
Definition CbmKF.h:84
CbmStsSensor * GetSensor(Int_t stationNr, Int_t sectorNr, Int_t sensorNr)
Int_t GetSensorNr() const
Definition CbmStsHit.h:70
virtual Int_t GetStationNr() const
Definition CbmStsHit.h:66
Int_t GetSectorNr() const
Definition CbmStsHit.h:68
Double_t GetStereoF() const
Double_t GetStereoB() const