Changeset 19788 for trunk/Mars/msimreflector
- Timestamp:
- 10/24/19 17:41:01 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/msimreflector/MSimRays.cc
r19599 r19788 165 165 166 166 Double_t x, y; 167 const Double_t r = gRandom->Uniform(); 168 gRandom->Circle(x, y, maxr*TMath::Sqrt(r)); 169 /* 170 Double_t ra = gRandom->Uniform(maxr); 171 Double_t ph = gRandom->Uniform(TMath::TwoPi()); 172 173 174 // Get radom incident point on the mirror plane. 175 //const Double_t x = gRandom->Uniform(-maxr, maxr); 176 //const Double_t y = gRandom->Uniform(-maxr, maxr); 177 178 Double_t x = ra*sin(ph); 179 Double_t y = ra*cos(ph); 180 181 // if (x*x + y*y > maxr*maxr) 182 // continue; 183 */ 167 if (fHeight<0) 168 { 169 // Parallel light 170 // -------------- 171 const Double_t r = gRandom->Uniform(); 172 gRandom->Circle(x, y, maxr*TMath::Sqrt(r)); 173 } 174 else 175 { 176 // Point source 177 // ------------ 178 // Adapted from: http://mathworld.wolfram.com/SpherePointPicking.html 179 // Note that theta and phi is exchanged! 180 181 // The maximum zenith angle is theta=atan(maxr/h) 182 // cos(theta) = cos(atan(maxr/h)) = 1/sqrt(1+maxr^2/h^2) 183 const double min_cost = 1./TMath::Sqrt(1.+maxr*maxr/h/h); 184 const double cos_theta = gRandom->Uniform(min_cost, 1); 185 186 gRandom->Circle(x, y, h*TMath::Sqrt(1./cos_theta/cos_theta - 1)); 187 188 // const double cos_theta = gRandom->Uniform(ct, 1); 189 // const double sin_theta = TMath::Sqrt(1.-cos_theta*cos_theta); 190 // gRandom->Circle(x, y, h*sin_theta/cos_theta); 191 192 // Homogeneous on a sphere 193 // const double phi = TMath::TwoPi() * gRandom->Uniform(); 194 // x = sin_theta * cos(phi); 195 // y = sin_theta * sin(phi); 196 // z = cos_theta; 197 198 // Project the photons to a plane at z=1 199 // x /= cos_theta; 200 // y /= cos_theta; 201 // z /= cos_theta; // z = 1 202 203 // The radius of the sphere is h 204 // x *= h; 205 // y *= h; 206 // z *= h; // z = h 207 } 208 184 209 // The is the incident direction of the photon 185 210 // h==0 means infinitiy
Note:
See TracChangeset
for help on using the changeset viewer.