5 #include "G4TrackStatus.hh" 7 #include "G4SteppingManager.hh" 8 #include "G4ParticleDefinition.hh" 9 #include "G4VProcess.hh" 10 #include "G4SystemOfUnits.hh" 13 std::vector<G4int>& evtNum,
14 std::vector<G4int>& primV,
15 std::vector<G4int>& trNum)
16 : m_PrintEvent(
false),m_PrintTrack(
false),m_verbose(verb),
17 m_EventNumbers(evtNum),m_PrimaryVertex(primV),m_TrackNumbers(trNum),
50 G4cout <<
"========== Event #" << evt->GetEventID() <<
" " 51 << evt->GetNumberOfPrimaryVertex() <<
" primary vertexes ======" 74 G4cout <<
"*********************************************************************************************************" << G4endl;
75 const G4ParticleDefinition* pd = track->GetDefinition();
76 G4cout <<
"* G4Track Information: Particle = ";
77 if(pd) {
G4cout << pd->GetParticleName(); }
78 G4cout <<
", Track ID = " << track->GetTrackID()
79 <<
", Parent ID = " << track->GetParentID() << G4endl;
80 G4cout <<
"*********************************************************************************************************" << G4endl;
82 G4cout << std::setw( 5) <<
"Step#" <<
" " 83 << std::setw( 8) <<
"X(cm)" <<
" " 84 << std::setw( 8) <<
"Y(cm)" <<
" " 85 << std::setw( 8) <<
"Z(cm)" <<
" " 86 << std::setw( 9) <<
"KinE(GeV)" <<
" " 87 << std::setw( 8) <<
"dE(MeV)" <<
" " 88 << std::setw( 8) <<
"Step(mm)" <<
" " 89 << std::setw( 9) <<
"TrackL(cm)" <<
" " 90 << std::setw(30) <<
"PhysVolume" <<
" " 91 << std::setw( 8) <<
"ProcName" << G4endl;
93 G4int prec =
G4cout.precision(4);
95 G4cout << std::setw( 5) << track->GetCurrentStepNumber() <<
" " 96 << std::setw( 8) << track->GetPosition().x()/CLHEP::cm <<
" " 97 << std::setw( 8) << track->GetPosition().y()/CLHEP::cm <<
" " 98 << std::setw( 8) << track->GetPosition().z()/CLHEP::cm <<
" " 99 << std::setw( 9) << track->GetKineticEnergy()/
CLHEP::GeV <<
" " 100 << std::setw( 8) <<
" " 101 << std::setw( 8) <<
" " 102 << std::setw( 9) <<
" ";
103 if( track->GetVolume() !=
nullptr ) {
104 G4cout << std::setw(30) << track->GetVolume()->GetName() <<
" ";
106 if(isKilled) {
G4cout <<
"isKilled"; }
120 G4int prec =
G4cout.precision(4);
122 G4cout << std::setw(10) << track->GetTrackID() <<
" " 123 << std::setw( 8) << track->GetPosition().x()/CLHEP::cm <<
" " 124 << std::setw( 8) << track->GetPosition().y()/CLHEP::cm <<
" " 125 << std::setw( 8) << track->GetPosition().z()/CLHEP::cm <<
" " 126 << std::setw( 9) << track->GetKineticEnergy()/
CLHEP::GeV <<
" ";
127 if( track->GetVolume() !=
nullptr ) {
128 G4cout << std::setw(24) << track->GetVolume()->GetName() <<
" ";
130 if(isKilled) {
G4cout <<
"isKilled"; }
136 const G4SteppingManager* sManager,
142 const G4Track*
track = step->GetTrack();
143 const G4StepPoint* preStep = step->GetPreStepPoint();
144 const G4StepPoint* postStep = step->GetPostStepPoint();
148 prec =
G4cout.precision(16);
151 G4cout <<
" ++G4Step Information " << G4endl;
152 G4cout <<
" Address of G4Track : " << track << G4endl;
153 G4cout <<
" Step Length (mm) : " << track->GetStepLength()
155 G4cout <<
" Energy Deposit (MeV) : " << step->GetTotalEnergyDeposit()
158 G4cout <<
" -------------------------------------------------------" 159 <<
"-------------------------------" << G4endl;
160 G4cout <<
" StepPoint Information " << std::setw(30) <<
"PreStep" 161 << std::setw(30) <<
"PostStep" << G4endl;
162 G4cout <<
" -------------------------------------------------------" 163 <<
"-------------------------------" << G4endl;
164 G4cout <<
" Position - x (cm) : " 165 << std::setw(30) << preStep->GetPosition().x()/CLHEP::cm
166 << std::setw(30) << postStep->GetPosition().x()/CLHEP::cm << G4endl;
167 G4cout <<
" Position - y (cm) : " 168 << std::setw(30) << preStep->GetPosition().y()/CLHEP::cm
169 << std::setw(30) << postStep->GetPosition().y()/CLHEP::cm << G4endl;
170 G4cout <<
" Position - z (cm) : " 171 << std::setw(30) << preStep->GetPosition().z()/CLHEP::cm
172 << std::setw(30) << postStep->GetPosition().z()/CLHEP::cm << G4endl;
173 G4cout <<
" Global Time (ns) : " 174 << std::setw(30) << preStep->GetGlobalTime()/CLHEP::ns
175 << std::setw(30) << postStep->GetGlobalTime()/CLHEP::ns << G4endl;
176 G4cout <<
" Local Time (ns) : " 177 << std::setw(30) << preStep->GetLocalTime()/CLHEP::ns
178 << std::setw(30) << postStep->GetLocalTime()/CLHEP::ns << G4endl;
179 G4cout <<
" Proper Time (ns) : " 180 << std::setw(30) << preStep->GetProperTime()/CLHEP::ns
181 << std::setw(30) << postStep->GetProperTime()/CLHEP::ns << G4endl;
182 G4cout <<
" Momentum Direct - x : " 183 << std::setw(30) << preStep->GetMomentumDirection().x()
184 << std::setw(30) << postStep->GetMomentumDirection().x()
186 G4cout <<
" Momentum Direct - y : " 187 << std::setw(30) << preStep->GetMomentumDirection().y()
188 << std::setw(30) << postStep->GetMomentumDirection().y()
190 G4cout <<
" Momentum Direct - z : " 191 << std::setw(30) << preStep->GetMomentumDirection().z()
192 << std::setw(30) << postStep->GetMomentumDirection().z()
194 G4cout <<
" Momentum - x (GeV/c): " 195 << std::setw(30) << preStep->GetMomentum().x()/
CLHEP::GeV 196 << std::setw(30) << postStep->GetMomentum().x()/
CLHEP::GeV << G4endl;
197 G4cout <<
" Momentum - y (GeV/c): " 198 << std::setw(30) << preStep->GetMomentum().y()/
CLHEP::GeV 199 << std::setw(30) << postStep->GetMomentum().y()/
CLHEP::GeV << G4endl;
200 G4cout <<
" Momentum - z (GeV/c): " 201 << std::setw(30) << preStep->GetMomentum().z()/
CLHEP::GeV 202 << std::setw(30) << postStep->GetMomentum().z()/
CLHEP::GeV << G4endl;
203 G4cout <<
" Total Energy (GeV) : " 204 << std::setw(30) << preStep->GetTotalEnergy()/
CLHEP::GeV 205 << std::setw(30) << postStep->GetTotalEnergy()/
CLHEP::GeV << G4endl;
206 G4cout <<
" Kinetic Energy (GeV): " 207 << std::setw(30) << preStep->GetKineticEnergy()/
CLHEP::GeV 208 << std::setw(30) << postStep->GetKineticEnergy()/
CLHEP::GeV << G4endl;
209 G4cout <<
" Velocity (mm/ns) : " 210 << std::setw(30) << preStep->GetVelocity()
211 << std::setw(30) << postStep->GetVelocity() << G4endl;
212 G4cout <<
" Volume Name : " 213 << std::setw(30) << preStep->GetPhysicalVolume()->GetName();
214 G4String volName = (postStep->GetPhysicalVolume()) ?
215 postStep->GetPhysicalVolume()->GetName() :
"OutOfWorld";
217 G4cout << std::setw(30) << volName << G4endl;
218 G4cout <<
" Safety (mm) : " 219 << std::setw(30) << preStep->GetSafety()
220 << std::setw(30) << postStep->GetSafety() << G4endl;
221 G4cout <<
" Polarization - x : " 222 << std::setw(30) << preStep->GetPolarization().x()
223 << std::setw(30) << postStep->GetPolarization().x()
225 G4cout <<
" Polarization - y : " 226 << std::setw(30) << preStep->GetPolarization().y()
227 << std::setw(30) << postStep->GetPolarization().y()
229 G4cout <<
" Polarization - Z : " 230 << std::setw(30) << preStep->GetPolarization().z()
231 << std::setw(30) << postStep->GetPolarization().z()
234 << std::setw(30) << preStep->GetWeight()
235 << std::setw(30) << postStep->GetWeight() << G4endl;
236 G4cout <<
" Step Status : " ;
237 G4StepStatus tStepStatus = preStep->GetStepStatus();
238 if( tStepStatus == fGeomBoundary ){
239 G4cout << std::setw(30) <<
"Geom Limit";
240 }
else if ( tStepStatus == fAlongStepDoItProc ){
241 G4cout << std::setw(30) <<
"AlongStep Proc.";
242 }
else if ( tStepStatus == fPostStepDoItProc ){
243 G4cout << std::setw(30) <<
"PostStep Proc";
244 }
else if ( tStepStatus == fAtRestDoItProc ){
245 G4cout << std::setw(30) <<
"AtRest Proc";
246 }
else if ( tStepStatus == fUndefined ){
247 G4cout << std::setw(30) <<
"Undefined";
250 tStepStatus = postStep->GetStepStatus();
251 if( tStepStatus == fGeomBoundary ){
252 G4cout << std::setw(30) <<
"Geom Limit";
253 }
else if ( tStepStatus == fAlongStepDoItProc ){
254 G4cout << std::setw(30) <<
"AlongStep Proc.";
255 }
else if ( tStepStatus == fPostStepDoItProc ){
256 G4cout << std::setw(30) <<
"PostStep Proc";
257 }
else if ( tStepStatus == fAtRestDoItProc ){
258 G4cout << std::setw(30) <<
"AtRest Proc";
259 }
else if ( tStepStatus == fUndefined ){
260 G4cout << std::setw(30) <<
"Undefined";
264 G4cout <<
" Process defined Step: " ;
265 if( preStep->GetProcessDefinedStep() ==
nullptr ){
266 G4cout << std::setw(30) <<
"Undefined";
269 << preStep->GetProcessDefinedStep()->GetProcessName();
271 if( postStep->GetProcessDefinedStep() ==
nullptr){
272 G4cout << std::setw(30) <<
"Undefined";
275 << postStep->GetProcessDefinedStep()->GetProcessName();
280 G4cout <<
" -------------------------------------------------------" 281 <<
"-------------------------------" << G4endl;
286 const G4VTouchable* tch1 = preStep->GetTouchable();
287 const G4VTouchable* tch2 = postStep->GetTouchable();
289 G4double
x = postStep->GetPosition().x();
290 G4double
y = postStep->GetPosition().y();
291 G4cout <<
"Touchable depth pre= " << tch1->GetHistoryDepth()
292 <<
" post= " << tch2->GetHistoryDepth()
293 <<
" trans1= " << tch1->GetTranslation(tch1->GetHistoryDepth())
294 <<
" trans2= " << tch2->GetTranslation(tch2->GetHistoryDepth())
297 const G4VPhysicalVolume* pv1 = preStep->GetPhysicalVolume();
298 const G4VPhysicalVolume* pv2 = postStep->GetPhysicalVolume();
299 G4cout <<
"PreStepVolume: " << pv1->GetName() << G4endl;
300 G4cout <<
" Translation: " << pv1->GetObjectTranslation() << G4endl;
301 G4cout <<
" Rotation: " << pv1->GetObjectRotationValue() << G4endl;
302 const G4VSolid* sv1 = pv1->GetLogicalVolume()->GetSolid();
306 G4cout <<
"PostStepVolume: " << pv2->GetName() << G4endl;
307 G4cout <<
" Translation: " << pv2->GetObjectTranslation() << G4endl;
308 G4cout <<
" Rotation: " << pv2->GetObjectRotationValue() << G4endl;
309 const G4VSolid* sv2 = pv2->GetLogicalVolume()->GetSolid();
315 G4cout <<
"##### Geometry Depth Analysis" << G4endl;
316 for(G4int
k=1;
k<tch1->GetHistoryDepth(); ++
k) {
317 const G4VPhysicalVolume*
pv = tch1->GetVolume(
k);
319 const G4VSolid* sol = pv->GetLogicalVolume()->GetSolid();
320 G4cout <<
" Depth # " <<
k <<
" PhysVolume " << pv->GetName() << G4endl;
321 G4cout <<
" Translation: " << pv->GetObjectTranslation() << G4endl;
322 G4cout <<
" Rotation: " << pv->GetObjectRotationValue() << G4endl;
331 prec =
G4cout.precision(4);
332 G4cout << std::setw( 5) << track->GetCurrentStepNumber() <<
" " 333 << std::setw( 8) << track->GetPosition().x()/CLHEP::cm <<
" " 334 << std::setw( 8) << track->GetPosition().y()/CLHEP::cm <<
" " 335 << std::setw( 8) << track->GetPosition().z()/CLHEP::cm <<
" " 336 << std::setw( 9) << track->GetKineticEnergy()/
CLHEP::GeV <<
" ";
338 prec =
G4cout.precision(3);
340 << std::setw( 8) << step->GetStepLength()/CLHEP::mm <<
" " 341 << std::setw( 9) << track->GetTrackLength()/CLHEP::cm <<
" ";
343 G4bool endTracking =
false;
344 if( track->GetNextVolume() !=
nullptr ) {
345 G4cout << std::setw(30) << track->GetVolume()->GetName() <<
" ";
347 G4cout << std::setw(30) <<
"OutOfWorld" <<
" ";
353 }
else if(postStep->GetProcessDefinedStep() !=
nullptr){
354 G4cout << postStep->GetProcessDefinedStep()->GetProcessName();
361 if(!endTracking && fStopAndKill != track->GetTrackStatus()) {
return; }
363 prec =
G4cout.precision(4);
364 G4cout <<
" ++List of " << step->GetSecondary()->size()
365 <<
" secondaries generated " << G4endl;
366 const G4TrackVector* tv = sManager->GetSecondary();
367 G4int
n = tv->size();
368 for(G4int
i=0;
i<
n; ++
i) {
372 << (*tv)[
i]->GetPosition().x()/CLHEP::cm <<
" " 374 << (*tv)[
i]->GetPosition().y()/CLHEP::cm <<
" " 376 << (*tv)[
i]->GetPosition().z()/CLHEP::cm <<
") cm, " 378 << (*tv)[
i]->GetKineticEnergy()/
CLHEP::GeV <<
" GeV, " 380 << (*tv)[
i]->GetGlobalTime()/CLHEP::ns <<
" ns, " 382 << (*tv)[
i]->GetDefinition()->GetParticleName() << G4endl;
void StackFilled(const G4Track *, bool isKilled) const
std::vector< G4int > m_EventNumbers
void NextStep(const G4Step *, const G4SteppingManager *ptr, bool isKilled) const
void TrackEnded(const G4Track *) const
std::vector< G4int > m_TrackNumbers
CMSSteppingVerbose(G4int verb, G4double ekin, std::vector< G4int > &evtNum, std::vector< G4int > &primV, std::vector< G4int > &trNum)
void BeginOfEvent(const G4Event *)
std::vector< G4int > m_PrimaryVertex
void TrackStarted(const G4Track *, bool isKilled)