Skip to content

Commit

Permalink
TGenEpEmv1: Return bool to indicate init success
Browse files Browse the repository at this point in the history
Currently TGenEpEmv1 fails when the initialization
fails (sampling of X-section).
This is sub-optimal since such abort will bring down
complete MC jobs the GRID.

This commit allows the caller to react to such error
condition. The caller may decide what to do (give it another go or to
exit).

Relates to https://alice.its.cern.ch/jira/browse/O2-3825
  • Loading branch information
sawenzel committed Jun 6, 2023
1 parent 4f84681 commit da8895c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions TEPEMGEN/TGenEpEmv1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ TGenEpEmv1::~TGenEpEmv1()
}

//____________________________________________________________
void TGenEpEmv1::Init()
bool TGenEpEmv1::Init()
{
// Initialisation:
// 1) define a generator
Expand All @@ -124,9 +124,10 @@ void TGenEpEmv1::Init()
double err = 0;
fXSection = CalcXSection(fXSectionEps,fMinXSTest,fMaxXSTest,err);
if (fXSection<=0 || err/fXSection>fXSectionEps) {
abort();
return false;
}
fXSectionEps = err/fXSection;
return true;
}

//____________________________________________________________
Expand Down
6 changes: 3 additions & 3 deletions TEPEMGEN/TGenEpEmv1.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class TGenEpEmv1 : public TEpEmGen {

public:
TGenEpEmv1();
virtual ~TGenEpEmv1();
~TGenEpEmv1() override;

virtual void GenerateEvent();
virtual void Init();
void GenerateEvent() override; // interface of TGenerator
bool Init(); // init function; returns true if successful; false otherwise
void SetDebug(Int_t debug) {fDebug=debug;}
void SetYRange(Double_t min, Double_t max) {fYMin = min; fYMax = max;};
void SetPtRange(Double_t min, Double_t max) {fPtMin = min; fPtMax = max;};
Expand Down

0 comments on commit da8895c

Please sign in to comment.