Added to repository
This commit is contained in:
179
geant4/LEMuSR/LEMuSR.cc
Normal file
179
geant4/LEMuSR/LEMuSR.cc
Normal file
@ -0,0 +1,179 @@
|
||||
//§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§//*
|
||||
// LOW ENERGY MUON SPIN RELAXATION, ROTATION, RADIATION Geant4 SIMULATION
|
||||
// ID : LEMuSR.cc , v 1.0
|
||||
// AUTHOR: Taofiq PARAISO
|
||||
// DATE : 2004-06-24 09:57
|
||||
|
||||
//§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§//
|
||||
//
|
||||
// & &&&&&&&&&& &&&&&&& &&&&&&&&
|
||||
// & & && && & &&
|
||||
// & & & & & & &&
|
||||
// & &&&&&&& & & &&&&&& &&&&&&&&
|
||||
// & & & && & & &&
|
||||
// & & && & & && && & &
|
||||
// &&&&&&&&&& &&&&&&&&&& & &&&&& && &&&&&&& & &&
|
||||
// &
|
||||
// &
|
||||
// &
|
||||
// &
|
||||
//
|
||||
//§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§//
|
||||
|
||||
|
||||
|
||||
// G4 CLASSES
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIterminal.hh"
|
||||
#include "G4UItcsh.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include <iomanip.h>
|
||||
|
||||
// LEMuSR CLASSES
|
||||
#include "LEMuSRDetectorConstruction.hh"
|
||||
|
||||
#include "LEMuSRPhysicsList.hh"
|
||||
#include "PhysicsList.hh"
|
||||
|
||||
#include "LEMuSRPrimaryGeneratorAction.hh"
|
||||
|
||||
#include "LEMuSRRunAction.hh"
|
||||
#include "LEMuSREventAction.hh"
|
||||
#include "LEMuSRSteppingAction.hh"
|
||||
#include "LEMuSRStackingAction.hh"
|
||||
#include "LEMuSRTrackingAction.hh"
|
||||
|
||||
// DUMMY PLANES STEPPING ACTIONS
|
||||
#include "AsymCheck.hh"
|
||||
#include "FieldCheck.hh"
|
||||
#include "TDCheck.hh"
|
||||
#include "FocalLengthTest.hh"
|
||||
|
||||
|
||||
// LEMuSR VISUALIZATION CLASS
|
||||
#include "LEMuSRVisManager.hh"
|
||||
|
||||
// Interactive root xwindow
|
||||
#ifdef G4UI_USE_ROOT
|
||||
#include "G4UIRoot.hh"
|
||||
#endif
|
||||
|
||||
|
||||
int main(int argc,char** argv)//argc:: defines the user interface
|
||||
{
|
||||
|
||||
// random numbers
|
||||
time_t myseed;
|
||||
time(&myseed);
|
||||
RanecuEngine *theRanGenerator = new RanecuEngine;
|
||||
theRanGenerator->setSeed(myseed);
|
||||
HepRandom::setTheEngine(theRanGenerator);
|
||||
|
||||
|
||||
// 1 The run manager construction
|
||||
G4RunManager* runManager = new G4RunManager;
|
||||
|
||||
// 2 The three mandatory classes
|
||||
|
||||
// 2.1 LEMuSR Initialization classes
|
||||
LEMuSRDetectorConstruction* lemuDetector = new LEMuSRDetectorConstruction();
|
||||
|
||||
LEMuSRPhysicsList* lemuPhysicsList = new LEMuSRPhysicsList();
|
||||
|
||||
// 2.2 LEMuSR Action class
|
||||
LEMuSRPrimaryGeneratorAction* lemuPGA = new LEMuSRPrimaryGeneratorAction();
|
||||
|
||||
|
||||
// 2.3 Setting the mandatory Initialization classes
|
||||
runManager ->SetUserInitialization( lemuDetector );
|
||||
|
||||
runManager ->SetUserInitialization( lemuPhysicsList );
|
||||
|
||||
|
||||
// 2.4 Setting the mandatory Action class
|
||||
runManager ->SetUserAction( lemuPGA );
|
||||
|
||||
// 3 The optionnal classes
|
||||
runManager ->SetUserAction( new LEMuSRRunAction());
|
||||
//#ifndef LEMU_TEST_FOCAL_LENGTH
|
||||
runManager ->SetUserAction( new LEMuSREventAction());// scintillators, sensitive detectors
|
||||
//#endif
|
||||
|
||||
|
||||
// optionnal stepping action: enable one at once
|
||||
|
||||
#if defined LEMU_TEST_ASYM
|
||||
runManager ->SetUserAction( new AsymCheck());
|
||||
#elif defined LEMU_TEST_FIELD
|
||||
runManager ->SetUserAction( new FieldCheck());
|
||||
#elif defined LEMU_TEST_CFOIL
|
||||
runManager ->SetUserAction( new TDCheck());
|
||||
#elif defined LEMU_TEST_FOCAL_LENGTH
|
||||
runManager ->SetUserAction( new FocalLengthTest());
|
||||
#else
|
||||
runManager ->SetUserAction( new LEMuSRSteppingAction());// fur debugging
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// 4 The visualization manager construction and initialization
|
||||
// ! will be initialize only if the env variable G4VIS_USE=1 !
|
||||
#ifdef G4VIS_USE
|
||||
LEMuSRVisManager* lemuVisManager = new LEMuSRVisManager;
|
||||
lemuVisManager -> Initialize();
|
||||
#endif
|
||||
|
||||
// 5 Initialize G4 kernel
|
||||
runManager -> Initialize();
|
||||
|
||||
|
||||
// Configuration of the User Interface manager
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
|
||||
G4UIsession* session = 0;
|
||||
|
||||
|
||||
|
||||
#if defined G4UI_USE_ROOT
|
||||
// G4UIRoot is a ROOT based GUI
|
||||
session = new G4UIRoot( argc, argv);
|
||||
#elif defined G4UI_USE_TCSH
|
||||
session = new G4UIterminal(new G4UItcsh);
|
||||
G4cout<<"\n G4UI_USE_TCSH! \n"<<G4endl;
|
||||
#else
|
||||
session = new G4UIterminal();
|
||||
#endif
|
||||
|
||||
// UI->ApplyCommand("/control/execute visual.mac");
|
||||
UI->ApplyCommand("/run/verbose 2");
|
||||
|
||||
// UI->ApplyCommand("/Detector/MagneticField on");
|
||||
// UI->ApplyCommand("/run/beamOn 1");
|
||||
#if defined LEMU_TEST_ASYM
|
||||
// UI->ApplyCommand("/Detector/ElectricField off");
|
||||
UI->ApplyCommand("/Detector/MagneticField 50");
|
||||
UI->ApplyCommand("/Detector/AsymCheck on");
|
||||
UI->ApplyCommand("/lemuGun/gunPosition 0 0 0");
|
||||
UI->ApplyCommand("/lemuGun/energy/defined 0");
|
||||
G4cout<<"\n READY TO TEST ASYMETRY! ";
|
||||
#endif
|
||||
|
||||
|
||||
session->SessionStart();
|
||||
|
||||
// JOB TERMINATION
|
||||
|
||||
delete session;
|
||||
|
||||
#if defined G4VIS_USE
|
||||
delete lemuVisManager;
|
||||
#endif
|
||||
|
||||
|
||||
delete runManager;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user