Deprecated/UpgradeASCIITests/G4TankSimulatorASCII/G4TankTrackingAction.cc
Go to the documentation of this file.
1 #include "G4TankTrackingAction.h"
3 
4 #include <G4Track.hh>
5 #include <G4TrackingManager.hh>
6 #include <G4TrackStatus.hh>
7 
8 #include <cstddef>
9 #include <iostream>
10 
11 using namespace G4TankSimulatorASCII;
12 
13 using std::cout;
14 using std::endl;
15 
16 
17 // Number of Cherenkov photons from injected particle
19 
20 // Number of Cherenkov photons NOT coming directly from
21 // the injected particle. (eg. delta rays)
22 //
26 
27 
30 
34 
35 double G4TankTrackingAction::ASCII_Edep_i[27]={ 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
36 
41 
43 {
44 
45 }
46 
47 
49 {
50 }
51 
52 
53 // NOTE : no energy deposition is expected from the decay process along the step.
54 void
56 {
57  BeforeTracking(aTrack);
58 
59  // Check if the track already has track information
60  if(aTrack->GetUserInformation()!=0) return;
61  if ( aTrack->GetParentID() !=1 ) return; // Only the decay of parent particle ( Particles considered mu+/mu-/e-/e+/gamma, it works for neutrons also )
62 
63  // Check if the track has the creator process (not the case for primaries)
64  const G4VProcess* creatorProcess = aTrack->GetCreatorProcess();
65  if(!creatorProcess) return;
66 
67  // Check if the track was generated by the interested process
68  if(creatorProcess->GetProcessName()=="Decay" )
69  {
70  // If it is the case, create a track information and attach it to the track
71  G4TankTrackInformation* anInfo = new G4TankTrackInformation(aTrack);
72  G4Track* theTrack = (G4Track*)aTrack;
73  theTrack->SetUserInformation(anInfo);
74  }
75 }
76 
77 
78 void
80 {
81  AfterTracking(aTrack);
82  //G4cerr << "Number of Cerenkov photons : " << fNumC;
83 
84  // Check if the track already has track information
86  = (G4TankTrackInformation*)(aTrack->GetUserInformation());
87  if(info==0) return;
88 
89  // Copy parent's track information to its daughters
90  G4TrackVector* secondaries = fpTrackingManager->GimmeSecondaries();
91  if(secondaries)
92  {
93  size_t nSeco = secondaries->size();
94  for(size_t i=0;i<nSeco;i++)
95  {
97  (*secondaries)[i]->SetUserInformation(infoNew);
98  }
99  }
100 }
101 
102 
103 void
105 {
106 
107  fNumBounces = 0;
108 
109  const int Code = aTrack->GetDefinition()->GetPDGEncoding();
110 
111  if (Code == 0) { // Optical photon
112 
113  const int Parent = aTrack->GetParentID();
114 
115  // Count number of Cerenkov photons
116  if (Parent != 1) // not directly produced by the injected particle (eg delta ray)
117  ++fNumCDelta;
118  else // Produced by injected particle
119  ++fNumC;
120  }
121 }
122 
123 
124 void
125 G4TankTrackingAction::AfterTracking(const G4Track* /*aTrack*/)
126 {
127 }

, generated on Tue Sep 26 2023.