Skip to content
Snippets Groups Projects
Commit 1371c840 authored by Pascal Raisig's avatar Pascal Raisig
Browse files

Fix safety in case of an existing TRD2D config without a TRD1D config.

It was not checked if a Trd1D config exists before trying to get its main branch name. This caused a seg violation in case no Trd1D config was added. Now the safeties are adjusted to check for it.
Includes a minor update of the naming scheme
parent 6da8158d
No related branches found
No related tags found
1 merge request!415Include all unpackers in the new /reco/steer/ based scheme
Pipeline #12343 passed
...@@ -41,8 +41,8 @@ void CbmRecoUnpack::Finish() ...@@ -41,8 +41,8 @@ void CbmRecoUnpack::Finish()
if (fRichConfig) fRichConfig->GetUnpacker()->Finish(); if (fRichConfig) fRichConfig->GetUnpacker()->Finish();
if (fStsConfig) fStsConfig->GetUnpacker()->Finish(); if (fStsConfig) fStsConfig->GetUnpacker()->Finish();
if (fTofConfig) fTofConfig->GetUnpacker()->Finish(); if (fTofConfig) fTofConfig->GetUnpacker()->Finish();
if (fTrdConfig) fTrdConfig->GetUnpacker()->Finish(); if (fTrd1DConfig) fTrd1DConfig->GetUnpacker()->Finish();
if (fTrdConfig2D) fTrdConfig2D->GetUnpacker()->Finish(); if (fTrd2DConfig) fTrd2DConfig->GetUnpacker()->Finish();
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
...@@ -70,20 +70,27 @@ Bool_t CbmRecoUnpack::Init() ...@@ -70,20 +70,27 @@ Bool_t CbmRecoUnpack::Init()
// --- Sts // --- Sts
if (fStsConfig) fStsConfig->Init(ioman); if (fStsConfig) fStsConfig->Init(ioman);
// --- Tof // --- Tof
// if (fTofConfig) fTofConfig->Init(ioman); if (fTofConfig) fTofConfig->Init(ioman);
// --- Trd // --- Trd
if (fTrdConfig) fTrdConfig->Init(ioman); if (fTrd1DConfig) fTrd1DConfig->Init(ioman);
// --- TRD2D // --- TRD2D
if (fTrdConfig2D->GetOutputBranchName() == fTrdConfig->GetOutputBranchName()) { if (fTrd2DConfig) {
fTrdConfig2D->SetOutputVec(fTrdConfig->GetOutputVec()); if (fTrd1DConfig) {
if (fTrdConfig2D) fTrdConfig2D->InitUnpacker(); if (fTrd2DConfig->GetOutputBranchName() == fTrd1DConfig->GetOutputBranchName()) {
} LOG(info) << fTrd2DConfig->GetName() << "::Init() ---------------------------------";
else { fTrd2DConfig->SetOutputVec(fTrd1DConfig->GetOutputVec());
if (fTrdConfig2D) fTrdConfig2D->Init(ioman); fTrd2DConfig->InitUnpacker();
LOG(info) << fTrd2DConfig->GetName() << " succesful initialized -----------------\n";
}
else {
fTrd2DConfig->Init(ioman);
}
}
else {
fTrd2DConfig->Init(ioman);
}
} }
// This is an ugly work around, because the TRD and TRD2D want to access the same vector and there is no function to retrieve a writeable vector<obj> from the FairRootManager, especially before the branches are created, as far as I am aware. The second option workaround is in in Init() to look for the fasp config and create a separate branch for fasp created CbmTrdDigis PR 072021 // This is an ugly work around, because the TRD and TRD2D want to access the same vector and there is no function to retrieve a writeable vector<obj> from the FairRootManager, especially before the branches are created, as far as I am aware. The second option workaround is in in Init() to look for the fasp config and create a separate branch for fasp created CbmTrdDigis PR 072021
// --- Tof
if (fTofConfig) fTofConfig->Init(ioman);
return kTRUE; return kTRUE;
} }
...@@ -102,13 +109,11 @@ void CbmRecoUnpack::Reset() ...@@ -102,13 +109,11 @@ void CbmRecoUnpack::Reset()
// ---- Sts ---- // ---- Sts ----
if (fStsConfig) fStsConfig->Reset(); if (fStsConfig) fStsConfig->Reset();
// ---- Tof ---- // ---- Tof ----
// if (fTofConfig) fTofConfig->Reset(); if (fTofConfig) fTofConfig->Reset();
// ---- Trd ---- // ---- Trd ----
if (fTrdConfig) fTrdConfig->Reset(); if (fTrd1DConfig) fTrd1DConfig->Reset();
// ---- Trd2D ---- // ---- Trd2D ----
if (fTrdConfig2D) fTrdConfig2D->Reset(); if (fTrd2DConfig) fTrd2DConfig->Reset();
// ---- Tof ----
if (fTofConfig) fTofConfig->Reset();
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
...@@ -148,25 +153,24 @@ void CbmRecoUnpack::Unpack(unique_ptr<Timeslice> ts) ...@@ -148,25 +153,24 @@ void CbmRecoUnpack::Unpack(unique_ptr<Timeslice> ts)
unpack(&timeslice, component, fStsConfig, fStsConfig->GetOptOutAVec(), fStsConfig->GetOptOutBVec())); unpack(&timeslice, component, fStsConfig, fStsConfig->GetOptOutAVec(), fStsConfig->GetOptOutBVec()));
break; break;
} }
case fkFlesTof: {
if (fTofConfig)
fCbmTsEventHeader->SetNDigisTof(
unpack(&timeslice, component, fTofConfig, fTofConfig->GetOptOutAVec(), fTofConfig->GetOptOutBVec()));
break;
}
case fkFlesTrd: { case fkFlesTrd: {
if (fTrdConfig) if (fTrd1DConfig)
fCbmTsEventHeader->SetNDigisTrd( fCbmTsEventHeader->SetNDigisTrd(
unpack(&timeslice, component, fTrdConfig, fTrdConfig->GetOptOutAVec(), fTrdConfig->GetOptOutBVec())); unpack(&timeslice, component, fTrd1DConfig, fTrd1DConfig->GetOptOutAVec(), fTrd1DConfig->GetOptOutBVec()));
break; break;
} }
case fkFlesTrd2D: { case fkFlesTrd2D: {
if (fTrdConfig2D) if (fTrd2DConfig)
fCbmTsEventHeader->SetNDigisTrd2D( fCbmTsEventHeader->SetNDigisTrd2D(
unpack(&timeslice, component, fTrdConfig2D, fTrdConfig2D->GetOptOutAVec(), fTrdConfig2D->GetOptOutBVec())); unpack(&timeslice, component, fTrd2DConfig, fTrd2DConfig->GetOptOutAVec(), fTrd2DConfig->GetOptOutBVec()));
break;
}
case fkFlesTof: {
if (fTofConfig)
fCbmTsEventHeader->SetNDigisTof(
unpack(&timeslice, component, fTofConfig, fTofConfig->GetOptOutAVec(), fTofConfig->GetOptOutBVec()));
break; break;
} }
default: { default: {
if (fDoDebugPrints) LOG(error) << "Unpack: Unknown system ID " << systemId << " for component " << component; if (fDoDebugPrints) LOG(error) << "Unpack: Unknown system ID " << systemId << " for component " << component;
break; break;
......
...@@ -82,10 +82,10 @@ public: ...@@ -82,10 +82,10 @@ public:
// void SetUnpackConfig(std::shared_ptr<CbmTofUnpackConfig> config) { fTofConfig = config; } // void SetUnpackConfig(std::shared_ptr<CbmTofUnpackConfig> config) { fTofConfig = config; }
/** @brief Set the Trd Unpack Config @param config */ /** @brief Set the Trd Unpack Config @param config */
void SetUnpackConfig(std::shared_ptr<CbmTrdUnpackConfig> config) { fTrdConfig = config; } void SetUnpackConfig(std::shared_ptr<CbmTrdUnpackConfig> config) { fTrd1DConfig = config; }
/** @brief Set the Trd2D Unpack Config @param config */ /** @brief Set the Trd2D Unpack Config @param config */
void SetUnpackConfig(std::shared_ptr<CbmTrdUnpackConfigFasp2D> config) { fTrdConfig2D = config; } void SetUnpackConfig(std::shared_ptr<CbmTrdUnpackConfigFasp2D> config) { fTrd2DConfig = config; }
/** @brief Set the Tof Unpack Config @param config */ /** @brief Set the Tof Unpack Config @param config */
void SetUnpackConfig(std::shared_ptr<CbmTofUnpackConfig> config) { fTofConfig = config; } void SetUnpackConfig(std::shared_ptr<CbmTofUnpackConfig> config) { fTofConfig = config; }
...@@ -210,10 +210,10 @@ private: ...@@ -210,10 +210,10 @@ private:
std::shared_ptr<CbmTofUnpackConfig> fTofConfig = nullptr; //! std::shared_ptr<CbmTofUnpackConfig> fTofConfig = nullptr; //!
/** @brief Configuration of the Trd unpacker. Provides the configured algorithm */ /** @brief Configuration of the Trd unpacker. Provides the configured algorithm */
std::shared_ptr<CbmTrdUnpackConfig> fTrdConfig = nullptr; //! std::shared_ptr<CbmTrdUnpackConfig> fTrd1DConfig = nullptr; //!
/** @brief Configuration of the Trd unpacker. Provides the configured algorithm */ /** @brief Configuration of the Trd unpacker. Provides the configured algorithm */
std::shared_ptr<CbmTrdUnpackConfigFasp2D> fTrdConfig2D = nullptr; //! std::shared_ptr<CbmTrdUnpackConfigFasp2D> fTrd2DConfig = nullptr; //!
/** @brief Pointer to the Timeslice start time used to write it to the output tree @remark since we hand this to the FairRootManager it also wants to delete it and we do not have to take care of deletion */ /** @brief Pointer to the Timeslice start time used to write it to the output tree @remark since we hand this to the FairRootManager it also wants to delete it and we do not have to take care of deletion */
CbmTsEventHeader* fCbmTsEventHeader = nullptr; CbmTsEventHeader* fCbmTsEventHeader = nullptr;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment