00001 // 00002 // ******************************************************************** 00003 // * DISCLAIMER * 00004 // * * 00005 // * Neither the authors of this software system, nor their employing * 00006 // * institutes,nor the agencies providing financial support for this * 00007 // * work make any representation or warranty, express or implied, * 00008 // * regarding this software system or assume any liability for its * 00009 // * use. * 00010 // * * 00011 // ******************************************************************** 00012 // 00013 // This is supposed to be a generator for cosmic ray muons (with the 00014 // correct spectrum) in the tunnel. It is work in progress 00015 // 00016 // History: 00017 // -------- 00018 // 28 Oct 2004 L.Pandola First implementation (not working) 00019 00020 #ifndef MaGeGeneratorCosmicRayMuons_h 00021 #define MaGeGeneratorCosmicRayMuons_h 1 00022 00023 #include "G4VPrimaryGenerator.hh" 00024 #include "G4Navigator.hh" 00025 #include "G4ParticleMomentum.hh" 00026 #include "G4ParticleDefinition.hh" 00027 #include "globals.hh" 00028 #include <fstream> 00029 00030 #include "generators/MaGeGeneratorCosmicRayMuonsMessenger.hh" 00031 class G4DataVector; 00032 00033 class MaGeGeneratorCosmicRayMuons : public G4VPrimaryGenerator { 00034 00035 public: 00036 MaGeGeneratorCosmicRayMuons (G4String,G4String); 00037 ~MaGeGeneratorCosmicRayMuons (); 00038 void GeneratePrimaryVertex(G4Event *evt); 00039 00040 public: 00041 00042 // position distribution 00043 void SetHalfZ(G4double); 00044 void SetRadius(G4double); 00045 00046 private: 00047 // angular distribution 00048 void GenerateAngularSpectrum(); 00049 00050 // energy distribution 00051 void GenerateEnergySpectrum(); 00052 00053 // initial position 00054 void SampleInitialPosition(); 00055 00056 void OpenEnergyFile(G4String); 00057 void OpenAngularFile(G4String); 00058 00059 public: 00060 //Get methods 00061 inline G4double GetParticleEnergy() {return particle_energy;} 00062 inline G4String GetParticleName() {return particle_definition->GetParticleName();}; 00063 00064 // verbosity 00065 void SetVerbosity(G4int); 00066 00067 //Set methods 00068 void SetParticleDefinition(G4ParticleDefinition * aParticleDefinition); 00069 inline void SetParticleCharge(G4double aCharge) 00070 { particle_charge = aCharge; } 00071 00072 private: 00073 // position distribution 00074 G4double halfz; 00075 G4double Radius; 00076 00077 // particle properties 00078 G4int NumberOfParticlesToBeGenerated; 00079 G4ParticleDefinition* particle_definition; 00080 G4ParticleMomentum particle_momentum_direction; 00081 G4double particle_energy; 00082 G4double particle_charge; 00083 G4ThreeVector particle_position; 00084 G4double particle_time; 00085 G4ThreeVector particle_polarization; 00086 00087 //files to be read 00088 G4String fFileEnergyName; 00089 G4String fFileAngularName; 00090 std::ifstream fEnergyInputFile; 00091 std::ifstream fAngularInputFile; 00092 00093 // Verbose 00094 G4int verbosityLevel; 00095 00096 private: 00097 G4DataVector* fEnergy; 00098 G4DataVector* fEnergySpectrum; 00099 MaGeGeneratorCosmicRayMuonsMessenger *theMessenger; 00100 G4Navigator *gNavigator; 00101 00102 }; 00103 00104 00105 #endif 00106