|
| 1 | +int test_tgeo_units() |
| 2 | +{ |
| 3 | + // Between root version v6.18.02 and v6.25.01 a differnt unit |
| 4 | + // system (from Geant4) was used which results in problems. |
| 5 | + // To work around the problem in the main steering class FairRunAna |
| 6 | + // the ROOT unit system is set as default. |
| 7 | + // When using tye wrong unit system the radiation length and the |
| 8 | + // interaction lenght has a value which is a factor 10 smaller than |
| 9 | + // when using the correct unit system. |
| 10 | + // This tests checks if the proper unit system is used. |
| 11 | + |
| 12 | + Int_t root_version = gROOT->GetVersionInt(); |
| 13 | + cout << "Root Version: " << root_version << endl; |
| 14 | + |
| 15 | + FairRunSim* run = new FairRunSim(); |
| 16 | + |
| 17 | + // Define the values for the correct unit system |
| 18 | + Double_t correctRadLengthAl{8.87561}; |
| 19 | + Double_t correctIntLengthAl{38.8622}; |
| 20 | + |
| 21 | + TGeoManager* geom = new TGeoManager("test_tgeo_units", "Test if the radiation lengtyh is the expected one"); |
| 22 | + cout << endl; |
| 23 | + |
| 24 | + // Create a new material with the propertoes of aluminum |
| 25 | + // and get the radiation and interaction length values from it |
| 26 | + TGeoMaterial* matAl = new TGeoMaterial("BP_aluminium", 26.9815386, 13, 2.7, 24.01); |
| 27 | + Double_t radLength = matAl->GetRadLen(); |
| 28 | + Double_t intLength = matAl->GetIntLen(); |
| 29 | + |
| 30 | + // Compare the expected values with the actual ones and fail the test |
| 31 | + // if they are not equal |
| 32 | + if (((correctRadLengthAl - radLength) < 0.001) && ((correctIntLengthAl - intLength) < 0.001)) { |
| 33 | + return 0; |
| 34 | + } else { |
| 35 | + cout << "Radiation or interaction length differnt from expectation" << endl; |
| 36 | + cout << "Expected radiation length : " << correctRadLengthAl << endl; |
| 37 | + cout << "Radiation length : " << radLength << endl; |
| 38 | + cout << "Expected Interaction length : " << correctIntLengthAl << endl; |
| 39 | + cout << "Interaction length : " << intLength << endl; |
| 40 | + return 1; |
| 41 | + } |
| 42 | +} |
0 commit comments