58 G4RunManager *runManager =
new G4RunManager();
60 CML2WorldConstruction *myWorld=CML2WorldConstruction::GetInstance();
63 G4UImanager* UImanager = G4UImanager::GetUIpointer();
64 UImanager->ApplyCommand(
"/control/verbose 2");
65 UImanager->ApplyCommand(
"/run/verbose 2");
67 ML2PhysicsList *physics =
new ML2PhysicsList();
68 runManager -> SetUserInitialization(physics);
71 G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManager();
72 scoringManager->SetVerboseLevel(1);
75 CML2PrimaryGenerationAction *gun;
76 gun = CML2PrimaryGenerationAction::GetInstance();
79 CML2CInputData *myInputData =
new CML2CInputData();
82 gun->inizialize(&myInputData->inputData.primaryParticleData);
87 myInputData->inputData.generalData.seed = 1;
88 myInputData->inputData.generalData.StartFileInputData =
"macroAndData/macro_files/main/ml2.mac";
92 myInputData->inputData.generalData.seed = 1;
93 myInputData->inputData.generalData.StartFileInputData = (
G4String)argv[1];
97 sscanf(argv[2],
"%d", &myInputData->inputData.generalData.seed);
98 myInputData->inputData.generalData.StartFileInputData = (
G4String)argv[1];
101 G4String command =
"/control/execute ";
102 UImanager->ApplyCommand(command+myInputData->inputData.generalData.StartFileInputData);
106 CLHEP::HepRandom::setTheEngine(
new CLHEP::RanecuEngine);
107 CLHEP::HepRandom::setTheSeed(myInputData->inputData.generalData.seed);
108 G4cout <<
"Using seed " << CLHEP::HepRandom::getTheSeed() << G4endl;
111 if (!myWorld->create(&myInputData->inputData, myInputData->getbOnlyVisio()))
118 gun->design(myWorld->getCML2AcceleratorConstruction()->getAcceleratorIsoCentre());
122 CML2Convergence *convergence =
new CML2Convergence(myInputData->inputData.generalData.seed,
123 myInputData->inputData.generalData.saving_in_Selected_Voxels_every_events,
124 myInputData->inputData.generalData.fileExperimentalData,
125 myInputData->inputData.generalData.fileExperimentalDataOut,
126 myInputData->inputData.generalData.bCompareExp,
127 myInputData->inputData.generalData.maxNumberOfEvents,
128 gun->getNrecycling(),
129 myInputData->inputData.generalData.nMaxLoop);
133 CML2RunAction *myRunAction =
new CML2RunAction(convergence, myInputData->inputData.generalData.nBeam,
134 myInputData->bOnlyVisio,
135 myInputData->inputData.voxelSegmentation.nX,
136 myInputData->inputData.voxelSegmentation.nY,
137 myInputData->inputData.voxelSegmentation.nZ );
139 CML2SteppingAction *myStepAction =
new CML2SteppingAction(convergence);
140 CML2EventAction *ML2EventAction =
new CML2EventAction();
142 runManager -> SetUserInitialization(myWorld);
143 runManager -> SetUserAction(myRunAction);
144 runManager -> SetUserAction(gun);
145 runManager -> SetUserAction(myStepAction);
146 runManager -> SetUserAction(ML2EventAction);
147 runManager -> SetUserAction(
new CML2TrackingAction);
153 G4double loopElapsedTime;
154 G4bool bStopRun =
false;
155 G4bool bNewGeometry =
true;
157 if (myInputData->bOnlyVisio)
160 myWorld -> newGeometry();
161 convergence -> setNewGeometry();
170 bNewGeometry = myWorld -> newGeometry();
171 convergence -> setNewGeometry();
176 CML2WorldConstruction::GetInstance()->checkVolumeOverlap();
178 G4cout <<
"################ START NEW GEOMETRY ########################" << G4endl;
179 myRunAction->setActualLoop(nLoop);
183 runManager->BeamOn(myInputData->inputData.generalData.nBeam);
185 bStopRun = convergence->stopRun();
188 G4cout <<
"################ END NEW GEOMETRY ########################" << G4endl;
193 loopElapsedTime = MyFullTime.GetUserElapsed();
194 G4cout <<
"loop elapsed time [s] : "<< loopElapsedTime <<
'\n' << G4endl;
void visio(int argc, char *argv[])