// // ******************************************************************** // * DISCLAIMER * // * * // * The following disclaimer summarizes all the specific disclaimers * // * of contributors to this software. The specific disclaimers,which * // * govern, are listed with their locations in: * // * http://cern.ch/geant4/license * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. * // * * // * This code implementation is the intellectual property of the * // * GEANT4 collaboration. * // * By copying, distributing or modifying the Program (or any work * // * based on the Program) you indicate your acceptance of this * // * statement, and all its terms. * // ******************************************************************** // // // $Id: EXPO.cc,v 1.9 2001/07/11 09:56:40 gunter Exp $ // GEANT4 tag $Name: geant4-05-00 $ // #include /*Geant4*/ #include #ifdef __sun #include "EXPO_Templates.hh" // This : /* template class G4RWTValOrderedVector; template class G4RWTValOrderedVector; template class G4RWTValVector; template class G4RWTValVector; template class G4Allocator; template class G4Allocator; */ #endif /*OPACS*/ /*begin Want_h*/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*Need HAS_XZ and HAS_PAW flags.*/ /*end Want_h*/ #include /*G4o*/ #include /***************************************************************************/ /***** G4 EXPO customization ***********************************************/ /***************************************************************************/ #include #include #include #include #include #include class EXPO_RunAction : public G4UserRunAction { private: G4Timer* timer; G4int runIDcounter; #ifdef HAS_HO static OHistogram myHisto1D; static OHistogram myHisto2D; #endif /*HAS_HO*/ public: EXPO_RunAction() { timer = new G4Timer; runIDcounter = 0; } ~EXPO_RunAction() { delete timer; } void BeginOfRunAction(const G4Run* aRun) { CWarnF ("### Run %d start.\n",aRun->GetRunID()); timer->Start(); #ifdef HAS_HO // Histo are created in an osh script somewhere (G4oRunBegin.osh). myHisto1D = OHistogramGetIdentifier("HepJamesRandom1"); myHisto2D = OHistogramGetIdentifier("HepJamesVsDRand48"); #endif /*HAS_HO*/ } void EndOfRunAction(const G4Run* aRun) { timer->Stop(); if (timer->IsValid()) { CWarnF ("number of event = %d User=%gs Real=%gs Sys=%gs\n", aRun->GetNumberOfEvent(), timer->GetUserElapsed(), timer->GetRealElapsed(), timer->GetSystemElapsed()); } else { CWarnF ("number of event = %d User=****s Real=****s Sys=****s\n", aRun->GetNumberOfEvent()); } #ifdef HAS_HO myHisto1D = NULL; myHisto2D = NULL; #endif /*HAS_HO*/ } #ifdef HAS_HO static OHistogram get_1d(){return myHisto1D; } static OHistogram Get2d(){return myHisto2D; } #endif /*HAS_HO*/ }; #ifdef HAS_HO OHistogram EXPO_RunAction::myHisto1D = NULL; OHistogram EXPO_RunAction::myHisto2D = NULL; #endif /*HAS_HO*/ #include class EXPO_EventAction : public G4UserEventAction { public: EXPO_EventAction() { } ~EXPO_EventAction() { } void BeginOfEventAction(const G4Event*) { } void EndOfEventAction(const G4Event*) { } }; #include "G4UserSteppingAction.hh" class EXPO_SteppingAction : public G4UserSteppingAction { private: HepJamesRandom theJamesEngine; DRand48Engine theDRand48Engine; public: EXPO_SteppingAction(){}; ~EXPO_SteppingAction(){}; void UserSteppingAction(const G4Step*) { #ifdef HAS_HO OHistogram h1 = EXPO_RunAction::get_1d(); OHistogram h2 = EXPO_RunAction::Get2d(); HepRandom::setTheEngine (&theJamesEngine); double james = RandGauss::shoot(0.3,0.1); OHistogramFillOneDimensional(h1,james,0.01); HepRandom::setTheEngine(&theDRand48Engine); double d48 = RandGauss::shoot(0.7,0.1); OHistogramFillTwoDimensional(h2,james,d48,0.01); #endif /*HAS_HO*/ } }; static char what[] = "@(#)EXPO v3"; /***************************************************************************/ int main ( int a_argn ,char** a_args ) /***************************************************************************/ /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ { /*.........................................................................*/ what[0] = '@'; /*c++ no warning.*/ /*begin Want_c*/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*end Want_c*/ G4RunManager* runManager = new G4RunManager; runManager->SetUserInitialization (new EXPO_DetectorConstruction); runManager->SetUserInitialization (new EXPO_PhysicsList); runManager->SetUserAction (new EXPO_RunAction); runManager->SetUserAction (new EXPO_PrimaryGeneratorAction); runManager->SetUserAction (new EXPO_EventAction); runManager->SetUserAction (new EXPO_SteppingAction); G4oState* state = new G4oState("EXPO_"); WoStartup (a_argn,a_args); WoProcessEvents (); WoClearClass (); delete state; delete runManager; return EXIT_SUCCESS; }