Back to home page

EIC code displayed by LXR

 
 

    


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

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/TestEm5/src/StackingAction.cc
0027 /// \brief Implementation of the StackingAction class
0028 //
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #include "StackingAction.hh"
0034 
0035 #include "EventAction.hh"
0036 #include "HistoManager.hh"
0037 #include "Run.hh"
0038 #include "StackingMessenger.hh"
0039 
0040 #include "G4EmSecondaryParticleType.hh"
0041 #include "G4RunManager.hh"
0042 #include "G4Track.hh"
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 StackingAction::StackingAction(EventAction* event) : fEventAction(event)
0047 {
0048   fStackMessenger = new StackingMessenger(this);
0049 }
0050 
0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0052 
0053 StackingAction::~StackingAction()
0054 {
0055   delete fStackMessenger;
0056 }
0057 
0058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0059 
0060 G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* aTrack)
0061 {
0062   G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0063 
0064   // keep primary particle
0065   if (aTrack->GetParentID() == 0) {
0066     return fUrgent;
0067   }
0068 
0069   G4int procID = aTrack->GetCreatorProcess()->GetProcessSubType();
0070   G4int modelID = aTrack->GetCreatorModelID();
0071 
0072   // count secondary particles
0073   Run* run = static_cast<Run*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
0074   run->CountParticles(aTrack->GetDefinition());
0075   /*
0076   G4cout << "###StackingAction: new "
0077          << aTrack->GetDefinition()->GetParticleName()
0078          << " E(MeV)= " << aTrack->GetKineticEnergy()
0079          << "  " << aTrack->GetMomentumDirection() << G4endl;
0080   */
0081   //
0082   // energy spectrum of secondaries
0083   //
0084   G4double energy = aTrack->GetKineticEnergy();
0085   G4double charge = aTrack->GetDefinition()->GetPDGCharge();
0086 
0087   if (charge != 0.) {
0088     analysisManager->FillH1(2, energy);
0089     analysisManager->FillH1(4, energy);
0090     if (procID >= 51 && procID <= 65) {
0091       analysisManager->FillH1(58, energy);
0092       analysisManager->FillH1(60, energy);
0093     }
0094     else if (_AugerElectron == modelID) {
0095       analysisManager->FillH1(50, energy);
0096       analysisManager->FillH1(52, energy);
0097     }
0098     else if (_ePIXE == modelID) {
0099       analysisManager->FillH1(54, energy);
0100       analysisManager->FillH1(56, energy);
0101     }
0102   }
0103 
0104   if (aTrack->GetDefinition() == G4Gamma::Gamma()) {
0105     analysisManager->FillH1(3, energy);
0106     analysisManager->FillH1(5, energy);
0107     if (procID >= 51 && procID <= 65) {
0108       analysisManager->FillH1(59, energy);
0109       analysisManager->FillH1(61, energy);
0110     }
0111     else if (_Fluorescence == modelID) {
0112       analysisManager->FillH1(51, energy);
0113       analysisManager->FillH1(53, energy);
0114     }
0115     else if (_GammaPIXE == modelID) {
0116       analysisManager->FillH1(55, energy);
0117       analysisManager->FillH1(57, energy);
0118     }
0119   }
0120 
0121   // stack or delete secondaries
0122   G4ClassificationOfNewTrack status = fUrgent;
0123   if (0 < fKillSecondary) {
0124     if (fKillSecondary == 1) {
0125       fEventAction->AddEnergy(energy);
0126     }
0127     status = fKill;
0128   }
0129 
0130   return status;
0131 }
0132 
0133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......