122 FairRunAna* Run = FairRunAna::Instance();
126 cout <<
"KALMAN FILTER : === INIT MAGNETIC FIELD ===" << endl;
132 cout <<
"Magnetic field done" << endl;
136 cout <<
"No Magnetic Field Found" << endl;
144 if (!pRecoSetupManager->IsInitialized()) {
155 assert(mvdStationPar);
156 const auto* mvdInterface = pRecoSetupManager->GetSetup().GetMvd();
157 if (mvdInterface ==
nullptr) {
158 cout <<
"KF: Warning - there is an MvdDigi branch, but no MVD tracking interface" << endl;
163 cout <<
"KALMAN FILTER : === READ MVD MATERIAL ===" << endl;
166 int NStations = mvdInterface->GetNofTrackingStations();
167 cout <<
"KF: MVD contains " << NStations <<
" stations";
169 for (
Int_t ist = 0; ist < NStations; ist++) {
172 const auto& vol = mvdInterface->GetFullVolume(ist);
173 tube.
ID = 1101 + ist;
175 tube.
z = vol.GetCenterZ();
176 tube.
dz = mvdStationPar->GetZThickness(ist);
178 tube.
RadLength = mvdStationPar->GetZThickness(ist) / (10. * mvdStationPar->GetZRadThickness(ist));
180 double dx = vol.GetMaxX();
181 double dy = vol.GetMaxY();
182 tube.
R =
sqrt(dx * dx + dy * dy);
183 tube.
rr = tube.
r * tube.
r;
184 tube.
RR = tube.
R * tube.
R;
192 cout <<
" Mvd material ( id, z, dz, r, R, RadL, dz/RadL )= ( " << tube.
ID <<
", " << tube.
z <<
", " << tube.
dz
204 cout <<
"KALMAN FILTER : === READ STS MATERIAL ===" << endl;
207 const auto* stsInterface = pRecoSetupManager->GetSetup().GetSts();
208 int NStations = stsInterface->GetNofTrackingStations();
210 for (
Int_t ist = 0; ist < NStations; ist++) {
214 const auto& vol = stsInterface->GetFullVolume(ist);
215 tube.
ID = 1000 + ist;
217 tube.
z = vol.GetCenterZ();
218 tube.
dz = stsStation->GetSensorD();
219 tube.
RadLength = stsStation->GetRadLength();
221 double dx = vol.GetMaxX();
222 double dy = vol.GetMaxY();
223 tube.
R =
sqrt(dx * dx + dy * dy);
224 tube.
rr = tube.
r * tube.
r;
225 tube.
RR = tube.
R * tube.
R;
233 cout <<
" Sts material ( id, z, dz, r, R, RadL, dz/RadL )= ( " << tube.
ID <<
", " << tube.
z <<
", " << tube.
dz
274 for (
unsigned i = 0; i <
vMaterial.size(); i++) {
294 TGeoNode* targetNode{
nullptr};
298 LOG(fatal) <<
"Could not find the target.";
301 Double_t local[3] = {0., 0., 0.};
303 gGeoManager->cd(targetPath);
304 gGeoManager->GetCurrentMatrix()->LocalToMaster(local, global);
305 target.x = global[0];
306 target.y = global[1];
307 target.z = global[2];
314 cout <<
"KALMAN FILTER : === READ TARGET MATERIAL ===" << endl;
315 cout <<
" found targed \"" << targetPath <<
"\" at ( " << target.x <<
" " << target.y <<
" " << target.z <<
" ) "
319 TGeoVolume* volume = targetNode->GetVolume();
321 TGeoShape*
shape = volume->GetShape();
322 if (
shape->TestShapeBit(TGeoShape::kGeoTube)) {
323 target.r =
static_cast<TGeoTube*
>(
shape)->GetRmin();
324 target.R =
static_cast<TGeoTube*
>(
shape)->GetRmax();
325 target.dz = 2. *
static_cast<TGeoTube*
>(
shape)->GetDz();
328 LOG(fatal) <<
"Only a target of a tube shape is supported";
331 TGeoMaterial* material = volume->GetMaterial();
332 Double_t radlength = material->GetRadLen();
333 target.RadLength = radlength;
336 target.rr = target.r * target.r;
337 target.RR = target.R * target.R;
338 target.ZThickness = target.dz;
339 target.ZReference = target.z;
342 LOG(info) <<
"Target info: " << target.KFInfo();
389 TString name = node->getName();
390 TString Sname = node->getShapePointer()->GetName();
391 FairGeoVector nodeV = node->getLabTransform()->getTranslation();
392 FairGeoVector centerV = node->getCenterPosition().getTranslation();
393 TArrayD* P = node->getParameters();
394 Int_t NP = node->getShapePointer()->getNumParam();
395 FairGeoMedium* material = node->getMedium();
396 material->calcRadiationLength();
398 tube.
ID = node->getMCid();
399 tube.
RadLength = material->getRadiationLength();
403 TString Mname = material->GetName();
404 if (Mname ==
"MUCHWolfram") {
407 else if (Mname ==
"MUCHiron") {
410 else if (Mname ==
"carbon") {
414 tube.
x = nodeV.X() + centerV.X();
415 tube.
y = nodeV.Y() + centerV.Y();
416 tube.
z = nodeV.Z() + centerV.Z();
425 if (Sname ==
"TUBS" || Sname ==
"TUBE") {
428 tube.
dz = 2. * P->At(2);
430 else if (Sname ==
"TRAP") {
433 tube.
dz = 2. * P->At(0);
435 else if (Sname ==
"SPHE") {
438 tube.
z += 0.5 * (P->At(0) + P->At(1));
439 tube.
dz = (P->At(1) - P->At(0));
441 else if (Sname ==
"PCON") {
442 Int_t Nz = (NP - 3) / 3;
443 double Z = -100000, R = -100000, z = 100000, r = 100000;
444 for (
Int_t i = 0; i < Nz; i++) {
445 double z1 = P->At(3 + i * 3 + 0);
446 double r1 = P->At(3 + i * 3 + 1);
447 double R1 = P->At(3 + i * 3 + 2);
464 tube.
z += (z + Z) / 2.;
467 else if (Sname ==
"PGON") {
468 Int_t Nz = (NP - 4) / 3;
469 double Z = -100000, R = -100000, z = 100000, r = 100000;
470 for (
Int_t i = 0; i < Nz; i++) {
471 double z1 = P->At(4 + i * 3 + 0);
472 double r1 = P->At(4 + i * 3 + 1);
473 double R1 = P->At(4 + i * 3 + 2);
489 tube.
z += (z + Z) / 2.;
492 else if (Sname ==
"BOX ") {
493 double dx = 2 * P->At(0);
494 double dy = 2 * P->At(1);
495 double dz = 2 * P->At(2);
497 tube.
R = TMath::Sqrt(dx * dx + dy * dy);
501 cout <<
" -E- unknown shape : " << Sname << endl;
502 cout <<
" -E- It does not make sense to go on" << endl;
503 cout <<
" -E- Stop execution here" << endl;
504 Fatal(
"CbmKF::ReadTube",
"Unknown Shape");
506 tube.
rr = tube.
r * tube.
r;
507 tube.
RR = tube.
R * tube.
R;
521 TString name = node->getName();
522 TString Sname = node->getShapePointer()->GetName();
524 FairGeoTransform trans(*node->getLabTransform());
525 FairGeoNode* nxt = node;
526 while ((nxt = nxt->getMotherNode())) {
527 FairGeoTransform* tm = nxt->getLabTransform();
531 trans.transFrom(*tm);
537 FairGeoVector nodeV = trans.getTranslation();
538 FairGeoVector centerV = nodeV + node->getCenterPosition().getTranslation();
540 TArrayD* P = node->getParameters();
541 Int_t NP = node->getShapePointer()->getNumParam();
542 FairGeoMedium* material = node->getMedium();
543 material->calcRadiationLength();
546 Double_t RadLength = material->getRadiationLength();
548 Double_t x0 = centerV.X();
549 Double_t y0 = centerV.Y();
550 Double_t z0 = centerV.Z();
554 if (Sname ==
"TUBS" || Sname ==
"TUBE") {
555 CbmKFTube tube(
ID, x0, y0, z0, 2. * P->At(2), P->At(0), P->At(1), RadLength);
559 else if (Sname ==
"SPHE") {
560 CbmKFTube tube(
ID, x0, y0, z0 + 0.5 * (P->At(0) + P->At(1)), (P->At(1) - P->At(0)), 0, 1000, RadLength);
564 else if (Sname ==
"PCON") {
565 Int_t Nz = (NP - 3) / 3;
566 double Z = -100000, R = -100000, z = 100000, r = 100000;
567 for (
Int_t i = 0; i < Nz; i++) {
568 double z1 = P->At(3 + i * 3 + 0);
569 double r1 = P->At(3 + i * 3 + 1);
570 double R1 = P->At(3 + i * 3 + 2);
584 CbmKFTube tube(
ID, x0, y0, z0 + 0.5 * (z + Z), (Z - z), r, R, RadLength);
588 else if (Sname ==
"PGON") {
589 Int_t Nz = (NP - 4) / 3;
590 double Z = -100000, R = -100000, z = 100000, r = 100000;
591 for (
Int_t i = 0; i < Nz; i++) {
592 double z1 = P->At(4 + i * 3 + 0);
593 double r1 = P->At(4 + i * 3 + 1);
594 double R1 = P->At(4 + i * 3 + 2);
608 CbmKFTube tube(
ID, x0, y0, z0 + 0.5 * (z + Z), (Z - z), r, R, RadLength);
612 else if (Sname ==
"BOX ") {
613 CbmKFBox box(
ID, x0, y0, z0, 2 * P->At(0), 2 * P->At(1), 2 * P->At(2), RadLength);
617 else if (Sname ==
"TRAP") {
618 int np = node->getNumPoints();
619 FairGeoVector vMin = *node->getPoint(0), vMax = vMin;
620 for (
int i = 0; i < np; i++) {
621 FairGeoVector*
v = node->getPoint(i);
622 for (
int j = 0; j < 3; j++) {
623 if (vMin(j) > (*
v)(j)) {
624 (&vMin.X())[j] = (*v)(j);
626 if (vMax(j) < (*
v)(j)) {
627 (&vMax.X())[j] = (*v)(j);
631 FairGeoVector v0 = (vMin + vMax);
633 FairGeoVector dv = vMax - vMin;
635 CbmKFBox box(
ID, x0 + v0(0), y0 + v0(1), z0 + v0(2), dv(0), dv(1), dv(2), RadLength);
640 cout <<
" -E- unknown shape : " << Sname << endl;
641 cout <<
" -E- It does not make sense to go on" << endl;
642 cout <<
" -E- Stop execution here" << endl;
643 Fatal(
"CbmKF::ReadPassive",
"Unknown Shape");