From 0c23649390ffff93fb0c0a2c512a8371214472ae Mon Sep 17 00:00:00 2001 From: "s.zharko@gsi.de" <s.zharko@gsi.de> Date: Thu, 22 Sep 2022 14:25:49 +0200 Subject: [PATCH] L1: case of nullptr field included to CbmL1 --- reco/L1/CbmL1.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 2cee0aea39..f80d034c45 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -401,9 +401,18 @@ InitStatus CbmL1::Init() // ** Field initialization ** // ************************** - fInitManager.SetFieldFunction([](const double(&inPos)[3], double(&outB)[3]) { - CbmKF::Instance()->GetMagneticField()->GetFieldValue(inPos, outB); - }); + if (CbmKF::Instance()->GetMagneticField()) { + fInitManager.SetFieldFunction([](const double(&inPos)[3], double(&outB)[3]) { + CbmKF::Instance()->GetMagneticField()->GetFieldValue(inPos, outB); + }); + } + else { + fInitManager.SetFieldFunction([](const double(&)[3], double(&outB)[3]) { + outB[0] = 0.; + outB[1] = 0.; + outB[2] = 0.; + }); + } // *************************** // ** Target initialization ** -- GitLab