Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file electromagnetic/TestEm6/src/Stepping << 26 // $Id: SteppingAction.cc,v 1.11 2010-12-03 14:54:55 gcosmo Exp $ 27 /// \brief Implementation of the SteppingActio << 27 // GEANT4 tag $Name: not supported by cvs2svn $ 28 // << 29 // 28 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 31 33 #include "SteppingAction.hh" 32 #include "SteppingAction.hh" 34 << 35 #include "RunAction.hh" 33 #include "RunAction.hh" 36 << 37 #include "G4ParticleTypes.hh" << 38 #include "G4SteppingManager.hh" 34 #include "G4SteppingManager.hh" 39 #include "G4VProcess.hh" 35 #include "G4VProcess.hh" >> 36 #include "G4ParticleTypes.hh" >> 37 >> 38 #ifdef G4ANALYSIS_USE >> 39 #include "AIDA/IHistogram1D.h" >> 40 #endif 40 41 41 //....oooOO0OOooo........oooOO0OOooo........oo 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 42 43 43 SteppingAction::SteppingAction(RunAction* RuAc << 44 SteppingAction::SteppingAction(RunAction* RuAct) 44 { << 45 :runAction(RuAct) 45 fMuonMass = G4MuonPlus::MuonPlus()->GetPDGMa << 46 { >> 47 muonMass = G4MuonPlus::MuonPlus()->GetPDGMass(); 46 } 48 } 47 49 48 //....oooOO0OOooo........oooOO0OOooo........oo 50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 49 51 50 SteppingAction::~SteppingAction() {} << 52 SteppingAction::~SteppingAction() >> 53 { } 51 54 52 //....oooOO0OOooo........oooOO0OOooo........oo 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 53 56 54 void SteppingAction::UserSteppingAction(const 57 void SteppingAction::UserSteppingAction(const G4Step* aStep) 55 { 58 { 56 const G4VProcess* process = aStep->GetPostSt << 59 const G4VProcess* process = aStep->GetPostStepPoint()->GetProcessDefinedStep(); 57 if (process == 0) return; << 60 if (process == 0) return; 58 G4String processName = process->GetProcessNa << 61 G4String processName = process->GetProcessName(); 59 fRunAction->CountProcesses(processName); // << 62 runAction->CountProcesses(processName); //count processes 60 << 63 61 if (processName != "GammaToMuPair") return; << 64 if (processName != "GammaToMuPair") return; 62 << 65 63 G4StepPoint* PrePoint = aStep->GetPreStepPoi << 66 #ifdef G4ANALYSIS_USE 64 G4double EGamma = PrePoint->GetTotalEnergy() << 67 G4StepPoint* PrePoint = aStep->GetPreStepPoint(); 65 G4ThreeVector PGamma = PrePoint->GetMomentum << 68 G4double EGamma = PrePoint->GetTotalEnergy(); 66 << 69 G4ThreeVector PGamma = PrePoint->GetMomentum(); 67 G4double Eplus(0), Eminus(0); << 70 68 G4ThreeVector Pplus, Pminus; << 71 G4double Eplus(0), Eminus(0); 69 const G4TrackVector* secondary = fpSteppingM << 72 G4ThreeVector Pplus , Pminus; 70 for (size_t lp = 0; lp < (*secondary).size() << 73 const G4TrackVector* secondary = fpSteppingManager->GetSecondary(); 71 if ((*secondary)[lp]->GetDefinition() == G << 74 for (size_t lp=0; lp<(*secondary).size(); lp++) { 72 Eplus = (*secondary)[lp]->GetTotalEnergy << 75 if ((*secondary)[lp]->GetDefinition()==G4MuonPlus::MuonPlusDefinition()) { 73 Pplus = (*secondary)[lp]->GetMomentum(); << 76 Eplus = (*secondary)[lp]->GetTotalEnergy(); 74 } << 77 Pplus = (*secondary)[lp]->GetMomentum(); 75 else { << 78 } else { 76 Eminus = (*secondary)[lp]->GetTotalEnerg << 79 Eminus = (*secondary)[lp]->GetTotalEnergy(); 77 Pminus = (*secondary)[lp]->GetMomentum() << 80 Pminus = (*secondary)[lp]->GetMomentum(); 78 } << 81 } 79 } << 82 } 80 << 83 81 G4double xPlus = Eplus / EGamma, xMinus = Em << 84 G4double xPlus = Eplus/EGamma, xMinus = Eminus/EGamma; 82 G4double thetaPlus = PGamma.angle(Pplus), th << 85 G4double thetaPlus = PGamma.angle(Pplus), thetaMinus = PGamma.angle(Pminus); 83 G4double GammaPlus = Eplus / fMuonMass; << 86 G4double GammaPlus=EGamma*xPlus/muonMass; 84 G4double GammaMinus = Eminus / fMuonMass; << 87 G4double GammaMinus=EGamma*xMinus/muonMass; 85 << 88 86 G4AnalysisManager* analysisManager = G4Analy << 89 runAction->GetHisto(0)->fill(1./(1.+std::pow(thetaPlus*GammaPlus,2))); 87 << 90 runAction->GetHisto(1)->fill(std::log10(thetaPlus*GammaPlus)); 88 if (0.0 == thetaPlus || 0.0 == thetaMinus) { << 91 89 G4cout << "SteppingAction: " << 92 runAction->GetHisto(2)->fill(std::log10(thetaMinus*GammaMinus)); 90 << "thetaPlus= " << thetaPlus << " << 93 runAction->GetHisto(3)->fill(std::log10(std::fabs(thetaPlus *GammaPlus 91 << " gamPlus= " << GammaPlus << " g << 94 -thetaMinus*GammaMinus))); 92 << thetaPlus * GammaPlus - thetaMin << 95 93 return; << 96 runAction->GetHisto(4)->fill(xPlus); 94 } << 97 runAction->GetHisto(5)->fill(xMinus); 95 analysisManager->FillH1(1, 1. / (1. + std::p << 98 #endif 96 analysisManager->FillH1(2, std::log10(thetaP << 97 << 98 analysisManager->FillH1(3, std::log10(thetaM << 99 analysisManager->FillH1(4, << 100 std::log10(std::fabs << 101 << 102 analysisManager->FillH1(5, xPlus); << 103 analysisManager->FillH1(6, xMinus); << 104 } 99 } 105 100 106 //....oooOO0OOooo........oooOO0OOooo........oo 101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 102 >> 103 107 104