5555#include < string_view>
5656#include < vector>
5757
58- #define O2_DEFINE_CONFIGURABLE (NAME, TYPE, DEFAULT, HELP ) Configurable<TYPE > NAME {#NAME , DEFAULT , HELP };
58+ #define O2_DEFINE_CONFIGURABLE (NAME, TYPE, DEFAULT, HELP ) Configurable<TYPE > NAME {#NAME , ( DEFAULT ), ( HELP ) };
5959
6060using namespace o2 ;
6161using namespace o2 ::framework;
@@ -200,7 +200,7 @@ struct ZdcQVectors {
200200 std::unique_ptr<TF1 > fMultCutHigh = nullptr ;
201201 std::unique_ptr<TF1 > fMultMultPVCut = nullptr ;
202202
203- Service<ccdb::BasicCCDBManager> ccdb;
203+ Service<ccdb::BasicCCDBManager> ccdb{} ;
204204
205205 // keep track of calibration histos for each given step and iteration
206206 struct Calib {
@@ -713,7 +713,13 @@ struct ZdcQVectors {
713713 hist = dynamic_cast <T*>(list->FindObject (Form (" %s" , objName)));
714714 } else if (cm == kTimestamp ) {
715715 auto list = dynamic_cast <TList*>(cal.calibList [cm]->FindObject (Form (" it%i_step%i" , iteration, step)));
716+ if (!list) {
717+ LOGF (fatal, " No calibration list for iteration %i and step %i" , iteration, step);
718+ }
716719 hist = dynamic_cast <T*>(list->FindObject (Form (" %s" , objName)));
720+ if (!hist) {
721+ LOGF (fatal, " No calibration histo for iteration %i and step %i -> %s" , iteration, step, objName);
722+ }
717723 } else if (cm == kRec ) {
718724 auto list = dynamic_cast <TList*>(cal.calibList [cm]->FindObject (Form (" it%i_step%i" , iteration, step)));
719725 if (!list) {
@@ -733,12 +739,15 @@ struct ZdcQVectors {
733739 if (hist->InheritsFrom (" TProfile2D" )) {
734740 // needed for energy calibration!
735741 auto h = dynamic_cast <TProfile2D*>(hist);
742+ if (h){
736743 TString name = h->GetName ();
737744 int binrunnumber = h->GetXaxis ()->FindBin (TString::Format (" %d" , cal.runnumber ));
738745 int bin = h->GetYaxis ()->FindBin (cal.centrality );
739746 calibConstant = h->GetBinContent (binrunnumber, bin);
747+ }
740748 } else if (hist->InheritsFrom (" TProfile" )) {
741749 auto h = dynamic_cast <TProfile*>(hist);
750+ if (h){
742751 TString name = h->GetName ();
743752 int bin{};
744753 if (name.Contains (" mean_vx" )) {
@@ -760,9 +769,11 @@ struct ZdcQVectors {
760769 bin = h->GetXaxis ()->FindBin (cal.timestamp );
761770 }
762771 calibConstant = h->GetBinContent (bin);
772+ }
763773 } else if (hist->InheritsFrom (" THnSparse" )) {
764774 std::vector<int > sparsePars;
765775 auto h = dynamic_cast <THnSparseD*>(hist);
776+ if (h){
766777 sparsePars.push_back (h->GetAxis (0 )->FindBin (cal.centrality ));
767778 sparsePars.push_back (h->GetAxis (1 )->FindBin (cal.v [0 ]));
768779 sparsePars.push_back (h->GetAxis (2 )->FindBin (cal.v [1 ]));
@@ -783,6 +794,7 @@ struct ZdcQVectors {
783794
784795 delete tempProj;
785796 }
797+ }
786798
787799 return calibConstant;
788800 }
@@ -1157,8 +1169,14 @@ struct ZdcQVectors {
11571169 if (!cfgCCDBdir_Shift.value .empty () && !cal.isShiftProfileFound ) {
11581170 LOGF (info, " Getting shift profile from CCDB for runnumber: %d" , runnumber);
11591171 TList* hcorrList = ccdb->getForTimeStamp <TList>(cfgCCDBdir_Shift.value , foundBC.timestamp ());
1160- cal.shiftprofileC = dynamic_cast <TProfile3D*>(hcorrList->FindObject (" ShiftZDCC" ));
1161- cal.shiftprofileA = dynamic_cast <TProfile3D*>(hcorrList->FindObject (" ShiftZDCA" ));
1172+ auto shiftProfileC = dynamic_cast <TProfile3D*>(hcorrList->FindObject (" ShiftZDCC" ));
1173+ if (shiftProfileC) {
1174+ cal.shiftprofileC = shiftProfileC;
1175+ }
1176+ auto shiftProfileA = dynamic_cast <TProfile3D*>(hcorrList->FindObject (" ShiftZDCA" ));
1177+ if (shiftProfileA) {
1178+ cal.shiftprofileA = shiftProfileA;
1179+ }
11621180 if (!cal.shiftprofileC || !cal.shiftprofileA ) {
11631181 LOGF (error, " Shift profile not found in CCDB for runnumber: %d" , runnumber);
11641182 cal.isShiftProfileFound = false ;
0 commit comments