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/TestEm2/src/Stepping << 23 // $Id: SteppingAction.cc,v 1.3 2004/11/24 10:46:30 maire Exp $ 27 /// \brief Implementation of the SteppingActio << 24 // GEANT4 tag $Name: geant4-08-00 $ 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" 36 #include "Run.hh" << 31 #include "RunAction.hh" >> 32 #include "G4SteppingManager.hh" >> 33 #include "G4VTouchable.hh" >> 34 >> 35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 37 36 38 #include "G4RunManager.hh" << 37 SteppingAction::SteppingAction(DetectorConstruction* det, 39 #include "Randomize.hh" << 38 RunAction* run) >> 39 :Det(det),Run(run) >> 40 { } 40 41 41 //....oooOO0OOooo........oooOO0OOooo........oo 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 42 43 43 SteppingAction::SteppingAction(DetectorConstru << 44 SteppingAction::~SteppingAction() >> 45 { } 44 46 45 //....oooOO0OOooo........oooOO0OOooo........oo 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 46 48 47 void SteppingAction::UserSteppingAction(const << 49 void SteppingAction::UserSteppingAction(const G4Step* aStep) 48 { << 50 { 49 // energy deposit << 51 G4Track* aTrack = aStep->GetTrack(); 50 // << 52 const G4VTouchable* preStepTouchable= aStep->GetPreStepPoint()->GetTouchable(); 51 G4double dEStep = step->GetTotalEnergyDeposi << 53 const G4VTouchable* postStepTouchable= aStep->GetPostStepPoint()->GetTouchable(); 52 Run* run = static_cast<Run*>(G4RunManager::G << 54 53 run->AddStep(step->GetTrack()->GetDefinition << 55 // energy deposit 54 if (dEStep > 0.) { << 56 // 55 G4ThreeVector prePoint = step->GetPreStepP << 57 G4int SlideNb(0), RingNb(0); 56 G4ThreeVector delta = step->GetPostStepPoi << 58 if (preStepTouchable->GetHistoryDepth()>0) 57 prePoint += G4UniformRand() * delta; << 59 { 58 G4double x = prePoint.x(), y = prePoint.y( << 60 if (Det->GetnRtot()>1) 59 G4double radius = std::sqrt(x * x + y * y) << 61 RingNb = preStepTouchable->GetReplicaNumber(1); 60 G4double offset = 0.5 * fDetector->Getfull << 62 /// RingNb = preStepTouchable->GetCopyNumber(1); 61 G4int SlideNb = G4int((z + offset) / fDete << 63 if (Det->GetnLtot()>1) 62 G4int RingNb = G4int(radius / fDetector->G << 64 SlideNb = preStepTouchable->GetReplicaNumber(); 63 run->FillPerStep(dEStep, SlideNb, RingNb); << 65 /// SlideNb = preStepTouchable->GetCopyNumber(); 64 } << 66 } >> 67 >> 68 G4double dEStep = aStep->GetTotalEnergyDeposit(); >> 69 if (dEStep > 0.) >> 70 Run->fillPerStep(dEStep,SlideNb,RingNb); >> 71 >> 72 // particle flux >> 73 // >> 74 if ((Det->GetnLtot()>1)&& >> 75 (postStepTouchable->GetVolume())) >> 76 { >> 77 G4int next = postStepTouchable->GetReplicaNumber(); >> 78 /// G4int next = postStepTouchable->GetCopyNumber(); >> 79 if (next != SlideNb) >> 80 Run->particleFlux(aTrack->GetDefinition(), (SlideNb+next)/2); >> 81 } 65 } 82 } 66 83 67 //....oooOO0OOooo........oooOO0OOooo........oo 84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 85 >> 86 68 87