Changeset 9565 for trunk/MagicSoft/Mars/msimreflector
- Timestamp:
- 03/30/10 14:47:27 (15 years ago)
- Location:
- trunk/MagicSoft/Mars/msimreflector
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msimreflector/MMirror.cc
r9371 r9565 99 99 using namespace std; 100 100 101 void MMirror::SetShape(Char_t c) 102 { 103 switch (toupper(c)) 104 { 105 case 'S': 106 fShape = 0; 107 break; 108 109 case 'P': 110 fShape = 1; 111 break; 112 113 default: 114 fShape = 0; 115 } 116 } 117 101 118 // -------------------------------------------------------------------------- 102 119 // -
trunk/MagicSoft/Mars/msimreflector/MMirror.h
r9564 r9565 25 25 Double_t fSigmaPSF; 26 26 27 Int_t fShape; // Spherical=0, Parabolic=1 28 27 29 // MMirror *fNeighbors[964]; 28 30 29 31 public: 30 MMirror() : fSigmaPSF(-1) 32 MMirror() : fSigmaPSF(-1), fShape(0) 31 33 { 32 34 } … … 48 50 fTilt.Rotate(-n.Theta(), TVector3(-n.Y(), n.X(), 0)); 49 51 } 52 void SetShape(Char_t c); 50 53 51 54 void SetZ(Double_t z) { fPos.SetZ(z); } … … 95 98 } 96 99 */ 97 ClassDef(MMirror, 1) // Base class to describe a mirror100 ClassDef(MMirror, 2) // Base class to describe a mirror 98 101 }; 99 102 -
trunk/MagicSoft/Mars/msimreflector/MReflector.cc
r9518 r9565 162 162 atof(arr[5]->GetName())); 163 163 164 const Double_t F = atof(arr[6]->GetName()); 165 166 const TString val = arr[7]->GetName(); 164 UInt_t n = 6; 165 166 TString six = arr[n]->GetName(); 167 168 Char_t shape = 'S'; 169 if (!six.IsFloat()) 170 { 171 shape = six[0]; 172 n++; 173 } 174 175 const Double_t F = atof(arr[n++]->GetName()); 176 177 const TString val = arr[n++]->GetName(); 167 178 168 179 const Double_t psf = val.IsFloat() ? val.Atof() : -1; 169 180 170 const UInt_t n = val.IsFloat() ? 9 : 8;181 n += val.IsFloat() ? 1 : 0; 171 182 172 183 TString type = arr[n-1]->GetName(); … … 201 212 } 202 213 203 m->SetFocalLength(F);204 214 m->SetPosition(pos); 205 215 m->SetNorm(norm); 216 m->SetShape(shape); 217 m->SetFocalLength(F); 206 218 m->SetSigmaPSF(psf>=0 ? psf : defpsf); 207 219 … … 223 235 // x y z nx ny nz F [psf] Type ... 224 236 // 225 // x: x-coordinate of the mirror's center 226 // y: y-coordinate of the mirror's center 227 // z: z-coordinate of the mirror's center 228 // nx: x-component of the normal vecor in the mirror center 229 // ny: y-component of the normal vecor in the mirror center 230 // nz: z-component of the normal vecor in the mirror center 231 // F: Focal distance of a spherical mirror 232 // [psf]: This number is the psf given in the units of x,y,z and 233 // defined at the focal distance F. It can be used to overwrite 234 // the second argument given in ReadFile for individual mirrors. 235 // Type: A instance of a mirrot of the class Type MMirrorType is created 236 // (Type can be, for example, Hex for for MMirrorHex). 237 // ...: Additional arguments as defined in MMirrorType::ReadM 237 // x: x-coordinate of the mirror's center 238 // y: y-coordinate of the mirror's center 239 // z: z-coordinate of the mirror's center 240 // nx: x-component of the normal vecor in the mirror center 241 // ny: y-component of the normal vecor in the mirror center 242 // nz: z-component of the normal vecor in the mirror center 243 // [shape]: S for spherical <default>, P for parabolic 244 // F: Focal distance of a spherical mirror 245 // [psf]: This number is the psf given in the units of x,y,z and 246 // defined at the focal distance F. It can be used to overwrite 247 // the second argument given in ReadFile for individual mirrors. 248 // Type: A instance of a mirrot of the class Type MMirrorType is created 249 // (Type can be, for example, Hex for for MMirrorHex). 250 // ...: Additional arguments as defined in MMirrorType::ReadM 238 251 // 239 252 // -
trunk/MagicSoft/Mars/msimreflector/MSimReflector.cc
r9564 r9565 18 18 ! Author(s): Thomas Bretz, 1/2009 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: CheObs Software Development, 2000-20 0920 ! Copyright: CheObs Software Development, 2000-2010 21 21 ! 22 22 ! … … 33 33 // obsolete except they can later be "moved" inside the detector, e.g. 34 34 // if you use MSimPSF to emulate a PSF by moving photons randomly 35 // on the focal plane. 35 // on the focal plane. To switch off this check set detector margin to -1. 36 36 // 37 37 ////////////////////////////////////////////////////////////////////////////// … … 206 206 // Focal length: F=R/2 | Focal length: F = 1/4p 207 207 // | 208 // r^2 + (z-2*F)^2 = (2*F)^2 | z = F/4*r^2208 // r^2 + (z-2*F)^2 = (2*F)^2 | z = r^2/4F 209 209 // | 210 210 // z = -sqrt(4*F*F - r*r) + 2*F | 211 211 // z-2*F = -sqrt(4*F*F - r*r) | 212 212 // (z-2*F)^2 = 4*F*F - r*r | 213 // z^2-4*F*z+4*F^2 = 4*F*F - r*r (4F^2-r^2>0) | z - F/4*r^2= 0213 // z^2-4*F*z+4*F^2 = 4*F*F - r*r (4F^2-r^2>0) | z - r^2/4F = 0 214 214 // z^2-4*F*z+r^2 = 0 215 215 // … … 223 223 // ------------------ 224 224 // 225 // z^2*(1+|v|^2) - 2*z*(2*F+q*v) + |q|^2 = 0 | z^2*|v|^2 - 2* (2/F+q*v)*z+ |q|^2 = 0225 // z^2*(1+|v|^2) - 2*z*(2*F+q*v) + |q|^2 = 0 | z^2*|v|^2 - 2*z*(2*F+q*v) + |q|^2 = 0 226 226 // 227 227 // z = (-b +- sqrt(b*b - 4ac))/(2*a) 228 228 // 229 229 // a = 1+|v|^2 | a = |v|^2 230 // b = - 2* (2*F+q*v) | b = - 2*(2/F+q*v)230 // b = - 2*b' with b' = 2*F+q*v | b = - 2*b' with b' = 2*F+q*v 231 231 // c = |q|^2 | c = |q|^2 232 232 // | … … 234 234 // substitute b := 2*b' 235 235 // 236 // z = ( -2*b' +- 2*sqrt(b'*b' - ac))/(2*a)237 // z = ( -b' +- sqrt(b'*b' - ac))/a238 // z = ( -b'/a +- sqrt(b'*b' - ac))/a236 // z = (2*b' +- 2*sqrt(b'*b' - ac))/(2*a) 237 // z = ( b' +- sqrt(b'*b' - ac))/a 238 // z = (b'/a +- sqrt(b'*b' - ac))/a 239 239 // 240 240 // substitute f := b'/a 241 241 // 242 // z = (-f +- sqrt(f^2 - c/a)242 // z = f +- sqrt(f^2 - c/a) 243 243 // 244 244 // ======================================================================================= … … 265 265 266 266 // Find the incident point of the vector to the mirror 267 // u corresponds to downwa qrd going particles, thus we use -u here267 // u corresponds to downward going particles, thus we use -u here 268 268 const Double_t b = G - q*v; 269 269 const Double_t a = v.Mod2(); … … 271 271 272 272 // Solution for q spherical (a+1) (parabolic mirror (a) instead of (a+1)) 273 const Double_t f = b/(a+1); 274 const Double_t g = c/(a+1); 273 const Double_t A = fShape ? a : a+1; 274 275 const Double_t f = b/A; 276 const Double_t g = c/A; 275 277 276 278 // Solution of second order polynomial (transformed: a>0) 277 279 // (The second solution can be omitted, it is the intersection 278 280 // with the upper part of the sphere) 279 // const Double_t dz = a==0 ? c/(2*b) : f - TMath::Sqrt(f*f - g); 280 const Double_t z = f - TMath::Sqrt(f*f - g); 281 const Double_t z = a==0 ? c/(2*b) : f - TMath::Sqrt(f*f - g); 281 282 282 283 // Move the photon along its trajectory to the x/y plane of the … … 293 294 294 295 // Get normal vector for reflection by calculating the derivatives 295 // of a spherical mirror along x and y 296 const Double_t d = TMath::Sqrt(G*G - p.R2()); 297 298 // This is a normal vector at the incident point 296 // of a the mirror's surface along x and y 297 const Double_t d = fShape ? G : TMath::Sqrt(G*G - p.R2()); 298 299 // The solution for the normal vector is 300 // TVector3 n(-p.X()/d, -p.Y()/d, 1)); 301 // Since the normal vector doesn't need to be of normal 302 // length we can avoid an obsolete division 299 303 TVector3 n(p.X(), p.Y(), -d); 300 // This is the obvious solution for the normal vector301 // TVector3 n(-p.X()/d, -p.Y()/d, 1));302 304 303 305 if (fSigmaPSF>0) … … 540 542 // It is detector specific not reflector specific 541 543 // Discard all photons which definitly can not hit the detector surface 542 if ( !fGeomCam->HitDetector(p, fDetectorMargin))544 if (fDetectorMargin>=0 && !fGeomCam->HitDetector(p, fDetectorMargin)) 543 545 continue; 544 546 -
trunk/MagicSoft/Mars/msimreflector/MSimReflector.h
r9564 r9565 49 49 void SetNameReflector(const char *name="MReflector") { fNameReflector = name; } 50 50 51 void SetDetectorMargin(Double_t m=0) { fDetectorMargin = m; } 52 51 53 ClassDef(MSimReflector, 0) // Task to calculate reflection on a mirror 52 54 };
Note:
See TracChangeset
for help on using the changeset viewer.