Changeset 19917 for trunk/Mars/msimreflector/MSimRays.cc
- Timestamp:
- 12/17/19 17:26:49 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/msimreflector/MSimRays.cc
r19788 r19917 52 52 #include "MParList.h" 53 53 54 #include "MSpline3.h" 54 55 #include "MQuaternion.h" 55 56 … … 71 72 : fEvt(0), fReflector(0), fPointPos(0), fSource(0), 72 73 fNumPhotons(1000), fHeight(-1), fWavelengthMin(-1), fWavelengthMax(-1), 73 f NameReflector("MReflector"), fNamePointPos("MPointingPos"),74 fRandomDist(0), fNameReflector("MReflector"), fNamePointPos("MPointingPos"), 74 75 fNameSource("Source") 75 76 { 76 77 fName = name ? name : "MSimRays"; 77 78 fTitle = title ? title : "Task to calculate reflection os a mirror"; 79 } 80 81 MSimRays::~MSimRays() 82 { 83 delete fRandomDist; 78 84 } 79 85 … … 234 240 dat.SetDirection(w); 235 241 236 if (fWavelengthMin>0 && fWavelengthMax>0) 237 dat.SimWavelength(fWavelengthMin, fWavelengthMax); 242 if (fRandomDist) 243 { 244 dat.SetWavelength(fRandomDist->FindX(gRandom->Uniform())); 245 } 246 else 247 { 248 if (fWavelengthMin>0 && fWavelengthMax>0) 249 dat.SimWavelength(fWavelengthMin, fWavelengthMax); 250 } 238 251 239 252 idx++; … … 247 260 } 248 261 262 void MSimRays::SetDistribution(const MSpline3 &s) 263 { 264 delete fRandomDist; 265 fRandomDist = new MSpline3(s.GetIntegralSpline()); 266 } 267 268 bool MSimRays::ReadDistribution(const char *filename, const char *fmt) 269 { 270 TGraph g(filename, fmt); 271 if (g.GetN()<2) 272 return false; 273 274 SetDistribution(MSpline3(g)); 275 return true; 276 } 277 249 278 // -------------------------------------------------------------------------- 250 279 //
Note:
See TracChangeset
for help on using the changeset viewer.