Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes
G4ITReactionChange Class Reference

#include <G4ITReactionChange.hh>

Public Member Functions

 G4ITReactionChange ()
 
virtual ~G4ITReactionChange ()
 
void Initialize (const G4Track &, const G4Track &, G4VParticleChange *particleChangeA=0, G4VParticleChange *particleChangeB=0)
 
void AddSecondary (G4Track *aSecondary)
 
void KillParents (G4bool)
 
G4VParticleChangeGetParticleChange (const G4Track *)
 
void UpdateStepInfo (G4Step *, G4Step *)
 
G4TrackGetSecondary (G4int) const
 
G4TrackFastVectorGetfSecondary ()
 
G4int GetNumberOfSecondaries () const
 
G4bool WereParentsKilled () const
 
const G4TrackGetTrackA ()
 
const G4TrackGetTrackB ()
 

Protected Member Functions

 G4ITReactionChange (const G4ITReactionChange &other)
 
G4ITReactionChangeoperator= (const G4ITReactionChange &other)
 
G4bool operator== (const G4ITReactionChange &right) const
 
G4bool operator!= (const G4ITReactionChange &right) const
 

Protected Attributes

std::map< const G4Track
*, G4VParticleChange * > 
fParticleChange
 
G4TrackFastVectorfSecondaries
 
G4int fNumberOfSecondaries
 
G4bool fKillParents
 
G4bool fParticleChangeIsSet
 

Detailed Description

Similar to G4ParticleChange, but deal with two tracks rather than one.

Definition at line 50 of file G4ITReactionChange.hh.

Constructor & Destructor Documentation

G4ITReactionChange::G4ITReactionChange ( )

Default constructor

Definition at line 38 of file G4ITReactionChange.cc.

38  :
39  fSecondaries(0),
41  fKillParents(false),
43 {
44  //ctor
45 }
G4TrackFastVector * fSecondaries
G4ITReactionChange::~G4ITReactionChange ( )
virtual

Default destructor

Definition at line 47 of file G4ITReactionChange.cc.

References fSecondaries.

48 {
49  //dtor
50  delete fSecondaries;
51  fSecondaries = 0 ;
52 }
G4TrackFastVector * fSecondaries
G4ITReactionChange::G4ITReactionChange ( const G4ITReactionChange other)
protected

Copy constructor

Parameters
otherObject to copy from

Definition at line 55 of file G4ITReactionChange.cc.

55  :
56  fSecondaries(0),
58  fKillParents(false),
60 {
61  //copy ctor
62 }
G4TrackFastVector * fSecondaries

Member Function Documentation

void G4ITReactionChange::AddSecondary ( G4Track aSecondary)

Definition at line 108 of file G4ITReactionChange.cc.

References fNumberOfSecondaries, fSecondaries, G4cerr, G4endl, G4TrackFastVectorSize, and G4FastVector< Type, N >::SetElement().

Referenced by G4DNAMolecularReaction::MakeReaction().

109 {
111 
112  // add a secondary after size check
114  {
117  }
118  else
119  {
120  G4cerr << "G4ITReactionChange::AddSecondary() Warning ";
121  G4cerr << "fSecondaries is full !! " << G4endl;
122  G4cerr << " The object will not be added in fSecondaries" << G4endl;
123  }
124 }
void SetElement(G4int anIndex, Type *anElement)
Definition: G4FastVector.hh:76
G4FastVector< G4Track, G4TrackFastVectorSize > G4TrackFastVector
#define G4endl
Definition: G4ios.hh:61
const G4int G4TrackFastVectorSize
G4TrackFastVector * fSecondaries
G4GLOB_DLL std::ostream G4cerr
G4TrackFastVector * G4ITReactionChange::GetfSecondary ( )
inline

Definition at line 130 of file G4ITReactionChange.hh.

References fSecondaries.

131 {
132  return fSecondaries;
133 }
G4TrackFastVector * fSecondaries
G4int G4ITReactionChange::GetNumberOfSecondaries ( ) const
inline

Definition at line 115 of file G4ITReactionChange.hh.

References fNumberOfSecondaries.

116 {
117  return fNumberOfSecondaries;
118 }
G4VParticleChange * G4ITReactionChange::GetParticleChange ( const G4Track track)

Definition at line 132 of file G4ITReactionChange.cc.

References fParticleChange.

133 {
134  std::map<const G4Track*, G4VParticleChange*>::iterator it = fParticleChange.find(track);
135 
136  if(it == fParticleChange.end()) return 0;
137  else return it ->second;
138 }
std::map< const G4Track *, G4VParticleChange * > fParticleChange
G4Track * G4ITReactionChange::GetSecondary ( G4int  anIndex) const
inline

Definition at line 110 of file G4ITReactionChange.hh.

References fSecondaries.

111 {
112  return (*fSecondaries)[anIndex];
113 }
G4TrackFastVector * fSecondaries
const G4Track * G4ITReactionChange::GetTrackA ( )

Definition at line 140 of file G4ITReactionChange.cc.

References FatalErrorInArgument, fParticleChange, and G4Exception().

