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

Last change on this file since 1342 was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 4.2 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.10 2009/11/27 14:54:58 hbu Exp $
27// GEANT4 tag $Name: geant4-09-04-beta-01 $
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 runAction->CountProcesses(processName); //count processes
63 
64 if (processName != "GammaToMuPair") return;
65 
66#ifdef G4ANALYSIS_USE
67 G4StepPoint* PrePoint = aStep->GetPreStepPoint(); 
68 G4double      EGamma  = PrePoint->GetTotalEnergy();
69 G4ThreeVector PGamma  = PrePoint->GetMomentum();
70   
71 G4double      Eplus(0), Eminus(0);
72 G4ThreeVector Pplus   , Pminus;
73 G4TrackVector* secondary = fpSteppingManager->GetSecondary();
74 for (size_t lp=0; lp<(*secondary).size(); lp++) {
75   if ((*secondary)[lp]->GetDefinition()==G4MuonPlus::MuonPlusDefinition()) {
76     Eplus  = (*secondary)[lp]->GetTotalEnergy();
77     Pplus  = (*secondary)[lp]->GetMomentum();
78   } else {
79     Eminus = (*secondary)[lp]->GetTotalEnergy();
80     Pminus = (*secondary)[lp]->GetMomentum();             
81   }
82 }
83           
84 G4double xPlus = Eplus/EGamma, xMinus = Eminus/EGamma;
85 G4double thetaPlus = PGamma.angle(Pplus), thetaMinus = PGamma.angle(Pminus);
86 G4double GammaPlus=EGamma*xPlus/muonMass;
87 G4double GammaMinus=EGamma*xMinus/muonMass;
88
89 runAction->GetHisto(0)->fill(1./(1.+std::pow(thetaPlus*GammaPlus,2)));
90 runAction->GetHisto(1)->fill(std::log10(thetaPlus*GammaPlus));
91
92 runAction->GetHisto(2)->fill(std::log10(thetaMinus*GammaMinus));
93 runAction->GetHisto(3)->fill(std::log10(std::fabs(thetaPlus *GammaPlus
94                                              -thetaMinus*GammaMinus)));
95 
96 runAction->GetHisto(4)->fill(xPlus);
97 runAction->GetHisto(5)->fill(xMinus); 
98#endif
99}
100
101//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102
103
Note: See TracBrowser for help on using the repository browser.