Changeset 14 in ZHANGProjects


Ignore:
Timestamp:
Jul 25, 2014, 11:01:45 AM (10 years ago)
Author:
zhangj
Message:

(1) Fix the bug to print the coordinates information for a specific particles. (2) Add some comments.

Location:
ICOSIM/CPP/trunk/source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ICOSIM/CPP/trunk/source/.kdev4/source.kdev4

    r13 r14  
    1212
    1313[Launch][Launch Configuration 0][Data]
    14 Arguments=../sample/collimatorfile_standard_ions_nominal.csv    ../outputs/test
     14Arguments=../sample/collimatorfile_crystal_matlab.csv    ../outputs/crystal/test
    1515Dependencies=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x00)
    1616Dependency Action=Nothing
  • ICOSIM/CPP/trunk/source/crystal_dan_FINAL_VERSION_CHvsVR.f

    r13 r14  
    145145c      miscut=0.001000
    146146c
    147       write(*,*)"last miscut angle =",miscut
     147c      write(*,*)"last miscut angle =",miscut
    148148c      write(*,*) 'enter crystal subroutine'
    149149c      write(*,*) 'particle energy Gev :', PC
  • ICOSIM/CPP/trunk/source/lattice.cc

    r8 r14  
    440440
    441441    if (idpart >= 0) {
    442         if (idpart >= bunch.size()) {
    443             cerr << "Warning, the particle that you want to spy using IDPART does not exist!" << endl;
     442        if (idpart > bunch.size()) {
     443            cerr << "Warning, the particle that you want to spy using IDPART does not exist!" << "  idpart = " << idpart << ",  bunch.size = " << bunch.size() <<endl;
    444444        } else {
    445445            choicePart = idpart;
  • ICOSIM/CPP/trunk/source/lattice.h

    r5 r14  
    108108
    109109    int npart; //number of particles
    110     vector <int> ips; //vector indicating the position of the collimators (gives the index of the collimators in the complete lattice, e.g. if the first collimator is the 5th element, we will have ips[0] = 5)
     110    vector <int> ips; //vector indicating the position of the collimators (the index of the collimators in the complete lattice, e.g. if the first collimator is the 5th element, we will have ips[0] = 5)
    111111
    112112    vector <int> cocount;//count the number of particles crashing on each collimator
     
    118118
    119119    vector <int> ii;//'TCI' collimators
    120     vector < int > ip;//'TCP', 'CRYSTAL' and 'TCRYO' collimators
    121     vector < int > is;//'TCS' collimators
     120    vector < int > ip;//'TCP', 'CRYSTAL' and 'TCRYO' collimators; primary collimators,
     121                      // only these collimators will be used to do particle-matter simulation
     122    vector < int > is;//'TCS' secondary collimators; absorbers.
    122123    vector < int > it;//'TCT' collimators
    123     vector < int > itcla;//'TCLA' collimators
     124    vector < int > itcla;//'TCLA' collimators; absorber.
    124125
    125126    vector < int > ipcoll; // vector giving the position like ips, but only for 'TCP' collimators
  • ICOSIM/CPP/trunk/source/simulation.cc

    r13 r14  
    995995
    996996
    997     //tracking the particles through the machine
     997    //nonlinear tracking the particles through the machine
    998998    cout << "FOURTH TRACKING, TRACKING THROUGHT THE MACHINE." << endl;
    999999
     
    19881988
    19891989    if (plotflag == "Yes") {
    1990         PlotTrajectory(emix, emiy, ibeg, iend, xco, yco, outputpath);
     1990        PlotTrajectory(emix, emiy, ibeg, iend, xco, yco, outputpath); 
    19911991    }
    19921992
     
    20102010    int irevloc(0), i0loc(0), imloc(0);
    20112011
     2012    //total number of lost particles on collimators + apertures
    20122013    NLostTotal = asumhitcolli[asumhitcolli.size() - 1] + asumhits[asumhits.size() - 1];
    20132014
     
    20192020
    20202021    vector <double> sep;
    2021     vector <double> plosslocal, zlosslocal;
     2022    vector <double> plosslocal, zlosslocal; // local lost power & lost position
    20222023
    20232024    for (double k(lat.reseau[i0loc]->S); k < lat.reseau[imloc]->S; ++k) {
     
    20252026    }
    20262027
     2028    //calculate the location range to count the lost particles in this range, each 0.5 m
    20272029    for (int i(0); i < sep.size() - 1; ++i) {
    20282030        zlosslocal.push_back(sep[i] + (sep[i + 1] - sep[i]) / 2);
     
    20312033    int count(0);
    20322034
     2035    //find the partice lost locations and number of lost particles
    20332036    for (int i(0); i < sep.size() - 1; ++i) {
    20342037        for (int j(0); j < hitso.size(); ++j) {
     
    20652068            sip.push_back(lat.reseau[i]->S);
    20662069            pos.push_back(i);
    2067         }
    2068     }
    2069 
     2070         //   std::cout << lat.reseau[i]->NAME << std::endl;
     2071        }
     2072    }
     2073
     2074  // std::cout << pos.size() << std::endl;
     2075  // std::cout << "size of the IP number: " << sip.size() << std::endl;
     2076   
    20702077    if (sip.size() != 0) {
    20712078
     
    21242131    vector <int> removedCollimators;
    21252132
     2133    //if the open jar of the collimator is larger than 100 sigma, so it means
     2134    // this collimator is not used in the collimation.
    21262135    for (int i(0); i < lat.resColli.size(); ++i) {
    21272136        if (lat.resColli[i]->nsig > 100) {
     
    22112220    }
    22122221
     2222    /********************************************************
     2223     *
     2224     *  Generate GNUPLOT scripts to plot the summary data.
     2225     * ******************************************************/
    22132226    //Writing PlotRunSummary1.p
    22142227
     
    22872300        PlotRun3 << "set title \"Time Development after first impact on collimator\"" << endl << endl;
    22882301        PlotRun3 << "set logscale y" << endl << endl;
    2289         PlotRun3 << " plot \"PlotRunSummary4.dat\" using 1:2 title \'particles in beam\' with line, \"PlotRunSummary4.dat\" using 1:3 title \'particles lost on collimators\' with line, \"PlotRunSummary4.dat\" using 1:4 title \'particles lost elsewhere\' with line" << endl << endl;
     2302        PlotRun3 << " plot \"PlotRunSummary4.dat\" using 1:2 title \'rest particles in beam\' with line, \"PlotRunSummary4.dat\" using 1:3 title \'particles lost on collimators\' with line, \"PlotRunSummary4.dat\" using 1:4 title \'particles lost elsewhere\' with line" << endl << endl;
    22902303        PlotRun3 << "unset logscale y" << endl;
    22912304        PlotRun3.close();
Note: See TracChangeset for help on using the changeset viewer.