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";
128 FairRunAna* Run = FairRunAna::Instance();
132 cout <<
"KALMAN FILTER : === INIT MAGNETIC FIELD ===" << endl;
138 cout <<
"Magnetic field done" << endl;
142 cout <<
"No Magnetic Field Found" << endl;
158 cout <<
"KALMAN FILTER : === READ MVD MATERIAL ===" << endl;
161 int NStations = mvdInterface->GetNtrackingStations();
163 for (Int_t ist = 0; ist < NStations; ist++) {
166 tube.
ID = 1101 + ist;
168 tube.
z = mvdInterface->GetZref(ist);
169 tube.
dz = mvdInterface->GetSensorThickness(ist);
171 tube.
RadLength = mvdInterface->GetRadLength(ist);
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;
185 cout <<
" Mvd material ( id, z, dz, r, R, RadL, dz/RadL )= ( " << tube.
ID <<
", " << tube.
z <<
", " << tube.
dz
196 cout <<
"KALMAN FILTER : === READ STS MATERIAL ===" << endl;
200 int NStations = stsInterface->GetNtrackingStations();
202 for (Int_t ist = 0; ist < NStations; ist++) {
205 tube.
ID = 1000 + ist;
207 tube.
z = stsInterface->GetZref(ist);
208 tube.
dz = stsInterface->GetSensorThickness(ist);
209 tube.
RadLength = stsInterface->GetRadLength(ist);
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;
223 cout <<
" Sts material ( id, z, dz, r, R, RadL, dz/RadL )= ( " << tube.
ID <<
", " << tube.
z <<
", " << tube.
dz
252 for (vector<CbmKFTube>::iterator i =
vTargets.begin(); i !=
vTargets.end(); ++i) {
264 for (
unsigned i = 0; i <
vMaterial.size(); i++) {
284 TGeoNode* targetNode{
nullptr};
288 LOG(fatal) <<
"Could not find the target.";
291 Double_t local[3] = {0., 0., 0.};
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];
304 cout <<
"KALMAN FILTER : === READ TARGET MATERIAL ===" << endl;
305 cout <<
" found targed \"" << targetPath <<
"\" at ( " << target.x <<
" " << target.y <<
" " << target.z <<
" ) "
309 TGeoVolume* volume = targetNode->GetVolume();
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();
318 LOG(fatal) <<
"Only a target of a tube shape is supported";
321 TGeoMaterial* material = volume->GetMaterial();
322 Double_t radlength = material->GetRadLen();
323 target.RadLength = radlength;
326 target.rr = target.r * target.r;
327 target.RR = target.R * target.R;
328 target.ZThickness = target.dz;
329 target.ZReference = target.z;
332 LOG(info) <<
"Target info: " << target.KFInfo();
379 TString name = node->getName();
380 TString Sname = node->getShapePointer()->GetName();
381 FairGeoVector nodeV = node->getLabTransform()->getTranslation();
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();
388 tube.
ID = node->getMCid();
389 tube.
RadLength = material->getRadiationLength();
393 TString Mname = material->GetName();
394 if (Mname ==
"MUCHWolfram") {
397 else if (Mname ==
"MUCHiron") {
400 else if (Mname ==
"carbon") {
404 tube.
x = nodeV.X() + centerV.X();
405 tube.
y = nodeV.Y() + centerV.Y();
406 tube.
z = nodeV.Z() + centerV.Z();
415 if (Sname ==
"TUBS" || Sname ==
"TUBE") {
418 tube.
dz = 2. * P->At(2);
420 else if (Sname ==
"TRAP") {
423 tube.
dz = 2. * P->At(0);
425 else if (Sname ==
"SPHE") {
428 tube.
z += 0.5 * (P->At(0) + P->At(1));
429 tube.
dz = (P->At(1) - P->At(0));
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);
454 tube.
z += (z + Z) / 2.;
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);
479 tube.
z += (z + Z) / 2.;
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);
487 tube.
R = TMath::Sqrt(dx * dx + dy * dy);
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");
496 tube.
rr = tube.
r * tube.
r;
497 tube.
RR = tube.
R * tube.
R;
511 TString name = node->getName();
512 TString Sname = node->getShapePointer()->GetName();
514 FairGeoTransform trans(*node->getLabTransform());
515 FairGeoNode* nxt = node;
516 while ((nxt = nxt->getMotherNode())) {
517 FairGeoTransform* tm = nxt->getLabTransform();
521 trans.transFrom(*tm);
527 FairGeoVector nodeV = trans.getTranslation();
528 FairGeoVector centerV = nodeV + node->getCenterPosition().getTranslation();
530 TArrayD* P = node->getParameters();
531 Int_t NP = node->getShapePointer()->getNumParam();
532 FairGeoMedium* material = node->getMedium();
533 material->calcRadiationLength();
535 Int_t
ID = node->getMCid();
536 Double_t RadLength = material->getRadiationLength();
538 Double_t x0 = centerV.X();
539 Double_t y0 = centerV.Y();
540 Double_t z0 = centerV.Z();
544 if (Sname ==
"TUBS" || Sname ==
"TUBE") {
545 CbmKFTube tube(
ID, x0, y0, z0, 2. * P->At(2), P->At(0), P->At(1), RadLength);
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);
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);
574 CbmKFTube tube(
ID, x0, y0, z0 + 0.5 * (z + Z), (Z - z), r, R, RadLength);
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);
598 CbmKFTube tube(
ID, x0, y0, z0 + 0.5 * (z + Z), (Z - z), r, R, RadLength);
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);
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);
616 if (vMax(j) < (*
v)(j)) {
617 (&vMax.X())[j] = (*v)(j);
621 FairGeoVector v0 = (vMin + vMax);
623 FairGeoVector dv = vMax - vMin;
625 CbmKFBox box(
ID, x0 + v0(0), y0 + v0(1), z0 + v0(2), dv(0), dv(1), dv(2), RadLength);
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");