|
21 | 21 | #include "FairRuntimeDb.h" // for FairRuntimeDb |
22 | 22 | #include "FairTask.h" // for FairTask |
23 | 23 |
|
24 | | -#include <TFile.h> // for TFile |
| 24 | +#include <RVersion.h> // for ROOT_VERSION_CODE and ROOT_VERSION |
| 25 | +#include <TFile.h> // for TFile |
| 26 | +#include <TGeoManager.h> // for gGeoManager, TGeoManager |
| 27 | +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 18, 2) && ROOT_VERSION_CODE <= ROOT_VERSION(6, 22, 6) |
| 28 | +#include <TGeoSystemOfUnits.h> // for TGeoUnit::kTGeoUnits |
| 29 | +#endif |
25 | 30 | #include <TList.h> // for TList |
26 | 31 | #include <TObject.h> // for TObject |
27 | 32 | #include <cassert> // for... well, assert |
@@ -50,8 +55,28 @@ FairRun::FairRun(Bool_t isMaster) |
50 | 55 | Fatal("FairRun", "Singleton instance already exists."); |
51 | 56 | return; |
52 | 57 | } |
| 58 | + |
53 | 59 | fRunInstance = this; |
54 | 60 |
|
| 61 | + // Fix the unit system to the ROOT one which was the default before ROOT v6.18.02. |
| 62 | + // With ROOT v6.18.02 the ROOT team introduced a new unit system (taken from Geant4) |
| 63 | + // for the geometry manager. The change was reverted with ROOT v6.25.1. |
| 64 | + // Unfortunately the way to set the default units to the ROOT one is |
| 65 | + // different for different ROOT versions such that the code needs some |
| 66 | + // preprocessor statements. |
| 67 | + // Before version v6.18.2 and after v6.25.1 the units are correct |
| 68 | + // by default |
| 69 | + |
| 70 | +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 18, 2) && ROOT_VERSION_CODE <= ROOT_VERSION(6, 22, 6) |
| 71 | + TGeoUnit::setUnitType(TGeoUnit::kTGeoUnits); |
| 72 | +#endif |
| 73 | + |
| 74 | +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 22, 8) && ROOT_VERSION_CODE <= ROOT_VERSION(6, 25, 1) |
| 75 | + TGeoManager::LockDefaultUnits(false); |
| 76 | + TGeoManager::SetDefaultUnits(TGeoManager::EDefaultUnits::kRootUnits); |
| 77 | + TGeoManager::LockDefaultUnits(true); |
| 78 | +#endif |
| 79 | + |
55 | 80 | fRootManager = FairRootManager::Instance(); |
56 | 81 |
|
57 | 82 | new FairLinkManager(); |
|
0 commit comments