@@ -39,13 +39,12 @@ class Ray
3939{
4040
4141 public:
42- using CrossPar = std::pair<float , float >;
4342 using vecF3 = float [3 ];
4443
4544 static constexpr float InvalidT = -1e9 ;
4645 static constexpr float Tiny = 1e-9 ;
4746
48- GPUd () Ray() : mP { 0 .f }, mD { 0 .f }, mDistXY2 (0 .f), mDistXY2i (0 .f), mDistXYZ (0 .f), mXDxPlusYDy (0 .f), mXDxPlusYDyRed (0 .f), mXDxPlusYDy2 (0 .f), mR02 (0 .f), mR12 (0 .f), mCrossParams ()
47+ GPUd () Ray() : mP { 0 .f }, mD { 0 .f }, mDistXY2 (0 .f), mDistXY2i (0 .f), mDistXYZ (0 .f), mXDxPlusYDy (0 .f), mXDxPlusYDyRed (0 .f), mXDxPlusYDy2 (0 .f), mR02 (0 .f), mR12 (0 .f)
4948 {
5049 }
5150 GPUd () ~Ray () CON_DEFAULT;
@@ -56,13 +55,17 @@ class Ray
5655 GPUd () Ray(float x0, float y0, float z0, float x1, float y1, float z1);
5756
5857 GPUd () int crossLayer (const MatLayerCyl& lr);
59- GPUd () bool crossCircleR (float r2, CrossPar& cross ) const ;
58+ GPUd () bool crossCircleR (float r2, float & cross1, float & cross2 ) const ;
6059
6160 GPUd () float crossRadial (const MatLayerCyl& lr, int sliceID) const ;
6261 GPUd () float crossRadial (float cs, float sn) const ;
6362 GPUd () float crossZ (float z) const ;
6463
65- GPUd () const CrossPar& getCrossParams (int i) const { return mCrossParams [i]; }
64+ GPUd () void getCrossParams (int i, float & par1, float & par2) const
65+ {
66+ par1 = mCrossParams1 [i];
67+ par2 = mCrossParams2 [i];
68+ }
6669
6770 GPUd () void getMinMaxR2 (float & rmin2, float & rmax2) const ;
6871
@@ -81,7 +84,7 @@ class Ray
8184
8285 GPUd () float getZ (float t) const { return mP [2 ] + t * mD [2 ]; }
8386
84- GPUd () bool validateZRange (CrossPar& cpar , const MatLayerCyl& lr) const ;
87+ GPUd () bool validateZRange (float & cpar1, float & cpar2 , const MatLayerCyl& lr) const ;
8588
8689 private:
8790 vecF3 mP ; // /< entrance point
@@ -94,7 +97,8 @@ class Ray
9497 float mXDxPlusYDy2 ; // /< aux (x0*DX+y0*DY)^2
9598 float mR02 ; // /< radius^2 of mP
9699 float mR12 ; // /< radius^2 of mP1
97- std::array<CrossPar, 2 > mCrossParams ; // /< parameters of crossing the layer
100+ float mCrossParams1 [2 ]; // /< parameters of crossing the layer (first parameter)
101+ float mCrossParams2 [2 ]; // /< parameters of crossing the layer (second parameter)
98102
99103 ClassDefNV (Ray, 1 );
100104};
@@ -142,7 +146,7 @@ GPUdi() float Ray::crossRadial(float cs, float sn) const
142146}
143147
144148// ______________________________________________________
145- GPUdi () bool Ray::crossCircleR (float r2, CrossPar& cross ) const
149+ GPUdi () bool Ray::crossCircleR (float r2, float & cross1, float & cross2 ) const
146150{
147151 // calculate parameters t of intersection with circle of radius r^2
148152 // calculated as solution of equation
@@ -152,8 +156,8 @@ GPUdi() bool Ray::crossCircleR(float r2, CrossPar& cross) const
152156 if (det < 0 )
153157 return false ; // no intersection
154158 float detRed = std::sqrt (det) * mDistXY2i ;
155- cross. first = mXDxPlusYDyRed + detRed; // (-mXDxPlusYDy + det)*mDistXY2i;
156- cross. second = mXDxPlusYDyRed - detRed; // (-mXDxPlusYDy - det)*mDistXY2i;
159+ cross1 = mXDxPlusYDyRed + detRed; // (-mXDxPlusYDy + det)*mDistXY2i;
160+ cross2 = mXDxPlusYDyRed - detRed; // (-mXDxPlusYDy - det)*mDistXY2i;
157161 return true ;
158162}
159163
@@ -172,20 +176,20 @@ GPUdi() float Ray::crossZ(float z) const
172176}
173177
174178// ______________________________________________________
175- GPUdi () bool Ray::validateZRange (CrossPar& cpar , const MatLayerCyl& lr) const
179+ GPUdi () bool Ray::validateZRange (float & cpar1, float & cpar2 , const MatLayerCyl& lr) const
176180{
177181 // make sure that estimated crossing parameters are compatible
178182 // with Z coverage of the layer
179- MatLayerCyl::RangeStatus zout0 = lr.isZOutside (getZ (cpar. first )), zout1 = lr.isZOutside (getZ (cpar. second ));
183+ MatLayerCyl::RangeStatus zout0 = lr.isZOutside (getZ (cpar1 )), zout1 = lr.isZOutside (getZ (cpar2 ));
180184 if (zout0 == zout1) { // either both points outside w/o crossing or boht inside
181185 return zout0 == MatLayerCyl::Within ? true : false ;
182186 }
183187 // at least 1 point is outside, but there is a crossing
184188 if (zout0 != MatLayerCyl::Within) {
185- cpar. first = crossZ (zout0 == MatLayerCyl::Below ? lr.getZMin () : lr.getZMax ());
189+ cpar1 = crossZ (zout0 == MatLayerCyl::Below ? lr.getZMin () : lr.getZMax ());
186190 }
187191 if (zout1 != MatLayerCyl::Within) {
188- cpar. second = crossZ (zout1 == MatLayerCyl::Below ? lr.getZMin () : lr.getZMax ());
192+ cpar2 = crossZ (zout1 == MatLayerCyl::Below ? lr.getZMin () : lr.getZMax ());
189193 }
190194 return true ;
191195}
0 commit comments