63 if (nComponents > 0) {
92 if (nComponents != 0 && k != nComponents) {
98 if (nComponents == 0) {
100 ca =
new Double_t[k];
101 cz =
new Double_t[k];
102 cw =
new Double_t[k];
104 weightFac =
static_cast<Int_t
>(n / nComponents);
110 if (i < 0 || i >= nComponents) {
111 Error(
"setNComponents",
"Wrong index");
123 if (i >= 0 && i < nComponents) {
129 p[0] = p[1] = p[2] = 0.;
136 if (n != npckov && npckov > 0) {
144 ppckov =
new Double_t[npckov];
145 absco =
new Double_t[npckov];
146 effic =
new Double_t[npckov];
147 rindex =
new Double_t[npckov];
154 if (i < 0 || i >= npckov) {
155 Error(
"setNpckov",
"Wrong index");
168 if (i >= 0 && i < npckov) {
174 p[0] = p[1] = p[2] = p[3] = 0.;
182 Double_t maxDeviation,
188 sensFlag = sensitivityFlag;
192 madfld = maxDeviation;
201 params[0] = sensFlag;
220 for (Int_t ik = 0; ik < nComponents; ik++) {
223 for (Int_t i = 0; i < nComponents; i++) {
227 if (nComponents == 1) {
231 for (Int_t i = 0; i < nComponents; i++) {
235 fin >> sensFlag >> fldFlag >> fld >> epsil;
237 fin >> madfld >> maxstep >> maxde >> minstep;
248 if (n > 0 && n < (INT_MAX - 1)) {
251 for (Int_t i = 0; i < n; i++) {
252 fin >> ppckov[i] >> absco[i] >> effic[i] >> rindex[i];
260 const char* bl =
" ";
261 cout << GetName() <<
'\n' << nComponents * weightFac << bl;
262 for (Int_t ii = 0; ii < nComponents; ii++) {
263 cout << ca[ii] << bl;
265 for (Int_t j = 0; j < nComponents; j++) {
268 cout << density << bl;
269 if (nComponents < 2) {
272 for (Int_t iik = 0; iik < nComponents; iik++) {
273 cout << cw[iik] << bl;
275 cout <<
'\n' << sensFlag << bl << fldFlag << bl << fld << bl << epsil <<
'\n';
277 cout << madfld << bl << maxstep << bl << maxde << bl << minstep <<
'\n';
279 cout << npckov <<
'\n';
281 for (Int_t i = 0; i < npckov; i++) {
282 cout << ppckov[i] << bl << absco[i] << bl << effic[i] << bl << rindex[i] <<
'\n';
291 const char* bl =
" ";
292 fout << GetName() <<
'\n' << nComponents * weightFac << bl;
293 for (Int_t i = 0; i < nComponents; i++) {
296 for (Int_t j = 0; j < nComponents; j++) {
299 fout << density << bl;
300 if (nComponents < 2) {
303 for (Int_t i = 0; i < nComponents; i++) {
306 fout <<
'\n' << sensFlag << bl << fldFlag << bl << fld << bl << epsil <<
'\n';
308 fout << madfld << bl << maxstep << bl << maxde << bl << minstep <<
'\n';
310 fout << npckov <<
'\n';
312 for (Int_t i = 0; i < npckov; i++) {
313 fout << ppckov[i] << bl << absco[i] << bl << effic[i] << bl << rindex[i] <<
'\n';
327 Double_t alpha = 1 / 137.;
328 Double_t fac = .1912821;
329 Double_t z, a, w, az2, fc, y, xi, x0i, amol = 0., x0itot = 0.;
333 for (
int i = 0; i < nComponents; i++) {
334 amol += cw[i] * ca[i];
336 Error(
"calcRadiationLength()",
"amol==0 for medium %s", fName.Data());
341 for (
int i = 0; i < nComponents; i++) {
347 w = a * cw[i] / amol;
349 az2 = alpha * alpha * z * z;
350 fc = az2 * (1. / (1. + az2) + 0.20206 - 0.0369 * az2 + 0.0083 * az2 * az2 - .002F * az2 * az2 * az2);
351 y = log(183. / pow(z, 1. / 3.)) - fc;
352 xi =
static_cast<float>(log(1440. / pow(z, 2. / 3.)) / y);
353 x0i = fac * alpha / a * z * (z + xi) * y;
356 if (x0itot == 0. || density == 0.) {
357 Error(
"calcRadiationLength()",
"x0itot=0 or density=0 for medium %s", fName.Data());
360 radLen = 1 / density / x0itot;
void setNComponents(Int_t)
Bool_t setComponent(Int_t, Double_t, Double_t, Double_t w=1.)
void write(std::fstream &)
FairGeoMedium(const char *name="")
Bool_t setCerenkovPar(Int_t, Double_t, Double_t, Double_t, Double_t)
void getCerenkovPar(Int_t, Double_t *)
ClassImp(FairEventBuilder)
void getMediumPar(Double_t *)
void read(std::fstream &, Int_t autoflag)
void getComponent(Int_t, Double_t *)
Bool_t calcRadiationLength()
void setMediumPar(Int_t, Int_t, Double_t, Double_t, Double_t maxDeviation=-1., Double_t maxStep=-1., Double_t maxDE=-1., Double_t minStepDouble_t=-1.)