Geant4_10
TrackingAction.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 //
28 //
29 // $Id: TrackingAction.cc 69099 2013-04-18 12:25:19Z maire $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "TrackingAction.hh"
35 
36 #include "Run.hh"
37 #include "HistoManager.hh"
38 
39 #include "G4RunManager.hh"
40 #include "G4Track.hh"
41 #include "G4SystemOfUnits.hh"
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
47  fNbStep1(0),fNbStep2(0),fTrackLen1(0.),fTrackLen2(0.),fTime1(0.),fTime2(0.)
48 { }
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53 {
54  fNbStep1 = fNbStep2 = 0;
55  fTrackLen1 = fTrackLen2 = 0.;
56  fTime1 = fTime2 = 0.;
57 }
58 
59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60 
62  G4double time)
63 {
64  const G4double thermal = 1*eV;
65  if (ekin > thermal) {
66  fNbStep1++; fTrackLen1 = trackl; fTime1 = time;
67  } else {
68  fNbStep2++; fTrackLen2 = trackl - fTrackLen1; fTime2 = time - fTime1;
69  }
70 }
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75 {
76  // keep only primary neutron
77  //
78  G4int trackID = track->GetTrackID();
79  if (trackID > 1) return;
80 
81  Run* run
82  = static_cast<Run*>(
84  run->SumTrackLength(fNbStep1,fNbStep2,fTrackLen1,fTrackLen2,fTime1,fTime2);
85 
86  // histograms
87  //
88  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
89  analysisManager->FillH1(1,fNbStep1);
90  analysisManager->FillH1(2,fTrackLen1);
91  analysisManager->FillH1(3,fTime1);
92  analysisManager->FillH1(4,fNbStep2);
93  analysisManager->FillH1(5,fTrackLen2);
94  analysisManager->FillH1(6,fTime2);
95 }
96 
97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
98 
int G4int
Definition: G4Types.hh:78
void SumTrackLength(G4int, G4int, G4double, G4double, G4double, G4double)
Definition: Run.cc:89
void PreUserTrackingAction(const G4Track *)
ExG4HbookAnalysisManager G4AnalysisManager
Definition: g4hbook_defs.hh:46
G4int GetTrackID() const
void PostUserTrackingAction(const G4Track *)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
double G4double
Definition: G4Types.hh:76
Definition: Run.hh:46
void UpdateTrackInfo(G4double, G4double, G4double)
G4Run * GetNonConstCurrentRun() const