From 083fd56106acec6b19c14e9f9434d2f4e185147c Mon Sep 17 00:00:00 2001 From: P-A Loizeau <p.-a.loizeau@gsi.de> Date: Wed, 27 Jan 2021 16:35:31 +0100 Subject: [PATCH] [mCBM 2020] make kronos macros wrappers around standard + related fixes - Replace un-needed calls with default description - Synchronize time window for TOF in build_event_win.C - Synchronize parameter folder path init in mcbm_build_and_reco.C - Fix uncommented debug block in mcbm_event_reco.C --- macro/beamtime/mcbm2020/build_event_win.C | 34 +- .../mcbm2020/build_event_win_kronos.C | 196 +----- macro/beamtime/mcbm2020/mcbm_build_and_reco.C | 39 +- .../mcbm2020/mcbm_build_and_reco_kronos.C | 576 +--------------- macro/beamtime/mcbm2020/mcbm_event_reco.C | 29 +- .../mcbm2020/mcbm_event_reco_kronos.C | 514 ++------------ macro/beamtime/mcbm2020/mcbm_reco.C | 27 +- macro/beamtime/mcbm2020/mcbm_reco_kronos.C | 324 ++------- macro/beamtime/mcbm2020/unpack_tsa_mcbm.C | 31 +- .../mcbm2020/unpack_tsa_mcbm_kronos.C | 642 +----------------- 10 files changed, 234 insertions(+), 2178 deletions(-) diff --git a/macro/beamtime/mcbm2020/build_event_win.C b/macro/beamtime/mcbm2020/build_event_win.C index dee22754..bf6a5db0 100644 --- a/macro/beamtime/mcbm2020/build_event_win.C +++ b/macro/beamtime/mcbm2020/build_event_win.C @@ -1,10 +1,24 @@ -void build_event_win(UInt_t uRunId = 0, - Int_t nEvents = 0, - TString outDir = "data/") { - TString fileName = Form("data/unp_mcbm_%03u.root", uRunId); +Bool_t build_event_win(UInt_t uRunId = 0, + Int_t nTimeslices = 0, + TString sOutDir = "./data", + TString sInpDir = "./data") { + + // ----- In- and output file names ------------------------------------ + TString fileName = Form("%s/unp_mcbm_%03u.root", sInpDir.Data(), uRunId); + TString runId = TString::Format("%03u", uRunId); + TString outFile = sOutDir + "/mcbm_events_win_" + runId + ".root"; + // ------------------------------------------------------------------------ if (uRunId < 692) return kFALSE; + /* + std::cout << sOutDir << std::endl << sInpDir << std::endl; + std::cout << fileName << std::endl + << outFile << std::endl; + std::cout << uRunId << " " << nTimeslices << std::endl; + + return kTRUE; + */ // ======================================================================== // Adjust this part according to your requirements @@ -35,8 +49,6 @@ void build_event_win(UInt_t uRunId = 0, FairFileSource* inputSource = new FairFileSource(fileName); fRun->SetSource(inputSource); - TString runId = TString::Format("%03u", uRunId); - TString outFile = outDir + "/mcbm_events_win_" + runId + ".root"; FairRootFileSink* outputSink = new FairRootFileSink(outFile); fRun->SetSink(outputSink); @@ -72,7 +84,7 @@ void build_event_win(UInt_t uRunId = 0, eventBuilder->SetTriggerWindow(ECbmModuleId::kSts, -50, 100); eventBuilder->SetTriggerWindow(ECbmModuleId::kMuch, -150, 50); eventBuilder->SetTriggerWindow(ECbmModuleId::kTrd, -50, 250); - eventBuilder->SetTriggerWindow(ECbmModuleId::kTof, -150, 10); + eventBuilder->SetTriggerWindow(ECbmModuleId::kTof, -50, 50); eventBuilder->SetTriggerWindow(ECbmModuleId::kRich, -50, 50); eventBuilder->SetTriggerWindow(ECbmModuleId::kPsd, -50, 50); /// To get T0 Digis (seed + close digis) in the event @@ -116,7 +128,7 @@ void build_event_win(UInt_t uRunId = 0, if (0 < uRunId) eventBuilder->SetOutFilename( - Form("%sHistosEvtWin_%03u.root", outDir.Data(), uRunId)); + Form("%s/HistosEvtWin_%03u.root", sOutDir.Data(), uRunId)); fRun->AddTask(eventBuilder); @@ -128,10 +140,10 @@ void build_event_win(UInt_t uRunId = 0, // rtdb->print(); cout << "Starting run" << endl; - if (0 == nEvents) { + if (0 == nTimeslices) { fRun->Run(0, 0); // run until end of input file } else { - fRun->Run(0, nEvents); // process N Events + fRun->Run(0, nTimeslices); // process N Timeslices } // ------------------------------------------------------------------------ @@ -164,4 +176,6 @@ void build_event_win(UInt_t uRunId = 0, cout << " Test passed" << endl; cout << " All ok " << endl; + + return kTRUE; } diff --git a/macro/beamtime/mcbm2020/build_event_win_kronos.C b/macro/beamtime/mcbm2020/build_event_win_kronos.C index 341a117f..6667e819 100644 --- a/macro/beamtime/mcbm2020/build_event_win_kronos.C +++ b/macro/beamtime/mcbm2020/build_event_win_kronos.C @@ -1,8 +1,12 @@ -void build_event_win_kronos(UInt_t uRunIdx = 0, - Int_t nEvents = 0, - TString outDir = "data/") { +#include "build_event_win.C" + +Bool_t build_event_win_kronos(UInt_t uRunIdx = 28, + Int_t nTimeslices = 0, + TString sOutDir = "./data", + TString sInpDir = "/lustre/cbm/users/ploizeau/mcbm2020/" + "unp_evt_data_7f229b3f_20201103") { UInt_t uRunId = 0; - TString fileName = "data/unp_mcbm_0.root"; + if (99999 != uRunIdx) { std::vector<UInt_t> vuListRunId = { 692, 698, 702, 704, 705, 706, 707, // 7 => 0 - 6 @@ -13,183 +17,23 @@ void build_event_win_kronos(UInt_t uRunIdx = 0, 841, 846, 849, // 3 => 30 - 32 850, 851, 852, 854, 855, 856, 857, 858, 859, // 9 => 33 - 41 860, 861, 862, 863, 864, 865, 866 // 7 => 42 - 48 - /* - /// With runs < 1 min due to missmatch! - 811, 812, 816, 817, 818, 819, // 6 => 14 - 19 - 820, 821, 822, 824, 826, 827, 828, 829, // 8 => 20 - 27 - 830, 831, 836, 839, // 4 => 28 - 31 - 840, 841, 842, 844, 845, 846, 848, 849, // 8 => 32 - 39 - 850, 851, 852, 854, 855, 856, 857, 858, 859, // 9 => 40 - 48 - 860, 861, 862, 863, 864, 865, 866 // 7 => 49 - 55 -*/ + + /* + /// With runs < 1 min due to missmatch! + 811, 812, 816, 817, 818, 819, // 6 => 14 - 19 + 820, 821, 822, 824, 826, 827, 828, 829, // 8 => 20 - 27 + 830, 831, 836, 839, // 4 => 28 - 31 + 840, 841, 842, 844, 845, 846, 848, 849, // 8 => 32 - 39 + 850, 851, 852, 854, 855, 856, 857, 858, 859, // 9 => 40 - 48 + 860, 861, 862, 863, 864, 865, 866 // 7 => 49 - 55 + */ }; if (vuListRunId.size() <= uRunIdx) return kFALSE; + uRunId = vuListRunId[uRunIdx]; - //fileName = Form("data/unp_mcbm_%03u.root", uRunId); - fileName = Form("/lustre/cbm/users/ploizeau/mcbm2020/" - "unp_evt_data_7f229b3f_20201103/unp_mcbm_%i.root", - uRunId); } // if( 99999 != uRunIdx ) if (uRunId < 692 && 0 != uRunId) return kFALSE; - - // ======================================================================== - // Adjust this part according to your requirements - - // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) - // Int_t iVerbose = 1; - - // --- Set log output levels - FairLogger::GetLogger(); - gLogger->SetLogScreenLevel("INFO"); - // gLogger->SetLogScreenLevel("DEBUG"); - gLogger->SetLogVerbosityLevel("MEDIUM"); - - // MC file - - TString srcDir = gSystem->Getenv("VMCWORKDIR"); - - // ----- Timer -------------------------------------------------------- - TStopwatch timer; - timer.Start(); - // ------------------------------------------------------------------------ - - // ----- Analysis run -------------------------------------------------- - // FairRunOnline *fRun= new FairRunOnline(); - FairRunAna* fRun = new FairRunAna(); - fRun->SetEventHeaderPersistence(kFALSE); - - FairFileSource* inputSource = new FairFileSource(fileName); - fRun->SetSource(inputSource); - - TString runId = TString::Format("%03u", uRunId); - TString outFile = outDir + "/mcbm_events_win_" + runId + ".root"; - FairRootFileSink* outputSink = new FairRootFileSink(outFile); - fRun->SetSink(outputSink); - - // Define output file for FairMonitor histograms - // TString monitorFile{outFile}; - // monitorFile.ReplaceAll("qa","qa.monitor"); - FairMonitor::GetMonitor()->EnableMonitor(kTRUE); - // FairMonitor::GetMonitor()->EnableMonitor(kFALSE); - // ------------------------------------------------------------------------ - - // CbmMcbm2019TimeWinEventBuilder* eventBuilder = new CbmMcbm2019TimeWinEventBuilder(); - CbmMcbm2019TimeWinEventBuilderTask* eventBuilder = - new CbmMcbm2019TimeWinEventBuilderTask(); - - eventBuilder->SetFillHistos(kTRUE); - - eventBuilder->SetEventOverlapMode(EOverlapMode::NoOverlap); - // eventBuilder->SetEventOverlapMode(EOverlapMode::MergeOverlap); - // eventBuilder->SetEventOverlapMode(EOverlapMode::AllowOverlap); - - /* - * Available Pre-defined detectors: - * kEventBuilderDetSts - * kEventBuilderDetMuch - * kEventBuilderDetTrd - * kEventBuilderDetTof - * kEventBuilderDetRich - * kEventBuilderDetPsd - * kEventBuilderDetT0 - */ - - /// Change the selection window limits for T0 as ref - eventBuilder->SetTriggerWindow(ECbmModuleId::kSts, -50, 100); - eventBuilder->SetTriggerWindow(ECbmModuleId::kMuch, -150, 50); - eventBuilder->SetTriggerWindow(ECbmModuleId::kTrd, -50, 250); - eventBuilder->SetTriggerWindow(ECbmModuleId::kTof, -150, 10); - eventBuilder->SetTriggerWindow(ECbmModuleId::kRich, -50, 50); - eventBuilder->SetTriggerWindow(ECbmModuleId::kPsd, -50, 50); - /// To get T0 Digis (seed + close digis) in the event - eventBuilder->SetTriggerWindow(ECbmModuleId::kT0, -1, 10); - - /* - /// Use TOF as reference - eventBuilder->SetReferenceDetector( kEventBuilderDetTof ); - eventBuilder->AddDetector(kEventBuilderDetT0); - - /// Change the selection window limits for TOF as ref - /// => Should always be after changes of detector lists! - eventBuilder->SetTriggerWindow(ECbmModuleId::kT0, -150, 0); - eventBuilder->SetTriggerWindow(ECbmModuleId::kSts, -50, 100); - eventBuilder->SetTriggerWindow(ECbmModuleId::kMuch, -50, 200); - eventBuilder->SetTriggerWindow(ECbmModuleId::kTrd, -50, 300); - eventBuilder->SetTriggerWindow(ECbmModuleId::kTof, 0, 60); - eventBuilder->SetTriggerWindow(ECbmModuleId::kRich, -100, 150); - eventBuilder->SetTriggerWindow(ECbmModuleId::kPsd, -200, 50); -*/ - - /// Change the trigger requirements - /// => Should always be after changes of detector lists! - /// --- Minimum - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kT0, 1); - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kSts, 0); - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kMuch, 0); - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kTrd, 0); - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kTof, 10); - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kRich, 0); - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kPsd, 0); - /// --- Maximum (-1 to disable cut) - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kT0, -1); - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kSts, -1); - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kMuch, -1); - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kTrd, -1); - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kTof, -1); - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kRich, -1); - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kPsd, -1); - - - if (0 < uRunId) - eventBuilder->SetOutFilename( - Form("%sHistosEvtWin_%03u.root", outDir.Data(), uRunId)); - - fRun->AddTask(eventBuilder); - - // ----- Intialise and run -------------------------------------------- - fRun->Init(); - - // rtdb->setOutput(parIo1); - // rtdb->saveOutput(); - // rtdb->print(); - - cout << "Starting run" << endl; - if (0 == nEvents) { - fRun->Run(0, 0); // run until end of input file - } else { - fRun->Run(0, nEvents); // process N Events - } - // ------------------------------------------------------------------------ - - - // ----- Finish ------------------------------------------------------- - timer.Stop(); - Double_t rtime = timer.RealTime(); - Double_t ctime = timer.CpuTime(); - cout << endl << endl; - cout << "Macro finished succesfully." << endl; - cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl; - cout << endl; - // ------------------------------------------------------------------------ - - // Extract the maximal used memory an add is as Dart measurement - // This line is filtered by CTest and the value send to CDash - FairSystemInfo sysInfo; - Float_t maxMemory = sysInfo.GetMaxMemory(); - cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; - cout << maxMemory; - cout << "</DartMeasurement>" << endl; - - Float_t cpuUsage = ctime / rtime; - cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; - cout << cpuUsage; - cout << "</DartMeasurement>" << endl; - - FairMonitor* tempMon = FairMonitor::GetMonitor(); - tempMon->Print(); - - cout << " Test passed" << endl; - cout << " All ok " << endl; + return build_event_win(uRunId, nTimeslices, sOutDir, sInpDir); } diff --git a/macro/beamtime/mcbm2020/mcbm_build_and_reco.C b/macro/beamtime/mcbm2020/mcbm_build_and_reco.C index 1102e135..11f438a8 100644 --- a/macro/beamtime/mcbm2020/mcbm_build_and_reco.C +++ b/macro/beamtime/mcbm2020/mcbm_build_and_reco.C @@ -7,9 +7,10 @@ // -------------------------------------------------------------------------- -void mcbm_build_and_reco(UInt_t uRunId = 831, - Int_t nTimeslices = 300, - TString outDir = "data/") { +Bool_t mcbm_build_and_reco(UInt_t uRunId = 831, + Int_t nTimeslices = 0, + TString sInpDir = "./data", + TString sOutDir = "./data") { // ======================================================================== @@ -25,16 +26,29 @@ void mcbm_build_and_reco(UInt_t uRunId = 831, TString myName = "mcbm_reco"; // this macro's name for screen output TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory TString paramDir = srcDir + "/macro/beamtime/mcbm2020/"; + TString parDir = srcDir + "/parameters"; // ------------------------------------------------------------------------ // ----- In- and output file names ------------------------------------ - TString inFile = Form("./data/unp_mcbm_%i.root", uRunId); - TString parFileIn = Form("./data/unp_mcbm_params_%i.root", uRunId); - TString parFileOut = Form("./data/reco_mcbm_evt_win_params_%u.root", uRunId); - TString outFile = Form("./data/reco_mcbm_evt_win_%u.root", uRunId); + TString inFile = sInpDir + Form("/unp_mcbm_%03u.root", uRunId); + TString parFileIn = sInpDir + Form("/unp_mcbm_params_%03u.root", uRunId); + TString parFileOut = sOutDir + Form("/reco_mcbm_evt_win_params_%03u.root", + uRunId); + TString outFile = sOutDir + Form("/reco_mcbm_evt_win_%03u.root", uRunId); // ------------------------------------------------------------------------ +/* + std::cout << sInpDir << std::endl << sOutDir << std::endl; + std::cout << inFile << std::endl + << parFileIn << std::endl + << parFileOut << std::endl + << outFile << std::endl; + std::cout << uRunId << " " << nTimeslices << std::endl; + + return kTRUE; +*/ + // --- Load the geometry setup ---- // This is currently only required by the TRD (parameters) std::string geoSetupTag = "mcbm_beam_2020_03"; @@ -96,8 +110,8 @@ void mcbm_build_and_reco(UInt_t uRunId = 831, * kEventBuilderDetT0 */ /// Use T0 as reference - eventBuilder->SetReferenceDetector(kEventBuilderDetT0); - eventBuilder->AddDetector(kEventBuilderDetTof); + /// The default (hardcoded) settings are T0 as reference detector and + /// STS, MUCH, TRD, TOF, RICH and PSD as selected detectors /// Change the selection window limits for T0 as ref eventBuilder->SetTriggerWindow(ECbmModuleId::kSts, -50, 100); @@ -147,7 +161,7 @@ void mcbm_build_and_reco(UInt_t uRunId = 831, if (0 < uRunId) eventBuilder->SetOutFilename( - Form("%sHistosEvtWin_%03u.root", outDir.Data(), uRunId)); + Form("%sHistosEvtWin_%03u.root", sOutDir.Data(), uRunId)); run->AddTask(eventBuilder); // ------------------------------------------------------------------------ @@ -198,8 +212,6 @@ void mcbm_build_and_reco(UInt_t uRunId = 831, // ----- Local reconstruction in MUCH --------------------------------- Int_t flag = 1; - TString parDir = - TString(gSystem->Getenv("VMCWORKDIR")) + TString("/parameters"); TString muchDigiFile( parDir + "/much/much_v19c_mcbm_digi_sector.root"); // MUCH digi file CbmMuchFindHitsGem* muchFindHits = @@ -247,6 +259,7 @@ void mcbm_build_and_reco(UInt_t uRunId = 831, std::cout << "-I- : Added task " << trdHit->GetName() << std::endl; // ------------------------------------------------------------------------ + // ----- Local reconstruction in TOF ---------------------------------- // ------------------------------------------------------------------------ // TOF defaults @@ -552,4 +565,6 @@ void mcbm_build_and_reco(UInt_t uRunId = 831, /// --- Screen output for automatic tests std::cout << " Test passed" << std::endl; std::cout << " All ok " << std::endl; + + return kTRUE; } diff --git a/macro/beamtime/mcbm2020/mcbm_build_and_reco_kronos.C b/macro/beamtime/mcbm2020/mcbm_build_and_reco_kronos.C index 629bcd8e..30fe00df 100644 --- a/macro/beamtime/mcbm2020/mcbm_build_and_reco_kronos.C +++ b/macro/beamtime/mcbm2020/mcbm_build_and_reco_kronos.C @@ -6,13 +6,15 @@ // // -------------------------------------------------------------------------- +#include "mcbm_build_and_reco.C" -void mcbm_build_and_reco_kronos(UInt_t uRunIdx = 28, - Int_t nTimeslices = 300, - TString outDir = "data/") { +Bool_t mcbm_build_and_reco_kronos(UInt_t uRunIdx = 28, + Int_t nTimeslices = 0, + TString sInpDir = "/lustre/cbm/users/ploizeau/mcbm2020/" + "unp_evt_data_7f229b3f_20201103", + TString sOutDir = "./data") { UInt_t uRunId = 0; - TString inFile = "./data/unp_mcbm_0.root"; - TString parFileIn = "./data/unp_mcbm_params_0.root"; + if (99999 != uRunIdx) { std::vector<UInt_t> vuListRunId = { 692, 698, 702, 704, 705, 706, 707, // 7 => 0 - 6 @@ -23,563 +25,23 @@ void mcbm_build_and_reco_kronos(UInt_t uRunIdx = 28, 841, 846, 849, // 3 => 30 - 32 850, 851, 852, 854, 855, 856, 857, 858, 859, // 9 => 33 - 41 860, 861, 862, 863, 864, 865, 866 // 7 => 42 - 48 - /* - /// With runs < 1 min due to missmatch! - 811, 812, 816, 817, 818, 819, // 6 => 14 - 19 - 820, 821, 822, 824, 826, 827, 828, 829, // 8 => 20 - 27 - 830, 831, 836, 839, // 4 => 28 - 31 - 840, 841, 842, 844, 845, 846, 848, 849, // 8 => 32 - 39 - 850, 851, 852, 854, 855, 856, 857, 858, 859, // 9 => 40 - 48 - 860, 861, 862, 863, 864, 865, 866 // 7 => 49 - 55 -*/ + + /* + /// With runs < 1 min due to missmatch! + 811, 812, 816, 817, 818, 819, // 6 => 14 - 19 + 820, 821, 822, 824, 826, 827, 828, 829, // 8 => 20 - 27 + 830, 831, 836, 839, // 4 => 28 - 31 + 840, 841, 842, 844, 845, 846, 848, 849, // 8 => 32 - 39 + 850, 851, 852, 854, 855, 856, 857, 858, 859, // 9 => 40 - 48 + 860, 861, 862, 863, 864, 865, 866 // 7 => 49 - 55 + */ }; if (vuListRunId.size() <= uRunIdx) return kFALSE; - uRunId = vuListRunId[uRunIdx]; - inFile = Form("/lustre/cbm/users/ploizeau/mcbm2020/" - "unp_evt_data_7f229b3f_20201103/unp_mcbm_%u.root", - uRunId); - parFileIn = Form("/lustre/cbm/users/ploizeau/mcbm2020/" - "unp_evt_data_7f229b3f_20201103/unp_mcbm_params_%u.root", - uRunId); + uRunId = vuListRunId[uRunIdx]; } // if( 99999 != uRunIdx ) if (uRunId < 692 && 0 != uRunId) return kFALSE; - - // ======================================================================== - // Adjust this part according to your requirements - - // --- Logger settings ---------------------------------------------------- - TString logLevel = "INFO"; - TString logVerbosity = "LOW"; - // ------------------------------------------------------------------------ - - - // ----- Environment -------------------------------------------------- - TString myName = "mcbm_reco"; // this macro's name for screen output - TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory - TString paramDir = srcDir + "/macro/beamtime/mcbm2020/"; - // ------------------------------------------------------------------------ - - - // ----- In- and output file names ------------------------------------ - TString parFileOut = Form("./data/reco_mcbm_evt_win_params_%u.root", uRunId); - TString outFile = Form("./data/reco_mcbm_evt_win_%u.root", uRunId); - // ------------------------------------------------------------------------ - - // --- Load the geometry setup ---- - // This is currently only required by the TRD (parameters) - std::string geoSetupTag = "mcbm_beam_2020_03"; - TString geoFile = - paramDir + geoSetupTag.data() + ".geo.root"; // Created in sim. run - CbmSetup* geoSetup = CbmSetup::Instance(); - geoSetup->LoadSetup(geoSetupTag.data()); - TList* parFileList = new TList(); - // ------------------------------------------------------------------------ - - // ----- Timer -------------------------------------------------------- - TStopwatch timer; - timer.Start(); - // ------------------------------------------------------------------------ - - - // ----- FairRunAna --------------------------------------------------- - FairRunAna* run = new FairRunAna(); - run->SetEventHeaderPersistence(kFALSE); - - FairFileSource* inputSource = new FairFileSource(inFile); - run->SetSource(inputSource); - - FairRootFileSink* outputSink = new FairRootFileSink(outFile); - run->SetSink(outputSink); - run->SetGeomFile(geoFile); - - // Define output file for FairMonitor histograms - TString monitorFile {outFile}; - monitorFile.ReplaceAll("reco", "reco.monitor"); - FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile); - // ------------------------------------------------------------------------ - - - // ----- Logger settings ---------------------------------------------- - FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); - FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data()); - // ------------------------------------------------------------------------ - - //-------- Event builder -------------------------------------------------- - // CbmMcbm2019TimeWinEventBuilder* eventBuilder = new CbmMcbm2019TimeWinEventBuilder(); - CbmMcbm2019TimeWinEventBuilderTask* eventBuilder = - new CbmMcbm2019TimeWinEventBuilderTask(); - - eventBuilder->SetFillHistos(kTRUE); - - eventBuilder->SetEventOverlapMode(EOverlapMode::NoOverlap); - // eventBuilder->SetEventOverlapMode(EOverlapMode::MergeOverlap); - // eventBuilder->SetEventOverlapMode(EOverlapMode::AllowOverlap); - - /* - * Available Pre-defined detectors: - * kEventBuilderDetSts - * kEventBuilderDetMuch - * kEventBuilderDetTrd - * kEventBuilderDetTof - * kEventBuilderDetRich - * kEventBuilderDetPsd - * kEventBuilderDetT0 - */ - - /// Change the selection window limits for T0 as ref - eventBuilder->SetTriggerWindow(ECbmModuleId::kSts, -50, 100); - eventBuilder->SetTriggerWindow(ECbmModuleId::kMuch, -150, 50); - eventBuilder->SetTriggerWindow(ECbmModuleId::kTrd, -50, 250); - eventBuilder->SetTriggerWindow(ECbmModuleId::kTof, -150, 10); - eventBuilder->SetTriggerWindow(ECbmModuleId::kRich, -50, 50); - eventBuilder->SetTriggerWindow(ECbmModuleId::kPsd, -50, 50); - /// To get T0 Digis (seed + close digis) in the event - eventBuilder->SetTriggerWindow(ECbmModuleId::kT0, -1, 10); - - /* - /// Use TOF as reference - eventBuilder->SetReferenceDetector( kEventBuilderDetTof ); - eventBuilder->AddDetector(kEventBuilderDetT0); - - /// Change the selection window limits for TOF as ref - /// => Should always be after changes of detector lists! - eventBuilder->SetTriggerWindow(ECbmModuleId::kT0, -150, 0); - eventBuilder->SetTriggerWindow(ECbmModuleId::kSts, -50, 100); - eventBuilder->SetTriggerWindow(ECbmModuleId::kMuch, -50, 200); - eventBuilder->SetTriggerWindow(ECbmModuleId::kTrd, -50, 300); - eventBuilder->SetTriggerWindow(ECbmModuleId::kTof, 0, 60); - eventBuilder->SetTriggerWindow(ECbmModuleId::kRich, -100, 150); - eventBuilder->SetTriggerWindow(ECbmModuleId::kPsd, -200, 50); -*/ - - /// Change the trigger requirements - /// => Should always be after changes of detector lists! - /// --- Minimum - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kT0, 1); - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kSts, 0); - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kMuch, 0); - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kTrd, 0); - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kTof, 10); - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kRich, 0); - eventBuilder->SetTriggerMinNumber(ECbmModuleId::kPsd, 0); - /// --- Maximum (-1 to disable cut) - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kT0, -1); - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kSts, -1); - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kMuch, -1); - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kTrd, -1); - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kTof, -1); - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kRich, -1); - eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kPsd, -1); - - - if (0 < uRunId) - eventBuilder->SetOutFilename( - Form("%sHistosEvtWin_%03u.root", outDir.Data(), uRunId)); - - run->AddTask(eventBuilder); - // ------------------------------------------------------------------------ - - - // ----- Reconstruction tasks ----------------------------------------- - - // ----- Local reconstruction in STS ---------------------------------- - CbmRecoSts* recoSts = new CbmRecoSts(); - recoSts->SetMode(kCbmRecoEvent); - - //recoSts->SetTimeCutDigisAbs( 20 );// cluster finder: time cut in ns - //recoSts->SetTimeCutClustersAbs(20.); // hit finder: time cut in ns - - // ASIC params: #ADC channels, dyn. range, threshold, time resol., dead time, - // noise RMS, zero-threshold crossing rate - auto parAsic = - new CbmStsParAsic(32, 75000., 3000., 5., 800., 1000., 3.9789e-3); - - // Module params: number of channels, number of channels per ASIC - auto parMod = new CbmStsParModule(2048, 128); - parMod->SetAllAsics(*parAsic); - recoSts->UseModulePar(parMod); - - // Sensor params - auto sensorPar = new CbmStsParSensor(CbmStsSensorClass::kDssdStereo); - sensorPar->SetPar(0, 6.2092); // Extension in x - sensorPar->SetPar(1, 6.2); // Extension in y - sensorPar->SetPar(2, 0.03); // Extension in z - sensorPar->SetPar(3, 5.9692); // Active size in y - sensorPar->SetPar(4, 1024.); // Number of strips front side - sensorPar->SetPar(5, 1024.); // Number of strips back side - sensorPar->SetPar(6, 0.0058); // Strip pitch front side - sensorPar->SetPar(7, 0.0058); // Strip pitch back side - sensorPar->SetPar(8, 7.5); // Stereo angle front side - sensorPar->SetPar(9, 0.0); // Stereo angle back side - recoSts->UseSensorPar(sensorPar); - - // Sensor conditions: full depletion voltage, bias voltage, temperature, - // coupling capacitance, inter-strip capacitance - auto sensorCond = new CbmStsParSensorCond(70., 140., 268., 17.5, 1.); - recoSts->UseSensorCond(sensorCond); - - run->AddTask(recoSts); - std::cout << "-I- : Added task " << recoSts->GetName() << std::endl; - // ------------------------------------------------------------------------ - - - // ----- Local reconstruction in MUCH --------------------------------- - Int_t flag = 1; - TString parDir = - TString(gSystem->Getenv("VMCWORKDIR")) + TString("/parameters"); - TString muchDigiFile( - parDir + "/much/much_v19c_mcbm_digi_sector.root"); // MUCH digi file - CbmMuchFindHitsGem* muchFindHits = - new CbmMuchFindHitsGem(muchDigiFile.Data(), flag); - muchFindHits->SetBeamTimeDigi(kTRUE); - run->AddTask(muchFindHits); - std::cout << "-I- : Added task " << muchFindHits->GetName() << std::endl; - // ------------------------------------------------------------------------ - - - // ----- Local reconstruction in TRD ---------------------------------- - // Load parameters <- they are required by the hit producer. - // For now, it is enough to load the default ascii parameters - // if no root file is existing from the unpacking process. - TString geoTagTrd = ""; - bool isActiveTrd = - (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) ? true : false; - if (!isActiveTrd) { - LOG(warning) << Form( - "TRD - parameter loading - Trd not found in CbmSetup(%s) -> parameters " - "can not be loaded correctly!", - geoSetupTag.data()); - } else { - TString paramFilesTrd( - Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data())); - std::vector<std::string> paramFilesVecTrd; - CbmTrdParManager::GetParFileExtensions(¶mFilesVecTrd); - for (auto parIt : paramFilesVecTrd) { - parFileList->Add( - new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.data()))); - } - } - // -- end trd parameters - // -- beginn trd reco - Double_t triggerThreshold = 0.5e-6; // Default - 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; - // ------------------------------------------------------------------------ - - // ----- Local reconstruction in TOF ---------------------------------- - // ------------------------------------------------------------------------ - // TOF defaults - Int_t calMode = 93; - Int_t calSel = 1; - Int_t calSm = 0; - Int_t RefSel = 0; - Double_t dDeadtime = 50.; - Int_t iSel2 = 500; - TString TofGeoTag = "v20f_mcbm"; - TString cCalId = "831.50.3.0"; - Int_t iCalSet = 12022500; // calibration settings - - TObjString* tofBdfFile = - new TObjString(parDir + "/tof/tof_" + TofGeoTag + ".digibdf.par"); - parFileList->Add(tofBdfFile); - std::cout << "-I- Using parameter file " << tofBdfFile->GetString() - << std::endl; - - CbmTofEventClusterizer* tofCluster = - new CbmTofEventClusterizer("TOF Event Clusterizer", 0, 1); - TString cFname = parDir + "/tof/" - + Form("%s_set%09d_%02d_%01dtofClust.hst.root", - cCalId.Data(), - iCalSet, - calMode, - calSel); - tofCluster->SetCalParFileName(cFname); - tofCluster->SetCalMode(calMode); - tofCluster->SetCalSel(calSel); - tofCluster->PosYMaxScal(0.75); //in % of 2*length - tofCluster->SetChannelDeadtime(dDeadtime); // artificial deadtime in ns - - run->AddTask(tofCluster); - std::cout << "-I- Added task " << tofCluster->GetName() << std::endl; - - // ----- Track reconstruction ------------------------------------------ - Int_t iTrackMode = 2; - switch (iTrackMode) { - case 2: { - Int_t iGenCor = 1; - Double_t dScalFac = 1.; - Double_t dChi2Lim2 = 3.5; - TString cTrkFile = - parDir + "/tof/" + Form("%s_tofFindTracks.hst.root", cCalId.Data()); - Int_t iTrackingSetup = 1; - Int_t iCalOpt = 1; - - CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); - tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm - tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz - tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz - tofTrackFinder->SetTyMean(0.); // mean slope dy/dz - CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); - TFitter* MyFit = new TFitter(1); // initialize Minuit - tofTrackFinder->SetFitter(tofTrackFitter); - - CbmTofFindTracks* tofFindTracks = - new CbmTofFindTracks("TOF Track Finder"); - tofFindTracks->UseFinder(tofTrackFinder); - tofFindTracks->UseFitter(tofTrackFitter); - tofFindTracks->SetCalOpt(iCalOpt); - // 1 - update offsets, 2 - update walk, 0 - bypass - tofFindTracks->SetCorMode( - iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - tofFindTracks->SetTtTarg( - 0.065); // target value for Mar2020 triple stack -> betapeak ~ 0.95 - //tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! - //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! - tofFindTracks->SetCalParFileName( - cTrkFile); // Tracker parameter value file name - tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter - tofFindTracks->SetStationMaxHMul( - 30); // Max Hit Multiplicity in any used station - - tofFindTracks->SetT0MAX(dScalFac); // in ns - tofFindTracks->SetSIGT(0.08); // default in ns - tofFindTracks->SetSIGX(0.3); // default in cm - tofFindTracks->SetSIGY(0.45); // default in cm - tofFindTracks->SetSIGZ(0.05); // default in cm - tofFindTracks->SetUseSigCalib( - kFALSE); // ignore resolutions in CalPar file - tofTrackFinder->SetSIGLIM(dChi2Lim2 - * 2.); // matching window in multiples of chi2 - tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 - - Int_t iMinNofHits = -1; - Int_t iNStations = 0; - Int_t iNReqStations = 3; - switch (iTrackingSetup) { - case 0: // bypass mode - iMinNofHits = -1; - iNStations = 1; - tofFindTracks->SetStation(0, 5, 0, 0); // Diamond - break; - - case 1: // for calibration mode of full setup - iMinNofHits = 3; - iNStations = 28; - iNReqStations = 4; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 2, 2); - tofFindTracks->SetStation(2, 0, 1, 2); - tofFindTracks->SetStation(3, 0, 0, 2); - tofFindTracks->SetStation(4, 0, 2, 1); - tofFindTracks->SetStation(5, 0, 1, 1); - tofFindTracks->SetStation(6, 0, 0, 1); - tofFindTracks->SetStation(7, 0, 2, 3); - tofFindTracks->SetStation(8, 0, 1, 3); - tofFindTracks->SetStation(9, 0, 0, 3); - tofFindTracks->SetStation(10, 0, 2, 0); - tofFindTracks->SetStation(11, 0, 1, 0); - tofFindTracks->SetStation(12, 0, 0, 0); - tofFindTracks->SetStation(13, 0, 2, 4); - tofFindTracks->SetStation(14, 0, 1, 4); - tofFindTracks->SetStation(15, 0, 0, 4); - tofFindTracks->SetStation(16, 0, 4, 0); - tofFindTracks->SetStation(17, 0, 3, 0); - tofFindTracks->SetStation(18, 0, 4, 1); - tofFindTracks->SetStation(19, 0, 3, 1); - tofFindTracks->SetStation(20, 0, 4, 2); - tofFindTracks->SetStation(21, 0, 3, 2); - tofFindTracks->SetStation(22, 0, 4, 3); - tofFindTracks->SetStation(23, 0, 3, 3); - tofFindTracks->SetStation(24, 0, 4, 4); - tofFindTracks->SetStation(25, 0, 3, 4); - tofFindTracks->SetStation(26, 9, 0, 0); - tofFindTracks->SetStation(27, 9, 0, 1); - break; - - case 2: // for geometry check mode of full setup - iMinNofHits = 3; - iNStations = 27; - iNReqStations = 4; - tofFindTracks->SetStation(0, 0, 2, 2); - tofFindTracks->SetStation(1, 0, 1, 2); - tofFindTracks->SetStation(2, 0, 0, 2); - tofFindTracks->SetStation(3, 0, 2, 1); - tofFindTracks->SetStation(4, 0, 1, 1); - tofFindTracks->SetStation(5, 0, 0, 1); - tofFindTracks->SetStation(6, 0, 2, 3); - tofFindTracks->SetStation(7, 0, 1, 3); - tofFindTracks->SetStation(8, 0, 0, 3); - tofFindTracks->SetStation(9, 0, 2, 0); - tofFindTracks->SetStation(10, 0, 1, 0); - tofFindTracks->SetStation(11, 0, 0, 0); - tofFindTracks->SetStation(12, 0, 2, 4); - tofFindTracks->SetStation(13, 0, 1, 4); - tofFindTracks->SetStation(14, 0, 0, 4); - tofFindTracks->SetStation(15, 0, 4, 0); - tofFindTracks->SetStation(16, 0, 3, 0); - tofFindTracks->SetStation(17, 0, 4, 1); - tofFindTracks->SetStation(18, 0, 3, 1); - tofFindTracks->SetStation(19, 0, 4, 2); - tofFindTracks->SetStation(20, 0, 3, 2); - tofFindTracks->SetStation(21, 0, 4, 3); - tofFindTracks->SetStation(22, 0, 3, 3); - tofFindTracks->SetStation(23, 0, 4, 4); - tofFindTracks->SetStation(24, 0, 3, 4); - tofFindTracks->SetStation(25, 9, 0, 0); - tofFindTracks->SetStation(26, 9, 0, 1); - break; - - case 3: // for reduced bias tracking of full setup - iMinNofHits = 3; - iNStations = 28; - iNReqStations = 4; - tofFindTracks->SetStation(0, 0, 2, 2); - tofFindTracks->SetStation(1, 0, 1, 2); - tofFindTracks->SetStation(2, 0, 0, 2); - tofFindTracks->SetStation(3, 0, 2, 1); - tofFindTracks->SetStation(4, 0, 1, 1); - tofFindTracks->SetStation(5, 0, 0, 1); - tofFindTracks->SetStation(6, 0, 2, 3); - tofFindTracks->SetStation(7, 0, 1, 3); - tofFindTracks->SetStation(8, 0, 0, 3); - tofFindTracks->SetStation(9, 0, 2, 0); - tofFindTracks->SetStation(10, 0, 1, 0); - tofFindTracks->SetStation(11, 0, 0, 0); - tofFindTracks->SetStation(12, 0, 2, 4); - tofFindTracks->SetStation(13, 0, 1, 4); - tofFindTracks->SetStation(14, 0, 0, 4); - tofFindTracks->SetStation(15, 0, 4, 0); - tofFindTracks->SetStation(16, 0, 3, 0); - tofFindTracks->SetStation(17, 0, 4, 1); - tofFindTracks->SetStation(18, 0, 3, 1); - tofFindTracks->SetStation(19, 0, 4, 2); - tofFindTracks->SetStation(20, 0, 3, 2); - tofFindTracks->SetStation(21, 0, 4, 3); - tofFindTracks->SetStation(22, 0, 3, 3); - tofFindTracks->SetStation(23, 0, 4, 4); - tofFindTracks->SetStation(24, 0, 3, 4); - tofFindTracks->SetStation(25, 9, 0, 0); - tofFindTracks->SetStation(26, 9, 0, 1); - tofFindTracks->SetStation(27, 5, 0, 0); - break; - } - tofFindTracks->SetMinNofHits(iMinNofHits); - tofFindTracks->SetNStations(iNStations); - tofFindTracks->SetNReqStations(iNReqStations); - //tofFindTracks->PrintSetup(); - run->AddTask(tofFindTracks); - } break; - case 1: { - } - case 0: - default:; - } - - // ----- Local reconstruction of RICH Hits ------------------------------ - 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); - // ------------------------------------------------------------------------ - - // ----- Local reconstruction in RICh -> Finding of Rings --------------- - CbmRichReconstruction* richReco = new CbmRichReconstruction(); - richReco->UseMCbmSetup(); - run->AddTask(richReco); - // ------------------------------------------------------------------------ - - - // ----- Psd hit producer ---------------------------------------------- - CbmPsdMCbmHitProducer* hitProdPsd = new CbmPsdMCbmHitProducer(); - run->AddTask(hitProdPsd); - // ------------------------------------------------------------------------ - - - // ----- 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(); - FairParRootFileIo* parIo3 = new FairParRootFileIo(); - parIo1->open(parFileIn.Data(), "READ"); - rtdb->setFirstInput(parIo1); - - parIo2->open(parFileList, "in"); - rtdb->setSecondInput(parIo2); - - parIo3->open(parFileOut.Data(), "RECREATE"); - - // ------------------------------------------------------------------------ - - - // ----- Run initialisation ------------------------------------------- - std::cout << std::endl; - std::cout << "-I- " << myName << ": Initialise run" << std::endl; - run->Init(); - rtdb->setOutput(parIo3); - 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 " << parFileOut << std::endl; - std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s" - << std::endl; - std::cout << 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(); - // ------------------------------------------------------------------------ - - /// --- Screen output for automatic tests - std::cout << " Test passed" << std::endl; - std::cout << " All ok " << std::endl; + return mcbm_build_and_reco(uRunId, nTimeslices, sInpDir, sOutDir); } diff --git a/macro/beamtime/mcbm2020/mcbm_event_reco.C b/macro/beamtime/mcbm2020/mcbm_event_reco.C index a9a4b40c..bedfbedf 100644 --- a/macro/beamtime/mcbm2020/mcbm_event_reco.C +++ b/macro/beamtime/mcbm2020/mcbm_event_reco.C @@ -6,10 +6,13 @@ // // -------------------------------------------------------------------------- -void mcbm_event_reco(Int_t runId = 831, Int_t nTimeslices = -1) { +Bool_t mcbm_event_reco(UInt_t uRunId = 831, + Int_t nTimeslices = 0, + TString sInpDir = "./data", + TString sOutDir = "./data") { // --- Logger settings ---------------------------------------------------- - TString logLevel = "WARN"; + TString logLevel = "INFO"; TString logVerbosity = "LOW"; // ------------------------------------------------------------------------ @@ -23,12 +26,24 @@ void mcbm_event_reco(Int_t runId = 831, Int_t nTimeslices = -1) { // ----- In- and output file names ------------------------------------ - TString inFile = Form("./data/unp_mcbm_%i.root", runId); - TString parFileIn = Form("./data/unp_mcbm_params_%i.root", runId); - TString parFileOut = Form("./data/reco_mcbm_event_params_%i.root", runId); - TString outFile = Form("./data/reco_mcbm_event_%i.root", runId); + TString inFile = sInpDir + Form("/unp_mcbm_%03u.root", uRunId); + TString parFileIn = sInpDir + Form("/unp_mcbm_params_%03u.root", uRunId); + TString parFileOut = sOutDir + Form("/reco_mcbm_event_params_%03u.root", + uRunId); + TString outFile = sOutDir + Form("/reco_mcbm_event_%03u.root", uRunId); // ------------------------------------------------------------------------ +/* + std::cout << sInpDir << std::endl << sOutDir << std::endl; + std::cout << inFile << std::endl + << parFileIn << std::endl + << parFileOut << std::endl + << outFile << std::endl; + std::cout << uRunId << " " << nTimeslices << std::endl; + + return kTRUE; +*/ + // --- Load the geometry setup ---- // This is currently only required by the TRD (parameters) std::string geoSetupTag = "mcbm_beam_2020_03"; @@ -477,4 +492,6 @@ void mcbm_event_reco(Int_t runId = 831, Int_t nTimeslices = -1) { /// --- Screen output for automatic tests std::cout << " Test passed" << std::endl; std::cout << " All ok " << std::endl; + + return kTRUE; } diff --git a/macro/beamtime/mcbm2020/mcbm_event_reco_kronos.C b/macro/beamtime/mcbm2020/mcbm_event_reco_kronos.C index b360afcd..00b90e16 100644 --- a/macro/beamtime/mcbm2020/mcbm_event_reco_kronos.C +++ b/macro/beamtime/mcbm2020/mcbm_event_reco_kronos.C @@ -6,480 +6,42 @@ // // -------------------------------------------------------------------------- -void mcbm_event_reco(Int_t runId = 831, Int_t nTimeslices = 300) { - - // --- Logger settings ---------------------------------------------------- - TString logLevel = "INFO"; - TString logVerbosity = "LOW"; - // ------------------------------------------------------------------------ - - - // ----- Environment -------------------------------------------------- - TString myName = "mcbm_event_reco"; // this macro's name for screen output - TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory - TString paramDir = srcDir + "/macro/beamtime/mcbm2020/"; - TString parDir = srcDir + "/parameters"; - // ------------------------------------------------------------------------ - - - // ----- In- and output file names ------------------------------------ - TString inFile = Form("/lustre/cbm/users/ploizeau/mcbm2020/" - "unp_evt_data_7f229b3f_20201103/unp_mcbm_%i.root", - runId); - TString parFileIn = - Form("/lustre/cbm/users/ploizeau/mcbm2020/unp_evt_data_7f229b3f_20201103/" - "unp_mcbm_params_%i.root", - runId); - TString parFileOut = Form("./data/reco_mcbm_event_params_%i.root", runId); - TString outFile = Form("./data/reco_mcbm_event_%i.root", runId); - // ------------------------------------------------------------------------ - - // --- Load the geometry setup ---- - // This is currently only required by the TRD (parameters) - std::string geoSetupTag = "mcbm_beam_2020_03"; - TString geoFile = - paramDir + geoSetupTag.data() + ".geo.root"; // Created in sim. run - CbmSetup* geoSetup = CbmSetup::Instance(); - geoSetup->LoadSetup(geoSetupTag.data()); - TList* parFileList = new TList(); - // ------------------------------------------------------------------------ - - // ----- Timer -------------------------------------------------------- - TStopwatch timer; - timer.Start(); - // ------------------------------------------------------------------------ - - - // ----- FairRunAna --------------------------------------------------- - FairRunAna* run = new FairRunAna(); - FairFileSource* inputSource = new FairFileSource(inFile); - run->SetSource(inputSource); - - FairRootFileSink* outputSink = new FairRootFileSink(outFile); - run->SetSink(outputSink); - run->SetGeomFile(geoFile); - - // Define output file for FairMonitor histograms - TString monitorFile {outFile}; - monitorFile.ReplaceAll("reco", "reco.monitor"); - FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile); - // ------------------------------------------------------------------------ - - - // ----- Logger settings ---------------------------------------------- - FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); - FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data()); - // ------------------------------------------------------------------------ - - //--------------------event builder-------------------// - CbmMcbm2018EventBuilder* eventBuilder = new CbmMcbm2018EventBuilder(); - // eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::MaximumTimeGap); - //eventBuilder->SetMaximumTimeGap(50.); - eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::FixedTimeWindow); - eventBuilder->SetFixedTimeWindow(200.); - eventBuilder->SetTriggerMinNumberT0(1); - //eventBuilder->SetTriggerMinNumberSts(0); - eventBuilder->SetTriggerMinNumberMuch(1); - // eventBuilder->SetTriggerMinNumberTrd(1); - eventBuilder->SetTriggerMinNumberTof(10); - // eventBuilder->SetFillHistos(kTRUE); - run->AddTask(eventBuilder); - // ------------------------------------------------------------------------ - - - // ----- Reconstruction tasks ----------------------------------------- - - // ----- Local reconstruction in MUCH --------------------------------- - Int_t flag = 1; - TString muchDigiFile( - parDir + "/much/much_v19c_mcbm_digi_sector.root"); // MUCH digi file - CbmMuchFindHitsGem* muchFindHits = - new CbmMuchFindHitsGem(muchDigiFile.Data(), flag); - muchFindHits->SetBeamTimeDigi(kTRUE); - run->AddTask(muchFindHits); - std::cout << "-I- : Added task " << muchFindHits->GetName() << std::endl; - //------------------------------------------------------------------------------- - - - // ----- Local reconstruction in STS ---------------------------------- - CbmRecoSts* recoSts = new CbmRecoSts(); - recoSts->SetMode(kCbmRecoEvent); - - //recoSts->SetTimeCutDigisAbs( 20 );// cluster finder: time cut in ns - //recoSts->SetTimeCutClustersAbs(20.); // hit finder: time cut in ns - - // ASIC params: #ADC channels, dyn. range, threshold, time resol., dead time, - // noise RMS, zero-threshold crossing rate - auto parAsic = - new CbmStsParAsic(32, 75000., 3000., 5., 800., 1000., 3.9789e-3); - - // Module params: number of channels, number of channels per ASIC - auto parMod = new CbmStsParModule(2048, 128); - parMod->SetAllAsics(*parAsic); - recoSts->UseModulePar(parMod); - - // Sensor params - auto sensorPar = new CbmStsParSensor(CbmStsSensorClass::kDssdStereo); - sensorPar->SetPar(0, 6.2092); // Extension in x - sensorPar->SetPar(1, 6.2); // Extension in y - sensorPar->SetPar(2, 0.03); // Extension in z - sensorPar->SetPar(3, 5.9692); // Active size in y - sensorPar->SetPar(4, 1024.); // Number of strips front side - sensorPar->SetPar(5, 1024.); // Number of strips back side - sensorPar->SetPar(6, 0.0058); // Strip pitch front side - sensorPar->SetPar(7, 0.0058); // Strip pitch back side - sensorPar->SetPar(8, 7.5); // Stereo angle front side - sensorPar->SetPar(9, 0.0); // Stereo angle back side - recoSts->UseSensorPar(sensorPar); - - // Sensor conditions: full depletion voltage, bias voltage, temperature, - // coupling capacitance, inter-strip capacitance - auto sensorCond = new CbmStsParSensorCond(70., 140., 268., 17.5, 1.); - recoSts->UseSensorCond(sensorCond); - - run->AddTask(recoSts); - std::cout << "-I- : Added task " << recoSts->GetName() << std::endl; - // ------------------------------------------------------------------------ - - - // ----- Local reconstruction in TRD ---------------------------------- - // Load parameters <- they are required by the hit producer. - // For now, it is enough to load the default ascii parameters - // if no root file is existing from the unpacking process. - TString geoTagTrd = ""; - bool isActiveTrd = - (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) ? true : false; - if (!isActiveTrd) { - LOG(warning) << Form( - "TRD - parameter loading - Trd not found in CbmSetup(%s) -> parameters " - "can not be loaded correctly!", - geoSetupTag.data()); - } else { - TString paramFilesTrd( - Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data())); - std::vector<std::string> paramFilesVecTrd; - CbmTrdParManager::GetParFileExtensions(¶mFilesVecTrd); - for (auto parIt : paramFilesVecTrd) { - parFileList->Add( - new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.data()))); - } - } - // -- end trd parameters - // -- beginn trd reco - Double_t triggerThreshold = 0.5e-6; // Default - 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; - // ------------------------------------------------------------------------ - - - // ----- Local reconstruction in TOF ---------------------------------- - // ------------------------------------------------------------------------ - // TOF defaults - Int_t calMode = 93; - Int_t calSel = 1; - Int_t calSm = 0; - Int_t RefSel = 0; - Double_t dDeadtime = 50.; - Int_t iSel2 = 500; - TString TofGeoTag = "v20f_mcbm"; - TString cCalId = "831.50.3.0"; - Int_t iCalSet = 12022500; // calibration settings - - TObjString* tofBdfFile = - new TObjString(parDir + "/tof/tof_" + TofGeoTag + ".digibdf.par"); - parFileList->Add(tofBdfFile); - std::cout << "-I- Using parameter file " << tofBdfFile->GetString() - << std::endl; - - CbmTofEventClusterizer* tofCluster = - new CbmTofEventClusterizer("TOF Event Clusterizer", 0, 1); - TString cFname = parDir + "/tof/" - + Form("%s_set%09d_%02d_%01dtofClust.hst.root", - cCalId.Data(), - iCalSet, - calMode, - calSel); - tofCluster->SetCalParFileName(cFname); - tofCluster->SetCalMode(calMode); - tofCluster->SetCalSel(calSel); - tofCluster->PosYMaxScal(0.75); //in % of 2*length - tofCluster->SetChannelDeadtime(dDeadtime); // artificial deadtime in ns - - run->AddTask(tofCluster); - std::cout << "-I- Added task " << tofCluster->GetName() << std::endl; - - // ----- Track reconstruction ------------------------------------------ - Int_t iTrackMode = 2; - switch (iTrackMode) { - case 2: { - Int_t iGenCor = 1; - Double_t dScalFac = 1.; - Double_t dChi2Lim2 = 3.5; - TString cTrkFile = - parDir + "/tof/" + Form("%s_tofFindTracks.hst.root", cCalId.Data()); - Int_t iTrackingSetup = 1; - Int_t iCalOpt = 0; - - CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); - tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm - tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz - tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz - tofTrackFinder->SetTyMean(0.); // mean slope dy/dz - CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); - TFitter* MyFit = new TFitter(1); // initialize Minuit - tofTrackFinder->SetFitter(tofTrackFitter); - - CbmTofFindTracks* tofFindTracks = - new CbmTofFindTracks("TOF Track Finder"); - tofFindTracks->UseFinder(tofTrackFinder); - tofFindTracks->UseFitter(tofTrackFitter); - tofFindTracks->SetCalOpt(iCalOpt); - // 1 - update offsets, 2 - update walk, 0 - bypass - tofFindTracks->SetCorMode( - iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - tofFindTracks->SetTtTarg( - 0.065); // target value for Mar2020 triple stack -> betapeak ~ 0.95 - //tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! - //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! - tofFindTracks->SetCalParFileName( - cTrkFile); // Tracker parameter value file name - tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter - tofFindTracks->SetStationMaxHMul( - 30); // Max Hit Multiplicity in any used station - - tofFindTracks->SetT0MAX(dScalFac); // in ns - tofFindTracks->SetSIGT(0.08); // default in ns - tofFindTracks->SetSIGX(0.3); // default in cm - tofFindTracks->SetSIGY(0.45); // default in cm - tofFindTracks->SetSIGZ(0.05); // default in cm - tofFindTracks->SetUseSigCalib( - kFALSE); // ignore resolutions in CalPar file - tofTrackFinder->SetSIGLIM(dChi2Lim2 - * 2.); // matching window in multiples of chi2 - tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 - - Int_t iMinNofHits = -1; - Int_t iNStations = 0; - Int_t iNReqStations = 3; - switch (iTrackingSetup) { - case 0: // bypass mode - iMinNofHits = -1; - iNStations = 1; - tofFindTracks->SetStation(0, 5, 0, 0); // Diamond - break; - - case 1: // for calibration mode of full setup - iMinNofHits = 3; - iNStations = 28; - iNReqStations = 4; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 2, 2); - tofFindTracks->SetStation(2, 0, 1, 2); - tofFindTracks->SetStation(3, 0, 0, 2); - tofFindTracks->SetStation(4, 0, 2, 1); - tofFindTracks->SetStation(5, 0, 1, 1); - tofFindTracks->SetStation(6, 0, 0, 1); - tofFindTracks->SetStation(7, 0, 2, 3); - tofFindTracks->SetStation(8, 0, 1, 3); - tofFindTracks->SetStation(9, 0, 0, 3); - tofFindTracks->SetStation(10, 0, 2, 0); - tofFindTracks->SetStation(11, 0, 1, 0); - tofFindTracks->SetStation(12, 0, 0, 0); - tofFindTracks->SetStation(13, 0, 2, 4); - tofFindTracks->SetStation(14, 0, 1, 4); - tofFindTracks->SetStation(15, 0, 0, 4); - tofFindTracks->SetStation(16, 0, 4, 0); - tofFindTracks->SetStation(17, 0, 3, 0); - tofFindTracks->SetStation(18, 0, 4, 1); - tofFindTracks->SetStation(19, 0, 3, 1); - tofFindTracks->SetStation(20, 0, 4, 2); - tofFindTracks->SetStation(21, 0, 3, 2); - tofFindTracks->SetStation(22, 0, 4, 3); - tofFindTracks->SetStation(23, 0, 3, 3); - tofFindTracks->SetStation(24, 0, 4, 4); - tofFindTracks->SetStation(25, 0, 3, 4); - tofFindTracks->SetStation(26, 9, 0, 0); - tofFindTracks->SetStation(27, 9, 0, 1); - break; - - case 2: // for geometry check mode of full setup - iMinNofHits = 3; - iNStations = 27; - iNReqStations = 4; - tofFindTracks->SetStation(0, 0, 2, 2); - tofFindTracks->SetStation(1, 0, 1, 2); - tofFindTracks->SetStation(2, 0, 0, 2); - tofFindTracks->SetStation(3, 0, 2, 1); - tofFindTracks->SetStation(4, 0, 1, 1); - tofFindTracks->SetStation(5, 0, 0, 1); - tofFindTracks->SetStation(6, 0, 2, 3); - tofFindTracks->SetStation(7, 0, 1, 3); - tofFindTracks->SetStation(8, 0, 0, 3); - tofFindTracks->SetStation(9, 0, 2, 0); - tofFindTracks->SetStation(10, 0, 1, 0); - tofFindTracks->SetStation(11, 0, 0, 0); - tofFindTracks->SetStation(12, 0, 2, 4); - tofFindTracks->SetStation(13, 0, 1, 4); - tofFindTracks->SetStation(14, 0, 0, 4); - tofFindTracks->SetStation(15, 0, 4, 0); - tofFindTracks->SetStation(16, 0, 3, 0); - tofFindTracks->SetStation(17, 0, 4, 1); - tofFindTracks->SetStation(18, 0, 3, 1); - tofFindTracks->SetStation(19, 0, 4, 2); - tofFindTracks->SetStation(20, 0, 3, 2); - tofFindTracks->SetStation(21, 0, 4, 3); - tofFindTracks->SetStation(22, 0, 3, 3); - tofFindTracks->SetStation(23, 0, 4, 4); - tofFindTracks->SetStation(24, 0, 3, 4); - tofFindTracks->SetStation(25, 9, 0, 0); - tofFindTracks->SetStation(26, 9, 0, 1); - break; - - case 3: // for reduced bias tracking of full setup - iMinNofHits = 3; - iNStations = 28; - iNReqStations = 4; - tofFindTracks->SetStation(0, 0, 2, 2); - tofFindTracks->SetStation(1, 0, 1, 2); - tofFindTracks->SetStation(2, 0, 0, 2); - tofFindTracks->SetStation(3, 0, 2, 1); - tofFindTracks->SetStation(4, 0, 1, 1); - tofFindTracks->SetStation(5, 0, 0, 1); - tofFindTracks->SetStation(6, 0, 2, 3); - tofFindTracks->SetStation(7, 0, 1, 3); - tofFindTracks->SetStation(8, 0, 0, 3); - tofFindTracks->SetStation(9, 0, 2, 0); - tofFindTracks->SetStation(10, 0, 1, 0); - tofFindTracks->SetStation(11, 0, 0, 0); - tofFindTracks->SetStation(12, 0, 2, 4); - tofFindTracks->SetStation(13, 0, 1, 4); - tofFindTracks->SetStation(14, 0, 0, 4); - tofFindTracks->SetStation(15, 0, 4, 0); - tofFindTracks->SetStation(16, 0, 3, 0); - tofFindTracks->SetStation(17, 0, 4, 1); - tofFindTracks->SetStation(18, 0, 3, 1); - tofFindTracks->SetStation(19, 0, 4, 2); - tofFindTracks->SetStation(20, 0, 3, 2); - tofFindTracks->SetStation(21, 0, 4, 3); - tofFindTracks->SetStation(22, 0, 3, 3); - tofFindTracks->SetStation(23, 0, 4, 4); - tofFindTracks->SetStation(24, 0, 3, 4); - tofFindTracks->SetStation(25, 9, 0, 0); - tofFindTracks->SetStation(26, 9, 0, 1); - tofFindTracks->SetStation(27, 5, 0, 0); - break; - } - tofFindTracks->SetMinNofHits(iMinNofHits); - tofFindTracks->SetNStations(iNStations); - tofFindTracks->SetNReqStations(iNReqStations); - //tofFindTracks->PrintSetup(); - run->AddTask(tofFindTracks); - } break; - case 1: { - } - case 0: - default:; - } - - // ----- Local reconstruction of RICH Hits ------------------------------ - 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); - // ------------------------------------------------------------------------ - - // ----- Local reconstruction in RICh -> Finding of Rings --------------- - CbmRichReconstruction* richReco = new CbmRichReconstruction(); - richReco->UseMCbmSetup(); - run->AddTask(richReco); - // ------------------------------------------------------------------------ - - - // ----- Psd hit producer ---------------------------------------------- - CbmPsdMCbmHitProducer* hitProdPsd = new CbmPsdMCbmHitProducer(); - run->AddTask(hitProdPsd); - // ------------------------------------------------------------------------ - - - // ----- 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(); - FairParRootFileIo* parIo3 = new FairParRootFileIo(); - parIo1->open(parFileIn.Data(), "READ"); - rtdb->setFirstInput(parIo1); - parIo2->open(parFileList, "in"); - rtdb->setSecondInput(parIo2); - parIo3->open(parFileOut.Data(), "RECREATE"); - // ------------------------------------------------------------------------ - - - // ----- Run initialisation ------------------------------------------- - std::cout << std::endl; - std::cout << "-I- " << myName << ": Initialise run" << std::endl; - run->Init(); - rtdb->setOutput(parIo3); - 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 " << parFileOut << std::endl; - std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s" - << std::endl; - std::cout << 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(); - // ------------------------------------------------------------------------ - - /// --- Screen output for automatic tests - std::cout << " Test passed" << std::endl; - std::cout << " All ok " << std::endl; +#include "mcbm_event_reco.C" + +Bool_t mcbm_event_reco_kronos(UInt_t uRunIdx = 28, + Int_t nTimeslices = 0, + TString sInpDir = "/lustre/cbm/users/ploizeau/mcbm2020/" + "unp_evt_data_7f229b3f_20201103", + TString sOutDir = "./data") { + UInt_t uRunId = 0; + + if (99999 != uRunIdx) { + std::vector<UInt_t> vuListRunId = { + 692, 698, 702, 704, 705, 706, 707, // 7 => 0 - 6 + 744, 750, 759, 760, 761, 762, 799, // 7 => 7 - 13 + 811, 812, 816, 817, 819, // 5 => 14 - 18 + 820, 821, 822, 824, 826, 827, 828, 829, // 8 => 19 - 26 + 830, 831, 836, // 3 => 27 - 29 + 841, 846, 849, // 3 => 30 - 32 + 850, 851, 852, 854, 855, 856, 857, 858, 859, // 9 => 33 - 41 + 860, 861, 862, 863, 864, 865, 866 // 7 => 42 - 48 + + /* + /// With runs < 1 min due to missmatch! + 811, 812, 816, 817, 818, 819, // 6 => 14 - 19 + 820, 821, 822, 824, 826, 827, 828, 829, // 8 => 20 - 27 + 830, 831, 836, 839, // 4 => 28 - 31 + 840, 841, 842, 844, 845, 846, 848, 849, // 8 => 32 - 39 + 850, 851, 852, 854, 855, 856, 857, 858, 859, // 9 => 40 - 48 + 860, 861, 862, 863, 864, 865, 866 // 7 => 49 - 55 + */ + }; + if (vuListRunId.size() <= uRunIdx) return kFALSE; + + uRunId = vuListRunId[uRunIdx]; + } // if( 99999 != uRunIdx ) + + if (uRunId < 692 && 0 != uRunId) return kFALSE; + + return mcbm_event_reco(uRunId, nTimeslices, sInpDir, sOutDir); } diff --git a/macro/beamtime/mcbm2020/mcbm_reco.C b/macro/beamtime/mcbm2020/mcbm_reco.C index 8ac6d602..b9799220 100644 --- a/macro/beamtime/mcbm2020/mcbm_reco.C +++ b/macro/beamtime/mcbm2020/mcbm_reco.C @@ -5,8 +5,10 @@ // // -------------------------------------------------------------------------- - -void mcbm_reco(Int_t runId = 831, Int_t nTimeslices = 0) { +Bool_t mcbm_reco(UInt_t uRunId = 831, + Int_t nTimeslices = 0, + TString sInpDir = "./data", + TString sOutDir = "./data") { // --- Logger settings ---------------------------------------------------- TString logLevel = "INFO"; @@ -23,12 +25,23 @@ void mcbm_reco(Int_t runId = 831, Int_t nTimeslices = 0) { // ----- In- and output file names ------------------------------------ - TString inFile = Form("./data/unp_mcbm_%i.root", runId); - TString parFileIn = Form("./data/unp_mcbm_params_%i.root", runId); - TString parFileOut = Form("./data/reco_mcbm_params_%i.root", runId); - TString outFile = Form("./data/reco_mcbm_%i.root", runId); + TString inFile = sInpDir + Form("/unp_mcbm_%03u.root", uRunId); + TString parFileIn = sInpDir + Form("/unp_mcbm_params_%03u.root", uRunId); + TString parFileOut = sOutDir + Form("/reco_mcbm_params_%03u.root", uRunId); + TString outFile = sOutDir + Form("/reco_mcbm_%03u.root", uRunId); // ------------------------------------------------------------------------ + /* + std::cout << sInpDir << std::endl << sOutDir << std::endl; + std::cout << inFile << std::endl + << parFileIn << std::endl + << parFileOut << std::endl + << outFile << std::endl; + std::cout << uRunId << " " << nTimeslices << std::endl; + + return kTRUE; + */ + // --- Load the geometry setup ---- // This is currently only required by the TRD (parameters) std::string geoSetupTag = "mcbm_beam_2020_03"; @@ -287,4 +300,6 @@ void mcbm_reco(Int_t runId = 831, Int_t nTimeslices = 0) { /// --- Screen output for automatic tests std::cout << " Test passed" << std::endl; std::cout << " All ok " << std::endl; + + return kTRUE; } diff --git a/macro/beamtime/mcbm2020/mcbm_reco_kronos.C b/macro/beamtime/mcbm2020/mcbm_reco_kronos.C index 16c3edc1..d715b4e8 100644 --- a/macro/beamtime/mcbm2020/mcbm_reco_kronos.C +++ b/macro/beamtime/mcbm2020/mcbm_reco_kronos.C @@ -5,290 +5,42 @@ // // -------------------------------------------------------------------------- -void mcbm_reco_kronos(Int_t runId = 831, Int_t nTimeslices = 0) { - - // --- Logger settings ---------------------------------------------------- - TString logLevel = "INFO"; - TString logVerbosity = "LOW"; - // ------------------------------------------------------------------------ - - - // ----- Environment -------------------------------------------------- - TString myName = "mcbm_reco"; // this macro's name for screen output - TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory - TString paramDir = srcDir + "/macro/beamtime/mcbm2020/"; - TString parDir = srcDir + "/parameters"; - // ------------------------------------------------------------------------ - - - // ----- In- and output file names ------------------------------------ - TString inFile = Form("/lustre/cbm/users/ploizeau/mcbm2020/" - "unp_evt_data_7f229b3f_20201103/unp_mcbm_%i.root", - runId); - TString parFileIn = - Form("/lustre/cbm/users/ploizeau/mcbm2020/unp_evt_data_7f229b3f_20201103/" - "unp_mcbm_params_%i.root", - runId); - TString parFileOut = Form("./data/reco_mcbm_params_%i.root", runId); - TString outFile = Form("./data/reco_mcbm_%i.root", runId); - // ------------------------------------------------------------------------ - - // --- Load the geometry setup ---- - // This is currently only required by the TRD (parameters) - std::string geoSetupTag = "mcbm_beam_2020_03"; - TString geoFile = - paramDir + geoSetupTag.data() + ".geo.root"; // Created in sim. run - CbmSetup* geoSetup = CbmSetup::Instance(); - geoSetup->LoadSetup(geoSetupTag.data()); - TList* parFileList = new TList(); - // ------------------------------------------------------------------------ - - // ----- Timer -------------------------------------------------------- - TStopwatch timer; - timer.Start(); - // ------------------------------------------------------------------------ - - - // ----- FairRunAna --------------------------------------------------- - FairRunAna* run = new FairRunAna(); - FairFileSource* inputSource = new FairFileSource(inFile); - run->SetSource(inputSource); - - FairRootFileSink* outputSink = new FairRootFileSink(outFile); - run->SetSink(outputSink); - run->SetGeomFile(geoFile); - - // Define output file for FairMonitor histograms - TString monitorFile {outFile}; - monitorFile.ReplaceAll("reco", "reco.monitor"); - FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile); - // ------------------------------------------------------------------------ - - - // ----- Logger settings ---------------------------------------------- - FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); - FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data()); - // ------------------------------------------------------------------------ - - - // ----- Reconstruction tasks ----------------------------------------- - - // ----- Local reconstruction in MUCH --------------------------------- - Int_t flag = 1; - TString muchDigiFile( - parDir + "/much/much_v19c_mcbm_digi_sector.root"); // MUCH digi file - CbmMuchFindHitsGem* muchFindHits = - new CbmMuchFindHitsGem(muchDigiFile.Data(), flag); - muchFindHits->SetBeamTimeDigi(kTRUE); - run->AddTask(muchFindHits); - std::cout << "-I- : Added task " << muchFindHits->GetName() << std::endl; - //-------------------------------------------------------- - - // ----- Local reconstruction in STS ---------------------------------- - CbmRecoSts* recoSts = new CbmRecoSts(); - - //recoSts->SetTimeCutDigisAbs( 20 );// cluster finder: time cut in ns - //recoSts->SetTimeCutClustersAbs(20.); // hit finder: time cut in ns - - // ASIC params: #ADC channels, dyn. range, threshold, time resol., dead time, - // noise RMS, zero-threshold crossing rate - auto parAsic = - new CbmStsParAsic(32, 75000., 3000., 5., 800., 1000., 3.9789e-3); - - // Module params: number of channels, number of channels per ASIC - auto parMod = new CbmStsParModule(2048, 128); - parMod->SetAllAsics(*parAsic); - recoSts->UseModulePar(parMod); - - // Sensor params - auto sensorPar = new CbmStsParSensor(CbmStsSensorClass::kDssdStereo); - sensorPar->SetPar(0, 6.2092); // Extension in x - sensorPar->SetPar(1, 6.2); // Extension in y - sensorPar->SetPar(2, 0.03); // Extension in z - sensorPar->SetPar(3, 5.9692); // Active size in y - sensorPar->SetPar(4, 1024.); // Number of strips front side - sensorPar->SetPar(5, 1024.); // Number of strips back side - sensorPar->SetPar(6, 0.0058); // Strip pitch front side - sensorPar->SetPar(7, 0.0058); // Strip pitch back side - sensorPar->SetPar(8, 7.5); // Stereo angle front side - sensorPar->SetPar(9, 0.0); // Stereo angle back side - recoSts->UseSensorPar(sensorPar); - - // Sensor conditions: full depletion voltage, bias voltage, temperature, - // coupling capacitance, inter-strip capacitance - auto sensorCond = new CbmStsParSensorCond(70., 140., 268., 17.5, 1.); - recoSts->UseSensorCond(sensorCond); - - run->AddTask(recoSts); - std::cout << "-I- : Added task " << recoSts->GetName() << std::endl; - // ------------------------------------------------------------------------ - - - // ----- Local reconstruction in TRD ---------------------------------- - // Load parameters <- they are required by the hit producer. - // For now, it is enough to load the default ascii parameters - // if no root file is existing from the unpacking process. - TString geoTagTrd = ""; - bool isActiveTrd = - (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) ? true : false; - if (!isActiveTrd) { - LOG(warning) << Form( - "TRD - parameter loading - Trd not found in CbmSetup(%s) -> parameters " - "can not be loaded correctly!", - geoSetupTag.data()); - } else { - TString paramFilesTrd( - Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data())); - std::vector<std::string> paramFilesVecTrd; - CbmTrdParManager::GetParFileExtensions(¶mFilesVecTrd); - for (auto parIt : paramFilesVecTrd) { - parFileList->Add( - new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.data()))); - } - } - // -- end trd parameters - // -- beginn trd reco - Double_t triggerThreshold = 0.5e-6; // Default - 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; - // ------------------------------------------------------------------------ - - - // ----- Local reconstruction in TOF ---------------------------------- - // ------------------------------------------------------------------------ - // TOF defaults - Int_t calMode = 93; - Int_t calSel = 1; - Int_t calSm = 0; - Int_t RefSel = 0; - Double_t dDeadtime = 50.; - Int_t iSel2 = 500; - TString TofGeoTag = "v20f_mcbm"; - TString cCalId = "831.50.3.0"; - Int_t iCalSet = 12022500; // calibration settings - - TObjString* tofBdfFile = - new TObjString(parDir + "/tof/tof_" + TofGeoTag + ".digibdf.par"); - parFileList->Add(tofBdfFile); - std::cout << "-I- Using parameter file " << tofBdfFile->GetString() - << std::endl; - - CbmTofEventClusterizer* tofCluster = - new CbmTofEventClusterizer("TOF Event Clusterizer", 0, 1); - TString cFname = parDir + "/tof/" - + Form("%s_set%09d_%02d_%01dtofClust.hst.root", - cCalId.Data(), - iCalSet, - calMode, - calSel); - tofCluster->SetCalParFileName(cFname); - tofCluster->SetCalMode(calMode); - tofCluster->SetCalSel(calSel); - tofCluster->PosYMaxScal(0.75); //in % of 2*length - tofCluster->SetChannelDeadtime(dDeadtime); // artificial deadtime in ns - - run->AddTask(tofCluster); - std::cout << "-I- Added task " << tofCluster->GetName() << std::endl; - - // ----- Local reconstruction of RICH Hits ------------------------------ - 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); - // ------------------------------------------------------------------------ - - // ----- Local reconstruction in RICh -> Finding of Rings --------------- - CbmRichReconstruction* richReco = new CbmRichReconstruction(); - richReco->UseMCbmSetup(); - run->AddTask(richReco); - // ------------------------------------------------------------------------ - - - // ----- Psd hit producer ---------------------------------------------- - CbmPsdMCbmHitProducer* hitProdPsd = new CbmPsdMCbmHitProducer(); - run->AddTask(hitProdPsd); - // ------------------------------------------------------------------------ - - - // ----- 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(); - FairParRootFileIo* parIo3 = new FairParRootFileIo(); - parIo1->open(parFileIn.Data(), "READ"); - rtdb->setFirstInput(parIo1); - parIo2->open(parFileList, "in"); - rtdb->setSecondInput(parIo2); - parIo3->open(parFileOut.Data(), "RECREATE"); - // ------------------------------------------------------------------------ - - - // ----- Run initialisation ------------------------------------------- - std::cout << std::endl; - std::cout << "-I- " << myName << ": Initialise run" << std::endl; - run->Init(); - rtdb->setOutput(parIo3); - 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 " << parFileOut << std::endl; - std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s" - << std::endl; - std::cout << 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(); - // ------------------------------------------------------------------------ - - /// --- Screen output for automatic tests - std::cout << " Test passed" << std::endl; - std::cout << " All ok " << std::endl; +#include "mcbm_reco.C" + +Bool_t mcbm_reco_kronos(UInt_t uRunIdx = 28, + Int_t nTimeslices = 0, + TString sInpDir = "/lustre/cbm/users/ploizeau/mcbm2020/" + "unp_evt_data_7f229b3f_20201103", + TString sOutDir = "./data") { + UInt_t uRunId = 0; + + if (99999 != uRunIdx) { + std::vector<UInt_t> vuListRunId = { + 692, 698, 702, 704, 705, 706, 707, // 7 => 0 - 6 + 744, 750, 759, 760, 761, 762, 799, // 7 => 7 - 13 + 811, 812, 816, 817, 819, // 5 => 14 - 18 + 820, 821, 822, 824, 826, 827, 828, 829, // 8 => 19 - 26 + 830, 831, 836, // 3 => 27 - 29 + 841, 846, 849, // 3 => 30 - 32 + 850, 851, 852, 854, 855, 856, 857, 858, 859, // 9 => 33 - 41 + 860, 861, 862, 863, 864, 865, 866 // 7 => 42 - 48 + + /* + /// With runs < 1 min due to missmatch! + 811, 812, 816, 817, 818, 819, // 6 => 14 - 19 + 820, 821, 822, 824, 826, 827, 828, 829, // 8 => 20 - 27 + 830, 831, 836, 839, // 4 => 28 - 31 + 840, 841, 842, 844, 845, 846, 848, 849, // 8 => 32 - 39 + 850, 851, 852, 854, 855, 856, 857, 858, 859, // 9 => 40 - 48 + 860, 861, 862, 863, 864, 865, 866 // 7 => 49 - 55 + */ + }; + if (vuListRunId.size() <= uRunIdx) return kFALSE; + + uRunId = vuListRunId[uRunIdx]; + } // if( 99999 != uRunIdx ) + + if (uRunId < 692 && 0 != uRunId) return kFALSE; + + return mcbm_reco(uRunId, nTimeslices, sInpDir, sOutDir); } diff --git a/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C b/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C index 89caf645..c3ad3517 100644 --- a/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C +++ b/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C @@ -10,20 +10,25 @@ // In order to call later Finish, we make this global FairRunOnline* run = NULL; -void unpack_tsa_mcbm(TString inFile = "", - UInt_t uRunId = 0, - UInt_t nrEvents = 0, - TString outDir = "data", - TString inDir = "") { +Bool_t unpack_tsa_mcbm(TString inFile = "", + UInt_t uRunId = 0, + UInt_t uNbTimeslices = 0, + TString sOutDir = "data") { TString srcDir = gSystem->Getenv("VMCWORKDIR"); - // --- Specify number of events to be produced. - // --- -1 means run until the end of the input file. - Int_t nEvents = -1; // --- Specify output file name (this is just an example) TString runId = TString::Format("%03u", uRunId); - TString outFile = outDir + "/unp_mcbm_" + runId + ".root"; - TString parFile = outDir + "/unp_mcbm_params_" + runId + ".root"; + TString outFile = sOutDir + "/unp_mcbm_" + runId + ".root"; + TString parFile = sOutDir + "/unp_mcbm_params_" + runId + ".root"; + + /* + std::cout << inFile << std::endl << sOutDir << std::endl; + std::cout << parFile << std::endl + << outFile << std::endl; + std::cout << uRunId << " " << uNbTimeslices << std::endl; + + return kTRUE; + */ // --- Set log output levels FairLogger::GetLogger(); @@ -620,10 +625,10 @@ void unpack_tsa_mcbm(TString inFile = "", TStopwatch timer; timer.Start(); std::cout << ">>> unpack_tsa_mcbm: Starting run..." << std::endl; - if (0 == nrEvents) { - run->Run(nEvents, 0); // run until end of input file + if (0 == uNbTimeslices) { + run->Run(-1, 0); // run until end of input file } else { - run->Run(0, nrEvents); // process N Events + run->Run(0, uNbTimeslices); // process N Timeslices } run->Finish(); diff --git a/macro/beamtime/mcbm2020/unpack_tsa_mcbm_kronos.C b/macro/beamtime/mcbm2020/unpack_tsa_mcbm_kronos.C index 964fbfd0..a441ed7d 100644 --- a/macro/beamtime/mcbm2020/unpack_tsa_mcbm_kronos.C +++ b/macro/beamtime/mcbm2020/unpack_tsa_mcbm_kronos.C @@ -7,12 +7,11 @@ ** Convert data into cbmroot format. ** Uses CbmMcbm2018Source as source task. */ -// In order to call later Finish, we make this global -FairRunOnline* run = NULL; +#include "unpack_tsa_mcbm.C" -void unpack_tsa_mcbm_kronos(UInt_t uRunIdx = 99999, - UInt_t nrEvents = 0, - TString outDir = "data") { +Bool_t unpack_tsa_mcbm_kronos(UInt_t uRunIdx = 28, + UInt_t uNbTimeslices = 0, + TString sOutDir = "data") { UInt_t uRunId = 0; if (99999 != uRunIdx) { std::vector<UInt_t> vuListRunId = { @@ -41,569 +40,7 @@ void unpack_tsa_mcbm_kronos(UInt_t uRunIdx = 99999, uRunId = vuListRunId[uRunIdx]; } // if( 99999 != uRunIdx ) - if (uRunId < 692 && 0 != uRunId) return kFALSE; - - TString srcDir = gSystem->Getenv("VMCWORKDIR"); - - // --- Specify number of events to be produced. - // --- -1 means run until the end of the input file. - Int_t nEvents = -1; - // --- Specify output file name (this is just an example) - TString runId = TString::Format("%03u", uRunId); - TString outFile = outDir + "/unp_mcbm_" + runId + ".root"; - TString parFile = outDir + "/unp_mcbm_params_" + runId + ".root"; - - // --- Set log output levels - FairLogger::GetLogger(); - gLogger->SetLogScreenLevel("INFO"); - //gLogger->SetLogScreenLevel("DEBUG4"); - gLogger->SetLogVerbosityLevel("MEDIUM"); - //gLogger->SetLogVerbosityLevel("LOW"); - - // --- Define parameter files - TList* parFileList = new TList(); - TString paramDir = srcDir + "/macro/beamtime/mcbm2020/"; - - // --- Load the geometry setup ---- - // This is currently only required by the TRD - std::string geoSetupTag = "mcbm_beam_2020_03"; - CbmSetup* geoSetup = CbmSetup::Instance(); - geoSetup->LoadSetup(geoSetupTag.data()); - - TString paramFileSts = paramDir + "mStsPar.par"; - TObjString* parStsFileName = new TObjString(paramFileSts); - parFileList->Add(parStsFileName); - - TString paramFileMuch = paramDir + "mMuchPar.par"; - TObjString* parMuchFileName = new TObjString(paramFileMuch); - parFileList->Add(parMuchFileName); - - // ---- Trd ---- - TString geoTagTrd = ""; - bool isActiveTrd = - (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) ? true : false; - if (!isActiveTrd) { - LOG(warning) << Form( - "TRD - parameter loading - Trd not found in CbmSetup(%s) -> parameters " - "can not be loaded correctly!", - geoSetupTag.data()); - } else { - TString paramFilesTrd( - Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data())); - std::vector<std::string> paramFilesVecTrd; - CbmTrdParManager::GetParFileExtensions(¶mFilesVecTrd); - for (auto parIt : paramFilesVecTrd) { - parFileList->Add( - new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.data()))); - } - // Add timeshift calibration, currently only available for run 831 others to come - if (uRunId == 831) - parFileList->Add(new TObjString(Form( - "%s/parameters/trd/mcbm2020_special/CbmMcbm2020TrdTshiftPar_run%d.par", - srcDir.Data(), - uRunId))); - } - - TString paramFileTof = paramDir + "mTofPar.par"; - if (uRunId >= 708 && uRunId < 754) - paramFileTof = paramDir + "mTofPar_2Stack.par"; - else if (uRunId >= 754) - paramFileTof = paramDir + "mTofPar_3Stack.par"; - - TObjString* parTofFileName = new TObjString(paramFileTof); - parFileList->Add(parTofFileName); - - TString paramFileRich = paramDir + "mRichPar.par"; - if (uRunId > 698) paramFileRich = paramDir + "mRichPar_70.par"; - TObjString* parRichFileName = new TObjString(paramFileRich); - parFileList->Add(parRichFileName); - - TString paramFilePsd = paramDir + "mPsdPar.par"; - TObjString* parPsdFileName = new TObjString(paramFilePsd); - parFileList->Add(parPsdFileName); - - // --- Set debug level - gDebug = 0; - - std::cout << std::endl; - std::cout << ">>> unpack_tsa: output file is " << outFile << std::endl; - - // ======================================================================== - // ======================================================================== - std::cout << std::endl; - std::cout << ">>> unpack_tsa: Initialising..." << std::endl; - - CbmMcbm2018UnpackerTaskSts* unpacker_sts = new CbmMcbm2018UnpackerTaskSts(); - CbmMcbm2018UnpackerTaskMuch* unpacker_much = - new CbmMcbm2018UnpackerTaskMuch(); - CbmMcbm2018UnpackerTaskTrdR* unpacker_trdR = - new CbmMcbm2018UnpackerTaskTrdR(); - CbmMcbm2018UnpackerTaskTof* unpacker_tof = new CbmMcbm2018UnpackerTaskTof(); - CbmMcbm2018UnpackerTaskRich* unpacker_rich = - new CbmMcbm2018UnpackerTaskRich(); - CbmMcbm2018UnpackerTaskPsd* unpacker_psd = new CbmMcbm2018UnpackerTaskPsd(); - - /* - * Do not generate plots by default - unpacker_sts ->SetMonitorMode(); - unpacker_much->SetMonitorMode(); - unpacker_trdR->SetMonitorMode(); // Assume histo server present, not like other unpackers - unpacker_tof ->SetMonitorMode(); - unpacker_rich->SetMonitorMode(); - unpacker_psd->SetMonitorMode(); -*/ - - unpacker_sts->SetIgnoreOverlapMs(); - unpacker_much->SetIgnoreOverlapMs(); - // unpacker_trdR ->SetIgnoreOverlapMs(); /// Default is kTRUE - unpacker_tof->SetIgnoreOverlapMs(); - unpacker_rich->SetIgnoreOverlapMs(); - unpacker_psd->SetIgnoreOverlapMs(); - - /// Starting from first run on Tuesday 28/04/2020, STS uses bin sorter FW - if (692 <= uRunId) unpacker_sts->SetBinningFwFlag(kTRUE); - /// Starting from first run on Monday 04/05/2020, MUCH uses bin sorter FW - if (811 <= uRunId) unpacker_much->SetBinningFwFlag(kTRUE); - - /// FIXME: Disable clang formatting for parameters tuning for now - /* clang-format off */ - // unpacker_sts ->SetAdcCut( 3 ); - unpacker_sts ->MaskNoisyChannel(1,768 , true ); - unpacker_sts ->MaskNoisyChannel(1,894 , true ); - unpacker_sts ->MaskNoisyChannel(1,896 , true ); - - unpacker_sts ->MaskNoisyChannel(2,930 , true ); - unpacker_sts ->MaskNoisyChannel(2,926 , true ); - unpacker_sts ->MaskNoisyChannel(2,892 , true ); - - unpacker_sts ->MaskNoisyChannel(3,770 , true ); - - unpacker_tof->SetSeparateArrayT0(); - - // ------------------------------ // - // Enable Asic type for MUCH data. - // fFlag = 0 ==> Asic type 2.0 (20) ---> December 2018 and March 2019 Data - // fFlag = 1 ==> Asic type 2.1 (21) ---> December 2019 Data - // This is to correct the channel fliping problem in smx 2.1 chip - Int_t fFlag = 1; - unpacker_much->EnableAsicType(fFlag); - // ------------------------------ // - - /// General System offsets (= offsets between sub-systems) - unpacker_sts->SetTimeOffsetNs(-936); // Run 811-866 - unpacker_much->SetTimeOffsetNs(-885); // Run 811-866 - unpacker_trdR->SetTimeOffsetNs(0); // Run 811-866 - unpacker_tof->SetTimeOffsetNs(30); // Run 811-866 - unpacker_rich->SetTimeOffsetNs(-310); // Run 811-866 - unpacker_psd->SetTimeOffsetNs(-225); // Run 811-866 -// ----------- ASIC by ASIC STS ---------------- - // the first 8 Unused - unpacker_sts ->SetTimeOffsetNsAsic( 0, 0.0 ); // Unused - unpacker_sts ->SetTimeOffsetNsAsic( 1, 0.0 ); // Unused - unpacker_sts ->SetTimeOffsetNsAsic( 2, 0.0 ); // Unused - unpacker_sts ->SetTimeOffsetNsAsic( 3, 0.0 ); // Unused - unpacker_sts ->SetTimeOffsetNsAsic( 4, 0.0 ); // Unused - unpacker_sts ->SetTimeOffsetNsAsic( 5, 0.0 ); // Unused - unpacker_sts ->SetTimeOffsetNsAsic( 6, 0.0 ); // Unused - unpacker_sts ->SetTimeOffsetNsAsic( 7, 0.0 ); // Unused - // - unpacker_sts ->SetTimeOffsetNsAsic(8, -0.360078 ); - unpacker_sts ->SetTimeOffsetNsAsic(9, 2.73976 ); - unpacker_sts ->SetTimeOffsetNsAsic(10, -0.507079 ); - unpacker_sts ->SetTimeOffsetNsAsic(11, 1.74695 ); - unpacker_sts ->SetTimeOffsetNsAsic(12, -0.909864 ); - unpacker_sts ->SetTimeOffsetNsAsic(13, -0.255514 ); - unpacker_sts ->SetTimeOffsetNsAsic(14, 1.44034 ); - unpacker_sts ->SetTimeOffsetNsAsic(15, 2.64009 ); - // this side: revert order 23->16 - unpacker_sts ->SetTimeOffsetNsAsic(23, -0.442762 ); - unpacker_sts ->SetTimeOffsetNsAsic(22, 1.76543 ); - unpacker_sts ->SetTimeOffsetNsAsic(21, -0.94728 ); - unpacker_sts ->SetTimeOffsetNsAsic(20, -2.18516 ); - unpacker_sts ->SetTimeOffsetNsAsic(19, -0.68254 ); - unpacker_sts ->SetTimeOffsetNsAsic(18, -2.32241 ); - unpacker_sts ->SetTimeOffsetNsAsic(17, -1.53483 ); - unpacker_sts ->SetTimeOffsetNsAsic(16, -2.12455 ); - // - unpacker_sts ->SetTimeOffsetNsAsic(24, -0.41084 ); - unpacker_sts ->SetTimeOffsetNsAsic(25, 0.230455 ); - unpacker_sts ->SetTimeOffsetNsAsic(26, -0.206921 ); - unpacker_sts ->SetTimeOffsetNsAsic(27, 0.0913657 ); - unpacker_sts ->SetTimeOffsetNsAsic(28, -0.17252 ); - unpacker_sts ->SetTimeOffsetNsAsic(29, -0.32990 ); - unpacker_sts ->SetTimeOffsetNsAsic(30, 1.43535 ); - unpacker_sts ->SetTimeOffsetNsAsic(31, -0.155741 ); - // this side: revert order 39->32 - unpacker_sts ->SetTimeOffsetNsAsic(39, 1.53865 ); - unpacker_sts ->SetTimeOffsetNsAsic(38, 3.6318 ); - unpacker_sts ->SetTimeOffsetNsAsic(37, 1.3153 ); - unpacker_sts ->SetTimeOffsetNsAsic(36, -1.90278 ); - unpacker_sts ->SetTimeOffsetNsAsic(35, 2.00051 ); - unpacker_sts ->SetTimeOffsetNsAsic(34, -2.85656 ); - unpacker_sts ->SetTimeOffsetNsAsic(33, 1.28834 ); - unpacker_sts ->SetTimeOffsetNsAsic(32, 0.657113 ); - - switch (uRunId) { - case 707: { - /// General System offsets (= offsets between sub-systems) - //unpacker_sts ->SetTimeOffsetNs( -1750 ); // Run 707 - //unpacker_much->SetTimeOffsetNs( -1750 ); // Run 707 - - /// ASIC specific offsets (= offsets inside sub-system) - unpacker_much->SetTimeOffsetNsAsic(0, 0.0); // Run 707, DPB 0 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(1, 0.0); // Run 707, DPB 0 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(2, 0.0); // Run 707, DPB 0 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(3, 0.0); // Run 707, DPB 0 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(4, 0.0); // Run 707, DPB 0 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(5, 0.0); // Run 707, DPB 0 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(6, 0.0); // Run 707, DPB 1 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(7, 0.0); // Run 707, DPB 1 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(8, 0.0); // Run 707, DPB 1 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(9, 0.0); // Run 707, DPB 1 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(10, 0.0); // Run 707, DPB 1 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(11, 0.0); // Run 707, DPB 1 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(12, 0.0); // Run 707, DPB 2 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(13, 0.0); // Run 707, DPB 2 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(14, 0.0); // Run 707, DPB 2 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(15, 0.0); // Run 707, DPB 2 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(16, 0.0); // Run 707, DPB 2 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(17, 0.0); // Run 707, DPB 2 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(18, 9590.0); // Run 707, DPB 3 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(19, 9590.0); // Run 707, DPB 3 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(20, 9630.0); // Run 707, DPB 3 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(21, 9590.0); // Run 707, DPB 3 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(22, 0.0); // Run 707, DPB 3 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(23, 0.0); // Run 707, DPB 3 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(24, 0.0); // Run 707, DPB 4 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(25, 0.0); // Run 707, DPB 4 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(26, 0.0); // Run 707, DPB 4 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(27, 0.0); // Run 707, DPB 4 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(28, 0.0); // Run 707, DPB 4 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(29, 0.0); // Run 707, DPB 4 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(30, 0.0); // Run 707, DPB 5 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(31, 0.0); // Run 707, DPB 5 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(32, 7170.0); // Run 707, DPB 5 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(33, 7170.0); // Run 707, DPB 5 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(34, 0.0); // Run 707, DPB 5 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(35, 0.0); // Run 707, DPB 5 ASIC 5 - break; - } // 707 - case 750: { - /// General System offsets (= offsets between sub-systems) - //unpacker_sts ->SetTimeOffsetNs( -1750 ); // Run 750 - //unpacker_much->SetTimeOffsetNs( -1750 ); // Run 750 - - /// ASIC specific offsets (= offsets inside sub-system) - unpacker_much->SetTimeOffsetNsAsic(0, 0.0); // Run 750, DPB 0 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(1, 0.0); // Run 750, DPB 0 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(2, 0.0); // Run 750, DPB 0 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(3, 0.0); // Run 750, DPB 0 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(4, 0.0); // Run 750, DPB 0 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(5, 0.0); // Run 750, DPB 0 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(6, 0.0); // Run 750, DPB 1 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(7, 0.0); // Run 750, DPB 1 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(8, 0.0); // Run 750, DPB 1 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(9, 0.0); // Run 750, DPB 1 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(10, 0.0); // Run 750, DPB 1 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(11, 0.0); // Run 750, DPB 1 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(12, 0.0); // Run 750, DPB 2 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(13, 0.0); // Run 750, DPB 2 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(14, 0.0); // Run 750, DPB 2 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(15, 0.0); // Run 750, DPB 2 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(16, 0.0); // Run 750, DPB 2 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(17, 0.0); // Run 750, DPB 2 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(18, 6400.0); // Run 750, DPB 3 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(19, 6400.0); // Run 750, DPB 3 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(20, 6400.0); // Run 750, DPB 3 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(21, 6400.0); // Run 750, DPB 3 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(22, 0.0); // Run 750, DPB 3 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(23, 0.0); // Run 750, DPB 3 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(24, 0.0); // Run 750, DPB 4 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(25, 0.0); // Run 750, DPB 4 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(26, 0.0); // Run 750, DPB 4 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(27, 0.0); // Run 750, DPB 4 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(28, 0.0); // Run 750, DPB 4 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(29, 0.0); // Run 750, DPB 4 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(30, 0.0); // Run 750, DPB 5 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(31, 0.0); // Run 750, DPB 5 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(32, 3170.0); // Run 750, DPB 5 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(33, 3170.0); // Run 750, DPB 5 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(34, 0.0); // Run 750, DPB 5 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(35, 0.0); // Run 750, DPB 5 ASIC 5 - break; - } // 750 - case 759: { - /// General System offsets (= offsets between sub-systems) - //unpacker_sts ->SetTimeOffsetNs( -1759 ); // Run 759 - //unpacker_much->SetTimeOffsetNs( -1759 ); // Run 759 - unpacker_trdR->SetTimeOffsetNs(190); // Run 759 - - /// ASIC specific offsets (= offsets inside sub-system) - unpacker_much->SetTimeOffsetNsAsic(0, 0.0); // Run 759, DPB 0 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(1, 0.0); // Run 759, DPB 0 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(2, 0.0); // Run 759, DPB 0 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(3, 0.0); // Run 759, DPB 0 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(4, 0.0); // Run 759, DPB 0 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(5, 0.0); // Run 759, DPB 0 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(6, 0.0); // Run 759, DPB 1 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(7, 0.0); // Run 759, DPB 1 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(8, 0.0); // Run 759, DPB 1 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(9, 0.0); // Run 759, DPB 1 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(10, 0.0); // Run 759, DPB 1 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(11, 0.0); // Run 759, DPB 1 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(12, 0.0); // Run 759, DPB 2 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(13, 0.0); // Run 759, DPB 2 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(14, 0.0); // Run 759, DPB 2 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(15, 0.0); // Run 759, DPB 2 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(16, 0.0); // Run 759, DPB 2 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(17, 0.0); // Run 759, DPB 2 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(18, 3200.0); // Run 759, DPB 3 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(19, 3200.0); // Run 759, DPB 3 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(20, 3200.0); // Run 759, DPB 3 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(21, 3200.0); // Run 759, DPB 3 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(22, 0.0); // Run 759, DPB 3 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(23, 0.0); // Run 759, DPB 3 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(24, 3200.0); // Run 759, DPB 4 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(25, 3200.0); // Run 759, DPB 4 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(26, 3200.0); // Run 759, DPB 4 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(27, 0.0); // Run 759, DPB 4 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(28, 0.0); // Run 759, DPB 4 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(29, 0.0); // Run 759, DPB 4 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(30, 0.0); // Run 759, DPB 5 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(31, 0.0); // Run 759, DPB 5 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(32, -30.0); // Run 759, DPB 5 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(33, -30.0); // Run 759, DPB 5 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(34, 0.0); // Run 759, DPB 5 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(35, 0.0); // Run 759, DPB 5 ASIC 5 - break; - } // 759 - case 760: { - /// General System offsets (= offsets between sub-systems) - //unpacker_sts ->SetTimeOffsetNs( -1760 ); // Run 760 - //unpacker_much->SetTimeOffsetNs( -1760 ); // Run 760 - unpacker_trdR->SetTimeOffsetNs(-75); // Run 760 - - /// ASIC specific offsets (= offsets inside sub-system) - unpacker_much->SetTimeOffsetNsAsic(0, 0.0); // Run 760, DPB 0 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(1, 0.0); // Run 760, DPB 0 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(2, 0.0); // Run 760, DPB 0 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(3, 0.0); // Run 760, DPB 0 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(4, 0.0); // Run 760, DPB 0 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(5, 0.0); // Run 760, DPB 0 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(6, 0.0); // Run 760, DPB 1 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(7, 0.0); // Run 760, DPB 1 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(8, 0.0); // Run 760, DPB 1 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(9, 0.0); // Run 760, DPB 1 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(10, 0.0); // Run 760, DPB 1 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(11, 0.0); // Run 760, DPB 1 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(12, 0.0); // Run 760, DPB 2 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(13, 0.0); // Run 760, DPB 2 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(14, 0.0); // Run 760, DPB 2 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(15, 0.0); // Run 760, DPB 2 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(16, 0.0); // Run 760, DPB 2 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(17, 0.0); // Run 760, DPB 2 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(18, 0.0); // Run 760, DPB 3 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(19, 0.0); // Run 760, DPB 3 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(20, 0.0); // Run 760, DPB 3 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(21, 0.0); // Run 760, DPB 3 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(22, 0.0); // Run 760, DPB 3 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(23, 0.0); // Run 760, DPB 3 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(24, 3160.0); // Run 760, DPB 4 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(25, 3160.0); // Run 760, DPB 4 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(26, 3160.0); // Run 760, DPB 4 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(27, 0.0); // Run 760, DPB 4 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(28, 0.0); // Run 760, DPB 4 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(29, 0.0); // Run 760, DPB 4 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(30, 0.0); // Run 760, DPB 5 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(31, 0.0); // Run 760, DPB 5 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(32, -30.0); // Run 760, DPB 5 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(33, -30.0); // Run 760, DPB 5 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(34, 0.0); // Run 760, DPB 5 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(35, 0.0); // Run 760, DPB 5 ASIC 5 - break; - } // 760 - case 761: { - /// General System offsets (= offsets between sub-systems) - //unpacker_sts ->SetTimeOffsetNs( -1761 ); // Run 761 - //unpacker_much->SetTimeOffsetNs( -1761 ); // Run 761 - unpacker_trdR->SetTimeOffsetNs(90); // Run 761 - - /// ASIC specific offsets (= offsets inside sub-system) - unpacker_much->SetTimeOffsetNsAsic(0, 0.0); // Run 761, DPB 0 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(1, 0.0); // Run 761, DPB 0 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(2, 0.0); // Run 761, DPB 0 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(3, 0.0); // Run 761, DPB 0 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(4, 0.0); // Run 761, DPB 0 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(5, 0.0); // Run 761, DPB 0 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(6, 0.0); // Run 761, DPB 1 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(7, 0.0); // Run 761, DPB 1 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(8, 0.0); // Run 761, DPB 1 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(9, 0.0); // Run 761, DPB 1 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(10, 0.0); // Run 761, DPB 1 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(11, 0.0); // Run 761, DPB 1 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(12, 0.0); // Run 761, DPB 2 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(13, 0.0); // Run 761, DPB 2 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(14, 0.0); // Run 761, DPB 2 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(15, 0.0); // Run 761, DPB 2 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(16, 0.0); // Run 761, DPB 2 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(17, 0.0); // Run 761, DPB 2 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(18, 3200.0); // Run 761, DPB 3 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(19, 3200.0); // Run 761, DPB 3 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(20, 3200.0); // Run 761, DPB 3 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(21, 3200.0); // Run 761, DPB 3 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(22, 0.0); // Run 761, DPB 3 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(23, 0.0); // Run 761, DPB 3 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(24, 6360.0); // Run 761, DPB 4 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(25, 6360.0); // Run 761, DPB 4 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(26, 6360.0); // Run 761, DPB 4 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(27, 0.0); // Run 761, DPB 4 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(28, 0.0); // Run 761, DPB 4 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(29, 0.0); // Run 761, DPB 4 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(30, 0.0); // Run 761, DPB 5 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(31, 0.0); // Run 761, DPB 5 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(32, 6360.0); // Run 761, DPB 5 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(33, 6360.0); // Run 761, DPB 5 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(34, 0.0); // Run 761, DPB 5 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(35, 0.0); // Run 761, DPB 5 ASIC 5 - break; - } // 761 - case 762: { - /// General System offsets (= offsets between sub-systems) - //unpacker_sts ->SetTimeOffsetNs( -1762 ); // Run 762 - //unpacker_much->SetTimeOffsetNs( -1762 ); // Run 762 - unpacker_trdR->SetTimeOffsetNs(60); // Run 762 - - /// ASIC specific offsets (= offsets inside sub-system) - unpacker_much->SetTimeOffsetNsAsic(0, 0.0); // Run 762, DPB 0 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(1, 0.0); // Run 762, DPB 0 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(2, 0.0); // Run 762, DPB 0 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(3, 0.0); // Run 762, DPB 0 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(4, 0.0); // Run 762, DPB 0 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(5, 0.0); // Run 762, DPB 0 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(6, 0.0); // Run 762, DPB 1 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(7, 0.0); // Run 762, DPB 1 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(8, 0.0); // Run 762, DPB 1 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(9, 0.0); // Run 762, DPB 1 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(10, 0.0); // Run 762, DPB 1 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(11, 0.0); // Run 762, DPB 1 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(12, 0.0); // Run 762, DPB 2 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(13, 0.0); // Run 762, DPB 2 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(14, 0.0); // Run 762, DPB 2 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(15, 0.0); // Run 762, DPB 2 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(16, 0.0); // Run 762, DPB 2 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(17, 0.0); // Run 762, DPB 2 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(18, 4800.0); // Run 762, DPB 3 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(19, 4800.0); // Run 762, DPB 3 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(20, 4800.0); // Run 762, DPB 3 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(21, 4800.0); // Run 762, DPB 3 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(22, 0.0); // Run 762, DPB 3 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(23, 0.0); // Run 762, DPB 3 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(24, 9550.0); // Run 762, DPB 4 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(25, 9550.0); // Run 762, DPB 4 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(26, 9550.0); // Run 762, DPB 4 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(27, 0.0); // Run 762, DPB 4 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(28, 0.0); // Run 762, DPB 4 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(29, 0.0); // Run 762, DPB 4 ASIC 5 - unpacker_much->SetTimeOffsetNsAsic(30, 0.0); // Run 762, DPB 5 ASIC 0 - unpacker_much->SetTimeOffsetNsAsic(31, 0.0); // Run 762, DPB 5 ASIC 1 - unpacker_much->SetTimeOffsetNsAsic(32, -30.0); // Run 762, DPB 5 ASIC 2 - unpacker_much->SetTimeOffsetNsAsic(33, -30.0); // Run 762, DPB 5 ASIC 3 - unpacker_much->SetTimeOffsetNsAsic(34, 0.0); // Run 762, DPB 5 ASIC 4 - unpacker_much->SetTimeOffsetNsAsic(35, 0.0); // Run 762, DPB 5 ASIC 5 - break; - } // 762 - case 811: { - unpacker_trdR->SetTimeOffsetNs(84.38); - break; - } // 811 - case 812: { - unpacker_trdR->SetTimeOffsetNs(165.62); - break; - } // 812 - case 816: { - unpacker_trdR->SetTimeOffsetNs(-9.38); - break; - } // 816 - case 819: { - unpacker_trdR->SetTimeOffsetNs(-140.62); - break; - } // 819 - case 820: { - unpacker_trdR->SetTimeOffsetNs(109.38); - break; - } // 820 - case 821: { - unpacker_trdR->SetTimeOffsetNs(-65.62); - break; - } // 821 - case 822: { - unpacker_trdR->SetTimeOffsetNs(59.38); - break; - } // 822 - case 824: { - unpacker_trdR->SetTimeOffsetNs(-165.62); - break; - } // 824 - case 826: { - unpacker_trdR->SetTimeOffsetNs(59.38); - break; - } // 826 - case 827: { - unpacker_trdR->SetTimeOffsetNs(-15.62); - break; - } // 827 - case 828: { - unpacker_trdR->SetTimeOffsetNs(-109.38); - break; - } // 828 - case 830: { - unpacker_trdR->SetTimeOffsetNs(15.62); - break; - } // 830 - case 831: { - // unpacker_trdR->SetTimeOffsetNs( 70.00 ); - unpacker_trdR->SetTimeOffsetNs(-25.00); - - std::cout << "MUCH: Feb by feb time offset correction......" << std::endl; - UInt_t uRun, uNx; - Double_t offset; - ifstream infile_off(paramDir + "/parameters/time_offset_much.txt"); - if (!infile_off) { - std::cout << "can not open time offset MUCH parameter List" << std::endl; - return kFALSE; - } // if (!infile_off) - while (!infile_off.eof()) { - infile_off >> uRun >> uNx >> offset; - if(uRun != 831) continue; - unpacker_much->SetTimeOffsetNsAsic(uNx, offset); - } // while (!infile_off.eof()) - infile_off.close(); - std::cout << "masking noisy channels......" << std::endl; - UInt_t uChan = 0; - ifstream infile_noise(paramDir + "parameters/much_noisy_channel_list.txt"); - if (!infile_noise) { - std::cout << "can not open MUCH noisy channel List" << std::endl; - return kFALSE; - } // if (!infile_noise) - while (!infile_noise.eof()) { - infile_noise >> uRun >> uNx >> uChan; - if(uRun != 831) continue; - unpacker_much->MaskNoisyChannel(uNx, uChan, kTRUE ); - } // while (!infile_noise.eof()) - infile_noise.close(); - break; - } // 831 - case 836: { - unpacker_trdR->SetTimeOffsetNs(-40.62); - break; - } // 836 - default: break; - } // switch( uRunId ) - /// FIXME: Re-enable clang formatting after parameters tuning - /* clang-format on */ - // --- Source task - CbmMcbm2018Source* source = new CbmMcbm2018Source(); - source->SetWriteOutputFlag(kTRUE); // For writing TS metadata + if (uRunId < 692) return kFALSE; TString inFile = Form("/lustre/cbm/users/ploizeau/mcbm2020/data/%3u_pn02_*.tsa;", uRunId); @@ -626,72 +63,5 @@ void unpack_tsa_mcbm_kronos(UInt_t uRunIdx = 99999, inFile += Form("/lustre/cbm/users/ploizeau/mcbm2020/data/%3u_pn15_*.tsa", uRunId); - source->SetFileName(inFile); - - source->AddUnpacker(unpacker_sts, 0x10, ECbmModuleId::kSts); // STS xyter - source->AddUnpacker(unpacker_much, 0x50, ECbmModuleId::kMuch); // MUCH xyter - if (isActiveTrd) - source->AddUnpacker(unpacker_trdR, 0x40, ECbmModuleId::kTrd); // Trd - source->AddUnpacker(unpacker_tof, 0x60, ECbmModuleId::kTof); // gDPB TOF - source->AddUnpacker(unpacker_tof, 0x90, ECbmModuleId::kTof); // gDPB T0 - source->AddUnpacker(unpacker_rich, 0x30, ECbmModuleId::kRich); // RICH trb - source->AddUnpacker(unpacker_psd, 0x80, ECbmModuleId::kPsd); // PSD - - // --- Event header - FairEventHeader* event = new FairEventHeader(); - event->SetRunId(uRunId); - - // --- RootFileSink - // --- Open next outputfile after 4GB - FairRootFileSink* sink = new FairRootFileSink(outFile); - // sink->GetOutTree()->SetMaxTreeSize(4294967295LL); - - // --- Run - run = new FairRunOnline(source); - run->SetSink(sink); - run->SetEventHeader(event); - run->SetAutoFinish(kFALSE); - - - // ----- Runtime database --------------------------------------------- - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - Bool_t kParameterMerged = kTRUE; - FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged); - FairParAsciiFileIo* parIn = new FairParAsciiFileIo(); - parOut->open(parFile.Data()); - parIn->open(parFileList, "in"); - rtdb->setFirstInput(parIn); - rtdb->setOutput(parOut); - - run->Init(); - - // --- Start run - TStopwatch timer; - timer.Start(); - std::cout << ">>> unpack_tsa_mcbm: Starting run..." << std::endl; - if (0 == nrEvents) { - run->Run(nEvents, 0); // run until end of input file - } else { - run->Run(0, nrEvents); // process N Events - } - run->Finish(); - - timer.Stop(); - - std::cout << "Processed " << std::dec << source->GetTsCount() << " timeslices" - << std::endl; - - // --- End-of-run info - Double_t rtime = timer.RealTime(); - Double_t ctime = timer.CpuTime(); - std::cout << std::endl << std::endl; - std::cout << ">>> unpack_tsa_mcbm: Macro finished successfully." << std::endl; - std::cout << ">>> unpack_tsa_mcbm: Output file is " << outFile << std::endl; - std::cout << ">>> unpack_tsa_mcbm: Real time " << rtime << " s, CPU time " - << ctime << " s" << std::endl; - std::cout << std::endl; - - /// --- Screen output for automatic tests - std::cout << " Test passed" << std::endl; - std::cout << " All ok " << std::endl; + return unpack_tsa_mcbm(inFile, uRunId, uNbTimeslices, sOutDir); } -- GitLab