Changeset 337 for trunk


Ignore:
Timestamp:
01/14/00 16:30:39 (25 years ago)
Author:
blanch
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Detector/Reflector/reflector.cxx

    r336 r337  
    2020//
    2121// $RCSfile: reflector.cxx,v $
    22 // $Revision: 1.3 $
    23 // $Author: harald $
    24 // $Date: 2000-01-03 12:41:26 $
     22// $Revision: 1.4 $
     23// $Author: blanch $
     24// $Date: 2000-01-14 16:30:39 $
    2525//
    2626////////////////////////////////////////////////////////////////////////
     
    34963496  float sin_iphi, cos_iphi;
    34973497  float iphi;
    3498 
    3499   // for the moment, we only simulate an uniform distribution,
    3500   // since our theta distribution in the generation of events is
    3501   // already uniform for hadrons, which are the main targets for
    3502   // using this option
    3503 
    3504   it = RandomNumber * range;
     3498  float range_aux;
     3499  int i;
     3500
     3501  //Random position of the CT. Theta distribution
     3502  //follows sin(theta) and ohi distribution is flat
     3503
     3504  range_aux=1.0-sin(M_PI/2-range);
     3505  Nit = RandomNumber * range_aux;
    35053506  ip = RandomNumber * 2.0 * M_PI;
     3507  it = M_PI/2-asin((1.0-Nit));
    35063508
    35073509  sin_theta = sin(theta);
     
    35113513  *newtheta = acos( cos_newtheta );
    35123514  sin_newtheta = sin( *newtheta );
    3513 
    3514   sin_iphi = sin(it)*sin(ip) / sin_newtheta;
    3515   cos_iphi = (( cos(it) - cos_newtheta * cos_theta ) /
    3516               ( sin_newtheta * sin_theta ));
    3517 
    3518   iphi = atan2( sin_iphi, cos_iphi );
     3515 
     3516  if(theta!=0){
     3517    sin_iphi = sin(it)*sin(ip)/sin_newtheta;
     3518    cos_iphi = ((cos(it)-cos_newtheta*cos_theta)/(sin_newtheta*sin_theta));
     3519   
     3520    iphi = atan2( sin_iphi, cos_iphi );
     3521  }
     3522  else iphi=ip;
    35193523
    35203524  *newphi = phi + iphi;
     
    35313535//
    35323536// $Log: not supported by cvs2svn $
     3537// Revision 1.4 2000/01/04 blanch
     3538// Sin(theta) distribution has been implemented in the
     3539// get_new_ct_pointing subroutine.
     3540//
     3541// Revision 1.3  2000/01/03 12:41:26  harald
     3542// There was a small mistake with +/- signs in the prevois versions. This
     3543// line was founded by Jose Carlos. His remark is following:
     3544//
     3545// Look for the comment I include here in this block: you will see that
     3546// now the following expression has a +- sign, where before it was only
     3547// + (or -, I don't remember, but only one)
     3548//
    35333549// Revision 1.2  1999/11/01 11:05:54  harald
    35343550// Small changes to comile the reflector program under linux.
Note: See TracChangeset for help on using the changeset viewer.