[1199] | 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 | #include "PlhSteppingAction.hh" |
---|
| 28 | #include "G4SteppingManager.hh" |
---|
| 29 | #include "G4Track.hh" |
---|
| 30 | #include "G4Step.hh" |
---|
| 31 | #include "G4StepPoint.hh" |
---|
| 32 | #include "G4TrackStatus.hh" |
---|
| 33 | #include "G4TrackVector.hh" |
---|
| 34 | #include "G4VPhysicalVolume.hh" |
---|
| 35 | #include "G4ParticleDefinition.hh" |
---|
| 36 | #include "G4ParticleTypes.hh" |
---|
| 37 | #include "G4ios.hh" |
---|
| 38 | #include <iomanip> |
---|
| 39 | |
---|
| 40 | PlhSteppingAction::PlhSteppingAction() |
---|
| 41 | {;} |
---|
| 42 | |
---|
| 43 | PlhSteppingAction::~PlhSteppingAction() |
---|
| 44 | {;} |
---|
| 45 | |
---|
| 46 | void PlhSteppingAction::UserSteppingAction() |
---|
| 47 | { |
---|
| 48 | G4SteppingManager * SM = GetOmnipotentSteppingManager(); |
---|
| 49 | G4Step * theStep = SM->GetStep(); |
---|
| 50 | G4Track * theTrack = theStep->GetTrack(); |
---|
| 51 | |
---|
| 52 | // check if it is alive |
---|
| 53 | if(theTrack->GetTrackStatus()==fAlive) { return; } |
---|
| 54 | |
---|
| 55 | G4cout << std::setw( 5) << "#Step#" << " " |
---|
| 56 | << std::setw( 9) << "X(mm)" << " " |
---|
| 57 | << std::setw( 9) << "Y(mm)" << " " |
---|
| 58 | << std::setw( 9) << "Z(mm)" << " " |
---|
| 59 | << std::setw( 9) << "KineE(MeV)" << " " |
---|
| 60 | << std::setw( 9) << "dE(MeV)" << " " |
---|
| 61 | << std::setw( 9) << "StepLeng" << " " |
---|
| 62 | << std::setw( 9) << "TrackLeng" << " " |
---|
| 63 | << std::setw(10) << "ProcName" << G4endl; |
---|
| 64 | G4cout.precision(3); |
---|
| 65 | G4cout << std::setw( 5) << theTrack->GetCurrentStepNumber() << " " |
---|
| 66 | << std::setw( 9) << theTrack->GetPosition().x() / mm << " " |
---|
| 67 | << std::setw( 9) << theTrack->GetPosition().y() / mm << " " |
---|
| 68 | << std::setw( 9) << theTrack->GetPosition().z() / mm << " " |
---|
| 69 | << std::setw( 9) << theTrack->GetKineticEnergy() / MeV << " " |
---|
| 70 | << std::setw( 9) << theStep->GetTotalEnergyDeposit() /MeV << " " |
---|
| 71 | << std::setw( 9) << theStep->GetStepLength() / mm << " " |
---|
| 72 | << std::setw( 9) << theTrack->GetTrackLength() / mm << " "; |
---|
| 73 | if(theStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){ |
---|
| 74 | G4cout << theStep->GetPostStepPoint()->GetProcessDefinedStep() |
---|
| 75 | ->GetProcessName(); |
---|
| 76 | } else { |
---|
| 77 | G4cout << "User Limit"; |
---|
| 78 | } |
---|
| 79 | G4cout << G4endl; |
---|
| 80 | |
---|
| 81 | G4TrackVector* fSecondary = SM->GetfSecondary(); |
---|
| 82 | G4cout << " -- List of secondaries generated : " |
---|
| 83 | << "(x,y,z,kE,t,PID) --" << G4endl; |
---|
| 84 | for( G4int lp1=0;lp1<(*fSecondary).entries(); lp1++){ |
---|
| 85 | G4cout << " " |
---|
| 86 | << std::setw( 9) |
---|
| 87 | << (*fSecondary)[lp1]->GetPosition().x() / mm << " " |
---|
| 88 | << std::setw( 9) |
---|
| 89 | << (*fSecondary)[lp1]->GetPosition().y() / mm << " " |
---|
| 90 | << std::setw( 9) |
---|
| 91 | << (*fSecondary)[lp1]->GetPosition().z() / mm << " " |
---|
| 92 | << std::setw( 9) |
---|
| 93 | << (*fSecondary)[lp1]->GetKineticEnergy() / MeV << " " |
---|
| 94 | << std::setw( 9) |
---|
| 95 | << (*fSecondary)[lp1]->GetGlobalTime() / ns << " " |
---|
| 96 | << std::setw(18) |
---|
| 97 | << (*fSecondary)[lp1]->GetDefinition() |
---|
| 98 | ->GetParticleName(); |
---|
| 99 | G4cout << G4endl; |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | } |
---|
| 103 | |
---|