![]() |
|
|||
File indexing completed on 2025-02-23 09:22: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 // 0027 /// \file ScreenSD.cc 0028 /// \brief Implementation of the ScreenSD class 0029 // 0030 0031 #include "ScreenSD.hh" 0032 0033 #include "G4AnalysisManager.hh" 0034 #include "G4Step.hh" 0035 #include "G4SystemOfUnits.hh" 0036 #include "G4VProcess.hh" 0037 #include "G4VTouchable.hh" 0038 #include "G4ios.hh" 0039 0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0041 0042 ScreenSD::ScreenSD(const G4String& name) : G4VSensitiveDetector(name) {} 0043 0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0045 0046 void ScreenSD::Initialize(G4HCofThisEvent* /*hce*/) {} 0047 0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0049 0050 G4bool ScreenSD::ProcessHits(G4Step* step, G4TouchableHistory* /*history*/) 0051 { 0052 // Current track: 0053 const G4Track* track = step->GetTrack(); 0054 0055 // Track ID: 0056 G4int ID = track->GetTrackID(); 0057 0058 // code PDG: 0059 G4int pdgCode = track->GetDefinition()->GetPDGEncoding(); 0060 0061 // Remember preStepPoint: 0062 G4StepPoint* preStepPoint = step->GetPreStepPoint(); 0063 0064 // Ekin: 0065 G4double Ekin = preStepPoint->GetKineticEnergy(); 0066 0067 // Obtain local coordinates: 0068 const G4VTouchable* touchable = preStepPoint->GetTouchable(); 0069 G4ThreeVector globalPosition = preStepPoint->GetPosition(); 0070 G4ThreeVector localPosition = 0071 touchable->GetHistory()->GetTopTransform().TransformPoint(globalPosition); 0072 // // Example for obtaining the local direction: 0073 // G4ThreeVector globalDirection = preStepPoint->GetMomentumDirection(); 0074 // G4ThreeVector localDirection 0075 // = touchable->GetHistory()->GetTopTransform().TransformAxis(localDirection); 0076 0077 // Time 0078 G4double time = preStepPoint->GetGlobalTime(); 0079 0080 // Store hit in the ntuple 0081 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 0082 analysisManager->FillNtupleIColumn(0, ID); 0083 analysisManager->FillNtupleIColumn(1, pdgCode); 0084 analysisManager->FillNtupleDColumn(2, Ekin / MeV); 0085 analysisManager->FillNtupleDColumn(3, localPosition.x() / cm); 0086 analysisManager->FillNtupleDColumn(4, localPosition.y() / cm); 0087 analysisManager->FillNtupleDColumn(5, time / ns); 0088 analysisManager->AddNtupleRow(); 0089 0090 return true; 0091 } 0092 0093 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0094 0095 void ScreenSD::EndOfEvent(G4HCofThisEvent* /*hce*/) {} 0096 0097 //....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 |
![]() ![]() |