![]() |
|
|||
File indexing completed on 2025-02-23 09:22:16
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 medical/fanoCavity/src/StackingAction.cc 0027 /// \brief Implementation of the StackingAction class 0028 // 0029 // 0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0032 0033 #include "StackingAction.hh" 0034 0035 #include "DetectorConstruction.hh" 0036 #include "HistoManager.hh" 0037 #include "Run.hh" 0038 #include "RunAction.hh" 0039 #include "StackingMessenger.hh" 0040 0041 #include "G4EmCalculator.hh" 0042 #include "G4RunManager.hh" 0043 #include "G4Track.hh" 0044 0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0046 0047 StackingAction::StackingAction(DetectorConstruction* det) : fDetector(det), fStackMessenger(0) 0048 { 0049 fMatWall = 0; 0050 fZcav = 0.; 0051 fEmCal = 0; 0052 first = true; 0053 fKillTrack = true; 0054 0055 // create a messenger for this class 0056 fStackMessenger = new StackingMessenger(this); 0057 } 0058 0059 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0060 0061 StackingAction::~StackingAction() 0062 { 0063 delete fEmCal; 0064 delete fStackMessenger; 0065 } 0066 0067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0068 0069 G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* track) 0070 { 0071 // get fDetector informations 0072 if (first) { 0073 fMatWall = fDetector->GetWallMaterial(); 0074 fZcav = 0.5 * (fDetector->GetCavityThickness()); 0075 fEmCal = new G4EmCalculator(); 0076 first = false; 0077 } 0078 0079 G4ClassificationOfNewTrack status = fUrgent; 0080 0081 // keep primary particle or neutral 0082 // 0083 G4ParticleDefinition* particle = track->GetDefinition(); 0084 G4bool neutral = (particle->GetPDGCharge() == 0.); 0085 if ((track->GetParentID() == 0) || neutral) return status; 0086 0087 Run* run = static_cast<Run*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun()); 0088 0089 // energy spectrum of charged secondaries 0090 // 0091 G4double energy = track->GetKineticEnergy(); 0092 run->SumEsecond(energy); 0093 0094 // kill e- which cannot reach Cavity 0095 // 0096 G4double position = (track->GetPosition()).z(); 0097 G4double safe = std::abs(position) - fZcav; 0098 G4double range = fEmCal->GetRangeFromRestricteDEDX(energy, particle, fMatWall); 0099 if (fKillTrack) { 0100 if (range < 0.8 * safe) status = fKill; 0101 } 0102 0103 // histograms 0104 // 0105 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 0106 analysisManager->FillH1(1, position); 0107 analysisManager->FillH1(2, energy); 0108 G4ThreeVector direction = track->GetMomentumDirection(); 0109 analysisManager->FillH1(3, std::acos(direction.z())); 0110 0111 return status; 0112 } 0113 0114 //....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 |
![]() ![]() |