/******************************************************************************** * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ void run_reco_timebased( TString mcEngine="TGeant3" ) { FairLogger *logger = FairLogger::GetLogger(); logger->SetLogFileName("MyLog.log"); // logger->SetLogToScreen(kTRUE); // logger->SetLogToFile(kTRUE); // logger->SetLogVerbosityLevel("HIGH"); // logger->SetLogFileLevel("DEBUG4"); // logger->SetLogScreenLevel("DEBUG"); // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 0; // just forget about it, for the moment // Input file (MC events) TString inFile = "data/testdigitimebased_"; inFile = inFile + mcEngine + ".root"; // Parameter file TString parFile = "data/testparams_"; parFile = parFile + mcEngine + ".root"; // Output file TString outFile = "data/testrecotimebased_"; outFile = outFile + mcEngine + ".root"; // ----- Timer -------------------------------------------------------- TStopwatch timer; // ----- Reconstruction run ------------------------------------------- FairRunAna *fRun= new FairRunAna(); fRun->SetInputFile(inFile); fRun->SetOutputFile(outFile); fRun->RunWithTimeStamps(); fRun->SetUseFairLinks(kTRUE); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); parInput1->open(parFile.Data()); rtdb->setFirstInput(parInput1); // ----- TorinoDetector hit producers --------------------------------- FairTestDetectorTimeRecoTask* hitProducer = new FairTestDetectorTimeRecoTask(); fRun->AddTask(hitProducer); fRun->Init(); timer.Start(); fRun->Run(); // ----- Finish ------------------------------------------------------- cout << endl << endl; // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash FairSystemInfo sysInfo; Float_t maxMemory=sysInfo.GetMaxMemory(); cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; cout << maxMemory; cout << "</DartMeasurement>" << endl; timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); Float_t cpuUsage=ctime/rtime; cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; cout << cpuUsage; cout << "</DartMeasurement>" << endl; cout << endl << endl; cout << "Output file is " << outFile << endl; cout << "Parameter file is " << parFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl; cout << "Macro finished successfully." << endl; // ------------------------------------------------------------------------ }
void run_reco( TString mcEngine="TGeant3" ) { FairLogger *logger = FairLogger::GetLogger(); logger->SetLogFileName("MyLog.log"); logger->SetLogToScreen(kTRUE); // logger->SetLogToFile(kTRUE); logger->SetLogVerbosityLevel("LOW"); // logger->SetLogFileLevel("DEBUG4"); logger->SetLogScreenLevel("INFO"); // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 0; // just forget about it, for the moment // Input file (MC events) TString inFile = "data/testdigi_"; inFile = inFile + mcEngine + ".root"; // Parameter file TString parFile = "data/testparams_"; parFile = parFile + mcEngine + ".root"; // Output file TString outFile = "data/testreco_"; outFile = outFile + mcEngine + ".root"; // ----- Timer -------------------------------------------------------- TStopwatch timer; // ----- Reconstruction run ------------------------------------------- FairRunAna *fRun= new FairRunAna(); fRun->SetInputFile(inFile); fRun->SetOutputFile(outFile); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); parInput1->open(parFile.Data()); rtdb->setFirstInput(parInput1); // ----- TorinoDetector hit producers --------------------------------- FairTestDetectorRecoTask* hitProducer = new FairTestDetectorRecoTask(); fRun->AddTask(hitProducer); fRun->Init(); timer.Start(); fRun->Run(); // ----- Finish ------------------------------------------------------- timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); cout << endl << endl; cout << "Macro finished successfully." << endl; cout << "Output file is " << outFile << endl; cout << "Parameter file is " << parFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl; cout << endl; // ------------------------------------------------------------------------ cout << " Test passed" << endl; cout << " All ok " << endl; exit(0); }
void run_rad(Int_t nEvents = 100, TString mcEngine="TGeant3") { TString dir = gSystem->Getenv("VMCWORKDIR"); TString tutdir = dir + "/rutherford/macros"; TString tut_geomdir = dir + "/geometry"; gSystem->Setenv("GEOMPATH",tut_geomdir.Data()); TString tut_configdir = dir + "/gconfig"; gSystem->Setenv("CONFIG_DIR",tut_configdir.Data()); TString outDir = "data"; TString outFile = outDir + "/test1_"; outFile = outFile + mcEngine + ".mc.root"; TString parFile = outDir + "/params1_"; parFile = parFile + mcEngine + ".root"; // In general, the following parts need not be touched // ======================================================================== // ---- Debug option ------------------------------------------------- gDebug = 0; // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ FairLogger *logger = FairLogger::GetLogger(); // define log file name logger->SetLogFileName("MyLog.log"); // log to screen and to file logger->SetLogToScreen(kTRUE); logger->SetLogToFile(kTRUE); // Print very accurate output. Levels are LOW, MEDIUM and HIGH logger->SetLogVerbosityLevel("HIGH"); // ----- Create simulation run ---------------------------------------- FairRunSim* run = new FairRunSim(); run->SetName(mcEngine); // Transport engine run->SetOutputFile(outFile); // Output file FairRuntimeDb* rtdb = run->GetRuntimeDb(); // ------------------------------------------------------------------------ // ----- Create media ------------------------------------------------- run->SetMaterials("media.geo"); // Materials // ------------------------------------------------------------------------ //----Start the radiation length manager ---------------------------------- run->SetRadLenRegister(kTRUE); // ----- Create geometry ---------------------------------------------- FairModule* cave= new FairCave("CAVE"); cave->SetGeometryFileName("cave_vacuum.geo"); run->AddModule(cave); FairModule* target= new FairTarget("Target"); target->SetGeometryFileName("target_rutherford.geo"); run->AddModule(target); FairDetector* rutherford = new FairRutherford("RutherfordDetector", kFALSE); rutherford->SetGeometryFileName("rutherford.geo"); run->AddModule(rutherford); // ------------------------------------------------------------------------ // ----- Create PrimaryGenerator -------------------------------------- FairPrimaryGenerator* primGen = new FairPrimaryGenerator(); run->SetGenerator(primGen); FairBoxGenerator* boxGen1 = new FairBoxGenerator(0, 1); boxGen1->SetPRange(.005,.005); boxGen1->SetPhiRange(0.,0.); boxGen1->SetThetaRange(-90.,90.); boxGen1->SetXYZ(0.,0.,-3.); primGen->AddGenerator(boxGen1); // ------------------------------------------------------------------------ run->SetStoreTraj(kTRUE); // ----- Run initialisation ------------------------------------------- run->Init(); // ------------------------------------------------------------------------ // Set cuts for storing the trajectories. // Switch this on only if trajectories are stored. // Choose this cuts according to your needs, but be aware // that the file size of the output file depends on these cuts FairTrajFilter* trajFilter = FairTrajFilter::Instance(); // trajFilter->SetStepSizeCut(0.01); // 1 cm // trajFilter->SetVertexCut(-2000., -2000., 4., 2000., 2000., 100.); // trajFilter->SetMomentumCutP(10e-3); // p_lab > 10 MeV // trajFilter->SetEnergyCut(0., 1.02); // 0 < Etot < 1.04 GeV trajFilter->SetStorePrimaries(kTRUE); trajFilter->SetStoreSecondaries(kTRUE); // ------------------------------------------------------------------------ // ----- Runtime database --------------------------------------------- Bool_t kParameterMerged = kTRUE; FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged); parOut->open(parFile.Data()); rtdb->setOutput(parOut); rtdb->saveOutput(); rtdb->print(); // ------------------------------------------------------------------------ // ----- Start run ---------------------------------------------------- run->Run(nEvents); // ------------------------------------------------------------------------ run->CreateGeometryFile("data/geofile_full.root"); // ----- Finish ------------------------------------------------------- timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); cout << endl << endl; cout << "Macro finished succesfully." << endl; cout << "Output file is " << outFile << endl; cout << "Parameter file is " << parFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl; // ------------------------------------------------------------------------ }