Skip to content

Commit

Permalink
Picodst fixes (#585)
Browse files Browse the repository at this point in the history
Leszek reported (on the simulations list) an issue with converting
simulation MuDsts to picoDsts. The code issues a couple of errors, and
then crashes. I believe this is due to a faulty assumption in
initialization. The code relies on the filename begining with "st_" in
order to determine the basename of the file, when the full path is
given. This fails for Leszek's case (and for any pure simualtion). When
the assumption fails, the initialization routine returns before creating
the TTree. This results in the crash during Make, when the null pointer
to the TTree is deferenced.

This PR removes the faulty assumption, and makes early returns from
Init() a "fatal" return rather than just an error.
  • Loading branch information
klendathu2k authored Sep 25, 2023
1 parent 127445c commit 7eaf967
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions StRoot/StPicoDstMaker/StPicoDstMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@
#include "StPicoEvent/StPicoArrays.h"
#include "StPicoEvent/StPicoDst.h"
#include "StPicoDstMaker/StPicoDstMaker.h"
#include "TSystem.h"
#if defined (__TFG__VERSION__)
#include "StarRoot/TDirIter.h"
#include "StMuDSTMaker/COMMON/StMuProbPidTraits.h"
#include "TSystem.h"
#include "TH1.h"
#include "TH2.h"
static Int_t _debug = 0;
Expand Down Expand Up @@ -278,20 +278,20 @@ Int_t StPicoDstMaker::Init() {

if (setVtxModeAttr() != kStOK) {
LOG_ERROR << "Pico Vertex Mode is not set ... " << endm;
return kStErr;
return kStFatal;
}
} //if (mVtxMode == PicoVtxMode::NotSet)

// To write or not to write covariance matrices into the branch
if (setCovMtxModeAttr() != kStOK) {
LOG_ERROR << "Pico covariance matrix I/O mode is not set ..." << endm;
return kStErr;
return kStFatal;
}

// To write or not to write BEmc Smd hits into the branch
if (setBEmcSmdModeAttr() != kStOk) {
LOG_ERROR << "Pico BEmc Smd I/O mode is not set ..." << endm;
return kStErr;
return kStFatal;
}

#if !defined (__TFG__VERSION__)
Expand All @@ -302,13 +302,13 @@ Int_t StPicoDstMaker::Init() {
mOutputFileName.ReplaceAll(".root", ".picoDst.root");
}
else {
mInputFileName = mInputFileName(mInputFileName.Index("st_"), mInputFileName.Length());
mInputFileName = gSystem->BaseName(mInputFileName);
mOutputFileName = mInputFileName;
mOutputFileName.ReplaceAll("MuDst.root", "picoDst.root");

if (mOutputFileName == mInputFileName) {
LOG_ERROR << "Input file is not a MuDst ... " << endm;
return kStErr;
return kStFatal;
}
}
#else /* __TFG__VERSION__ */
Expand Down

0 comments on commit 7eaf967

Please sign in to comment.