CbmRoot
Loading...
Searching...
No Matches
CbmKF.cxx
Go to the documentation of this file.
1/* Copyright (C) 2006-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig, Sergey Gorbunov, Denis Bertini [committer] */
4
5#include "CbmKF.h"
6
7#include "CbmDefs.h"
8#include "CbmDigiManager.h"
9#include "CbmKFFieldMath.h"
10#include "CbmKFHit.h"
11#include "CbmKFMath.h"
15#include "FairBaseParSet.h"
16#include "FairField.h"
17#include "FairGeoNode.h"
18#include "FairRunAna.h"
19#include "FairRuntimeDb.h"
20#include "TGeoManager.h"
21#include "TGeoMaterial.h"
22#include "TGeoMatrix.h"
23#include "TGeoNode.h"
24#include "TGeoShape.h"
25#include "TGeoTube.h"
26#include "TGeoVolume.h"
27#include "TObjArray.h"
28#include "TString.h"
29
30#include <cmath>
31#include <iostream>
32#include <list>
33#include <map>
34#include <vector>
35
36using std::cout;
37using std::endl;
38using std::fabs;
39using std::map;
40using std::pair;
41using std::vector;
42
43
45
46 CbmKF* CbmKF::fInstance = nullptr;
47
48CbmKF::CbmKF(const char* name, Int_t iVerbose)
49 : FairTask(name, iVerbose)
50 , vMaterial()
51 ,
52
53 vMvdMaterial()
54 , vStsMaterial()
55 , vMuchMaterial()
56 , vMuchDetectors()
57 , vRichMaterial()
58 , vTrdMaterial()
59 , vTargets()
60 , vPipe()
61 ,
62
63 vPassiveTube()
64 , vPassiveWall()
65 , vPassiveBox()
66 ,
67
68 MvdStationIDMap()
69 , StsStationIDMap()
70 , TrdStationIDMap()
71 , MuchMCID2StationMap()
72 , MuchStation2MCIDMap()
73 ,
74
75 fMagneticField(nullptr)
76 , fMethod(1)
77 , fMaterialID2IndexMap()
78{
79 if (!fInstance) {
80 fInstance = this;
81 }
82}
83
84CbmKF::~CbmKF() { fInstance = nullptr; }
85
87{
88 FairRunAna* ana = FairRunAna::Instance();
89 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
90 rtdb->getContainer("FairBaseParSet");
91 rtdb->getContainer("CbmFieldPar");
92}
93
94InitStatus CbmKF::ReInit() { return Init(); }
95
96InitStatus CbmKF::Init()
97{
99 LOG(fatal)
100 << "CbmKF::Init(): CbmTrackingDetectorInterfaceInit instance was not found. Please, add it as a task to your "
101 "reco macro right before the KF and L1 tasks and after all the tasks before KF:\n"
102 << "\033[1;30mrun->AddTask(new CbmTrackingDetectorInterfaceInit());\033[0m";
103 }
104
105 fMagneticField = nullptr;
106
107 vMvdMaterial.clear();
108 vStsMaterial.clear();
109 vTrdMaterial.clear();
110 vRichMaterial.clear();
111 vMuchMaterial.clear();
112 vMuchDetectors.clear();
113 vPipe.clear();
114 vTargets.clear();
115 vPassiveTube.clear();
116 vPassiveWall.clear();
117 vPassiveBox.clear();
118 vMaterial.clear();
119
120 StsStationIDMap.clear();
121 TrdStationIDMap.clear();
122 MvdStationIDMap.clear();
123 MuchMCID2StationMap.clear();
124 MuchStation2MCIDMap.clear();
125
126 fMaterialID2IndexMap.clear();
127
128 FairRunAna* Run = FairRunAna::Instance();
129 //FairRuntimeDb *RunDB = Run->GetRuntimeDb(); (VF) not used
130
131 if (fVerbose) {
132 cout << "KALMAN FILTER : === INIT MAGNETIC FIELD ===" << endl;
133 }
134
135 fMagneticField = reinterpret_cast<FairField*>(Run->GetField());
136
137 if (fVerbose && fMagneticField) {
138 cout << "Magnetic field done" << endl;
139 }
140
141 if (!fMagneticField) {
142 cout << "No Magnetic Field Found" << endl;
143 }
144
145
147 // fill vector of material
148
149 //=== Mvd ===
150
152 digiMan->Init();
154 if (useMVD) {
155 auto mvdInterface = CbmMvdTrackingInterface::Instance();
156
157 if (fVerbose) {
158 cout << "KALMAN FILTER : === READ MVD MATERIAL ===" << endl;
159 }
160
161 int NStations = mvdInterface->GetNtrackingStations();
162
163 for (Int_t ist = 0; ist < NStations; ist++) {
164 CbmKFTube tube;
165
166 tube.ID = 1101 + ist;
167 // tube.F = 1.;
168 tube.z = mvdInterface->GetZref(ist);
169 tube.dz = mvdInterface->GetSensorThickness(ist);
170 // TODO: verify the thickness of MVD stations
171 tube.RadLength = mvdInterface->GetRadLength(ist);
172 tube.r = 0.;
173 double dx = mvdInterface->GetXmax(ist);
174 double dy = mvdInterface->GetYmax(ist);
175 tube.R = sqrt(dx * dx + dy * dy);
176 tube.rr = tube.r * tube.r;
177 tube.RR = tube.R * tube.R;
178 tube.ZThickness = tube.dz;
179 tube.ZReference = tube.z;
180
181 vMvdMaterial.push_back(tube);
182 MvdStationIDMap.insert(pair<Int_t, Int_t>(tube.ID, ist));
183
184 if (fVerbose) {
185 cout << " Mvd material ( id, z, dz, r, R, RadL, dz/RadL )= ( " << tube.ID << ", " << tube.z << ", " << tube.dz
186 << ", " << tube.r << ", " << tube.R << ", " << tube.RadLength << ", " << tube.dz / tube.RadLength << " )"
187 << endl;
188 }
189 }
190 }
191
192
193 //=== Sts stations ===
194
195 if (fVerbose) {
196 cout << "KALMAN FILTER : === READ STS MATERIAL ===" << endl;
197 }
198
199 auto stsInterface = CbmStsTrackingInterface::Instance();
200 int NStations = stsInterface->GetNtrackingStations();
201
202 for (Int_t ist = 0; ist < NStations; ist++) {
203 CbmKFTube tube;
204
205 tube.ID = 1000 + ist;
206 tube.F = 1.;
207 tube.z = stsInterface->GetZref(ist);
208 tube.dz = stsInterface->GetSensorThickness(ist);
209 tube.RadLength = stsInterface->GetRadLength(ist);
210 tube.r = 0.;
211 double dx = stsInterface->GetXmax(ist);
212 double dy = stsInterface->GetYmax(ist);
213 tube.R = sqrt(dx * dx + dy * dy);
214 tube.rr = tube.r * tube.r;
215 tube.RR = tube.R * tube.R;
216 tube.ZThickness = tube.dz;
217 tube.ZReference = tube.z;
218
219 vStsMaterial.push_back(tube);
220 StsStationIDMap.insert(pair<Int_t, Int_t>(tube.ID, ist));
221
222 if (fVerbose) {
223 cout << " Sts material ( id, z, dz, r, R, RadL, dz/RadL )= ( " << tube.ID << ", " << tube.z << ", " << tube.dz
224 << ", " << tube.r << ", " << tube.R << ", " << tube.RadLength << ", " << tube.dz / tube.RadLength << " )"
225 << endl;
226 }
227 }
228
229 // FU 05.03.2020
230 // Remove the usage of old ascii parameter containers. Since the
231 // containers were empty anyway there is no change of the behaviour
232 // The change was tested by Iour Vassiliev (see Redmine Issue #1566)
233 // and no difference of the results was seen. This at least holds for
234 // the STS/MVD system.
235
236
237 // FU 25.05.2020
238 // Reimplement initializing the target information. After shifting the
239 // target 4 cm upstream it was found that the KF package assumes the
240 // target at (0.,0.,0.). In ancient times the target information was
241 // initialized from the ascii parameter container. After the target
242 // geometry was changed to ROOT geometry the information was not
243 // initialized. Probably this never was a problem since the target was at
244 // z=0. cm anyway.
245 // Now the target information s properly initialized from the ROOT GeoManager.
246 // Fixes Redmine issues #1727 and #1718
247
249
250
251 {
252 for (vector<CbmKFTube>::iterator i = vTargets.begin(); i != vTargets.end(); ++i) {
253 vMaterial.push_back(&*i);
254 }
255
256 for (vector<CbmKFTube>::iterator i = vMvdMaterial.begin(); i != vMvdMaterial.end(); ++i) {
257 vMaterial.push_back(&*i);
258 }
259
260 for (vector<CbmKFTube>::iterator i = vStsMaterial.begin(); i != vStsMaterial.end(); ++i) {
261 vMaterial.push_back(&*i);
262 }
263 sort(vMaterial.begin(), vMaterial.end(), CbmKFMaterial::comparePDown);
264 for (unsigned i = 0; i < vMaterial.size(); i++) {
265 fMaterialID2IndexMap.insert(pair<Int_t, Int_t>(vMaterial[i]->ID, i));
266 }
267 }
268 return kSUCCESS;
269}
270
272{
273 // Loop over all nodes till a node with name "target" is found
274 // Extract the required infrmation from the node and store it in the
275 // proper structure
276 // The complete logic depends on the naming convention of the target.
277 // If the node doesn't contain the string target the procedure will fail
278
279 CbmKFTube target{};
280 target.ID = -111;
281 target.F = 1.;
282
283 TString targetPath;
284 TGeoNode* targetNode{nullptr};
285 FindTargetNode(targetPath, targetNode);
286
287 if (!targetNode) {
288 LOG(fatal) << "Could not find the target.";
289 }
290
291 Double_t local[3] = {0., 0., 0.}; // target centre, local c.s.
292 Double_t global[3]; // target centre, global c.s.
293 gGeoManager->cd(targetPath);
294 gGeoManager->GetCurrentMatrix()->LocalToMaster(local, global);
295 target.x = global[0];
296 target.y = global[1];
297 target.z = global[2];
298
299 fTargetXYZ[0] = target.x;
300 fTargetXYZ[1] = target.y;
301 fTargetXYZ[2] = target.z;
302
303 if (fVerbose) {
304 cout << "KALMAN FILTER : === READ TARGET MATERIAL ===" << endl;
305 cout << " found targed \"" << targetPath << "\" at ( " << target.x << " " << target.y << " " << target.z << " ) "
306 << endl;
307 }
308
309 TGeoVolume* volume = targetNode->GetVolume();
310
311 TGeoShape* shape = volume->GetShape();
312 if (shape->TestShapeBit(TGeoShape::kGeoTube)) {
313 target.r = static_cast<TGeoTube*>(shape)->GetRmin();
314 target.R = static_cast<TGeoTube*>(shape)->GetRmax();
315 target.dz = 2. * static_cast<TGeoTube*>(shape)->GetDz();
316 }
317 else {
318 LOG(fatal) << "Only a target of a tube shape is supported";
319 }
320
321 TGeoMaterial* material = volume->GetMaterial();
322 Double_t radlength = material->GetRadLen();
323 target.RadLength = radlength;
324 target.Fe = 0.02145;
325
326 target.rr = target.r * target.r;
327 target.RR = target.R * target.R;
328 target.ZThickness = target.dz;
329 target.ZReference = target.z;
330
331 vTargets.push_back(target);
332 LOG(info) << "Target info: " << target.KFInfo();
333}
334
335const std::array<float, 3> CbmKF::GetTargetPosition() { return fTargetXYZ; }
336
337void CbmKF::FindTargetNode(TString& targetPath, TGeoNode*& targetNode)
338{
339 if (!targetNode) { // init at the top of the tree
340 targetNode = gGeoManager->GetTopNode();
341 targetPath = "/" + TString(targetNode->GetName());
342 }
343
344 if (TString(targetNode->GetName()).Contains("target")) {
345 return;
346 }
347
348 for (Int_t iNode = 0; iNode < targetNode->GetNdaughters(); iNode++) {
349 TGeoNode* newNode = targetNode->GetDaughter(iNode);
350 TString newPath = targetPath + "/" + newNode->GetName();
351 FindTargetNode(newPath, newNode);
352 if (newNode) {
353 targetPath = newPath;
354 targetNode = newNode;
355 return;
356 }
357 }
358 targetPath = "";
359 targetNode = nullptr;
360}
361
363{
364 map<Int_t, Int_t>::iterator i = fMaterialID2IndexMap.find(uid);
365 if (i != fMaterialID2IndexMap.end()) {
366 return i->second;
367 }
368 return -1;
369}
370
371
372Int_t CbmKF::ReadTube(CbmKFTube& tube, FairGeoNode* node)
373{
374
375 if (!node) {
376 return 1;
377 }
378
379 TString name = node->getName();
380 TString Sname = node->getShapePointer()->GetName();
381 FairGeoVector nodeV = node->getLabTransform()->getTranslation(); //in cm
382 FairGeoVector centerV = node->getCenterPosition().getTranslation();
383 TArrayD* P = node->getParameters();
384 Int_t NP = node->getShapePointer()->getNumParam();
385 FairGeoMedium* material = node->getMedium();
386 material->calcRadiationLength();
387
388 tube.ID = node->getMCid();
389 tube.RadLength = material->getRadiationLength();
390 tube.F = 1.;
391
392 tube.Fe = 0.02145;
393 TString Mname = material->GetName();
394 if (Mname == "MUCHWolfram") {
395 tube.Fe = 0.009029;
396 }
397 else if (Mname == "MUCHiron") {
398 tube.Fe = 0.02219;
399 }
400 else if (Mname == "carbon") {
401 tube.Fe = 0.08043;
402 }
403
404 tube.x = nodeV.X() + centerV.X();
405 tube.y = nodeV.Y() + centerV.Y();
406 tube.z = nodeV.Z() + centerV.Z();
407 /*
408 int np = node->getNumPoints();
409 cout<<"points:"<<endl;
410 for( int i=0; i<np; i++ ){
411 FairGeoVector *v = node->getPoint(i);
412 cout<<v->X()<<" "<<v->Y()<<" "<<v->Z()<<endl;
413 }
414 */
415 if (Sname == "TUBS" || Sname == "TUBE") {
416 tube.r = P->At(0);
417 tube.R = P->At(1);
418 tube.dz = 2. * P->At(2);
419 }
420 else if (Sname == "TRAP") {
421 tube.r = 0;
422 tube.R = 1000;
423 tube.dz = 2. * P->At(0);
424 }
425 else if (Sname == "SPHE") {
426 tube.r = 0;
427 tube.R = 1000;
428 tube.z += 0.5 * (P->At(0) + P->At(1)); // inner & outer radius
429 tube.dz = (P->At(1) - P->At(0));
430 }
431 else if (Sname == "PCON") {
432 Int_t Nz = (NP - 3) / 3;
433 double Z = -100000, R = -100000, z = 100000, r = 100000;
434 for (Int_t i = 0; i < Nz; i++) {
435 double z1 = P->At(3 + i * 3 + 0);
436 double r1 = P->At(3 + i * 3 + 1);
437 double R1 = P->At(3 + i * 3 + 2);
438 if (r1 < r) {
439 r = r1;
440 }
441 if (R1 > R) {
442 R = R1;
443 }
444 if (z1 < z) {
445 z = z1;
446 }
447 if (z1 > Z) {
448 Z = z1;
449 }
450 }
451
452 tube.r = r;
453 tube.R = R;
454 tube.z += (z + Z) / 2.;
455 tube.dz = (Z - z);
456 }
457 else if (Sname == "PGON") {
458 Int_t Nz = (NP - 4) / 3;
459 double Z = -100000, R = -100000, z = 100000, r = 100000;
460 for (Int_t i = 0; i < Nz; i++) {
461 double z1 = P->At(4 + i * 3 + 0);
462 double r1 = P->At(4 + i * 3 + 1);
463 double R1 = P->At(4 + i * 3 + 2);
464 if (r1 < r) {
465 r = r1;
466 }
467 if (R1 > R) {
468 R = R1;
469 }
470 if (z1 < z) {
471 z = z1;
472 }
473 if (z1 > Z) {
474 Z = z1;
475 }
476 }
477 tube.r = r;
478 tube.R = R;
479 tube.z += (z + Z) / 2.;
480 tube.dz = (Z - z);
481 }
482 else if (Sname == "BOX ") {
483 double dx = 2 * P->At(0);
484 double dy = 2 * P->At(1);
485 double dz = 2 * P->At(2);
486 tube.r = 0;
487 tube.R = TMath::Sqrt(dx * dx + dy * dy);
488 tube.dz = dz;
489 }
490 else {
491 cout << " -E- unknown shape : " << Sname << endl;
492 cout << " -E- It does not make sense to go on" << endl;
493 cout << " -E- Stop execution here" << endl;
494 Fatal("CbmKF::ReadTube", "Unknown Shape");
495 }
496 tube.rr = tube.r * tube.r;
497 tube.RR = tube.R * tube.R;
498 tube.ZThickness = tube.dz;
499 tube.ZReference = tube.z;
500 return 0;
501}
502
503
505{
506
507 if (!node) {
508 return nullptr;
509 }
510
511 TString name = node->getName();
512 TString Sname = node->getShapePointer()->GetName();
513
514 FairGeoTransform trans(*node->getLabTransform());
515 FairGeoNode* nxt = node;
516 while ((nxt = nxt->getMotherNode())) {
517 FairGeoTransform* tm = nxt->getLabTransform();
518 if (!tm) {
519 break;
520 }
521 trans.transFrom(*tm);
522 }
523
524 //FairGeoVector nodeV = node->getLabTransform()->getTranslation(); //in cm
525 //FairGeoVector centerV = node->getCenterPosition().getTranslation();
526
527 FairGeoVector nodeV = trans.getTranslation(); //in cm
528 FairGeoVector centerV = nodeV + node->getCenterPosition().getTranslation();
529
530 TArrayD* P = node->getParameters();
531 Int_t NP = node->getShapePointer()->getNumParam();
532 FairGeoMedium* material = node->getMedium();
533 material->calcRadiationLength();
534
535 Int_t ID = node->getMCid();
536 Double_t RadLength = material->getRadiationLength();
537 // Double_t F = 1.;
538 Double_t x0 = centerV.X();
539 Double_t y0 = centerV.Y();
540 Double_t z0 = centerV.Z();
541
542 CbmKFMaterial* ret = nullptr;
543
544 if (Sname == "TUBS" || Sname == "TUBE") {
545 CbmKFTube tube(ID, x0, y0, z0, 2. * P->At(2), P->At(0), P->At(1), RadLength);
546 vPassiveTube.push_back(tube);
547 ret = &(vPassiveTube.back());
548 }
549 else if (Sname == "SPHE") {
550 CbmKFTube tube(ID, x0, y0, z0 + 0.5 * (P->At(0) + P->At(1)), (P->At(1) - P->At(0)), 0, 1000, RadLength);
551 vPassiveTube.push_back(tube);
552 ret = &(vPassiveTube.back());
553 }
554 else if (Sname == "PCON") {
555 Int_t Nz = (NP - 3) / 3;
556 double Z = -100000, R = -100000, z = 100000, r = 100000;
557 for (Int_t i = 0; i < Nz; i++) {
558 double z1 = P->At(3 + i * 3 + 0);
559 double r1 = P->At(3 + i * 3 + 1);
560 double R1 = P->At(3 + i * 3 + 2);
561 if (r1 < r) {
562 r = r1;
563 }
564 if (R1 > R) {
565 R = R1;
566 }
567 if (z1 < z) {
568 z = z1;
569 }
570 if (z1 > Z) {
571 Z = z1;
572 }
573 }
574 CbmKFTube tube(ID, x0, y0, z0 + 0.5 * (z + Z), (Z - z), r, R, RadLength);
575 vPassiveTube.push_back(tube);
576 ret = &(vPassiveTube.back());
577 }
578 else if (Sname == "PGON") {
579 Int_t Nz = (NP - 4) / 3;
580 double Z = -100000, R = -100000, z = 100000, r = 100000;
581 for (Int_t i = 0; i < Nz; i++) {
582 double z1 = P->At(4 + i * 3 + 0);
583 double r1 = P->At(4 + i * 3 + 1);
584 double R1 = P->At(4 + i * 3 + 2);
585 if (r1 < r) {
586 r = r1;
587 }
588 if (R1 > R) {
589 R = R1;
590 }
591 if (z1 < z) {
592 z = z1;
593 }
594 if (z1 > Z) {
595 Z = z1;
596 }
597 }
598 CbmKFTube tube(ID, x0, y0, z0 + 0.5 * (z + Z), (Z - z), r, R, RadLength);
599 vPassiveTube.push_back(tube);
600 ret = &(vPassiveTube.back());
601 }
602 else if (Sname == "BOX ") {
603 CbmKFBox box(ID, x0, y0, z0, 2 * P->At(0), 2 * P->At(1), 2 * P->At(2), RadLength);
604 vPassiveBox.push_back(box);
605 ret = &(vPassiveBox.back());
606 }
607 else if (Sname == "TRAP") {
608 int np = node->getNumPoints();
609 FairGeoVector vMin = *node->getPoint(0), vMax = vMin;
610 for (int i = 0; i < np; i++) {
611 FairGeoVector* v = node->getPoint(i);
612 for (int j = 0; j < 3; j++) {
613 if (vMin(j) > (*v)(j)) {
614 (&vMin.X())[j] = (*v)(j);
615 }
616 if (vMax(j) < (*v)(j)) {
617 (&vMax.X())[j] = (*v)(j);
618 }
619 }
620 }
621 FairGeoVector v0 = (vMin + vMax);
622 v0 *= .5 / 10.;
623 FairGeoVector dv = vMax - vMin;
624 dv /= 10.;
625 CbmKFBox box(ID, x0 + v0(0), y0 + v0(1), z0 + v0(2), dv(0), dv(1), dv(2), RadLength);
626 vPassiveBox.push_back(box);
627 ret = &(vPassiveBox.back());
628 }
629 else {
630 cout << " -E- unknown shape : " << Sname << endl;
631 cout << " -E- It does not make sense to go on" << endl;
632 cout << " -E- Stop execution here" << endl;
633 Fatal("CbmKF::ReadPassive", "Unknown Shape");
634 }
635 return ret;
636}
637
638
639Int_t CbmKF::Propagate(Double_t* T, Double_t* C, Double_t z_out, Double_t QP0)
640{
641 Bool_t err = 0;
642 if (fabs(T[5] - z_out) < 1.e-5) {
643 return 0;
644 }
645
646 if (!fMagneticField || (300 <= z_out && 300 <= T[5])) {
647 CbmKFFieldMath::ExtrapolateLine(T, C, T, C, z_out);
648 return 0;
649 }
650 Double_t zz = z_out;
651 if (z_out < 300. && 300 <= T[5]) {
652 CbmKFFieldMath::ExtrapolateLine(T, C, T, C, 300.);
653 }
654
655 if (T[5] < 300. && 300. < z_out) {
656 zz = 300.;
657 }
658 Bool_t repeat = 1;
659 while (!err && repeat) {
660 const Double_t max_step = 5.;
661 Double_t zzz;
662 if (fabs(T[5] - zz) > max_step) {
663 zzz = T[5] + ((zz > T[5]) ? max_step : -max_step);
664 }
665 else {
666 zzz = zz;
667 repeat = 0;
668 }
669 switch (fMethod) {
670 case 0: {
671 CbmKFFieldMath::ExtrapolateLine(T, C, T, C, zzz);
672 break;
673 }
674 case 1: {
675 err = err || CbmKFFieldMath::ExtrapolateALight(T, C, T, C, zzz, QP0, fMagneticField);
676 break;
677 }
678 case 2: {
679 err = err || CbmKFFieldMath::ExtrapolateRK4(T, C, T, C, zzz, QP0, fMagneticField);
680 break;
681 }
682 /*
683 case 3:
684 {
685 CbmKFFieldMath::ExtrapolateACentral( T, C, T, C, zzz , QP0, fMagneticField );
686 break;
687 }
688 case 4:
689 {
690 CbmKFFieldMath::ExtrapolateAnalytic( T, C, T, C, zzz , QP0, fMagneticField, 1 );
691 break;
692 }
693 case 5:
694 {
695 CbmKFFieldMath::ExtrapolateAnalytic( T, C, T, C, zzz , QP0, fMagneticField, 2 );
696 break;
697 }
698 case 6:
699 {
700 CbmKFFieldMath::ExtrapolateAnalytic( T, C, T, C, zzz , QP0, fMagneticField, 3 );
701 break;
702 }
703 */
704 }
705 }
706 if (T[5] != z_out) {
707 CbmKFFieldMath::ExtrapolateLine(T, C, T, C, z_out);
708 }
709 return err;
710}
711
712Int_t CbmKF::PassMaterial(CbmKFTrackInterface& track, Double_t& QP0, Int_t ifst, Int_t ilst)
713{
714 Bool_t downstream = (ilst > ifst);
715 Bool_t err = 0;
716 Int_t iend = downstream ? ilst + 1 : ilst - 1;
717 for (Int_t i = ifst; i != iend; downstream ? ++i : --i) {
718 err = err || vMaterial[i]->Pass(track, downstream, QP0);
719 }
720 return err;
721}
722
723Int_t CbmKF::PassMaterialBetween(CbmKFTrackInterface& track, Double_t& QP0, Int_t ifst, Int_t ilst)
724{
725 Bool_t downstream = (ilst > ifst);
726 Bool_t err = 0;
727 Int_t istart = downstream ? ifst + 1 : ifst - 1;
728 for (Int_t i = istart; i != ilst; downstream ? ++i : --i) {
729 err = err || vMaterial[i]->Pass(track, downstream, QP0);
730 }
731 return err;
732}
733
734Int_t CbmKF::PassMaterialBetween(CbmKFTrackInterface& track, Double_t& QP0, CbmKFHit* fst, CbmKFHit* lst)
735{
736 return PassMaterialBetween(track, QP0, fst->MaterialIndex, lst->MaterialIndex);
737}
ClassImp(CbmConverterManager)
@ kMvd
Micro-Vertex Detector.
friend fvec sqrt(const fvec &a)
fscal v[fmask::Size]
Definition KfSimdPseudo.h:4
CbmDigiManager.
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
InitStatus Init()
Initialisation.
static CbmDigiManager * Instance()
Static instance.
static void ExtrapolateLine(const Double_t T_in[], const Double_t C_in[], Double_t T_out[], Double_t C_out[], Double_t z_out)
static Int_t ExtrapolateRK4(const Double_t T_in[], const Double_t C_in[], Double_t T_out[], Double_t C_out[], Double_t z_out, Double_t qp0, FairField *MF)
static Int_t ExtrapolateALight(const Double_t T_in[], const Double_t C_in[], Double_t T_out[], Double_t C_out[], Double_t z_out, Double_t qp0, FairField *MF)
Int_t MaterialIndex
Definition CbmKFHit.h:26
Double_t ZReference
Double_t RadLength
static Bool_t comparePDown(const CbmKFMaterial *a, const CbmKFMaterial *b)
Double_t ZThickness
Double_t R
Double_t rr
Double_t RR
Double_t x
Double_t r
Double_t dz
Double_t y
Double_t z
Definition CbmKF.h:34
std::vector< CbmKFMaterial * > vMaterial
Definition CbmKF.h:63
Int_t fMethod
Definition CbmKF.h:100
std::vector< CbmKFWall > vTrdMaterial
Definition CbmKF.h:70
std::vector< CbmKFBox > vPassiveBox
Definition CbmKF.h:76
std::vector< CbmKFTube > vPassiveTube
Definition CbmKF.h:74
void GetTargetInfo()
Definition CbmKF.cxx:271
std::array< float, 3 > fTargetXYZ
Definition CbmKF.h:114
CbmKFMaterial * ReadPassive(FairGeoNode *node)
Definition CbmKF.cxx:504
Int_t PassMaterialBetween(CbmKFTrackInterface &track, Double_t &QP0, Int_t ifst, Int_t ilst)
Definition CbmKF.cxx:723
std::map< Int_t, Int_t > TrdStationIDMap
Definition CbmKF.h:84
std::vector< CbmKFWall > vPassiveWall
Definition CbmKF.h:75
std::map< Int_t, Int_t > MuchMCID2StationMap
Definition CbmKF.h:85
void SetParContainers()
Definition CbmKF.cxx:86
std::vector< CbmKFTube > vRichMaterial
Definition CbmKF.h:69
std::vector< CbmKFCone > vPipe
Definition CbmKF.h:72
std::vector< CbmKFTube > vMuchDetectors
Definition CbmKF.h:68
std::vector< CbmKFTube > vMvdMaterial
Definition CbmKF.h:65
Int_t GetMaterialIndex(Int_t uid)
Definition CbmKF.cxx:362
std::map< Int_t, Int_t > MuchStation2MCIDMap
Definition CbmKF.h:86
FairField * fMagneticField
Definition CbmKF.h:97
~CbmKF()
Definition CbmKF.cxx:84
std::vector< CbmKFTube > vStsMaterial
Definition CbmKF.h:66
std::map< Int_t, Int_t > StsStationIDMap
Definition CbmKF.h:83
CbmKF(const char *name="KF", Int_t iVerbose=1)
void FindTargetNode(TString &targetPath, TGeoNode *&targetNode)
Definition CbmKF.cxx:337
std::map< Int_t, Int_t > fMaterialID2IndexMap
Definition CbmKF.h:105
std::map< Int_t, Int_t > MvdStationIDMap
Definition CbmKF.h:82
std::vector< CbmKFTube > vMuchMaterial
Definition CbmKF.h:67
Int_t PassMaterial(CbmKFTrackInterface &track, Double_t &QP0, Int_t ifst, Int_t ilst)
Definition CbmKF.cxx:712
Int_t ReadTube(CbmKFTube &tube, FairGeoNode *node)
Definition CbmKF.cxx:372
const std::array< float, 3 > GetTargetPosition()
Definition CbmKF.cxx:335
InitStatus Init()
Definition CbmKF.cxx:96
std::vector< CbmKFTube > vTargets
Definition CbmKF.h:71
static CbmKF * fInstance
Definition CbmKF.h:95
Int_t Propagate(Double_t *T, Double_t *C, Double_t z_out, Double_t QP0)
Definition CbmKF.cxx:639
InitStatus ReInit()
Definition CbmKF.cxx:94
static CbmMvdTrackingInterface * Instance()
Gets pointer to the instance of the CbmMvdTrackingInterface.
static CbmStsTrackingInterface * Instance()
Gets pointer to the instance of the CbmStsTrackingInterface class.
static CbmTrackingDetectorInterfaceInit * Instance()
Returns a pointer to the class instance.