Skip to content
Snippets Groups Projects
Commit a6864083 authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau
Browse files

mCBM 2020: add explicitely the optional RICH mapping + remove 2019 macro

parent 08782aa9
No related branches found
No related tags found
1 merge request!156Add test for mCBM 2020 reconstruction macro
// --------------------------------------------------------------------------
//
// Macro for reconstruction of mcbm data (2019)
// Only STS local reconstruction (cluster + hit finder) for the time being
//
//
//
// --------------------------------------------------------------------------
void mcbm2019_reco(
Int_t nTimeslices = -1,
UInt_t uRunId = 0,
TString outDir = "data",
TString dataSet = "data/mcbm2019", // Data set for file names
Bool_t eventMode = kFALSE // Event-by-event mode
) {
// --- Logger settings ----------------------------------------------------
TString logLevel = "INFO";
TString logVerbosity = "LOW";
// ------------------------------------------------------------------------
// ----- Environment --------------------------------------------------
TString myName = "mcbm2019_reco"; // this macro's name for screen output
TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory
// TString srcDir1 = gSystem->Getenv("SLURM_INDEX"); // ------------------------------------------------------------------------
// ----- In- and output file names ------------------------------------
TString runId = TString::Format("%03u", uRunId);
TString inFile = outDir + "/unp_mcbm_" + runId + ".root";
if (eventMode) inFile = dataSet + ".event.raw.root";
TString parFile = outDir + "/unp_mcbm_params_" + runId + ".root";
TString outFile = dataSet + "_" + runId + ".rec.root";
TString geoFile = dataSet + ".geo.root"; // to be created by a simulation run
// ------------------------------------------------------------------------
// ----- Timer --------------------------------------------------------
TStopwatch timer;
timer.Start();
// ------------------------------------------------------------------------
// ---- Debug option -------------------------------------------------
gDebug = 0;
// ------------------------------------------------------------------------
// ----- FairRunAna ---------------------------------------------------
FairRunAna* run = new FairRunAna();
CbmStsFindHits* hit = new CbmStsFindHits();
FairFileSource* inputSource = new FairFileSource(inFile);
run->SetSource(inputSource);
run->SetOutputFile(outFile);
run->SetGenerateRunInfo(kTRUE);
run->SetGeomFile(geoFile);
TString monitorFile {outFile};
monitorFile.ReplaceAll("rec", "rec.monitor");
FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile);
// -----------------------------------------------------------------------
// ----- Logger settings ----------------------------------------------
FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data());
FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data());
// ------------------------------------------------------------------------
// ----- Reconstruction tasks -----------------------------------------
// ----- Local reconstruction in STS ----------------------------------
CbmStsReco* stsReco = new CbmStsReco();
run->AddTask(stsReco);
std::cout << "-I- : Added task " << stsReco->GetName() << 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);
// ------------------------------------------------------------------------
// ----- 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, nTimeslices);
// ------------------------------------------------------------------------
// ----- Finish -------------------------------------------------------
timer.Stop();
FairMonitor::GetMonitor()->Print();
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;
// ------------------------------------------------------------------------
// ----- 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;
// ------------------------------------------------------------------------
// ----- Function needed for CTest runtime dependency -----------------
// RemoveGeoManager();
// ------------------------------------------------------------------------
}
......@@ -118,6 +118,9 @@ void mcbm_reco(Int_t runId = 812, Int_t nTimeslices = 0) {
CbmRichMCbmHitProducer* hitProdRich = new CbmRichMCbmHitProducer();
hitProdRich->setToTLimits(23.7, 30.0);
hitProdRich->applyToTCut();
TString sRichMapFile = srcDir
+ "/macro/rich/mcbm/beamtime/mRICH_Mapping_vert_20190318_elView.geo";
hitProdRich->SetMappingFile( sRichMapFile.Data() );
run->AddTask(hitProdRich);
// ------------------------------------------------------------------------
......
......@@ -122,6 +122,9 @@ void mcbm_reco(Int_t runId = 812, Int_t nTimeslices = 0) {
CbmRichMCbmHitProducer* hitProdRich = new CbmRichMCbmHitProducer();
hitProdRich->setToTLimits(23.7, 30.0);
hitProdRich->applyToTCut();
TString sRichMapFile = srcDir
+ "/macro/rich/mcbm/beamtime/mRICH_Mapping_vert_20190318_elView.geo";
hitProdRich->SetMappingFile( sRichMapFile.Data() );
run->AddTask(hitProdRich);
// ------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment