Changeset 17 in ZHANGProjects for ICOSIM/CPP/trunk/source/simcrys.cc
- Timestamp:
- Sep 30, 2014, 11:05:33 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ICOSIM/CPP/trunk/source/simcrys.cc
r16 r17 576 576 * original crystal routine 577 577 * *******************************************************************************/ 578 void SimCrys::general(SimCrys& sim, const int& pas, string outputpath, double Mirror, double C_rotation, double C_aperture, double C_offset, double C_tilt, double Crystal_tilt)578 void SimCrys::general(SimCrys& sim, const int& pas, long int& nhit, string outputpath, double Mirror, double C_rotation, double C_aperture, double C_offset, double C_tilt, double Crystal_tilt) 579 579 { 580 580 srand ( time(NULL) ); … … 659 659 660 660 661 661 662 663 662 664 //----------------------------------END OF INITATING REFERNENTIAL PARAMETERS------------------------------------------------------------------------- 663 665 c_length = crys.Cry_length; … … 692 694 * xmin=x-, xmax=x+, etc. from the input file 693 695 */ 694 long int nhit = 0; 696 697 698 //initialize particle variables 699 part.n_part = 0; 700 part.nabsorbed = 0; 701 part.namor = 0; 702 part.nchann = 0; 703 part.ndechann = 0; 704 part.nout =0; 705 part.nvcapt = 0; 706 part.nvrefl = 0; 707 part.nhit = 0; 708 nhit = 0; 695 709 double fracab = 0; 696 710 // int n_chan = 0; // valentina :initialize to zero the counters for crystal effects … … 748 762 while (!entree.eof()) { 749 763 count = count + 1; 764 765 //particle hit the crystal or not 766 bool hitflag = false; 767 750 768 751 769 getline(entree, rest, ','); … … 927 945 s_impact = s_in0; //!(for the first impact) 928 946 929 if( 1){947 if(0){ 930 948 cout<<"hit the cry entrance face"<<endl; 931 949 cout<<"impact at s = "<< s_impact<< ", x = "<<x_in0<<endl; … … 1062 1080 //cout<<"----------------------1111111111111111111111111-----------------"<<endl; 1063 1081 1064 1082 if(layerflag == 0){ 1083 part.namor = part.namor + 1; /////////////COUNT///////////// 1084 part.effet = 2; 1085 } 1086 1065 1087 if (strncmp(Proc,"out",3)==0) 1066 1088 crossing = false; … … 1069 1091 1070 1092 if (crossing == true){ 1071 nhit = nhit + 1; 1093 hitflag = true; 1094 nhit = nhit + 1; 1095 part.nhit = nhit; 1072 1096 // lhit = 100000000*ie + ITURN; 1073 1097 impact = x_in0; … … 1261 1285 xp_in0 = xp_shift; 1262 1286 } ////////////////////////// fin IF NUMERO 17////////////////// 1263 1287 hitflag = true; 1264 1288 nhit = nhit + 1; 1289 part.nhit = nhit; 1265 1290 //lhit = 100000000*ie + ITURN; 1266 1291 impact = x_in0; … … 1339 1364 1340 1365 1341 nabs = 0; 1366 nabs = 0; //particle lost or not lost..... 1342 1367 part.effet = nabs; 1343 1368 //cout<< "debug - S Coll RF 2" , s_rot <<endl; … … 1375 1400 part.nvcapt = part.nvcapt + 1; /////////////COUNT///////////// 1376 1401 part.effet = 6;} 1402 if(strncmp(Proc,"absorbed",8==0)){ 1403 part.nabsorbed = part.nabsorbed +1; 1404 part.effet = 7; 1405 } 1406 /* 1407 if (PROC(1:3).eq.'pne') 1408 PROC_dan=7 1409 if (PROC(1:3).eq.'ppe') 1410 PROC_dan=8 1411 if (PROC(1:4).eq.'diff') 1412 PROC_dan=9 1413 if (PROC(1:4).eq.'ruth') 1414 PROC_dan=10 1415 */ 1416 1377 1417 1378 1418 // ????????????????????????????????????? … … 1471 1511 av_pc1 = av_pc1 + part.PC; 1472 1512 1473 1513 if(0){ 1474 1514 cout<<" X apres :"<<part.x<<" XP apres :"<<part.xp<<" Y apres :"<<part.y<<" YP apres :"<<part.yp<<" PC apres :"<<part.PC<<endl; 1475 1515 //cout<<endl; 1516 } 1517 //only record the particles that hit the collimator. 1518 if(hitflag != true){ 1476 1519 //sortieIco.setf(ios::scientific); 1477 sortieIco << part.x << "," << part.y << "," << part.xp << "," << part.yp << "," << part.PC << endl;1520 sortieIco << part.x << "," << part.y << "," << part.xp << "," << part.yp << "," << part.PC << endl; 1478 1521 //}//end of for.... 1479 1522 } 1523 1480 1524 } 1481 1525 } //End of while … … 1525 1569 file_out(pas, outputpath); 1526 1570 1571 if(1){ 1572 cout << "number of particles before the crystal: " << count<< endl; 1573 cout << "number of particle hit the crystal: " << part.nhit << endl; 1574 cout << "number of particles after the crystal: " << count - part.nhit << endl; 1575 } 1527 1576 //cout<<endl; 1528 1577 //cout<<endl; … … 1667 1716 cout << "N.OUT :" << part.nout << endl; 1668 1717 cout << "N.VREFLECTION :" << part.nvrefl << endl; 1669 cout << "N.VCAPTURE :" << part.nvcapt << endl; 1718 cout << "N.VCAPTURE:" << part.nvcapt << endl; 1719 cout << "N.ABSORBED: "<< part.nabsorbed << endl; 1670 1720 1671 1721 //cout << "Si la somme ne donne pas le nbre de part., c est normale !! En effet, il est possible que plusieurs evenement se produisent!!!"; … … 1688 1738 out << "Crystal Curved Length [m] :" << crys.Cry_length << endl; 1689 1739 out << "Crystal Curvature Radius [m] :" << crys.Rcurv << endl; 1690 out << "Crystal Bending Angle [urad] :" << crys.cry_bend << " , " << crys.Cry_length / crys.Rcurv << endl;1740 out << "Crystal Bending Angle [urad] :" << crys.cry_bend << " , " << 1e6*crys.Cry_length / crys.Rcurv << endl; 1691 1741 out << "Critical Radius :" << crys.Rcrit << endl; 1692 1742 out << "Ratio :" << crys.ratio << endl; … … 1702 1752 out << "N.OUT :" << part.nout << endl; 1703 1753 out << "N.VREFLECTION :" << part.nvrefl << endl; 1704 out << "N.VCAPTURE :" << part.nvcapt << endl << endl << endl; 1705 1754 out << "N.VCAPTURE :" << part.nvcapt << endl ; 1755 out << "N.ABSORBED: "<< part.nabsorbed << endl; 1756 out << "N. of particles that hit the crystal collimator: " << part.nhit << endl; 1757 cout << endl; 1758 cout << endl; 1759 1706 1760 out.close(); 1707 1761 }
Note: See TracChangeset
for help on using the changeset viewer.