source: trunk/examples/extended/hadronic/Hadr01/src/StackingAction.cc@ 1330

Last change on this file since 1330 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

File size: 3.5 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// $Id: StackingAction.cc,v 1.5 2006/10/04 09:56:03 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-03-cand-01 $
28//
29/////////////////////////////////////////////////////////////////////////
30//
31// StackingAction
32//
33// Created: 31.04.2006 V.Ivanchenko
34//
35// Modified:
36// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
37//
38////////////////////////////////////////////////////////////////////////
39//
40
41#include "StackingAction.hh"
42
43#include "HistoManager.hh"
44#include "StackingMessenger.hh"
45
46#include "G4Track.hh"
47
48
49//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50
51StackingAction::StackingAction()
52{
53 stackMessenger = new StackingMessenger(this);
54 histoManager = HistoManager::GetPointer();
55 killSecondary = false;
56 pname = "";
57}
58
59//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60
61StackingAction::~StackingAction()
62{
63 delete stackMessenger;
64}
65
66//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67
68G4ClassificationOfNewTrack
69StackingAction::ClassifyNewTrack(const G4Track* aTrack)
70{
71 G4ClassificationOfNewTrack status = fUrgent;
72
73 if (aTrack->GetTrackStatus() == fAlive)
74 histoManager->ScoreNewTrack(aTrack);
75
76 const G4String name = aTrack->GetDefinition()->GetParticleName();
77
78 if(histoManager->GetVerbose() > 1 ) {
79 G4cout << "Track #"
80 << aTrack->GetTrackID() << " of " << name
81 << " E(MeV)= " << aTrack->GetKineticEnergy()/MeV
82 << " produced by "
83 << histoManager->CurrentParticle()->GetParticleName()
84 << " ID= " << aTrack->GetParentID()
85 << " with E(MeV)= " << histoManager->CurrentKinEnergy()/MeV
86 << G4endl;
87 }
88 if(aTrack->GetTrackID() == 1) return status;
89
90 //stack or delete secondaries
91 if (killSecondary) status = fKill;
92 else if(pname == name) status = fKill;
93
94 return status;
95}
96
97//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.