Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4FTFParticipants Class Reference

#include <G4FTFParticipants.hh>

+ Inheritance diagram for G4FTFParticipants:

Public Member Functions

 G4FTFParticipants ()
 
 ~G4FTFParticipants ()
 
const G4FTFParticipantsoperator= (const G4FTFParticipants &right)=delete
 
G4bool operator== (const G4FTFParticipants &right) const =delete
 
G4bool operator!= (const G4FTFParticipants &right) const =delete
 
 G4FTFParticipants (const G4FTFParticipants &right)=delete
 
void GetList (const G4ReactionProduct &thePrimary, G4FTFParameters *theParameters)
 
void StartLoop ()
 
G4bool Next ()
 
void SortInteractionsIncT ()
 
void ShiftInteractionTime ()
 
G4InteractionContentGetInteraction ()
 
void Clean ()
 
- Public Member Functions inherited from G4VParticipants
 G4VParticipants ()
 
virtual ~G4VParticipants ()
 
 G4VParticipants (const G4VParticipants &right)=delete
 
const G4VParticipantsoperator= (const G4VParticipants &right)=delete
 
G4bool operator== (const G4VParticipants &right) const =delete
 
G4bool operator!= (const G4VParticipants &right) const =delete
 
virtual void Init (G4int theZ, G4int theA)
 
virtual void SetNucleus (G4V3DNucleus *aNucleus)
 
virtual G4V3DNucleusGetWoundedNucleus () const
 
virtual void InitProjectileNucleus (G4int theZ, G4int theA)
 
virtual void SetProjectileNucleus (G4V3DNucleus *aNucleus)
 
virtual G4V3DNucleusGetProjectileNucleus () const
 

Additional Inherited Members

- Protected Attributes inherited from G4VParticipants
G4V3DNucleustheNucleus
 
G4V3DNucleustheProjectileNucleus
 

Detailed Description

Definition at line 50 of file G4FTFParticipants.hh.

Constructor & Destructor Documentation

◆ G4FTFParticipants() [1/2]

G4FTFParticipants::G4FTFParticipants ( )

Definition at line 61 of file G4FTFParticipants.cc.

61: currentInteraction( -1 ) {}

◆ ~G4FTFParticipants()

G4FTFParticipants::~G4FTFParticipants ( )

Definition at line 65 of file G4FTFParticipants.cc.

65{}

◆ G4FTFParticipants() [2/2]

G4FTFParticipants::G4FTFParticipants ( const G4FTFParticipants right)
delete

Member Function Documentation

◆ Clean()

void G4FTFParticipants::Clean ( )

Definition at line 359 of file G4FTFParticipants.cc.

359 {
360 for ( size_t i = 0; i < theInteractions.size(); i++ ) {
361 if ( theInteractions[ i ] ) {
362 delete theInteractions[ i ];
363 theInteractions[ i ] = 0;
364 }
365 }
366 theInteractions.clear();
367 currentInteraction = -1;
368}

Referenced by G4FTFModel::GetStrings(), and G4FTFModel::Init().

◆ GetInteraction()

G4InteractionContent & G4FTFParticipants::GetInteraction ( )
inline

Definition at line 81 of file G4FTFParticipants.hh.

81 {
82 return *theInteractions[ currentInteraction ];
83}

Referenced by G4FTFModel::GetStrings().

◆ GetList()

void G4FTFParticipants::GetList ( const G4ReactionProduct thePrimary,
G4FTFParameters theParameters 
)

Definition at line 69 of file G4FTFParticipants.cc.

70 {
71
72 #ifdef debugFTFparticipant
73 G4cout << "Participants::GetList" << G4endl
74 << "thePrimary " << thePrimary.GetMomentum() << G4endl << G4endl;
75 #endif
76
77 G4double betta_z = thePrimary.GetMomentum().z() / thePrimary.GetTotalEnergy();
78 if ( betta_z < 1.0e-10 ) betta_z = 1.0e-10;
79
80 StartLoop(); // reset Loop over Interactions
81
82 for ( unsigned int i = 0; i < theInteractions.size(); i++ ) delete theInteractions[i];
83 theInteractions.clear();
84
85 G4double deltaxy = 2.0 * fermi; // Extra nuclear radius
86
87 if ( theProjectileNucleus == nullptr ) { // Hadron-nucleus or anti-baryon-nucleus interactions
88
89 G4double impactX( 0.0 ), impactY( 0.0 );
90
91 G4VSplitableHadron* primarySplitable = new G4DiffractiveSplitableHadron( thePrimary );
92
93 #ifdef debugFTFparticipant
94 G4cout << "Hadron-nucleus or anti-baryon-nucleus interactions" << G4endl;
95 #endif
96
97 G4double xyradius;
98 xyradius = theNucleus->GetOuterRadius() + deltaxy; // Range of impact parameter sampling
99
100 const G4int maxNumberOfLoops = 1000;
101 G4int loopCounter = 0;
102 do {
103
104 std::pair< G4double, G4double > theImpactParameter;
105 theImpactParameter = theNucleus->ChooseImpactXandY( xyradius );
106 impactX = theImpactParameter.first;
107 impactY = theImpactParameter.second;
108
109 #ifdef debugFTFparticipant
110 G4cout << "New interaction list," << " b= "
111 << std::sqrt( sqr(impactX ) + sqr( impactY ) )/fermi << G4endl;
112 #endif
113
114 G4ThreeVector thePosition( impactX, impactY, 0.0 );
115 primarySplitable->SetPosition( thePosition );
116
119
120 #ifdef debugFTFparticipant
121 G4int TrN( 0 );
122 #endif
123
124 while ( ( nucleon = theNucleus->GetNextNucleon() ) ) { /* Loop checking, 10.08.2015, A.Ribon */
125
126 G4double impact2 = sqr( impactX - nucleon->GetPosition().x() ) +
127 sqr( impactY - nucleon->GetPosition().y() );
128
129 if ( theParameters->GetProbabilityOfInteraction( impact2/fermi/fermi ) >
130 G4UniformRand() ) {
131 primarySplitable->SetStatus( 1 ); // It takes part in the interaction
132 G4VSplitableHadron* targetSplitable = 0;
133 if ( ! nucleon->AreYouHit() ) {
134 targetSplitable = new G4DiffractiveSplitableHadron( *nucleon );
135 nucleon->Hit( targetSplitable );
136 targetSplitable->SetStatus( 1 ); // It takes part in the interaction
137
138 #ifdef debugFTFparticipant
139 G4cout << "Participated nucleons #, " << TrN << " " << "Splitable Pr* Tr* "
140 << primarySplitable << " " << targetSplitable << G4endl;
141 #endif
142
143 }
144 G4InteractionContent* aInteraction = new G4InteractionContent( primarySplitable );
145 G4Nucleon* PrNucleon = 0;
146 aInteraction->SetProjectileNucleon( PrNucleon );
147 aInteraction->SetTarget( targetSplitable );
148 aInteraction->SetTargetNucleon( nucleon );
149 aInteraction->SetStatus( 1 );
150 aInteraction->SetInteractionTime( ( primarySplitable->GetPosition().z() +
151 nucleon->GetPosition().z() ) / betta_z );
152 theInteractions.push_back( aInteraction );
153 }
154
155 #ifdef debugFTFparticipant
156 TrN++;
157 #endif
158
159 }
160
161 } while ( ( theInteractions.size() == 0 ) &&
162 ++loopCounter < maxNumberOfLoops ); /* Loop checking, 10.08.2015, A.Ribon */
163 if ( loopCounter >= maxNumberOfLoops ) {
164 #ifdef debugFTFparticipant
165 G4cout << "BAD situation: forced exit from the while loop!" << G4endl;
166 #endif
167 return;
168 }
169
170 #ifdef debugFTFparticipant
171 G4cout << "Number of Hit nucleons " << theInteractions.size() << "\t Bx " << impactX/fermi
172 << "\t By " << impactY/fermi << "\t B "
173 << std::sqrt( sqr( impactX ) + sqr( impactY ) )/fermi << G4endl << G4endl;
174 #endif
175
176 //SortInteractionsIncT(); // Not need because nucleons are sorted in increasing z-coordinates.
177 ShiftInteractionTime(); // To put correct times and z-coordinates
178 return;
179
180 } // end of if ( theProjectileNucleus == 0 )
181
182 // Projectile and target are nuclei
183
184 #ifdef debugFTFparticipant
185 G4cout << "Projectile and target are nuclei" << G4endl;
186 #endif
187
188 //G4cout<<theProjectileNucleus->GetOuterRadius()/fermi<<" "<<theNucleus->GetOuterRadius()/fermi<<" "<<deltaxy/fermi<<G4endl;
189
190 G4double xyradius;
191 xyradius = theProjectileNucleus->GetOuterRadius() + // Range of impact parameter sampling
192 theNucleus->GetOuterRadius() + deltaxy;
193
194 G4double impactX( 0.0 ), impactY( 0.0 );
195
196 const G4int maxNumberOfLoops = 1000;
197 G4int loopCounter = 0;
198 do {
199
200 std::pair< G4double, G4double > theImpactParameter;
201 theImpactParameter = theNucleus->ChooseImpactXandY( xyradius );
202 impactX = theImpactParameter.first;
203 impactY = theImpactParameter.second;
204
205 #ifdef debugFTFparticipant
206 G4cout << "New interaction list, " << "b "
207 << std::sqrt( sqr( impactX ) + sqr( impactY ) )/fermi << G4endl;
208 #endif
209
210 G4ThreeVector theBeamPosition( impactX, impactY, 0.0 );
211
213 G4Nucleon* ProjectileNucleon;
214
215 #ifdef debugFTFparticipant
216 G4int PrNuclN( 0 );
217 #endif
218
219 while ( ( ProjectileNucleon = theProjectileNucleus->GetNextNucleon() ) ) { /* Loop checking, 10.08.2015, A.Ribon */
220
221 G4VSplitableHadron* ProjectileSplitable = 0;
223 G4Nucleon* TargetNucleon = 0;
224
225 #ifdef debugFTFparticipant
226 G4int TrNuclN( 0 );
227 #endif
228
229 while ( ( TargetNucleon = theNucleus->GetNextNucleon() ) ) { /* Loop checking, 10.08.2015, A.Ribon */
230
231 G4double impact2 = sqr( impactX + ProjectileNucleon->GetPosition().x() -
232 TargetNucleon->GetPosition().x() ) +
233 sqr( impactY + ProjectileNucleon->GetPosition().y() -
234 TargetNucleon->GetPosition().y() );
235 G4VSplitableHadron* TargetSplitable = 0;
236 if ( theParameters->GetProbabilityOfInteraction( impact2/fermi/fermi ) >
237 G4UniformRand() ) { // An interaction has happend!
238
239 #ifdef debugFTFparticipant
240 G4cout << G4endl << "An Interaction has happend" << G4endl << "Proj N mom " << PrNuclN
241 << " " << ProjectileNucleon->Get4Momentum() << "-------------" << G4endl
242 << "Targ N mom " << TrNuclN << " " << TargetNucleon->Get4Momentum() << G4endl
243 << "PrN TrN Z coords " << ProjectileNucleon->GetPosition().z()/fermi
244 << " " << TargetNucleon->GetPosition().z()/fermi
245 << " " << ProjectileNucleon->GetPosition().z()/fermi +
246 TargetNucleon->GetPosition().z()/fermi << G4endl;
247 #endif
248
249 if ( ! ProjectileNucleon->AreYouHit() ) {
250 // Projectile nucleon was not involved until now.
251 ProjectileSplitable = new G4DiffractiveSplitableHadron( *ProjectileNucleon );
252 ProjectileNucleon->Hit( ProjectileSplitable );
253 ProjectileSplitable->SetStatus( 1 ); // It takes part in the interaction
254 } else { // Projectile nucleon was involved before.
255 ProjectileSplitable = ProjectileNucleon->GetSplitableHadron();
256 }
257
258 if ( ! TargetNucleon->AreYouHit() ) { // Target nucleon was not involved until now
259 TargetSplitable = new G4DiffractiveSplitableHadron( *TargetNucleon );
260 TargetNucleon->Hit( TargetSplitable );
261 TargetSplitable->SetStatus( 1 ); // It takes part in the interaction
262 } else { // Target nucleon was involved before.
263 TargetSplitable = TargetNucleon->GetSplitableHadron();
264 }
265
266 G4InteractionContent* anInteraction = new G4InteractionContent( ProjectileSplitable );
267 anInteraction->SetTarget( TargetSplitable );
268 anInteraction->SetProjectileNucleon( ProjectileNucleon );
269 anInteraction->SetTargetNucleon( TargetNucleon );
270 anInteraction->SetInteractionTime( ( ProjectileNucleon->GetPosition().z() +
271 TargetNucleon->GetPosition().z() ) / betta_z );
272 anInteraction->SetStatus( 1 );
273
274 #ifdef debugFTFparticipant
275 G4cout << "Part anInteraction->GetInteractionTime() "
276 << anInteraction->GetInteractionTime()/fermi << G4endl
277 << "Splitable Pr* Tr* " << ProjectileSplitable << " "
278 << TargetSplitable << G4endl;
279 #endif
280
281 theInteractions.push_back( anInteraction );
282
283 } // End of an Interaction has happend!
284
285 #ifdef debugFTFparticipant
286 TrNuclN++;
287 #endif
288
289 } // End of while ( ( TargetNucleon = theNucleus->GetNextNucleon() ) )
290
291 #ifdef debugFTFparticipant
292 PrNuclN++;
293 #endif
294
295 } // End of while ( ( ProjectileNucleon = theProjectileNucleus->GetNextNucleon() ) )
296
297 if ( theInteractions.size() != 0 ) theProjectileNucleus->DoTranslation( theBeamPosition );
298
299 } while ( ( theInteractions.size() == 0 ) &&
300 ++loopCounter < maxNumberOfLoops ); /* Loop checking, 10.08.2015, A.Ribon */
301 if ( loopCounter >= maxNumberOfLoops ) {
302 #ifdef debugFTFparticipant
303 G4cout << "BAD situation: forced exit from the while loop!" << G4endl;
304 #endif
305 return;
306 }
307
310
311 #ifdef debugFTFparticipant
312 G4cout << G4endl << "Number of primary collisions " << theInteractions.size()
313 << "\t Bx " << impactX/fermi << "\t By " << impactY/fermi
314 << "\t B " << std::sqrt( sqr( impactX ) + sqr( impactY ) )/fermi << G4endl
315 << "FTF participant End. #######################" << G4endl << G4endl;
316 #endif
317 return;
318}
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
#define G4UniformRand()
Definition: Randomize.hh:52
double z() const
double x() const
double y() const
G4double GetProbabilityOfInteraction(const G4double impactsquare)
G4double GetInteractionTime() const
void SetTargetNucleon(G4Nucleon *aNucleon)
void SetTarget(G4VSplitableHadron *aTarget)
void SetStatus(G4int aValue)
void SetInteractionTime(G4double aValue)
void SetProjectileNucleon(G4Nucleon *aNucleon)
const G4ThreeVector & GetPosition() const
Definition: G4Nucleon.hh:138
G4bool AreYouHit() const
Definition: G4Nucleon.hh:96
G4VSplitableHadron * GetSplitableHadron() const
Definition: G4Nucleon.hh:95
virtual const G4LorentzVector & Get4Momentum() const
Definition: G4Nucleon.hh:72
void Hit(G4VSplitableHadron *aHit)
Definition: G4Nucleon.hh:89
G4double GetTotalEnergy() const
G4ThreeVector GetMomentum() const
virtual G4double GetOuterRadius()=0
virtual G4Nucleon * GetNextNucleon()=0
virtual G4bool StartLoop()=0
virtual void DoTranslation(const G4ThreeVector &theShift)=0
std::pair< G4double, G4double > ChooseImpactXandY(G4double maxImpact)
Definition: G4V3DNucleus.hh:86
G4V3DNucleus * theProjectileNucleus
G4V3DNucleus * theNucleus
void SetStatus(const G4int aStatus)
const G4ThreeVector & GetPosition() const
void SetPosition(const G4ThreeVector &aPosition)
G4bool nucleon(G4int ityp)
T sqr(const T &x)
Definition: templates.hh:128

