// simulation software for the Panda Barrel DIRC prototype // contact: r.dzhygadlo@gsi.de #ifdef G4MULTITHREADED #include "G4MTRunManager.hh" #else #include "G4RunManager.hh" #endif #include "G4UImanager.hh" #include "TROOT.h" #include "PrtPhysicsList.h" #include "PrtDetectorConstruction.h" #include "PrtActionInitialization.h" #include "time.h" #ifdef G4VIS_USE #include "G4VisExecutive.hh" #endif #ifdef G4UI_USE #include "G4UIExecutive.hh" #endif #include "TApplication.h" #include "PrtManager.h" #include "PrtLutReco.h" namespace { void PrintUsage() { G4cerr<<" Usage: "< 50 ) { PrintUsage(); return 1; } TApplication theApp("App", 0, 0); G4String macro, events, geometry, radiator, physlist, outfile, session,geomAng,batchmode,lensId,particle,momentum,testVal, beamDimension, mcpLayout, infile = "hits.root", lutfile = "../data/lut.root"; G4int runtype = 0; G4long myseed = 345354; for ( G4int i=1; iSetBatch(kTRUE); if(!events.size()) events = "1"; PrtManager::Instance(outfile,runtype); if(runtype == 2){ PrtLutReco * reco = new PrtLutReco(infile,lutfile); reco->Run(0); return 0; } // Choose the Random engine G4Random::setTheEngine(new CLHEP::RanecuEngine); std::cout<<"SEED "<SetPhysList(atoi(physlist)); if(geometry.size()) PrtManager::Instance()->SetGeometry(atoi(geometry)); if(radiator.size()) PrtManager::Instance()->SetRadiator(atoi(radiator)); if(lensId.size()) PrtManager::Instance()->SetLens(atoi(lensId)); if(mcpLayout.size())PrtManager::Instance()->SetMcpLayout(atoi(mcpLayout)); if(beamDimension.size()) PrtManager::Instance()->SetBeamDimension(atoi(beamDimension)); if(testVal.size()) PrtManager::Instance()->SetShift(atof(testVal)); if(testVal.size()) PrtManager::Instance()->SetTest(atof(testVal)); if(geomAng.size()) PrtManager::Instance()->SetAngle(atof(geomAng)); // Detector construction runManager-> SetUserInitialization(new PrtDetectorConstruction()); // Physics list runManager-> SetUserInitialization(new PrtPhysicsList()); // User action initialization runManager->SetUserInitialization(new PrtActionInitialization(outfile)); // Initialize G4 kernel runManager->Initialize(); #ifdef G4VIS_USE // Initialize visualization G4VisManager* visManager = new G4VisExecutive; // G4VisManager* visManager = new G4VisExecutive("Quiet"); visManager->Initialize(); #endif // Get the pointer to the User Interface manager G4UImanager* UImanager = G4UImanager::GetUIpointer(); if ( macro.size() ) { G4String command = "/control/execute "; UImanager->ApplyCommand(command+macro); } else { UImanager->ApplyCommand("/control/execute prt.mac"); } if ( geomAng.size() ) { G4String command = "/Prt/geom/prtRotation "; UImanager->ApplyCommand(command+geomAng); } if ( lensId.size() ) { G4String command = "/Prt/geom/lensId "; UImanager->ApplyCommand(command+lensId); } if ( particle.size() ) { G4String command = "/gun/particle "; UImanager->ApplyCommand(command+particle); int pdgid = 0; if(particle=="proton") pdgid = 2212; if(particle=="pi+") pdgid = 211; if(particle=="pi0") pdgid = 111; if(particle=="kaon+") pdgid = 321; if(particle=="mu-") pdgid = 13; if(particle=="e-") pdgid = 11; PrtManager::Instance()->SetParticle(pdgid); } if(momentum.size()) UImanager->ApplyCommand( "/gun/momentumAmp "+momentum); if(batchmode.size()){ // batch mode UImanager->ApplyCommand("/run/beamOn "+events); }else{ // UI session for interactive mode #ifdef G4UI_USE G4UIExecutive * ui = new G4UIExecutive(argc,argv,session); #ifdef G4VIS_USE UImanager->ApplyCommand("/control/execute ../vis.mac"); #endif if (ui->IsGUI()) UImanager->ApplyCommand("/control/execute gui.mac"); UImanager->ApplyCommand("/run/beamOn "+events); //UImanager->ApplyCommand("/vis/ogl/printEPS"); ui->SessionStart(); delete ui; #endif } #ifdef G4VIS_USE delete visManager; #endif delete runManager; return 0; }