diff --git a/macro/beamtime/mcbm2021/.gitignore b/macro/beamtime/mcbm2021/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e1d5e7903d4a24b917342a078ef8f3330af84fb8 --- /dev/null +++ b/macro/beamtime/mcbm2021/.gitignore @@ -0,0 +1 @@ +.root_hist diff --git a/macro/beamtime/mcbm2021/MonitorTof.C b/macro/beamtime/mcbm2021/MonitorTof.C new file mode 100644 index 0000000000000000000000000000000000000000..2a291266c798d03b2d06b85e2017b24f0691b644 --- /dev/null +++ b/macro/beamtime/mcbm2021/MonitorTof.C @@ -0,0 +1,127 @@ +/** @file MonitorTof.C + ** @author Florian Uhlig <f.uhlig@gsi.de> + ** @date 20.06.2016 + ** Modified by P.-A. Loizeau + ** @date 13.10.2019 + ** + ** ROOT macro to read tsa files which have been produced with the new data transport + ** Convert data into cbmroot format. + ** Uses CbmMcbm2018Source as source task. + */ +// In order to call later Finish, we make this global +FairRunOnline* run = NULL; + +/// FIXME: Disable clang formatting to keep easy parameters overview +/* clang-format off */ +void MonitorTof(TString inFile = "", + TString sHostname = "localhost", + Int_t iServerRefreshRate = 100, + Int_t iServerHttpPort = 8080, + UInt_t nrEvents = 0, + Bool_t bIgnoreCriticalErrors = kTRUE, + Int_t iGdpbIndex = -1, + TString sHistoFile = "data/HistosMonitorTof.root") +{ + /// FIXME: Re-enable clang formatting after parameters initial values setting + /* clang-format on */ + + 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; + + // --- Set log output levels + FairLogger::GetLogger(); + gLogger->SetLogScreenLevel("INFO"); + // gLogger->SetLogScreenLevel("DEBUG"); + // gLogger->SetLogScreenLevel("DEBUG2"); // Print raw messages + gLogger->SetLogVerbosityLevel("LOW"); + + // --- Define parameter files + TList* parFileList = new TList(); + TString paramDir = srcDir + "/macro/beamtime/mcbm2021/"; + //TString paramDir = "/scratch/cbmroot_macro/macro/beamtime/mcbm2020/"; + + TString paramFileTof = paramDir + "mTofPar.par"; + TObjString* parTofFileName = new TObjString(paramFileTof); + parFileList->Add(parTofFileName); + + // --- Set debug level + gDebug = 0; + + std::cout << std::endl; + + // ======================================================================== + // ======================================================================== + + std::cout << std::endl; + std::cout << ">>> MonitorTof: Initialising..." << std::endl; + + // Get4 Unpacker + CbmMcbm2018MonitorTaskTof* monitor_tof = new CbmMcbm2018MonitorTaskTof(); + monitor_tof->SetIgnoreOverlapMs(); + monitor_tof->SetHistoryHistoSize(600); + // monitor_tof->SetDebugMonitorMode(); + monitor_tof->SetIgnoreCriticalErrors(bIgnoreCriticalErrors); + monitor_tof->SetGdpbIndex(iGdpbIndex); + monitor_tof->SetHistoFilename(sHistoFile); + + // --- Source task + CbmMcbm2018Source* source = new CbmMcbm2018Source(); + if ("" != inFile) { + // Empty comment to avoid collapsing by clang-format + source->SetFileName(inFile); + } // if( "" != inFile ) + else { + source->SetHostName(sHostname); + } // else of if( "" != inFile ) + source->SetSubscriberHwm(10); + source->AddUnpacker(monitor_tof, 0x60, ECbmModuleId::kTof); //gDPBs + source->AddUnpacker(monitor_tof, 0x90, ECbmModuleId::kTof); //gDPBs T0 + + // --- Run + run = new FairRunOnline(source); + run->ActivateHttpServer(iServerRefreshRate, + iServerHttpPort); // refresh each 100 events + /// To avoid the server sucking all Histos from gROOT when no output file is used + /// ===> Need to explicitely add the canvases to the server in the task! + run->GetHttpServer()->GetSniffer()->SetScanGlobalDir(kFALSE); + run->SetAutoFinish(kFALSE); + + // ----- Runtime database --------------------------------------------- + FairRuntimeDb* rtdb = run->GetRuntimeDb(); + FairParAsciiFileIo* parIn = new FairParAsciiFileIo(); + parIn->open(parFileList, "in"); + rtdb->setFirstInput(parIn); + + run->Init(); + + // --- Start run + TStopwatch timer; + timer.Start(); + std::cout << ">>> MonitorTof: Starting run..." << std::endl; + if (0 == nrEvents) { + run->Run(nEvents, 0); // run until end of input file + } + else { + run->Run(0, nrEvents); // process 2000 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 << ">>> MonitorTof: Macro finished successfully." << std::endl; + std::cout << ">>> MonitorTof: 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; +} diff --git a/macro/beamtime/mcbm2021/data/.gitignore b/macro/beamtime/mcbm2021/data/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..4ea40f8315d27f24d50e2c0f6ac12ea00b5542f6 --- /dev/null +++ b/macro/beamtime/mcbm2021/data/.gitignore @@ -0,0 +1 @@ +*.root diff --git a/macro/beamtime/mcbm2021/mTofParMay.par b/macro/beamtime/mcbm2021/mTofParMay.par new file mode 100644 index 0000000000000000000000000000000000000000..256e6dc403351bd69f839d5a188bd6301c13088b --- /dev/null +++ b/macro/beamtime/mcbm2021/mTofParMay.par @@ -0,0 +1,65 @@ +[CbmMcbm2018TofPar] +//---------------------------------------------------------------------------- +NrOfGdpbs: Int_t 10 +GdpbIdArray: Int_t \ +0x5b7b 0x55c4 0x18c5 0x5f64 0x1889 0x181c 0x1922 0x1925 0x1902 0x65d5 +NrOfFeesPerGdpb: Int_t 30 +NrOfGet4PerFee: Int_t 8 +NrOfChannelsPerGet4: Int_t 4 +NrOfGbtx: Int_t 54 +NrOfModule: Int_t 9 +NrOfRpc: Int_t \ + 1 0 0 0 0 0 \ + 1 0 0 0 0 0 \ + 5 0 0 0 0 0 \ + 2 0 0 0 0 0 \ + 5 0 0 0 0 0 \ + 5 0 0 0 0 0 \ + 2 0 0 0 0 0 \ + 5 0 0 0 0 0 \ + 2 0 0 0 0 0 +RpcType: Int_t \ + 5 -1 -1 -1 -1 -1 \ + 5 -1 -1 -1 -1 -1 \ + 0 -1 -1 -1 -1 -1 \ + 9 -1 -1 -1 -1 -1 \ + 0 -1 -1 -1 -1 -1 \ + 0 -1 -1 -1 -1 -1 \ + 9 -1 -1 -1 -1 -1 \ + 0 -1 -1 -1 -1 -1 \ + 6 -1 -1 -1 -1 -1 +RpcSide: Int_t \ + 0 0 0 0 0 0 \ + 1 0 0 0 0 0 \ + 1 0 0 0 0 0 \ + 2 0 0 0 0 0 \ + 1 0 0 0 0 0 \ + 0 0 0 0 0 0 \ + 2 0 0 0 0 0 \ + 0 0 0 0 0 0 \ + 7 0 0 0 0 0 +ModuleId: Int_t \ + 0 0 0 0 0 0 \ + 0 0 0 0 0 0 \ + 3 0 0 0 0 0 \ + 0 0 0 0 0 0 \ + 4 0 0 0 0 0 \ + 3 0 0 0 0 0 \ + 1 0 0 0 0 0 \ + 4 0 0 0 0 0 \ + 0 0 0 0 0 0 +NbMsTot: Int_t 100 +NbMsOverlap: Int_t 1 +SizeMsInNs: Double_t 102400.0 +//SizeMsInNs: Double_t 1638400 +StarTriggerDeadtime: Double_t \ + 1000.0 1000.0 1000.0 1000.0 1000.0 +StarTriggerDelay: Double_t \ + 2000.0 2000.0 2000.0 2000.0 2000.0 +// 2000.0 2000.0 2000.0 2000.0 2000.0 +//-23000.0 -23000.0 -23000.0 -23000.0 -23000.0 +StarTriggerWinSize: Double_t \ + 2000.0 2000.0 2000.0 2000.0 2000.0 +TsDeadtimePeriod: Double_t 62.5 +####################### +