Skip to content

Commit ef3cd2b

Browse files
committed
Merge remote-tracking branch 'upstream/master' into f1pmixbkg
2 parents b820e26 + 088b554 commit ef3cd2b

File tree

68 files changed

+6485
-3401
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+6485
-3401
lines changed

.github/workflows/mega-linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
id: ml
3939
# You can override MegaLinter flavor used to have faster performances
4040
# More info at https://megalinter.io/flavors/
41-
uses: oxsecurity/megalinter@v8.8.0
41+
uses: oxsecurity/megalinter@v9.0.1
4242
env:
4343
# All available variables are described in documentation:
4444
# https://megalinter.io/configuration/

ALICE3/Core/FastTracker.cxx

Lines changed: 78 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ namespace fastsim
3030

3131
void FastTracker::AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi, float resZ, float eff, int type)
3232
{
33+
LOG(debug) << "Adding layer " << name << " r=" << r << " z=" << z << " x0=" << x0 << " xrho=" << xrho << " resRPhi=" << resRPhi << " resZ=" << resZ << " eff=" << eff << " type=" << type;
3334
DetLayer newLayer(name, r, z, x0, xrho, resRPhi, resZ, eff, type);
3435
// Check that efficient layers are not inert layers
3536
if (newLayer.getEfficiency() > 0.0f && newLayer.isInert()) {
@@ -144,27 +145,42 @@ void FastTracker::AddSiliconALICE3v2(std::vector<float> pixelResolution)
144145
AddLayer("B10", 80., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
145146
}
146147

147-
void FastTracker::AddSiliconALICE3(std::vector<float> pixelResolution)
148+
void FastTracker::AddSiliconALICE3(float scaleX0VD, std::vector<float> pixelResolution)
148149
{
149-
float x0IT = 0.001; // 0.1%
150+
float x0Pipe0 = 0.001592; // 200 um AlBe
151+
float x0VDL0 = 0.00076; // 30 um Si + 50 um glue + carbon foam 0.03%
152+
float x0VDL1 = 0.00096; // 30 um Si + 50 um glue + carbon foam 0.05%
153+
float x0VDL2 = 0.00167; // 30 um Si + 50 um glue + carbon foam 0.05% + 0.07% Be case
154+
float x0Coldplate = 0.02f; // (1.5 mm Al2O3 2%)
155+
float x0Pipe1 = 0.0023f; // 800 um Be
150156
float x0OT = 0.01; // 1.0%
151-
float xrhoIB = 2.3292e-02; // 100 mum Si
152-
float xrhoOT = 2.3292e-01; // 1000 mum Si
153-
float eff = 1.00;
157+
float x0iTOF = x0OT * 3.;
154158

155-
float resRPhiIT = pixelResolution[0];
156-
float resZIT = pixelResolution[1];
159+
float resRPhiVD = pixelResolution[0];
160+
float resZVD = pixelResolution[1];
157161
float resRPhiOT = pixelResolution[2];
158162
float resZOT = pixelResolution[3];
159163

160-
AddLayer("bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0); // 150 mum Be
161-
AddLayer("B00", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
162-
AddLayer("B01", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
163-
AddLayer("B02", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
164-
AddLayer("bpipe1", 3.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0); // 500 mum Be
164+
float xrhoPipe0 = 0;
165+
float xrhoVDL0 = 0;
166+
float xrhoVDL1 = 0;
167+
float xrhoVDL2 = 0;
168+
float xrhoColdplate = 0;
169+
float xrhoPipe1 = 0;
170+
float xrhoOT = 2.3292e-01;
171+
float xrhoiTOF = 0.03;
172+
float eff = 1.00;
173+
174+
AddLayer("bpipe0", 0.48, 250, x0Pipe0, xrhoPipe0, 0.0f, 0.0f, 0.0f, 0);
175+
AddLayer("B00", 0.5, 250, x0VDL0 * scaleX0VD, xrhoVDL0, resRPhiVD, resZVD, eff, 1);
176+
AddLayer("B01", 1.2, 250, x0VDL1 * scaleX0VD, xrhoVDL1, resRPhiVD, resZVD, eff, 1);
177+
AddLayer("B02", 2.5, 250, x0VDL2 * scaleX0VD, xrhoVDL2, resRPhiVD, resZVD, eff, 1);
178+
AddLayer("coldplate", 2.6, 250, x0Coldplate, xrhoColdplate, 0.0f, 0.0f, 0.0f, 0);
179+
AddLayer("bpipe1", 5.7, 250, x0Pipe1, xrhoPipe1, 0.0f, 0.0f, 0.0f, 0);
165180
AddLayer("B03", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
166181
AddLayer("B04", 9., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
167182
AddLayer("B05", 12., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
183+
AddLayer("iTOF", 19, 250, x0iTOF, xrhoiTOF, resRPhiOT, resZOT, eff, 0);
168184
AddLayer("B06", 20., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
169185
AddLayer("B07", 30., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
170186
AddLayer("B08", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
@@ -217,6 +233,56 @@ void FastTracker::AddTPC(float phiResMean, float zResMean)
217233
}
218234
}
219235

236+
void FastTracker::AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBManager* ccdbManager)
237+
{
238+
LOG(info) << " Adding generic detector from file " << filename;
239+
// If the filename starts with ccdb: then take the file from the ccdb
240+
if (filename.rfind("ccdb:", 0) == 0) {
241+
std::string ccdbPath = filename.substr(5); // remove "ccdb:" prefix
242+
if (ccdbManager == nullptr) {
243+
LOG(fatal) << "CCDB manager is null, cannot retrieve file " << ccdbPath;
244+
return;
245+
}
246+
const std::string outPath = "/tmp/DetGeo/";
247+
filename = Form("%s/%s/snapshot.root", outPath.c_str(), ccdbPath.c_str());
248+
std::ifstream checkFile(filename); // Check if file already exists
249+
if (!checkFile.is_open()) { // File does not exist, retrieve from CCDB
250+
LOG(info) << " --- CCDB source detected for detector geometry " << filename;
251+
std::map<std::string, std::string> metadata;
252+
ccdbManager->getCCDBAccessor().retrieveBlob(ccdbPath, outPath, metadata, 1);
253+
// Add CCDB handling logic here if needed
254+
LOG(info) << " --- Now retrieving geometry configuration from CCDB to: " << filename;
255+
} else { // File exists, proceed to load
256+
LOG(info) << " --- Geometry configuration file already exists: " << filename << ". Skipping download.";
257+
checkFile.close();
258+
}
259+
AddGenericDetector(filename, nullptr);
260+
return;
261+
}
262+
263+
std::ifstream infile(filename);
264+
if (!infile.is_open()) {
265+
LOG(fatal) << "Could not open detector configuration file: " << filename;
266+
return;
267+
}
268+
269+
std::string line;
270+
while (std::getline(infile, line)) {
271+
if (line.empty() || line[0] == '#')
272+
continue; // skip comments and empty lines
273+
std::istringstream iss(line);
274+
std::string name;
275+
float r, z, x0, xrho, resRPhi, resZ, eff;
276+
int type;
277+
if (!(iss >> name >> r >> z >> x0 >> xrho >> resRPhi >> resZ >> eff >> type)) {
278+
LOG(error) << "Malformed line in detector config: " << line;
279+
continue;
280+
}
281+
AddLayer(name.c_str(), r, z, x0, xrho, resRPhi, resZ, eff, type);
282+
}
283+
infile.close();
284+
}
285+
220286
float FastTracker::Dist(float z, float r)
221287
{
222288
// porting of DetektorK::Dist

ALICE3/Core/FastTracker.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414

1515
#include "DetLayer.h"
1616

17-
#include "ReconstructionDataFormats/Track.h"
17+
#include <CCDB/BasicCCDBManager.h>
18+
#include <ReconstructionDataFormats/Track.h>
1819

19-
#include <fairlogger/Logger.h> // not a system header but megalinter thinks so
20+
#include <fairlogger/Logger.h>
2021

2122
#include <string>
2223
#include <vector>
@@ -59,8 +60,19 @@ class FastTracker
5960

6061
void AddSiliconALICE3v4(std::vector<float> pixelResolution);
6162
void AddSiliconALICE3v2(std::vector<float> pixelResolution);
62-
void AddSiliconALICE3(std::vector<float> pixelResolution);
63+
void AddSiliconALICE3(float scaleX0VD, std::vector<float> pixelResolution);
6364
void AddTPC(float phiResMean, float zResMean);
65+
/**
66+
* @brief Adds a generic detector configuration from the specified file.
67+
*
68+
* This function loads and integrates a detector configuration into the tracker
69+
* using the provided filename. The file should contain the necessary parameters
70+
* and settings for the detector to be added.
71+
*
72+
* @param filename Path to the configuration file describing the detector.
73+
* @param ccdbManager Pointer to a BasicCCDBManager instance for database access (if needed).
74+
*/
75+
void AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBManager* ccdbManager = nullptr);
6476

6577
void Print();
6678

ALICE3/TableProducer/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ o2physics_add_dpl_workflow(alice3-trackextension
2121
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::ReconstructionDataFormats
2222
COMPONENT_NAME Analysis)
2323

24-
o2physics_add_dpl_workflow(alice3-pid-tof
25-
SOURCES alice3-pidTOF.cxx
26-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::ALICE3Core
27-
COMPONENT_NAME Analysis)
28-
2924
o2physics_add_dpl_workflow(alice3-centrality
3025
SOURCES alice3-centrality.cxx
3126
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore

ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx

Lines changed: 44 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,31 @@
3838
#include "Common/Core/trackUtilities.h"
3939
#include "Common/DataModel/TrackSelectionTables.h"
4040

41-
#include "CCDB/BasicCCDBManager.h"
42-
#include "CCDB/CcdbApi.h"
43-
#include "CommonConstants/GeomConstants.h"
44-
#include "CommonConstants/MathConstants.h"
45-
#include "CommonConstants/PhysicsConstants.h"
46-
#include "CommonUtils/NameConf.h"
47-
#include "DataFormatsCalibration/MeanVertexObject.h"
48-
#include "DataFormatsParameters/GRPMagField.h"
49-
#include "DetectorsBase/GeometryManager.h"
50-
#include "DetectorsBase/Propagator.h"
51-
#include "DetectorsVertexing/HelixHelper.h"
52-
#include "Framework/ASoAHelpers.h"
53-
#include "Framework/AnalysisDataModel.h"
54-
#include "Framework/AnalysisTask.h"
55-
#include "Framework/HistogramRegistry.h"
56-
#include "Framework/O2DatabasePDGPlugin.h"
57-
#include "Framework/RunningWorkflowInfo.h"
58-
#include "Framework/runDataProcessing.h"
59-
#include "ReconstructionDataFormats/DCA.h"
60-
#include "ReconstructionDataFormats/PID.h"
61-
62-
#include "TRandom3.h"
63-
#include "TString.h"
64-
#include "TVector3.h"
41+
#include <CCDB/BasicCCDBManager.h>
42+
#include <CCDB/CcdbApi.h>
43+
#include <CommonConstants/GeomConstants.h>
44+
#include <CommonConstants/MathConstants.h>
45+
#include <CommonConstants/PhysicsConstants.h>
46+
#include <CommonUtils/NameConf.h>
47+
#include <DataFormatsCalibration/MeanVertexObject.h>
48+
#include <DataFormatsParameters/GRPMagField.h>
49+
#include <DetectorsBase/GeometryManager.h>
50+
#include <DetectorsBase/Propagator.h>
51+
#include <DetectorsVertexing/HelixHelper.h>
52+
#include <Framework/ASoAHelpers.h>
53+
#include <Framework/AnalysisDataModel.h>
54+
#include <Framework/AnalysisTask.h>
55+
#include <Framework/HistogramRegistry.h>
56+
#include <Framework/O2DatabasePDGPlugin.h>
57+
#include <Framework/RunningWorkflowInfo.h>
58+
#include <Framework/runDataProcessing.h>
59+
#include <ReconstructionDataFormats/DCA.h>
60+
#include <ReconstructionDataFormats/PID.h>
61+
6562
#include <TPDGCode.h>
63+
#include <TRandom3.h>
64+
#include <TString.h>
65+
#include <TVector3.h>
6666

6767
#include <cmath>
6868
#include <map>
@@ -80,6 +80,8 @@ struct OnTheFlyRichPid {
8080

8181
// necessary for particle charges
8282
Service<o2::framework::O2DatabasePDG> pdg;
83+
// Necessary for LUTs
84+
Service<o2::ccdb::BasicCCDBManager> ccdb;
8385

8486
// master setting: magnetic field
8587
Configurable<float> magneticField{"magneticField", 0, "magnetic field (kilogauss) if 0, taken from the tracker task"};
@@ -131,14 +133,6 @@ struct OnTheFlyRichPid {
131133
Configurable<float> bRICHPixelSize{"bRICHPixelSize", 0.1, "barrel RICH pixel size (cm)"};
132134
Configurable<float> bRichGapRefractiveIndex{"bRichGapRefractiveIndex", 1.000283, "barrel RICH gap refractive index"};
133135

134-
struct : ConfigurableGroup {
135-
Configurable<std::string> lutEl{"lutEl", "inherit", "LUT for electrons (if inherit, inherits from otf tracker task)"};
136-
Configurable<std::string> lutMu{"lutMu", "inherit", "LUT for muons (if inherit, inherits from otf tracker task)"};
137-
Configurable<std::string> lutPi{"lutPi", "inherit", "LUT for pions (if inherit, inherits from otf tracker task)"};
138-
Configurable<std::string> lutKa{"lutKa", "inherit", "LUT for kaons (if inherit, inherits from otf tracker task)"};
139-
Configurable<std::string> lutPr{"lutPr", "inherit", "LUT for protons (if inherit, inherits from otf tracker task)"};
140-
} simConfig;
141-
142136
o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;
143137

144138
// Track smearer (here used to get relative pt and eta uncertainties)
@@ -304,47 +298,27 @@ struct OnTheFlyRichPid {
304298
LOG(info) << "Bz = " << magneticField.value << " T";
305299
}
306300

307-
// Check if inheriting the LUT configuration
308-
auto configLutPath = [&](Configurable<std::string>& lut) {
309-
if (lut.value != "inherit") {
310-
return;
311-
}
312-
if (!getTaskOptionValue(initContext, "on-the-fly-tracker", lut, false)) {
313-
LOG(fatal) << "Could not get " << lut.name << " from on-the-fly-tracker task";
314-
}
315-
};
316-
configLutPath(simConfig.lutEl);
317-
configLutPath(simConfig.lutMu);
318-
configLutPath(simConfig.lutPi);
319-
configLutPath(simConfig.lutKa);
320-
configLutPath(simConfig.lutPr);
321-
322301
// Load LUT for pt and eta smearing
323302
if (flagIncludeTrackAngularRes && flagRICHLoadDelphesLUTs) {
324-
std::map<int, const char*> mapPdgLut;
325-
const char* lutElChar = simConfig.lutEl->c_str();
326-
const char* lutMuChar = simConfig.lutMu->c_str();
327-
const char* lutPiChar = simConfig.lutPi->c_str();
328-
const char* lutKaChar = simConfig.lutKa->c_str();
329-
const char* lutPrChar = simConfig.lutPr->c_str();
330-
331-
LOGF(info, "Will load electron lut file ..: %s for RICH PID", lutElChar);
332-
LOGF(info, "Will load muon lut file ......: %s for RICH PID", lutMuChar);
333-
LOGF(info, "Will load pion lut file ......: %s for RICH PID", lutPiChar);
334-
LOGF(info, "Will load kaon lut file ......: %s for RICH PID", lutKaChar);
335-
LOGF(info, "Will load proton lut file ....: %s for RICH PID", lutPrChar);
336-
337-
mapPdgLut.insert(std::make_pair(11, lutElChar));
338-
mapPdgLut.insert(std::make_pair(13, lutMuChar));
339-
mapPdgLut.insert(std::make_pair(211, lutPiChar));
340-
mapPdgLut.insert(std::make_pair(321, lutKaChar));
341-
mapPdgLut.insert(std::make_pair(2212, lutPrChar));
342-
343-
for (const auto& e : mapPdgLut) {
344-
if (!mSmearer.loadTable(e.first, e.second)) {
345-
LOG(fatal) << "Having issue with loading the LUT " << e.first << " " << e.second;
303+
mSmearer.setCcdbManager(ccdb.operator->());
304+
auto loadLUT = [&](int pdg, const std::string& cfgNameToInherit) {
305+
std::string lut = "none";
306+
if (!getTaskOptionValue(initContext, "on-the-fly-tracker", cfgNameToInherit, lut, false)) {
307+
LOG(fatal) << "Could not get " << cfgNameToInherit << " from on-the-fly-tracker task";
346308
}
347-
}
309+
bool success = mSmearer.loadTable(pdg, lut.c_str());
310+
if (!success && !lut.empty()) {
311+
LOG(fatal) << "Having issue with loading the LUT " << pdg << " " << lut;
312+
}
313+
};
314+
loadLUT(11, "lutEl");
315+
loadLUT(13, "lutMu");
316+
loadLUT(211, "lutPi");
317+
loadLUT(321, "lutKa");
318+
loadLUT(2212, "lutPr");
319+
loadLUT(1000010020, "lutDe");
320+
loadLUT(1000010030, "lutTr");
321+
loadLUT(1000020030, "lutHe3");
348322
}
349323

350324
if (doQAplots) {

0 commit comments

Comments
 (0)