Changeset 19917 for trunk/Mars/msimreflector
- Timestamp:
- 12/17/19 17:26:49 (5 years ago)
- Location:
- trunk/Mars/msimreflector
- Files:
-
- 2 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 // -
trunk/Mars/msimreflector/MSimRays.h
r19599 r19917 7 7 8 8 class MParList; 9 class MSpline3; 9 10 class MGeomCam; 10 11 class MPointingPos; … … 28 29 Double_t fWavelengthMax; 29 30 31 MSpline3 *fRandomDist; //! 32 30 33 TString fNameReflector; 31 34 TString fNamePointPos; … … 41 44 public: 42 45 MSimRays(const char *name=NULL, const char *title=NULL); 46 ~MSimRays(); 43 47 44 48 void SetNameReflector(const char *name="MReflector") { fNameReflector = name; } … … 50 54 51 55 void SetWavelengthRange(Double_t min, Double_t max) { fWavelengthMin = min; fWavelengthMax = max; } 56 void SetDistribution(const MSpline3 &s); 57 bool ReadDistribution(const char *filename, const char *fmt="%lg %lg"); 52 58 53 59 // MSimRays
Note:
See TracChangeset
for help on using the changeset viewer.