Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:10

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 // Authors: Susanna Guatelli and Francesco Romano
0027 // susanna@uow.edu.au, francesco.romano@ct.infn.it
0028 //
0029 
0030 #include "G4ios.hh"
0031 #include "G4SteppingManager.hh"
0032 #include "G4Step.hh"
0033 #include "G4Track.hh"
0034 #include "G4StepPoint.hh"
0035 #include "G4VPhysicalVolume.hh"
0036 #include "SteppingAction.hh"
0037 #include "AnalysisManager.hh"
0038 #include "G4SystemOfUnits.hh"
0039 
0040 SteppingAction::SteppingAction(AnalysisManager* pAnalysis)
0041 { 
0042 analysis = pAnalysis;
0043 fSecondary = 0; 
0044 }
0045 
0046 SteppingAction::~SteppingAction()
0047 { 
0048 }
0049 
0050 void SteppingAction::UserSteppingAction(const G4Step* aStep)
0051 { 
0052   G4SteppingManager*  steppingManager = fpSteppingManager;
0053   G4Track* theTrack = aStep -> GetTrack();
0054 
0055   // check if it is alive
0056   if(theTrack-> GetTrackStatus() == fAlive) { return; }
0057 
0058   // Retrieve the secondary particles
0059     fSecondary = steppingManager -> GetfSecondary();
0060 
0061 
0062 
0063 #ifdef ANALYSIS_USE  
0064    for(size_t lp1=0;lp1<(*fSecondary).size(); lp1++)
0065      { 
0066        // Retrieve the info about the generation of secondary particles 
0067        G4String volumeName = (*fSecondary)[lp1] -> GetVolume() -> GetName(); // volume where secondary was generated 
0068        G4String secondaryParticleName =  (*fSecondary)[lp1]->GetDefinition() -> GetParticleName();  // name of the secondary
0069        G4double secondaryParticleKineticEnergy =  (*fSecondary)[lp1] -> GetKineticEnergy(); // kinetic energy
0070       // G4String process = (*fSecondary)[lp1]-> GetCreatorProcess()-> GetProcessName();   // process creating it
0071        G4double charge = (*fSecondary)[lp1] -> GetDynamicParticle() -> GetDefinition() -> GetPDGCharge();
0072        G4int AA = (*fSecondary)[lp1] -> GetDynamicParticle() -> GetDefinition() -> GetBaryonNumber();
0073 
0074      if (G4StrUtil::contains(volumeName, "SV_phys") || volumeName == "sen_bridge" || volumeName == "physSensitiveBridgeVolume") 
0075 //Testing with larger volume!
0076 //if (volumeName == "DiaVol_phys")
0077      {
0078     //   G4cout << "Particle in = " << volumeName << G4endl;
0079        if ((secondaryParticleName == "proton") ||
0080                (secondaryParticleName == "neutron")||
0081                (secondaryParticleName == "alpha") ||
0082                (secondaryParticleName == "deuton") || 
0083                (secondaryParticleName == "triton") || 
0084                (secondaryParticleName == "He3") || 
0085            (secondaryParticleName =="GenericIon"))
0086                analysis -> FillSecondaries(AA, charge, secondaryParticleKineticEnergy/MeV);     
0087           }
0088    }
0089 #endif   
0090 }
0091