source: trunk/source/geometry/magneticfield/test/field06/src/MyExSteppingAction.cc@ 1256

Last change on this file since 1256 was 1199, checked in by garnier, 16 years ago

nvx fichiers dans CVS

File size: 8.6 KB
Line 
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: MyExSteppingAction.cc,v 1.1 2006/11/28 15:19:42 tnikitin Exp $
28// GEANT4 tag $Name: HEAD $
29//
30//
31
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34#include "ExN01SteppingAction.hh"
35
36#include "ExN01DetectorConstruction.hh"
37#include "ExN01EventAction.hh"
38
39#include "G4Step.hh"
40 #include "G4UnitsTable.hh"
41
42////#include "G4RunManager.hh"
43
44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45ExN01SteppingAction::ExN01SteppingAction(ExN01DetectorConstruction* det,
46 ExN01EventAction* evt)
47:detector(det), event_action(evt)
48{ }
49
50//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51ExN01SteppingAction::~ExN01SteppingAction()
52{ }
53
54//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55void ExN01SteppingAction::UserSteppingAction(const G4Step* aStep)
56{
57 // get volume of the current step
58 G4VPhysicalVolume* volume
59 = aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
60 //
61 //tanja
62 //get name of particle
63 G4double EndStepX=0.;
64 G4double EndStepY=0.;
65 G4double EndStepZ=0.;
66 G4String particleName = (aStep -> GetTrack() -> GetDynamicParticle()
67 -> GetDefinition() -> GetParticleName());
68 if( particleName =="e-")
69 {
70 // G4cout<<particleName<<G4endl;
71 EndStepX =
72 aStep->GetPreStepPoint()->GetPosition().x();
73
74 EndStepY =
75 aStep->GetPreStepPoint()->GetPosition().y();
76 EndStepZ =
77 aStep->GetPreStepPoint()->GetPosition().z();
78 G4cout<<particleName<<" "<<"PreStep"<<" "
79 << std::setw(6) << G4BestUnit(aStep->GetPreStepPoint()->GetPosition().x(),"Length")<<" "
80 << std::setw(6) << G4BestUnit(aStep->GetPreStepPoint()->GetPosition().y(),"Length")<<" "
81 << std::setw(6) << G4BestUnit(aStep->GetPreStepPoint()->GetPosition().z(),"Length")<<" "
82 << std::setw(6) << G4BestUnit(std::sqrt(EndStepX*EndStepX+EndStepY*EndStepY),"Length")<<" "
83
84 << std::setw(6) << G4BestUnit(aStep->GetStepLength(),"Length")<<" "
85 << std::setw(10) <<aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetName()<<" "
86 <<G4endl;
87 //G4cout<<particleName<<" "<<"PostStep "
88 // << std::setw(6) << G4BestUnit(aStep->GetPostStepPoint()->GetPosition().x(),"Length")<<" "
89 // << std::setw(6) << G4BestUnit(aStep->GetPostStepPoint()->GetPosition().y(),"Length")<<" "
90 // << std::setw(6) << G4BestUnit(aStep->GetPostStepPoint()->GetPosition().z(),"Length")<<" "
91 // << std::setw(6) << G4BestUnit(aStep->GetStepLength(),"Length")<<" "
92 //
93 //// <<G4endl;
94 //
95 // const G4int verboseLevel=1;
96 //G4cout.precision(6);
97 // G4cout.setf(ios_base::fixed,ios_base::floatfield);
98 // G4cout << std::setw( 9) << "X(mm)" << " "
99 // << std::setw( 9) << "Y(mm)" << " "
100 // << std::setw( 9) << "Z(mm)" << " "
101 // << std::setw( 9) << " N_x " << " "
102 // << std::setw( 9) << " N_y " << " "
103 // << std::setw( 9) << " N_z " << " "
104 // // << std::setw( 9) << " Delta|N|" << " "
105 // // << std::setw( 9) << " Delta(N_z) " << " "
106 // // << std::setw( 9) << "StepLen" << " "
107 // // << std::setw( 9) << "PhsStep" << " "
108 // << std::setw( 9) << "Safety" << " "
109 // << std::setw(18) << "NextVolume" << " "
110 // << G4endl;
111
112
113
114 //G4cout.precision(6);
115 //G4cout <<std::setw( 9) <<aStep->GetPreStepPoint()->GetPosition().x() << " "
116 // << std::setw( 9) <<aStep->GetPreStepPoint()->GetPosition().y() << " "
117 // << std::setw( 9) <<aStep->GetPreStepPoint()->GetPosition().z() << " "
118 // // << std::setw( 9) <<aStep->GetPreStepPoint()->GetVelocity.x() << " "
119 // // << std::setw( 9) << aStep->GetPreStepPoint()->GetVelocity.y() << " "
120 // // << std::setw( 9) <<aStep->GetPreStepPoint()->GetVelocity.z() << " ";
121 // // G4cout.precision(2);
122
123 /// // << std::setw( 9) <<aStep->GetPreStepPoint()->GetSafety << " "
124 // << std::setw(12) << aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume() << " "
125 // <<G4endl;
126
127
128
129 }
130 if( particleName =="chargedgeantino")
131 {
132 // G4cout<<particleName<<G4endl;
133 EndStepX =
134 aStep->GetPreStepPoint()->GetPosition().x();
135
136 EndStepY =
137 aStep->GetPreStepPoint()->GetPosition().y();
138 EndStepZ =
139 aStep->GetPreStepPoint()->GetPosition().z();
140 G4cout<<particleName<<" "
141 << std::setw(6) << G4BestUnit(aStep->GetPreStepPoint()->GetPosition().x(),"Length")<<" "
142 << std::setw(6) << G4BestUnit(aStep->GetPreStepPoint()->GetPosition().y(),"Length")<<" "
143 << std::setw(6) << G4BestUnit(aStep->GetPreStepPoint()->GetPosition().z(),"Length")<<" "
144 <<G4endl;
145
146 }
147 if( particleName =="mu+")
148 {
149 // G4cout<<particleName<<G4endl;
150 EndStepX =
151 aStep->GetPreStepPoint()->GetPosition().x();
152
153 EndStepY =
154 aStep->GetPreStepPoint()->GetPosition().y();
155 EndStepZ =
156 aStep->GetPreStepPoint()->GetPosition().z();
157 G4cout<<particleName<<" "
158 << std::setw(6) << G4BestUnit(aStep->GetPreStepPoint()->GetPosition().x(),"Length")<<" "
159 << std::setw(6) << G4BestUnit(aStep->GetPreStepPoint()->GetPosition().y(),"Length")<<" "
160 << std::setw(6) << G4BestUnit(aStep->GetPreStepPoint()->GetPosition().z(),"Length")<<" "
161 <<G4endl;
162
163 }
164 //end tanja
165 // collect energy and track length step by step
166
167 //end tanja
168 //example of saving random number seed of this event, under condition
169 //// if (condition) G4RunManager::GetRunManager()->rndmSaveThisEvent();
170}
171
172//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.