![]() |
|
|||
File indexing completed on 2025-02-23 09:21:15
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 field/BlineTracer/src/G4BlinePrimaryGeneratorAction.cc 0027 /// \brief Implementation of the G4BlinePrimaryGeneratorAction class 0028 // 0029 // 0030 // 0031 // 0032 // -------------------------------------------------------------------- 0033 // 0034 // G4BlinePrimaryGeneratorAction implementation 0035 // 0036 // -------------------------------------------------------------------- 0037 // Author: Laurent Desorgher (desorgher@phim.unibe.ch) 0038 // Created - 2003-10-06 0039 // -------------------------------------------------------------------- 0040 0041 #include "G4BlinePrimaryGeneratorAction.hh" 0042 0043 #include "G4ChargedGeantino.hh" 0044 #include "G4Event.hh" 0045 #include "G4SystemOfUnits.hh" 0046 #include "G4Types.hh" 0047 0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0049 0050 void G4BlinePrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) 0051 { 0052 if (!fUserPrimaryAction) { 0053 G4Exception("G4BlinePrimaryGeneratorAction::GeneratePrimaries()", "NullPointer", JustWarning, 0054 "Primary generator action not defined !"); 0055 return; 0056 } 0057 0058 // For the first part of a bline the start position and time are defined 0059 // by using the USER primary action while for the second part the previous 0060 // values are taken. 0061 0062 if (fFirstPartOfBline) { 0063 // set the position and time defined by using the USER primary action 0064 0065 auto tmpEvent = new G4Event(); 0066 fUserPrimaryAction->GeneratePrimaries(tmpEvent); 0067 fBlineStartPosition = tmpEvent->GetPrimaryVertex()->GetPosition(); 0068 fT0 = tmpEvent->GetPrimaryVertex()->GetT0(); 0069 delete tmpEvent; 0070 } 0071 fFirstPartOfBline = false; 0072 0073 auto primary_vertex = new G4PrimaryVertex(fBlineStartPosition, fT0); 0074 0075 // Define the particle to be tracked as Charged Geantino 0076 0077 G4ChargedGeantino* pdef = G4ChargedGeantino::ChargedGeantino(); 0078 0079 G4double mass = pdef->GetPDGMass(); 0080 G4double energy = 10000. * MeV + mass; 0081 G4double pmom = std::sqrt(energy * energy - mass * mass); 0082 0083 // The momentum direction and energy do not have an effect in tracing of 0084 // bline but still need to be defined. 0085 0086 G4double px = 0.; 0087 G4double py = 0.; 0088 G4double pz = pmom; 0089 0090 auto particle = new G4PrimaryParticle(pdef, px, py, pz); 0091 particle->SetMass(mass); 0092 particle->SetCharge(pdef->GetPDGCharge()); 0093 primary_vertex->SetPrimary(particle); 0094 0095 anEvent->AddPrimaryVertex(primary_vertex); 0096 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |