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/G4InuclEvaporation.cc

    r962 r1315  
    2323// * acceptance of all terms of the Geant4 Software license.          *
    2424// ********************************************************************
     25// $Id: G4InuclEvaporation.cc,v 1.18 2010/05/21 18:26:16 mkelsey Exp $
     26// Geant4 tag: $Name: geant4-09-04-beta-cand-01 $
    2527//
    26 // $Id: G4InuclEvaporation.cc,v 1.8 2008/10/24 20:49:07 dennis Exp $
    27 //
     28// 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
     29// 20100405  M. Kelsey -- Pass const-ref std::vector<>
     30// 20100413  M. Kelsey -- Pass G4CollisionOutput by ref to ::collide(), use
     31//              const_iterator.
     32// 20100428  M. Kelsey -- Use G4InuclParticleNames enum
     33// 20100429  M. Kelsey -- Change "case gamma:" to "case photon:"
     34// 20100517  M. Kelsey -- Follow new ctors for G4*Collider family.  Make
     35//              G4EvaporationInuclCollider a data member.
     36// 20100520  M. Kelsey -- Simplify collision loop, move momentum rotations to
     37//              G4CollisionOutput, copy G4DynamicParticle directly from
     38//              G4InuclParticle, no switch-block required.  Fix scaling factors.
     39
    2840#include <numeric>
    2941#include "G4IonTable.hh"
     
    4153#include "G4LorentzVector.hh"
    4254#include "G4EquilibriumEvaporator.hh"
    43 #include "G4Fissioner.hh"
    44 #include "G4BigBanger.hh"
    4555#include "G4InuclElementaryParticle.hh"
    4656#include "G4InuclParticle.hh"
    4757#include "G4CollisionOutput.hh"
     58#include "G4InuclParticleNames.hh"
    4859
    49 typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
    50 typedef std::vector<G4InuclNuclei>::iterator nucleiIterator;
     60using namespace G4InuclParticleNames;
     61
     62typedef std::vector<G4InuclElementaryParticle>::const_iterator particleIterator;
     63typedef std::vector<G4InuclNuclei>::const_iterator nucleiIterator;
    5164
    5265
    53 G4InuclEvaporation::G4InuclEvaporation() {
    54   verboseLevel=0;
    55 }
     66G4InuclEvaporation::G4InuclEvaporation()
     67  : verboseLevel(0),   evaporator(new G4EvaporationInuclCollider) {}
    5668
    5769G4InuclEvaporation::G4InuclEvaporation(const G4InuclEvaporation &) : G4VEvaporation() {
     
    5971}
    6072
    61 
    6273G4InuclEvaporation::~G4InuclEvaporation() {
     74  delete evaporator;
    6375}
    6476
     
    8193}
    8294
    83 G4FragmentVector * G4InuclEvaporation::BreakItUp(const G4Fragment &theNucleus) {
    84  
    85   enum particleType { nuclei = 0, proton = 1, neutron = 2, pionPlus = 3,
    86                       pionMinus = 5, pionZero = 7, photon = 10,
    87                       kaonPlus = 11, kaonMinus = 13, kaonZero = 15,
    88                       kaonZeroBar = 17, lambda = 21, sigmaPlus = 23,
    89                       sigmaZero = 25, sigmaMinus = 27, xiZero = 29, xiMinus = 31 }; 
    90 
    91   std::vector< G4DynamicParticle * > secondaryParticleVector;
    92   G4FragmentVector * theResult = new G4FragmentVector;
     95G4FragmentVector* G4InuclEvaporation::BreakItUp(const G4Fragment &theNucleus) {
     96  G4FragmentVector* theResult = new G4FragmentVector;
    9397
    9498  if (theNucleus.GetExcitationEnergy() <= 0.0) { // Check that Excitation Energy > 0
     
    100104  G4double Z = theNucleus.GetZ();
    101105  G4double mTar  = G4NucleiProperties::GetNuclearMass(A, Z); // Mass of the target nucleus
    102   G4LorentzVector tmp =theNucleus.GetMomentum();
    103106
    104   G4ThreeVector momentum = tmp.vect();
     107  G4ThreeVector momentum =  theNucleus.GetMomentum().vect() / GeV;
    105108  //  G4double energy = tmp.e();
    106109  G4double exitationE = theNucleus.GetExcitationEnergy();
     
    108111  // Move to CMS frame, save initial velocity of the nucleus to boostToLab vector.
    109112  //   G4ThreeVector boostToLab( ( 1/G4NucleiProperties::GetNuclearMass( A, Z ) ) * momentum );
    110   G4InuclNuclei* tempNuc = new G4InuclNuclei(A, Z);
    111   G4double mass=tempNuc->getMass()*1000;
    112   G4ThreeVector boostToLab( ( 1/mass) * momentum );
     113
     114  G4double mass = mTar / GeV;
     115  G4ThreeVector boostToLab( momentum/mass );
    113116
    114117  if ( verboseLevel > 2 )
     
    122125
    123126  G4InuclNuclei* nucleus = new G4InuclNuclei(A, Z);
    124   nucleus->setExitationEnergy(exitationE/1000);
    125   G4CascadeMomentum tmom;
    126   nucleus->setMomentum(tmom);
    127   nucleus->setEnergy();
     127  nucleus->setExitationEnergy(exitationE);
    128128
    129   G4EquilibriumEvaporator*          eqil = new G4EquilibriumEvaporator;
    130   G4Fissioner*                      fiss = new G4Fissioner;
    131   G4BigBanger*                      bigb = new G4BigBanger;
    132   G4EvaporationInuclCollider* evaporator = new G4EvaporationInuclCollider(eqil, fiss, bigb);
    133129  G4CollisionOutput output;
     130  evaporator->collide(0, nucleus, output);
    134131
    135   output = evaporator->collide(0, nucleus);
     132  const std::vector<G4InuclNuclei>& nucleiFragments = output.getNucleiFragments();
     133  const std::vector<G4InuclElementaryParticle>& particles = output.getOutgoingParticles();
    136134
    137   std::vector<G4InuclNuclei>             nucleiFragments = output.getNucleiFragments();
    138   std::vector<G4InuclElementaryParticle> particles =       output.getOutgoingParticles();
     135  G4double eTot=0.0;
     136  G4int  i=1;
    139137
    140   G4double ekin,emas;
    141   G4double eTot=0.0;
    142   G4DynamicParticle* cascadeParticle = 0;
    143   G4int  i=1;
    144   //G4cout << "# particles: " << output.getOutgoingParticles().size() << G4endl;
    145138  if (!particles.empty()) {
    146     particleIterator ipart;
    147     G4int outgoingParticle;
    148 
    149     for (ipart = particles.begin(); ipart != particles.end(); ipart++) {
    150      
    151       outgoingParticle = ipart->type();
     139    G4int outgoingType;
     140    particleIterator ipart = particles.begin();
     141    for (; ipart != particles.end(); ipart++) {
     142      outgoingType = ipart->type();
    152143
    153144      if (verboseLevel > 2) {
    154         G4cout << "Evaporated particle:  " << i << " of type: " << outgoingParticle << G4endl;
     145        G4cout << "Evaporated particle:  " << i << " of type: " << outgoingType << G4endl;
    155146        i++;
    156147        //              ipart->printParticle();
    157148      }
    158149
    159       const G4CascadeMomentum& mom = ipart->getMomentum();
    160       eTot   += std::sqrt(mom[0]*1000 * mom[0]*1000);
     150      eTot += ipart->getEnergy();
     151     
     152      G4LorentzVector vlab = ipart->getMomentum().boost(boostToLab);
    161153
    162       ekin = ipart->getKineticEnergy()*1000;
    163       emas = ipart->getMass()*1000;
    164 
    165       G4ThreeVector aMom(mom[1]*1000, mom[2]*1000, mom[3]*1000);
    166 
    167       G4LorentzVector v(aMom, (ekin+emas));
    168       v.boost( boostToLab );
    169 
    170       switch(outgoingParticle) {
    171 
    172       case proton:
    173         cascadeParticle = new G4DynamicParticle(G4Proton::ProtonDefinition(), v.vect(), v.e());
    174         break;
    175 
    176       case neutron:
    177         cascadeParticle = new G4DynamicParticle(G4Neutron::NeutronDefinition(), v.vect(), v.e());
    178         break;
    179 
    180       case photon:
    181         cascadeParticle = new G4DynamicParticle(G4Gamma::Gamma(), v.vect(), v.e());
    182         break;
    183       default:
    184         G4cout << " ERROR: GInuclEvapration::Propagate undefined particle type" << G4endl;
    185       };
    186 
    187       secondaryParticleVector.push_back( cascadeParticle );
     154      theResult->push_back( new G4Fragment(vlab, ipart->getDefinition()) );
    188155      //      theResult.AddSecondary(cascadeParticle);
    189156    } 
    190157  }
    191   fillResult( secondaryParticleVector, theResult);
    192  
    193158
    194159  //  G4cout << "# fragments " << output.getNucleiFragments().size() << G4endl;
    195160  i=1;
    196161  if (!nucleiFragments.empty()) {
    197     nucleiIterator ifrag;
    198 
    199     for (ifrag = nucleiFragments.begin(); ifrag != nucleiFragments.end(); ifrag++) {
    200 
    201       ekin = ifrag->getKineticEnergy()*1000;
    202       emas = ifrag->getMass()*1000;
    203       const G4CascadeMomentum& mom = ifrag->getMomentum();
    204       eTot  += std::sqrt(mom[0]*1000 * mom[0]*1000);
    205 
    206       G4ThreeVector aMom(mom[1]*1000, mom[2]*1000, mom[3]*1000);
    207       //      aMom = aMom.unit();
    208 
    209       G4LorentzVector v(aMom, (ekin+emas));
    210       v.boost( boostToLab );
    211 
     162    nucleiIterator ifrag = nucleiFragments.begin();
     163    for (; ifrag != nucleiFragments.end(); ifrag++) {
    212164      if (verboseLevel > 2) {
    213165        G4cout << " Nuclei fragment: " << i << G4endl; i++;
    214         //      ifrag->printParticle();
    215166      }
    216167
     168      eTot += ifrag->getEnergy();
     169
     170      G4LorentzVector vlab = ifrag->getMomentum().boost(boostToLab);
     171 
    217172      G4int A = G4int(ifrag->getA());
    218173      G4int Z = G4int(ifrag->getZ());
    219       //        cascadeParticle = new G4DynamicParticle(G4Proton::ProtonDefinition(), v.vect(), v.e());
    220174      if (verboseLevel > 2) {
    221         G4cout << "boosted v" << v << G4endl;
     175        G4cout << "boosted v" << vlab << G4endl;
    222176      }
    223       // theResult->push_back( new G4Fragment(A, Z, tmp) );
    224       theResult->push_back( new G4Fragment(A, Z, v) );
     177      theResult->push_back( new G4Fragment(A, Z, vlab) );
    225178    }
    226179  }
     
    229182  return theResult;
    230183}
    231 
    232 void G4InuclEvaporation::fillResult( std::vector<G4DynamicParticle *> secondaryParticleVector,
    233                                      G4FragmentVector * aResult )
    234 {
    235   // Fill the vector pParticleChange with secondary particles stored in vector.
    236   for ( size_t i = 0 ; i < secondaryParticleVector.size() ; i++ )
    237     {
    238       G4int aZ = static_cast<G4int> (secondaryParticleVector[i]->GetDefinition()->GetPDGCharge() );
    239       G4int aA = static_cast<G4int> (secondaryParticleVector[i]->GetDefinition()->GetBaryonNumber());
    240       G4LorentzVector aMomentum = secondaryParticleVector[i]->Get4Momentum();
    241       if(aA>0) {
    242         aResult->push_back( new G4Fragment(aA, aZ, aMomentum) );
    243       } else {
    244         aResult->push_back( new G4Fragment(aMomentum, secondaryParticleVector[i]->GetDefinition()) );
    245       }
    246     }
    247   return;
    248 }
    249 
    250 
    251 
Note: See TracChangeset for help on using the changeset viewer.