From 704c4a7f1e20c9c9d6a925d0a3aca2aab70890f3 Mon Sep 17 00:00:00 2001 From: "s.zharko@gsi.de" <s.zharko@gsi.de> Date: Wed, 19 Jun 2024 17:11:45 +0200 Subject: [PATCH] mcbm2024 data recostruction chain: - CbmL1: added the CbmL1:EInitMode flags, the EInitMode::Full is default and provides the initialization of the L1Algo --- algo/ca/core/CMakeLists.txt | 96 +++++++++++++-------------- algo/ca/core/data/CaTrack.h | 5 +- algo/ca/core/data/CaTrackParam.h | 5 +- algo/ca/core/utils/CaVector.h | 6 +- macro/qa/run_recoQa.C | 11 +-- reco/L1/CbmL1.cxx | 9 ++- reco/L1/CbmL1.h | 17 ++++- reco/steer/CbmSourceDigiTimeslice.cxx | 16 ++--- 8 files changed, 99 insertions(+), 66 deletions(-) diff --git a/algo/ca/core/CMakeLists.txt b/algo/ca/core/CMakeLists.txt index b255a4bfdb..5d1b64b618 100644 --- a/algo/ca/core/CMakeLists.txt +++ b/algo/ca/core/CMakeLists.txt @@ -78,55 +78,55 @@ install(DIRECTORY pars TYPE INCLUDE FILES_MATCHING PATTERN "*.h") install( FILES - data/CaDataManager.h - data/CaGridEntry.h - data/CaHit.h - data/CaInputData.h - data/CaTrackParam.h - data/CaTrack.h - data/CaMeasurementU.h - data/CaMeasurementXy.h - data/CaMeasurementTime.h - data/CaWindowData.h - pars/CaConfigReader.h - data/CaGridEntry.h - data/CaGrid.h - data/CaGridArea.h - data/CaTriplet.h - data/CaBranch.h - data/CaWindowData.h - data/CaTimesliceHeader.h - pars/CaConstants.h - pars/CaField.h - pars/CaInitManager.h - pars/CaIteration.h - pars/CaMaterialMap.h - pars/CaMaterialMonitor.h - pars/CaParameters.h - pars/CaSearchWindow.h - pars/CaStation.h - pars/CaStationInitializer.h + #data/CaDataManager.h + #data/CaGridEntry.h + #data/CaHit.h + #data/CaInputData.h + #data/CaTrackParam.h + #data/CaTrack.h + #data/CaMeasurementU.h + #data/CaMeasurementXy.h + #data/CaMeasurementTime.h + #data/CaWindowData.h + #pars/CaConfigReader.h + #data/CaGridEntry.h + #data/CaGrid.h + #data/CaGridArea.h + #data/CaTriplet.h + #data/CaBranch.h + #data/CaWindowData.h + #data/CaTimesliceHeader.h + #pars/CaConstants.h + #pars/CaField.h + #pars/CaInitManager.h + #pars/CaIteration.h + #pars/CaMaterialMap.h + #pars/CaMaterialMonitor.h + #pars/CaParameters.h + #pars/CaSearchWindow.h + #pars/CaStation.h + #pars/CaStationInitializer.h - utils/CaTrackingMonitor.h - utils/CaEnumArray.h - utils/CaMonitor.h - utils/CaMonitorData.h - utils/CaObjectInitController.h - utils/CaSimd.h - utils/CaSimdVc.h - utils/CaSimdPseudo.h - utils/CaTimer.h - utils/CaVector.h - utils/CaUtils.h - utils/CaDefines.h - tracking/CaCloneMerger.h - tracking/CaFramework.h - tracking/CaTrackExtender.h - tracking/CaTrackFinder.h - tracking/CaTrackFinderWindow.h - tracking/CaTrackFit.h - tracking/CaTrackFitter.h - tracking/CaTripletConstructor.h + #utils/CaTrackingMonitor.h + #utils/CaEnumArray.h + #utils/CaMonitor.h + #utils/CaMonitorData.h + #utils/CaObjectInitController.h + #utils/CaSimd.h + #utils/CaSimdVc.h + #utils/CaSimdPseudo.h + #utils/CaTimer.h + #utils/CaVector.h + #utils/CaUtils.h + #utils/CaDefines.h + #tracking/CaCloneMerger.h + #tracking/CaFramework.h + #tracking/CaTrackExtender.h + #tracking/CaTrackFinder.h + #tracking/CaTrackFinderWindow.h + #tracking/CaTrackFit.h + #tracking/CaTrackFitter.h + #tracking/CaTripletConstructor.h DESTINATION include/ ) diff --git a/algo/ca/core/data/CaTrack.h b/algo/ca/core/data/CaTrack.h index c1ed282801..6c623a9533 100644 --- a/algo/ca/core/data/CaTrack.h +++ b/algo/ca/core/data/CaTrack.h @@ -7,7 +7,8 @@ /// \since 02.06.2022 /// \author S.Zharko <s.zharko@gsi.de> -#pragma once // include this header only once per compilation unit +#ifndef CA_CORE_CaTrack_h +#define CA_CORE_CaTrack_h 1 #include "CaConstants.h" #include "CaSimd.h" @@ -47,3 +48,5 @@ namespace cbm::algo::ca }; } // namespace cbm::algo::ca + +#endif // CA_CORE_CaTrack_h diff --git a/algo/ca/core/data/CaTrackParam.h b/algo/ca/core/data/CaTrackParam.h index 8dbc71b78d..1e3f859fbd 100644 --- a/algo/ca/core/data/CaTrackParam.h +++ b/algo/ca/core/data/CaTrackParam.h @@ -8,7 +8,8 @@ /// \since 02.06.2022 /// \author Sergey Gorbunov -#pragma once // include this header only once per compilation unit +#ifndef CA_CORE_CaTrackParam_h +#define CA_CORE_CaTrackParam_h 1 #include "CaConstants.h" #include "CaSimd.h" @@ -759,3 +760,5 @@ namespace cbm::algo::ca } } // namespace cbm::algo::ca + +#endif // CA_CORE_CaTrackParam_h diff --git a/algo/ca/core/utils/CaVector.h b/algo/ca/core/utils/CaVector.h index de24b82564..16fee44c40 100644 --- a/algo/ca/core/utils/CaVector.h +++ b/algo/ca/core/utils/CaVector.h @@ -6,8 +6,10 @@ /// \author Sergey Gorbunov /// \date 2021-06-16 -#pragma once // include this header only once per compilation unit +//#pragma once // include this header only once per compilation unit (not robust) +#ifndef CA_CORE_CaVector_h +#define CA_CORE_CaVector_h 1 #ifndef FAST_CODE #include "AlgoFairloggerCompat.h" @@ -295,3 +297,5 @@ namespace cbm::algo::ca class Vector<bool> { }; } // namespace cbm::algo::ca + +#endif // CA_CORE_CaVector_h diff --git a/macro/qa/run_recoQa.C b/macro/qa/run_recoQa.C index a5774ec2a0..141ea7d536 100644 --- a/macro/qa/run_recoQa.C +++ b/macro/qa/run_recoQa.C @@ -147,13 +147,14 @@ void run_recoQa(Int_t nEvents = -1, TString recFile = "2391_node8_0_0000.rec.roo //pCaOutputQa->ReadParameters(caParFile.Data()); // L1 CA track finder setup - auto l1 = new CbmL1("CA"); - l1->SetMcbmMode(); - // TODO: add l1->SetInitMode(CbmL1::EInitMode::Param), after !1862 will be merged + auto pCa = new CbmL1("CA"); + pCa->SetInitMode(CbmL1::EInitMode::Param); + pCa->SetMcbmMode(); + // TODO: add pCa->SetInitMode(CbmL1::EInitMode::Param), after !1862 will be merged // User configuration example for CA: - //l1->SetConfigUser(srcDir + "/macro/L1/configs/ca_params_user_example.yaml"); - run->AddTask(l1); + //pCa->SetConfigUser(srcDir + "/macro/L1/configs/ca_params_user_example.yaml"); + run->AddTask(pCa); // ----- Reco QA -------------------------------------------- CbmRecoQaTask::Detector* det(nullptr); diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 493e306ea0..a2d72bd140 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -519,6 +519,11 @@ try { } } + if (fInitMode == EInitMode::Param) { + auto parameters = fInitManager.TakeParameters(); + LOG(info) << '\n' << parameters.ToString(1); + return kSUCCESS; + } // Init L1 algo core @@ -962,7 +967,9 @@ void CbmL1::DefineSTAPNames(const char* dirName) // void CbmL1::WriteSTAPParamObject() { - TString filename = fSTAPDataDir + "/" + fSTAPDataPrefix + "." + TString(kSTAPParamSuffix.data()); + TString filename = fSTAPParamFile.IsNull() + ? fSTAPDataDir + "/" + fSTAPDataPrefix + "." + TString(kSTAPParamSuffix.data()) + : fSTAPParamFile; fInitManager.WriteParametersObject(filename.Data()); } diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index f488fddca8..76bde7f973 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -125,6 +125,11 @@ class CbmL1 : public FairTask { friend class CbmL1MCTrack; friend class CbmL1PFFitter; + enum class EInitMode + { + Full, ///< Full initialization (default) + Param ///< Parameter initialization (when algorithm execution is not required) + }; // ********************************** // ** Member functions declaration ** @@ -190,6 +195,10 @@ class CbmL1 : public FairTask { /// Possible entries of Detector ID are listed in CbmL1DetectorID.h. void DisableTrackingStation(ca::EDetectorID detID, int iSt); + /// \brief Sets initialization mode + /// \param mode A CbmL1::EInitMode enumeration entry + void SetInitMode(EInitMode mode) { fInitMode = mode; } + /// Sets safe but slow material initialisation to get around potential problems in TGeoVoxelFinder /// (use it only in case of a crash at the initialisation of material maps) void SetSafeMaterialInitialization(bool val = true) { fDoSafeMaterialInitialization = val; } @@ -221,6 +230,10 @@ class CbmL1 : public FairTask { /// \param filename Name of the input tracking configuration file void SetOutputConfigName(const char* filename) { fInitManager.SetOutputConfigName(std::string(filename)); } + /// \brief Sets a name for the ca-parameter file + /// \param filename Name of the parameter file + void SetParameterFilename(const char* filename) { fSTAPParamFile = TString(filename); } + /// \brief Sets output file for MC triplets tree /// If the filename is empty string, tree is not filled /// \param filename Name of the output file name @@ -456,8 +469,8 @@ class CbmL1 : public FairTask { int fSTAPDataMode = 4; ///< Option to work with files for the standalone mode TString fSTAPDataDir = "."; ///< Name of input/output directory for running in a STAP mode - TString fSTAPDataPrefix = "test"; ///< Name of input/output file prefix. The prefix is defined by output TTree file + TString fSTAPParamFile = ""; ///< Name of the parameter file (generated automatically, if not provided manually) /// Extension for IO of the L1Parameters object static constexpr std::string_view kSTAPParamSuffix = "ca.par"; @@ -522,6 +535,8 @@ class CbmL1 : public FairTask { int fMatBudgetNrays{3}; ///< material budget n rays per dimansion in each bin double fMatBudgetPitch{0.1}; ///< material budget minimal bin size in cm + EInitMode fInitMode = EInitMode::Full; ///< Initialization mode + bool fMatBudgetParallelProjection{false}; ///< Calculate material budget with rays, parallel to Z axis ///< Only needed in debug mode to produce detailed picture of the material diff --git a/reco/steer/CbmSourceDigiTimeslice.cxx b/reco/steer/CbmSourceDigiTimeslice.cxx index f2d9479a94..780d1d25e1 100644 --- a/reco/steer/CbmSourceDigiTimeslice.cxx +++ b/reco/steer/CbmSourceDigiTimeslice.cxx @@ -65,12 +65,12 @@ Bool_t CbmSourceDigiTimeslice::Init() auto* pEvtHeader = FairRun::Instance()->GetEventHeader(); - //if (!(fTsEventHeader = dynamic_cast<CbmTsEventHeader*>(FairRun::Instance()->GetEventHeader()))) { - // LOG(fatal) - // << "CbmSourceDigiTimeslice::Init() no CbmTsEventHeader was added to the run. Without it, we can not store the UTC of the " - // "Timeslices correctly. Hence, this causes a fatal. Please add it in the steering macro to the Run."; - // return kFALSE; - //} + if (!(fTsEventHeader = dynamic_cast<CbmTsEventHeader*>(FairRun::Instance()->GetEventHeader()))) { + LOG(fatal) << "CbmSourceDigiTimeslice::Init() no CbmTsEventHeader was added to the run. Without it, we can not " + "store the UTC of the " + "Timeslices correctly. Hence, this causes a fatal. Please add it in the steering macro to the Run."; + return kFALSE; + } // TimeSlice. branch initialization if (ioman->GetObject("TimeSlice.")) { @@ -158,8 +158,8 @@ Int_t CbmSourceDigiTimeslice::ReadEvent(UInt_t) /// FIXME: Add PSD and FSD to the output of RawDigis in algo/global and reco/app // << " PSD=" << results->StsDigis().size() << " FSD=" << results->StsDigis().size(); - //fTsEventHeader->SetTsIndex(results->TsIndex()); - //fTsEventHeader->SetTsStartTime(results->TsStartTime()); + fTsEventHeader->SetTsIndex(results->TsIndex()); + fTsEventHeader->SetTsStartTime(results->TsStartTime()); fTimeslice->SetStartTime(results->TsStartTime()); -- GitLab