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