Ignore:
Timestamp:
11/14/02 21:39:04 (22 years ago)
Author:
bigongia
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Detector/ReflectorII/ph2cph.c

    r1535 r1614  
    118118  r[0] = ph->u;
    119119  r[1] = ph->v;
    120   r[2] = (float) sqrt(1.0 - r[0]*r[0] - r[1]*r[1]);
     120
     121// AM 11/2002: fixed line below: u v are the direction cosines of the
     122// *downgoing* photon. Hence, third component must be negative!
     123// This was a serious bug affecting all versions before 0.6 (see TDAS
     124// note on Reflector program 0.6).
     125
     126  r[2] = (float) -sqrt(1.0 - r[0]*r[0] - r[1]*r[1]);
    121127
    122128  /* get photon time and production height */   
     
    494500  /*
    495501   if we still have the photon, we continue with the reflexion;       
    496    we calculate normal vector in this point
    497    (and normalize, with the sign changed)
     502   we calculate normal vector in this point and normalize:
    498503  */
    499504
    500505  rnor[0] = 2.0f*xcut[0];
    501506  rnor[1] = 2.0f*xcut[1];
    502   rnor[2] = (float) (2.0*(xcut[2] - 2.0*ct_Focal[i_mirror]));
     507  rnor[2] = (float) (2.0*(xcut[2] - 2.0*ct_data[i_mirror].f));
    503508
    504509  /* CBC */
     
    506511  /* CBC */
    507512
    508   rnorm    = -NORM( rnor );
     513// Changed AM, 11/2002: now we use the normal vector going "outwards"
     514// from inside the sphere (=removed minus sign in normalization below).
     515// It is easier to do so, since now the vector rm indicating the
     516// photon direction also goes from the front to the back of the mirror.
     517
     518  rnorm    = NORM( rnor );
    509519  rnor[0] /= rnorm;
    510520  rnor[1] /= rnorm;
     
    525535  */
    526536
    527   calpha = (float) fabs(rnor[0]*rm[0] + rnor[1]*rm[1] + rnor[2]*rm[2]);
     537// AM 11/2002: removed absolute value in scalar
     538// product below (it is now unnecessary):
     539
     540  calpha = (float) (rnor[0]*rm[0] + rnor[1]*rm[1] + rnor[2]*rm[2]);
    528541
    529542  /* CBC */
     
    532545       
    533546  /*  finally!!! we have the reflected trajectory of the photon */
     547
    534548
    535549  rrefl[0] = (float) (2.0*rnor[0]*calpha - rm[0]);
     
    633647   calculate angle of incidence between tray. and camera plane
    634648   the camera plane is
    635    0 y + 0 y + z - ct_Focal = 0 => (A,B,C,D) = (0,0,1,-ct_Focal)
     649   0 x + 0 y + z - ct_Focal_mean = 0 => (A,B,C,D) = (0,0,1,-ct_Focal_mean)
    636650   from Table 3.20 "Tasch. der Math."
    637651  */
     
    679693  /* Output */
    680694
    681 /*  cph->w   = wl;  */
    682   cph->x   = xcam[0];
    683   cph->y   = xcam[1];
     695  /* AM Nov 2002: Added one further change of coordinates so that the camera
     696   * images have the "right" orientation: they will appear as seen by an
     697   * observer on ground, standing behind the mirror dish and looking towards
     698   * the camera. Formerly cph->x and cph->y were simply xcam[0] and xcam[1].
     699   */
     700
     701  cph->x   = -xcam[1];
     702  cph->y   = -xcam[0];
     703
    684704  cph->u   = r[0];
    685705  cph->v   = r[1];
Note: See TracChangeset for help on using the changeset viewer.