// // ******************************************************************** // * 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 electromagnetic/TestEm1/src/StackingAction.cc /// \brief Implementation of the StackingAction class // // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "StackingAction.hh" //#include "HistoManager.hh" #include "G4SystemOfUnits.hh" #include "G4Track.hh" #include "G4RunManager.hh" #include "g4analysis.hh" #include "G4DynamicParticle.hh" #include "globals.hh" #include "G4ThreeVector.hh" #include "G4Event.hh" #include "G4PrimaryParticle.hh" #include "G4PrimaryVertex.hh" #include "G4Step.hh" #include "G4ThreeVector.hh" #include "G4Track.hh" #include "G4TrackStatus.hh" #include "G4VProcess.hh" #include "G4UImanager.hh" #include "G4Ions.hh" #include "G4Navigator.hh" #include "G4TransportationManager.hh" #include "G4ProcessManager.hh" #include "G4StepStatus.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... StackingAction::StackingAction() : G4UserStackingAction() { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... StackingAction::~StackingAction() { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* track) { //This code looks for gammas emitted by nuclear decays //and counts how many primary particles are emitted in the decay G4int parentID = track->GetParentID(); G4String particleName = track->GetDefinition()->GetParticleName(); G4String particleType = track->GetDefinition()->GetParticleType(); G4cout <<"Process is " << track->GetCreatorProcess()->GetProcessName() << G4endl; G4int pdggamma; G4double energy; G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); if ((parentID == 0 && particleName == "gamma") || (track->GetCreatorProcess()->GetProcessName() == "RadioactiveDecay" && particleName == "gamma")) { pdggamma = track->GetParticleDefinition()->GetPDGEncoding(); energy = track->GetDynamicParticle()->GetKineticEnergy(); analysisManager->FillNtupleDColumn(2,0, pdggamma); //if (energy > 0) { analysisManager->FillNtupleDColumn(2,1, energy/keV); analysisManager->AddNtupleRow(2); analysisManager->FillH1(1, energy/keV); // } } return fUrgent; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......