Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4ITReactionChange.cc
이 파일의 문서화 페이지로 가기
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 // $Id: G4ITReactionChange.cc 85244 2014-10-27 08:24:13Z gcosmo $
27 //
28 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
29 //
30 // History:
31 // -----------
32 // 10 Oct 2011 M.Karamitros created
33 //
34 // -------------------------------------------------------------------
35 
36 #include "G4ITReactionChange.hh"
37 
39  fSecondaries(0),
40  fNumberOfSecondaries(0),
41  fKillParents(false),
42  fParticleChangeIsSet(false)
43 {
44  //ctor
45 }
46 
48 {
49  //dtor
50  delete fSecondaries;
51  fSecondaries = 0;
52 }
53 
54 // Should not be used
56  fSecondaries(0),
57  fNumberOfSecondaries(0),
58  fKillParents(false),
59  fParticleChangeIsSet(false)
60 {
61  //copy ctor
62 }
63 
64 // should not be used
66 {
67  if (this == &rhs) return *this; // handle self assignment
68  //assignment operator
69  return *this;
70 }
71 
73  const G4Track& trackB,
74  G4VParticleChange* particleChangeA,
75  G4VParticleChange* particleChangeB)
76 {
77  fParticleChange.clear();
78  fParticleChange[&trackA] = particleChangeA;
79  fParticleChange[&trackB] = particleChangeB;
80 
81  if (particleChangeA || particleChangeB)
82  {
83  G4bool test = particleChangeA && particleChangeB;
84 
85  if (test == false)
86  {
87  G4ExceptionDescription exceptionDescription;
88  exceptionDescription << "If you give for one track a particleChange, ";
89  exceptionDescription
90  << "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 
104  fSecondaries = 0;
106  fKillParents = false;
107 }
108 
110 {
111  if (fSecondaries == 0) fSecondaries = new std::vector<G4Track*>();
112  fSecondaries->push_back(aTrack);
114 }
115 
117 {
118  fParticleChange[stepA->GetTrack()]->UpdateStepForPostStep(stepA);
119  fParticleChange[stepB->GetTrack()]->UpdateStepForPostStep(stepB);
120 }
121 
123 {
124  std::map<const G4Track*, G4VParticleChange*>::iterator it = fParticleChange
125  .find(track);
126 
127  if (it == fParticleChange.end()) return 0;
128  else return it->second;
129 }
130 
132 {
133  std::map<const G4Track*, G4VParticleChange*>::iterator it = fParticleChange
134  .begin();
135  if (it != fParticleChange.end())
136  {
137  return it->first;
138  }
139 
140  G4ExceptionDescription exceptionDescription;
141  exceptionDescription
142  << "No track A found ! Have you initialized the ReactionChange ?";
143  G4Exception("G4ITReactionChange::GetTrackA", "ITReactionChange001",
144  FatalErrorInArgument, exceptionDescription);
145  return 0;
146 }
147 
149 {
150  std::map<const G4Track*, G4VParticleChange*>::iterator it = fParticleChange
151  .begin();
152  std::map<const G4Track*, G4VParticleChange*>::iterator next = it++;
153  if (next == fParticleChange.end())
154  {
155  G4ExceptionDescription exceptionDescription;
156  exceptionDescription
157  << "No track B found ! Have you initialized the ReactionChange ?";
158  G4Exception("G4ITReactionChange::GetTrackB", "ITReactionChange002",
159  FatalErrorInArgument, exceptionDescription);
160  }
161 
162  return it->first;
163 }
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:45
void Initialize(const G4Track &, const G4Track &, G4VParticleChange *particleChangeA=0, G4VParticleChange *particleChangeB=0)
bool G4bool
Definition: G4Types.hh:79
const G4Track * GetTrackA()
G4Track * GetTrack() const
Definition: G4Step.hh:76
void UpdateStepInfo(G4Step *, G4Step *)
void AddSecondary(G4Track *aSecondary)
G4ITReactionChange & operator=(const G4ITReactionChange &other)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
G4VParticleChange * GetParticleChange(const G4Track *)
const G4Track * GetTrackB()
std::vector< G4Track * > * fSecondaries
std::map< const G4Track *, G4VParticleChange * > fParticleChange