00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 00030 #ifndef G4PromaryTransformer_h 00031 #define G4PromaryTransformer_h 1 00032 00033 #include "G4TrackVector.hh" 00034 #include "G4ParticleTable.hh" 00035 #include "globals.hh" 00036 class G4Event; 00037 class G4PrimaryVertex; 00038 #include "G4PrimaryParticle.hh" 00039 #include "G4DynamicParticle.hh" 00040 00041 // class description: 00042 // 00043 // This class is exclusively used by G4EventManager for the conversion 00044 // from G4PrimaryVertex/G4PrimaryParticle to G4DynamicParticle/G4Track. 00045 // 00046 00047 class G4PrimaryTransformer 00048 { 00049 public: 00050 G4PrimaryTransformer(); 00051 virtual ~G4PrimaryTransformer(); 00052 00053 G4TrackVector* GimmePrimaries(G4Event* anEvent, G4int trackIDCounter=0); 00054 void CheckUnknown(); 00055 00056 protected: 00057 G4TrackVector TV; 00058 G4ParticleTable* particleTable; 00059 G4int verboseLevel; 00060 G4int trackID; 00061 00062 G4ParticleDefinition* unknown; 00063 G4bool unknownParticleDefined; 00064 00065 public: 00066 inline void SetVerboseLevel(G4int vl) 00067 { verboseLevel = vl; }; 00068 00069 public: //with description 00070 void SetUnknnownParticleDefined(G4bool vl); 00071 // By invoking this Set method, the user can alter the treatment of unknown 00072 // particle. The ideal place to invoke this method is in the BeginOfRunAction. 00073 00074 inline G4bool GetUnknownParticleDefined() const 00075 { return unknownParticleDefined; } 00076 00077 protected: 00078 void GenerateTracks(G4PrimaryVertex* primaryVertex); 00079 void GenerateSingleTrack(G4PrimaryParticle* primaryParticle, 00080 G4double x0,G4double y0,G4double z0,G4double t0,G4double wv); 00081 void SetDecayProducts(G4PrimaryParticle* mother, 00082 G4DynamicParticle* motherDP); 00083 G4bool CheckDynamicParticle(G4DynamicParticle*DP); 00084 00085 protected: //with description 00086 // Following two virtual methods are provided to customize the use of PrimaryTransformer 00087 // for particle types exotic to Geant4. 00088 00089 virtual G4ParticleDefinition* GetDefinition(G4PrimaryParticle*pp); 00090 // Return appropriate G4ParticleDefinition w.r.t. the primary particle. 00091 // If NULL is returned, the particle will not be treated as a track, but its daughters 00092 // will be examined in case it has "pre-assigned decay products". 00093 00094 virtual G4bool IsGoodForTrack(G4ParticleDefinition*pd); 00095 // Return true if a primary particle should be converted into a track. 00096 // By default, all particles of non-shortlived and shortlived with valid decay 00097 // tables are converted. 00098 }; 00099 00100 #endif 00101 00102