141 {
142  std::map<const G4Track*, G4VParticleChange*>::iterator it = fParticleChange.begin();
143  if(it != fParticleChange.end())
144  {
145  return it->first;
146  }
147 
148  G4ExceptionDescription exceptionDescription ;
149  exceptionDescription << "No track A found ! Have you initialized the ReactionChange ?";
150  G4Exception("G4ITReactionChange::GetTrackA","ITReactionChange001",
151  FatalErrorInArgument,exceptionDescription);
152  return 0;
153 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::map< const G4Track *, G4VParticleChange * > fParticleChange
const G4Track * G4ITReactionChange::GetTrackB ( )

Definition at line 155 of file G4ITReactionChange.cc.

References FatalErrorInArgument, fParticleChange, and G4Exception().

156 {
157  std::map<const G4Track*, G4VParticleChange*>::iterator it = fParticleChange.begin();
158  std::map<const G4Track*, G4VParticleChange*>::iterator next = it++;
159  if(next == fParticleChange.end())
160  {
161  G4ExceptionDescription exceptionDescription ;
162  exceptionDescription << "No track B found ! Have you initialized the ReactionChange ?";
163  G4Exception("G4ITReactionChange::GetTrackB","ITReactionChange002",
164  FatalErrorInArgument,exceptionDescription);
165  }
166 
167  return it->first;
168 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::map< const G4Track *, G4VParticleChange * > fParticleChange
void G4ITReactionChange::Initialize ( const G4Track trackA,
const G4Track trackB,
G4VParticleChange particleChangeA = 0,
G4VParticleChange particleChangeB = 0 
)

Definition at line 72 of file G4ITReactionChange.cc.

References FatalErrorInArgument, fKillParents, fNumberOfSecondaries, fParticleChange, fParticleChangeIsSet, fSecondaries, G4Exception(), and mcscore::test().

Referenced by G4DNAMolecularReaction::MakeReaction().

77 {
78  fParticleChange.clear();
79  fParticleChange[&trackA] = particleChangeA;
80  fParticleChange[&trackB] = particleChangeB;
81 
82  if(particleChangeA || particleChangeB)
83  {
84  G4bool test = particleChangeA && particleChangeB ;
85 
86  if(test == false)
87  {
88  G4ExceptionDescription exceptionDescription ;
89  exceptionDescription << "If you give for one track a particleChange, ";
90  exceptionDescription << "G4ITReactionChange is expecting that you give for both ";
91  exceptionDescription << "reacting tracks a particleChange.";
92  G4Exception("G4ITReactionChange::Initialize","ITReactionChange001",
93  FatalErrorInArgument,exceptionDescription);
94  }
95 
96  fParticleChangeIsSet = true;
97 
98  fParticleChange[&trackA]->Initialize(trackA);
99  fParticleChange[&trackB]->Initialize(trackB);;
100 
101  }
102 
103  fSecondaries = 0;
105  fKillParents = false;
106 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::map< const G4Track *, G4VParticleChange * > fParticleChange
def test
Definition: mcscore.py:117
G4TrackFastVector * fSecondaries
void G4ITReactionChange::KillParents ( G4bool  kill)
inline

Definition at line 120 of file G4ITReactionChange.hh.

References fKillParents.

Referenced by G4DNAMolecularReaction::MakeReaction().

121 {
122  fKillParents = kill;
123 }
G4bool G4ITReactionChange::operator!= ( const G4ITReactionChange right) const
protected
G4ITReactionChange & G4ITReactionChange::operator= ( const G4ITReactionChange other)
protected

Assignment operator

Parameters
otherObject to assign from
Returns
A reference to this

Definition at line 65 of file G4ITReactionChange.cc.

66 {
67  if (this == &rhs) return *this; // handle self assignment
68  //assignment operator
69  return *this;
70 }
G4bool G4ITReactionChange::operator== ( const G4ITReactionChange right) const
protected
void G4ITReactionChange::UpdateStepInfo ( G4Step stepA,
G4Step stepB 
)

Definition at line 126 of file G4ITReactionChange.cc.

References fParticleChange, and G4Step::GetTrack().

127 {
128  fParticleChange[stepA->GetTrack()]->UpdateStepForPostStep(stepA);
129  fParticleChange[stepB->GetTrack()]->UpdateStepForPostStep(stepB);
130 }
std::map< const G4Track *, G4VParticleChange * > fParticleChange
G4Track * GetTrack() const
G4bool G4ITReactionChange::WereParentsKilled ( ) const
inline

Definition at line 125 of file G4ITReactionChange.hh.

References fKillParents.

126 {
127  return fKillParents ;
128 }

Field Documentation

G4bool G4ITReactionChange::fKillParents
protected

Definition at line 106 of file G4ITReactionChange.hh.

Referenced by Initialize(), KillParents(), and WereParentsKilled().

G4int G4ITReactionChange::fNumberOfSecondaries
protected

Definition at line 105 of file G4ITReactionChange.hh.

Referenced by AddSecondary(), GetNumberOfSecondaries(), and Initialize().

std::map<const G4Track*, G4VParticleChange*> G4ITReactionChange::fParticleChange
protected
G4bool G4ITReactionChange::fParticleChangeIsSet
protected

Definition at line 107 of file G4ITReactionChange.hh.

Referenced by Initialize().

G4TrackFastVector* G4ITReactionChange::fSecondaries
protected

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