Changeset 17 in ZHANGProjects for ICOSIM/CPP/trunk/source/CrystalCollimator.cc
- Timestamp:
- Sep 30, 2014, 11:05:33 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ICOSIM/CPP/trunk/source/CrystalCollimator.cc
r15 r17 32 32 33 33 34 void CrystalCollimator::collipassCrystal(vector <Particle>& bunch, const double& betgam, const int& pas, string outputpath)34 void CrystalCollimator::collipassCrystal(vector <Particle>& bunch, const double& betgam, const int& pas, long int& nhit, string outputpath) 35 35 { 36 36 //pas: number of turns 37 37 //Calculate proton energy 38 38 double Mproton(0.93827231); //rest mass [GeV] … … 62 62 63 63 for (int k(0); k < bunch.size(); ++k) { 64 64 //simulate the particles that are not lost on the previous aperture 65 if(bunch[k].inabs !=0){ 65 66 sortie << bunch[k].coordonnees[0][0] << "," << bunch[k].coordonnees[0][2] << "," << bunch[k].coordonnees[0][1] << "," << bunch[k].coordonnees[0][3] << "," << Eproton[k] << endl; 67 } 66 68 } 67 69 … … 93 95 // sim.general(sim, pas, outputpath, NAME, emitx0, emity0,enum, C_rotation, C_aperture, C_offset, C_tilt, Cry_tilt); 94 96 95 sim.general(sim, pas, outputpath, Mirror, C_rotation, C_aperture, C_offset, C_tilt, Cry_tilt);97 sim.general(sim, pas, nhit, outputpath, Mirror, C_rotation, C_aperture, C_offset, C_tilt, Cry_tilt); 96 98 99 100 //assign the new bunch coordinates after the crystal 101 for (int k(0); k < bunch.size(); ++k) { 102 bunch[k].inabs =0 ; 103 } 104 105 97 106 ifstream enter; 98 107 string file_in; … … 105 114 } else { 106 115 107 for (int k(0); k < bunch.size() ; ++k) {116 for (int k(0); k < bunch.size()-nhit; ++k) { 108 117 109 118 string rest; … … 120 129 getline(enter, rest, ','); 121 130 bunch[k].coordonnees[1][3] = atof(rest.c_str()); 122 131 132 //particle is not lost (interact) with the crystal 133 bunch[k].inabs = 1; 134 123 135 getline(enter, rest); 124 136 Eproton[k] = atof(rest.c_str()); 137 125 138 } 126 139 … … 128 141 } 129 142 143 130 144 vector <double> gamProton; 131 145 vector <double> betProton;
Note: See TracChangeset
for help on using the changeset viewer.