Ignore:
Timestamp:
Apr 6, 2009, 12:30:29 PM (15 years ago)
Author:
garnier
Message:

update processes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/incl/include/G4InclDataDefs.hh

    r819 r962  
    2424// ********************************************************************
    2525//
    26 // $Id: G4InclDataDefs.hh,v 1.2 2007/09/11 13:18:43 miheikki Exp $
     26// $Id: G4InclDataDefs.hh,v 1.5 2008/06/25 17:20:04 kaitanie Exp $
    2727// Translation of INCL4.2/ABLA V3
    2828// Pekka Kaitaniemi, HIP (translation)
     
    564564
    565565  /**
     566   * Clear and initialize all variables and arrays.
     567   */
     568  void clear() {
     569    particleIndex = 0;
     570    projType = 0;
     571    projEnergy = 0.0;
     572    targetA = 0;
     573    targetZ = 0;
     574    massini = 0;
     575    mzini = 0;
     576    exini = 0;
     577    pcorem = 0;
     578    mcorem = 0;
     579    pxrem = 0;
     580    pyrem = 0;
     581    pzrem = 0;
     582    mulncasc = 0;
     583    mulnevap = 0;
     584    mulntot = 0;
     585    bimpact = 0.0;
     586    jremn = 0;
     587    kfis = 0;
     588    estfis = 0;
     589    izfis = 0;
     590    iafis = 0;
     591    ntrack = 0;
     592    for(G4int i = 0; i < VARNTPSIZE; i++) {
     593      itypcasc[i] = 0;
     594      avv[i] = 0;
     595      zvv[i] = 0;
     596      enerj[i] = 0.0;
     597      plab[i] = 0.0;
     598      tetlab[i] = 0.0;
     599      philab[i] = 0.0;
     600      full[i] = false;
     601    }
     602  }
     603
     604  void addParticle(G4double A, G4double Z, G4double E, G4double P, G4double theta, G4double phi) {
     605    if(full[particleIndex]) {
     606      G4cout <<"G4VarNtp: Error. Index i = " << particleIndex << " is already occupied by particle:" << G4endl;
     607      G4cout <<"A = " << avv[particleIndex] << " Z = " << zvv[particleIndex] << G4endl;
     608      G4cout <<"Tried to replace it with:" << G4endl;
     609      G4cout <<"A = " << Z << " Z = " << Z << G4endl;
     610    } else {
     611      avv[particleIndex] = (int) A;
     612      zvv[particleIndex] = (int) Z;
     613      enerj[particleIndex] = E;
     614      plab[particleIndex] = P;
     615      tetlab[particleIndex] = theta;
     616      philab[particleIndex] = phi;
     617      full[particleIndex] = true;
     618      ntrack = particleIndex + 1;
     619      particleIndex++;
     620    }
     621  }
     622
     623  /**
     624   * Baryon number conservation check.
     625   */
     626  G4int getTotalBaryonNumber() {
     627    G4int baryonNumber = 0;
     628    for(G4int i = 0; i < ntrack; i++) {
     629      if(avv[i] > 0) {
     630        baryonNumber += avv[i];
     631      }
     632    }
     633    return baryonNumber;
     634  }
     635
     636  /**
     637   * Return total energy.
     638   */
     639  G4double getTotalEnergy() {
     640    G4double energy = 0.0;
     641    for(G4int i = 0; i < ntrack; i++) {
     642      energy += std::sqrt(std::pow(plab[i], 2) + std::pow(getMass(i), 2)); // E^2 = p^2 + m^2
     643    }
     644
     645    return energy;
     646  }
     647
     648  /**
     649   * Return total three momentum.
     650   */
     651  G4double getTotalThreeMomentum() {
     652    G4double momentum = 0;
     653    for(G4int i = 0; i < ntrack; i++) {
     654      momentum += plab[i];
     655    }
     656    return momentum;
     657  }
     658
     659  G4double getMomentumSum() {
     660    G4double momentum = 0;
     661    for(G4int i = 0; i < ntrack; i++) {
     662      momentum += plab[i];
     663    }
     664    return momentum;
     665  }
     666
     667  G4double getMass(G4int particle) {
     668    const G4double protonMass = 938.272;
     669    const G4double neutronMass = 939.565;
     670    const G4double pionMass = 139.57;
     671
     672    G4double mass = 0.0;
     673    if(avv[particle] ==  1 && zvv[particle] ==  1) mass = protonMass;
     674    if(avv[particle] ==  1 && zvv[particle] ==  0) mass = neutronMass;
     675    if(avv[particle] == -1)                        mass = pionMass;
     676    if(avv[particle] > 1)
     677      mass = avv[particle] * protonMass + zvv[particle] * neutronMass;
     678    return mass;
     679  }
     680
     681  /**
     682   * Dump debugging output.
     683   */
     684  void dump() {
     685    G4int nProton = 0, nNeutron = 0;
     686    G4int nPiPlus = 0, nPiZero = 0, nPiMinus = 0;
     687    G4int nH2 = 0, nHe3 = 0, nAlpha = 0;
     688    G4int nFragments = 0;
     689    G4int nParticles = 0;
     690    G4cout <<"Particles produced in the event (" << ntrack << "):" << G4endl;
     691    G4cout <<"A \t Z \t Ekin \t Ptot \t Theta \t Phi" << G4endl;
     692    for(G4int i = 0; i < ntrack; i++) {
     693      nParticles++;
     694      if(avv[i] ==  1 && zvv[i] ==  1) nProton++;  // Count multiplicities
     695      if(avv[i] ==  1 && zvv[i] ==  0) nNeutron++;
     696      if(avv[i] == -1 && zvv[i] ==  1) nPiPlus++;
     697      if(avv[i] == -1 && zvv[i] ==  0) nPiZero++;
     698      if(avv[i] == -1 && zvv[i] == -1) nPiMinus++;
     699      if(avv[i] ==  2 && zvv[i] ==  1) nH2++;
     700      if(avv[i] ==  3 && zvv[i] ==  2) nHe3++;
     701      if(avv[i] ==  4 && zvv[i] ==  2) nAlpha++;
     702      if(                zvv[i] >   2) nFragments++;
     703
     704      G4cout << i << " \t " << avv[i] << " \t " << zvv[i] << " \t " << enerj[i] << " \t "
     705             << plab[i] << " \t " << tetlab[i] << " \t " << philab[i] << G4endl;
     706    }
     707
     708    G4cout <<"Summary of event: " << G4endl;
     709    G4cout <<"Projectile type: " << projType <<" Energy: " << projEnergy << G4endl;
     710    G4cout <<"Target A = " << targetA << " Z = " << targetZ << G4endl;
     711    G4cout <<"Remnant from cascade: " << G4endl;
     712    G4cout <<"A = " << massini << " Z = " << mzini << " excitation E = " << exini << G4endl;
     713    G4cout <<"Particle multiplicities:" << G4endl;
     714    G4cout <<"Protons: " << nProton << " Neutrons:  " << nNeutron << G4endl;
     715    G4cout <<"pi+: " << nPiPlus << " pi0: " << nPiZero << " pi-: " << nPiMinus << G4endl;
     716    G4cout <<"H2: " << nH2 << " He3: " << nHe3 << " Alpha: " << nAlpha << G4endl;
     717    G4cout <<"Nucleus fragments = " << nFragments << G4endl;
     718    G4cout <<"Conservation laws:" << G4endl;
     719    G4cout <<"Baryon number = " <<  getTotalBaryonNumber() << G4endl;
     720    G4cout <<"Number of particles = " << nParticles << G4endl;
     721  }
     722
     723  /**
     724   * Projectile type.
     725   */
     726  G4int projType;
     727
     728  /**
     729   * Projectile energy.
     730   */
     731  G4double projEnergy;
     732
     733  /**
     734   * Target mass number.
     735   */
     736  G4int targetA;
     737
     738  /**
     739   * Target charge number.
     740   */
     741  G4int targetZ;
     742
     743  /**
    566744   * A of the remnant.
    567745   */
     
    578756  G4double exini;
    579757
     758  G4double pcorem, mcorem, pxrem, pyrem, pzrem;
     759
    580760  /**
    581761   * Cascade n multip.
     
    629809
    630810  /**
     811   * The state of the index:
     812   * true = reserved
     813   * false = free
     814   */
     815  G4bool full[VARNTPSIZE];
     816
     817  /**
    631818   * emitted in cascade (0) or evaporation (1).
    632819   */
     
    663850   */
    664851  G4double philab[VARNTPSIZE];
     852
     853private:
     854  G4int particleIndex;
    665855};
    666856
Note: See TracChangeset for help on using the changeset viewer.