1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // |
---|
27 | // $Id: G4FTFModel.cc,v 1.7 2007/04/24 10:32:59 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-01-patch-02 $ |
---|
29 | // |
---|
30 | |
---|
31 | // ------------------------------------------------------------ |
---|
32 | // GEANT 4 class implementation file |
---|
33 | // |
---|
34 | // ---------------- G4FTFModel ---------------- |
---|
35 | // by Gunter Folger, May 1998. |
---|
36 | // class implementing the excitation in the FTF Parton String Model |
---|
37 | // ------------------------------------------------------------ |
---|
38 | |
---|
39 | #include "G4FTFModel.hh" |
---|
40 | #include "G4FTFParticipants.hh" |
---|
41 | #include "G4InteractionContent.hh" |
---|
42 | #include "G4LorentzRotation.hh" |
---|
43 | #include "G4ParticleDefinition.hh" |
---|
44 | #include "G4ios.hh" |
---|
45 | |
---|
46 | // Class G4FTFModel |
---|
47 | |
---|
48 | G4FTFModel::G4FTFModel():theExcitation(new G4DiffractiveExcitation()) // Uzhi |
---|
49 | { |
---|
50 | G4VPartonStringModel::SetThisPointer(this); |
---|
51 | } |
---|
52 | |
---|
53 | G4FTFModel::G4FTFModel(G4double a, G4double b, G4double c):theExcitation(new G4DiffractiveExcitation()) |
---|
54 | { |
---|
55 | G4VPartonStringModel::SetThisPointer(this); |
---|
56 | } |
---|
57 | |
---|
58 | G4FTFModel::G4FTFModel(G4DiffractiveExcitation * anExcitation) |
---|
59 | : |
---|
60 | theExcitation(anExcitation) |
---|
61 | { |
---|
62 | G4VPartonStringModel::SetThisPointer(this); |
---|
63 | } |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | G4FTFModel::~G4FTFModel() |
---|
68 | {} |
---|
69 | |
---|
70 | |
---|
71 | const G4FTFModel & G4FTFModel::operator=(const G4FTFModel &) |
---|
72 | { |
---|
73 | throw G4HadronicException(__FILE__, __LINE__, "G4FTFModel::operator= is not meant to be accessed "); |
---|
74 | return *this; |
---|
75 | } |
---|
76 | |
---|
77 | |
---|
78 | int G4FTFModel::operator==(const G4FTFModel &right) const |
---|
79 | { |
---|
80 | return this==&right; |
---|
81 | } |
---|
82 | |
---|
83 | int G4FTFModel::operator!=(const G4FTFModel &right) const |
---|
84 | { |
---|
85 | return this!=&right; |
---|
86 | } |
---|
87 | |
---|
88 | void G4FTFModel::Init(const G4Nucleus & aNucleus, const G4DynamicParticle & aProjectile) |
---|
89 | { |
---|
90 | theParticipants.Init(aNucleus.GetN(),aNucleus.GetZ()); // Uzhi N-mass number Z-charge |
---|
91 | |
---|
92 | theProjectile = aProjectile; |
---|
93 | } |
---|
94 | |
---|
95 | G4ExcitedStringVector * G4FTFModel::GetStrings() |
---|
96 | { |
---|
97 | theParticipants.BuildInteractions(theProjectile); |
---|
98 | |
---|
99 | if (! ExciteParticipants()) return NULL;; |
---|
100 | |
---|
101 | G4ExcitedStringVector * theStrings = BuildStrings(); |
---|
102 | |
---|
103 | return theStrings; |
---|
104 | } |
---|
105 | |
---|
106 | struct DeleteVSplitableHadron { void operator()(G4VSplitableHadron * aH){delete aH;} }; |
---|
107 | |
---|
108 | G4ExcitedStringVector * G4FTFModel::BuildStrings() |
---|
109 | { |
---|
110 | |
---|
111 | // Loop over all collisions; find all primaries, and all target ( targets may |
---|
112 | // be duplicate in the List ( to unique G4VSplitableHadrons) |
---|
113 | |
---|
114 | G4ExcitedStringVector * strings; |
---|
115 | strings = new G4ExcitedStringVector(); |
---|
116 | |
---|
117 | std::vector<G4VSplitableHadron *> primaries; |
---|
118 | std::vector<G4VSplitableHadron *> targets; |
---|
119 | |
---|
120 | theParticipants.StartLoop(); // restart a loop |
---|
121 | while ( theParticipants.Next() ) |
---|
122 | { |
---|
123 | const G4InteractionContent & interaction=theParticipants.GetInteraction(); |
---|
124 | // do not allow for duplicates ... |
---|
125 | if ( primaries.end() == std::find(primaries.begin(), primaries.end(), interaction.GetProjectile()) ) |
---|
126 | primaries.push_back(interaction.GetProjectile()); |
---|
127 | |
---|
128 | if ( targets.end() == std::find(targets.begin(), targets.end(),interaction.GetTarget()) ) |
---|
129 | targets.push_back(interaction.GetTarget()); |
---|
130 | } |
---|
131 | |
---|
132 | |
---|
133 | // G4cout << "BuildStrings prim/targ " << primaries.entries() << " , " << |
---|
134 | // targets.entries() << G4endl; |
---|
135 | |
---|
136 | |
---|
137 | unsigned int ahadron; |
---|
138 | for ( ahadron=0; ahadron < primaries.size() ; ahadron++) |
---|
139 | { |
---|
140 | G4bool isProjectile=true; |
---|
141 | strings->push_back(theExcitation->String(primaries[ahadron], isProjectile)); |
---|
142 | } |
---|
143 | for ( ahadron=0; ahadron < targets.size() ; ahadron++) |
---|
144 | { |
---|
145 | G4bool isProjectile=false; |
---|
146 | strings->push_back(theExcitation->String(targets[ahadron], isProjectile)); |
---|
147 | } |
---|
148 | |
---|
149 | std::for_each(primaries.begin(), primaries.end(), DeleteVSplitableHadron()); |
---|
150 | primaries.clear(); |
---|
151 | std::for_each(targets.begin(), targets.end(), DeleteVSplitableHadron()); |
---|
152 | targets.clear(); |
---|
153 | |
---|
154 | return strings; |
---|
155 | } |
---|
156 | |
---|
157 | G4bool G4FTFModel::ExciteParticipants() |
---|
158 | { |
---|
159 | |
---|
160 | while (theParticipants.Next()) |
---|
161 | { |
---|
162 | const G4InteractionContent & collision=theParticipants.GetInteraction(); |
---|
163 | |
---|
164 | //G4cout << " soft colls : " << collision.GetNumberOfSoftCollisions() << G4endl; // Uzhi no match |
---|
165 | G4VSplitableHadron * projectile=collision.GetProjectile(); |
---|
166 | G4VSplitableHadron * target=collision.GetTarget(); |
---|
167 | |
---|
168 | if ( ! theExcitation->ExciteParticipants(projectile, target) ) |
---|
169 | { |
---|
170 | // give up, clean up |
---|
171 | std::vector<G4VSplitableHadron *> primaries; |
---|
172 | std::vector<G4VSplitableHadron *> targets; |
---|
173 | theParticipants.StartLoop(); // restart a loop |
---|
174 | while ( theParticipants.Next() ) |
---|
175 | { |
---|
176 | const G4InteractionContent & interaction=theParticipants.GetInteraction(); |
---|
177 | // do not allow for duplicates ... |
---|
178 | if ( primaries.end() == std::find(primaries.begin(), primaries.end(), interaction.GetProjectile()) ) |
---|
179 | primaries.push_back(interaction.GetProjectile()); |
---|
180 | |
---|
181 | if ( targets.end() == std::find(targets.begin(), targets.end(),interaction.GetTarget()) ) |
---|
182 | targets.push_back(interaction.GetTarget()); |
---|
183 | } |
---|
184 | std::for_each(primaries.begin(), primaries.end(), DeleteVSplitableHadron()); |
---|
185 | primaries.clear(); |
---|
186 | std::for_each(targets.begin(), targets.end(), DeleteVSplitableHadron()); |
---|
187 | targets.clear(); |
---|
188 | |
---|
189 | return false; |
---|
190 | } |
---|
191 | |
---|
192 | } |
---|
193 | return true; |
---|
194 | } |
---|