void test_E01(const TString& configMacro, Bool_t oldGeometry) { /// Macro function for testing example E01 /// \param configMacro configuration macro loaded in initialization /// \param oldGeometry if true - geometry is defined via VMC, otherwise /// via TGeo // Load basic libraries gROOT->LoadMacro("macro/basiclibs.C"); basiclibs(); // Load MC libraries TString mc = configMacro(0, 2); if ( mc == "g3" ) { // Geant3 libraries gROOT->LoadMacro("macro/g3libs.C"); g3libs(); } else if ( mc == "g4" ) { // Geant4 libraries gROOT->LoadMacro("macro/g4libs.C"); g4libs(); } else if ( mc == "fl" ) { // Fluka libraries gROOT->LoadMacro("macro/fllibs.C"); fllibs(); // Prepare Fluka working directory gSystem->Exec("macro/run_fluka.sh"); // Enter in Fluka working directory gSystem->cd("fluka_out"); } // Load this example library gSystem->Load("libexample01"); // MC application Ex01MCApplication* appl = new Ex01MCApplication("Example01", "The example01 MC application"); // Set geometry defined via VMC appl->SetOldGeometry(oldGeometry); // Initialize MC appl->InitMC(configMacro); // Run MC appl->RunMC(1); // Print info //cout << endl // << "Test VMC geometry getters << endl << endl; // Test VMC geometry getters appl->TestVMCGeometryGetters(); delete appl; }
void load_g4() { // Load Geant4 + VMC libraries g4libs(); // Load this example library gSystem->Load("libmtroot"); gSystem->Load("libvmc_Gflash"); }
void load_g4() { // Load Geant4 + VMC libraries g4libs(); // Load this example library gSystem->Load("libmtroot"); gSystem->Load("libvmc_E03"); // Load library with a user run configuration gSystem->Load("libgeant4_E03"); }
void calibrateEM() { // FIXME: There are two possibilities to execute the script: // i) root run_hadron_g4.C // root[] .L calibrateEM.C // root[] calibrateEM() // or ii) Include the basics from run_hadron_g4.C here and // execute simply: // root calibrateEM.C // Load basic libraries // Load basic libraries gROOT->LoadMacro("/opt/geant4_vmc.2.15a/examples/macro/basiclibs.C"); basiclibs(); // Load Geant4 libraries gROOT->LoadMacro("/opt/geant4_vmc.2.15a/examples/macro/g4libs.C"); g4libs(); // Load the tutorial application library gSystem->Load("libTutorialApplication"); // MC application TutorialApplication* app = new TutorialApplication("TutorialApplication", "Tutorial Application for HEP Lecture @EKP"); // configure Geant4 gROOT->LoadMacro("g4Config.C"); Config(); // instantiate graphical user interface for tutorial application new TutorialMainFrame(app); //FIXME: Load "CountChargedinScint.C" gROOT->ProcessLine(".L CountChargedinScint.C"); //FIXME: Initialize the geometry app->InitMC("geometry/calor(1,0.2)"); //FIXME: Set the primary particle to photon app->SetPrimaryPDG(22); // Profile histogram - will show us the mean numbers of counts in bins of the energy. // The given binning refers to the energy, the other binning will be inferred automatically. TProfile* hcounts = new TProfile("hcounts","Counts per particle energy", 10,0,10); hcounts->SetXTitle("energy [GeV]"); hcounts->SetYTitle("mean number of counts"); // FIXME loop over different particle momenta, and for each momentum simulate several events (e.g. 10) for(Int_t i = 0 ; i < 10 ; ++i) { for(Int_t k = 0 ; k < 10; k ++) { //FIXME: Set the momentum of the primary particle to p Double_t p = i; app->SetPrimaryMomentum(p); //FIXME: Run the simulation app->RunMC(); //FIXME: Fill both the momentum and the output from CountChargedinScint // into the profile histogram hcounts Double_t x = CountChargedinScint(); hcounts->Fill(p,x); } } TCanvas* c = new TCanvas(); c->cd(); hcounts->Draw(); TF1 *fitter = new TF1("fitf","[0]*x", 0,10); fitter->SetParameter(0,1.0); fitter->SetParNames("calibration factor"); //FIXME: Fit the histogram to get the calibration factor hcounts->Fit("fitf"); }