Referenced by G4FTFModel::GetStrings().

◆ Next()

G4bool G4FTFParticipants::Next ( )
inline

Definition at line 77 of file G4FTFParticipants.hh.

77 {
78 return ++currentInteraction < static_cast< G4int >( theInteractions.size() );
79}

Referenced by G4FTFModel::GetStrings().

◆ operator!=()

G4bool G4FTFParticipants::operator!= ( const G4FTFParticipants right) const
delete

◆ operator=()

const G4FTFParticipants & G4FTFParticipants::operator= ( const G4FTFParticipants right)
delete

◆ operator==()

G4bool G4FTFParticipants::operator== ( const G4FTFParticipants right) const
delete

◆ ShiftInteractionTime()

void G4FTFParticipants::ShiftInteractionTime ( )

Definition at line 339 of file G4FTFParticipants.cc.

339 {
340 G4double InitialTime = theInteractions[0]->GetInteractionTime();
341 for ( unsigned int i = 1; i < theInteractions.size(); i++ ) {
342 G4double InterTime = theInteractions[i]->GetInteractionTime() - InitialTime;
343 theInteractions[i]->SetInteractionTime( InterTime );
344 G4InteractionContent* aCollision = theInteractions[i];
345 G4VSplitableHadron* projectile = aCollision->GetProjectile();
346 G4VSplitableHadron* target = aCollision->GetTarget();
347 G4ThreeVector prPosition = projectile->GetPosition();
348 prPosition.setZ( target->GetPosition().z() );
349 projectile->SetPosition( prPosition );
350 projectile->SetTimeOfCreation( InterTime );
351 target->SetTimeOfCreation( InterTime );
352 }
353 return;
354}
void setZ(double)
G4VSplitableHadron * GetProjectile() const
G4VSplitableHadron * GetTarget() const
void SetTimeOfCreation(G4double aTime)

Referenced by GetList().

◆ SortInteractionsIncT()

void G4FTFParticipants::SortInteractionsIncT ( )

Definition at line 331 of file G4FTFParticipants.cc.

331 { // on increased T
332 if ( theInteractions.size() < 2 ) return; // Avoid unnecesary work
333 std::sort( theInteractions.begin(), theInteractions.end(), G4FTFPartHelperForSortInT );
334}
bool G4FTFPartHelperForSortInT(const G4InteractionContent *Int1, const G4InteractionContent *Int2)

Referenced by GetList().

◆ StartLoop()

void G4FTFParticipants::StartLoop ( )
inline

Definition at line 73 of file G4FTFParticipants.hh.

73 {
74 currentInteraction = -1;
75}

Referenced by GetList(), and G4FTFModel::GetStrings().


The documentation for this class was generated from the following files: