10 #include "CbmTofHit.h"
12 #include "TGeoManager.h"
199 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
213 Point vertices[2][2][2];
226 for (
int i = 0;
i < fNofTBins; ++
i)
230 void Calc(
int nofTBins = 0) {
231 fNofTBins = nofTBins;
233 if (fNofTBins) fTBins =
new TBin[fNofTBins];
235 dirWidth = {(vertices[0][0][1].
x - vertices[0][0][0].
x) / width,
236 (vertices[0][0][1].
y - vertices[0][0][0].
y) / width,
237 (vertices[0][0][1].
z - vertices[0][0][0].
z) / width};
238 dirHeight = {(vertices[0][1][0].
x - vertices[0][0][0].
x) / height,
239 (vertices[0][1][0].
y - vertices[0][0][0].
y) / height,
240 (vertices[0][1][0].
z - vertices[0][0][0].
z) / height};
241 dirThickness = {(vertices[1][0][0].
x - vertices[0][0][0].
x) / thickness,
242 (vertices[1][0][0].
y - vertices[0][0][0].
y) / thickness,
243 (vertices[1][0][0].
z - vertices[0][0][0].
z) / thickness};
255 for (
int i = 0;
i < 2; ++
i) {
258 for (
int j = 0; j < 2; ++j) {
261 for (
int k = 0; k < 2; ++k) {
264 for (
int l = 0; l < 3; ++l) {
266 int dims2[3] = {dims[0], dims[1], dims[2]};
268 edges[ind++] = {{vertices[dims[0]][dims[1]][dims[2]].
x,
269 vertices[dims[0]][dims[1]][dims[2]].
y,
270 vertices[dims[0]][dims[1]][dims[2]].
z},
271 {vertices[dims2[0]][dims2[1]][dims2[2]].
x,
272 vertices[dims2[0]][dims2[1]][dims2[2]].
y,
273 vertices[dims2[0]][dims2[1]][dims2[2]].
z}};
277 if (minX > vertices[
i][j][k].
x) minX = vertices[
i][j][k].
x;
279 if (maxX < vertices[
i][j][k].
x) maxX = vertices[
i][j][k].
x;
281 if (minY > vertices[
i][j][k].
y) minY = vertices[
i][j][k].
y;
283 if (maxY < vertices[
i][j][k].
y) maxY = vertices[
i][j][k].
y;
285 if (minZ > vertices[
i][j][k].z) minZ = vertices[
i][j][k].
z;
287 if (maxZ < vertices[
i][j][k].z) maxZ = vertices[
i][j][k].
z;
292 for (
int i = 0;
i < 3; ++
i) {
295 int dims0[3] = {0, 0, 0};
296 int dims1[3] = {0, 0, 0};
297 int dims2[3] = {0, 0, 0};
301 TMath::Sqrt((vertices[dims1[0]][dims1[1]][dims1[2]].
x
302 - vertices[dims0[0]][dims0[1]][dims0[2]].
x)
303 * (vertices[dims1[0]][dims1[1]][dims1[2]].
x
304 - vertices[dims0[0]][dims0[1]][dims0[2]].
x)
305 + (vertices[dims1[0]][dims1[1]][dims1[2]].
y
306 - vertices[dims0[0]][dims0[1]][dims0[2]].
y)
307 * (vertices[dims1[0]][dims1[1]][dims1[2]].
y
308 - vertices[dims0[0]][dims0[1]][dims0[2]].
y)
309 + (vertices[dims1[0]][dims1[1]][dims1[2]].z
310 - vertices[dims0[0]][dims0[1]][dims0[2]].z)
311 * (vertices[dims1[0]][dims1[1]][dims1[2]].z
312 - vertices[dims0[0]][dims0[1]][dims0[2]].z));
313 double cosX1 = (vertices[dims1[0]][dims1[1]][dims1[2]].
x
314 - vertices[dims0[0]][dims0[1]][dims0[2]].
x)
316 double cosY1 = (vertices[dims1[0]][dims1[1]][dims1[2]].
y
317 - vertices[dims0[0]][dims0[1]][dims0[2]].
y)
319 double cosZ1 = (vertices[dims1[0]][dims1[1]][dims1[2]].
z
320 - vertices[dims0[0]][dims0[1]][dims0[2]].
z)
324 TMath::Sqrt((vertices[dims2[0]][dims2[1]][dims2[2]].
x
325 - vertices[dims0[0]][dims0[1]][dims0[2]].
x)
326 * (vertices[dims2[0]][dims2[1]][dims2[2]].
x
327 - vertices[dims0[0]][dims0[1]][dims0[2]].
x)
328 + (vertices[dims2[0]][dims2[1]][dims2[2]].
y
329 - vertices[dims0[0]][dims0[1]][dims0[2]].
y)
330 * (vertices[dims2[0]][dims2[1]][dims2[2]].
y
331 - vertices[dims0[0]][dims0[1]][dims0[2]].
y)
332 + (vertices[dims2[0]][dims2[1]][dims2[2]].z
333 - vertices[dims0[0]][dims0[1]][dims0[2]].z)
334 * (vertices[dims2[0]][dims2[1]][dims2[2]].z
335 - vertices[dims0[0]][dims0[1]][dims0[2]].z));
336 double cosX2 = (vertices[dims2[0]][dims2[1]][dims2[2]].
x
337 - vertices[dims0[0]][dims0[1]][dims0[2]].
x)
339 double cosY2 = (vertices[dims2[0]][dims2[1]][dims2[2]].
y
340 - vertices[dims0[0]][dims0[1]][dims0[2]].
y)
342 double cosZ2 = (vertices[dims2[0]][dims2[1]][dims2[2]].
z
343 - vertices[dims0[0]][dims0[1]][dims0[2]].
z)
346 faces[
i][0] = {{vertices[dims0[0]][dims0[1]][dims0[2]].
x,
347 vertices[dims0[0]][dims0[1]][dims0[2]].
y,
348 vertices[dims0[0]][dims0[1]][dims0[2]].
z,
361 len1 = TMath::Sqrt((vertices[dims1[0]][dims1[1]][dims1[2]].
x
362 - vertices[dims0[0]][dims0[1]][dims0[2]].
x)
363 * (vertices[dims1[0]][dims1[1]][dims1[2]].
x
364 - vertices[dims0[0]][dims0[1]][dims0[2]].
x)
365 + (vertices[dims1[0]][dims1[1]][dims1[2]].
y
366 - vertices[dims0[0]][dims0[1]][dims0[2]].
y)
367 * (vertices[dims1[0]][dims1[1]][dims1[2]].
y
368 - vertices[dims0[0]][dims0[1]][dims0[2]].
y)
369 + (vertices[dims1[0]][dims1[1]][dims1[2]].z
370 - vertices[dims0[0]][dims0[1]][dims0[2]].z)
371 * (vertices[dims1[0]][dims1[1]][dims1[2]].z
372 - vertices[dims0[0]][dims0[1]][dims0[2]].z));
373 cosX1 = (vertices[dims1[0]][dims1[1]][dims1[2]].
x
374 - vertices[dims0[0]][dims0[1]][dims0[2]].
x)
376 cosY1 = (vertices[dims1[0]][dims1[1]][dims1[2]].
y
377 - vertices[dims0[0]][dims0[1]][dims0[2]].
y)
379 cosZ1 = (vertices[dims1[0]][dims1[1]][dims1[2]].
z
380 - vertices[dims0[0]][dims0[1]][dims0[2]].
z)
383 len2 = TMath::Sqrt((vertices[dims2[0]][dims2[1]][dims2[2]].
x
384 - vertices[dims0[0]][dims0[1]][dims0[2]].
x)
385 * (vertices[dims2[0]][dims2[1]][dims2[2]].
x
386 - vertices[dims0[0]][dims0[1]][dims0[2]].
x)
387 + (vertices[dims2[0]][dims2[1]][dims2[2]].
y
388 - vertices[dims0[0]][dims0[1]][dims0[2]].
y)
389 * (vertices[dims2[0]][dims2[1]][dims2[2]].
y
390 - vertices[dims0[0]][dims0[1]][dims0[2]].
y)
391 + (vertices[dims2[0]][dims2[1]][dims2[2]].z
392 - vertices[dims0[0]][dims0[1]][dims0[2]].z)
393 * (vertices[dims2[0]][dims2[1]][dims2[2]].z
394 - vertices[dims0[0]][dims0[1]][dims0[2]].z));
395 cosX2 = (vertices[dims2[0]][dims2[1]][dims2[2]].
x
396 - vertices[dims0[0]][dims0[1]][dims0[2]].
x)
398 cosY2 = (vertices[dims2[0]][dims2[1]][dims2[2]].
y
399 - vertices[dims0[0]][dims0[1]][dims0[2]].
y)
401 cosZ2 = (vertices[dims2[0]][dims2[1]][dims2[2]].
z
402 - vertices[dims0[0]][dims0[1]][dims0[2]].
z)
405 faces[
i][1] = {{vertices[dims0[0]][dims0[1]][dims0[2]].
x,
406 vertices[dims0[0]][dims0[1]][dims0[2]].
y,
407 vertices[dims0[0]][dims0[1]][dims0[2]].
z,
420 static bool Inside(
const Cuboid& cuboid,
const Point& point) {
421 const Point& O = cuboid.vertices[0][0][0];
422 double projX = (point.
x - O.
x) * cuboid.dirWidth.cosX
423 + (point.
y - O.
y) * cuboid.dirWidth.cosY
424 + (point.
z - O.
z) * cuboid.dirWidth.cosZ;
426 if (0 > projX || projX > cuboid.width)
return false;
428 double projY = (point.
x - O.
x) * cuboid.dirHeight.cosX
429 + (point.
y - O.
y) * cuboid.dirHeight.cosY
430 + (point.
z - O.
z) * cuboid.dirHeight.cosZ;
432 if (0 > projY || projY > cuboid.height)
return false;
434 double projZ = (point.
x - O.
x) * cuboid.dirThickness.cosX
435 + (point.
y - O.
y) * cuboid.dirThickness.cosY
436 + (point.
z - O.
z) * cuboid.dirThickness.cosZ;
438 if (0 > projZ || projZ > cuboid.thickness)
return false;
443 static bool Intersect(
const Cuboid& cuboid1,
const Cuboid& cuboid2) {
445 for (
int i = 0;
i < 2; ++
i) {
446 for (
int j = 0; j < 2; ++j) {
447 for (
int k = 0; k < 2; ++k) {
448 if (Inside(cuboid1, cuboid2.vertices[
i][j][k]))
return true;
454 for (
int i = 0;
i < 2; ++
i) {
455 for (
int j = 0; j < 2; ++j) {
456 for (
int k = 0; k < 2; ++k) {
457 if (Inside(cuboid2, cuboid1.vertices[
i][j][k]))
return true;
463 for (
int i = 0;
i < 3; ++
i) {
464 for (
int j = 0; j < 2; ++j) {
467 for (
int k = 0; k < 12; ++k) {
468 const Segment& edge = cuboid2.edges[k];
470 if (Intersect(face, edge))
return true;
476 for (
int i = 0;
i < 3; ++
i) {
477 for (
int j = 0; j < 2; ++j) {
480 for (
int k = 0; k < 12; ++k) {
481 const Segment& edge = cuboid1.edges[k];
483 if (Intersect(face, edge))
return true;
490 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
493 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
494 list<Cuboid*> fCuboids;
497 for (list<Cuboid*>::iterator
i = fCuboids.begin();
i != fCuboids.end();
503 #else //CBM_GLOBALTB_TOF_3D_CUBOIDS
514 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
521 YBin(
int nofXBins,
int nofTBins)
526 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
528 #else //CBM_GLOBALTB_TOF_3D_CUBOIDS
530 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
543 ZBin(
int nofYBins,
int nofXBins,
int nofTBins)
562 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
588 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
589 for (list<Cuboid*>::iterator
i = fCuboids.begin();
i != fCuboids.end(); ++
i)
591 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
595 FindGeoChild(TGeoNode* node,
const char* name, list<TGeoNode*>& results) {
596 Int_t nofChildren = node->GetNdaughters();
598 for (Int_t
i = 0;
i < nofChildren; ++
i) {
599 TGeoNode* child = node->GetDaughter(
i);
600 TString childName(child->GetName());
602 if (childName.Contains(name, TString::kIgnoreCase))
603 results.push_back(child);
608 fC = 1.e-7 * TMath::C();
612 TGeoNavigator* pNavigator = gGeoManager->GetCurrentNavigator();
613 gGeoManager->cd(
"/cave_1");
614 list<TGeoNode*> tofNodes;
615 FindGeoChild(gGeoManager->GetCurrentNode(),
"tof", tofNodes);
617 if (tofNodes.empty())
return false;
619 TGeoNode* tofNode = tofNodes.front();
620 pNavigator->CdDown(tofNode);
622 list<TGeoNode*> tofModules;
625 for (list<TGeoNode*>::iterator
i = tofModules.begin();
i != tofModules.end();
627 TGeoNode* tofModule = *
i;
628 const char* modName = tofModule->GetName();
629 const char* firstUnd = strchr(modName,
'_');
630 const char* lastUnd = strrchr(modName,
'_');
632 if (0 == firstUnd || 0 == lastUnd)
continue;
637 pNavigator->CdDown(tofModule);
638 list<TGeoNode*> tofGasBoxes;
641 for (list<TGeoNode*>::iterator j = tofGasBoxes.begin();
642 j != tofGasBoxes.end();
644 TGeoNode* tofGasBox = *j;
645 pNavigator->CdDown(tofGasBox);
646 list<TGeoNode*> tofModuleCounters;
649 for (list<TGeoNode*>::iterator k = tofModuleCounters.begin();
650 k != tofModuleCounters.end();
652 TGeoNode* tofModuleCounter = *k;
653 const char* counterName = tofModuleCounter->GetName();
655 const char* lastUnd2 = strrchr(counterName,
'_');
657 if (0 == lastUnd2)
continue;
661 pNavigator->CdDown(tofModuleCounter);
662 TGeoVolume* tofModuleCounterVol = gGeoManager->GetCurrentVolume();
663 const TGeoBBox* tofModuleCounterShape =
664 static_cast<const TGeoBBox*
>(tofModuleCounterVol->GetShape());
665 Double_t halfwidth = tofModuleCounterShape->GetDX();
666 Double_t halfheight = tofModuleCounterShape->GetDY();
667 Double_t halfthickness = tofModuleCounterShape->GetDZ();
669 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
671 new Cuboid({2 * halfwidth, 2 * halfheight, 2 * halfthickness});
674 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
685 for (
int t = 0; t < 2; ++t)
687 for (
int h = 0;
h < 2; ++
h)
689 for (
int w = 0; w < 2; ++w)
691 Double_t localCoords[3] = {w > 0 ? halfwidth : -halfwidth,
692 h > 0 ? halfheight : -halfheight,
693 t > 0 ? halfthickness
695 Double_t globalCoords[3];
696 gGeoManager->LocalToMaster(localCoords, globalCoords);
697 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
698 cuboid->vertices[t][
h][w] = {
699 globalCoords[0], globalCoords[1], globalCoords[2]};
700 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
702 if (
fMinX > globalCoords[0])
fMinX = globalCoords[0];
704 if (
fMaxX < globalCoords[0])
fMaxX = globalCoords[0];
706 if (
fMinY > globalCoords[1])
fMinY = globalCoords[1];
708 if (
fMaxY < globalCoords[1])
fMaxY = globalCoords[1];
710 if (
fMinZ > globalCoords[2])
fMinZ = globalCoords[2];
712 if (
fMaxZ < globalCoords[2])
fMaxZ = globalCoords[2];
717 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
719 fCuboids.push_back(cuboid);
720 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
742 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
744 for (list<Cuboid*>::iterator iter = fCuboids.begin(); iter != fCuboids.end();
746 Cuboid* cuboid = *iter;
747 int zIndMin =
GetZInd(cuboid->minZ);
748 int zIndMax =
GetZInd(cuboid->maxZ);
749 int yIndMin =
GetYInd(cuboid->minY);
750 int yIndMax =
GetYInd(cuboid->maxY);
751 int xIndMin =
GetXInd(cuboid->minX);
752 int xIndMax =
GetXInd(cuboid->maxX);
754 for (
int zInd = zIndMin; zInd <= zIndMax; ++zInd) {
757 for (
int yInd = yIndMin; yInd <= yIndMax; ++yInd) {
760 for (
int xInd = xIndMin; xInd <= xIndMax; ++xInd) {
764 for (
int i = 0;
i < 2; ++
i) {
765 for (
int j = 0; j < 2; ++j) {
766 for (
int k = 0; k < 2; ++k)
775 if (Intersect(*cuboid, cuboid2)) xBin.fCuboids.push_back(cuboid);
780 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
799 int nofHits =
fTofHits->GetEntriesFast();
802 for (
int i = 0;
i < nofHits; ++
i) {
806 if (z < fMinZ || z >
fMaxZ)
continue;
812 if (y < fMinY || y >
fMaxY)
continue;
818 if (x < fMinX || x >
fMaxX)
continue;
823 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
824 if (xBin.fCuboids.empty())
continue;
825 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
829 if (t < fStartTime || t >
fEndTime)
continue;
835 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
839 for (list<Cuboid*>::iterator j = xBin.fCuboids.begin();
840 j != xBin.fCuboids.end();
844 if (mrpc->fFullModId == moduleId) {
845 mrpc->fTBins[tInd].fHitInds.push_back(
i);
849 #else //CBM_GLOBALTB_TOF_3D_CUBOIDS
852 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
871 Double_t stsTrackLength = length;
893 cbmTrackParams.
Set(trackParams, trackTime, errT);
896 &cbmTrackParams, &litTrackParams);
904 double x1 = litTrackParams.
GetX();
905 double y1 = litTrackParams.
GetY();
912 double tx = litTrackParams.
GetTx();
913 double xMax = x1 + tx * deltaZMax;
914 double ty = litTrackParams.
GetTy();
915 double yMax = y1 + ty * deltaZMax;
916 double normLen = TMath::Sqrt(1 + tx * tx + ty * ty);
918 double t1 = trackTime + (stsTrackLength + length) /
fC;
922 map<int, map<int, map<int, double>>> inds;
930 double deltaX = 4 * TMath::Sqrt(litTrackParams.
GetCovariance(0));
931 double deltaY = 4 * TMath::Sqrt(litTrackParams.
GetCovariance(6));
932 double deltaT = 4 * errT;
947 xMax = x1 + tx * (
fMaxY - y1) / ty;
953 xMax = x1 + tx * (
fMinY - y1) / ty;
958 yMax = y1 + ty * (
fMaxX - x1) / tx;
964 yMax = y1 + ty * (
fMinX - x1) / tx;
971 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
972 set<const Cuboid*> cuboidSet;
973 #else //CBM_GLOBALTB_TOF_3D_CUBOIDS
976 double deltaLength = 0;
977 Line line = {x1, y1,
z1, tx / normLen, ty / normLen, 1 / normLen};
978 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
980 set<const TBin*> neighbourhood;
985 for (
int zInd = zMinInd; zInd <= zMaxInd; ++zInd) {
989 int yIndDelta = ty < 0 ? -1 : 1;
990 double startY = y1 + (startZ -
z1) * ty;
991 double stopY = y1 + (stopZ -
z1) * ty;
992 int yStartInd =
GetYInd(startY);
995 for (
int yInd = yStartInd;
true; yInd += yIndDelta) {
1003 }
else if (0 > ty) {
1011 if (startZy < startZ) startZy = startZ;
1013 if (stopZy > stopZ) stopZy = stopZ;
1016 double startX = x1 + (startZy -
z1) * tx;
1017 double stopX = x1 + (stopZy -
z1) * tx;
1021 double extLen = ((startZy + stopZy) / 2 -
z1) * normLen;
1022 double extT = t1 + extLen /
fC;
1027 if (tHighInd >= 0 || tLowInd <
fNofTBins) {
1028 if (tLowInd < 0) tLowInd = 0;
1032 double startY2 = startY < stopY ? startY - deltaY : stopY - deltaY;
1033 double stopY2 = startY < stopY ? stopY + deltaY : startY + deltaY;
1034 int yStartInd2 =
GetYInd(startY2);
1035 int yStopInd2 =
GetYInd(stopY2);
1036 double startX2 = startX < stopX ? startX - deltaX : stopX - deltaX;
1037 double stopX2 = startX < stopX ? stopX + deltaX : startX + deltaX;
1038 int xStartInd2 =
GetXInd(startX2);
1039 int xStopInd2 =
GetXInd(stopX2);
1041 for (
int yInd2 = yStartInd2; yInd2 <= yStopInd2; ++yInd2) {
1044 for (
int xInd2 = xStartInd2; xInd2 <= xStopInd2; ++xInd2) {
1047 for (
int tInd2 = tLowInd; tInd2 <= tHighInd; ++tInd2)
1048 neighbourhood.insert(&xBin2.
fTBins[tInd2]);
1053 if (yInd == yStopInd)
break;
1057 for (set<const TBin*>::const_iterator tBinIter = neighbourhood.begin();
1058 tBinIter != neighbourhood.end();
1060 const TBin* tBin = *tBinIter;
1062 for (list<Int_t>::const_iterator hitIndIter = tBin->
fHitInds.begin();
1063 hitIndIter != tBin->
fHitInds.end();
1065 Int_t hitInd = *hitIndIter;
1068 double L01Sq = (hit->
GetX() - x1) * (hit->
GetX() - x1)
1069 + (hit->
GetY() - y1) * (hit->
GetY() - y1)
1072 double L02 = (hit->
GetX() - x1) * line.
cosX
1075 double extT2 = t1 + L02 /
fC;
1089 if (chi2 < minChi2) {
1102 length += deltaLength;
1106 mergingHit, tofHitInd, &litHit);
1107 double mergingChi2 = 0;
1108 fFilter->Update(&litTrackParams, &litHit, mergingChi2);
1110 &litTrackParams, &trackParams);
1117 for (
int xInd = xStartInd;
true; xInd += xIndDelta)
1119 const XBin& xBin = yBin.fXBins[xInd];
1121 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
1122 for (list<Cuboid*>::const_iterator
i = xBin.fCuboids.begin();
i != xBin.fCuboids.end(); ++
i)
1123 cuboidSet.insert(*
i);
1124 #else //CBM_GLOBALTB_TOF_3D_CUBOIDS
1127 for (list<Int_t>::const_iterator hitIndIter = tBin.
fHitInds.begin(); hitIndIter != tBin.
fHitInds.end(); ++hitIndIter)
1129 Int_t hitInd = *hitIndIter;
1131 double L01Sq = (hit->
GetX() - x1) * (hit->
GetX() - x1) + (hit->
GetY() - y1) * (hit->
GetY() - y1) + (hit->
GetZ() -
z1) * (hit->
GetZ() -
z1);
1134 double extT2 = t1 + L02 /
fC;
1144 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
1146 if (xInd == xStopInd)
1149 #ifndef CBM_GLOBALTB_TOF_3D_CUBOIDS
1151 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS
1153 if (yInd == yStopInd)
1197 #ifdef CBM_GLOBALTB_TOF_3D_CUBOIDS
1198 if (cuboidSet.empty())
return;
1200 bool inMRPC =
false;
1201 bool inMRPCT =
false;
1204 double normLen = TMath::Sqrt(1 + tx * tx + ty * ty);
1205 Line line = {x1, y1,
z1, tx / normLen, ty / normLen, 1 / normLen};
1207 for (set<const Cuboid*>::const_iterator
i = cuboidSet.begin();
1208 i != cuboidSet.end();
1210 const Cuboid* cuboid = *
i;
1211 const Rectangle& face1 = cuboid->faces[0][0];
1212 const Rectangle& face2 = cuboid->faces[0][1];
1215 if (Intersect(face1, line, result) || Intersect(face2, line, result)) {
1217 double extT = t0 + result[2] / fC;
1218 int tInd = (extT - fStartTime) / fTBinSize;
1220 if (tInd < 0 || tInd >= fNofTBins)
continue;
1225 double extX = x1 + line.
cosX * result[2];
1226 double extY = y1 + line.
cosY * result[2];
1227 double extZ =
z1 + line.
cosZ * result[2];
1228 TBin& tBin = cuboid->fTBins[tInd];
1230 for (list<Int_t>::const_iterator hitIndIter = tBin.
fHitInds.begin();
1233 Int_t hitInd = *hitIndIter;
1235 static_cast<const CbmTofHit*
>(fTofHits->At(hitInd));
1237 (hit->
GetX() - extX) * (hit->
GetX() - extX)
1238 / (errX * errX + hit->
GetDx() * hit->
GetDx())
1239 + (hit->
GetY() - extY) * (hit->
GetY() - extY)
1240 / (errY * errY + hit->
GetDy() * hit->
GetDy())
1242 / (litTrackParams.GetTimeError() * litTrackParams.GetTimeError()
1245 if (chi2 < minChi2) {
1256 #endif //CBM_GLOBALTB_TOF_3D_CUBOIDS