diff --git a/macro/rich/geotest/run_ana_geo_opt.C b/macro/rich/geotest/run_ana_geo_opt.C deleted file mode 100644 index 5fc33e2fba4928b51259e8493ce672e69d7b3c71..0000000000000000000000000000000000000000 --- a/macro/rich/geotest/run_ana_geo_opt.C +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (C) 2014 UGiessen, JINR-LIT - SPDX-License-Identifier: GPL-3.0-only - Authors: Semen Lebedev [committer] */ - -void run_ana_geo_opt(Int_t nEvents = 200) -{ - TTree::SetMaxTreeSize(90000000000); - TString script = TString(gSystem->Getenv("SCRIPT")); - TString parDir = TString(gSystem->Getenv("VMCWORKDIR")) + TString("/parameters"); - TString stsMatBudgetFileName = parDir + "/sts/sts_matbudget_v12b.root"; // Material budget file for L1 STS tracking - gRandom->SetSeed(10); - - TString outDir = "/Users/slebedev/Development/cbm/data/simulations/rich/urqmdtest/"; - TString mcFile = outDir + "25gev.centr.mc.0000.root"; - TString parFile = outDir + "25gev.centr.param.0000.root"; - TString recFile = outDir + "25gev.centr.reco.0000.root"; - TString anaFile = outDir + "25gev.centr.ana.0000.root"; - std::string resultDir = "results_urqmd_25gev_centr/"; - TString parDir = TString(gSystem->Getenv("VMCWORKDIR")) + TString("/parameters"); - TList* parFileList = new TList(); - //TObjString stsDigiFile = parDir + "/sts/sts_v13d_std.digi.par"; // STS digi file - //parFileList->Add(&stsDigiFile); - - if (script == "yes") { - mcFile = TString(gSystem->Getenv("MC_FILE")); - recFile = TString(gSystem->Getenv("RECO_FILE")); - parFile = TString(gSystem->Getenv("PAR_FILE")); - anaFile = TString(gSystem->Getenv("ANA_FILE")); - } - - gDebug = 0; - TStopwatch timer; - timer.Start(); - - gROOT->LoadMacro("$VMCWORKDIR/macro/littrack/loadlibs.C"); - loadlibs(); - - FairRunAna* run = new FairRunAna(); - run->SetInputFile(mcFile); - run->SetOutputFile(anaFile); - run->AddFriend(recFile); - - CbmRichGeoOpt* richGeoOpt = new CbmRichGeoOpt(); - run->AddTask(richGeoOpt); - - // ----- Parameter database -------------------------------------------- - 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(); - - - run->Init(); - cout << "Starting run" << endl; - run->Run(0, nEvents); - - // ----- 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 " << recFile << 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; -} diff --git a/macro/rich/geotest/run_digi_geotest.C b/macro/rich/geotest/run_digi.C similarity index 74% rename from macro/rich/geotest/run_digi_geotest.C rename to macro/rich/geotest/run_digi.C index 4f7d86e941c106d4b2b64477b06166b09a573452..1ebc322414f6f43642a231961e2645d71dc0f969 100644 --- a/macro/rich/geotest/run_digi_geotest.C +++ b/macro/rich/geotest/run_digi.C @@ -2,14 +2,10 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Semen Lebedev [committer], Andrey Lebedev */ -void run_digi_geotest(const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/mc.00000.root", - const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/param.00000.root", - const string& digiFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/digi.00000.root", - int nEvents = 10000) +void run_digi(const string& traFile, const string& parFile, const string& digiFile, int nEvents) { FairLogger::GetLogger()->SetLogScreenLevel("INFO"); FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); - TTree::SetMaxTreeSize(90000000000); Double_t eventRate = 1.e7; @@ -23,7 +19,7 @@ void run_digi_geotest(const string& mcFile = "/Users/slebedev/Development/cbm/ timer.Start(); CbmDigitization run; - run.AddInput(mcFile.c_str(), eventRate); + run.AddInput(traFile.c_str(), eventRate); run.SetOutputFile(digiFile.c_str(), overwrite); run.SetParameterRootFile(parFile.c_str()); run.SetTimeSliceLength(timeSliceLength); @@ -32,6 +28,7 @@ void run_digi_geotest(const string& mcFile = "/Users/slebedev/Development/cbm/ CbmRichDigitizer* richDigitizer = new CbmRichDigitizer(); richDigitizer->SetMaxNofHitsPerPmtCut(65); + richDigitizer->SetNoiseDigiRate(0.); run.SetDigitizer(ECbmModuleId::kRich, richDigitizer, "RichPoint", true); run.Run(nEvents); diff --git a/macro/rich/geotest/run_digi_urqmdtest.C b/macro/rich/geotest/run_digi_urqmdtest.C deleted file mode 100644 index 07c850f449cd7cdc5e21781a2c65fe1b27ffc4a3..0000000000000000000000000000000000000000 --- a/macro/rich/geotest/run_digi_urqmdtest.C +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 2018-2020 UGiessen, JINR-LIT - SPDX-License-Identifier: GPL-3.0-only - Authors: Semen Lebedev [committer], Andrey Lebedev */ - -void run_digi_urqmdtest( - const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/mc.00000.root", - const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/param.00000.root", - const string& digiFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/digi.00000.root", - int nEvents = 1000) -{ - FairLogger::GetLogger()->SetLogScreenLevel("INFO"); - FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); - - TTree::SetMaxTreeSize(90000000000); - - Double_t eventRate = 1.e7; - Double_t timeSliceLength = 1.e4; - Bool_t eventMode = true; - Bool_t overwrite = true; - - remove(digiFile.c_str()); - - TStopwatch timer; - timer.Start(); - - CbmDigitization run; - run.AddInput(mcFile.c_str(), eventRate); - run.SetOutputFile(digiFile.c_str(), overwrite); - run.SetParameterRootFile(parFile.c_str()); - run.SetTimeSliceLength(timeSliceLength); - run.SetEventMode(eventMode); - run.SetMonitorFile(""); - - CbmRichDigitizer* richDigitizer = new CbmRichDigitizer(); - richDigitizer->SetMaxNofHitsPerPmtCut(65); - run.SetDigitizer(kRich, richDigitizer, "RichPoint", true); - - run.Run(nEvents); - - timer.Stop(); - std::cout << std::endl; - std::cout << "Macro finished successfully." << std::endl; - std::cout << "Digi file is " << digiFile << std::endl; - std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << " s" << std::endl; - std::cout << std::endl << "Test passed" << std::endl << "All ok" << std::endl; -} diff --git a/macro/rich/geotest/run_many.py b/macro/rich/geotest/run_many.py index 70f210f3b0d8949872acff18fd7b8836ec517b48..3253ed41dc5d92711bdd96f76a12efa262d0cfb1 100755 --- a/macro/rich/geotest/run_many.py +++ b/macro/rich/geotest/run_many.py @@ -1,7 +1,14 @@ import os -for taskId in range(7,8): - commandXterm = ('xterm -hold -e python3 run_one.py {}&').format(taskId) - print(commandXterm + " " + str(taskId)) - os.system(commandXterm) + +commandXterm1 = ('xterm -hold -e python3 run_one.py {} {}&').format(1, "4gev") +os.system(commandXterm1) +commandXterm2 = ('xterm -hold -e python3 run_one.py {} {}&').format(2, "8gev") +os.system(commandXterm2) + +commandXterm3 = ('xterm -hold -e python3 run_one.py {} {}&').format(3, "10gev") +os.system(commandXterm3) + +commandXterm4 = ('xterm -hold -e python3 run_one.py {} {}&').format(4, "12gev") +os.system(commandXterm4) \ No newline at end of file diff --git a/macro/rich/geotest/run_one.py b/macro/rich/geotest/run_one.py index dcd13845021477ac2245ab19c4868c43e1cfe3a4..5d93adab7daec29bf9ea465357b38a21aacb2930 100755 --- a/macro/rich/geotest/run_one.py +++ b/macro/rich/geotest/run_one.py @@ -1,47 +1,49 @@ #!/usr/bin/env python3 -import os -import sys - -taskId = sys.argv[1] -cbmrootConfigPath = "/Users/slebedev/Development/cbm/trunk/build/config.sh" -macroDir = "/Users/slebedev/Development/cbm/trunk/cbmroot/macro/rich/geotest/" -nofEvents = 20000 - -os.system(("source {}").format(cbmrootConfigPath)) - -urqmdFile = "/Users/slebedev/Development/cbm/data/urqmd/auau/10gev/centr/urqmd.auau.10gev.centr.00001.root" -dataDir= "/Users/slebedev/Development/cbm/data/sim/rich/geotest/" -mcFile = dataDir + "/mc."+ taskId + ".root" -parFile = dataDir + "/param."+ taskId + ".root" -digiFile = dataDir + "/digi."+ taskId + ".root" -recoFile = dataDir + "/reco."+ taskId + ".root" -qaFile = dataDir + "/qa."+ taskId + ".root" -geoSimFile = dataDir + "/geosim."+ taskId + ".root" -geoSetup = "rich_v19b_" + taskId -resultDir = "results_rich_v19b/geotest/results_" + geoSetup + "/" - - -#geotest -commandSim=('root -l -b -q {}/run_sim_geotest.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, geoSimFile, geoSetup, nofEvents) -commandDigi=('root -l -b -q {}/run_digi_geotest.C\(\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, nofEvents) -commandReco=('root -l -b -q {}/run_reco_geotest.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, recoFile, geoSetup, resultDir, nofEvents) -commandQa=('root -l -b -q {}/run_qa_geotest.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, recoFile, qaFile, geoSetup, resultDir, nofEvents) - -#urqmdtest -# commandSim=('root -l -b -q {}/run_sim_urqmdtest.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, urqmdFile, mcFile, parFile, geoSimFile, geoSetup, nofEvents) -# commandDigi=('root -l -b -q {}/run_digi_urqmdtest.C\(\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, nofEvents) -# commandReco=('root -l -b -q {}/run_reco_urqmdtest.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, recoFile, geoSetup, resultDir, nofEvents) -# commandQa=('root -l -b -q {}/run_qa_urqmdtest.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, recoFile, qaFile, geoSetup, resultDir, nofEvents) - -#recoqa -# commandSim=('root -l -b -q {}/run_sim.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{},{},\\"{}\\",\\"{}\\",{}\)').format(macroDir, urqmdFile, mcFile, parFile, geoSimFile, 5, 5, "", geoSetup, nofEvents) -# #commandSim=('root -l -b -q {}/run_sim.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{},{},\\"{}\\",\\"{}\\",{}\)').format(macroDir, "", mcFile, parFile, geoSimFile, 15, 15, "", geoSetup, nofEvents) -# commandDigi=('root -l -b -q {}/run_digi.C\(\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, nofEvents) -# commandReco=('root -l -b -q {}/run_reco.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, recoFile, geoSetup, resultDir, nofEvents) -# commandQa=('root -l -b -q {}/run_qa.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(macroDir, mcFile, parFile, digiFile, recoFile, qaFile, geoSetup, resultDir, nofEvents) - -os.system(commandSim) -os.system(commandDigi) -os.system(commandReco) -os.system(commandQa) +import os +import sys +import shutil +import argparse + +def main(): + runId = sys.argv[1] + energy = sys.argv[2] + + cbmrootConfigPath = "/Users/slebedev/Development/cbm/git/build/config.sh" + urqmdFile = ("/Users/slebedev/Development/cbm/data/urqmd/auau/{}/mbias/urqmd.auau.{}.mbias.00001.root").format(energy, energy) + plutoFile = "" + dataDir = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/" + resultDir = "results_" + runId + "_"+ energy +"/" + + #runId = "0" + geoSetup = "sis100_electron" + nEvents = 1000 + testType = "urqmdTest" # urqmdTest or geoTest + + traFile = dataDir + "/tra." + runId + ".root" + parFile = dataDir + "/param." + runId + ".root" + digiFile = dataDir + "/digi." + runId + ".root" + recoFile = dataDir + "/reco." + runId + ".root" + qaFile = dataDir + "/qa." + runId + ".root" + geoSimFile = dataDir + "/geosim." + runId + ".root" + + traCmd = ('root -l -b -q run_transport.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(urqmdFile, plutoFile, traFile, parFile, geoSimFile, geoSetup, nEvents) + digiCmd = ('root -l -b -q run_digi.C\(\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(traFile, parFile, digiFile, nEvents) + recoCmd = ('root -l -b -q run_reco.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(testType, traFile, parFile, digiFile, recoFile, geoSetup, nEvents) + qaCmd = ('root -l -b -q run_qa.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(testType, traFile, parFile, digiFile, recoFile, qaFile, geoSetup, resultDir, nEvents) + + os.system((". /{} -a; {}").format(cbmrootConfigPath, traCmd)) + os.system((". /{} -a; {}").format(cbmrootConfigPath, digiCmd)) + os.system((". /{} -a; {}").format(cbmrootConfigPath, recoCmd)) + os.system((". /{} -a; {}").format(cbmrootConfigPath, qaCmd)) + +# def make_args(): +# parser = argparse.ArgumentParser() +# parser.add_argument('--urqmdFile', help='urqmdFile') +# return parser.parse_args() + +if __name__ == '__main__': + # import sys + # args = make_args() + # main(make_args()) + main() diff --git a/macro/rich/geotest/run_qa.C b/macro/rich/geotest/run_qa.C new file mode 100644 index 0000000000000000000000000000000000000000..caeb15bc2b22dbf70f4a47184b5a6a146c23b13b --- /dev/null +++ b/macro/rich/geotest/run_qa.C @@ -0,0 +1,80 @@ +/* Copyright (C) 2019-2020 UGiessen, JINR-LIT + SPDX-License-Identifier: GPL-3.0-only + Authors: Semen Lebedev [committer] */ + +void run_qa(const string& testType, // "geoTest" or "urqmdTest" + const string& traFile, const string& parFile, const string& digiFile, const string& recoFile, + const string& qaFile, const string& geoSetup, const string& resultDir, int nEvents) +{ + if (testType != "urqmdTest" && testType != "geoTest") { + std::cout << "ERROR testType is not correct. It must be urqmdTest or geoTest" << std::endl; + return; + } + + FairLogger::GetLogger()->SetLogScreenLevel("INFO"); + FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); + TTree::SetMaxTreeSize(90000000000); + + TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory + + remove(qaFile.c_str()); + + CbmSetup* geo = CbmSetup::Instance(); + geo->LoadSetup(geoSetup.c_str()); + + TList* parFileList = new TList(); + + TStopwatch timer; + timer.Start(); + gDebug = 0; + + FairRunAna* run = new FairRunAna(); + FairFileSource* inputSource = new FairFileSource(digiFile.c_str()); + inputSource->AddFriend(recoFile.c_str()); + inputSource->AddFriend(traFile.c_str()); + run->SetSource(inputSource); + run->SetOutputFile(qaFile.c_str()); + run->SetGenerateRunInfo(false); + + CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager", 1); + mcManager->AddFile(traFile.c_str()); + run->AddTask(mcManager); + + if (testType == "geoTest") { + CbmRichGeoTest* geoTest = new CbmRichGeoTest(); + geoTest->SetDrawPmts(false); + //geoTest->SetDrawEventDisplay(false); + geoTest->SetOutputDir(resultDir); + run->AddTask(geoTest); + } + else if (testType == "urqmdTest") { + CbmRichUrqmdTest* urqmdTest = new CbmRichUrqmdTest(); + urqmdTest->SetOutputDir(resultDir); + run->AddTask(urqmdTest); + } + + FairRuntimeDb* rtdb = run->GetRuntimeDb(); + FairParRootFileIo* parIo1 = new FairParRootFileIo(); + FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); + parIo1->open(parFile.c_str(), "UPDATE"); + rtdb->setFirstInput(parIo1); + if (!parFileList->IsEmpty()) { + parIo2->open(parFileList, "in"); + rtdb->setSecondInput(parIo2); + } + + run->Init(); + rtdb->setOutput(parIo1); + rtdb->saveOutput(); + rtdb->print(); + run->Run(0, nEvents); + + + timer.Stop(); + std::cout << std::endl << std::endl; + std::cout << "Macro finished succesfully." << std::endl; + std::cout << "Output file is " << qaFile << std::endl; + std::cout << "Parameter file is " << parFile << std::endl; + std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << " s" << std::endl; + std::cout << "Test passed" << std::endl << "All ok" << std::endl; +} diff --git a/macro/rich/geotest/run_qa_geotest.C b/macro/rich/geotest/run_qa_geotest.C deleted file mode 100644 index ea65b7e8565900029165601a214661158c4d0bae..0000000000000000000000000000000000000000 --- a/macro/rich/geotest/run_qa_geotest.C +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (C) 2019-2020 UGiessen, JINR-LIT - SPDX-License-Identifier: GPL-3.0-only - Authors: Semen Lebedev [committer] */ - -void run_qa_geotest(const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/mc.00000.root", - const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/param.00000.root", - const string& digiFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/digi.00000.root", - const string& recoFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/reco.00000.root", - const string& qaFile = "/Users/slebedev/Development/cbm/data/sim/rich/" - "geotest/qa.g3new_media0.00000.root", - const string& geoSetup = "sis100_electron", - const string& resultDir = "results_geotest_geant3_new_media0/", int nEvents = 10000) -{ - FairLogger::GetLogger()->SetLogScreenLevel("INFO"); - FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); - TTree::SetMaxTreeSize(90000000000); - - TString myName = "run_qa_geotest"; - TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory - - remove(qaFile.c_str()); - - TString setupFile = srcDir + "/geometry/setup/setup_" + geoSetup + ".C"; - TString setupFunct = "setup_" + geoSetup + "()"; - gROOT->LoadMacro(setupFile); - gROOT->ProcessLine(setupFunct); - - std::cout << std::endl << "-I- " << myName << ": Defining parameter files " << std::endl; - TList* parFileList = new TList(); - - TStopwatch timer; - timer.Start(); - gDebug = 0; - - FairRunAna* run = new FairRunAna(); - FairFileSource* inputSource = new FairFileSource(digiFile.c_str()); - inputSource->AddFriend(recoFile.c_str()); - inputSource->AddFriend(mcFile.c_str()); - run->SetSource(inputSource); - run->SetOutputFile(qaFile.c_str()); - run->SetGenerateRunInfo(kTRUE); - - CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager", 1); - mcManager->AddFile(mcFile.c_str()); - run->AddTask(mcManager); - - CbmRichGeoTest* geoTest = new CbmRichGeoTest(); - geoTest->SetDrawPmts(false); - //geoTest->SetDrawEventDisplay(false); - geoTest->SetOutputDir(resultDir); - run->AddTask(geoTest); - - std::cout << std::endl << std::endl << "-I- " << myName << ": Set runtime DB" << std::endl; - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - FairParRootFileIo* parIo1 = new FairParRootFileIo(); - FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); - parIo1->open(parFile.c_str(), "UPDATE"); - rtdb->setFirstInput(parIo1); - if (!parFileList->IsEmpty()) { - parIo2->open(parFileList, "in"); - rtdb->setSecondInput(parIo2); - } - - - std::cout << std::endl << "-I- " << myName << ": Initialise run" << std::endl; - run->Init(); - - - rtdb->setOutput(parIo1); - rtdb->saveOutput(); - rtdb->print(); - - - std::cout << std::endl << std::endl; - std::cout << "-I- " << myName << ": Starting run" << std::endl; - run->Run(0, nEvents); - - - timer.Stop(); - std::cout << std::endl << std::endl; - std::cout << "Macro finished succesfully." << std::endl; - std::cout << "Output file is " << qaFile << std::endl; - std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << " s" << std::endl; - std::cout << "Test passed" << std::endl << "All ok" << std::endl; -} diff --git a/macro/rich/geotest/run_qa_urqmdtest.C b/macro/rich/geotest/run_qa_urqmdtest.C deleted file mode 100644 index ded8054ef91e5f89402318707cad4f1d6d3e85a9..0000000000000000000000000000000000000000 --- a/macro/rich/geotest/run_qa_urqmdtest.C +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright (C) 2019-2020 UGiessen, JINR-LIT - SPDX-License-Identifier: GPL-3.0-only - Authors: Semen Lebedev [committer] */ - -void run_qa_urqmdtest( - const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/mc.00000.root", - const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/param.00000.root", - const string& digiFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/digi.00000.root", - const string& recoFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/reco.00000.root", - const string& qaFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/qa.00000.root", - const string& geoSetup = "sis100_electron", const string& resultDir = "results_urqmdtest_geant4/", int nEvents = 1000) -{ - FairLogger::GetLogger()->SetLogScreenLevel("INFO"); - FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); - - TTree::SetMaxTreeSize(90000000000); - - TString myName = "run_reco_urqmdtest"; - TString srcDir = gSystem->Getenv("VMCWORKDIR"); - - remove(qaFile.c_str()); - - TString setupFile = srcDir + "/geometry/setup/setup_" + geoSetup + ".C"; - TString setupFunct = "setup_" + geoSetup + "()"; - gROOT->LoadMacro(setupFile); - gROOT->ProcessLine(setupFunct); - - CbmSetup* setup = CbmSetup::Instance(); - - std::cout << std::endl << "-I- " << myName << ": Defining parameter files " << std::endl; - TList* parFileList = new TList(); - - - TStopwatch timer; - timer.Start(); - gDebug = 0; - - - FairRunAna* run = new FairRunAna(); - FairFileSource* inputSource = new FairFileSource(digiFile.c_str()); - inputSource->AddFriend(mcFile.c_str()); - inputSource->AddFriend(recoFile.c_str()); - run->SetSource(inputSource); - run->SetOutputFile(qaFile.c_str()); - run->SetGenerateRunInfo(kTRUE); - - CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager", 1); - mcManager->AddFile(mcFile.c_str()); - run->AddTask(mcManager); - - - CbmRichUrqmdTest* urqmdTest = new CbmRichUrqmdTest(); - urqmdTest->SetOutputDir(resultDir); - run->AddTask(urqmdTest); - - - std::cout << std::endl << std::endl << "-I- " << myName << ": Set runtime DB" << std::endl; - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - FairParRootFileIo* parIo1 = new FairParRootFileIo(); - FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); - parIo1->open(parFile.c_str(), "UPDATE"); - rtdb->setFirstInput(parIo1); - if (!parFileList->IsEmpty()) { - parIo2->open(parFileList, "in"); - rtdb->setSecondInput(parIo2); - } - - - std::cout << std::endl << "-I- " << myName << ": Initialise run" << std::endl; - run->Init(); - - - rtdb->setOutput(parIo1); - rtdb->saveOutput(); - rtdb->print(); - - - std::cout << std::endl << std::endl; - std::cout << "-I- " << myName << ": Starting run" << std::endl; - run->Run(0, nEvents); - - - timer.Stop(); - std::cout << std::endl << std::endl; - std::cout << "Macro finished succesfully." << std::endl; - std::cout << "Reco file is " << recoFile << std::endl; - std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << " s" << std::endl; - std::cout << std::endl << "Test passed" << std::endl << "All ok" << std::endl; -} diff --git a/macro/rich/geotest/run_reco.C b/macro/rich/geotest/run_reco.C new file mode 100644 index 0000000000000000000000000000000000000000..8d31f7f32dadf9e7c22efc625cd5b855eca9566b --- /dev/null +++ b/macro/rich/geotest/run_reco.C @@ -0,0 +1,110 @@ +/* Copyright (C) 2013-2020 UGiessen, JINR-LIT + SPDX-License-Identifier: GPL-3.0-only + Authors: Semen Lebedev [committer], Andrey Lebedev */ + +void run_reco(const string& testType, // "geoTest" or "urqmdTest" + const string& traFile, const string& parFile, const string& digiFile, const string& recoFile, + const string& geoSetup, int nEvents) +{ + + if (testType != "urqmdTest" && testType != "geoTest") { + std::cout << "ERROR testType:" << testType << " is not correct. It must be urqmdTest or geoTest" << std::endl; + return; + } + + FairLogger::GetLogger()->SetLogScreenLevel("INFO"); + FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); + TTree::SetMaxTreeSize(90000000000); + + TString srcDir = gSystem->Getenv("VMCWORKDIR"); + + remove(recoFile.c_str()); + + CbmSetup* geo = CbmSetup::Instance(); + geo->LoadSetup(geoSetup.c_str()); + + TList* parFileList = new TList(); + + TStopwatch timer; + timer.Start(); + gDebug = 0; + + FairRunAna* run = new FairRunAna(); + FairFileSource* inputSource = new FairFileSource(digiFile.c_str()); + inputSource->AddFriend(traFile.c_str()); + run->SetSource(inputSource); + run->SetOutputFile(recoFile.c_str()); + run->SetGenerateRunInfo(false); + + CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager", 1); + mcManager->AddFile(traFile.c_str()); + run->AddTask(mcManager); + + if (testType == "urqmdTest") { + CbmRecoSts* stsReco = new CbmRecoSts(kCbmRecoTimeslice); + run->AddTask(stsReco); + + CbmKF* kalman = new CbmKF(); + run->AddTask(kalman); + CbmL1* l1 = new CbmL1("L1", 0); + + TString stsGeoTag; + if (geo->GetGeoTag(ECbmModuleId::kSts, stsGeoTag)) { + TString parFile = gSystem->Getenv("VMCWORKDIR"); + parFile += "/parameters/sts/sts_matbudget_" + stsGeoTag + ".root"; + l1->SetStsMaterialBudgetFileName(parFile.Data()); + } + run->AddTask(l1); + + CbmStsTrackFinder* stsTrackFinder = new CbmL1StsTrackFinder(); + FairTask* stsFindTracks = new CbmStsFindTracksEvents(stsTrackFinder, false); + run->AddTask(stsFindTracks); + + CbmLitFindGlobalTracks* finder = new CbmLitFindGlobalTracks(); + finder->SetTrackingType("branch"); + finder->SetMergerType("nearest_hit"); + run->AddTask(finder); + } + + CbmRichHitProducer* richHitProd = new CbmRichHitProducer(); + run->AddTask(richHitProd); + + CbmRichReconstruction* richReco = new CbmRichReconstruction(); + if (testType == "geoTest") { + richReco->SetRunExtrapolation(false); + richReco->SetRunProjection(false); + } + richReco->SetRunTrackAssign(false); + richReco->SetFinderName("ideal"); + run->AddTask(richReco); + + CbmMatchRecoToMC* match = new CbmMatchRecoToMC(); + run->AddTask(match); + + FairRuntimeDb* rtdb = run->GetRuntimeDb(); + FairParRootFileIo* parIo1 = new FairParRootFileIo(); + FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); + parIo1->open(parFile.c_str(), "UPDATE"); + rtdb->setFirstInput(parIo1); + if (!parFileList->IsEmpty()) { + parIo2->open(parFileList, "in"); + rtdb->setSecondInput(parIo2); + } + + run->Init(); + + rtdb->setOutput(parIo1); + rtdb->saveOutput(); + rtdb->print(); + + run->Run(0, nEvents); + + + timer.Stop(); + std::cout << std::endl << std::endl; + std::cout << "Macro finished succesfully." << std::endl; + std::cout << "Reco file is " << recoFile << std::endl; + std::cout << "Parameter file is " << parFile << std::endl; + std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << " s" << std::endl; + std::cout << std::endl << "Test passed" << std::endl << "All ok" << std::endl; +} diff --git a/macro/rich/geotest/run_reco_geo_opt.C b/macro/rich/geotest/run_reco_geo_opt.C deleted file mode 100644 index 44bbf8898470dc1357c98b9a7c47bfe0425f2a81..0000000000000000000000000000000000000000 --- a/macro/rich/geotest/run_reco_geo_opt.C +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright (C) 2014-2017 UGiessen, JINR-LIT - SPDX-License-Identifier: GPL-3.0-only - Authors: Semen Lebedev [committer] */ - -void run_reco_geo_opt(Int_t nEvents = 30000) -{ - TTree::SetMaxTreeSize(90000000000); - TString script = TString(gSystem->Getenv("SCRIPT")); - TString parDir = TString(gSystem->Getenv("VMCWORKDIR")) + TString("/parameters"); - TString stsMatBudgetFileName = parDir + "/sts/sts_matbudget_v12b.root"; // Material budget file for L1 STS tracking - gRandom->SetSeed(10); - - TString outDir = "/Users/slebedev/Development/cbm/data/simulations/rich/urqmdtest/"; - TString mcFile = outDir + "25gev.centr.mc.0000.root"; - TString parFile = outDir + "25gev.centr.param.0000.root"; - TString recFile = outDir + "25gev.centr.reco.0000.root"; - std::string resultDir = "results_urqmd_25gev_centr/"; - TString parDir = TString(gSystem->Getenv("VMCWORKDIR")) + TString("/parameters"); - TList* parFileList = new TList(); - //TObjString stsDigiFile = parDir + "/sts/sts_v13d_std.digi.par"; // STS digi file - //parFileList->Add(&stsDigiFile); - - if (script == "yes") { - mcFile = TString(gSystem->Getenv("MC_FILE")); - recFile = TString(gSystem->Getenv("RECO_FILE")); - parFile = TString(gSystem->Getenv("PAR_FILE")); - } - - gDebug = 0; - TStopwatch timer; - timer.Start(); - - gROOT->LoadMacro("$VMCWORKDIR/macro/littrack/loadlibs.C"); - loadlibs(); - - FairRunAna* run = new FairRunAna(); - run->SetInputFile(mcFile); - run->SetOutputFile(recFile); - - CbmRichHitProducer* richHitProd = new CbmRichHitProducer(); - richHitProd->SetDetectorType(4); - richHitProd->SetNofNoiseHits(220); - richHitProd->SetCollectionEfficiency(1.0); - richHitProd->SetSigmaMirror(0.06); - run->AddTask(richHitProd); - - CbmRichReconstruction* richReco = new CbmRichReconstruction(); - richReco->SetRunExtrapolation(false); - richReco->SetRunProjection(false); - richReco->SetRunTrackAssign(false); - richReco->SetFinderName("ideal"); - // richReco->SetExtrapolationName("ideal"); - run->AddTask(richReco); - - CbmRichMatchRings* matchRings = new CbmRichMatchRings(); - run->AddTask(matchRings); - - // ----- Parameter database -------------------------------------------- - 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(); - - - run->Init(); - cout << "Starting run" << endl; - run->Run(0, nEvents); - - // ----- 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 " << recFile << 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; -} diff --git a/macro/rich/geotest/run_reco_geotest.C b/macro/rich/geotest/run_reco_geotest.C deleted file mode 100644 index 3cd720de24311471c054dbed29a999762702af7e..0000000000000000000000000000000000000000 --- a/macro/rich/geotest/run_reco_geotest.C +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (C) 2009-2020 UGiessen, JINR-LIT - SPDX-License-Identifier: GPL-3.0-only - Authors: Semen Lebedev [committer], Andrey Lebedev */ - -void run_reco_geotest(const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/mc.00000.root", - const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/param.00000.root", - const string& digiFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/digi.00000.root", - const string& recoFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/reco.00000.root", - const string& geoSetup = "sis100_electron", - const string& resultDir = "rich_pipe_v1", // "results_geotest_test/", - int nEvents = 10000) -{ - FairLogger::GetLogger()->SetLogScreenLevel("INFO"); - FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); - TTree::SetMaxTreeSize(90000000000); - - TString myName = "run_reco_geotest"; - TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory - - remove(recoFile.c_str()); - - TString setupFile = srcDir + "/geometry/setup/setup_" + geoSetup + ".C"; - TString setupFunct = "setup_" + geoSetup + "()"; - gROOT->LoadMacro(setupFile); - gROOT->ProcessLine(setupFunct); - - std::cout << std::endl << "-I- " << myName << ": Defining parameter files " << std::endl; - TList* parFileList = new TList(); - - TStopwatch timer; - timer.Start(); - gDebug = 0; - - FairRunAna* run = new FairRunAna(); - FairFileSource* inputSource = new FairFileSource(digiFile.c_str()); - inputSource->AddFriend(mcFile.c_str()); - run->SetSource(inputSource); - run->SetOutputFile(recoFile.c_str()); - run->SetGenerateRunInfo(kTRUE); - - - CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager", 1); - mcManager->AddFile(mcFile.c_str()); - run->AddTask(mcManager); - - CbmRichHitProducer* richHitProd = new CbmRichHitProducer(); - run->AddTask(richHitProd); - - CbmRichReconstruction* richReco = new CbmRichReconstruction(); - richReco->SetRunExtrapolation(false); - richReco->SetRunProjection(false); - richReco->SetRunTrackAssign(false); - richReco->SetFinderName("ideal"); - run->AddTask(richReco); - - CbmMatchRecoToMC* matchRecoToMc = new CbmMatchRecoToMC(); - run->AddTask(matchRecoToMc); - - // CbmRichGeoTest* geoTest = new CbmRichGeoTest(); - // geoTest->SetOutputDir(resultDir); - // run->AddTask(geoTest); - - std::cout << std::endl << std::endl << "-I- " << myName << ": Set runtime DB" << std::endl; - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - FairParRootFileIo* parIo1 = new FairParRootFileIo(); - FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); - parIo1->open(parFile.c_str(), "UPDATE"); - rtdb->setFirstInput(parIo1); - if (!parFileList->IsEmpty()) { - parIo2->open(parFileList, "in"); - rtdb->setSecondInput(parIo2); - } - - - std::cout << std::endl << "-I- " << myName << ": Initialise run" << std::endl; - run->Init(); - - - rtdb->setOutput(parIo1); - rtdb->saveOutput(); - rtdb->print(); - - - std::cout << std::endl << std::endl; - std::cout << "-I- " << myName << ": Starting run" << std::endl; - run->Run(0, nEvents); - - - timer.Stop(); - std::cout << std::endl << std::endl; - std::cout << "Macro finished succesfully." << std::endl; - std::cout << "Output file is " << mcFile << std::endl; - std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << " s" << std::endl; - std::cout << "Test passed" << std::endl << "All ok" << std::endl; -} diff --git a/macro/rich/geotest/run_reco_urqmdtest.C b/macro/rich/geotest/run_reco_urqmdtest.C deleted file mode 100644 index b204458c044923e785e1814e7309eab4866e0762..0000000000000000000000000000000000000000 --- a/macro/rich/geotest/run_reco_urqmdtest.C +++ /dev/null @@ -1,128 +0,0 @@ -/* Copyright (C) 2013-2020 UGiessen, JINR-LIT - SPDX-License-Identifier: GPL-3.0-only - Authors: Semen Lebedev [committer], Andrey Lebedev */ - -void run_reco_urqmdtest( - const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/mc.00000.root", - const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/param.00000.root", - const string& digiFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/digi.00000.root", - const string& recoFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/reco.00000.root", - const string& geoSetup = "sis100_electron", const string& resultDir = "results_urqmdtest/", int nEvents = 1000) -{ - FairLogger::GetLogger()->SetLogScreenLevel("INFO"); - FairLogger::GetLogger()->SetLogVerbosityLevel("LOW"); - - TTree::SetMaxTreeSize(90000000000); - - TString myName = "run_reco_urqmdtest"; - TString srcDir = gSystem->Getenv("VMCWORKDIR"); - - remove(recoFile.c_str()); - - TString setupFile = srcDir + "/geometry/setup/setup_" + geoSetup + ".C"; - TString setupFunct = "setup_" + geoSetup + "()"; - gROOT->LoadMacro(setupFile); - gROOT->ProcessLine(setupFunct); - - CbmSetup* setup = CbmSetup::Instance(); - - std::cout << std::endl << "-I- " << myName << ": Defining parameter files " << std::endl; - TList* parFileList = new TList(); - - - TStopwatch timer; - timer.Start(); - gDebug = 0; - - - FairRunAna* run = new FairRunAna(); - FairFileSource* inputSource = new FairFileSource(digiFile.c_str()); - inputSource->AddFriend(mcFile.c_str()); - run->SetSource(inputSource); - run->SetOutputFile(recoFile.c_str()); - run->SetGenerateRunInfo(kTRUE); - - CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager", 1); - mcManager->AddFile(mcFile.c_str()); - run->AddTask(mcManager); - - FairTask* stsReco = new CbmStsReco(); - run->AddTask(stsReco); - - - CbmKF* kalman = new CbmKF(); - run->AddTask(kalman); - CbmL1* l1 = new CbmL1("L1", 0); - TString stsGeoTag; - if (setup->GetGeoTag(kSts, stsGeoTag)) { - TString parFile = gSystem->Getenv("VMCWORKDIR"); - parFile = parFile + "/parameters/sts/sts_matbudget_" + stsGeoTag + ".root"; - std::cout << "Using material budget file " << parFile << std::endl; - l1->SetStsMaterialBudgetFileName(parFile.Data()); - } - run->AddTask(l1); - - CbmStsTrackFinder* stsTrackFinder = new CbmL1StsTrackFinder(); - FairTask* stsFindTracks = new CbmStsFindTracksEvents(stsTrackFinder, false); - run->AddTask(stsFindTracks); - - - CbmLitFindGlobalTracks* finder = new CbmLitFindGlobalTracks(); - finder->SetTrackingType("branch"); - finder->SetMergerType("nearest_hit"); - run->AddTask(finder); - - - CbmRichHitProducer* richHitProd = new CbmRichHitProducer(); - run->AddTask(richHitProd); - - CbmRichReconstruction* richReco = new CbmRichReconstruction(); - richReco->SetRunExtrapolation(true); - richReco->SetRunProjection(true); - richReco->SetRunTrackAssign(false); - richReco->SetFinderName("ideal"); - // richReco->SetExtrapolationName("ideal"); - run->AddTask(richReco); - - CbmMatchRecoToMC* match = new CbmMatchRecoToMC(); - run->AddTask(match); - - // CbmRichUrqmdTest* urqmdTest = new CbmRichUrqmdTest(); - // urqmdTest->SetOutputDir(resultDir); - // run->AddTask(urqmdTest); - - - std::cout << std::endl << std::endl << "-I- " << myName << ": Set runtime DB" << std::endl; - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - FairParRootFileIo* parIo1 = new FairParRootFileIo(); - FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); - parIo1->open(parFile.c_str(), "UPDATE"); - rtdb->setFirstInput(parIo1); - if (!parFileList->IsEmpty()) { - parIo2->open(parFileList, "in"); - rtdb->setSecondInput(parIo2); - } - - - std::cout << std::endl << "-I- " << myName << ": Initialise run" << std::endl; - run->Init(); - - - rtdb->setOutput(parIo1); - rtdb->saveOutput(); - rtdb->print(); - - - std::cout << std::endl << std::endl; - std::cout << "-I- " << myName << ": Starting run" << std::endl; - run->Run(0, nEvents); - - - timer.Stop(); - std::cout << std::endl << std::endl; - std::cout << "Macro finished succesfully." << std::endl; - std::cout << "Reco file is " << recoFile << std::endl; - std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << " s" << std::endl; - std::cout << std::endl << "Test passed" << std::endl << "All ok" << std::endl; -} diff --git a/macro/rich/geotest/run_sim_geo_opt.C b/macro/rich/geotest/run_sim_geo_opt.C deleted file mode 100644 index d076f39ccb1448b66e301d6e07a87cfa2d98cd71..0000000000000000000000000000000000000000 --- a/macro/rich/geotest/run_sim_geo_opt.C +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright (C) 2014 UGiessen, JINR-LIT - SPDX-License-Identifier: GPL-3.0-only - Authors: Semen Lebedev [committer] */ - -void run_sim_geo_opt(Int_t nEvents = 200) -{ - TTree::SetMaxTreeSize(90000000000); - - TString script = TString(gSystem->Getenv("SCRIPT")); - TString parDir = TString(gSystem->Getenv("VMCWORKDIR")) + TString("/parameters"); - - //TString inFile = "/Users/slebedev/Development/cbm/data/urqmd/auau/25gev/centr/urqmd.auau.25gev.centr.00001.root"; - TString outDir = "/Users/slebedev/Development/cbm/data/simulations/rich/urqmdtest/"; - TString parFile = outDir + "25gev.centr.param.0000.root"; - TString outFile = outDir + "25gev.centr.mc.0000.root"; - - TString caveGeom = "cave.geo"; - TString pipeGeom = "pipe/pipe_standard.geo"; - TString magnetGeom = "magnet/magnet_v12a.geo"; - TString stsGeom = ""; //"sts/sts_v13d.geo.root"; - TString richGeom = "rich/rich_v08a.geo"; - TString fieldMap = "field_v12a"; - Double_t fieldZ = 50.; // field center z position - Double_t fieldScale = 1.0; // field scaling factor - - if (script == "yes") { - outFile = TString(gSystem->Getenv("MC_FILE")); - parFile = TString(gSystem->Getenv("PAR_FILE")); - caveGeom = TString(gSystem->Getenv("CAVE_GEOM")); - pipeGeom = TString(gSystem->Getenv("PIPE_GEOM")); - stsGeom = TString(gSystem->Getenv("STS_GEOM")); - richGeom = TString(gSystem->Getenv("RICH_GEOM")); - fieldMap = TString(gSystem->Getenv("FIELD_MAP")); - magnetGeom = TString(gSystem->Getenv("MAGNET_GEOM")); - fieldScale = TString(gSystem->Getenv("FIELD_MAP_SCALE")).Atof(); - } - - gDebug = 0; - TStopwatch timer; - timer.Start(); - - gROOT->LoadMacro("$VMCWORKDIR/macro/littrack/loadlibs.C"); - loadlibs(); - - FairRunSim* fRun = new FairRunSim(); - fRun->SetName("TGeant3"); // Transport engine - fRun->SetOutputFile(outFile); - FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); - - fRun->SetMaterials("media.geo"); // Materials - - if (caveGeom != "") { - FairModule* cave = new CbmCave("CAVE"); - cave->SetGeometryFileName(caveGeom); - fRun->AddModule(cave); - } - - if (pipeGeom != "") { - FairModule* pipe = new CbmPipe("PIPE"); - pipe->SetGeometryFileName(pipeGeom); - fRun->AddModule(pipe); - } - - CbmTarget* target = new CbmTarget("Gold", 0.025); // 250 mum - fRun->AddModule(target); - - if (magnetGeom != "") { - FairModule* magnet = new CbmMagnet("MAGNET"); - magnet->SetGeometryFileName(magnetGeom); - fRun->AddModule(magnet); - } - - if (stsGeom != "") { - FairDetector* sts = new CbmStsMC(kTRUE); - sts->SetGeometryFileName(stsGeom); - fRun->AddModule(sts); - } - - if (richGeom != "") { - FairDetector* rich = new CbmRich("RICH", kTRUE); - rich->SetGeometryFileName(richGeom); - fRun->AddModule(rich); - } - - CbmFieldMap* magField = new CbmFieldMapSym2(fieldMap); - magField->SetPosition(0., 0., fieldZ); - magField->SetScale(fieldScale); - fRun->SetField(magField); - - FairPrimaryGenerator* primGen = new FairPrimaryGenerator(); - - // e+/- - FairBoxGenerator* boxGen1 = new FairBoxGenerator(11, 1); - boxGen1->SetPtRange(0., 3.); - boxGen1->SetPhiRange(0., 360.); - boxGen1->SetThetaRange(2.5, 25.); - boxGen1->SetCosTheta(); - boxGen1->Init(); - primGen->AddGenerator(boxGen1); - - FairBoxGenerator* boxGen2 = new FairBoxGenerator(-11, 1); - boxGen2->SetPtRange(0., 3.); - boxGen2->SetPhiRange(0., 360.); - boxGen2->SetThetaRange(2.5, 25.); - boxGen2->SetCosTheta(); - boxGen2->Init(); - primGen->AddGenerator(boxGen2); - - - fRun->SetGenerator(primGen); - fRun->Init(); - - CbmFieldPar* fieldPar = (CbmFieldPar*) rtdb->getContainer("CbmFieldPar"); - fieldPar->SetParameters(magField); - fieldPar->setChanged(); - fieldPar->setInputVersion(fRun->GetRunId(), 1); - Bool_t kParameterMerged = kTRUE; - FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged); - parOut->open(parFile.Data()); - rtdb->setOutput(parOut); - rtdb->saveOutput(); - rtdb->print(); - - fRun->Run(nEvents); - - 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; - cout << " Test passed" << endl; - cout << " All ok " << endl; -} diff --git a/macro/rich/geotest/run_sim_urqmdtest.C b/macro/rich/geotest/run_sim_urqmdtest.C deleted file mode 100644 index 2b345305421b98ca7b43c8a491b1b5621fa5dcef..0000000000000000000000000000000000000000 --- a/macro/rich/geotest/run_sim_urqmdtest.C +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 2013-2020 UGiessen, JINR-LIT - SPDX-License-Identifier: GPL-3.0-only - Authors: Semen Lebedev [committer], Andrey Lebedev */ - -void run_sim_urqmdtest( - const string& urqmdFile = "/Users/slebedev/Development/cbm/data/urqmd/auau/" - "8gev/centr/urqmd.auau.8gev.centr.00001.root", - const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/mc.00000.root", - const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/param.00000.root", - const string& geoFile = "/Users/slebedev/Development/cbm/data/sim/rich/urqmdtest/geosim.00000.root", - const string& geoSetup = "sis100_electron", int nEvents = 1000) -{ - TTree::SetMaxTreeSize(90000000000); - - remove(parFile.c_str()); - remove(mcFile.c_str()); - remove(geoFile.c_str()); - - TStopwatch timer; - timer.Start(); - - CbmTransport run; - run.AddInput(urqmdFile.c_str()); - run.SetOutFileName(mcFile.c_str()); - run.SetParFileName(parFile.c_str()); - run.SetGeoFileName(geoFile.c_str()); - run.LoadSetup(geoSetup.c_str()); - run.SetTarget("Gold", 0.025, 2.5); - run.SetBeamPosition(0., 0., 0.1, 0.1); - run.SetEngine(kGeant4); - run.Run(nEvents); - - timer.Stop(); - std::cout << std::endl << std::endl; - std::cout << "Macro finished successfully." << std::endl; - std::cout << "Output file is " << mcFile << std::endl; - std::cout << "Parameter file is " << parFile << std::endl; - std::cout << "Geometry file is " << geoFile << std::endl; - std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << "s" << std::endl; - std::cout << std::endl << "Test passed" << std::endl << "All ok" << std::endl; -} diff --git a/macro/rich/geotest/run_sim_geotest.C b/macro/rich/geotest/run_transport.C similarity index 69% rename from macro/rich/geotest/run_sim_geotest.C rename to macro/rich/geotest/run_transport.C index 82ae2efdf46680c0024278e016c88cdf329e45c7..7564e15521ea0f39e6ed71c4102dee213bc9ec92 100644 --- a/macro/rich/geotest/run_sim_geotest.C +++ b/macro/rich/geotest/run_transport.C @@ -2,17 +2,16 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Semen Lebedev [committer], Andrey Lebedev */ -void run_sim_geotest(const string& plutoFile = "", // if "", BoxGenerator is used - const string& mcFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/mc.00000.root", - const string& parFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/param.00000.root", - const string& geoFile = "/Users/slebedev/Development/cbm/data/sim/rich/geotest/geosim.00000.root", - const string& geoSetup = "sis100_electron", //"mirror12_42", - int nEvents = 10) +// +void run_transport(const string& urqmdFile, // only for "urqmdTest" + const string& plutoFile, // only for "geoTest", if "", BoxGenerator is used + const string& traFile, const string& parFile, const string& geoFile, const string& geoSetup, + int nEvents) { TTree::SetMaxTreeSize(90000000000); remove(parFile.c_str()); - remove(mcFile.c_str()); + remove(traFile.c_str()); remove(geoFile.c_str()); TStopwatch timer; @@ -20,6 +19,8 @@ void run_sim_geotest(const string& plutoFile = "", // if "", BoxGenerator is us CbmTransport run; + if (urqmdFile.length() > 0) { run.AddInput(urqmdFile.c_str()); } + if (plutoFile.length() > 0) { run.AddInput(plutoFile.c_str(), kPluto); } else { FairBoxGenerator* boxGen1 = new FairBoxGenerator(11, 1); @@ -39,7 +40,8 @@ void run_sim_geotest(const string& plutoFile = "", // if "", BoxGenerator is us run.AddInput(boxGen2); } - run.SetOutFileName(mcFile.c_str()); + + run.SetOutFileName(traFile.c_str()); run.SetParFileName(parFile.c_str()); run.SetGeoFileName(geoFile.c_str()); run.LoadSetup(geoSetup.c_str()); @@ -52,7 +54,7 @@ void run_sim_geotest(const string& plutoFile = "", // if "", BoxGenerator is us timer.Stop(); std::cout << std::endl << std::endl; std::cout << "Macro finished successfully." << std::endl; - std::cout << "Output file is " << mcFile << std::endl; + std::cout << "Transport file is " << traFile << std::endl; std::cout << "Parameter file is " << parFile << std::endl; std::cout << "Geometry file is " << geoFile << std::endl; std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << "s" << std::endl; diff --git a/reco/detectors/rich/qa/CbmRichUrqmdTest.cxx b/reco/detectors/rich/qa/CbmRichUrqmdTest.cxx index 772cd429e8e1b358e09a90ace10b80a5d0d44d26..3e0995d89138fb1f61fc7277a3137ba07372ee9d 100644 --- a/reco/detectors/rich/qa/CbmRichUrqmdTest.cxx +++ b/reco/detectors/rich/qa/CbmRichUrqmdTest.cxx @@ -180,7 +180,7 @@ void CbmRichUrqmdTest::InitHistograms() fHM->Create1<TH1D>("fh_mu_mom", "fh_mu_mom;p [GeV/c];Number per event", 100, 0., 20); fHM->Create1<TH1D>("fh_nof_points_per_event", "fh_nof_points_per_event;Particle;# MC points per event", 7, .5, 7.5); - fHM->Create1<TH1D>("fh_nof_hits_per_event", "fh_nof_hits_per_event;# hits per event;Yield", 100, 0, 4000); + fHM->Create1<TH1D>("fh_nof_hits_per_event", "fh_nof_hits_per_event;# hits per event;Yield", 100, 0, 2000); fHM->Create1<TH1D>("fh_nof_hits_per_pmt", "fh_nof_hits_per_pmt;# hits per PMT;% of total", 65, -0.5, 64.5); vector<Double_t> xPmtBins = CbmRichDraw::GetPmtHistXbins(); @@ -677,7 +677,7 @@ void CbmRichUrqmdTest::DrawHist() ss6 << "#mu^{#pm} (" << fHM->H1("fh_mu_mom")->GetEntries() / fEventNum << ")"; DrawH1({fHM->H1("fh_gamma_target_mom"), fHM->H1("fh_gamma_nontarget_mom"), fHM->H1("fh_secel_mom"), fHM->H1("fh_pi_mom"), fHM->H1("fh_kaon_mom"), fHM->H1("fh_mu_mom")}, - list_of(ss1.str())(ss2.str())(ss3.str())(ss4.str())(ss5.str())(ss6.str()), kLinear, kLog, true, 0.5, 0.7, + list_of(ss1.str())(ss2.str())(ss3.str()) (ss4.str()) (ss5.str()) (ss6.str()), kLinear, kLog, true, 0.5, 0.7, 0.99, 0.99, "hist"); } @@ -748,7 +748,8 @@ void CbmRichUrqmdTest::DrawHist() { fHM->CreateCanvas("rich_urqmd_nof_hits_per_event", "rich_urqmd_nof_hits_per_event", 800, 800); fHM->H1("fh_nof_hits_per_event")->Scale(1. / fHM->H1("fh_nof_hits_per_event")->Integral()); - DrawH1andFitGauss(fHM->H1("fh_nof_hits_per_event")); + DrawH1(fHM->H1("fh_nof_hits_per_event"), kLinear, kLinear, "hist"); + fHM->H1("fh_nof_hits_per_event")->SetStats(true); cout << "Mean number of hits per event = " << fHM->H1("fh_nof_hits_per_event")->GetMean() << endl; }