Geant4  10.02.p02
F04StackingAction.cc
Go to the documentation of this file.
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: F04StackingAction.cc 68021 2013-03-13 13:36:07Z gcosmo $
27 //
30 //
31 
32 #include "F04StackingAction.hh"
33 
34 #include "G4RunManager.hh"
35 
36 #include "G4Track.hh"
37 #include "G4ParticleTypes.hh"
38 #include "G4ParticleDefinition.hh"
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41 
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49 
52 {
53  G4ParticleDefinition* particleType = aTrack->GetDefinition();
54  const G4String name = particleType->GetParticleName();
55 
56  // keep primary particle
57  if (aTrack->GetParentID() == 0) return fUrgent;
58 
59  if (particleType != G4Proton::ProtonDefinition() &&
60  particleType != G4Neutron::NeutronDefinition() &&
61  particleType != G4KaonPlus::KaonPlusDefinition() &&
62  particleType != G4PionPlus::PionPlusDefinition() &&
63  particleType != G4MuonPlus::MuonPlusDefinition() &&
64  particleType != G4Positron::PositronDefinition()) return fKill;
65 
66  if (name != "pi+" && name != "mu+") return fKill;
67 
68 // if (name == "mu+") G4RunManager::GetRunManager()->rndmSaveThisEvent();
69 
70  return fUrgent;
71 }
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74 
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
G4ParticleDefinition * GetDefinition() const
G4int GetParentID() const
static G4KaonPlus * KaonPlusDefinition()
Definition: G4KaonPlus.cc:108
static G4MuonPlus * MuonPlusDefinition()
Definition: G4MuonPlus.cc:94
G4String name
Definition: TRTMaterials.hh:40
static G4Proton * ProtonDefinition()
Definition: G4Proton.cc:88
virtual ~F04StackingAction()
const G4String & GetParticleName() const
static G4PionPlus * PionPlusDefinition()
Definition: G4PionPlus.cc:93
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *aTrack)
static G4Positron * PositronDefinition()
Definition: G4Positron.cc:89
virtual void PrepareNewEvent()
virtual void NewStage()
Definition of the F04StackingAction class.
static G4Neutron * NeutronDefinition()
Definition: G4Neutron.cc:99