// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * 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. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // /// \file analysis/AnaEx01/AnaEx01.cc /// \brief Main program of the analysis/AnaEx01 example // // // // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "DetectorConstruction.hh" #include "ActionInitialization.hh" #ifdef G4MULTITHREADED #include "G4MTRunManager.hh" #else #include "G4RunManager.hh" #endif #include "G4UImanager.hh" #include "Shielding.hh" #include "G4VisExecutive.hh" #include "G4UIExecutive.hh" #include #include #include "G4Types.hh" #include "G4VPhysicalVolume.hh" #include "G4UImanager.hh" #include "G4GeometryManager.hh" // user classes #include "G4ImportanceBiasing.hh" #include "G4WeightWindowBiasing.hh" #include "ActionInitialization.hh" // Files specific for biasing and scoring #include "G4GeometrySampler.hh" #include "G4IStore.hh" #include "G4VWeightWindowStore.hh" #include "G4WeightWindowAlgorithm.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... int main(int argc, char **argv) { G4int mode = 0; if (argc>1) mode = atoi(argv[1]); G4int numberOfEvents = 100; G4long myseed = 345354; #ifdef G4MULTITHREADED G4MTRunManager * runManager = new G4MTRunManager; G4cout << " Number of cores: " << G4Threading::G4GetNumberOfCores() << G4endl; G4cout << " and using 2 of them! " << G4endl; runManager->SetNumberOfThreads(2); // runManager->SetNumberOfThreads(G4Threading::G4GetNumberOfCores()); #else G4RunManager * runManager = new G4RunManager; #endif G4Random::setTheSeed(myseed); G4VWeightWindowAlgorithm *wwAlg = 0; // pointer for WeightWindow (mode>0) // create the detector --------------------------- DetectorConstruction* detector = new DetectorConstruction(); runManager->SetUserInitialization(detector); G4GeometrySampler mgs(detector->GetWorldVolume(),"neutron"); G4VModularPhysicsList* physicsList = new Shielding; if(mode == 0) { physicsList->RegisterPhysics(new G4ImportanceBiasing(&mgs)); } else { wwAlg = new G4WeightWindowAlgorithm(1, // upper limit factor 1, // survival factor 100); // max. number of splitting physicsList->RegisterPhysics(new G4WeightWindowBiasing (&mgs, wwAlg, onBoundary)); // place of action } runManager->SetUserInitialization(physicsList); // Set user action classes through Worker Initialization // ActionInitialization* actions = new ActionInitialization; runManager->SetUserInitialization(actions); runManager->Initialize(); if (mode == 0) { detector->CreateImportanceStore(); G4cout<<"detector->CreateImportanceStore();"<CreateWeightWindowStore(); G4cout<<"detector->CreateWeightWindowStore();"<BeamOn(numberOfEvents); //temporary fix before runManager->BeamOn works... G4UImanager* UImanager = G4UImanager::GetUIpointer(); G4String command1 = "/control/cout/setCoutFile threadOut"; UImanager->ApplyCommand(command1); G4String command2 = "/run/beamOn " + G4UIcommand::ConvertToString(numberOfEvents);; UImanager->ApplyCommand(command2); // open geometry for clean biasing stores clean-up // G4GeometryManager::GetInstance()->OpenGeometry(); if (wwAlg) { delete wwAlg; } // mgs.ClearSampling(); delete runManager; return 0; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......