|
1 | 1 | /******************************************************************************** |
2 | | - * Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * |
| 2 | + * Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * |
3 | 3 | * * |
4 | 4 | * This software is distributed under the terms of the * |
5 | 5 | * GNU Lesser General Public Licence (LGPL) version 3, * |
@@ -40,38 +40,39 @@ FairParSet::FairParSet(const char* name, const char* title, const char* context, |
40 | 40 | } |
41 | 41 | } |
42 | 42 |
|
| 43 | +bool FairParSet::CallInitIO(FairParIo* io, const char* context) |
| 44 | +{ |
| 45 | + if (!io) { |
| 46 | + return false; |
| 47 | + } |
| 48 | + bool retval = init(io); |
| 49 | + if (!retval) { |
| 50 | + LOGP(warn, "{}({})::init(io) failed for {}", ClassName(), GetName(), context); |
| 51 | + } |
| 52 | + return retval; |
| 53 | +} |
| 54 | + |
43 | 55 | Bool_t FairParSet::init() |
44 | 56 | { |
45 | 57 | // intitializes the container from an input in run time |
46 | 58 | // database. If this is not successful it is initialized from |
47 | 59 | // the second input. If this failes too, it returns an error. |
48 | 60 | // (calls internally the init function in the derived class) |
49 | 61 | FairRuntimeDb* rtdb = FairRuntimeDb::instance(); |
50 | | - // FairRunAna* fRun =FairRunAna::Instance(); |
51 | | - // cout << "-I- FairParSet::init() " << GetName() << endl; |
52 | | - |
53 | | - bool allFound = false; |
54 | | - FairParIo* io = 0; |
55 | | - if (rtdb) { |
56 | | - io = rtdb->getFirstInput(); |
57 | | - if (io) { |
58 | | - 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 | | - } |
66 | | - } else { |
67 | | - setInputVersion(-1, 2); |
68 | | - } |
| 62 | + if (!rtdb) { |
| 63 | + LOG(error) << "FairParSet::init()/" << GetName() << ": No RTDB"; |
| 64 | + return false; |
69 | 65 | } |
| 66 | + |
| 67 | + bool allFound = CallInitIO(rtdb->getFirstInput(), "first input"); |
70 | 68 | if (allFound) { |
71 | | - return kTRUE; |
| 69 | + setInputVersion(-1, 2); |
| 70 | + return allFound; |
72 | 71 | } |
73 | | - LOG(error) << "init() " << GetName() << " not initialized"; |
74 | | - return kFALSE; |
| 72 | + |
| 73 | + allFound = CallInitIO(rtdb->getSecondInput(), "second input"); |
| 74 | + |
| 75 | + return allFound; |
75 | 76 | } |
76 | 77 |
|
77 | 78 | Int_t FairParSet::write() |
|
0 commit comments