Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:01

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file electromagnetic/TestEm6/src/SteppingAction.cc
0027 /// \brief Implementation of the SteppingAction class
0028 //
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #include "SteppingAction.hh"
0034 
0035 #include "RunAction.hh"
0036 
0037 #include "G4ParticleTypes.hh"
0038 #include "G4SteppingManager.hh"
0039 #include "G4VProcess.hh"
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 SteppingAction::SteppingAction(RunAction* RuAct) : G4UserSteppingAction(), fRunAction(RuAct)
0044 {
0045   fMuonMass = G4MuonPlus::MuonPlus()->GetPDGMass();
0046 }
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0049 
0050 SteppingAction::~SteppingAction() {}
0051 
0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0053 
0054 void SteppingAction::UserSteppingAction(const G4Step* aStep)
0055 {
0056   const G4VProcess* process = aStep->GetPostStepPoint()->GetProcessDefinedStep();
0057   if (process == 0) return;
0058   G4String processName = process->GetProcessName();
0059   fRunAction->CountProcesses(processName);  // count processes
0060 
0061   if (processName != "GammaToMuPair") return;
0062 
0063   G4StepPoint* PrePoint = aStep->GetPreStepPoint();
0064   G4double EGamma = PrePoint->GetTotalEnergy();
0065   G4ThreeVector PGamma = PrePoint->GetMomentum();
0066 
0067   G4double Eplus(0), Eminus(0);
0068   G4ThreeVector Pplus, Pminus;
0069   const G4TrackVector* secondary = fpSteppingManager->GetSecondary();
0070   for (size_t lp = 0; lp < (*secondary).size(); lp++) {
0071     if ((*secondary)[lp]->GetDefinition() == G4MuonPlus::MuonPlusDefinition()) {
0072       Eplus = (*secondary)[lp]->GetTotalEnergy();
0073       Pplus = (*secondary)[lp]->GetMomentum();
0074     }
0075     else {
0076       Eminus = (*secondary)[lp]->GetTotalEnergy();
0077       Pminus = (*secondary)[lp]->GetMomentum();
0078     }
0079   }
0080 
0081   G4double xPlus = Eplus / EGamma, xMinus = Eminus / EGamma;
0082   G4double thetaPlus = PGamma.angle(Pplus), thetaMinus = PGamma.angle(Pminus);
0083   G4double GammaPlus = Eplus / fMuonMass;
0084   G4double GammaMinus = Eminus / fMuonMass;
0085 
0086   G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0087 
0088   if (0.0 == thetaPlus || 0.0 == thetaMinus) {
0089     G4cout << "SteppingAction: "
0090            << "thetaPlus= " << thetaPlus << " thetaMinus= " << thetaMinus
0091            << " gamPlus= " << GammaPlus << " gamMinus= " << GammaMinus << "  "
0092            << thetaPlus * GammaPlus - thetaMinus * GammaMinus << G4endl;
0093     return;
0094   }
0095   analysisManager->FillH1(1, 1. / (1. + std::pow(thetaPlus * GammaPlus, 2)));
0096   analysisManager->FillH1(2, std::log10(thetaPlus * GammaPlus));
0097 
0098   analysisManager->FillH1(3, std::log10(thetaMinus * GammaMinus));
0099   analysisManager->FillH1(4,
0100                           std::log10(std::fabs(thetaPlus * GammaPlus - thetaMinus * GammaMinus)));
0101 
0102   analysisManager->FillH1(5, xPlus);
0103   analysisManager->FillH1(6, xMinus);
0104 }
0105 
0106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......