| 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 | //
|
|---|
| 27 | // $Id: Em10SteppingAction.cc,v 1.6 2006/06/29 16:39:06 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 |
|
|---|
| 32 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 33 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 34 |
|
|---|
| 35 | #include "Em10DetectorConstruction.hh"
|
|---|
| 36 | #include "G4EnergyLossTables.hh"
|
|---|
| 37 | #include "G4SteppingManager.hh"
|
|---|
| 38 | #include "G4TrackVector.hh"
|
|---|
| 39 | #include "Em10SteppingAction.hh"
|
|---|
| 40 | #include "Em10PrimaryGeneratorAction.hh"
|
|---|
| 41 | #include "Em10EventAction.hh"
|
|---|
| 42 | #include "Em10RunAction.hh"
|
|---|
| 43 | #include "G4Event.hh"
|
|---|
| 44 | #include "G4EventManager.hh"
|
|---|
| 45 | #include "Em10SteppingMessenger.hh"
|
|---|
| 46 | #include "G4ios.hh"
|
|---|
| 47 | #include <iomanip>
|
|---|
| 48 | #include "G4UImanager.hh"
|
|---|
| 49 |
|
|---|
| 50 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 51 |
|
|---|
| 52 | Em10SteppingAction::Em10SteppingAction(Em10DetectorConstruction* DET,
|
|---|
| 53 | Em10EventAction* EA,
|
|---|
| 54 | Em10RunAction* RA)
|
|---|
| 55 | :detector (DET),eventaction (EA),runaction (RA),steppingMessenger(0),
|
|---|
| 56 | IDold(-1) ,evnoold(-1)
|
|---|
| 57 | {
|
|---|
| 58 | steppingMessenger = new Em10SteppingMessenger(this);
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 62 |
|
|---|
| 63 | Em10SteppingAction::~Em10SteppingAction()
|
|---|
| 64 | {
|
|---|
| 65 | delete steppingMessenger ;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 69 |
|
|---|
| 70 | void Em10SteppingAction::UserSteppingAction(const G4Step* aStep)
|
|---|
| 71 | {
|
|---|
| 72 |
|
|---|
| 73 | G4double Theta,Thetaback,Ttrans,Tback,Tsec,Egamma,yend,zend,rend ;
|
|---|
| 74 | G4int evno = eventaction->GetEventno() ;
|
|---|
| 75 |
|
|---|
| 76 | IDnow = evno+10000*(aStep->GetTrack()->GetTrackID())+
|
|---|
| 77 | 100000000*(aStep->GetTrack()->GetParentID());
|
|---|
| 78 | if(IDnow != IDold)
|
|---|
| 79 | {
|
|---|
| 80 | IDold=IDnow ;
|
|---|
| 81 | if(
|
|---|
| 82 | (((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
|---|
| 83 | GetParticleName()) == "e-") &&
|
|---|
| 84 | ((aStep->GetTrack()->GetTrackID() != 1) ||
|
|---|
| 85 | (aStep->GetTrack()->GetParentID() != 0)) )
|
|---|
| 86 | ||
|
|---|
| 87 | (((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
|---|
| 88 | GetParticleName()) == "e+") &&
|
|---|
| 89 | ((aStep->GetTrack()->GetTrackID() != 1) ||
|
|---|
| 90 | (aStep->GetTrack()->GetParentID() != 0)) )
|
|---|
| 91 | )
|
|---|
| 92 | runaction->Fillvertexz(aStep->GetTrack()->GetVertexPosition().x());
|
|---|
| 93 |
|
|---|
| 94 | if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Absorber")
|
|---|
| 95 | {
|
|---|
| 96 | if(((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
|---|
| 97 | GetParticleName()) == "e-") &&
|
|---|
| 98 | ((aStep->GetTrack()->GetTrackID() != 1) ||
|
|---|
| 99 | (aStep->GetTrack()->GetParentID() != 0)) )
|
|---|
| 100 | {
|
|---|
| 101 | eventaction->AddCharged() ;
|
|---|
| 102 | eventaction->AddE() ;
|
|---|
| 103 | Tsec = aStep->GetTrack()->GetKineticEnergy() ; // !!!!!!!!!!!!
|
|---|
| 104 | Tsec += aStep->GetTotalEnergyDeposit() ; // !!!!!!!!!!!!
|
|---|
| 105 | runaction->FillTsec(Tsec) ;
|
|---|
| 106 | }
|
|---|
| 107 | else
|
|---|
| 108 | if(((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
|---|
| 109 | GetParticleName()) == "e+") &&
|
|---|
| 110 | ((aStep->GetTrack()->GetTrackID() != 1) ||
|
|---|
| 111 | (aStep->GetTrack()->GetParentID() != 0)) )
|
|---|
| 112 | {
|
|---|
| 113 | eventaction->AddCharged() ;
|
|---|
| 114 | eventaction->AddP() ;
|
|---|
| 115 | Tsec = aStep->GetTrack()->GetKineticEnergy() ; // !!!!!!!!!!!!
|
|---|
| 116 | Tsec += aStep->GetTotalEnergyDeposit() ; // !!!!!!!!!!!!
|
|---|
| 117 | runaction->FillTsec(Tsec) ;
|
|---|
| 118 | }
|
|---|
| 119 | else
|
|---|
| 120 | if(((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
|---|
| 121 | GetParticleName()) == "gamma") &&
|
|---|
| 122 | ((aStep->GetTrack()->GetTrackID() != 1) ||
|
|---|
| 123 | (aStep->GetTrack()->GetParentID() != 0)) )
|
|---|
| 124 | {
|
|---|
| 125 | eventaction->AddNeutral() ;
|
|---|
| 126 | }
|
|---|
| 127 | }
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| 130 | if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Absorber")
|
|---|
| 131 | {
|
|---|
| 132 | if(((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
|---|
| 133 | GetParticleName()) == "e-")
|
|---|
| 134 | ||
|
|---|
| 135 | ((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
|---|
| 136 | GetParticleName()) == "e+"))
|
|---|
| 137 | eventaction->CountStepsCharged() ;
|
|---|
| 138 |
|
|---|
| 139 | if ((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
|---|
| 140 | GetParticleName()) == "gamma")
|
|---|
| 141 | eventaction->CountStepsNeutral() ;
|
|---|
| 142 | }
|
|---|
| 143 |
|
|---|
| 144 | if (
|
|---|
| 145 | (((aStep->GetTrack()->GetTrackID() == 1) &&
|
|---|
| 146 | (aStep->GetTrack()->GetParentID()== 0)) ||
|
|---|
| 147 | (aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
|---|
| 148 | GetParticleName() ==
|
|---|
| 149 | Em10PrimaryGeneratorAction::GetPrimaryName()))
|
|---|
| 150 | &&
|
|---|
| 151 | (aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Absorber")
|
|---|
| 152 | &&
|
|---|
| 153 | (aStep->GetTrack()->GetNextVolume()->GetName()=="World") &&
|
|---|
| 154 | (aStep->GetPostStepPoint()->GetProcessDefinedStep()
|
|---|
| 155 | ->GetProcessName() == "Transportation") &&
|
|---|
| 156 | (aStep->GetTrack()->GetMomentumDirection().x()>0.)
|
|---|
| 157 | )
|
|---|
| 158 | {
|
|---|
| 159 | eventaction->SetTr();
|
|---|
| 160 | Theta = std::acos(aStep->GetTrack()->GetMomentumDirection().x()) ;
|
|---|
| 161 | runaction->FillTh(Theta) ;
|
|---|
| 162 | Ttrans = aStep->GetTrack()->GetKineticEnergy() ;
|
|---|
| 163 | runaction->FillTt(Ttrans) ;
|
|---|
| 164 | yend= aStep->GetTrack()->GetPosition().y() ;
|
|---|
| 165 | zend= aStep->GetTrack()->GetPosition().z() ;
|
|---|
| 166 | rend = std::sqrt(yend*yend+zend*zend) ;
|
|---|
| 167 | runaction->FillR(rend);
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| 170 | if (
|
|---|
| 171 | (((aStep->GetTrack()->GetTrackID() == 1) &&
|
|---|
| 172 | (aStep->GetTrack()->GetParentID()== 0)) ||
|
|---|
| 173 | (aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
|---|
| 174 | GetParticleName() ==
|
|---|
| 175 | Em10PrimaryGeneratorAction::GetPrimaryName()))
|
|---|
| 176 | &&
|
|---|
| 177 | (aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Absorber") &&
|
|---|
| 178 | (aStep->GetTrack()->GetNextVolume()->GetName()=="World") &&
|
|---|
| 179 | (aStep->GetPostStepPoint()->GetProcessDefinedStep()
|
|---|
| 180 | ->GetProcessName() == "Transportation") &&
|
|---|
| 181 | (aStep->GetTrack()->GetMomentumDirection().z()<0.)
|
|---|
| 182 | )
|
|---|
| 183 | {
|
|---|
| 184 | eventaction->SetRef();
|
|---|
| 185 | Thetaback = std::acos(aStep->GetTrack()->GetMomentumDirection().x()) ;
|
|---|
| 186 | Thetaback -= 0.5*pi ;
|
|---|
| 187 | runaction->FillThBack(Thetaback) ;
|
|---|
| 188 | Tback = aStep->GetTrack()->GetKineticEnergy() ;
|
|---|
| 189 | runaction->FillTb(Tback) ;
|
|---|
| 190 | }
|
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 | if (
|
|---|
| 194 | ((aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Absorber") &&
|
|---|
| 195 | (aStep->GetTrack()->GetNextVolume()->GetName()=="World") &&
|
|---|
| 196 | (aStep->GetPostStepPoint()->GetProcessDefinedStep()
|
|---|
| 197 | ->GetProcessName() == "Transportation") &&
|
|---|
| 198 | (aStep->GetTrack()->GetMomentumDirection().x()>0.) &&
|
|---|
| 199 | (aStep->GetTrack()->GetDynamicParticle()->GetDefinition()
|
|---|
| 200 | ->GetParticleName() == "gamma"))
|
|---|
| 201 | )
|
|---|
| 202 | {
|
|---|
| 203 | Egamma = aStep->GetTrack()->GetKineticEnergy() ;
|
|---|
| 204 | runaction->FillGammaSpectrum(Egamma) ;
|
|---|
| 205 | }
|
|---|
| 206 |
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 210 |
|
|---|