ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackingAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackingAction.cc
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 //
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
33 #include "TrackingAction.hh"
34 
35 #include "DetectorConstruction.hh"
36 #include "Run.hh"
37 #include "HistoManager.hh"
38 
39 #include "G4RunManager.hh"
40 #include "G4Track.hh"
41 #include "G4HadronicProcessType.hh"
42 
43 #include "G4SystemOfUnits.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
48 :G4UserTrackingAction(), fDetector(det)
49 { }
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52 
54 {
55 
56  Run* run = static_cast<Run*>(
58 
60 
61  //which volume ?
62  //
63  G4LogicalVolume* lVolume = track->GetVolume()->GetLogicalVolume();
64  G4int iVol = 0;
65  if (lVolume == fDetector->GetLogicTarget()) iVol = 1;
66  if (lVolume == fDetector->GetLogicDetector()) iVol = 2;
67 
68  //secondary particles only
69  if (track->GetTrackID() == 1) return;
70 
72  G4String name = particle->GetParticleName();
73  G4int pid = particle->GetPDGEncoding();
74  G4int Z = particle->GetAtomicNumber();
75  G4int A = particle->GetAtomicMass();
76  G4double charge = particle->GetPDGCharge();
77  G4double energy = track->GetKineticEnergy();
78  G4double time = track->GetGlobalTime();
79  G4double weight = track->GetWeight();
80 
81  run->ParticleCount(name,energy,iVol);
82 
83  //Radioactive decay products
84  G4int processType = track->GetCreatorProcess()->GetProcessSubType();
85  if (processType == fRadioactiveDecay) {
86  //fill ntuple id = 3
87  G4int id = 3;
88  analysisManager->FillNtupleDColumn(id,0, double(pid));
89  analysisManager->FillNtupleDColumn(id,1, double(Z));
90  analysisManager->FillNtupleDColumn(id,2, double(A));
91  analysisManager->FillNtupleDColumn(id,3, energy);
92  analysisManager->FillNtupleDColumn(id,4, time/s);
93  analysisManager->FillNtupleDColumn(id,5, weight);
94  analysisManager->AddNtupleRow(id);
95 
96  if (charge < 3.) {
97  //fill ntuple id = 0
98  id = 0;
99  analysisManager->FillNtupleDColumn(id,0, double(pid));
100  analysisManager->FillNtupleDColumn(id,1, energy);
101  analysisManager->FillNtupleDColumn(id,2, time/s);
102  analysisManager->FillNtupleDColumn(id,3, weight);
103  analysisManager->AddNtupleRow(id);
104 
105  analysisManager->FillH1(6, energy, weight);
106  analysisManager->FillH1(7, energy, weight);
107  analysisManager->FillH1(8, energy, weight);
108  }
109  }
110 
111  //all unstable ions produced in target
112  G4bool unstableIon = ((charge > 2.) && !(particle->GetPDGStable()));
113  if ((unstableIon) && (iVol == 1)) {
114  //fill ntuple id = 1
115  G4int id = 1;
116  analysisManager->FillNtupleDColumn(id,0, double(pid));
117  analysisManager->FillNtupleDColumn(id,1, time/s);
118  analysisManager->FillNtupleDColumn(id,2, weight);
119  analysisManager->AddNtupleRow(id);
120  }
121 }
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
124 
126 { }
127 
128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
129