Ignore:
Timestamp:
03/30/10 14:47:27 (14 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/msimreflector/MSimReflector.cc

    r9564 r9565  
    1818!   Author(s): Thomas Bretz,  1/2009 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: CheObs Software Development, 2000-2009
     20!   Copyright: CheObs Software Development, 2000-2010
    2121!
    2222!
     
    3333//  obsolete except they can later be "moved" inside the detector, e.g.
    3434//  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.
    3636//
    3737//////////////////////////////////////////////////////////////////////////////
     
    206206//    Focal length: F=R/2                        |  Focal length: F = 1/4p
    207207//                                               |
    208 //   r^2 + (z-2*F)^2 = (2*F)^2                   |            z = F/4*r^2
     208//   r^2 + (z-2*F)^2 = (2*F)^2                   |           z = r^2/4F
    209209//                                               |
    210210//          z        = -sqrt(4*F*F - r*r) + 2*F  |
    211211//          z-2*F    = -sqrt(4*F*F - r*r)        |
    212212//         (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 = 0
     213//   z^2-4*F*z+4*F^2 = 4*F*F - r*r  (4F^2-r^2>0) |  z - r^2/4F = 0
    214214//   z^2-4*F*z+r^2   = 0
    215215//
     
    223223// ------------------
    224224//
    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 = 0
     225//   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
    226226//
    227227//                                   z = (-b +- sqrt(b*b - 4ac))/(2*a)
    228228//
    229229//              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
    231231//              c =   |q|^2                      |             c = |q|^2
    232232//                                               |
     
    234234//                                        substitute b := 2*b'
    235235//
    236 //                            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
     236//                            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
    239239//
    240240//                                        substitute f := b'/a
    241241//
    242 //                                      z = (-f +- sqrt(f^2 - c/a)
     242//                                      z = f +- sqrt(f^2 - c/a)
    243243//
    244244// =======================================================================================
     
    265265
    266266    // Find the incident point of the vector to the mirror
    267     // u corresponds to downwaqrd going particles, thus we use -u here
     267    // u corresponds to downward going particles, thus we use -u here
    268268    const Double_t b = G - q*v;
    269269    const Double_t a = v.Mod2();
     
    271271
    272272    // 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;
    275277
    276278    // Solution of second order polynomial (transformed: a>0)
    277279    // (The second solution can be omitted, it is the intersection
    278280    //  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);
    281282
    282283    // Move the photon along its trajectory to the x/y plane of the
     
    293294
    294295    // 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
    299303    TVector3 n(p.X(), p.Y(), -d);
    300     // This is the obvious solution for the normal vector
    301     //  TVector3 n(-p.X()/d, -p.Y()/d, 1));
    302304
    303305    if (fSigmaPSF>0)
     
    540542        // It is detector specific not reflector specific
    541543        // 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))
    543545            continue;
    544546
Note: See TracChangeset for help on using the changeset viewer.