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: G4VCollision.cc,v 1.1 2003/10/07 12:37:40 hpw Exp $ // 27 25 28 #include "globals.hh" 26 #include "globals.hh" 29 #include "G4ios.hh" 27 #include "G4ios.hh" 30 #include "G4VCollision.hh" 28 #include "G4VCollision.hh" 31 #include "G4VCrossSectionSource.hh" 29 #include "G4VCrossSectionSource.hh" 32 #include "G4KineticTrack.hh" 30 #include "G4KineticTrack.hh" 33 31 34 G4VCollision::G4VCollision() 32 G4VCollision::G4VCollision() 35 { } 33 { } 36 34 37 G4VCollision::~G4VCollision() 35 G4VCollision::~G4VCollision() 38 { 36 { 39 } 37 } 40 38 41 39 42 G4bool G4VCollision::operator==(const G4VColli 40 G4bool G4VCollision::operator==(const G4VCollision &right) const 43 { 41 { 44 return (this == (G4VCollision *) &right); 42 return (this == (G4VCollision *) &right); 45 } 43 } 46 44 47 45 48 G4bool G4VCollision::operator!=(const G4VColli 46 G4bool G4VCollision::operator!=(const G4VCollision &right) const 49 { 47 { 50 return (this != (G4VCollision *) &right); 48 return (this != (G4VCollision *) &right); 51 } 49 } 52 50 53 51 54 G4double G4VCollision::CrossSection(const G4Ki 52 G4double G4VCollision::CrossSection(const G4KineticTrack& aTrk1, 55 const G4Ki << 53 const G4KineticTrack& aTrk2) const 56 { 54 { 57 G4double sigma = 0.; 55 G4double sigma = 0.; 58 << 56 59 const G4VCrossSectionSource* xSource = GetCr 57 const G4VCrossSectionSource* xSource = GetCrossSectionSource(); 60 58 61 if (xSource != nullptr) << 59 if (xSource != 0) 62 { << 60 { 63 // There is a cross section for this Colli << 61 // There is a cross section for this Collision 64 sigma = xSource->CrossSection(aTrk1,aTrk2) << 62 sigma = xSource->CrossSection(aTrk1,aTrk2); 65 } << 63 } 66 return sigma; 64 return sigma; 67 } 65 } 68 66 69 67 70 void G4VCollision::Print() const 68 void G4VCollision::Print() const 71 { 69 { 72 G4String name = GetName(); 70 G4String name = GetName(); 73 71 74 G4cout << "---- " << name << "---- Cross sec 72 G4cout << "---- " << name << "---- Cross section" << G4endl; 75 73 76 const G4VCrossSectionSource* xSource = GetCr << 74 const G4VCrossSectionSource* xSource = GetCrossSectionSource(); 77 if (xSource) xSource->Print(); << 75 if (xSource) xSource->Print(); 78 76 79 G4int nComponents = 0; 77 G4int nComponents = 0; 80 const G4CollisionVector* components = GetCom 78 const G4CollisionVector* components = GetComponents(); 81 if (components) 79 if (components) 82 { << 80 { 83 nComponents = (G4int)components->size(); << 81 nComponents = components->size(); 84 } << 82 } 85 G4cout << "---- " << name << "---- has " << 83 G4cout << "---- " << name << "---- has " << nComponents << " components" <<G4endl; 86 G4int i = 0; 84 G4int i = 0; 87 if (components) << 85 G4CollisionVector::const_iterator iter; 88 { << 86 for (iter = components->begin(); iter != components->end(); ++iter) 89 for (auto iter = components->cbegin(); ite << 90 { 87 { 91 G4cout << "---- " << name << " ---- Comp 88 G4cout << "---- " << name << " ---- Component " << i << G4endl; 92 ((*iter))->Print(); << 89 ((*iter)())->Print(); 93 ++i; << 90 i++; 94 } 91 } 95 } << 92 >> 93 // G4int i; >> 94 // for (i=0; i<nComponents; i++) >> 95 // { >> 96 // G4VCollision* component = (*components)[i]; >> 97 // G4cout << "---- " << name << " ---- Component " << i << G4endl; >> 98 // component->Print(); >> 99 // } 96 } 100 } 97 101 98 102 99 void G4VCollision::Print(const G4KineticTrack& 103 void G4VCollision::Print(const G4KineticTrack& trk1, 100 const G4KineticTrack& << 104 const G4KineticTrack& trk2) const 101 { 105 { 102 G4String name = GetName(); 106 G4String name = GetName(); 103 << 107 104 if (IsInCharge(trk1,trk2)) 108 if (IsInCharge(trk1,trk2)) 105 { << 109 { 106 G4cout << "---- " << name << "is in charge << 110 G4cout << "---- " << name << "is in charge ---- " << G4endl; 107 } << 111 } 108 else 112 else 109 { << 113 { 110 G4cout << "---- " << name << "is not in ch << 114 G4cout << "---- " << name << "is not in charge ---- " << G4endl; 111 } << 115 } 112 << 116 113 G4cout << "---- " << name << "---- Cross sec 117 G4cout << "---- " << name << "---- Cross section" << G4endl; 114 << 118 115 const G4VCrossSectionSource* xSource = GetCr 119 const G4VCrossSectionSource* xSource = GetCrossSectionSource(); 116 if (xSource) xSource->Print(); 120 if (xSource) xSource->Print(); 117 G4cout << "Cross section = " << CrossSection 121 G4cout << "Cross section = " << CrossSection(trk1,trk2) << G4endl; 118 << 122 119 G4int nComponents = 0; 123 G4int nComponents = 0; 120 const G4CollisionVector* components = GetCom 124 const G4CollisionVector* components = GetComponents(); 121 if (components) 125 if (components) 122 { << 126 { 123 nComponents = (G4int)components->size(); << 127 nComponents = components->size(); 124 } << 128 } 125 G4cout << "---- " << name << "has " << nComp 129 G4cout << "---- " << name << "has " << nComponents << " components" <<G4endl; 126 << 130 127 G4int i = 0; << 131 G4int i = 0; 128 if (components) << 132 G4CollisionVector::const_iterator iter; 129 { << 133 for (iter = components->begin(); iter != components->end(); ++iter) 130 for (auto iter = components->cbegin(); ite << 131 { 134 { 132 G4cout << "Component " << i << G4endl; 135 G4cout << "Component " << i << G4endl; 133 ((*iter))->Print(); << 136 ((*iter)())->Print(); 134 ++i; << 137 i++; 135 } 138 } 136 } << 137 } 139 } 138 140 139 G4VCollision::G4VCollision(void*, void*, void << 140 { << 141 } << 142 141 143 void G4VCollision::establish_G4MT_TLS_G4VColli << 144 { << 145 } << 146 142