Skip to content

Commit e582790

Browse files
authored
[geom] fix sign bug in TGeoTrd1::GetFittingBox
Use abs(origin[0]) when computing fitted box size. The old code could return a box that does not fit for negative x offsets.
1 parent a67b429 commit e582790

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

geom/geom/src/TGeoTrd1.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,9 @@ Int_t TGeoTrd1::GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_
585585
Double_t fx = 0.5 * (fDx1 - fDx2) / fDz;
586586
Double_t dx0 = 0.5 * (fDx1 + fDx2);
587587
Double_t z = origin[2] - dd[2];
588-
dd[0] = dx0 - fx * z - origin[0];
588+
dd[0] = dx0 - fx * z - TMath::Abs(origin[0]);
589589
z = origin[2] + dd[2];
590-
dd[0] = TMath::Min(dd[0], dx0 - fx * z - origin[0]);
590+
dd[0] = TMath::Min(dd[0], dx0 - fx * z - TMath::Abs(origin[0]));
591591
if (dd[0] < 0) {
592592
Error("GetFittingBox", "wrong matrix");
593593
return 1;

0 commit comments

Comments
 (0)