/** * Performs a transport simulation with user defined setup * in the CBM MuCh setup: STS + MUCH. * * @author Florian Uhlig f.uhlig@gsi.de * @param nEvents Number of events to process * @param inputSignal Input file containing signal * @param inputBgr Input file containing background * @param outFile Output file for transport data * @param setupName Name of experiment setup to load */ #include using namespace std; void much_transport(Int_t nEvents = 3, TString inputSignal = "", TString inputBgr = "", TString outFile = "", TString setupName = "much_test") { // ----- Set unique random generator seed ----------------------------- // Comment this out if you want to have a defined seed for reproducibility. gRandom->SetSeed(1); // ------------------------------------------------------------------------ // ---- Debug option ------------------------------------------------- gDebug = 0; // ------------------------------------------------------------------------ // --- Logger settings ---------------------------------------------------- FairLogger::GetLogger()->SetLogScreenLevel("INFO"); FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ // ======================================================================== // Adjust this part according to your requirements TString inputdir = gSystem->Getenv("VMCWORKDIR"); if (inputSignal == "") { inputSignal = inputdir + "/macro/much/data/jpsi.root"; } if (inputBgr == "") { inputBgr = inputdir + "/input/urqmd.auau.10gev.centr.root"; } if (outFile == "") { outFile = "data/" + setupName + ".tra.root"; } TString parFile = "data/" + setupName + ".par.root"; TString geoFile = "data/" + setupName + ".geofile.root"; // ----- Confirm input parameters ------------------------------------ cout << endl; cout << "======== CBMROOT Macro much_sim =================" << endl; cout << "First input file is " << inputSignal << endl; cout << "Second input file is " << inputBgr << endl; cout << "Output file is " << outFile << endl; cout << "Events to process: " << nEvents << endl; cout << "===================================================" << endl; cout << endl; // ----- Load the geometry setup ------------------------------------- std::cout << std::endl; TString setupFile = inputdir + "/macro/much/setup_" + setupName + ".C"; TString setupFunct = "setup_"; setupFunct = setupFunct + setupName + "()"; std::cout << "-I- " << ": Loading macro " << setupFile << std::endl; gROOT->LoadMacro(setupFile); gROOT->ProcessLine(setupFunct); CbmSetup* setup = CbmSetup::Instance(); // ------------------------------------------------------------------------ CbmTransport run; run.AddInput(inputBgr); run.AddInput(inputSignal, kPluto); run.SetOutFileName(outFile); run.SetParFileName(parFile); run.SetGeoFileName(geoFile); run.SetSetup(setup); run.SetTarget("Gold", 0.025, 2.5); run.SetBeamPosition(0., 0., 0.1, 0.1); run.Run(nEvents); // ----- Finish ------------------------------------------------------- timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); std::cout << std::endl << std::endl; std::cout << "Macro finished successfully." << std::endl; std::cout << "Output file is " << outFile << std::endl; std::cout << "Parameter file is " << parFile << std::endl; std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << std::endl << std::endl; // ------------------------------------------------------------------------ // ----- Resource monitoring ------------------------------------------ FairSystemInfo sysInfo; Float_t maxMemory=sysInfo.GetMaxMemory(); std::cout << ""; std::cout << maxMemory; std::cout << "" << std::endl; Float_t cpuUsage=ctime/rtime; std::cout << ""; std::cout << cpuUsage; std::cout << "" << std::endl; std::cout << " Test passed" << std::endl; std::cout << " All ok " << std::endl; // ------------------------------------------------------------------------ }