Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4UnknownDecay.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 //
27 // $Id: G4UnknownDecay.cc 105727 2017-08-16 12:47:05Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------
31 // GEANT 4 class implementation file
32 //
33 // ------------------------------------------------------------
34 //
35 
36 #include "G4UnknownDecay.hh"
37 
38 #include "G4PhysicalConstants.hh"
39 #include "G4SystemOfUnits.hh"
40 #include "G4DynamicParticle.hh"
41 #include "G4DecayProducts.hh"
42 #include "G4PhysicsLogVector.hh"
44 #include "G4DecayProcessType.hh"
45 
46 // constructor
48  :G4VDiscreteProcess(processName, fDecay),
49  verboseLevel(1),
50  HighestValue(20.0)
51 {
52  // set Process Sub Type
53  SetProcessSubType(static_cast<int>(DECAY_Unknown));
54 
55 #ifdef G4VERBOSE
56  if (GetVerboseLevel()>1) {
57  G4cout << "G4UnknownDecay constructor " << " Name:" << processName << G4endl;
58  }
59 #endif
61 }
62 
64 {
65 }
66 
68 {
69  if(aParticleType.GetParticleName()=="unknown") return true;
70  return false;
71 }
72 
74 {
75  return DBL_MIN;
76 }
77 
79 {
80  return;
81 }
82 
84 {
85  // The DecayIt() method returns by pointer a particle-change object.
86  // Units are expressed in GEANT4 internal units.
87 
88  // Initialize ParticleChange
89  // all members of G4VParticleChange are set to equal to
90  // corresponding member in G4Track
92 
93  // get particle
94  const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
95 
96  //check if thePreAssignedDecayProducts exists
97  const G4DecayProducts* o_products = (aParticle->GetPreAssignedDecayProducts());
98  G4bool isPreAssigned = (o_products != nullptr);
99  G4DecayProducts* products = nullptr;
100 
101  if (!isPreAssigned ){
103  // Kill the parent particle
106 
108  return &fParticleChangeForDecay ;
109  }
110 
111  // copy decay products
112  products = new G4DecayProducts(*o_products);
113 
114  // get parent particle information ...................................
115  G4double ParentEnergy = aParticle->GetTotalEnergy();
116  G4double ParentMass = aParticle->GetMass();
117  if (ParentEnergy < ParentMass) {
118  ParentEnergy = ParentMass;
119 #ifdef G4VERBOSE
120  if (GetVerboseLevel()>1) {
121  G4cout << "G4UnknownDecay::DoIt : Total Energy is less than its mass" << G4endl;
122  G4cout << " Particle: " << aParticle->GetDefinition()->GetParticleName();
123  G4cout << " Energy:" << ParentEnergy/MeV << "[MeV]";
124  G4cout << " Mass:" << ParentMass/MeV << "[MeV]";
125  G4cout << G4endl;
126  }
127 #endif
128  }
129  G4ThreeVector ParentDirection(aParticle->GetMomentumDirection());
130 
131  G4double energyDeposit = 0.0;
132  G4double finalGlobalTime = aTrack.GetGlobalTime();
133  //boost all decay products to laboratory frame
134  //if the particle has traveled
135  if(aParticle->GetPreAssignedDecayProperTime()>0.) {
136  products->Boost( ParentEnergy, ParentDirection);
137  }
138 
139  //add products in fParticleChangeForDecay
140  G4int numberOfSecondaries = products->entries();
141  fParticleChangeForDecay.SetNumberOfSecondaries(numberOfSecondaries);
142 #ifdef G4VERBOSE
143  if (GetVerboseLevel()>1) {
144  G4cout << "G4UnknownDecay::DoIt : Decay vertex :";
145  G4cout << " Time: " << finalGlobalTime/ns << "[ns]";
146  G4cout << " X:" << (aTrack.GetPosition()).x() /cm << "[cm]";
147  G4cout << " Y:" << (aTrack.GetPosition()).y() /cm << "[cm]";
148  G4cout << " Z:" << (aTrack.GetPosition()).z() /cm << "[cm]";
149  G4cout << G4endl;
150  G4cout << "G4UnknownDecay::DoIt : decay products in Lab. Frame" << G4endl;
151  products->DumpInfo();
152  }
153 #endif
154  G4int index;
155  G4ThreeVector currentPosition;
156  const G4TouchableHandle thand = aTrack.GetTouchableHandle();
157  for (index=0; index < numberOfSecondaries; index++){
158  // get current position of the track
159  currentPosition = aTrack.GetPosition();
160  // create a new track object
161  G4Track* secondary = new G4Track( products->PopProducts(),
162  finalGlobalTime ,
163  currentPosition );
164  // switch on good for tracking flag
165  secondary->SetGoodForTrackingFlag();
166  secondary->SetTouchableHandle(thand);
167  // add the secondary track in the List
169  }
170  delete products;
171 
172  // Kill the parent particle
175  fParticleChangeForDecay.ProposeGlobalTime( finalGlobalTime );
176  // reset NumberOfInteractionLengthLeft
178 
179  return &fParticleChangeForDecay ;
180 }
181 
182 void G4UnknownDecay::ProcessDescription(std::ostream& outFile) const
183 {
184  outFile << GetProcessName()
185  << ": Decay of 'unknown' particles. \n"
186  << "kinematics of daughters are dertermined "
187  << "by PreAssignedDecayProducts. \n";
188 }
189 
190 
191 
192 
193 
Float_t x
Definition: compare.C:6
virtual void BuildPhysicsTable(const G4ParticleDefinition &) override
virtual G4double GetMeanFreePath(const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition) override
void AddSecondary(G4Track *aSecondary)
virtual G4VParticleChange * DecayIt(const G4Track &aTrack, const G4Step &aStep)
G4UnknownDecay(const G4String &processName="UnknownDecay")
static constexpr double MeV
Definition: G4SIunits.hh:214
#define G4endl
Definition: G4ios.hh:61
Float_t y
Definition: compare.C:6
const G4ThreeVector & GetMomentumDirection() const
Double_t z
const G4String & GetParticleName() const
const G4TouchableHandle & GetTouchableHandle() const
G4DynamicParticle * PopProducts()
void Boost(G4double totalEnergy, const G4ThreeVector &momentumDirection)
G4int entries() const
virtual G4bool IsApplicable(const G4ParticleDefinition &) override
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4ParticleDefinition * GetDefinition() const
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283
void DumpInfo() const
G4double GetGlobalTime() const
G4double GetPreAssignedDecayProperTime() const
G4int GetVerboseLevel() const
Definition: G4VProcess.hh:445
void SetTouchableHandle(const G4TouchableHandle &apValue)
const G4String & GetProcessName() const
Definition: G4VProcess.hh:411
const G4ThreeVector & GetPosition() const
Definition: G4Step.hh:76
void SetGoodForTrackingFlag(G4bool value=true)
const G4DecayProducts * GetPreAssignedDecayProducts() const
int G4int
Definition: G4Types.hh:78
#define DBL_MIN
Definition: templates.hh:75
G4ParticleChangeForDecay fParticleChangeForDecay
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:435
G4ForceCondition
static constexpr double cm
Definition: G4SIunits.hh:119
G4GLOB_DLL std::ostream G4cout
void ClearNumberOfInteractionLengthLeft()
Definition: G4VProcess.hh:450
virtual ~G4UnknownDecay()
G4double GetMass() const
G4double GetTotalEnergy() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
virtual void ProcessDescription(std::ostream &outFile) const override
virtual void Initialize(const G4Track &)
void ProposeTrackStatus(G4TrackStatus status)
#define ns
Definition: xmlparse.cc:614
const G4DynamicParticle * GetDynamicParticle() const
void SetNumberOfSecondaries(G4int totSecondaries)