FairRoot/PandaRoot
Test30HadronProduction.cxx
Go to the documentation of this file.
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 // -------------------------------------------------------------
28 // GEANT 4 class
29 //
30 // ---------- Test30HadronProduction -------
31 // by Vladimir Ivanchenko, 12 March 2002
32 //
33 // Modified:
34 //
35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
37 
38 
39 #include "Test30HadronProduction.hh"
40 #include "Test30VSecondaryGenerator.hh"
41 
42 #include "G4Track.hh"
43 #include "G4ParticleDefinition.hh"
44 #include "G4ParticleTable.hh"
45 #include "G4DynamicParticle.hh"
46 #include "G4VPhysicalVolume.hh"
47 #include "G4LogicalVolume.hh"
48 #include "G4VSolid.hh"
49 #include "G4Tubs.hh"
50 #include "Randomize.hh"
51 #include "G4LorentzVector.hh"
52 #include "G4ParticleChange.hh"
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
55 
56 Test30HadronProduction::Test30HadronProduction(const G4String& aName)
57  :G4VDiscreteProcess(aName),
58  theGenerator(0)
59 {
60  InitializeMe();
61 }
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64 
65 void Test30HadronProduction::InitializeMe()
66 {}
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
69 
70 Test30HadronProduction::~Test30HadronProduction()
71 {
72  if(theGenerator) delete theGenerator;
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
76 
77 G4double Test30HadronProduction::PostStepGetPhysicalInteractionLength(
78  const G4Track&,
79  G4double,
80  G4ForceCondition* condition)
81 {
82  // condition is set to "Not Forced"
83  *condition = NotForced;
84  G4double z = DBL_MAX;
85 
86  return z;
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
90 
91 void Test30HadronProduction::SetSecondaryGenerator(Test30VSecondaryGenerator* gen)
92 {
93  if(theGenerator) delete theGenerator;
94  theGenerator = gen;
95 }
96 
97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
98 
99 G4VParticleChange* Test30HadronProduction::PostStepDoIt(
100  const G4Track& track,
101  const G4Step&)
102 {
103  G4HadFinalState* result = theGenerator->Secondaries(track);
104 
105  ClearNumberOfInteractionLengthLeft();
106  theChange.Initialize(track);
107 
108  G4int ns = result->GetNumberOfSecondaries();
109  G4int nb = ns;
110  if(result->GetStatusChange() == isAlive) nb++;
111 
112  theChange.ProposeTrackStatus(fStopAndKill);
113  theChange.SetNumberOfSecondaries(nb);
114 
115  for(G4int i=0; i<ns; i++) {
116  G4Track* tr = new G4Track(result->GetSecondary(i)->GetParticle(),
117  track.GetGlobalTime(),
118  track.GetPosition());
119  theChange.AddSecondary(tr);
120  }
121 
122  if(result->GetStatusChange() == isAlive) {
123  G4DynamicParticle* dp = new G4DynamicParticle(*(track.GetDynamicParticle()));
124  G4Track* tr = new G4Track(dp,track.GetGlobalTime(),track.GetPosition());
125  tr->SetKineticEnergy(result->GetEnergyChange());
126  tr->SetMomentumDirection(result->GetMomentumChange());
127  theChange.AddSecondary(tr);
128  }
129  result->Clear();
130 
131  return &theChange;
132 }
133 
134 
135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Int_t i
Definition: run_full.C:25
PndMCTrack * track
Definition: anaLmdCluster.C:89
Double_t z