diff --git a/macro/run/run_reco.C b/macro/run/run_reco.C index 6260b7401e69644c4020c7336806347038c869cd..721c4b6262f3d4c06b7a84d61c8c92d0620f5eca 100644 --- a/macro/run/run_reco.C +++ b/macro/run/run_reco.C @@ -9,6 +9,7 @@ #if !defined(__CLING__) #include "CbmBuildEventsFromTracksReal.h" #include "CbmBuildEventsIdeal.h" +#include "CbmBuildEventsQa.h" #include "CbmDefs.h" #include "CbmFindPrimaryVertex.h" #include "CbmKF.h" @@ -16,6 +17,7 @@ #include "CbmL1StsTrackFinder.h" #include "CbmLitFindGlobalTracks.h" #include "CbmMCDataManager.h" +#include "CbmMatchRecoToMC.h" #include "CbmMuchFindHitsGem.h" #include "CbmMvdClusterfinder.h" #include "CbmMvdHitfinder.h" @@ -29,6 +31,7 @@ #include "CbmStsFindTracks.h" #include "CbmStsFindTracksEvents.h" #include "CbmStsTrackFinder.h" +#include "CbmTaskBuildRawEvents.h" #include "CbmTofSimpClusterizer.h" #include "CbmTrdClusterFinder.h" #include "CbmTrdHitProducer.h" @@ -198,50 +201,6 @@ void run_reco(TString input = "", Int_t nTimeSlices = -1, Int_t firstTimeSlice = std::cout << "-I- " << myName << ": Added task " << evBuildRaw->GetName() << std::endl; eventBased = kTRUE; } //? Ideal raw event building - else if (sEvBuildRaw.EqualTo("Real2018", TString::ECaseCompare::kIgnoreCase)) { - CbmMcbm2018EventBuilder* evBuildRaw = new CbmMcbm2018EventBuilder(); - - evBuildRaw->SetFixedTimeWindow(500.); - evBuildRaw->SetTriggerMinNumberSts(1000); - - evBuildRaw->SetUseBaseMuchDigi(kTRUE); - - run->AddTask(evBuildRaw); - std::cout << "-I- " << myName << ": Added task " << evBuildRaw->GetName() << std::endl; - eventBased = kTRUE; - } - else if (sEvBuildRaw.EqualTo("Real2019", TString::ECaseCompare::kIgnoreCase)) { - CbmMcbm2019TimeWinEventBuilderTask* evBuildRaw = new CbmMcbm2019TimeWinEventBuilderTask(); - - //Choose between NoOverlap, MergeOverlap, AllowOverlap - evBuildRaw->SetEventOverlapMode(EOverlapMode::AllowOverlap); - - // Remove detectors where digis not found - if (!useRich) evBuildRaw->RemoveDetector(kEventBuilderDetRich); - if (!useMuch) evBuildRaw->RemoveDetector(kEventBuilderDetMuch); - if (!usePsd) evBuildRaw->RemoveDetector(kEventBuilderDetPsd); - if (!useTof) evBuildRaw->RemoveDetector(kEventBuilderDetTof); - if (!useTrd) evBuildRaw->RemoveDetector(kEventBuilderDetTrd); - if (!useSts) { - std::cerr << "-E- " << myName << ": Sts must be present for raw event " - << "building using ``Real2019'' option. Terminating macro." << std::endl; - return; - } - // Set STS as reference detector - evBuildRaw->SetReferenceDetector(kEventBuilderDetSts); - evBuildRaw->SetTsParameters(0.0, 1.e7, 0.0); - - // Use CbmMuchDigi instead of CbmMuchBeamtimeDigi - evBuildRaw->ChangeMuchBeamtimeDigiFlag(kFALSE); - - evBuildRaw->SetTriggerMinNumber(ECbmModuleId::kSts, 1000); - evBuildRaw->SetTriggerMaxNumber(ECbmModuleId::kSts, -1); - evBuildRaw->SetTriggerWindow(ECbmModuleId::kSts, -500, 500); - - run->AddTask(evBuildRaw); - std::cout << "-I- " << myName << ": Added task " << evBuildRaw->GetName() << std::endl; - eventBased = kTRUE; - } else if (sEvBuildRaw.EqualTo("Real", TString::ECaseCompare::kIgnoreCase)) { CbmTaskBuildRawEvents* evBuildRaw = new CbmTaskBuildRawEvents(); @@ -282,6 +241,7 @@ void run_reco(TString input = "", Int_t nTimeSlices = -1, Int_t firstTimeSlice = } //? event-based reco // ------------------------------------------------------------------------ + // ----------- QA for raw event builder ----------------------------------- if (eventBased && useMC) { CbmBuildEventsQA* evBuildQA = new CbmBuildEventsQA(); diff --git a/macro/run/run_reco_event_qa.C b/macro/run/run_reco_event_qa.C deleted file mode 100644 index 23e87019742229b1e1f48d6b33f5838c1209e879..0000000000000000000000000000000000000000 --- a/macro/run/run_reco_event_qa.C +++ /dev/null @@ -1,201 +0,0 @@ -// -------------------------------------------------------------------------- -// -// Macro for reconstruction of simulated raw data with L1 QA -// -// Default event-by-event reconstruction chain, -// defined in macro/run/modules/reconstruct.C -// -// The following naming conventions are assumed: -// Transport file: [dataset].tra.root -// Raw data file: [dataset].event.raw.root -// Parameter file: [dataset].par.root -// Output file: [dataset].rec.root -// -// V. Friese 10/06/2018 -// -// -------------------------------------------------------------------------- - - -void run_reco_event_qa(Int_t nEvents = 2, - TString dataset = "test", - TString setup = "sis100_electron") { - - // ======================================================================== - // Adjust this part according to your requirements - - // --- Logger settings ---------------------------------------------------- - TString logLevel = "INFO"; - TString logVerbosity = "LOW"; - // ------------------------------------------------------------------------ - - - // ----- Environment -------------------------------------------------- - TString myName = "run_reco_event"; // this macro's name for screen output - TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory - // ------------------------------------------------------------------------ - - - // ----- In- and output file names ------------------------------------ - TString traFile = dataset + ".tra.root"; - TString rawFile = dataset + ".event.raw.root"; - TString parFile = dataset + ".par.root"; - TString outFile = dataset + ".rec.root"; - // ------------------------------------------------------------------------ - - - // ----- Load the geometry setup ------------------------------------- - std::cout << std::endl; - std::cout << "-I- " << myName << ": Loading setup " << setup << std::endl; - CbmSetup::Instance()->LoadSetup(setup); - // You can modify the pre-defined setup by using - // CbmSetup::Instance()->RemoveModule(ESystemId) or - // CbmSetup::Instance()->SetModule(ESystemId, const char*, Bool_t) or - // CbmSetup::Instance()->SetActive(ESystemId, Bool_t) - // See the class documentation of CbmSetup. - // ------------------------------------------------------------------------ - - - // ----- Parameter files as input to the runtime database ------------- - std::cout << std::endl; - std::cout << "-I- " << myName << ": Defining parameter files " << std::endl; - TList* parFileList = new TList(); - TString geoTag; - - // - TRD digitisation parameters - if (CbmSetup::Instance()->GetGeoTag(kTrd, geoTag)) { - TObjString* trdFile = - new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + ".digi.par"); - parFileList->Add(trdFile); - std::cout << "-I- " << myName << ": Using parameter file " - << trdFile->GetString() << std::endl; - } - - // - TOF digitisation parameters - if (CbmSetup::Instance()->GetGeoTag(kTof, geoTag)) { - TObjString* tofBdfFile = - new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); - parFileList->Add(tofBdfFile); - std::cout << "-I- " << myName << ": Using parameter file " - << tofBdfFile->GetString() << std::endl; - } - // ------------------------------------------------------------------------ - - // In general, the following parts need not be touched - // ======================================================================== - - - // ----- Timer -------------------------------------------------------- - TStopwatch timer; - timer.Start(); - // ------------------------------------------------------------------------ - - - // ---- Debug option ------------------------------------------------- - gDebug = 0; - // ------------------------------------------------------------------------ - - - // ----- FairRunAna --------------------------------------------------- - FairRunAna* run = new FairRunAna(); - FairFileSource* inputSource = new FairFileSource(rawFile); - inputSource->AddFriend(traFile); - run->SetSource(inputSource); - run->SetOutputFile(outFile); - run->SetGenerateRunInfo(kTRUE); - run->SetGenerateRunInfo(kTRUE); - Bool_t hasFairMonitor = Has_Fair_Monitor(); - if (hasFairMonitor) FairMonitor::GetMonitor()->EnableMonitor(kTRUE); - // ------------------------------------------------------------------------ - - - // ----- Logger settings ---------------------------------------------- - FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); - FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data()); - // ------------------------------------------------------------------------ - - - // ----- Mc Data Manager ------------------------------------------------ - CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager", 1); - mcManager->AddFile(traFile); - run->AddTask(mcManager); - // ------------------------------------------------------------------------ - - - // ----- Reconstruction tasks ----------------------------------------- - std::cout << std::endl; - TString macroName = srcDir + "/macro/run/modules/reconstruct.C"; - std::cout << "Loading macro " << macroName << std::endl; - gROOT->LoadMacro(macroName); - Bool_t recoSuccess = gROOT->ProcessLine("reconstruct(kTRUE)"); - if (!recoSuccess) { - std::cerr << "-E-" << myName << ": error in executing " << macroName - << std::endl; - return; - } - std::cout << "-I-" << myName << ": " << macroName << " excuted successfully" - << std::endl; - // ------------------------------------------------------------------------ - - - // ----- Parameter database -------------------------------------------- - std::cout << std::endl << std::endl; - std::cout << "-I- " << myName << ": Set runtime DB" << std::endl; - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - FairParRootFileIo* parIo1 = new FairParRootFileIo(); - FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); - parIo1->open(parFile.Data(), "UPDATE"); - rtdb->setFirstInput(parIo1); - if (!parFileList->IsEmpty()) { - parIo2->open(parFileList, "in"); - rtdb->setSecondInput(parIo2); - } - // ------------------------------------------------------------------------ - - - // ----- Run initialisation ------------------------------------------- - std::cout << std::endl; - std::cout << "-I- " << myName << ": Initialise run" << std::endl; - run->Init(); - // ------------------------------------------------------------------------ - - rtdb->setOutput(parIo1); - rtdb->saveOutput(); - rtdb->print(); - - // ----- Start run ---------------------------------------------------- - std::cout << std::endl << std::endl; - std::cout << "-I- " << myName << ": Starting run" << std::endl; - run->Run(0, 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::cout << std::endl; - std::cout << " Test passed" << std::endl; - std::cout << " All ok " << std::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(); - std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; - std::cout << maxMemory; - std::cout << "</DartMeasurement>" << std::endl; - - Float_t cpuUsage = ctime / rtime; - std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; - std::cout << cpuUsage; - std::cout << "</DartMeasurement>" << std::endl; - - RemoveGeoManager(); -} diff --git a/macro/run/run_reco_new.C b/macro/run/run_reco_new.C deleted file mode 100644 index fe2d12b605307fabf18932761ea5b0144b5fa455..0000000000000000000000000000000000000000 --- a/macro/run/run_reco_new.C +++ /dev/null @@ -1,229 +0,0 @@ -// -------------------------------------------------------------------------- -// -// Macro for reconstruction of simulated events with standard settings -// -// HitProducers in MVD, RICH, TRD, TOF, ECAL -// Digitizer and HitFinder in STS -// FAST MC for ECAL -// STS track finding and fitting (L1 / KF) -// TRD track finding and fitting (L1 / KF) -// RICH ring finding (ideal) and fitting -// Global track finding (ideal), rich assignment -// Primary vertex finding (ideal) -// Matching of reconstructed and MC tracks in STS, RICH and TRD -// -// V. Friese 24/02/2006 -// Version 24/04/2007 (V. Friese) -// -// -------------------------------------------------------------------------- - - -void run_reco_new( - Int_t nEvents = 2, - const char* setupName = "sis100_electron", - // const char* setupName = "sis100_debug", - // const char* setupName = "sis100_hadron", - // const char* setupName = "sis100_muon_jpsi", - // const char* setupName = "sis100_muon_lmvm", - const char* inputFile = "") { - - // ======================================================================== - // Adjust this part according to your requirements - - // --- Logger settings ---------------------------------------------------- - TString logLevel = "INFO"; - TString logVerbosity = "LOW"; - // ------------------------------------------------------------------------ - - - // ----- Environment -------------------------------------------------- - TString myName = "run_reco_new"; // this macro's name for screen output - TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory - // ------------------------------------------------------------------------ - - - // ----- In- and output file names ------------------------------------ - TString inFile = ""; // give here or as argument; otherwise default is taken - TString outDir = "data/"; - TString outFile = - outDir + setupName + "_test.eds.root"; // Output file (reco) - TString parFile = outDir + setupName + "_params.root"; // Parameter file - // ------------------------------------------------------------------------ - - // ----- Load the geometry setup ------------------------------------- - std::cout << std::endl; - std::cout << "-I- " << myName << ": Loading setup " << setup << std::endl; - CbmSetup::Instance()->LoadSetup(setup); - CbmSetup* setup = CbmSetup::Instance(); - // ------------------------------------------------------------------------ - - - // ----- Parameter files as input to the runtime database ------------- - std::cout << std::endl; - std::cout << "-I- " << myName << ": Defining parameter files " << std::endl; - TList* parFileList = new TList(); - TString geoTag; - - // - TRD digitisation parameters - if (setup->GetGeoTag(kTrd, geoTag)) { - TObjString* trdFile = - new TObjString(srcDir + "/parameters/trd/trd_" + geoTag + ".digi.par"); - parFileList->Add(trdFile); - std::cout << "-I- " << myName << ": Using parameter file " - << trdFile->GetString() << std::endl; - } - - // - TOF digitisation parameters - if (setup->GetGeoTag(kTof, geoTag)) { - TObjString* tofBdfFile = - new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par"); - parFileList->Add(tofBdfFile); - std::cout << "-I- " << myName << ": Using parameter file " - << tofBdfFile->GetString() << std::endl; - } - // ------------------------------------------------------------------------ - - // In general, the following parts need not be touched - // ======================================================================== - - - // ----- Timer -------------------------------------------------------- - TStopwatch timer; - timer.Start(); - // ------------------------------------------------------------------------ - - - // ---- Debug option ------------------------------------------------- - gDebug = 0; - // ------------------------------------------------------------------------ - - - // ----- Input file --------------------------------------------------- - std::cout << std::endl; - TString defaultInputFile = "data/"; - defaultInputFile = defaultInputFile + setupName + "_test.mc.root"; - if (inFile.IsNull()) { // Not defined in the macro explicitly - if (strcmp(inputFile, "") == 0) { // not given as argument to the macro - inFile = defaultInputFile; - } else - inFile = inputFile; - } - std::cout << "-I- " << myName << ": Using input file " << inFile << std::endl; - // ------------------------------------------------------------------------ - - - // ----- FairRunAna --------------------------------------------------- - FairRunAna* run = new FairRunAna(); - FairFileSource* inputSource = new FairFileSource(inFile); - run->SetSource(inputSource); - run->SetOutputFile(outFile); - run->SetGenerateRunInfo(kTRUE); - - // Define output file for FairMonitor histograms - TString monitorFile {outFile}; - monitorFile.ReplaceAll("eds", "eds.monitor"); - FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile); - // ------------------------------------------------------------------------ - - - // ----- Logger settings ---------------------------------------------- - FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); - FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data()); - // ------------------------------------------------------------------------ - - // ----- Mc Data Manager ------------------------------------------------ - CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager", 1); - mcManager->AddFile(inFile); - run->AddTask(mcManager); - // ------------------------------------------------------------------------ - - // ----- Digitisers --------------------------------------------------- - std::cout << std::endl; - TString macroName = gSystem->Getenv("VMCWORKDIR"); - macroName += "/macro/run/modules/digitize.C"; - std::cout << "Loading macro " << macroName << std::endl; - gROOT->LoadMacro(macroName); - gROOT->ProcessLine("digitize()"); - // ------------------------------------------------------------------------ - - - // ----- Reconstruction tasks ----------------------------------------- - std::cout << std::endl; - macroName = srcDir + "/macro/run/modules/reconstruct.C"; - std::cout << "Loading macro " << macroName << std::endl; - gROOT->LoadMacro(macroName); - Bool_t recoSuccess = gROOT->ProcessLine("reconstruct()"); - if (!recoSuccess) { - std::cerr << "-E-" << myName << ": error in executing " << macroName - << std::endl; - return; - } - std::cout << "-I-" << myName << ": " << macroName << " excuted successfully" - << std::endl; - // ------------------------------------------------------------------------ - - - // ----- Parameter database -------------------------------------------- - std::cout << std::endl << std::endl; - std::cout << "-I- " << myName << ": Set runtime DB" << std::endl; - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - FairParRootFileIo* parIo1 = new FairParRootFileIo(); - FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); - parIo1->open(parFile.Data()); - parIo2->open(parFileList, "in"); - rtdb->setFirstInput(parIo1); - rtdb->setSecondInput(parIo2); - rtdb->setOutput(parIo1); - rtdb->saveOutput(); - rtdb->print(); - // ------------------------------------------------------------------------ - - - // ----- Run initialisation ------------------------------------------- - std::cout << std::endl; - std::cout << "-I- " << myName << ": Initialise run" << std::endl; - run->Init(); - // ------------------------------------------------------------------------ - - - // ----- Start run ---------------------------------------------------- - std::cout << std::endl << std::endl; - std::cout << "-I- " << myName << ": Starting run" << std::endl; - run->Run(0, nEvents); - // ------------------------------------------------------------------------ - - - // ----- Finish ------------------------------------------------------- - timer.Stop(); - Double_t rtime = timer.RealTime(); - Double_t ctime = timer.CpuTime(); - std::cout << std::endl << std::endl; - std::cout << "Macro finished succesfully." << 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::cout << std::endl; - std::cout << " Test passed" << std::endl; - std::cout << " All ok " << std::endl; - // ------------------------------------------------------------------------ - - // ----- Resource monitoring ------------------------------------------ - // 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(); - std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; - std::cout << maxMemory; - std::cout << "</DartMeasurement>" << std::endl; - - Float_t cpuUsage = ctime / rtime; - std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; - std::cout << cpuUsage; - std::cout << "</DartMeasurement>" << std::endl; - - FairMonitor* tempMon = FairMonitor::GetMonitor(); - tempMon->Print(); - - RemoveGeoManager(); -} diff --git a/macro/run/run_reco_tb_digi.C b/macro/run/run_reco_tb_digi.C deleted file mode 100644 index 19f5f26559bd957584716f22aa1090018c383a47..0000000000000000000000000000000000000000 --- a/macro/run/run_reco_tb_digi.C +++ /dev/null @@ -1,133 +0,0 @@ -// -------------------------------------------------------------------------- -// -// Macro for reconstruction of simulated time slices -// Using event building from STS digis and event-based reconstruction chain -// -// STS chain only: -// Event building from STS digis -// STS cluster finder (event-based) -// STS hit finder (event-based) -// STS track finder (L1) -// Simple QA -// -// Run the macro run_digi_tb.C before to generate the input file .raw.root. -// -// V. Friese 14/03/2017 -// -// -------------------------------------------------------------------------- - - -using std::cout; -using std::endl; - -void run_reco_tb_digi(TString dataSet = "test", Int_t nSlices = -1) { - - // ========================================================================= - // === Settings === - // ========================================================================= - - - // --- File names - TString inFile = dataSet + ".raw.root"; // Input file (MC events) - TString parFile = dataSet + ".par.root"; // Parameter file - TString outFile = dataSet + ".rec.root"; // Output file - - // Log level - TString logLevel = "INFO"; // switch to DEBUG or DEBUG1,... for more info - TString logVerbosity = "LOW"; // switch to MEDIUM or HIGH for more info - - // ---- Debug option ------------------------------------------------- - gDebug = 0; - // ======================================================================== - - - // ----- Timer -------------------------------------------------------- - TStopwatch timer; - timer.Start(); - // ------------------------------------------------------------------------ - - // ----- Reconstruction run ------------------------------------------- - FairRunAna* run = new FairRunAna(); - FairFileSource* inputSource = new FairFileSource(inFile); - run->SetSource(inputSource); - run->SetOutputFile(outFile); - run->SetGenerateRunInfo(kTRUE); - - TString monitorFile {outFile}; - monitorFile.ReplaceAll("rec", "rec.monitor"); - FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile); - // ------------------------------------------------------------------------ - - - // ---- Set the log level - FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); - FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data()); - - - // ========================================================================= - // === Reconstruction chain === - // ========================================================================= - - // --- Event builder (from digis) - // --- In order to perform event-by-event reconstruction, use the - // --- ideal event builder (CbmBuildEventsIdeal) instead. - run->AddTask(new CbmBuildEventsSimple()); - - // --- STS reconstruction (event mode) - CbmStsReco* stsReco = new CbmStsReco(); - stsReco->SetMode(kCbmEvent); - run->AddTask(stsReco); - - - // --- STS track finder (event-based) - run->AddTask(new CbmKF()); - run->AddTask(new CbmL1()); - CbmStsTrackFinder* stsTrackFinder = new CbmL1StsTrackFinder(); - FairTask* stsFindTracks = new CbmStsFindTracksEvents(stsTrackFinder); - run->AddTask(stsFindTracks); - - // --- Simple QA task to check basics - run->AddTask(new CbmStsRecoQa()); - - - // ----- Parameter database -------------------------------------------- - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - FairParRootFileIo* parIo1 = new FairParRootFileIo(); - parIo1->open(parFile.Data(), "UPDATE"); - rtdb->setFirstInput(parIo1); - // ------------------------------------------------------------------------ - - - // ----- Initialise and run ------------------------------------------- - run->Init(); - - rtdb->setOutput(parIo1); - rtdb->saveOutput(); - rtdb->print(); - - cout << "Starting run " << gGeoManager << endl; - if (nSlices < 0) - run->Run(); - else - run->Run(nSlices); - // ------------------------------------------------------------------------ - - - // ----- Finish ------------------------------------------------------- - timer.Stop(); - FairMonitor::GetMonitor()->Print(); - 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; - RemoveGeoManager(); -} diff --git a/macro/run/run_reco_tb_track.C b/macro/run/run_reco_tb_track.C deleted file mode 100644 index 141a20b1bb075c89018a2115952ec3881570b827..0000000000000000000000000000000000000000 --- a/macro/run/run_reco_tb_track.C +++ /dev/null @@ -1,260 +0,0 @@ -// -------------------------------------------------------------------------- -// -// Macro for reconstruction of simulated time slices -// Using time-based reconstruction in the STS -// -// STS cluster finder (time-based) -// STS hit finder (time-based) -// STS track finder (time-based) -// Event building from STS tracks -// Simple QA -// -// V. Friese 14/03/2017 -// -// -------------------------------------------------------------------------- - -// Includes needed for IDE -#if !defined(__CLING__) -#include "CbmDefs.h" -#include "CbmMuchFindHitsGem.h" -#include "CbmRecoSts.h" -#include "CbmRichHitProducer.h" -#include "CbmSetup.h" -#include "CbmTofSimpClusterizer.h" -#include "CbmTrdClusterFinder.h" -#include "CbmTrdHitProducer.h" -#include <FairLogger.h> -#include <FairMonitor.h> -#include <FairParAsciiFileIo.h> -#include <FairParRootFileIo.h> -#include <FairRunAna.h> -#include <FairRuntimeDb.h> -#include <TGeoManager.h> -#include <TStopwatch.h> -#include <TString.h> - -#endif - - -using std::cout; -using std::endl; - -void run_reco_tb_track(TString dataSet = "test", - Int_t nSlices = -1, - TString setup = "sis100_electron", - Bool_t useMC = kFALSE) { - - // ========================================================================= - // === Settings === - // ========================================================================= - - - // --- File names - TString outDir = "data/"; - TString inFile = dataSet + ".raw.root"; // Input file (digis) - TString parFile = dataSet + ".par.root"; // Parameter file - TString outFile = dataSet + ".tb.rec.root"; // Output file - TString traFile = dataSet + ".tra.root"; // Transport file - - // Log level - TString logLevel = "INFO"; // switch to DEBUG or DEBUG1,... for more info - TString logVerbosity = "LOW"; // switch to MEDIUM or HIGH for more info - - - // ---- Debug option ------------------------------------------------- - gDebug = 0; - - // ======================================================================== - - - // ----- Timer -------------------------------------------------------- - TStopwatch timer; - timer.Start(); - // ------------------------------------------------------------------------ - - - // ----- Reconstruction run ------------------------------------------- - FairRunAna* run = new FairRunAna(); - FairFileSource* inputSource = new FairFileSource(inFile); - run->SetSource(inputSource); - run->SetOutputFile(outFile); - run->SetGenerateRunInfo(kTRUE); - - TString monitorFile {outFile}; - monitorFile.ReplaceAll("rec", "rec.monitor"); - FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile); - // ------------------------------------------------------------------------ - - // ----- MC manager ------------------------------------------- - - if (useMC) { - CbmMCDataManager* mcManager = new CbmMCDataManager("MCDataManager", 0); - mcManager->AddFile(traFile); - run->AddTask(mcManager); - } - - // ---- Set the log level ----------------------------------------------- - FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); - FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data()); - // ------------------------------------------------------------------------ - - // ----- Environment -------------------------------------------------- - TString myName = "run_reco_tb_track"; // this macro's name for screen output - TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory - // ------------------------------------------------------------------------ - - // ----- Load the geometry setup ------------------------------------- - std::cout << std::endl; - std::cout << "-I- " << myName << ": Loading setup " << setup << std::endl; - CbmSetup::Instance()->LoadSetup(setup); - // You can modify the pre-defined setup by using - // CbmSetup::Instance()->RemoveModule(ESystemId) or - // CbmSetup::Instance()->SetModule(ESystemId, const char*, Bool_t) or - // CbmSetup::Instance()->SetActive(ESystemId, Bool_t) - // See the class documentation of CbmSetup. - // ------------------------------------------------------------------------ - - // ========================================================================= - // === Reconstruction chain === - // ========================================================================= - - - if (CbmSetup::Instance()->IsActive(ECbmModuleId::kSts)) { - // --- STS local reconstruction - run->AddTask(new CbmRecoSts()); - } - - if (CbmSetup::Instance()->IsActive(ECbmModuleId::kMuch)) { - - // --- Parameter file name - TString geoTag; - CbmSetup::Instance()->GetGeoTag(ECbmModuleId::kMuch, geoTag); - Int_t muchFlag = 0; - if (geoTag.Contains("mcbm")) muchFlag = 1; - - std::cout << geoTag(0, 4) << std::endl; - TString parFile = gSystem->Getenv("VMCWORKDIR"); - parFile = - parFile + "/parameters/much/much_" + geoTag(0, 4) + "_digi_sector.root"; - std::cout << "Using parameter file " << parFile << std::endl; - - // --- Hit finder for GEMs - FairTask* muchHitGem = new CbmMuchFindHitsGem(parFile.Data(), muchFlag); - run->AddTask(muchHitGem); - } - - if (CbmSetup::Instance()->IsActive(ECbmModuleId::kRich)) { - // ----- RICH reconstruction ------------------------------------------ - CbmRichHitProducer* richHitProd = new CbmRichHitProducer(); - run->AddTask(richHitProd); - std::cout << "-I- : Added task " << richHitProd->GetName() << std::endl; - } - - if (CbmSetup::Instance()->IsActive(ECbmModuleId::kTrd)) { - // ---- Local reco in TRD ----------------------------- - Double_t triggerThreshold = 0.5e-6; // SIS100 - CbmTrdClusterFinder* trdCluster = new CbmTrdClusterFinder(); - trdCluster->SetNeighbourEnable(true, false); - trdCluster->SetMinimumChargeTH(triggerThreshold); - trdCluster->SetRowMerger(true); - run->AddTask(trdCluster); - std::cout << "-I- : Added task " << trdCluster->GetName() << std::endl; - CbmTrdHitProducer* trdHit = new CbmTrdHitProducer(); - run->AddTask(trdHit); - std::cout << "-I- : Added task " << trdHit->GetName() << std::endl; - } - - if (CbmSetup::Instance()->IsActive(ECbmModuleId::kTof)) { - // ---- Local reconstruction in TOF ---------------------------------------- - CbmTofSimpClusterizer* tofCluster = - new CbmTofSimpClusterizer("TOF Simple Clusterizer", 0); - tofCluster->SetOutputBranchPersistent("TofHit", kTRUE); - tofCluster->SetOutputBranchPersistent("TofDigiMatch", kTRUE); - run->AddTask(tofCluster); - std::cout << "-I- : Added task " << tofCluster->GetName() << std::endl; - } - - // // ----- Local reconstruction in PSD reconstruction -------------------- - // CbmPsdHitProducer* psdHit = new CbmPsdHitProducer(); - // run->AddTask(ECbmModuleId::psdHit); - // std::cout << "-I- : Added task CbmPsdHitProducer" << std::endl; - - if (useMC) { - // --- STS MC matching ---------------------------------------------- - CbmMatchRecoToMC* matchTask = new CbmMatchRecoToMC(); - run->AddTask(matchTask); - } - - // --- STS track finder - { - TString geoTag; - CbmSetup::Instance()->GetGeoTag(ECbmModuleId::kSts, geoTag); - - TString parFile1 = gSystem->Getenv("VMCWORKDIR"); - parFile1 = - parFile1 + "/parameters/sts/sts_matbudget_" + geoTag(0, 4) + ".root"; - LOG(info) << "CA: Using material budget file " << parFile1; - bool err = gSystem->AccessPathName(parFile1); - if (!err) { - run->AddTask(new CbmKF()); - CbmL1* l1 = new CbmL1("CbmL1", 2, (useMC ? 3 : 0)); - l1->SetStsMaterialBudgetFileName(parFile1.Data()); - l1->SetDataMode(1); - l1->SetUseHitErrors(1); - run->AddTask(l1); - CbmStsTrackFinder* stsTrackFinder = new CbmL1StsTrackFinder(); - FairTask* stsFindTracks = new CbmStsFindTracks(0, stsTrackFinder); - run->AddTask(stsFindTracks); - } else { - LOG(warning) - << "CA: STS material budget file doesn't exist, L1 reco stops"; - } - } - // - // // --- Event builder (track-based) - // run->AddTask(new CbmBuildEventsFromTracksReal()); - // - // // --- Simple QA task to check basics - // run->AddTask(new CbmStsRecoQa()); - - // ----- Parameter database -------------------------------------------- - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - FairParRootFileIo* parIo1 = new FairParRootFileIo(); - FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); - parIo1->open(parFile.Data(), "UPDATE"); - rtdb->setFirstInput(parIo1); - // ------------------------------------------------------------------------ - - // ----- Initialise and run -------------------------------------------- - run->Init(); - - rtdb->setOutput(parIo1); - rtdb->saveOutput(); - rtdb->print(); - - cout << "Starting run " << gGeoManager << endl; - if (nSlices < 0) - run->Run(); - else - run->Run(nSlices); - // ------------------------------------------------------------------------ - - - // ----- Finish ------------------------------------------------------- - timer.Stop(); - FairMonitor::GetMonitor()->Print(); - 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; - RemoveGeoManager(); -} diff --git a/macro/run/run_transport_sts_long.C b/macro/run/run_transport_sts_long.C deleted file mode 100644 index 14cae4b15648f867b2eb34ca5b906a00d1d84cd9..0000000000000000000000000000000000000000 --- a/macro/run/run_transport_sts_long.C +++ /dev/null @@ -1,127 +0,0 @@ -/** @file run_transport_sts_long.C - ** @author Volker Friese <v.friese@gsi.de> - ** @since 2 March 2019 - **/ - -// Includes needed for IDE -#if !defined(__CLING__) -#include "CbmTransport.h" -#include "FairSystemInfo.h" -#include "TStopwatch.h" -#endif - - -/** @brief run_transport_sts_long.C - ** @author Volker Friese <v.friese@gsi.de> - ** @since 2 March 2019 - ** @param nEvents Number of events from input to transport - ** @param setupName Name of predefined geometry setup - ** @param output Name of output data set - ** @param inputFile Name of input file - ** - ** Macro for transport simulation with CBM (GEANT3), for regular tests. - ** - ** For the setup (geometry and field), predefined setups can be chosen - ** by the second argument. Available setups are in geometry/setup. - ** The input file is in UniGen format and can be specified by the last argument. - ** If none is specified, a default input file distributed with the source code - ** is selected. The user has to assure the consistency of input file and target, - ** the latter being defined in the macro body. - ** - ** Random event plane rotation of the input events is applied. - ** - ** The output file will be named [output].tra.root. - ** A parameter file [output].par.root will be created. - ** The geometry (TGeoManager) will be written into [output].geo.root. - ** - ** For the options for the transport simulation, see the documentation of - ** CbmTransport. - **/ -void run_transport_sts_long( - Int_t nEvents = 2, - const char* setupName = "sis100_hadron_sts_long", - // const char* setupName = "sis100_electron", - // const char* setupName = "sis100_hadron", - const char* output = "test", - const char* inputFile = "") { - - // --- Logger settings ---------------------------------------------------- - FairLogger::GetLogger()->SetLogScreenLevel("INFO"); - FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); - // ------------------------------------------------------------------------ - - - // ----- Environment -------------------------------------------------- - TString myName = "run_transport"; // this macro's name for screen output - TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory - // ------------------------------------------------------------------------ - - - // ----- In- and output file names ------------------------------------ - TString dataset(output); - TString outFile = dataset + ".tra.root"; - TString parFile = dataset + ".par.root"; - TString geoFile = dataset + ".geo.root"; - std::cout << std::endl; - TString defaultInputFile = srcDir + "/input/urqmd.auau.10gev.centr.root"; - TString inFile; - if (strcmp(inputFile, "") == 0) - inFile = defaultInputFile; - else - inFile = inputFile; - std::cout << "-I- " << myName << ": Using input file " << inFile << std::endl; - // ------------------------------------------------------------------------ - - - // ----- Timer -------------------------------------------------------- - TStopwatch timer; - timer.Start(); - // ------------------------------------------------------------------------ - - - // --- Transport run ---------------------------------------------------- - CbmTransport run; - run.AddInput(inFile); - run.SetOutFileName(outFile); - run.SetParFileName(parFile); - run.SetGeoFileName(geoFile); - run.LoadSetup(setupName); - run.SetTarget("Gold", 0.025, 2.5, 0., 0., -4.); - run.SetBeamPosition(0., 0., 0.1, 0.1); - run.SetRandomEventPlane(); - 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 << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; - std::cout << maxMemory; - std::cout << "</DartMeasurement>" << std::endl; - - Float_t cpuUsage = ctime / rtime; - std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; - std::cout << cpuUsage; - std::cout << "</DartMeasurement>" << std::endl; - - - std::cout << " Test passed" << std::endl; - std::cout << " All ok " << std::endl; - // ------------------------------------------------------------------------ - -} // End of macro