Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:22

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 //
0027 /// \file OpNoviceSteppingAction.cc
0028 /// \brief Implementation of the OpNoviceSteppingAction class
0029 
0030 #include "OpNoviceSteppingAction.hh"
0031 
0032 #include "OpNoviceRun.hh"
0033 
0034 #include "G4Event.hh"
0035 #include "G4OpBoundaryProcess.hh"
0036 #include "G4OpticalPhoton.hh"
0037 #include "G4RunManager.hh"
0038 #include "G4Step.hh"
0039 #include "G4Track.hh"
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 OpNoviceSteppingAction::OpNoviceSteppingAction(OpNoviceEventAction* event)
0044   : G4UserSteppingAction(), fEventAction(event)
0045 {}
0046 
0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0048 void OpNoviceSteppingAction::UserSteppingAction(const G4Step* step)
0049 {
0050   static G4ParticleDefinition* opticalphoton = G4OpticalPhoton::OpticalPhotonDefinition();
0051 
0052   const G4ParticleDefinition* particleDef =
0053     step->GetTrack()->GetDynamicParticle()->GetParticleDefinition();
0054 
0055   if (particleDef == opticalphoton) {
0056     G4StepPoint* endPoint = step->GetPostStepPoint();
0057     const G4VProcess* pds = endPoint->GetProcessDefinedStep();
0058     G4String procname = pds->GetProcessName();
0059     if (procname == "OpRayleigh")
0060       fEventAction->AddRayleigh();
0061     else if (procname == "OpAbsorption")
0062       fEventAction->AddAbsorption();
0063     else if (procname == "OpMieHG")
0064       fEventAction->AddMie();
0065 
0066     // for boundary scattering, process name in 'transportation'.
0067     // Need to check differently:
0068     if (endPoint->GetStepStatus() == fGeomBoundary) {
0069       G4OpBoundaryProcessStatus theStatus = Undefined;
0070       G4ProcessManager* opManager = opticalphoton->GetProcessManager();
0071       G4int n_proc = opManager->GetPostStepProcessVector(typeDoIt)->entries();
0072       G4ProcessVector* postStepDoItVector = opManager->GetPostStepProcessVector(typeDoIt);
0073       for (G4int i = 0; i < n_proc; ++i) {
0074         G4VProcess* currentProcess = (*postStepDoItVector)[i];
0075 
0076         auto opProc = dynamic_cast<G4OpBoundaryProcess*>(currentProcess);
0077         if (opProc) theStatus = opProc->GetStatus();
0078       }
0079       if (theStatus != Undefined && theStatus != NotAtBoundary && theStatus != StepTooSmall) {
0080         fEventAction->AddBoundary();
0081       }
0082     }
0083   }
0084 }
0085 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......