diff --git a/macro/beamtime/mcbm2020/build_event_win.C b/macro/beamtime/mcbm2020/build_event_win.C index bf6a5db0d408dc723be030feaa7a9421cbcc6c1d..fe5471eba0cfb86cec7bd7a701b243f99b938f6f 100644 --- a/macro/beamtime/mcbm2020/build_event_win.C +++ b/macro/beamtime/mcbm2020/build_event_win.C @@ -1,19 +1,36 @@ -Bool_t build_event_win(UInt_t uRunId = 0, - Int_t nTimeslices = 0, - TString sOutDir = "./data", - TString sInpDir = "./data") { + +/// FIXME: Disable clang formatting to keep easy parameters overview +/* clang-format off */ +Bool_t build_event_win(UInt_t uRunId = 0, + Int_t nTimeslices = 0, + TString sOutDir = "./data", + TString sInpDir = "./data", + Int_t iUnpFileIndex = -1) +{ + /// FIXME: Re-enable clang formatting after parameters initial values setting + /* clang-format on */ // ----- 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"; + /// Standardized RUN ID + TString sRunId = TString::Format("%03u", uRunId); + /// Initial pattern + TString inFile = sInpDir + "/unp_mcbm_" + sRunId; + TString outFile = sOutDir + "/mcbm_events_win_" + sRunId; + /// Add index of splitting at unpacking level if needed + if (0 <= iUnpFileIndex) { + inFile += TString::Format("_%02u", iUnpFileIndex); + outFile += TString::Format("_%02u", iUnpFileIndex); + } // if ( 0 <= iUnpFileIndex ) + /// Add ROOT file suffix + inFile += ".root"; + outFile += ".root"; // ------------------------------------------------------------------------ if (uRunId < 692) return kFALSE; /* std::cout << sOutDir << std::endl << sInpDir << std::endl; - std::cout << fileName << std::endl + std::cout << inFile << std::endl << outFile << std::endl; std::cout << uRunId << " " << nTimeslices << std::endl; @@ -46,7 +63,7 @@ Bool_t build_event_win(UInt_t uRunId = 0, FairRunAna* fRun = new FairRunAna(); fRun->SetEventHeaderPersistence(kFALSE); - FairFileSource* inputSource = new FairFileSource(fileName); + FairFileSource* inputSource = new FairFileSource(inFile); fRun->SetSource(inputSource); FairRootFileSink* outputSink = new FairRootFileSink(outFile); @@ -126,9 +143,7 @@ Bool_t build_event_win(UInt_t uRunId = 0, eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kPsd, -1); - if (0 < uRunId) - eventBuilder->SetOutFilename( - Form("%s/HistosEvtWin_%03u.root", sOutDir.Data(), uRunId)); + if (0 < uRunId) eventBuilder->SetOutFilename(Form("%s/HistosEvtWin_%03u.root", sOutDir.Data(), uRunId)); fRun->AddTask(eventBuilder); @@ -142,7 +157,8 @@ Bool_t build_event_win(UInt_t uRunId = 0, cout << "Starting run" << endl; if (0 == nTimeslices) { fRun->Run(0, 0); // run until end of input file - } else { + } + else { fRun->Run(0, nTimeslices); // process N Timeslices } // ------------------------------------------------------------------------ diff --git a/macro/beamtime/mcbm2020/build_event_win_kronos.C b/macro/beamtime/mcbm2020/build_event_win_kronos.C index 6b42f114534a70dc81749cb47b735a7df5fed247..7feca70a0eb410bf58f8df802d52f933652e81b8 100644 --- a/macro/beamtime/mcbm2020/build_event_win_kronos.C +++ b/macro/beamtime/mcbm2020/build_event_win_kronos.C @@ -1,13 +1,14 @@ #include "build_event_win.C" -/// FIXME: Disable clang formatting around parameters initial value setting -/// due to problem with real file path length +/// FIXME: Disable clang formatting to keep easy parameters overview /* clang-format off */ 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") { + "unp_evt_data_7f229b3f_20201103", + Int_t iUnpFileIndex = -1) +{ /// FIXME: Re-enable clang formatting after parameters initial values setting /* clang-format on */ @@ -41,5 +42,5 @@ Bool_t build_event_win_kronos(UInt_t uRunIdx = 28, if (uRunId < 692 && 0 != uRunId) return kFALSE; - return build_event_win(uRunId, nTimeslices, sOutDir, sInpDir); + return build_event_win(uRunId, nTimeslices, sOutDir, sInpDir, iUnpFileIndex); } diff --git a/macro/beamtime/mcbm2020/mcbm_build_and_reco.C b/macro/beamtime/mcbm2020/mcbm_build_and_reco.C index c7a7b708eb6cf4fd75a7b233b47a20a19aba2aff..2a70b2249b55e6d8d97a722a6955e3b282473ea0 100644 --- a/macro/beamtime/mcbm2020/mcbm_build_and_reco.C +++ b/macro/beamtime/mcbm2020/mcbm_build_and_reco.C @@ -6,12 +6,16 @@ // // -------------------------------------------------------------------------- - -Bool_t mcbm_build_and_reco(UInt_t uRunId = 831, - Int_t nTimeslices = 0, - TString sInpDir = "./data", - TString sOutDir = "./data") { - +/// FIXME: Disable clang formatting to keep easy parameters overview +/* clang-format off */ +Bool_t mcbm_build_and_reco(UInt_t uRunId = 831, + Int_t nTimeslices = 0, + TString sInpDir = "./data", + TString sOutDir = "./data", + Int_t iUnpFileIndex = -1) +{ + /// FIXME: Re-enable clang formatting after parameters initial values setting + /* clang-format on */ // ======================================================================== // Adjust this part according to your requirements @@ -34,11 +38,25 @@ Bool_t mcbm_build_and_reco(UInt_t uRunId = 831, /// due to problem with real file path length /* clang-format off */ // ----- In- and output file names ------------------------------------ - 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); + /// Standardized RUN ID + TString sRunId = TString::Format("%03u", uRunId); + /// Initial pattern + TString inFile = sInpDir + "/unp_mcbm_" + sRunId; + TString parFileIn = sInpDir + "/unp_mcbm_params_" + sRunId; + TString parFileOut = sOutDir + "/reco_mcbm_evt_win_params_" + sRunId; + TString outFile = sOutDir + "/reco_mcbm_evt_win_" + sRunId; + /// Add index of splitting at unpacking level if needed + if ( 0 <= iUnpFileIndex ) { + inFile += TString::Format( "_%02u", iUnpFileIndex ); + // the input par file is not split during unpacking! + parFileOut += TString::Format( "_%02u", iUnpFileIndex ); + outFile += TString::Format( "_%02u", iUnpFileIndex ); + } // if ( 0 <= iUnpFileIndex ) + /// Add ROOT file suffix + inFile += ".root"; + parFileIn += ".root"; + parFileOut += ".root"; + outFile += ".root"; // ------------------------------------------------------------------------ /// FIXME: Re-enable clang formatting after parameters initial values setting /* clang-format on */ @@ -164,9 +182,7 @@ Bool_t mcbm_build_and_reco(UInt_t uRunId = 831, eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kPsd, -1); - if (0 < uRunId) - eventBuilder->SetOutFilename( - Form("%sHistosEvtWin_%03u.root", sOutDir.Data(), uRunId)); + if (0 < uRunId) eventBuilder->SetOutFilename(Form("%sHistosEvtWin_%03u.root", sOutDir.Data(), uRunId)); run->AddTask(eventBuilder); // ------------------------------------------------------------------------ diff --git a/macro/beamtime/mcbm2020/mcbm_build_and_reco_kronos.C b/macro/beamtime/mcbm2020/mcbm_build_and_reco_kronos.C index 6a8c1e102cf9469dd619d32bed32f455e2c303bf..1f0748a5fa7a6d0ac5a9e129ba4ca031dd980acf 100644 --- a/macro/beamtime/mcbm2020/mcbm_build_and_reco_kronos.C +++ b/macro/beamtime/mcbm2020/mcbm_build_and_reco_kronos.C @@ -8,14 +8,15 @@ #include "mcbm_build_and_reco.C" -/// FIXME: Disable clang formatting around parameters initial value setting -/// due to problem with real file path length +/// FIXME: Disable clang formatting to keep easy parameters overview /* clang-format off */ 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") { + TString sOutDir = "./data", + Int_t iUnpFileIndex = -1) +{ /// FIXME: Re-enable clang formatting after parameters initial values setting /* clang-format on */ @@ -49,5 +50,5 @@ Bool_t mcbm_build_and_reco_kronos(UInt_t uRunIdx = 28, if (uRunId < 692 && 0 != uRunId) return kFALSE; - return mcbm_build_and_reco(uRunId, nTimeslices, sInpDir, sOutDir); + return mcbm_build_and_reco(uRunId, nTimeslices, sInpDir, sOutDir, iUnpFileIndex); } diff --git a/macro/beamtime/mcbm2020/mcbm_event_ana.C b/macro/beamtime/mcbm2020/mcbm_event_ana.C index b721048170a59489680188007826183f198b3576..f7b1f19bb60e5cdaf195e7b3cc82d83feb0543fb 100644 --- a/macro/beamtime/mcbm2020/mcbm_event_ana.C +++ b/macro/beamtime/mcbm2020/mcbm_event_ana.C @@ -6,9 +6,17 @@ // // -------------------------------------------------------------------------- -void mcbm_event_ana(Int_t runId = 831, - Int_t nTimeslices = 1000, - Bool_t bUseEvtWin = kFALSE) { +/// FIXME: Disable clang formatting to keep easy parameters overview +/* clang-format off */ +void mcbm_event_ana(UInt_t uRunId = 831, + Int_t nTimeslices = 1000, + Bool_t bUseEvtWin = kFALSE, + TString sInpDir = "./data", + TString sOutDir = "./data", + Int_t iUnpFileIndex = -1) +{ + /// FIXME: Re-enable clang formatting after parameters initial values setting + /* clang-format on */ // --- Logger settings ---------------------------------------------------- TString logLevel = "WARN"; @@ -23,16 +31,36 @@ void mcbm_event_ana(Int_t runId = 831, // ------------------------------------------------------------------------ // ----- In- and output file names ------------------------------------ - TString inFile = Form("./data/reco_mcbm_event_%03u.root", runId); - TString trkFile = Form("./data/tracking_mcbm_event_%03u.root", runId); + /// Standardized RUN ID + TString sRunId = TString::Format("%03u", uRunId); + /// Initial pattern + TString inFile = sInpDir + "/reco_mcbm_event_" + sRunId; + TString trkFile = sInpDir + "/tracking_mcbm_event_" + sRunId; + TString parFileIn = sInpDir + "/unp_mcbm_params_" + sRunId; + TString parFileOut = sOutDir + "/mcbm_event_ana_params_" + sRunId; + TString geoFile = paramDir + "mcbm_beam_2020_03.geo.root"; + TString outFile = sOutDir + "/mcbm_event_ana__" + sRunId; + /// Initial pattern if using event builder with time window if (bUseEvtWin) { - inFile = Form("./data/reco_mcbm_evt_win_%03u.root", runId); - trkFile = Form("./data/tracking_mcbm_evt_win_%03u.root", runId); - } // if (bUseEvtWin) - TString parFile = Form("./data/unp_mcbm_params_%i.root", runId); - TString geoFile = paramDir + "mcbm_beam_2020_03.geo.root"; - TString outFile = Form("./data/ana_mcbm_%i.root", runId); - + inFile = sInpDir + "/reco_mcbm_evt_win_" + sRunId; + trkFile = sInpDir + "/tracking_mcbm_evt_win_" + sRunId; + parFileOut = sOutDir + "/mcbm_event_ana_evt_win_params_" + sRunId; + outFile = sOutDir + "/mcbm_event_ana_evt_win_" + sRunId; + } // if( bUseEvtWin ) + /// Add index of splitting at unpacking level if needed + if (0 <= iUnpFileIndex) { + inFile += TString::Format("_%02u", iUnpFileIndex); + trkFile += TString::Format("_%02u", iUnpFileIndex); + // the input par file is from unpacking and not split during it! + parFileOut += TString::Format("_%02u", iUnpFileIndex); + outFile += TString::Format("_%02u", iUnpFileIndex); + } // if ( 0 <= iUnpFileIndex ) + /// Add ROOT file suffix + inFile += ".root"; + trkFile += ".root"; + parFileIn += ".root"; + parFileOut += ".root"; + outFile += ".root"; // ------------------------------------------------------------------------ // ----- Parameter files as input to the runtime database ------------- @@ -399,10 +427,12 @@ void mcbm_event_ana(Int_t runId = 831, FairRuntimeDb* rtdb = run->GetRuntimeDb(); FairParRootFileIo* parIo1 = new FairParRootFileIo(); FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); - parIo1->open(parFile.Data(), "UPDATE"); + FairParRootFileIo* parIo3 = new FairParRootFileIo(); + parIo1->open(parFileIn.Data(), "READ"); parIo2->open(parFileList, "in"); rtdb->setFirstInput(parIo1); rtdb->setSecondInput(parIo2); + parIo3->open(parFileOut.Data(), "RECREATE"); // ------------------------------------------------------------------------ @@ -410,7 +440,7 @@ void mcbm_event_ana(Int_t runId = 831, std::cout << std::endl; std::cout << "-I- " << myName << ": Initialise run" << std::endl; run->Init(); - rtdb->setOutput(parIo1); + rtdb->setOutput(parIo3); rtdb->saveOutput(); rtdb->print(); // ------------------------------------------------------------------------ @@ -431,7 +461,7 @@ void mcbm_event_ana(Int_t runId = 831, std::cout << std::endl << std::endl; std::cout << "Macro finished successfully." << std::endl; std::cout << "Output file is " << outFile << std::endl; - std::cout << "Parameter file is " << parFile << std::endl; + std::cout << "Parameter file is " << parFileOut << std::endl; std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << std::endl; std::cout << std::endl; diff --git a/macro/beamtime/mcbm2020/mcbm_event_reco.C b/macro/beamtime/mcbm2020/mcbm_event_reco.C index d2d669d39a01d9404c0294886647b2e1215ca026..1be681d0acb0eccd6383b8368d9dc1e0f09ded5d 100644 --- a/macro/beamtime/mcbm2020/mcbm_event_reco.C +++ b/macro/beamtime/mcbm2020/mcbm_event_reco.C @@ -6,10 +6,16 @@ // // -------------------------------------------------------------------------- -Bool_t mcbm_event_reco(UInt_t uRunId = 831, - Int_t nTimeslices = 0, - TString sInpDir = "./data", - TString sOutDir = "./data") { +/// FIXME: Disable clang formatting to keep easy parameters overview +/* clang-format off */ +Bool_t mcbm_event_reco(UInt_t uRunId = 831, + Int_t nTimeslices = 0, + TString sInpDir = "./data", + TString sOutDir = "./data", + Int_t iUnpFileIndex = -1) +{ + /// FIXME: Re-enable clang formatting after parameters initial values setting + /* clang-format on */ // --- Logger settings ---------------------------------------------------- TString logLevel = "INFO"; @@ -28,11 +34,25 @@ Bool_t mcbm_event_reco(UInt_t uRunId = 831, /// due to problem with real file path length /* clang-format off */ // ----- In- and output file names ------------------------------------ - 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); + /// Standardized RUN ID + TString sRunId = TString::Format("%03u", uRunId); + /// Initial pattern + TString inFile = sInpDir + "/unp_mcbm_" + sRunId; + TString parFileIn = sInpDir + "/unp_mcbm_params_" + sRunId; + TString parFileOut = sOutDir + "/reco_mcbm_event_params_" + sRunId; + TString outFile = sOutDir + "/reco_mcbm_event_" + sRunId; + /// Add index of splitting at unpacking level if needed + if ( 0 <= iUnpFileIndex ) { + inFile += TString::Format( "_%02u", iUnpFileIndex ); + // the input par file is not split during unpacking! + parFileOut += TString::Format( "_%02u", iUnpFileIndex ); + outFile += TString::Format( "_%02u", iUnpFileIndex ); + } // if ( 0 <= iUnpFileIndex ) + /// Add ROOT file suffix + inFile += ".root"; + parFileIn += ".root"; + parFileOut += ".root"; + outFile += ".root"; // ------------------------------------------------------------------------ /// FIXME: Re-enable clang formatting after parameters initial values setting /* clang-format on */ diff --git a/macro/beamtime/mcbm2020/mcbm_event_reco_kronos.C b/macro/beamtime/mcbm2020/mcbm_event_reco_kronos.C index 5978f74fc7d25b66a01fdea77ef51fc7268dd7c9..03552c2ca0ba0641dbd5aa03879008af8ac30ab0 100644 --- a/macro/beamtime/mcbm2020/mcbm_event_reco_kronos.C +++ b/macro/beamtime/mcbm2020/mcbm_event_reco_kronos.C @@ -8,14 +8,15 @@ #include "mcbm_event_reco.C" -/// FIXME: Disable clang formatting around parameters initial value setting -/// due to problem with real file path length +/// FIXME: Disable clang formatting to keep easy parameters overview /* clang-format off */ 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") { + TString sOutDir = "./data", + Int_t iUnpFileIndex = -1) +{ /// FIXME: Re-enable clang formatting after parameters initial values setting /* clang-format on */ @@ -49,5 +50,5 @@ Bool_t mcbm_event_reco_kronos(UInt_t uRunIdx = 28, if (uRunId < 692 && 0 != uRunId) return kFALSE; - return mcbm_event_reco(uRunId, nTimeslices, sInpDir, sOutDir); + return mcbm_event_reco(uRunId, nTimeslices, sInpDir, sOutDir, iUnpFileIndex); } diff --git a/macro/beamtime/mcbm2020/mcbm_reco.C b/macro/beamtime/mcbm2020/mcbm_reco.C index b9799220e24ae511fec7a0c5c13860593dd04ad3..962f42d571a3b8bd7ff07b913ae124f498382f4e 100644 --- a/macro/beamtime/mcbm2020/mcbm_reco.C +++ b/macro/beamtime/mcbm2020/mcbm_reco.C @@ -5,10 +5,16 @@ // // -------------------------------------------------------------------------- -Bool_t mcbm_reco(UInt_t uRunId = 831, - Int_t nTimeslices = 0, - TString sInpDir = "./data", - TString sOutDir = "./data") { +/// FIXME: Disable clang formatting to keep easy parameters overview +/* clang-format off */ +Bool_t mcbm_reco(UInt_t uRunId = 831, + Int_t nTimeslices = 0, + TString sInpDir = "./data", + TString sOutDir = "./data", + Int_t iUnpFileIndex = -1) +{ + /// FIXME: Re-enable clang formatting after parameters initial values setting + /* clang-format on */ // --- Logger settings ---------------------------------------------------- TString logLevel = "INFO"; @@ -25,10 +31,25 @@ Bool_t mcbm_reco(UInt_t uRunId = 831, // ----- In- and output file names ------------------------------------ - 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); + /// Standardized RUN ID + TString sRunId = TString::Format("%03u", uRunId); + /// Initial pattern + TString inFile = sInpDir + "/unp_mcbm_" + sRunId; + TString parFileIn = sInpDir + "/unp_mcbm_params_" + sRunId; + TString parFileOut = sOutDir + "/reco_mcbm_params_" + sRunId; + TString outFile = sOutDir + "/reco_mcbm_" + sRunId; + /// Add index of splitting at unpacking level if needed + if (0 <= iUnpFileIndex) { + inFile += TString::Format("_%02u", iUnpFileIndex); + // the input par file is not split during unpacking! + parFileOut += TString::Format("_%02u", iUnpFileIndex); + outFile += TString::Format("_%02u", iUnpFileIndex); + } // if ( 0 <= uUnpFileIndex ) + /// Add ROOT file suffix + inFile += ".root"; + parFileIn += ".root"; + parFileOut += ".root"; + outFile += ".root"; // ------------------------------------------------------------------------ /* diff --git a/macro/beamtime/mcbm2020/mcbm_reco_kronos.C b/macro/beamtime/mcbm2020/mcbm_reco_kronos.C index d715b4e8d7933d2198a4c44c8088099cde058948..07ba9365377607e3daa460b1bbf1674f3d8f86ec 100644 --- a/macro/beamtime/mcbm2020/mcbm_reco_kronos.C +++ b/macro/beamtime/mcbm2020/mcbm_reco_kronos.C @@ -7,11 +7,18 @@ #include "mcbm_reco.C" +/// FIXME: Disable clang formatting to keep easy parameters overview +/* clang-format off */ 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") { + TString sOutDir = "./data", + Int_t iUnpFileIndex = -1) +{ + /// FIXME: Re-enable clang formatting after parameters initial values setting + /* clang-format on */ + UInt_t uRunId = 0; if (99999 != uRunIdx) { @@ -42,5 +49,5 @@ Bool_t mcbm_reco_kronos(UInt_t uRunIdx = 28, if (uRunId < 692 && 0 != uRunId) return kFALSE; - return mcbm_reco(uRunId, nTimeslices, sInpDir, sOutDir); + return mcbm_reco(uRunId, nTimeslices, sInpDir, sOutDir, iUnpFileIndex); } diff --git a/macro/beamtime/mcbm2020/mcbm_tof_tracking.C b/macro/beamtime/mcbm2020/mcbm_tof_tracking.C index eeec2f2637827d4779e6b3da203700c9395a99ff..436401a3853c0dd2991a4ca79ebc31aba2f4edda 100644 --- a/macro/beamtime/mcbm2020/mcbm_tof_tracking.C +++ b/macro/beamtime/mcbm2020/mcbm_tof_tracking.C @@ -5,14 +5,20 @@ // // -------------------------------------------------------------------------- -Bool_t mcbm_tof_tracking(UInt_t uRunId = 831, - Bool_t bEventWin = kFALSE, - Int_t iTrackMode = 2, - Int_t iCalOpt = 0, - Int_t nTimeslices = 0, - TString sInpDir = "./data", - TString sOutDir = "./data", - TString cCalId = "831.50.3.0") { +/// FIXME: Disable clang formatting to keep easy parameters overview +/* clang-format off */ +Bool_t mcbm_tof_tracking(UInt_t uRunId = 831, + Bool_t bEventWin = kFALSE, + Int_t iTrackMode = 2, + Int_t iCalOpt = 0, + Int_t nTimeslices = 0, + TString sInpDir = "./data", + TString sOutDir = "./data", + TString cCalId = "831.50.3.0", + Int_t iUnpFileIndex = -1) +{ + /// FIXME: Re-enable clang formatting after parameters initial values setting + /* clang-format on */ // --- Logger settings ---------------------------------------------------- TString logLevel = "INFO"; @@ -21,7 +27,7 @@ Bool_t mcbm_tof_tracking(UInt_t uRunId = 831, // ----- Environment -------------------------------------------------- - TString myName = "mcbm_tof_tracking"; // this macro's name for screen outp + TString myName = "mcbm_tof_tracking"; // this macro's name for screen outp TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory TString paramDir = srcDir + "/macro/beamtime/mcbm2020/"; TString parDir = srcDir + "/parameters"; @@ -31,20 +37,32 @@ Bool_t mcbm_tof_tracking(UInt_t uRunId = 831, /// due to problem with real file path length /* clang-format off */ // ----- In- and output file names ------------------------------------ - TString inFile = sInpDir + Form("/reco_mcbm_event_%03u.root", uRunId); - TString parFileIn = sInpDir + Form("/reco_mcbm_event_params_%03u.root", - uRunId); - TString parFileOut = sOutDir + Form("/tracking_mcbm_event_params_%03u.root", - uRunId); - TString outFile = sOutDir + Form("/tracking_mcbm_event_%03u.root", uRunId); + /// Standardized RUN ID + TString sRunId = TString::Format("%03u", uRunId); + /// Initial pattern + TString inFile = sInpDir + "/reco_mcbm_event_" + sRunId; + TString parFileIn = sInpDir + "/reco_mcbm_event_params_" + sRunId; + TString parFileOut = sOutDir + "/tracking_mcbm_event_params_" + sRunId; + TString outFile = sOutDir + "/tracking_mcbm_event_" + sRunId; + /// Initial pattern if using event builder with time window if (bEventWin) { - inFile = sInpDir + Form("/reco_mcbm_evt_win_%03u.root", uRunId); - parFileIn = sInpDir + Form("/reco_mcbm_evt_win_params_%03u.root", - uRunId); - parFileOut = sOutDir + Form("/tracking_mcbm_evt_win_params_%03u.root", - uRunId); - outFile = sOutDir + Form("/tracking_mcbm_evt_win_%03u.root", uRunId); + inFile = sInpDir + "/reco_mcbm_evt_win_" + sRunId; + parFileIn = sInpDir + "/reco_mcbm_evt_win_params_" + sRunId; + parFileOut = sOutDir + "/tracking_mcbm_evt_win_params_" + sRunId; + outFile = sOutDir + "/tracking_mcbm_evt_win_" + sRunId; } // if( bEventWin ) + /// Add index of splitting at unpacking level if needed + if ( 0 <= iUnpFileIndex ) { + inFile += TString::Format( "_%02u", iUnpFileIndex ); + parFileIn += TString::Format( "_%02u", iUnpFileIndex ); + parFileOut += TString::Format( "_%02u", iUnpFileIndex ); + outFile += TString::Format( "_%02u", iUnpFileIndex ); + } // if ( 0 <= iUnpFileIndex ) + /// Add ROOT file suffix + inFile += ".root"; + parFileIn += ".root"; + parFileOut += ".root"; + outFile += ".root"; // ------------------------------------------------------------------------ /// FIXME: Re-enable clang formatting after parameters initial values setting /* clang-format on */ @@ -63,9 +81,8 @@ Bool_t mcbm_tof_tracking(UInt_t uRunId = 831, // --- 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(); + TString geoFile = paramDir + geoSetupTag.data() + ".geo.root"; // Created in sim. run + CbmSetup* geoSetup = CbmSetup::Instance(); geoSetup->LoadSetup(geoSetupTag.data()); TList* parFileList = new TList(); // ------------------------------------------------------------------------ @@ -101,49 +118,41 @@ Bool_t mcbm_tof_tracking(UInt_t uRunId = 831, // ----- Track reconstruction ------------------------------------------ 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 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; 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 + 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"); + 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->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 + 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; @@ -311,8 +320,7 @@ Bool_t mcbm_tof_tracking(UInt_t uRunId = 831, 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 << "Real time " << rtime << " s, CPU time " << ctime << " s" << std::endl; std::cout << std::endl; // ------------------------------------------------------------------------ diff --git a/macro/beamtime/mcbm2020/mcbm_tof_tracking_kronos.C b/macro/beamtime/mcbm2020/mcbm_tof_tracking_kronos.C index 5bc961fee18df4ee86fc4a6a00fd9f8e2d394469..8f81e6d4c116edafc87b4371139e6d24a6be01cb 100644 --- a/macro/beamtime/mcbm2020/mcbm_tof_tracking_kronos.C +++ b/macro/beamtime/mcbm2020/mcbm_tof_tracking_kronos.C @@ -8,8 +8,7 @@ #include "mcbm_tof_tracking.C" -/// FIXME: Disable clang formatting around parameters initial value setting -/// due to problem with real file path length +/// FIXME: Disable clang formatting to keep easy parameters overview /* clang-format off */ Bool_t mcbm_tof_tracking_kronos(UInt_t uRunIdx = 28, Bool_t bEventWin = kFALSE, @@ -18,7 +17,10 @@ Bool_t mcbm_tof_tracking_kronos(UInt_t uRunIdx = 28, Int_t nTimeslices = 0, TString sInpDir = "/lustre/cbm/users/ploizeau/mcbm2020/" "unp_evt_data_7f229b3f_20201103", - TString sOutDir = "./data") { + TString sOutDir = "./data", + TString cCalId = "831.50.3.0", + Int_t iUnpFileIndex = -1) +{ /// FIXME: Re-enable clang formatting after parameters initial values setting /* clang-format on */ @@ -52,6 +54,5 @@ Bool_t mcbm_tof_tracking_kronos(UInt_t uRunIdx = 28, if (uRunId < 692 && 0 != uRunId) return kFALSE; - return mcbm_tof_tracking( - uRunId, bEventWin, iTrackMode, iCalOpt, nTimeslices, sInpDir, sOutDir); + return mcbm_tof_tracking(uRunId, bEventWin, iTrackMode, iCalOpt, nTimeslices, sInpDir, sOutDir, cCalId, iUnpFileIndex); } diff --git a/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C b/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C index c3ad351700e6eb9ea5b15ca37cff5e3c3ba21053..0a8e4b6f6a788a37c5649e50c739622612515577 100644 --- a/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C +++ b/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C @@ -10,16 +10,32 @@ // 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 */ Bool_t unpack_tsa_mcbm(TString inFile = "", UInt_t uRunId = 0, UInt_t uNbTimeslices = 0, - TString sOutDir = "data") { + TString sOutDir = "data", + Int_t iSpillIndex = -1, + Int_t iSpillnumber = 3, + UInt_t uSpillLimType = 1) +{ + /// FIXME: Re-enable clang formatting after parameters initial values setting + /* clang-format on */ + TString srcDir = gSystem->Getenv("VMCWORKDIR"); // --- Specify output file name (this is just an example) TString runId = TString::Format("%03u", uRunId); - TString outFile = sOutDir + "/unp_mcbm_" + runId + ".root"; - TString parFile = sOutDir + "/unp_mcbm_params_" + runId + ".root"; + TString outFile = sOutDir + "/unp_mcbm_" + runId; + TString parFile = sOutDir + "/unp_mcbm_params_" + runId; + if( 0 <= iSpillIndex ) + { + outFile += TString::Format("_%02i", iSpillIndex); + parFile += TString::Format("_%02i", iSpillIndex); + } // if( 0 <= iSpillIndex ) + outFile += ".root"; + parFile += ".root"; /* std::cout << inFile << std::endl << sOutDir << std::endl; @@ -578,6 +594,7 @@ Bool_t unpack_tsa_mcbm(TString inFile = "", } // 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 @@ -593,14 +610,34 @@ Bool_t unpack_tsa_mcbm(TString inFile = "", source->AddUnpacker(unpacker_rich, 0x30, ECbmModuleId::kRich); // RICH trb source->AddUnpacker(unpacker_psd, 0x80, ECbmModuleId::kPsd); // PSD + source->UnpackSelectSpills(iSpillIndex * iSpillnumber, iSpillIndex * iSpillnumber + iSpillnumber - 1, uSpillLimType); + switch (uRunId) { + case 831: { + source->LoadTsListSpillBreakBegin( + std::vector< ULong64_t >( { 1, 933, 1941, 2949, 4349, 5357, 6365, 7373, 8773, 9781, 10789, 11801, + 13197, 14209, 15217, 16225, 17625, 18633, 19645, 20653, 22053, 23061, 24069, 25077, + 26473, 27481, 28493, 29501, 30897, 31905, 32913, 33921, 35321, 36329, 37337, 38345, + 39745, 40753, 41761, 42769, 44169, 45177, 46185, 47193, 48593 } )); + source->LoadTsListSpillBreakMiddle( + std::vector< ULong64_t >( { 111, 1081, 2087, 3299, 4495, 5503, 6513, 7721, 8921, 9927, 10935, 12149, + 13347, 14355, 15363, 16573, 17773, 18781, 19791, 21001, 22199, 23209, 24215, 25423, + 26619, 27629, 28637, 29847, 31045, 32051, 33059, 34275, 35469, 36475, 37483, 38693, + 39889, 40899, 41907, 43117, 44315, 45323, 46333, 47543, 48689 } )); + source->LoadTsListSpillBreakEnd( + std::vector< ULong64_t >( { 221, 1229, 2233, 3649, 4641, 5649, 6661, 8069, 9069, 10073, 11081, 12497, + 13497, 14501, 15509, 16921, 17921, 18929, 19937, 21349, 22345, 23357, 24361, 25769, + 26765, 27777, 28781, 30193, 31193, 32197, 33205, 34629, 35617, 36621, 37629, 39041, + 40033, 41045, 42053, 43465, 44461, 45469, 46481, 47893, 48786 } )); + break; + } // case 831 + } // switch (uRunId) + // --- 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); @@ -627,7 +664,8 @@ Bool_t unpack_tsa_mcbm(TString inFile = "", std::cout << ">>> unpack_tsa_mcbm: Starting run..." << std::endl; if (0 == uNbTimeslices) { run->Run(-1, 0); // run until end of input file - } else { + } + else { run->Run(0, uNbTimeslices); // process N Timeslices } run->Finish(); @@ -650,4 +688,6 @@ Bool_t unpack_tsa_mcbm(TString inFile = "", /// --- 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/unpack_tsa_mcbm_kronos.C b/macro/beamtime/mcbm2020/unpack_tsa_mcbm_kronos.C index a441ed7d202bad3be1de12b39045ea4e790e7ac5..0b5cc0988007b3f9ae6f2aa8ca5e7bd19f93722a 100644 --- a/macro/beamtime/mcbm2020/unpack_tsa_mcbm_kronos.C +++ b/macro/beamtime/mcbm2020/unpack_tsa_mcbm_kronos.C @@ -9,9 +9,18 @@ */ #include "unpack_tsa_mcbm.C" +/// FIXME: Disable clang formatting to keep easy parameters overview +/* clang-format off */ Bool_t unpack_tsa_mcbm_kronos(UInt_t uRunIdx = 28, UInt_t uNbTimeslices = 0, - TString sOutDir = "data") { + TString sOutDir = "data", + Int_t iSpillIndex = -1, + Int_t iSpillnumber = 3, + UInt_t uSpillLimType = 1) +{ + /// FIXME: Re-enable clang formatting after parameters initial values setting + /* clang-format on */ + UInt_t uRunId = 0; if (99999 != uRunIdx) { std::vector<UInt_t> vuListRunId = { @@ -63,5 +72,5 @@ Bool_t unpack_tsa_mcbm_kronos(UInt_t uRunIdx = 28, inFile += Form("/lustre/cbm/users/ploizeau/mcbm2020/data/%3u_pn15_*.tsa", uRunId); - return unpack_tsa_mcbm(inFile, uRunId, uNbTimeslices, sOutDir); + return unpack_tsa_mcbm(inFile, uRunId, uNbTimeslices, sOutDir, iSpillIndex, iSpillnumber, uSpillLimType); }