- Timestamp:
- 01/28/00 09:19:54 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/Reflector/reflector.cxx
r347 r348 20 20 // 21 21 // $RCSfile: reflector.cxx,v $ 22 // $Revision: 1. 8$22 // $Revision: 1.9 $ 23 23 // $Author: harald $ 24 // $Date: 2000-01-28 0 8:59:49$24 // $Date: 2000-01-28 09:19:54 $ 25 25 // 26 26 //////////////////////////////////////////////////////////////////////// … … 795 795 int Random_Pointing = FALSE; 796 796 797 //@: number of times a shower is going to be processed 798 int nRepeat_Random; 799 800 //@: number of times a shower is already processed 801 int nRepeated; 802 797 803 //@: maximum random pointing distance 798 804 float Random_Pointing_MaxDist; // [radians] … … 921 927 parname[0] = '\0'; 922 928 923 optarg = NULL;929 optarg = 0; 924 930 while ( !errflg && ((ch = getopt(argc, argv, COMMAND_LINE_OPTIONS)) != -1) ) 925 931 switch (ch) { … … 945 951 946 952 if ( strlen(parname) < 1 ) 947 readparam( NULL);953 readparam(0); 948 954 else 949 955 readparam(parname); … … 1165 1171 outputfile.write( SIGNATURE, sizeof(SIGNATURE) ); 1166 1172 1173 // get random pointing variables 1174 1175 Random_Pointing = get_random_pointing( &Random_Pointing_MaxDist ); 1176 1167 1177 // generate a sort of log information 1168 1178 1169 1179 if ( verbose >= VERBOSE_MINIMAL ) { 1180 log( SIGNATURE, "Random poi.: %f\n", Random_Pointing_MaxDist ); 1170 1181 log( SIGNATURE, "Atmospheric model: %s\n", get_atm_mod() ); 1171 1182 log( SIGNATURE, "Number of paths: %d\n", get_num_of_paths() ); … … 1177 1188 1178 1189 get_energy_cuts( &lE, &uE ); 1190 1191 // get number of times which a shower is going to be used 1192 // at different pointing directions 1193 nRepeat_Random = get_repeat_random(); 1179 1194 1180 1195 /*!@' … … 1202 1217 directory = opendir(pathname); 1203 1218 1204 if ( directory == NULL)1219 if ( directory == 0 ) 1205 1220 error( SIGNATURE, 1206 1221 "Cannot open directory %s\n", pathname ); … … 1232 1247 log(SIGNATURE, " * * * READING DATA FROM STDIN * * *\n"); 1233 1248 1234 get_stdin_files( 1249 get_stdin_files(0, lE, uE, TRUE); 1235 1250 1236 1251 } … … 1246 1261 // maximum number is not reached ) ) 1247 1262 1263 nRepeated = 0; 1264 1248 1265 while ( ( 1249 ((de = readdir( directory )) != NULL) &&1266 ((de = readdir( directory )) != 0) && 1250 1267 (num_cer_files < max_num_cer_files) 1251 1268 ) … … 1255 1272 (num_cer_files < max_num_cer_files) 1256 1273 ) ) { 1257 1274 /* 1275 // increment the number of times this files is used 1276 nRepeated++; 1277 */ 1278 1258 1279 // if Block > 0, then we wait till a file __DOIT is present 1259 1280 … … 1440 1461 1441 1462 mcevth.put_times ( stat.get_tfirst(), stat.get_tlast() ); 1442 1463 1443 1464 // get direction where the CT is pointing to 1444 1465 // (or, better, from when the shower is coming from) … … 1451 1472 1452 1473 // do we want random pointing (around shower axis) ? 1453 if ( get_random_pointing( &Random_Pointing_MaxDist )== TRUE ) {1474 if ( Random_Pointing == TRUE ) { 1454 1475 1455 1476 // we do, then get a random position … … 1986 2007 // the photon actually hit the mirror!! 1987 2008 2009 1988 2010 t = t + ((( xm[2] > 0. ) ? -1.0 : +1.0) * 1989 2011 sqrt( SQR(xm[0] - xcut[0]) + 1990 2012 SQR(xm[1] - xcut[1]) + 1991 2013 SQR(xm[2] - xcut[2]) ) / Speed_of_Light_air_cmns); 1992 1993 2014 2015 // add path from the mirror till the camera 1994 2016 1995 2017 t = t + sqrt( SQR(xcutCT[0] - xcam[0]) + … … 2212 2234 2213 2235 delete [] ct_Focal; 2214 ct_Focal = NULL;2236 ct_Focal = 0; 2215 2237 2216 2238 // delete reflectivity table … … 2221 2243 2222 2244 delete [] Reflectivity; 2223 Reflectivity = NULL;2245 Reflectivity = 0; 2224 2246 2225 2247 // delete mirrors' data table … … 2230 2252 2231 2253 delete [] ct_data; 2232 ct_data = NULL;2254 ct_data = 0; 2233 2255 } 2234 2256 //!@} … … 3492 3514 { 3493 3515 float distance; 3494 float it, ip ,Nit;3516 float it, ip; 3495 3517 float sin_theta, cos_theta; 3496 3518 float sin_newtheta, cos_newtheta; 3497 3519 float sin_iphi, cos_iphi; 3498 3520 float iphi; 3499 float range_aux; 3500 int i; 3501 3502 //Random position of the CT. It is the distance 3503 //between shower axis and CT position and its 3504 //distribution follows sin(it). 3505 3506 range_aux=1.0-sin(M_PI/2-range); 3507 Nit = RandomNumber * range_aux; 3521 3522 // for the moment, we only simulate an uniform distribution, 3523 // since our theta distribution in the generation of events is 3524 // already uniform for hadrons, which are the main targets for 3525 // using this option 3526 3527 it = RandomNumber * range; 3508 3528 ip = RandomNumber * 2.0 * M_PI; 3509 it = M_PI/2-asin((1.0-Nit)); 3510 3511 sin_theta = sin(theta); 3512 cos_theta = cos(theta); 3513 3514 cos_newtheta = cos_theta*cos(it) - sin_theta*sin(it)*cos(ip); 3515 *newtheta = acos( cos_newtheta ); 3516 sin_newtheta = sin( *newtheta ); 3517 3518 if(theta!=0){ 3519 sin_iphi = sin(it)*sin(ip)/sin_newtheta; 3520 cos_iphi = ((cos(it)-cos_newtheta*cos_theta)/(sin_newtheta*sin_theta)); 3529 3530 if ( theta == 0.0 ) { 3531 3532 *newtheta = it; 3533 *newphi = ip; 3534 3535 } else { 3536 3537 sin_theta = sin(theta); 3538 cos_theta = cos(theta); 3539 3540 cos_newtheta = cos_theta*cos(it) + sin_theta*sin(it)*cos(ip); 3541 *newtheta = acos( cos_newtheta ); 3542 sin_newtheta = sin( *newtheta ); 3543 3544 sin_iphi = sin(it)*sin(ip) / sin_newtheta; 3545 cos_iphi = (( cos(it) - cos_newtheta * cos_theta ) / 3546 ( sin_newtheta * sin_theta )); 3521 3547 3522 3548 iphi = atan2( sin_iphi, cos_iphi ); 3549 3550 *newphi = phi + iphi; 3551 3523 3552 } 3524 else iphi=ip;3525 3526 *newphi = phi + iphi;3527 3553 3528 3554 return( it ); … … 3536 3562 //!@{ 3537 3563 // 3538 // Revision 1.3 2000/01/03 12:41:26 harald 3539 // There was a small mistake with +/- signs in the prevois versions. This 3540 // line was founded by Jose Carlos. His remark is following: 3541 // 3542 // Look for the comment I include here in this block: you will see that 3543 // now the following expression has a +- sign, where before it was only 3544 // + (or -, I don't remember, but only one) 3545 // 3546 // Revision 1.2 1999/11/01 11:05:54 harald 3547 // Small changes to comile the reflector program under linux. 3548 // (Different use of NULL on DECalphas-osf1 and on linux) 3549 // 3550 // Revision 1.1.1.1 1999/10/29 07:00:33 harald 3551 // This is the startpoint for the futher development of the Reflector program 3552 // of Jose Carlos. For all developments use this CVS-controlled directory. 3564 // $Log: not supported by cvs2svn $ 3565 // Revision 1.20 2000/01/27 10:47:54 gonzalez 3566 // JAN2000-STABLE 3567 // 3568 // Revision 1.19 1999/11/19 20:52:31 gonzalez 3569 // *** empty log message *** 3553 3570 // 3554 3571 // Revision 1.18 1999/10/05 11:11:12 gonzalez
Note:
See TracChangeset
for help on using the changeset viewer.