Changeset 312 in PSPA for Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
- Timestamp:
- Feb 5, 2013, 2:23:23 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
r257 r312 81 81 82 82 void particleBeam::setWithParticles(vector<double>& centroid, bareParticle& referencePart, vector<bareParticle>& particles) { 83 cout << " particleBeam::setWithParticles taille vect. part. " << particles.size() << endl; 83 84 centroid_.clear(); 84 85 centroid_ = centroid; … … 86 87 goodPartic_.clear(); 87 88 goodPartic_ = particles; 89 cout << " particleBeam::setWithParticles taille vect. part. ENREGISTRE " << goodPartic_.size() << endl; 90 // printAllXYZ(); 88 91 particleRepresentationOk_ = true; 89 92 } … … 112 115 113 116 114 // bool particleBeam::setFromTransport(string workingDir, string elLab, const nomdElements elem)115 // {116 // string elementLabel = elLab;117 // // transformer le label en majuscules ; je ne suis pas sur que ca118 // // marchera a tous les coups (glm)119 // std::transform(elementLabel.begin(), elementLabel.end(), elementLabel.begin(), (int (*)(int))std::toupper);120 121 // cout << " particleBeam::setFromTransport on cherche element " << elementLabel << endl;122 // string buf;123 // ifstream infile;124 // // string nameIn = WORKINGAREA + "transport.output";125 // string nameIn = workingDir + "transport.output";126 // infile.open(nameIn.c_str(), ios::in);127 // if (!infile) {128 // cerr << " particleBeam::setFromTransport : error re-opening transport output stream " << nameIn << endl;129 // return false;130 // }131 // // else cout << " particleBeam::setFromTransport() : ouverture du fichier " << nameIn << endl;132 133 // string::size_type nn = string::npos;134 // while ( getline(infile, buf) ) {135 // // cout << " buf= " << buf << endl;136 // nn = buf.find(elementLabel);137 // // cout << " string::npos= " << string::npos << " nn= " << nn << endl;138 // if ( nn != string::npos ) {139 // // cout << " particleBeam::setFromTransport : element " << elementLabel << " trouve " << endl;140 // break;141 // }142 // }143 144 // if ( nn == string::npos ) {145 // cerr << " particleBeam::setFromTransport : element " << elementLabel << " non trouve dans le fichier " << nameIn << endl;146 // return false;147 // }148 // if (elem.getElementType() == bend ) {149 // getline(infile, buf);150 // getline(infile, buf);151 // }152 // readTransportMoments(infile);153 // impressionDesMoments();154 // infile.close();155 // momentRepresentationOk_ = true;156 // return true;157 // }158 159 // bool particleBeam::setFromTransport(string workingDir, string elLab, const nomdElements elem)160 // {161 // string elementLabel = elLab;162 // // transformer le label en majuscules ; je ne suis pas sur que ca163 // // marchera a tous les coups (glm)164 // std::transform(elementLabel.begin(), elementLabel.end(), elementLabel.begin(), (int (*)(int))std::toupper);165 166 // cout << " particleBeam::setFromTransport on cherche element " << elementLabel << endl;167 // ifstream infile;168 // // string nameIn = WORKINGAREA + "transport.output";169 // string nameIn = workingDir + "transport.output";170 // infile.open(nameIn.c_str(), ios::in);171 // if (!infile) {172 // cerr << " particleBeam::setFromTransport : error re-opening transport output stream " << nameIn << endl;173 // return false;174 // }175 // // else cout << " particleBeam::setFromTransport() : ouverture du fichier " << nameIn << endl;176 177 // string::size_type nn = string::npos;178 // string fichier;179 // string buf;180 // unsigned compteur = 0;181 // while ( getline(infile, buf) ) {182 // fichier += buf+"\n";183 // nn = buf.find(elementLabel);184 // if ( nn != string::npos ) {185 // compteur++;186 // // break;187 // }188 // }189 // infile.close();190 // cout << " compteur= " << compteur << endl;191 // if ( compteur == 0 ) {192 // cerr << " particleBeam::setFromTransport : element " << elementLabel << " non trouve dans le fichier " << nameIn << endl;193 // return false;194 // }195 196 197 // stringstream fichierStream(fichier);198 // buf.clear();199 // unsigned relu = 0;200 // while ( std::getline(fichierStream, buf) ) {201 // // cout << " relecture buffer : " << buf << endl;202 // nn = buf.find(elementLabel);203 // if ( nn != string::npos ) {204 // relu++;205 // if ( relu == compteur ) {206 // cout << " TROUVE !" << endl;207 // break;208 // }209 // }210 // }211 //212 // readTransportMoments(fichierStream);213 // // impressionDesMoments();214 // momentRepresentationOk_ = true;215 // return true;216 // }217 218 219 // bool particleBeam::setFromParmela(string workingDir,unsigned numeroElement, double referencefrequency) {220 // unsigned k;221 // FILE* filefais;222 // string nomfilefais = workingDir + "parmdesz";223 // cout << " nom fichier desz : " << nomfilefais << endl;224 // filefais = fopen(nomfilefais.c_str(), "r");225 226 // if ( filefais == (FILE*)0 ) {227 // cerr << " particleBeam::setFromParmela() erreur a l'ouverture du fichier" << nomfilefais << endl;;228 // return false;229 // }230 // else cout << " particleBeam::setFromParmela() : ouverture du fichier " << nomfilefais << endl;231 232 // parmelaParticle partic;233 // std::vector<parmelaParticle> faisceau;234 235 // cout << " particleBeam::setFromParmela : numeroElement = " << numeroElement << endl;236 // unsigned indexElement = numeroElement-1;237 238 239 240 241 // int testNombrePartRef =0;242 // double phaseRef;243 244 // while( partic.readFromParmelaFile(filefais) > 0 ) {245 // if ( partic.ne == (int)indexElement )246 // {247 // faisceau.push_back(partic);248 249 // if ( partic.np == 1 ) {250 // // en principe on est sur la particule de reference251 // if ( fabs(partic.xx) > EPSILON || fabs(partic.yy) > EPSILON || fabs(partic.xxp) > EPSILON || fabs(partic.yyp) > EPSILON) {252 // printf(" ATTENTION part. reference douteuse \n");253 // partic.imprim();254 // }255 // phaseRef = partic.phi;256 // TRIDVECTOR posRef(partic.xx,partic.yy,0.0);257 // TRIDVECTOR betagammaRef(partic.xxp*partic.begamz, partic.yyp*partic.begamz, partic.begamz);258 // referenceParticle_ = bareParticle(posRef, betagammaRef);259 // testNombrePartRef++;260 // if ( testNombrePartRef != 1 ) {261 // cerr << " TROP DE PART. DE REF : " << testNombrePartRef << " !! " << endl;262 // return false;263 // }264 // }265 // }266 // }267 268 // if ( faisceau.size() == 0)269 // {270 // cerr << " particleBeam::setFromParmela echec lecture element " << numeroElement << endl;271 // return false;272 // }273 274 // // facteur c/ 360. pour calculer (c dphi) / (360.freq)275 // // avec freq en Mhz et dphi en degres et résultat en cm:276 // double FACTEUR = 83.3333; // ameliorer la precision277 278 279 280 // // pour l'instant on choisit un centroid nul;281 // centroid_ = vector<double>(6,0.0);282 283 // goodPartic_.clear();284 // goodPartic_.resize(faisceau.size(), bareParticle());285 // double x,xp,y,yp;286 // double betagammaz;287 // double betaz;288 // double deltaz;289 // double dephas;290 // double g;291 // TRIDVECTOR pos;292 // TRIDVECTOR betagamma;293 // // contrairement a ce qu'indique la notice PARMELA, dans parmdesz, les xp et yp294 // // sont donnes en radians295 // for ( k=0; k < faisceau.size(); k++) {296 // x=faisceau.at(k).xx;297 // xp=faisceau.at(k).xxp;298 // y=faisceau.at(k).yy;299 // yp=faisceau.at(k).yyp;300 301 // // dephasage par rapport a la reference302 // dephas = faisceau.at(k).phi - phaseRef; // degrés303 // g = faisceau.at(k).wz/ERESTMeV;304 // betagammaz = faisceau.at(k).begamz;305 // betaz = betagammaz/(g+1.0);306 // deltaz = FACTEUR * betaz * dephas / referencefrequency;307 // x += xp * deltaz;308 // y += yp * deltaz;309 // pos.setComponents(x,y,deltaz);310 // betagamma.setComponents(xp*betagammaz, yp*betagammaz, betagammaz);311 // goodPartic_.at(k) = bareParticle(pos,betagamma);312 // }313 // particleRepresentationOk_ = true;314 // return true;315 // }316 117 317 118 … … 358 159 double xx,yy,zz; 359 160 goodPartic_.at(k).getPosition().getComponents(xx,yy,zz); 360 cout << " part. numero " << k << " x= " << xx << " y= " << yy << " z= " << zz << endl; 161 double betgamx, betgamy, betgamz; 162 goodPartic_.at(k).getBetaGamma().getComponents(betgamx, betgamy, betgamz); 163 cout << " part. numero " << k << " x= " << xx << " y= " << yy << " z= " << zz << " betgamx= " << betgamx << " betgamy= " << betgamy << " betgamz= " << betgamz << endl; 361 164 } 362 165 } … … 421 224 double P_reference_MeV_sur_c = sqrt( gref*(gref+2) ); 422 225 226 cout << " gref = " << gref << " P_reference_MeV_sur_c = " << P_reference_MeV_sur_c << endl; 227 228 423 229 // initialisation des moments 424 230 razDesMoments(); … … 432 238 double PMeVsc; 433 239 double del; 434 vector<double> part(6 );240 vector<double> part(6, 0.0); 435 241 436 242 vector< vector<double> >& matrice = rij_.getMatrix();
Note: See TracChangeset
for help on using the changeset viewer.