Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // >> 24 // $Id: G4CollisionPN.cc,v 1.2 2003/11/03 17:53:28 hpw Exp $ // >> 25 // ------------------------------------------------------------------- >> 26 // GEANT4 Class file >> 27 // >> 28 // For information related to this code contact: >> 29 // >> 30 // File name: G4CollisionNN >> 31 // >> 32 // Author: Maria Grazia Pia >> 33 // >> 34 // Creation date: 15 April 1999 >> 35 // >> 36 // Modifications: >> 37 // >> 38 // ------------------------------------------------------------------- >> 39 27 40 28 #include "globals.hh" 41 #include "globals.hh" 29 #include "G4CollisionPN.hh" 42 #include "G4CollisionPN.hh" >> 43 #include "G4CollisionComposite.hh" >> 44 #include "G4VCollision.hh" >> 45 #include "G4CollisionVector.hh" >> 46 #include "G4KineticTrack.hh" >> 47 #include "G4VCrossSectionSource.hh" 30 #include "G4XnpTotal.hh" 48 #include "G4XnpTotal.hh" >> 49 #include "G4Proton.hh" >> 50 #include "G4Neutron.hh" 31 #include "G4CollisionnpElastic.hh" 51 #include "G4CollisionnpElastic.hh" 32 #include "G4CollisionNNToNDelta.hh" 52 #include "G4CollisionNNToNDelta.hh" 33 #include "G4Pair.hh" << 34 << 35 // J.P. Wellisch, Dec 2004. << 36 53 37 typedef GROUP2(G4CollisionnpElastic, G4Collisi << 38 54 39 G4CollisionPN::G4CollisionPN() 55 G4CollisionPN::G4CollisionPN() 40 { 56 { 41 57 42 crossSectionSource = new G4XnpTotal(); 58 crossSectionSource = new G4XnpTotal(); 43 Register aR; << 59 44 G4ForEach<theChannels>::Apply(&aR, this); << 60 // Components vector to be filled >> 61 components = new G4CollisionVector; >> 62 components->push_back(new G4CollisionnpElastic()); >> 63 components->push_back(new G4CollisionNNToNDelta()); >> 64 >> 65 // Subtype of interacting particles >> 66 G4String subType1 = G4Proton::ProtonDefinition()->GetParticleSubType(); >> 67 G4String subType2 = G4Neutron::NeutronDefinition()->GetParticleSubType(); >> 68 >> 69 colliders1.push_back(subType1); >> 70 colliders2.push_back(subType2); >> 71 45 } 72 } 46 73 47 74 48 G4CollisionPN::~G4CollisionPN() 75 G4CollisionPN::~G4CollisionPN() 49 { 76 { 50 delete crossSectionSource; 77 delete crossSectionSource; 51 crossSectionSource = 0; 78 crossSectionSource = 0; >> 79 >> 80 if (components != 0) >> 81 { >> 82 G4int nComponents = components->size(); >> 83 for (G4int i = 0; i < nComponents; i++) >> 84 { >> 85 G4CollisionPtr componentPtr = (*components)[i]; >> 86 G4VCollision* component = componentPtr(); >> 87 delete component; >> 88 component = 0; >> 89 } >> 90 } >> 91 delete components; >> 92 components = 0; 52 } 93 } 53 94 54 95 55 const std::vector<G4String>& G4CollisionPN::Ge << 96 const std::vector<G4String>& G4CollisionPN::GetListOfColliders(G4int whichOne) const 56 { 97 { 57 throw G4HadronicException(__FILE__, __LINE__ << 98 if (whichOne == 1) 58 return colliders1; << 99 { >> 100 return colliders1; >> 101 } >> 102 else >> 103 { >> 104 if (whichOne == 2) >> 105 { return colliders2; } >> 106 else >> 107 { >> 108 throw G4HadronicException(__FILE__, __LINE__, "G4CollisionNN::GetListOfColliders - Argument outside valid range"); >> 109 return colliders1; >> 110 } >> 111 } 59 } 112 } >> 113 60 114 61 115