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 #include "PrimaryGeneratorAction.hh"
35 #include "Run.hh"
36 #include "HistoManager.hh"
37 
38 #include "G4RunManager.hh"
39 #include "G4Track.hh"
40 
41 #include "G4SystemOfUnits.hh"
42 #include "G4UnitsTable.hh"
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 
47 :G4UserTrackingAction(),fPrimary(prim)
48 { }
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53 {
54 /*
55  //debug
56  const G4DynamicParticle* dynamic = aTrack->GetDynamicParticle();
57  G4double dynamCharge = dynamic->GetCharge();
58  G4int occup = dynamic->GetTotalOccupancy();
59  G4double pdgMass = dynamic->GetParticleDefinition()->GetPDGMass();
60  G4double invarMass = dynamic->Get4Momentum().m();
61  G4double dynamMass = dynamic->GetMass();
62  G4double dif1 = invarMass - pdgMass;
63  G4double dif2 = dynamMass - pdgMass;
64 
65  G4cout
66  << "\n Begin of track :"
67  << "\n charge= " << dynamCharge << " occupancy= " << occup
68  << "\n pdgMass= " << G4BestUnit (pdgMass , "Energy")
71  << "\n dynamMass= " << G4BestUnit (dynamMass, "Energy")
72  << " dynam-pdg= " << G4BestUnit (dif2 , "Energy")
73  << G4endl;
74 */
75 }
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
80 {
81  //increase nb of processed tracks
82  //count nb of steps of this track
83  G4int nbSteps = aTrack->GetCurrentStepNumber();
84  G4double Trleng = aTrack->GetTrackLength();
85 
86  Run* run = static_cast<Run*>(
88 
89  if (aTrack->GetDefinition()->GetPDGCharge() == 0.) {
90  run->CountTraks0(1);
91  run->CountSteps0(nbSteps);
92 
93  } else {
94  run->CountTraks1(1);
95  run->CountSteps1(nbSteps);
96  }
97 
98  //true and projected ranges for primary particle
99  if (aTrack->GetTrackID() == 1) {
100  run->AddTrueRange(Trleng);
102  G4ThreeVector position = aTrack->GetPosition() - vertex;
103  run->AddProjRange(position.x());
104  run->AddTransvDev(position.y());
105  run->AddTransvDev(position.z());
106 
107  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
108  analysisManager->FillH1(1,Trleng);
109  analysisManager->FillH1(2,(float)nbSteps);
110  }
111 /*
112  //debug
113  const G4DynamicParticle* dynamic = aTrack->GetDynamicParticle();
114  G4double dynamCharge = dynamic->GetCharge();
115  G4int occup = dynamic->GetTotalOccupancy();
116  G4double pdgMass = dynamic->GetParticleDefinition()->GetPDGMass();
117  G4double invarMass = dynamic->Get4Momentum().m();
118  G4double dynamMass = dynamic->GetMass();
119  G4double dif1 = invarMass - pdgMass;
120  G4double dif2 = dynamMass - pdgMass;
121 
122  G4cout
123  << "\n End of track :"
124  << "\n charge= " << dynamCharge << " occupancy= " << occup
125  << "\n pdgMass= " << G4BestUnit (pdgMass , "Energy")
128  << "\n dynamMass= " << G4BestUnit (dynamMass, "Energy")
129  << " dynam-pdg= " << G4BestUnit (dif2 , "Energy")
130  << G4endl;
131 */
132 }
133 
134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
135