Skip to content

Commit be614d2

Browse files
committed
Recover buildMatBudLUT mods for upgrades
1 parent 6863937 commit be614d2

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

Detectors/Base/test/buildMatBudLUT.C

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#include "DetectorsBase/MatLayerCyl.h"
1818
#include "DetectorsBase/GeometryManager.h"
1919
#include "ITSMFTReconstruction/ChipMappingITS.h"
20-
#include "ITS3Simulation/DescriptorInnerBarrelITS3.h"
21-
#include "ITS3Base/SpecsV2.h"
2220
#include "CommonUtils/NameConf.h"
2321
#include <TFile.h>
2422
#include <TSystem.h>
@@ -31,7 +29,7 @@ o2::base::MatLayerCylSet mbLUT;
3129

3230
bool testMBLUT(const std::string& lutFile = "matbud.root");
3331

34-
bool buildMatBudLUT(int nTst = 60, int maxLr = -1, const std::string& outFile = "matbud.root", const std::string& geomName = "o2sim_geometry-aligned.root");
32+
bool buildMatBudLUT(int nTst = 30, int maxLr = -1, const std::string& outFile = "matbud.root", const std::string& geomNamePrefix = "o2sim", const std::string& opts = "");
3533

3634
struct LrData {
3735
float rMin = 0.f;
@@ -46,14 +44,17 @@ struct LrData {
4644
std::vector<LrData> lrData;
4745
void configLayers();
4846

49-
bool buildMatBudLUT(int nTst, int maxLr, const std::string& outFile, const std::string& geomNameInput)
47+
bool buildMatBudLUT(int nTst, int maxLr, const std::string& outFile, const std::string& geomNamePrefix, const std::string& opts)
5048
{
51-
auto geomName = o2::base::NameConf::getGeomFileName(geomNameInput);
49+
auto geomName = o2::base::NameConf::getGeomFileName(geomNamePrefix);
5250
if (gSystem->AccessPathName(geomName.c_str())) { // if needed, create geometry
53-
std::cout << geomName << " does not exist. Will create it\n";
54-
gSystem->Exec("$O2_ROOT/bin/o2-sim -n 0 --detectorList ALICE2.1");
51+
std::cout << geomName << " does not exist. Will create it on the fly\n";
52+
std::stringstream str;
53+
// constructing an **unaligned** geom (Geant3 used since faster initialization) --> can be avoided by passing an existing geometry
54+
str << "${O2_ROOT}/bin/o2-sim-serial -n 0 -e TGeant3 --configKeyValues \"" << opts << "\" --field 0 -o " << geomNamePrefix;
55+
gSystem->Exec(str.str().c_str());
5556
}
56-
o2::base::GeometryManager::loadGeometry(geomNameInput);
57+
o2::base::GeometryManager::loadGeometry(geomNamePrefix);
5758
configLayers();
5859

5960
if (maxLr < 1) {
@@ -63,7 +64,7 @@ bool buildMatBudLUT(int nTst, int maxLr, const std::string& outFile, const std::
6364
}
6465
for (int i = 0; i < maxLr; i++) {
6566
auto& l = lrData[i];
66-
printf("L:%3d %6.4f<R<%6.4f ZH=%5.4f | dz = %6.4f drph = %6.4f\n", i, l.rMin, l.rMax, l.zHalf, l.dZMin, l.dRPhiMin);
67+
printf("L:%3d %6.2f<R<%6.2f ZH=%5.1f | dz = %6.2f drph = %6.2f\n", i, l.rMin, l.rMax, l.zHalf, l.dZMin, l.dRPhiMin);
6768
mbLUT.addLayer(l.rMin, l.rMax, l.zHalf, l.dZMin, l.dRPhiMin);
6869
}
6970

0 commit comments

Comments
 (0)