Ignore:
Timestamp:
Jun 18, 2010, 11:42:07 AM (14 years ago)
Author:
garnier
Message:

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeChannel.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4CascadeChannel.cc,v 1.7 2010/05/15 04:25:17 mkelsey Exp $
     26// GEANT4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
     28// 20100514  M. Kelsey -- All functionality removed except quantum-number
     29//              validation functions.
    2630
    2731#include "G4CascadeChannel.hh"
    28 #include "Randomize.hh"
    29 
    30 std::pair<G4int, G4double>
    31 G4CascadeChannel::interpolateEnergy(G4double e)
    32 {
    33   G4int index = 30;
    34   G4double fraction = 0.0;
    35 
    36   for (G4int i = 1; i < 31; i++) {
    37     if (e < energyScale[i]) {
    38       index = i-1;
    39       fraction = (e - energyScale[index]) / (energyScale[i] - energyScale[index]);
    40       break;
    41     }
    42   }
    43   return std::pair<G4int, G4double>(index, fraction);
    44 }
     32#include "G4ParticleDefinition.hh"
     33#include <vector>
    4534
    4635
    47 G4int
    48 G4CascadeChannel::sampleFlat(std::vector<G4double> const& sigma)
    49 {
    50   G4int i;
    51   G4double sum(0.);
    52   for (i = 0; i < G4int(sigma.size()); i++) sum += sigma[i];
    53  
    54   G4double fsum = sum*G4UniformRand();
    55   G4double partialSum = 0.0;
    56   G4int channel = 0;
    57 
    58   for (i = 0; i < G4int(sigma.size()); i++) {
    59     partialSum += sigma[i];
    60     if (fsum < partialSum) {
    61       channel = i;
    62       break;
    63     }
    64   }
    65 
    66   return channel;
    67 }
    68 
    69 
    70 std::vector<G4int>
    71 G4CascadeChannel::getQnums(G4int type)
    72 {
     36std::vector<G4int> G4CascadeChannel::getQnums(G4int type) {
    7337  G4int bary=0, str=0, ch=0;
    7438  std::vector<G4int> Qnums(3);
     
    160124}
    161125
     126void
     127G4CascadeChannel::CheckQnums(const G4FastVector<G4ReactionProduct,256> &vec,
     128                             G4int &vecLen,
     129                             G4ReactionProduct &currentParticle,
     130                             G4ReactionProduct &targetParticle,
     131                             G4double Q, G4double B, G4double S) {
     132  G4ParticleDefinition* projDef = currentParticle.GetDefinition();
     133  G4ParticleDefinition* targDef = targetParticle.GetDefinition();
     134  G4double chargeSum = projDef->GetPDGCharge() + targDef->GetPDGCharge();
     135  G4double baryonSum = projDef->GetBaryonNumber() + targDef->GetBaryonNumber();
     136  G4double strangenessSum = projDef->GetQuarkContent(3) -
     137                            projDef->GetAntiQuarkContent(3) +
     138                            targDef->GetQuarkContent(3) -
     139                            targDef->GetAntiQuarkContent(3);
    162140
     141  G4ParticleDefinition* secDef = 0;
     142  for (G4int i = 0; i < vecLen; i++) {
     143    secDef = vec[i]->GetDefinition();
     144    chargeSum += secDef->GetPDGCharge();
     145    baryonSum += secDef->GetBaryonNumber();
     146    strangenessSum += secDef->GetQuarkContent(3)
     147                    - secDef->GetAntiQuarkContent(3);
     148  }
    163149
    164 const G4double G4CascadeChannel::energyScale[31] =
    165   { 0.0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45,
    166     0.5, 1.0,  1.5, 2.0,  2.5, 3.0,  3.5, 4.0,  4.5, 5.0,
    167     5.5, 6.0,  6.5, 7.0,  7.5, 8.0,  8.5, 9.0,  9.5, 10.0, 15.0 };
     150  G4bool OK = true;
     151  if (chargeSum != Q) {
     152    G4cout << " Charge not conserved " << G4endl;
     153    OK = false;
     154  }
     155  if (baryonSum != B) {
     156    G4cout << " Baryon number not conserved " << G4endl;
     157    OK = false;
     158  }
     159  if (strangenessSum != S) {
     160    G4cout << " Strangeness not conserved " << G4endl;
     161    OK = false;
     162  }
     163
     164  if (!OK) {
     165    G4cout << " projectile: " << projDef->GetParticleName()
     166           << "  target: " << targDef->GetParticleName() << G4endl;
     167    for (G4int i = 0; i < vecLen; i++) {
     168      secDef = vec[i]->GetDefinition();
     169      G4cout << secDef->GetParticleName() << " " ;
     170    }
     171    G4cout << G4endl;
     172  }
     173}
Note: See TracChangeset for help on using the changeset viewer.