Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file hadronic/Hadr01/src/StackingAction.c << 26 // $Id: StackingAction.cc,v 1.5 2006/10/04 09:56:03 vnivanch Exp $ 27 /// \brief Implementation of the StackingActio << 27 // GEANT4 tag $Name: geant4-08-03-patch-02 $ 28 // << 29 // 28 // 30 ////////////////////////////////////////////// 29 ///////////////////////////////////////////////////////////////////////// 31 // 30 // 32 // StackingAction 31 // StackingAction 33 // 32 // 34 // Created: 31.04.2006 V.Ivanchenko 33 // Created: 31.04.2006 V.Ivanchenko 35 // 34 // 36 // Modified: 35 // Modified: 37 // 04.06.2006 Adoptation of Hadr01 (V.Ivanchen << 36 // 04.06.2006 Adoptation of hadr01 (V.Ivanchenko) 38 // 37 // 39 ////////////////////////////////////////////// 38 //////////////////////////////////////////////////////////////////////// 40 // << 39 // 41 40 42 #include "StackingAction.hh" 41 #include "StackingAction.hh" 43 42 44 #include "HistoManager.hh" 43 #include "HistoManager.hh" 45 #include "StackingMessenger.hh" 44 #include "StackingMessenger.hh" 46 45 47 #include "G4ParticleDefinition.hh" << 48 #include "G4ParticleTable.hh" << 49 #include "G4SystemOfUnits.hh" << 50 #include "G4Track.hh" 46 #include "G4Track.hh" 51 47 >> 48 52 //....oooOO0OOooo........oooOO0OOooo........oo 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 53 50 54 StackingAction::StackingAction() : G4UserStack << 51 StackingAction::StackingAction() 55 { 52 { 56 fStackMessenger = new StackingMessenger(this << 53 stackMessenger = new StackingMessenger(this); 57 fHistoManager = HistoManager::GetPointer(); << 54 histoManager = HistoManager::GetPointer(); >> 55 killSecondary = false; >> 56 pname = ""; 58 } 57 } 59 58 60 //....oooOO0OOooo........oooOO0OOooo........oo 59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 61 60 62 StackingAction::~StackingAction() 61 StackingAction::~StackingAction() 63 { 62 { 64 delete fStackMessenger; << 63 delete stackMessenger; 65 } 64 } 66 65 67 //....oooOO0OOooo........oooOO0OOooo........oo 66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 68 67 69 G4ClassificationOfNewTrack StackingAction::Cla << 68 G4ClassificationOfNewTrack >> 69 StackingAction::ClassifyNewTrack(const G4Track* aTrack) 70 { 70 { 71 G4ClassificationOfNewTrack status = fUrgent; 71 G4ClassificationOfNewTrack status = fUrgent; 72 72 73 if (aTrack->GetTrackStatus() == fAlive) { << 73 if (aTrack->GetTrackStatus() == fAlive) 74 fHistoManager->ScoreNewTrack(aTrack); << 74 histoManager->ScoreNewTrack(aTrack); 75 } << 76 << 77 const G4ParticleDefinition* part = aTrack->G << 78 75 79 if (fHistoManager->GetVerbose() > 1) { << 76 const G4String name = aTrack->GetDefinition()->GetParticleName(); 80 G4cout << "Track #" << aTrack->GetTrackID( << 81 << " E(MeV)= " << aTrack->GetKineti << 82 << " produced by Track ID= " << aTr << 83 } << 84 77 85 // stack or delete secondaries << 78 if(histoManager->GetVerbose() > 1 ) { 86 if (aTrack->GetTrackID() > 1) { << 79 G4cout << "Track #" 87 if (fKillSecondary || fParticle == part) { << 80 << aTrack->GetTrackID() << " of " << name 88 status = fKill; << 81 << " E(MeV)= " << aTrack->GetKineticEnergy()/MeV 89 } << 82 << " produced by " >> 83 << histoManager->CurrentParticle()->GetParticleName() >> 84 << " ID= " << aTrack->GetParentID() >> 85 << " with E(MeV)= " << histoManager->CurrentKinEnergy()/MeV >> 86 << G4endl; 90 } 87 } 91 return status; << 88 if(aTrack->GetTrackID() == 1) return status; 92 } << 93 89 94 //....oooOO0OOooo........oooOO0OOooo........oo << 90 //stack or delete secondaries 95 << 91 if (killSecondary) status = fKill; 96 void StackingAction::SetKillStatus(G4bool valu << 92 else if(pname == name) status = fKill; 97 { << 98 fKillSecondary = value; << 99 } << 100 93 101 //....oooOO0OOooo........oooOO0OOooo........oo << 94 return status; 102 << 103 void StackingAction::SetKill(const G4String& n << 104 { << 105 fParticle = G4ParticleTable::GetParticleTabl << 106 } 95 } 107 96 108 //....oooOO0OOooo........oooOO0OOooo........oo 97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 109 98