| [807] | 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | // Code developed by:
|
|---|
| 27 | // S.Larsson
|
|---|
| 28 | //
|
|---|
| 29 | // ***********************************
|
|---|
| 30 | // * *
|
|---|
| 31 | // * PurgMagSteppingAction.cc *
|
|---|
| 32 | // * *
|
|---|
| 33 | // ***********************************
|
|---|
| 34 | //
|
|---|
| 35 | // $Id: PurgMagSteppingAction.cc,v 1.5 2006/06/29 16:06:21 gunter Exp $
|
|---|
| 36 | // GEANT4 tag $Name: $
|
|---|
| 37 | //
|
|---|
| 38 |
|
|---|
| 39 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 40 |
|
|---|
| 41 | #include "PurgMagSteppingAction.hh"
|
|---|
| 42 | #include "PurgMagRunAction.hh"
|
|---|
| 43 | #include "PurgMagDetectorConstruction.hh"
|
|---|
| 44 |
|
|---|
| 45 | #include "G4SteppingManager.hh"
|
|---|
| 46 | #include "G4VTouchable.hh"
|
|---|
| 47 | #include "G4VPhysicalVolume.hh"
|
|---|
| 48 |
|
|---|
| 49 | #ifdef G4ANALYSIS_USE
|
|---|
| 50 | #include"PurgMagAnalysisManager.hh"
|
|---|
| 51 | #endif
|
|---|
| 52 |
|
|---|
| 53 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 54 |
|
|---|
| 55 | PurgMagSteppingAction::PurgMagSteppingAction(PurgMagRunAction* run,PurgMagDetectorConstruction* det)
|
|---|
| 56 | :PurgMagRun(run),Detector(det)
|
|---|
| 57 | { }
|
|---|
| 58 |
|
|---|
| 59 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 60 |
|
|---|
| 61 | PurgMagSteppingAction::~PurgMagSteppingAction()
|
|---|
| 62 | { }
|
|---|
| 63 |
|
|---|
| 64 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 65 |
|
|---|
| 66 | void PurgMagSteppingAction::UserSteppingAction(const G4Step* aStep)
|
|---|
| 67 |
|
|---|
| 68 | {
|
|---|
| 69 | #ifdef G4ANALYSIS_USE
|
|---|
| 70 | //Collection at SSD in N-tuples. Electrons and photons separated
|
|---|
| 71 | //Prestep point in World, next volume MeasureVolume, process transportation
|
|---|
| 72 | PurgMagAnalysisManager* analysis = PurgMagAnalysisManager::getInstance();
|
|---|
| 73 | if ((aStep->GetPreStepPoint()->GetPhysicalVolume() == Detector->GetWorld())&&
|
|---|
| 74 | (aStep->GetTrack()->GetNextVolume() == Detector->GetMeasureVolume())&&
|
|---|
| 75 | //(aStep->GetTrack()->GetMomentumDirection().z()>0.)&& // only particles with positive momentum
|
|---|
| 76 | (aStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() == "Transportation"))
|
|---|
| 77 | {
|
|---|
| 78 | G4double gx, gy, gz, ge, gpx, gpy, gpz, ex, ey, ez, ee;
|
|---|
| 79 | G4double epx, epy, epz, px, py, pz, pe, ppx, ppy, ppz;
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 | // Electrons
|
|---|
| 83 | if(aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName()
|
|---|
| 84 | == "e-")
|
|---|
| 85 | {//Position
|
|---|
| 86 | ex = (aStep->GetTrack()->GetPosition().x())/cm;
|
|---|
| 87 | ey = (aStep->GetTrack()->GetPosition().y())/cm;
|
|---|
| 88 | ez = (aStep->GetTrack()->GetPosition().z())/cm;
|
|---|
| 89 | // Energy
|
|---|
| 90 | ee = (aStep->GetTrack()->GetKineticEnergy())/MeV;
|
|---|
| 91 | // Momentum
|
|---|
| 92 | epx = aStep->GetTrack()->GetMomentum().x();
|
|---|
| 93 | epy = aStep->GetTrack()->GetMomentum().y();
|
|---|
| 94 | epz = aStep->GetTrack()->GetMomentum().z();
|
|---|
| 95 |
|
|---|
| 96 | // Fill N-tuple electrons
|
|---|
| 97 | analysis->fill_Tuple_Electrons(ex, ey, ez, ee, epx, epy, epz);
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | // Photons
|
|---|
| 101 | if (aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
|---|
| 102 | GetParticleName() == "gamma")
|
|---|
| 103 | {
|
|---|
| 104 |
|
|---|
| 105 | // Position
|
|---|
| 106 | gx = (aStep->GetTrack()->GetPosition().x())/cm;
|
|---|
| 107 | gy = (aStep->GetTrack()->GetPosition().y())/cm;
|
|---|
| 108 | gz = (aStep->GetTrack()->GetPosition().z())/cm;
|
|---|
| 109 |
|
|---|
| 110 | // Energy
|
|---|
| 111 | ge = (aStep->GetTrack()->GetKineticEnergy())/MeV;
|
|---|
| 112 |
|
|---|
| 113 | // Momentum
|
|---|
| 114 | gpx = aStep->GetTrack()->GetMomentum().x();
|
|---|
| 115 | gpy = aStep->GetTrack()->GetMomentum().y();
|
|---|
| 116 | gpz = aStep->GetTrack()->GetMomentum().z();
|
|---|
| 117 |
|
|---|
| 118 | // Fill N-tuple photons
|
|---|
| 119 | analysis->fill_Tuple_Gamma(gx, gy, gz, ge, gpx, gpy, gpz);
|
|---|
| 120 | }
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 | // Positrons
|
|---|
| 124 | if (aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName() == "e+")
|
|---|
| 125 | {
|
|---|
| 126 |
|
|---|
| 127 | // Position
|
|---|
| 128 | px = (aStep->GetTrack()->GetPosition().x())/cm;
|
|---|
| 129 | py = (aStep->GetTrack()->GetPosition().y())/cm;
|
|---|
| 130 | pz = (aStep->GetTrack()->GetPosition().z())/cm;
|
|---|
| 131 |
|
|---|
| 132 | // Energy
|
|---|
| 133 | pe = (aStep->GetTrack()->GetKineticEnergy())/MeV;
|
|---|
| 134 |
|
|---|
| 135 | // Momentum
|
|---|
| 136 | ppx = aStep->GetTrack()->GetMomentum().x();
|
|---|
| 137 | ppy = aStep->GetTrack()->GetMomentum().y();
|
|---|
| 138 | ppz = aStep->GetTrack()->GetMomentum().z();
|
|---|
| 139 |
|
|---|
| 140 | // Fill Ntuple positrons
|
|---|
| 141 | analysis->fill_Tuple_Positrons(px, py, pz, pe, ppx, ppy, ppz);
|
|---|
| 142 | }
|
|---|
| 143 | }
|
|---|
| 144 | #endif
|
|---|
| 145 | }
|
|---|
| 146 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|