Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 11 additions & 2 deletions ALICE3/Core/FastTracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,20 @@ std::map<std::string, std::map<std::string, std::string>> GeometryContainer::par
void GeometryContainer::init(o2::framework::InitContext& initContext)
{
std::vector<std::string> detectorConfiguration;
const bool found = common::core::getTaskOptionValue(initContext, "on-the-fly-detector-geometry-provider", "detectorConfiguration", detectorConfiguration, false);
if (!found) {
const bool foundDetectorConfiguration = common::core::getTaskOptionValue(initContext, "on-the-fly-detector-geometry-provider", "detectorConfiguration", detectorConfiguration, false);
if (!foundDetectorConfiguration) {
LOG(fatal) << "Could not retrieve detector configuration from OnTheFlyDetectorGeometryProvider task.";
return;
}
LOG(info) << "Size of detector configuration: " << detectorConfiguration.size();

bool cleanLutWhenLoaded;
const bool foundCleanLutWhenLoaded = common::core::getTaskOptionValue(initContext, "on-the-fly-detector-geometry-provider", "cleanLutWhenLoaded", cleanLutWhenLoaded, false);
if (!foundCleanLutWhenLoaded) {
LOG(fatal) << "Could not retrieve foundCleanLutWhenLoaded option from OnTheFlyDetectorGeometryProvider task.";
return;
}

for (std::string& configFile : detectorConfiguration) {
if (configFile.rfind("ccdb:", 0) == 0) {
LOG(info) << "ccdb source detected from on-the-fly-detector-geometry-provider";
Expand All @@ -107,6 +115,7 @@ void GeometryContainer::init(o2::framework::InitContext& initContext)

LOG(info) << "Detector geometry configuration file used: " << configFile;
addEntry(configFile);
setLutCleanupSetting(cleanLutWhenLoaded);
}
}

Expand Down
3 changes: 3 additions & 0 deletions ALICE3/Core/FastTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ class GeometryContainer

// Add a geometry entry from a configuration file
void addEntry(const std::string& filename) { entries.emplace_back(filename); }
void setLutCleanupSetting(const bool cleanLutWhenLoaded) { mCleanLutWhenLoaded = cleanLutWhenLoaded; }

// Getters
int getNumberOfConfigurations() const { return entries.size(); }
const std::vector<GeometryEntry>& getEntries() const { return entries; }
const GeometryEntry& getEntry(const int id) const { return entries.at(id); }
GeometryEntry getGeometryEntry(const int id) const { return entries.at(id); }
bool cleanLutWhenLoaded() const { return mCleanLutWhenLoaded; }

// Get configuration maps
std::map<std::string, std::map<std::string, std::string>> getConfigurations(const int id) const { return entries.at(id).getConfigurations(); }
Expand All @@ -92,6 +94,7 @@ class GeometryContainer

private:
std::vector<GeometryEntry> entries;
bool mCleanLutWhenLoaded = true;
};

// +-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

struct OnTheFlyDetectorGeometryProvider {
o2::framework::HistogramRegistry histos{"Histos", {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject};
o2::framework::Configurable<bool> cleanLutWhenLoaded{"cleanLutWhenLoaded", true, "clean LUTs after being loaded to save disk space"};
o2::framework::Configurable<std::vector<std::string>> detectorConfiguration{"detectorConfiguration",
std::vector<std::string>{"$O2PHYSICS_ROOT/share/alice3/a3geometry_v3.ini"},
"Paths of the detector geometry configuration files"};
Expand Down Expand Up @@ -64,7 +65,7 @@ struct OnTheFlyDetectorGeometryProvider {
}
detectorConfiguration.value[idx] = configFile; // Update the filename to the local file
}
LOG(info) << "Adding " << configFile << "geometry container";
LOG(info) << "Adding " << configFile << " to geometry container";
geometryContainer.addEntry(configFile);
idx++;
}
Expand Down
101 changes: 50 additions & 51 deletions ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ struct OnTheFlyRichPid {
Configurable<float> bRichRefractiveIndexSector20{"bRichRefractiveIndexSector20", 1.03, "barrel RICH refractive index central(s)-20 and central(s)+20"}; // central(s)-20 and central(s)+20
Configurable<float> bRICHPixelSize{"bRICHPixelSize", 0.1, "barrel RICH pixel size (cm)"};
Configurable<float> bRichGapRefractiveIndex{"bRichGapRefractiveIndex", 1.000283, "barrel RICH gap refractive index"};
Configurable<bool> cleanLutWhenLoaded{"cleanLutWhenLoaded", true, "clean LUTs after being loaded to save disk space"};

o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;

Expand Down Expand Up @@ -292,59 +291,59 @@ struct OnTheFlyRichPid {
mGeoContainer.init(initContext);

const int nGeometries = mGeoContainer.getNumberOfConfigurations();
mMagneticField = mGeoContainer.getFloatValue(0, "global", "magneticfield");

pRandomNumberGenerator.SetSeed(0); // fully randomize
mMagneticField = mGeoContainer.getFloatValue(0, "global", "magneticfield");

for (int icfg = 0; icfg < nGeometries; ++icfg) {
const std::string histPath = "Configuration_" + std::to_string(icfg) + "/";
mSmearer.emplace_back(std::make_unique<o2::delphes::DelphesO2TrackSmearer>());
mSmearer[icfg]->setCleanupDownloadedFile(cleanLutWhenLoaded.value);
mSmearer[icfg]->setCcdbManager(ccdb.operator->());
mSmearer[icfg]->setDownloadPath("./.ALICE3/RICHPID/");
std::map<std::string, std::string> globalConfiguration = mGeoContainer.getConfiguration(icfg, "global");
for (const auto& entry : globalConfiguration) {
int pdg = 0;
if (entry.first.find("lut") != 0) {
continue;
}
if (entry.first.find("lutEl") != std::string::npos) {
pdg = kElectron;
} else if (entry.first.find("lutMu") != std::string::npos) {
pdg = kMuonMinus;
} else if (entry.first.find("lutPi") != std::string::npos) {
pdg = kPiPlus;
} else if (entry.first.find("lutKa") != std::string::npos) {
pdg = kKPlus;
} else if (entry.first.find("lutPr") != std::string::npos) {
pdg = kProton;
} else if (entry.first.find("lutDe") != std::string::npos) {
pdg = o2::constants::physics::kDeuteron;
} else if (entry.first.find("lutTr") != std::string::npos) {
pdg = o2::constants::physics::kTriton;
} else if (entry.first.find("lutHe3") != std::string::npos) {
pdg = o2::constants::physics::kHelium3;
} else if (entry.first.find("lutAl") != std::string::npos) {
pdg = o2::constants::physics::kAlpha;
}
if (flagRICHLoadDelphesLUTs) {
for (int icfg = 0; icfg < nGeometries; ++icfg) {
mSmearer.emplace_back(std::make_unique<o2::delphes::DelphesO2TrackSmearer>());
mSmearer[icfg]->setCleanupDownloadedFile(mGeoContainer.cleanLutWhenLoaded());
mSmearer[icfg]->setCcdbManager(ccdb.operator->());
mSmearer[icfg]->setDownloadPath("./.ALICE3/RICHPID/");
std::map<std::string, std::string> globalConfiguration = mGeoContainer.getConfiguration(icfg, "global");
for (const auto& entry : globalConfiguration) {
int pdg = 0;
if (entry.first.find("lut") != 0) {
continue;
}
if (entry.first.find("lutEl") != std::string::npos) {
pdg = kElectron;
} else if (entry.first.find("lutMu") != std::string::npos) {
pdg = kMuonMinus;
} else if (entry.first.find("lutPi") != std::string::npos) {
pdg = kPiPlus;
} else if (entry.first.find("lutKa") != std::string::npos) {
pdg = kKPlus;
} else if (entry.first.find("lutPr") != std::string::npos) {
pdg = kProton;
} else if (entry.first.find("lutDe") != std::string::npos) {
pdg = o2::constants::physics::kDeuteron;
} else if (entry.first.find("lutTr") != std::string::npos) {
pdg = o2::constants::physics::kTriton;
} else if (entry.first.find("lutHe3") != std::string::npos) {
pdg = o2::constants::physics::kHelium3;
} else if (entry.first.find("lutAl") != std::string::npos) {
pdg = o2::constants::physics::kAlpha;
}

std::string filename = entry.second;
if (pdg == 0) {
LOG(fatal) << "Unknown LUT entry " << entry.first << " for global configuration";
}
LOG(info) << "Loading LUT for pdg " << pdg << " for config " << icfg << " from provided file '" << filename << "'";
if (filename.empty()) {
LOG(warning) << "No LUT file passed for pdg " << pdg << ", skipping.";
}
// strip from leading/trailing spaces
filename.erase(0, filename.find_first_not_of(" "));
filename.erase(filename.find_last_not_of(" ") + 1);
if (filename.empty()) {
LOG(warning) << "No LUT file passed for pdg " << pdg << ", skipping.";
}
bool success = mSmearer[icfg]->loadTable(pdg, filename.c_str());
if (!success) {
LOG(fatal) << "Having issue with loading the LUT " << pdg << " " << filename;
std::string filename = entry.second;
if (pdg == 0) {
LOG(fatal) << "Unknown LUT entry " << entry.first << " for global configuration";
}
LOG(info) << "Loading LUT for pdg " << pdg << " for config " << icfg << " from provided file '" << filename << "'";
if (filename.empty()) {
LOG(warning) << "No LUT file passed for pdg " << pdg << ", skipping.";
}
// strip from leading/trailing spaces
filename.erase(0, filename.find_first_not_of(" "));
filename.erase(filename.find_last_not_of(" ") + 1);
if (filename.empty()) {
LOG(warning) << "No LUT file passed for pdg " << pdg << ", skipping.";
}
bool success = mSmearer[icfg]->loadTable(pdg, filename.c_str());
if (!success) {
LOG(fatal) << "Having issue with loading the LUT " << pdg << " " << filename;
}
}
}
}
Expand Down
100 changes: 50 additions & 50 deletions ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ struct OnTheFlyTofPid {
Configurable<int> nBinsMult{"nBinsMult", 200, "number of bins in multiplicity"};
Configurable<float> maxMultRange{"maxMultRange", 1000.f, "upper limit in multiplicity plots"};
} plotsConfig;
Configurable<bool> cleanLutWhenLoaded{"cleanLutWhenLoaded", true, "clean LUTs after being loaded to save disk space"};

o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;

Expand All @@ -154,56 +153,57 @@ struct OnTheFlyTofPid {
mMagneticField = mGeoContainer.getFloatValue(0, "global", "magneticfield");

pRandomNumberGenerator.SetSeed(0); // fully randomize
if (simConfig.flagTOFLoadDelphesLUTs) {
for (int icfg = 0; icfg < nGeometries; ++icfg) {
const std::string histPath = "Configuration_" + std::to_string(icfg) + "/";
mSmearer.emplace_back(std::make_unique<o2::delphes::DelphesO2TrackSmearer>());
mSmearer[icfg]->setCleanupDownloadedFile(mGeoContainer.cleanLutWhenLoaded());
mSmearer[icfg]->setCcdbManager(ccdb.operator->());
mSmearer[icfg]->setDownloadPath("./.ALICE3/TOFPID/");
std::map<std::string, std::string> globalConfiguration = mGeoContainer.getConfiguration(icfg, "global");
for (const auto& entry : globalConfiguration) {
int pdg = 0;
if (entry.first.find("lut") != 0) {
continue;
}
if (entry.first.find("lutEl") != std::string::npos) {
pdg = kElectron;
} else if (entry.first.find("lutMu") != std::string::npos) {
pdg = kMuonMinus;
} else if (entry.first.find("lutPi") != std::string::npos) {
pdg = kPiPlus;
} else if (entry.first.find("lutKa") != std::string::npos) {
pdg = kKPlus;
} else if (entry.first.find("lutPr") != std::string::npos) {
pdg = kProton;
} else if (entry.first.find("lutDe") != std::string::npos) {
pdg = o2::constants::physics::kDeuteron;
} else if (entry.first.find("lutTr") != std::string::npos) {
pdg = o2::constants::physics::kTriton;
} else if (entry.first.find("lutHe3") != std::string::npos) {
pdg = o2::constants::physics::kHelium3;
} else if (entry.first.find("lutAl") != std::string::npos) {
pdg = o2::constants::physics::kAlpha;
}

for (int icfg = 0; icfg < nGeometries; ++icfg) {
const std::string histPath = "Configuration_" + std::to_string(icfg) + "/";
mSmearer.emplace_back(std::make_unique<o2::delphes::DelphesO2TrackSmearer>());
mSmearer[icfg]->setCleanupDownloadedFile(cleanLutWhenLoaded.value);
mSmearer[icfg]->setCcdbManager(ccdb.operator->());
mSmearer[icfg]->setDownloadPath("./.ALICE3/TOFPID/");
std::map<std::string, std::string> globalConfiguration = mGeoContainer.getConfiguration(icfg, "global");
for (const auto& entry : globalConfiguration) {
int pdg = 0;
if (entry.first.find("lut") != 0) {
continue;
}
if (entry.first.find("lutEl") != std::string::npos) {
pdg = kElectron;
} else if (entry.first.find("lutMu") != std::string::npos) {
pdg = kMuonMinus;
} else if (entry.first.find("lutPi") != std::string::npos) {
pdg = kPiPlus;
} else if (entry.first.find("lutKa") != std::string::npos) {
pdg = kKPlus;
} else if (entry.first.find("lutPr") != std::string::npos) {
pdg = kProton;
} else if (entry.first.find("lutDe") != std::string::npos) {
pdg = o2::constants::physics::kDeuteron;
} else if (entry.first.find("lutTr") != std::string::npos) {
pdg = o2::constants::physics::kTriton;
} else if (entry.first.find("lutHe3") != std::string::npos) {
pdg = o2::constants::physics::kHelium3;
} else if (entry.first.find("lutAl") != std::string::npos) {
pdg = o2::constants::physics::kAlpha;
}

std::string filename = entry.second;
if (pdg == 0) {
LOG(fatal) << "Unknown LUT entry " << entry.first << " for global configuration";
}
LOG(info) << "Loading LUT for pdg " << pdg << " for config " << icfg << " from provided file '" << filename << "'";
if (filename.empty()) {
LOG(warning) << "No LUT file passed for pdg " << pdg << ", skipping.";
}
// strip from leading/trailing spaces
filename.erase(0, filename.find_first_not_of(" "));
filename.erase(filename.find_last_not_of(" ") + 1);
if (filename.empty()) {
LOG(warning) << "No LUT file passed for pdg " << pdg << ", skipping.";
}
bool success = mSmearer[icfg]->loadTable(pdg, filename.c_str());
if (!success) {
LOG(fatal) << "Having issue with loading the LUT " << pdg << " " << filename;
std::string filename = entry.second;
if (pdg == 0) {
LOG(fatal) << "Unknown LUT entry " << entry.first << " for global configuration";
}
LOG(info) << "Loading LUT for pdg " << pdg << " for config " << icfg << " from provided file '" << filename << "'";
if (filename.empty()) {
LOG(warning) << "No LUT file passed for pdg " << pdg << ", skipping.";
}
// strip from leading/trailing spaces
filename.erase(0, filename.find_first_not_of(" "));
filename.erase(filename.find_last_not_of(" ") + 1);
if (filename.empty()) {
LOG(warning) << "No LUT file passed for pdg " << pdg << ", skipping.";
}
bool success = mSmearer[icfg]->loadTable(pdg, filename.c_str());
if (!success) {
LOG(fatal) << "Having issue with loading the LUT " << pdg << " " << filename;
}
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions ALICE3/TableProducer/OTF/onTheFlyTracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ struct OnTheFlyTracker {
Configurable<bool> processUnreconstructedTracks{"processUnreconstructedTracks", false, "process (smear) unreco-ed tracks"};
Configurable<bool> doExtraQA{"doExtraQA", false, "do extra 2D QA plots"};
Configurable<bool> extraQAwithoutDecayDaughters{"extraQAwithoutDecayDaughters", false, "remove decay daughters from qa plots (yes/no)"};
Configurable<bool> cleanLutWhenLoaded{"cleanLutWhenLoaded", true, "clean LUTs after being loaded to save disk space"};

struct : ConfigurableGroup {
ConfigurableAxis axisMomentum{"axisMomentum", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "#it{p} (GeV/#it{c})"};
Expand Down Expand Up @@ -319,7 +318,7 @@ struct OnTheFlyTracker {
for (int icfg = 0; icfg < nGeometries; ++icfg) {
const std::string histPath = "Configuration_" + std::to_string(icfg) + "/";
mSmearer.emplace_back(std::make_unique<o2::delphes::DelphesO2TrackSmearer>());
mSmearer[icfg]->setCleanupDownloadedFile(cleanLutWhenLoaded.value);
mSmearer[icfg]->setCleanupDownloadedFile(mGeoContainer.cleanLutWhenLoaded());
mSmearer[icfg]->setCcdbManager(ccdb.operator->());
mSmearer[icfg]->setDownloadPath("./.ALICE3/Tracker/");
std::map<std::string, std::string> globalConfiguration = mGeoContainer.getConfiguration(icfg, "global");
Expand Down
Loading