Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 /// \file electromagnetic/TestEm11/src/Steppin << 23 // $Id: SteppingAction.cc,v 1.1 2005/06/03 15:20:32 maire Exp $ 27 /// \brief Implementation of the SteppingActio << 24 // GEANT4 tag $Name: geant4-08-00-patch-01 $ 28 // << 29 // 25 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 26 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 27 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 28 33 #include "SteppingAction.hh" 29 #include "SteppingAction.hh" 34 << 35 #include "DetectorConstruction.hh" 30 #include "DetectorConstruction.hh" >> 31 #include "RunAction.hh" 36 #include "EventAction.hh" 32 #include "EventAction.hh" 37 #include "HistoManager.hh" 33 #include "HistoManager.hh" 38 #include "Run.hh" << 39 34 40 #include "G4RunManager.hh" << 41 #include "G4SteppingManager.hh" 35 #include "G4SteppingManager.hh" 42 #include "Randomize.hh" << 36 #include "G4VProcess.hh" >> 37 #include "G4ParticleTypes.hh" 43 38 44 //....oooOO0OOooo........oooOO0OOooo........oo 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 40 46 SteppingAction::SteppingAction(DetectorConstru << 41 SteppingAction::SteppingAction(DetectorConstruction* det, RunAction* RuAct, 47 : fDetector(det), fEventAction(event) << 42 EventAction* event, HistoManager* histo) 48 {} << 43 :detector(det), runAction(RuAct), eventAction(event), histoManager(histo) >> 44 { } 49 45 50 //....oooOO0OOooo........oooOO0OOooo........oo 46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 51 47 52 void SteppingAction::UserSteppingAction(const << 48 SteppingAction::~SteppingAction() 53 { << 49 { } 54 G4double edep = step->GetTotalEnergyDeposit( << 55 if (edep <= 0.) return; << 56 50 57 G4AnalysisManager* analysisManager = G4Analy << 51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 58 52 59 // longitudinal profile of deposited energy << 53 void SteppingAction::UserSteppingAction(const G4Step* aStep) 60 // randomize point of energy deposotion << 54 { 61 // << 55 G4double edep = aStep->GetTotalEnergyDeposit(); 62 G4StepPoint* prePoint = step->GetPreStepPoin << 56 if (edep <= 0.) return; 63 G4StepPoint* postPoint = step->GetPostStepPo << 57 64 G4ThreeVector P1 = prePoint->GetPosition(); << 58 //total energy deposit in absorber 65 G4ThreeVector P2 = postPoint->GetPosition(); << 59 // 66 G4ThreeVector point = P1 + G4UniformRand() * << 60 eventAction->AddEdep(edep); 67 if (step->GetTrack()->GetDefinition()->GetPD << 61 68 G4double x = point.x(); << 62 //longitudinal profile of deposited energy 69 G4double xshifted = x + 0.5 * fDetector->Get << 63 // 70 analysisManager->FillH1(1, xshifted, edep); << 64 const G4StepPoint* prePoint = aStep->GetPreStepPoint(); 71 << 65 const G4StepPoint* postPoint = aStep->GetPostStepPoint(); 72 //"normalized" histogram << 66 73 // << 67 G4double x = (prePoint->GetPosition().x() + postPoint->GetPosition().x())/2; 74 Run* run = static_cast<Run*>(G4RunManager::G << 68 x += 0.5*detector->GetAbsorSizeX(); 75 G4int iabs = prePoint->GetTouchableHandle()- << 69 histoManager->FillHisto(1, x, edep); 76 G4double csdaRange = run->GetCsdaRange(iabs) << 70 77 if (csdaRange > 0.) { << 71 //step size of primary particle or charged secondaries 78 G4double density = fDetector->GetAbsorMate << 72 // 79 G4double xfront = fDetector->GetXfront(iab << 73 G4double steplen = aStep->GetStepLength(); 80 G4double xfrontNorm = run->GetXfrontNorm(i << 74 const G4Track* track = aStep->GetTrack(); 81 G4double xnorm = xfrontNorm + (x - xfront) << 75 if (track->GetTrackID() == 1) histoManager->FillHisto(4, steplen); 82 analysisManager->FillH1(8, xnorm, edep / ( << 76 else if (track->GetDefinition()->GetPDGCharge() != 0.) 83 } << 77 histoManager->FillHisto(7, steplen); 84 << 85 // total energy deposit in absorber << 86 // << 87 fEventAction->AddEdep(iabs, edep); << 88 << 89 // step size of primary particle or charged << 90 // << 91 G4double steplen = step->GetStepLength(); << 92 const G4Track* track = step->GetTrack(); << 93 if (track->GetTrackID() == 1) << 94 analysisManager->FillH1(4, steplen); << 95 else if (track->GetDefinition()->GetPDGCharg << 96 analysisManager->FillH1(7, steplen); << 97 } 78 } 98 79 99 //....oooOO0OOooo........oooOO0OOooo........oo 80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 81 >> 82 100 83