Skip to content

Commit 53ec5c4

Browse files
authored
Merge pull request #16 from sawenzel/swenzel/patch
TGenEpEmv1: Return bool to indicate init success
2 parents 4f84681 + da8895c commit 53ec5c4

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

TEPEMGEN/TGenEpEmv1.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ TGenEpEmv1::~TGenEpEmv1()
109109
}
110110

111111
//____________________________________________________________
112-
void TGenEpEmv1::Init()
112+
bool TGenEpEmv1::Init()
113113
{
114114
// Initialisation:
115115
// 1) define a generator
@@ -124,9 +124,10 @@ void TGenEpEmv1::Init()
124124
double err = 0;
125125
fXSection = CalcXSection(fXSectionEps,fMinXSTest,fMaxXSTest,err);
126126
if (fXSection<=0 || err/fXSection>fXSectionEps) {
127-
abort();
127+
return false;
128128
}
129129
fXSectionEps = err/fXSection;
130+
return true;
130131
}
131132

132133
//____________________________________________________________

TEPEMGEN/TGenEpEmv1.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ class TGenEpEmv1 : public TEpEmGen {
2121

2222
public:
2323
TGenEpEmv1();
24-
virtual ~TGenEpEmv1();
24+
~TGenEpEmv1() override;
2525

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

0 commit comments

Comments
 (0)