Ignore:
Timestamp:
04/30/03 18:22:48 (22 years ago)
Author:
moralejo
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r2046 r2051  
    7878  float phi;                  /* angle between photon and camera plane */
    7979
    80   float a, b, c, t;           /* intermediate variables */
     80  float a, b, c, t, t1, t2;   /* intermediate variables */
    8181
    8282  float d;                    /* minimum distance trajectory-mirror center */
     
    9595
    9696  float sx, sy;
    97   float t1, t2;
    9897  float dummy = 0.;
    9998
     
    193192  applyMxV( OmegaCT, x, xCT );
    194193  applyMxV( OmegaCT, r, rCT );       
    195 
    196194
    197195  /* CBC */
     
    240238 
    241239  /*  the z coordinate is calculated */
    242  
     240
    243241  a = - SQR(rCT[0]) - SQR(rCT[1]);
    244242
     
    257255    - SQR(rCT[0])*SQR(xCT[2]) - SQR(rCT[1])*SQR(xCT[2]);
    258256
    259 
    260   if ( fabs(a) < 1.e-6 ) {
    261 
    262     /*  only one value */
    263 
    264     xcut[2] = -c / b;
     257  /* Alternative calculation (AM), same result:
     258   *
     259   * a = SQR(rCT[0])+SQR(rCT[1]);
     260   * b = 2*xCT[0]*rCT[0]+2*xCT[1]*rCT[1]-4*ct_Focal_mean*rCT[2];
     261   * c = -4*ct_Focal_mean*xCT[2]+SQR(xCT[0])+SQR(xCT[1]);
     262   */
     263
     264  if ( fabs(a) < 1.e-3 ) {   /* Changed old cut value 1e-6 AM, 04/2003 */
     265    xcut[2] = -c / b;         // Only one solution
     266
     267      /*
     268       * Alternative calculation:
     269       *  if (a < 1.e-3 )
     270       *  {
     271       *     xcut[2] = xCT[2] - c/b*rCT[2];
     272       */
    265273
    266274  } else {
     
    281289
    282290    /*  z must be the minimum of t1 and t2 */
    283          
     291
    284292    xcut[2] = (t1 < t2) ? t1 : t2;
    285293
     294    /*
     295     * Alternative calculation:
     296     *
     297     * xcut[2] = (t1 < t2) ? xCT[2]+t1*rCT[2] : xCT[2]+t2*rCT[2]; 
     298     */
    286299  }
    287300   
     
    315328    return 2;
    316329  }
    317 
    318330
    319331  /*  calculate the mirror to be used */
Note: See TracChangeset for help on using the changeset viewer.