Changeset 377 in PSPA for Interface_Web
- Timestamp:
- Mar 8, 2013, 2:24:40 PM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h
r371 r377 43 43 unsigned indexFromPspaToTransport(unsigned index) const; 44 44 45 void histogramComponent(vector<double>& coord,unsigned int index);46 45 void histogramInitialize(unsigned int index,vector<double>& vshf,double out[3]); 47 46 void histogramPacking(double ecatyp,vector<double>vshf,vector<double>&xcor,vector<int>& hist); -
Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
r371 r377 357 357 coord.resize(goodPartic_.size(), 0.0 ); 358 358 cout << " particleBeam::particlesPhaseSpaceComponent index = " << index << endl; 359 359 360 if ( index <= 2 ) { 360 361 for (unsigned i = 0; i < goodPartic_.size(); ++i) { … … 363 364 return; 364 365 } 365 366 366 367 if ( index > 2 && index < 5 ) { 367 368 for (unsigned i = 0; i < goodPartic_.size(); ++i) { … … 378 379 if ( index == 5 ) { 379 380 double gamma0 = referenceParticle_.getGamma(); 380 // cout << " gamma0 = " << gamma0 << endl;381 381 if ( gamma0 == 0.0 ) return; 382 382 for (unsigned i = 0; i < goodPartic_.size(); ++i) { 383 383 coord.at(i) = 100.*(goodPartic_.at(i).getGamma() - gamma0)/gamma0; // en % 384 // cout << " gamma0 = " << gamma0 << " gamma = " << goodPartic_.at(i).getGamma() << endl;385 384 } 386 385 return; … … 529 528 } 530 529 531 void particleBeam::histogramme(unsigned int iabs,vector<double>& xcor,vector<int>& hist,double out[3])530 void particleBeam::histogramme(unsigned int iabs,vector<double>& xcor,vector<int>& hist,double out[3]) 532 531 { 532 // out[0]= nbre de particules, out[1]= moyenne, out[2]= ecart-type 533 533 vector<double> vshf; 534 histogramComponent(vshf,iabs);534 particlesPhaseSpaceComponent(vshf,iabs); 535 535 histogramInitialize(iabs,vshf,out); 536 536 histogramPacking(out[2],vshf,xcor,hist); 537 537 538 // out[0]= nbre de particules, out[1]= moyenne, out[2]= ecart-type539 if(iabs == 0 || iabs == 1 || iabs == 2) {540 out[2] *= 1000.0; // ecart-type en mm541 }542 543 538 if(iabs == 5) { 544 for (unsigned int i = 0; i <= xcor.size(); ++i) {545 xcor[i] = 100.*xcor[i]/out[1]; // en %546 }547 539 out[1] *= EREST_MeV; // moyenne en MeV 548 540 out[2] *= EREST_keV; // ecart-type en KeV 549 541 } 550 }551 552 void particleBeam::histogramComponent(vector<double>& coord,unsigned int index)553 {554 coord.clear();555 coord.resize(goodPartic_.size(),0.0);556 557 if(index == 0 || index == 1 || index == 2)558 {559 // collecte d'une coordonnee x(index= 0), y(index= 1) ou z(index= 2) des particules560 for (unsigned int k = 0; k < goodPartic_.size(); k++) {561 coord.at(k) = goodPartic_.at(k).getPosition().getComponent(index);562 }563 }564 565 if(index == 3 || index == 4)566 {567 // collecte de begamx (index= 3), begamy (index= 4)568 for (unsigned int k = 0; k < goodPartic_.size(); k++) {569 double begamz = goodPartic_.at(k).getBetaGamma().getComponent(2);570 if (begamz == 0.0) continue;571 double begam = goodPartic_.at(k).getBetaGamma().getComponent(index-3);572 coord.at(k) = 1000.0*begam/begamz; //pi.mm.mradians573 }574 }575 576 if(index == 5)577 {578 // collecte de l'energie acquise par les particules579 for (unsigned int k = 0; k < goodPartic_.size(); k++) {580 double gamma = goodPartic_.at(k).getGamma();581 coord.at(k) = gamma-1.0;582 }583 }584 542 } 585 543 … … 607 565 608 566 if(index == 0) { 609 cout << "position x -moyenne " << vmoy << " m " << "-mini " << vmin << " m " << "-maxi " << vmax << " m " << "ecart type " << ecatyp*1000.0 << " mm" << endl;567 cout << "position x -moyenne " << vmoy << " cm " << "-mini " << vmin << " cm " << "-maxi " << vmax << " cm " << "ecart type " << ecatyp << " cm" << endl; 610 568 } 611 569 if(index == 1) { 612 cout << "position y -moyenne " << vmoy << " m " << "-mini " << vmin << " m " << "-maxi " << vmax << " m " << "ecart type " << ecatyp*1000.0 << " mm" << endl;570 cout << "position y -moyenne " << vmoy << " cm " << "-mini " << vmin << " cm " << "-maxi " << vmax << " cm " << "ecart type " << ecatyp << " cm" << endl; 613 571 } 614 572 if(index == 2) { 615 cout << "position z -moyenne " << vmoy << " m " << "-mini " << vmin << " m " << "-maxi " << vmax << " m " << "ecart type " << ecatyp*1000.0 << " mm" << endl;573 cout << "position z -moyenne " << vmoy << " cm " << "-mini " << vmin << " cm " << "-maxi " << vmax << " cm " << "ecart type " << ecatyp << " cm" << endl; 616 574 } 617 575 if(index == 3) { 618 cout << "divergence xp -moyenne " << vmoy << " pi.mm.mrad " << "-mini " << vmin << " pi.mm.mrad " << "-maxi " << vmax << " pi.mm.mrad " << "ecart type " << ecatyp << " pi.mm.mrad" << endl;576 cout << "divergence xp -moyenne " << vmoy << " mrad " << "-mini " << vmin << " mrad " << "-maxi " << vmax << " mrad " << "ecart type " << ecatyp << " mrad" << endl; 619 577 } 620 578 if(index == 4) { 621 cout << "divergence yp -moyenne " << vmoy << " pi.mm.mrad " << "-mini " << vmin << " pi.mm.mrad " << "-maxi " << vmax << " pi.mm.mrad " << "ecart type " << ecatyp << " pi.mm.mrad" << endl;579 cout << "divergence yp -moyenne " << vmoy << " mrad " << "-mini " << vmin << " mrad " << "-maxi " << vmax << " mrad " << "ecart type " << ecatyp << " mrad" << endl; 622 580 } 623 581 if(index == 5) { … … 668 626 if(var < 0 ) { 669 627 cout<<"lesser that the minimum "<<var<<", ("<< i<<")"<< endl; 670 hist[0]++; 671 } 672 673 if(var >= phist) { 628 hist.at(0)++; 629 } else if(var >= phist) { 674 630 cout<<"greater that the maximum "<<var<<", ("<< i<<")"<< endl; 675 hist [ihist-1]++;676 } 677 678 int kk= (int)floor(var/hpas);679 hist[kk]++;680 } 681 } 682 631 hist.at(ihist-1)++; 632 } else { 633 int kk= (int)floor(var/hpas); 634 hist.at(kk)++; 635 } 636 } 637 } 638 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
r376 r377 873 873 874 874 WContainerWidget *w= histoDialog->contents(); 875 876 // int nbpts= xcor.size()+cnts+1;877 // WStandardItemModel *model = new WStandardItemModel(nbpts,2,w);878 // //model->setHeaderData(1, WString("energie"));879 880 // int j= 0;881 // if(hist[0] > 0) {882 // model->setData(j,0,xcor[0]);883 // model->setData(j,1,hist[0]);884 // j++;885 // }886 // model->setData(j,0,xcor[0]);887 // model->setData(j,1,hist[0]);888 // j++;889 // for (int i = 1; i < nbpts; ++i) {890 // if(hist[i] == 0) {891 // if(hist[i-1] > 0) {892 // model->setData(j,0,xcor[i]);893 // model->setData(j,1,hist[i-1]);894 // j++;895 // }896 // model->setData(j,0,xcor[i]);897 // model->setData(j,1,hist[i]);898 // j++;899 // }900 // if(hist[i] > 0) {901 // model->setData(j,0,xcor[i]);902 // model->setData(j,1,hist[i-1]);903 // j++;904 // model->setData(j,0,xcor[i]);905 // model->setData(j,1,hist[i]);906 // j++;907 // }908 // }909 910 875 int n = hist.size(); 911 876 int nbpts= 2*(n+1); 912 cout << " nbre de points nbpts= " << nbpts << endl;913 877 WStandardItemModel *model = new WStandardItemModel(nbpts,2,w); 914 878 915 879 int j= 0; 916 880 model->setData(j,0,xcor[0]); … … 920 884 model->setData(j,1,hist[0]); 921 885 j++; 886 922 887 for (int i = 1; i < n; ++i) { 923 888 model->setData(j,0,xcor[i]); … … 928 893 j++; 929 894 } 930 895 931 896 model->setData(j,0,xcor[n]); 932 897 model->setData(j,1,hist[n-1]); … … 934 899 model->setData(j,0,xcor[n]); 935 900 model->setData(j,1,0.0); 936 901 937 902 // legendes 938 903 string unites[2]; 939 904 if(iabs == 0 || iabs == 1 || iabs == 2) { 940 unites[0]= " m"; unites[1]= " mm";905 unites[0]= unites[1]= " cm"; 941 906 } 942 907 if(iabs == 3 || iabs == 4) { 943 unites[0]= unites[1]= " pi.mm.mrad";908 unites[0]= unites[1]= " mrad"; 944 909 } 945 910 if(iabs == 5) { … … 955 920 WCartesianChart *chart = new WCartesianChart(w); 956 921 957 if(iabs == 0) chart->setTitle(" Histogram ofx-coordinate");958 if(iabs == 1) chart->setTitle(" Histogram ofy-coordinate");959 if(iabs == 2) chart->setTitle(" Histogram ofz-coordinate");960 if(iabs == 3) chart->setTitle(" Histogram of xp- ???");961 if(iabs == 4) chart->setTitle(" Histogram of yp- ???");962 if(iabs == 5) chart->setTitle(" Histogram ofkinetic energy");922 if(iabs == 0) chart->setTitle("x-coordinate"); 923 if(iabs == 1) chart->setTitle("y-coordinate"); 924 if(iabs == 2) chart->setTitle("z-coordinate"); 925 if(iabs == 3) chart->setTitle("xp-divergence"); 926 if(iabs == 4) chart->setTitle("yp-devergence"); 927 if(iabs == 5) chart->setTitle("kinetic energy"); 963 928 964 929 chart->setModel(model); // set the model … … 977 942 axis.setGridLinesEnabled(true); 978 943 979 if(iabs < 5) { 980 axis.setTitle(WString(" ???")); 981 } else { 982 axis.setTitle(WString(" dEcin/Ecin (%)")); 983 } 984 944 if(iabs == 0) axis.setTitle(WString(" x (cm)")); 945 if(iabs == 1) axis.setTitle(WString(" y (cm)")); 946 if(iabs == 2) axis.setTitle(WString(" z (cm)")); 947 if(iabs == 3) axis.setTitle(WString(" xp (mrad)")); 948 if(iabs == 4) axis.setTitle(WString(" yp (mrad)")); 949 if(iabs == 5) axis.setTitle(WString(" dEcin/Ecin (%)")); 950 985 951 chart->axis(Y1Axis).setGridLinesEnabled(true); 986 952 //chart->axis(Y1Axis).setTitle(WString("legende y"));
Note: See TracChangeset
for help on using the changeset viewer.