CbmRoot
CbmKFMaterial.cxx
Go to the documentation of this file.
1 #include "CbmKFMaterial.h"
2 
3 #include "CbmKF.h"
4 #include "CbmKFMath.h"
5 #include "TString.h"
6 
7 #include <cmath>
8 
9 using std::fabs;
10 
12 
13 TString CbmKFMaterial::KFInfo() const {
14  char tmp[255];
15  sprintf(tmp,
16  " ( id, z, dz, RadL )= ( %i, %f, %f, %f )",
17  ID,
18  ZReference,
19  ZThickness,
20  RadLength);
21  return tmp;
22 }
23 
24 
25 Int_t CbmKFMaterial::Pass(Double_t ZCross,
26  Double_t ZThick,
27  CbmKFTrackInterface& track,
28  Bool_t downstream,
29  Double_t& QP0) {
30  Bool_t err = 0;
31  Double_t* T = track.GetTrack();
32  Double_t* C = track.GetCovMatrix();
33  err = err || CbmKF::Instance()->Propagate(T, C, ZCross, QP0);
34  if (err) return err;
35  if (IsOutside(T[0], T[1])) return 0;
36  Double_t Q5, Q8, Q9, Ecor;
37  err = err
38  || CbmKFMath::GetNoise(ZThick / RadLength,
39  F,
40  Fe,
41  T[2],
42  T[3],
43  QP0,
44  track.GetMass(),
45  track.IsElectron(),
46  downstream,
47  &Q5,
48  &Q8,
49  &Q9,
50  &Ecor);
51  if (err) return err;
52  C[5] += Q5;
53  C[8] += Q8;
54  C[9] += Q9;
55  QP0 *= Ecor;
56  T[4] *= Ecor;
57  C[10] *= Ecor;
58  C[11] *= Ecor;
59  C[12] *= Ecor;
60  C[13] *= Ecor;
61  C[14] *= Ecor * Ecor;
62  return 0;
63 }
64 
67 
69  Double_t x_,
70  Double_t y_,
71  Double_t z_,
72  Double_t dz_,
73  Double_t r_,
74  Double_t R_,
75  Double_t radL_)
76  : x(x_), y(y_), z(z_), dz(dz_), r(r_), R(R_), rr(r_ * r_), RR(R_ * R_) {
77  ID = ID_;
78  ZReference = z_;
79  ZThickness = dz_;
80  RadLength = radL_;
81  F = 1;
82 }
83 
84 TString CbmKFTube::KFInfo() const {
85  char tmp[255];
86  sprintf(
87  tmp,
88  " tube ( id, x,y,z, dz, r, R, RadL )= ( %i, %f, %f, %f, %f, %f, %f, %f )",
89  ID,
90  x,
91  y,
92  z,
93  dz,
94  r,
95  R,
96  RadLength);
97  return tmp;
98 }
99 
100 
102 
104  Double_t x_,
105  Double_t y_,
106  Double_t z_,
107  Double_t dx_,
108  Double_t dy_,
109  Double_t dz_,
110  Double_t radL_)
111  : x(x_), y(y_), z(z_), dx05(dx_ / 2), dy05(dy_ / 2), dz(dz_) {
112  ID = ID_;
113  ZReference = z_;
114  ZThickness = dz_;
115  RadLength = radL_;
116  F = 1;
117 }
118 
119 Bool_t CbmKFBox::IsOutside(Double_t X, Double_t Y) {
120  return (TMath::Abs(X - x) > dx05 || TMath::Abs(Y - y) > dy05);
121 }
122 
123 TString CbmKFBox::KFInfo() const {
124  char tmp[255];
125  sprintf(
126  tmp,
127  " box ( id, x,y,z, dx, dy, dz, RadL )= ( %i, %f, %f, %f, %f, %f, %f, %f )",
128  ID,
129  x,
130  y,
131  z,
132  dx05 * 2,
133  dy05 * 2,
134  dz,
135  RadLength);
136  return tmp;
137 }
138 
139 
141 
142 Int_t CbmKFCone::Pass(Double_t ZCross,
143  Double_t /*ZThick*/,
144  CbmKFTrackInterface& track,
145  Bool_t downstream,
146  Double_t& QP0) {
147 
148  Bool_t err = 0;
149  CbmKF* KF = CbmKF::Instance();
150  Double_t* T = track.GetTrack();
151  Double_t* C = track.GetCovMatrix();
152 
153  Double_t zthick = ZThickness, zcross = ZReference;
154  Double_t T_tmp[6];
155  for (Int_t j = 0; j < 6; j++)
156  T_tmp[j] = T[j];
157  err = err || KF->Propagate(T_tmp, 0, ZReference, QP0);
158  if (err) return err;
159  Double_t cz1, ct1, cz2, ct2;
160  {
161  Double_t iz1, iz2, iZ1, iZ2;
162  Bool_t err1 = CbmKFMath::intersectCone(z1, z2, r1, r2, T_tmp, &iz1, &iz2);
163  Bool_t err2 = CbmKFMath::intersectCone(z1, z2, R1, R2, T_tmp, &iZ1, &iZ2);
164  if (err1 || iz1 < z1 || iz1 > z2) iz1 = -200;
165  if (err1 || iz2 < z1 || iz2 > z2) iz2 = -200;
166  if (err2 || iZ1 < z1 || iZ1 > z2) iZ1 = -200;
167  if (err2 || iZ2 < z1 || iZ2 > z2) iZ2 = -200;
168 
169  if (iz1 > -200 && iZ1 > -200) {
170  cz1 = (iz1 + iZ1) / 2;
171  ct1 = fabs(iZ1 - iz1);
172  } else {
173  cz1 = ZCross; //TODO Check me
174  ct1 = 0;
175  }
176 
177  if (iz2 > -200 && iZ2 > -200) {
178  cz2 = (iz2 + iZ2) / 2;
179  ct2 = fabs(iZ2 - iz2);
180  } else {
181  cz2 = ZCross; //TODO Check me
182  ct2 = 0;
183  }
184 
185  if (iz1 <= -200 && iz2 <= -200 && iZ1 > -200 && iZ2 > -200) {
186  cz1 = (iZ1 + iZ2) / 2;
187  ct1 = fabs(iZ2 - iZ1);
188  cz2 = ZCross; //TODO Check me
189  ct2 = 0;
190  }
191  }
192  Double_t dz1 = cz1 - T[5];
193  Double_t dz2 = cz2 - T[5];
194  if (fabs(dz1) < fabs(dz2)) {
195  zthick = ct1;
196  zcross = cz1;
197  } else {
198  zthick = ct2;
199  zcross = cz2;
200  }
201 
202  err = err || KF->Propagate(T, C, zcross, QP0);
203 
204  Double_t Q5, Q8, Q9, Ecor;
205  err = err
206  || CbmKFMath::GetNoise(zthick / RadLength,
207  F,
208  Fe,
209  T[2],
210  T[3],
211  QP0,
212  track.GetMass(),
213  track.IsElectron(),
214  downstream,
215  &Q5,
216  &Q8,
217  &Q9,
218  &Ecor);
219  if (err) return err;
220  C[5] += Q5;
221  C[8] += Q8;
222  C[9] += Q9;
223  QP0 *= Ecor;
224  T[4] *= Ecor;
225  C[10] *= Ecor;
226  C[11] *= Ecor;
227  C[12] *= Ecor;
228  C[13] *= Ecor;
229  C[14] *= Ecor * Ecor;
230  return 0;
231 }
CbmKFBox
Definition: CbmKFMaterial.h:104
CbmKFTube::z
Double_t z
Definition: CbmKFMaterial.h:92
CbmKFCone
Definition: CbmKFMaterial.h:126
CbmKFMath::intersectCone
static Bool_t intersectCone(Double_t zCone, Double_t ZCone, Double_t rCone, Double_t RCone, const Double_t x[], Double_t *z1, Double_t *z2)
ClassImp
ClassImp(CbmKFMaterial)
CbmKF.h
CbmKFTube::CbmKFTube
CbmKFTube()
Definition: CbmKFMaterial.h:79
CbmKFBox::z
Double_t z
Definition: CbmKFMaterial.h:119
CbmKFBox::dx05
Double_t dx05
Definition: CbmKFMaterial.h:119
CbmKFTrackInterface::IsElectron
virtual Bool_t IsElectron()
Mass hypothesis.
Definition: CbmKFTrackInterface.h:36
CbmKFTrackInterface::GetTrack
virtual Double_t * GetTrack()
Is it electron.
Definition: CbmKFTrackInterface.cxx:33
CbmKF::Propagate
Int_t Propagate(Double_t *T, Double_t *C, Double_t z_out, Double_t QP0)
Definition: CbmKF.cxx:554
CbmKFMaterial::ZThickness
Double_t ZThickness
Definition: CbmKFMaterial.h:30
CbmKFCone::R2
Double_t R2
Definition: CbmKFMaterial.h:132
CbmKFBox::dy05
Double_t dy05
Definition: CbmKFMaterial.h:119
CbmKFTube::KFInfo
TString KFInfo() const
Definition: CbmKFMaterial.cxx:84
CbmKF
Definition: CbmKF.h:33
CbmKFTrackInterface::GetMass
virtual Double_t GetMass()
Definition: CbmKFTrackInterface.h:35
CbmKFCone::R1
Double_t R1
Definition: CbmKFMaterial.h:132
CbmKFBox::dz
Double_t dz
Definition: CbmKFMaterial.h:119
CbmKFTube::R
Double_t R
Definition: CbmKFMaterial.h:93
CbmKFMaterial
Definition: CbmKFMaterial.h:17
CbmKFMaterial::F
Double_t F
Definition: CbmKFMaterial.h:32
CbmKFCone::r1
Double_t r1
Definition: CbmKFMaterial.h:132
CbmKFBox::IsOutside
Bool_t IsOutside(Double_t X, Double_t Y)
Definition: CbmKFMaterial.cxx:119
CbmKFMath.h
CbmKFMaterial::ID
Int_t ID
Definition: CbmKFMaterial.h:26
CbmKF::Instance
static CbmKF * Instance()
Definition: CbmKF.h:39
CbmKFBox::KFInfo
TString KFInfo() const
Definition: CbmKFMaterial.cxx:123
CbmKFWall
Definition: CbmKFMaterial.h:69
CbmKFCone::Pass
Int_t Pass(Double_t ZCross, Double_t ZThick, CbmKFTrackInterface &track, Bool_t downstream, Double_t &QP0)
Definition: CbmKFMaterial.cxx:142
CbmKFMaterial::RadLength
Double_t RadLength
Definition: CbmKFMaterial.h:31
CbmKFMaterial::KFInfo
virtual TString KFInfo() const
Definition: CbmKFMaterial.cxx:13
CbmKFMaterial::IsOutside
virtual Bool_t IsOutside(Double_t, Double_t)
Definition: CbmKFMaterial.h:34
CbmKFMaterial::ZReference
Double_t ZReference
Definition: CbmKFMaterial.h:29
CbmKFTube::dz
Double_t dz
Definition: CbmKFMaterial.h:92
CbmKFBox::x
Double_t x
Definition: CbmKFMaterial.h:119
CbmKFTube::x
Double_t x
Definition: CbmKFMaterial.h:92
CbmKFTube::r
Double_t r
Definition: CbmKFMaterial.h:93
CbmKFTrackInterface
Definition: CbmKFTrackInterface.h:26
CbmKFTube::y
Double_t y
Definition: CbmKFMaterial.h:92
CbmKFTrackInterface::GetCovMatrix
virtual Double_t * GetCovMatrix()
array[6] of track parameters(x,y,tx,ty,qp,z)
Definition: CbmKFTrackInterface.cxx:34
CbmKFTube
Definition: CbmKFMaterial.h:77
CbmKFMaterial.h
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmKFMaterial::Pass
virtual Int_t Pass(Double_t ZCross, Double_t ZThick, CbmKFTrackInterface &track, Bool_t downstream, Double_t &QP0)
Definition: CbmKFMaterial.cxx:25
fabs
friend F32vec4 fabs(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:60
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmKFCone::r2
Double_t r2
Definition: CbmKFMaterial.h:132
CbmKFMaterial::Fe
Double_t Fe
Definition: CbmKFMaterial.h:33
CbmKFBox::y
Double_t y
Definition: CbmKFMaterial.h:119
CbmKFMath::GetNoise
static Int_t GetNoise(Double_t Lrl, Double_t F, Double_t Fe, Double_t tx, Double_t ty, Double_t qp, Double_t mass, Bool_t is_electron, Bool_t downstream_direction, Double_t *Q5, Double_t *Q8, Double_t *Q9, Double_t *Ecor)
Definition: CbmKFMath.cxx:756
CbmKFBox::CbmKFBox
CbmKFBox()
Definition: CbmKFMaterial.h:106
CbmKFCone::z2
Double_t z2
Definition: CbmKFMaterial.h:131
CbmKFCone::z1
Double_t z1
Definition: CbmKFMaterial.h:131