Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // 27 // ------------------------------------------- 24 // -------------------------------------------------------------- 28 // GEANT 4 - Underground Dark Matter Detecto 25 // GEANT 4 - Underground Dark Matter Detector Advanced Example 29 // 26 // 30 // For information related to this code c 27 // For information related to this code contact: Alex Howard 31 // e-mail: alexander.howard@cern.ch << 28 // e-mail: a.s.howard@ic.ac.uk 32 // ------------------------------------------- 29 // -------------------------------------------------------------- 33 // Comments 30 // Comments 34 // 31 // 35 // Underground Advanced 32 // Underground Advanced 36 // by A. Howard and H. Araujo 33 // by A. Howard and H. Araujo 37 // (27th November 2001) 34 // (27th November 2001) 38 // 35 // 39 // 36 // 40 // PrimaryGeneratorAction program 37 // PrimaryGeneratorAction program 41 // ------------------------------------------- 38 // -------------------------------------------------------------- 42 39 43 #include "DMXPrimaryGeneratorAction.hh" 40 #include "DMXPrimaryGeneratorAction.hh" 44 41 45 #ifdef DMXENV_GPS_USE 42 #ifdef DMXENV_GPS_USE 46 #include "G4GeneralParticleSource.hh" 43 #include "G4GeneralParticleSource.hh" 47 #else 44 #else 48 #include "DMXParticleSource.hh" 45 #include "DMXParticleSource.hh" 49 #endif 46 #endif 50 47 51 #include "G4AnalysisManager.hh" << 48 #ifdef G4ANALYSIS_USE >> 49 #include "DMXAnalysisManager.hh" >> 50 #endif >> 51 52 #include "G4Event.hh" 52 #include "G4Event.hh" 53 53 54 #include "Randomize.hh" 54 #include "Randomize.hh" 55 55 56 #include "globals.hh" 56 #include "globals.hh" 57 57 58 58 59 DMXPrimaryGeneratorAction::DMXPrimaryGenerator 59 DMXPrimaryGeneratorAction::DMXPrimaryGeneratorAction() { 60 60 61 #ifdef DMXENV_GPS_USE 61 #ifdef DMXENV_GPS_USE 62 particleGun = new G4GeneralParticleSource(); 62 particleGun = new G4GeneralParticleSource(); 63 #else 63 #else 64 particleGun = new DMXParticleSource(); 64 particleGun = new DMXParticleSource(); 65 #endif 65 #endif 66 66 67 energy_pri=0; 67 energy_pri=0; 68 // seeds=NULL; 68 // seeds=NULL; 69 seeds[0] =-1; 69 seeds[0] =-1; 70 seeds[1] =-1; 70 seeds[1] =-1; 71 71 72 } 72 } 73 73 74 //....oooOO0OOooo........oooOO0OOooo........oo << 75 74 76 DMXPrimaryGeneratorAction::~DMXPrimaryGenerato 75 DMXPrimaryGeneratorAction::~DMXPrimaryGeneratorAction() { 77 76 78 delete particleGun; 77 delete particleGun; 79 } 78 } 80 79 81 //....oooOO0OOooo........oooOO0OOooo........oo << 82 80 83 void DMXPrimaryGeneratorAction::GeneratePrimar 81 void DMXPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) { 84 82 85 energy_pri = 0.; 83 energy_pri = 0.; 86 84 87 // seeds 85 // seeds 88 seeds[0] = *G4Random::getTheSeeds(); << 86 // seeds = HepRandom::getTheSeeds(); 89 seeds[1] = *(G4Random::getTheSeeds()+1); << 87 seeds[0] = *HepRandom::getTheSeeds(); >> 88 seeds[1] = *(HepRandom::getTheSeeds()+1); 90 89 91 particleGun->GeneratePrimaryVertex(anEvent); 90 particleGun->GeneratePrimaryVertex(anEvent); 92 91 93 energy_pri = particleGun->GetParticleEnergy( 92 energy_pri = particleGun->GetParticleEnergy(); >> 93 #ifdef G4ANALYSIS_USE >> 94 DMXAnalysisManager* analysis = DMXAnalysisManager::getInstance(); >> 95 analysis->analysePrimaryGenerator(energy_pri); >> 96 #endif 94 97 95 //Fill ntuple #1 << 96 G4AnalysisManager* man = G4AnalysisManager:: << 97 man->FillNtupleDColumn(1,0,energy_pri); << 98 man->AddNtupleRow(1); << 99 } 98 } 100 99 101 100 102 101