|
|
|||
File indexing completed on 2026-06-03 07:55:38
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 /// \file TrackingAction.cc 0027 /// \brief Implementation of the TrackingAction class 0028 0029 #include "TrackingAction.hh" 0030 0031 #include "EventAction.hh" 0032 #include "HistoManager.hh" 0033 #include "PrimaryGeneratorAction.hh" 0034 #include "Run.hh" 0035 0036 #include "G4Positron.hh" 0037 #include "G4PhysicalConstants.hh" 0038 #include "G4RunManager.hh" 0039 #include "G4StepStatus.hh" 0040 #include "G4SystemOfUnits.hh" 0041 #include "G4Track.hh" 0042 #include "G4UnitsTable.hh" 0043 0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0045 0046 TrackingAction::TrackingAction(PrimaryGeneratorAction* prim, EventAction* evt) 0047 : fPrimary(prim),fEventAction(evt) {} 0048 0049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0050 0051 void TrackingAction::PreUserTrackingAction(const G4Track*) 0052 { 0053 /* 0054 //debug 0055 const G4DynamicParticle* dynamic = aTrack->GetDynamicParticle(); 0056 G4double dynamCharge = dynamic->GetCharge(); 0057 G4int occup = dynamic->GetTotalOccupancy(); 0058 G4double pdgMass = dynamic->GetParticleDefinition()->GetPDGMass(); 0059 G4double invarMass = dynamic->Get4Momentum().m(); 0060 G4double dynamMass = dynamic->GetMass(); 0061 G4double dif1 = invarMass - pdgMass; 0062 G4double dif2 = dynamMass - pdgMass; 0063 0064 G4cout 0065 << "\n Begin of track :" 0066 << "\n charge= " << dynamCharge << " occupancy= " << occup 0067 << "\n pdgMass= " << G4BestUnit (pdgMass , "Energy") 0068 /// << "\n invarMass= " << G4BestUnit (invarMass, "Energy") 0069 /// << " invar-pdg= " << G4BestUnit (dif1 , "Energy") 0070 << "\n dynamMass= " << G4BestUnit (dynamMass, "Energy") 0071 << " dynam-pdg= " << G4BestUnit (dif2 , "Energy") 0072 << G4endl; 0073 */ 0074 } 0075 0076 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0077 0078 void TrackingAction::PostUserTrackingAction(const G4Track* aTrack) 0079 { 0080 // increase nb of processed tracks 0081 // count nb of steps of this track 0082 G4int nbSteps = aTrack->GetCurrentStepNumber(); 0083 G4double Trleng = aTrack->GetTrackLength(); 0084 0085 Run* run = static_cast<Run*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun()); 0086 0087 if (aTrack->GetDefinition()->GetPDGCharge() == 0.) { 0088 run->CountTraks0(1); 0089 run->CountSteps0(nbSteps); 0090 } 0091 else { 0092 run->CountTraks1(1); 0093 run->CountSteps1(nbSteps); 0094 } 0095 0096 // true and projected ranges for primary particle 0097 if (aTrack->GetTrackID() == 1) { 0098 run->AddTrueRange(Trleng); 0099 G4ThreeVector vertex = fPrimary->GetParticleGun()->GetParticlePosition(); 0100 G4ThreeVector position = aTrack->GetPosition() - vertex; 0101 run->AddProjRange(position.x()); 0102 run->AddTransvDev(position.y()); 0103 run->AddTransvDev(position.z()); 0104 0105 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 0106 analysisManager->FillH1(1, Trleng); 0107 analysisManager->FillH1(2, (float)nbSteps); 0108 } 0109 /* 0110 //debug 0111 const G4DynamicParticle* dynamic = aTrack->GetDynamicParticle(); 0112 G4double dynamCharge = dynamic->GetCharge(); 0113 G4int occup = dynamic->GetTotalOccupancy(); 0114 G4double pdgMass = dynamic->GetParticleDefinition()->GetPDGMass(); 0115 G4double invarMass = dynamic->Get4Momentum().m(); 0116 G4double dynamMass = dynamic->GetMass(); 0117 G4double dif1 = invarMass - pdgMass; 0118 G4double dif2 = dynamMass - pdgMass; 0119 0120 G4cout 0121 << "\n End of track :" 0122 << "\n charge= " << dynamCharge << " occupancy= " << occup 0123 << "\n pdgMass= " << G4BestUnit (pdgMass , "Energy") 0124 /// << "\n invarMass= " << G4BestUnit (invarMass, "Energy") 0125 /// << " invar-pdg= " << G4BestUnit (dif1 , "Energy") 0126 << "\n dynamMass= " << G4BestUnit (dynamMass, "Energy") 0127 << " dynam-pdg= " << G4BestUnit (dif2 , "Energy") 0128 << G4endl; 0129 */ 0130 0131 // energy leakage 0132 G4StepStatus status = aTrack->GetStep()->GetPostStepPoint()->GetStepStatus(); 0133 if (status == fWorldBoundary) { 0134 G4double eleak = aTrack->GetKineticEnergy(); 0135 if (aTrack->GetDefinition() == G4Positron::Positron()) { 0136 eleak += 2*electron_mass_c2; 0137 } 0138 fEventAction->AddEleak(eleak); 0139 } 0140 } 0141 0142 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|