Skip to content

Commit cef3b20

Browse files
refactor(parbase): Improve logging in FairParSet
And re-arrange some if statements
1 parent 6f693ea commit cef3b20

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

fairroot/parbase/FairParSet.cxx

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -47,30 +47,34 @@ Bool_t FairParSet::init()
4747
// the second input. If this failes too, it returns an error.
4848
// (calls internally the init function in the derived class)
4949
FairRuntimeDb* rtdb = FairRuntimeDb::instance();
50-
// FairRunAna* fRun =FairRunAna::Instance();
51-
// cout << "-I- FairParSet::init() " << GetName() << endl;
50+
if (!rtdb) {
51+
LOG(error) << "FairParSet::init()/" << GetName() << ": No RTDB";
52+
return false;
53+
}
5254

5355
Bool_t allFound = kFALSE;
54-
FairParIo* io = 0;
55-
if (rtdb) {
56-
io = rtdb->getFirstInput();
56+
FairParIo* io = rtdb->getFirstInput();
57+
if (io) {
58+
allFound = init(io);
59+
} else {
60+
LOG(warn) << "FairParSet::init()/" << GetName() << ": No first input";
61+
}
62+
if (!allFound) {
63+
io = rtdb->getSecondInput();
64+
// cout << "-I FairParSet::init() 2 " << io << std::endl;
5765
if (io) {
5866
allFound = init(io);
59-
}
60-
if (!allFound) {
61-
io = rtdb->getSecondInput();
62-
// cout << "-I FairParSet::init() 2 " << io << std::endl;
63-
if (io) {
64-
allFound = init(io);
65-
}
6667
} else {
67-
setInputVersion(-1, 2);
68+
LOG(warn) << "FairParSet::init()/" << GetName() << ": No second input";
6869
}
70+
} else {
71+
setInputVersion(-1, 2);
6972
}
73+
7074
if (allFound) {
7175
return kTRUE;
7276
}
73-
LOG(error) << "init() " << GetName() << " not initialized";
77+
LOG(error) << "FairParSet::init()/" << GetName() << ": not initialized";
7478
return kFALSE;
7579
}
7680

0 commit comments

Comments
 (0)