00001 //---------------------------------------------------------------------------// 00002 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu// 00003 // // 00004 // MAJORANA Simulation // 00005 // // 00006 // This code implementation is the intellectual property of the // 00007 // MAJORANA Collaboration. It is based on Geant4, an intellectual // 00008 // property of the RD44 GEANT4 collaboration. // 00009 // // 00010 // ********************* // 00011 // // 00012 // Neither the authors of this software system, nor their employing // 00013 // institutes, nor the agencies providing financial support for this // 00014 // work make any representation or warranty, express or implied, // 00015 // regarding this software system or assume any liability for its use. // 00016 // By copying, distributing or modifying the Program (or any work based // 00017 // on on the Program) you indicate your acceptance of this statement, // 00018 // and all its terms. // 00019 // // 00020 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu// 00021 //---------------------------------------------------------------------------// 00022 // 00023 // $Id: MJGeneratorPrimary.cc,v 1.3 2004/11/22 13:10:20 gast Exp $ 00024 // 00025 // CLASS IMPLEMENTATION: MJGeneratorPrimary.cc 00026 // 00027 //---------------------------------------------------------------------------// 00034 // 00035 //---------------------------------------------------------------------------// 00049 //---------------------------------------------------------------------------// 00050 // 00051 #include "G4ThreeVector.hh" 00052 00053 #include "management/MJManager.hh" 00054 #include "generators/MJGeneratorPrimaryMessenger.hh" 00055 #include "io/MJLogger.hh" 00056 00057 //---------------------------------------------------------------------------// 00058 00059 #include "generators/MJGeneratorPrimary.hh" 00060 00061 //---------------------------------------------------------------------------// 00062 00063 class G4Event; 00064 00065 //---------------------------------------------------------------------------// 00066 00067 MJGeneratorPrimary::MJGeneratorPrimary(): 00068 fMJGenerator(0),confinementCode(noconfined) 00069 { 00070 volumeName = "NULL"; 00071 positionSampler = new MaGeGeneratorPositionSampling(); 00072 fG4Messenger = new MJGeneratorPrimaryMessenger(this); 00073 00074 } 00075 00076 //---------------------------------------------------------------------------// 00077 00078 MJGeneratorPrimary::MJGeneratorPrimary(const MJGeneratorPrimary & other) 00079 {;} 00080 00081 //---------------------------------------------------------------------------// 00082 00083 MJGeneratorPrimary::~MJGeneratorPrimary() 00084 { 00085 delete fG4Messenger; 00086 delete positionSampler; 00087 delete fMJGenerator; 00088 } 00089 00090 //---------------------------------------------------------------------------// 00091 00092 void MJGeneratorPrimary::GeneratePrimaries(G4Event *event) 00093 { 00094 G4int copyN = 0; 00095 G4ThreeVector position; 00096 if(fMJGenerator) 00097 { 00098 if (confinementCode == volume) 00099 { 00100 position = positionSampler->SampleUniformlyInVolume(GetVolumeName(),copyN); 00101 fMJGenerator->SetParticlePosition(position); 00102 } 00103 else if (confinementCode == surface) 00104 { 00105 position = positionSampler->SampleOnSurface(GetVolumeName(),copyN); 00106 fMJGenerator->SetParticlePosition(position); 00107 } 00108 fMJGenerator->GeneratePrimaryVertex(event); 00109 } 00110 else { 00111 MJLog(error) << "No generator specified!" << endlog; 00112 MJLog(fatal) << endlog; 00113 } 00114 } 00115 00116 //---------------------------------------------------------------------------// 00117 //---------------------------------------------------------------------------//