Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions Detectors/Base/test/buildMatBudLUT.C
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "DetectorsBase/MatLayerCyl.h"
#include "DetectorsBase/GeometryManager.h"
#include "ITSMFTReconstruction/ChipMappingITS.h"
#include "ITS3Simulation/DescriptorInnerBarrelITS3.h"
#include "ITS3Base/SpecsV2.h"
#include "CommonUtils/NameConf.h"
#include <TFile.h>
#include <TSystem.h>
Expand All @@ -31,7 +29,7 @@ o2::base::MatLayerCylSet mbLUT;

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

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

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

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

if (maxLr < 1) {
Expand All @@ -63,7 +64,7 @@ bool buildMatBudLUT(int nTst, int maxLr, const std::string& outFile, const std::
}
for (int i = 0; i < maxLr; i++) {
auto& l = lrData[i];
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);
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);
mbLUT.addLayer(l.rMin, l.rMax, l.zHalf, l.dZMin, l.dRPhiMin);
}

Expand Down