// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // /// \file TrackingAction.cc /// \brief Implementation of the TrackingAction class // // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "TrackingAction.hh" #include "B1EventAction.hh" #include "TrackingMessenger.hh" #include "G4Track.hh" #include "G4ParticleTypes.hh" #include "G4IonTable.hh" #include "G4RunManager.hh" #include "G4SystemOfUnits.hh" #include "G4UnitsTable.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... TrackingAction::TrackingAction(B1EventAction* eventAction) :G4UserTrackingAction(), fEvent(eventAction),fTrackMessenger(0), fFullChain(true) { fTrackMessenger = new TrackingMessenger(this); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... TrackingAction::~TrackingAction() { delete fTrackMessenger; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void TrackingAction::PreUserTrackingAction(const G4Track* track) { G4ParticleDefinition* particle = track->GetDefinition(); G4String name = particle->GetParticleName(); fCharge = particle->GetPDGCharge(); fMass = particle->GetPDGMass(); G4double Ekin = track->GetKineticEnergy(); G4int ID = track->GetTrackID(); G4bool condition = false; // check LifeTime // G4double meanLife = particle->GetPDGLifeTime(); //Ion // if (fCharge > 2.) { //build decay chain if (ID == 1) fEvent->AddDecayChain(name); else fEvent->AddDecayChain(" ---> " + name); // //full chain: put at rest; if not: kill secondary G4Track* tr = (G4Track*) track; if (fFullChain) { tr->SetKineticEnergy(0.); tr->SetTrackStatus(fStopButAlive);} else if (ID>1) tr->SetTrackStatus(fStopAndKill); // } //example of saving random number seed of this fEvent, under condition // ////condition = (ih == 3); //if (condition) G4RunManager::GetRunManager()->rndmSaveThisEvent(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......