70 cout <<
"CbmRichProjectionProducerAnalytical:: event " <<
fEventNum << endl;
79 TMatrixFSym covMat(5);
80 for (Int_t i = 0; i < 5; i++) {
81 for (Int_t j = 0; j <= i; j++) {
85 covMat(0, 0) = covMat(1, 1) = covMat(2, 2) = covMat(3, 3) = covMat(4, 4) = 1.e-4;
87 for (Int_t j = 0; j <
fTrackParams->GetEntriesFast(); j++) {
88 FairTrackParam* point = (FairTrackParam*)
fTrackParams->At(j);
89 new ((*richProj)[j]) FairTrackParam(0., 0., 0., 0., 0., 0., covMat);
92 if (point->GetX() == 0 && point->GetY() == 0 && point->GetZ() == 0 && point->GetTx() == 0 && point->GetTy() == 0)
94 if (point->GetQp() == 0)
continue;
97 TVector3 startP, momP, crossP, centerP;
100 Double_t p = 1. / TMath::Abs(point->GetQp());
102 if ((1 + point->GetTx() * point->GetTx() + point->GetTy() * point->GetTy()) > 0.)
103 pz = p / TMath::Sqrt(1 + point->GetTx() * point->GetTx() + point->GetTy() * point->GetTy());
105 cout <<
" -E- RichProjectionProducer: strange value for calculating pz: "
106 << (1 + point->GetTx() * point->GetTx() + point->GetTy() * point->GetTy()) << endl;
110 Double_t px = pz * point->GetTx();
111 Double_t py = pz * point->GetTy();
112 momP.SetXYZ(px, py, pz);
113 point->Position(startP);
114 if ((mirrorY * startP.y()) < 0) mirrorY = -mirrorY;
125 (momP.x() * (startP.x() - mirrorX) + momP.y() * (startP.y() - mirrorY) + momP.z() * (startP.z() - mirrorZ));
126 Double_t normP2 = (momP.x() * momP.x() + momP.y() * momP.y() + momP.z() * momP.z());
127 Double_t dist = (startP.x() * startP.x() + mirrorX * mirrorX + startP.y() * startP.y() + mirrorY * mirrorY
128 + startP.z() * startP.z() + mirrorZ * mirrorZ - 2 * startP.x() * mirrorX - 2 * startP.y() * mirrorY
129 - 2 * startP.z() * mirrorZ - mirrorR * mirrorR);
131 if ((RxP * RxP - normP2 * dist) > 0.) {
132 if (normP2 != 0.) rho1 = (-RxP + TMath::Sqrt(RxP * RxP - normP2 * dist)) / normP2;
133 if (normP2 == 0) cout <<
" Error in track extrapolation: momentum = 0 " << endl;
139 Double_t crossPx = startP.x() + rho1 * momP.x();
140 Double_t crossPy = startP.y() + rho1 * momP.y();
141 Double_t crossPz = startP.z() + rho1 * momP.z();
142 crossP.SetXYZ(crossPx, crossPy, crossPz);
146 if ((mirrorY * crossP.y()) < 0) {
148 RxP = (momP.x() * (startP.x() - mirrorX) + momP.y() * (startP.y() - mirrorY) + momP.z() * (startP.z() - mirrorZ));
149 normP2 = (momP.x() * momP.x() + momP.y() * momP.y() + momP.z() * momP.z());
150 dist = (startP.x() * startP.x() + mirrorX * mirrorX + startP.y() * startP.y() + mirrorY * mirrorY
151 + startP.z() * startP.z() + mirrorZ * mirrorZ - 2 * startP.x() * mirrorX - 2 * startP.y() * mirrorY
152 - 2 * startP.z() * mirrorZ - mirrorR * mirrorR);
154 if ((RxP * RxP - normP2 * dist) > 0.) {
155 if (normP2 != 0.) rho1 = (-RxP + TMath::Sqrt(RxP * RxP - normP2 * dist)) / normP2;
156 if (normP2 == 0) cout <<
" Error in track extrapolation: momentum = 0 " << endl;
162 crossPx = startP.x() + rho1 * momP.x();
163 crossPy = startP.y() + rho1 * momP.y();
164 crossPz = startP.z() + rho1 * momP.z();
165 crossP.SetXYZ(crossPx, crossPy, crossPz);
168 centerP.SetXYZ(mirrorX, mirrorY, mirrorZ);
178 TVector3 normP(crossP.x() - newCenterP.x(), crossP.y() - newCenterP.y(), crossP.z() - newCenterP.z());
180 normP = normP.Unit();
182 if ((normP.z() * momP.z()) < 0.) normP = TVector3(-1. * normP.x(), -1. * normP.y(), -1. * normP.z());
185 Double_t np = normP.x() * momP.x() + normP.y() * momP.y() + normP.z() * momP.z();
188 ref.SetXYZ(2 * np * normP.x() - momP.x(), 2 * np * normP.y() - momP.y(), 2 * np * normP.z() - momP.z());
192 TVector3 inPos(0., 0., 0.), outPos(0., 0., 0.);
210 Fatal(
"CbmRichProjectionProducerAnalytical ",
"unknown geometry type");
216 FairTrackParam richtrack(outPos.x(), outPos.y(), outPos.z(), 0., 0., 0., covMat);
217 *(FairTrackParam*) (
richProj->At(j)) = richtrack;
328 const TVector3* crossP,
const TVector3* ref,
346 Fatal(
"CbmRichProjectionProducerAnalytical::GetPmtIntersectionPointTwoWings ",
347 "Wrong geometry, this method could be used only for "
348 "CbmRichGeometryTypeTwoWings");
358 if (centerP->y() > 0) {
359 rho2 = (-TMath::Sin(pmtPhi) * (pmtPlaneX - crossP->x())
360 - TMath::Sin(pmtTheta) * TMath::Cos(pmtPhi) * (pmtPlaneY - crossP->y())
361 + TMath::Cos(pmtTheta) * TMath::Cos(pmtPhi) * (pmtPlaneZ - crossP->z()))
362 / (-TMath::Sin(pmtPhi) * ref->x() - TMath::Sin(pmtTheta) * TMath::Cos(pmtPhi) * ref->y()
363 + TMath::Cos(pmtTheta) * TMath::Cos(pmtPhi) * ref->z());
365 if (centerP->y() < 0) {
366 rho2 = (-TMath::Sin(pmtPhi) * (pmtPlaneX - crossP->x())
367 - TMath::Sin(-pmtTheta) * TMath::Cos(pmtPhi) * (-pmtPlaneY - crossP->y())
368 + TMath::Cos(-pmtTheta) * TMath::Cos(pmtPhi) * (pmtPlaneZ - crossP->z()))
369 / (-TMath::Sin(pmtPhi) * ref->x() - TMath::Sin(-pmtTheta) * TMath::Cos(pmtPhi) * ref->y()
370 + TMath::Cos(-pmtTheta) * TMath::Cos(pmtPhi) * ref->z());
374 Double_t xX = crossP->x() + ref->x() * rho2;
375 Double_t yY = crossP->y() + ref->y() * rho2;
376 Double_t zZ = crossP->z() + ref->z() * rho2;
379 if (centerP->y() > 0) {
380 rho2 = (-TMath::Sin(-pmtPhi) * (-pmtPlaneX - crossP->x())
381 - TMath::Sin(pmtTheta) * TMath::Cos(-pmtPhi) * (pmtPlaneY - crossP->y())
382 + TMath::Cos(pmtTheta) * TMath::Cos(-pmtPhi) * (pmtPlaneZ - crossP->z()))
383 / (-TMath::Sin(-pmtPhi) * ref->x() - TMath::Sin(pmtTheta) * TMath::Cos(-pmtPhi) * ref->y()
384 + TMath::Cos(pmtTheta) * TMath::Cos(-pmtPhi) * ref->z());
386 if (centerP->y() < 0) {
387 rho2 = (-TMath::Sin(-pmtPhi) * (-pmtPlaneX - crossP->x())
388 - TMath::Sin(-pmtTheta) * TMath::Cos(-pmtPhi) * (-pmtPlaneY - crossP->y())
389 + TMath::Cos(-pmtTheta) * TMath::Cos(-pmtPhi) * (pmtPlaneZ - crossP->z()))
390 / (-TMath::Sin(-pmtPhi) * ref->x() - TMath::Sin(-pmtTheta) * TMath::Cos(-pmtPhi) * ref->y()
391 + TMath::Cos(-pmtTheta) * TMath::Cos(-pmtPhi) * ref->z());
394 xX = crossP->x() + ref->x() * rho2;
395 yY = crossP->y() + ref->y() * rho2;
396 zZ = crossP->z() + ref->z() * rho2;
399 outPoint->SetXYZ(xX, yY, zZ);
404 const TVector3* ref, TVector3* outPoint)
408 Fatal(
"CbmRichProjectionProducerAnalytical::GetPmtIntersectionPointCyl ",
409 "Wrong geometry, this method could be used only for "
410 "CbmRichGeometryTypeCylindrical");
415 Double_t maxDist = 0.;
417 for (map<string, CbmRichRecGeoParPmt>::iterator it = gp->
fPmtMap.begin(); it != gp->
fPmtMap.end(); it++) {
418 Double_t pmtPlaneX = it->second.fPlaneX;
419 Double_t pmtPlaneY = it->second.fPlaneY;
420 Double_t pmtPlaneZ = it->second.fPlaneZ;
421 Double_t pmtPhi = it->second.fPhi;
422 Double_t pmtTheta = it->second.fTheta;
424 if (!(pmtPlaneX >= 0 && pmtPlaneY >= 0))
continue;
428 if (centerP->y() > 0) {
429 rho2 = (-TMath::Sin(pmtPhi) * (pmtPlaneX - crossP->x())
430 - TMath::Sin(pmtTheta) * TMath::Cos(pmtPhi) * (pmtPlaneY - crossP->y())
431 + TMath::Cos(pmtTheta) * TMath::Cos(pmtPhi) * (pmtPlaneZ - crossP->z()))
432 / (-TMath::Sin(pmtPhi) * ref->x() - TMath::Sin(pmtTheta) * TMath::Cos(pmtPhi) * ref->y()
433 + TMath::Cos(pmtTheta) * TMath::Cos(pmtPhi) * ref->z());
435 if (centerP->y() < 0) {
436 rho2 = (-TMath::Sin(pmtPhi) * (pmtPlaneX - crossP->x())
437 - TMath::Sin(-pmtTheta) * TMath::Cos(pmtPhi) * (-pmtPlaneY - crossP->y())
438 + TMath::Cos(-pmtTheta) * TMath::Cos(pmtPhi) * (pmtPlaneZ - crossP->z()))
439 / (-TMath::Sin(pmtPhi) * ref->x() - TMath::Sin(-pmtTheta) * TMath::Cos(pmtPhi) * ref->y()
440 + TMath::Cos(-pmtTheta) * TMath::Cos(pmtPhi) * ref->z());
443 Double_t cxX = crossP->x() + ref->x() * rho2;
444 Double_t cyY = crossP->y() + ref->y() * rho2;
445 Double_t czZ = crossP->z() + ref->z() * rho2;
448 if (centerP->y() > 0) {
449 rho2 = (-TMath::Sin(-pmtPhi) * (-pmtPlaneX - crossP->x())
450 - TMath::Sin(pmtTheta) * TMath::Cos(-pmtPhi) * (pmtPlaneY - crossP->y())
451 + TMath::Cos(pmtTheta) * TMath::Cos(-pmtPhi) * (pmtPlaneZ - crossP->z()))
452 / (-TMath::Sin(-pmtPhi) * ref->x() - TMath::Sin(pmtTheta) * TMath::Cos(-pmtPhi) * ref->y()
453 + TMath::Cos(pmtTheta) * TMath::Cos(-pmtPhi) * ref->z());
455 if (centerP->y() < 0) {
456 rho2 = (-TMath::Sin(-pmtPhi) * (-pmtPlaneX - crossP->x())
457 - TMath::Sin(-pmtTheta) * TMath::Cos(-pmtPhi) * (-pmtPlaneY - crossP->y())
458 + TMath::Cos(-pmtTheta) * TMath::Cos(-pmtPhi) * (pmtPlaneZ - crossP->z()))
459 / (-TMath::Sin(-pmtPhi) * ref->x() - TMath::Sin(-pmtTheta) * TMath::Cos(-pmtPhi) * ref->y()
460 + TMath::Cos(-pmtTheta) * TMath::Cos(-pmtPhi) * ref->z());
463 cxX = crossP->x() + ref->x() * rho2;
464 cyY = crossP->y() + ref->y() * rho2;
465 czZ = crossP->z() + ref->z() * rho2;
468 Double_t dP = TMath::Sqrt((crossP->x() - cxX) * (crossP->X() - cxX) + (crossP->y() - cyY) * (crossP->y() - cyY)
469 + (crossP->z() - czZ) * (crossP->Z() - czZ));
479 outPoint->SetXYZ(xX, yY, zZ);