source: trunk/examples/extended/electromagnetic/TestEm6/src/SteppingAction.cc@ 1036

Last change on this file since 1036 was 807, checked in by garnier, 17 years ago

update

File size: 4.1 KB
Line 
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// $Id: SteppingAction.cc,v 1.9 2006/06/29 16:57:23 gunter Exp $
27// GEANT4 tag $Name: $
28//
29//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
32#include "SteppingAction.hh"
33#include "RunAction.hh"
34#include "G4SteppingManager.hh"
35#include "G4VProcess.hh"
36#include "G4ParticleTypes.hh"
37
38#ifdef G4ANALYSIS_USE
39 #include "AIDA/IHistogram1D.h"
40#endif
41
42//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43
44SteppingAction::SteppingAction(RunAction* RuAct)
45:runAction(RuAct)
46{
47 muonMass = G4MuonPlus::MuonPlus()->GetPDGMass();
48}
49
50//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51
52SteppingAction::~SteppingAction()
53{ }
54
55//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56
57void SteppingAction::UserSteppingAction(const G4Step* aStep)
58{
59 const G4VProcess* process = aStep->GetPostStepPoint()->GetProcessDefinedStep();
60 if (process == 0) return;
61 G4String processName = process->GetProcessName();
62 if (processName != "GammaToMuPair") return;
63
64#ifdef G4ANALYSIS_USE
65 G4StepPoint* PrePoint = aStep->GetPreStepPoint();
66 G4double EGamma = PrePoint->GetTotalEnergy();
67 G4ThreeVector PGamma = PrePoint->GetMomentum();
68
69 G4double Eplus(0), Eminus(0);
70 G4ThreeVector Pplus , Pminus;
71 G4TrackVector* secondary = fpSteppingManager->GetSecondary();
72 for (size_t lp=0; lp<(*secondary).size(); lp++) {
73 if ((*secondary)[lp]->GetDefinition()==G4MuonPlus::MuonPlusDefinition()) {
74 Eplus = (*secondary)[lp]->GetTotalEnergy();
75 Pplus = (*secondary)[lp]->GetMomentum();
76 } else {
77 Eminus = (*secondary)[lp]->GetTotalEnergy();
78 Pminus = (*secondary)[lp]->GetMomentum();
79 }
80 }
81
82 G4double xPlus = Eplus/EGamma, xMinus = Eminus/EGamma;
83 G4double thetaPlus = PGamma.angle(Pplus), thetaMinus = PGamma.angle(Pminus);
84 G4double GammaPlus=EGamma*xPlus/muonMass;
85 G4double GammaMinus=EGamma*xMinus/muonMass;
86
87 runAction->GetHisto(0)->fill(1./(1.+std::pow(thetaPlus*GammaPlus,2)));
88 runAction->GetHisto(1)->fill(std::log10(thetaPlus*GammaPlus));
89
90 runAction->GetHisto(2)->fill(std::log10(thetaMinus*GammaMinus));
91 runAction->GetHisto(3)->fill(std::log10(std::fabs(thetaPlus *GammaPlus
92 -thetaMinus*GammaMinus)));
93
94 runAction->GetHisto(4)->fill(xPlus);
95 runAction->GetHisto(5)->fill(xMinus);
96#endif
97}
98
99//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
100
101
Note: See TracBrowser for help on using the repository browser.