Skip to content

Commit 0682194

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents bbd8d71 + 06b1097 commit 0682194

File tree

368 files changed

+28184
-14948
lines changed

Some content is hidden

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

368 files changed

+28184
-14948
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ IncludeCategories:
5151
Priority: 3
5252
CaseSensitive: true
5353
# O2
54-
- Regex: ^(<|")(Algorithm|CCDB|Common[A-Z]|DataFormats|DCAFitter|Detectors|EMCAL|Field|Framework|FT0|FV0|GlobalTracking|ITS|MathUtils|MFT|MCH|MID|PHOS|PID|ReconstructionDataFormats|SimulationDataFormat|TOF|TPC|ZDC).*/.*\.h
54+
- Regex: ^(<|")(Algorithm|CCDB|Common[A-Z]|DataFormats|DCAFitter|Detectors|EMCAL|Field|Framework|FT0|FV0|GlobalTracking|GPU|ITS|MathUtils|MFT|MCH|MID|PHOS|PID|ReconstructionDataFormats|SimulationDataFormat|TOF|TPC|ZDC).*/.*\.h
5555
Priority: 4
5656
CaseSensitive: true
5757
# ROOT

ALICE3/Core/DelphesO2TrackSmearer.cxx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636

3737
#include "ALICE3/Core/DelphesO2TrackSmearer.h"
3838

39+
#include <Framework/Logger.h>
40+
3941
namespace o2
4042
{
4143
namespace delphes
@@ -45,11 +47,38 @@ namespace delphes
4547

4648
bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload)
4749
{
48-
auto ipdg = getIndexPDG(pdg);
50+
if (!filename || filename[0] == '\0') {
51+
LOG(info) << " --- No LUT file provided for PDG " << pdg << ". Skipping load.";
52+
return false;
53+
}
54+
const auto ipdg = getIndexPDG(pdg);
55+
LOGF(info, "Will load %s lut file ..: '%s'", getParticleName(pdg), filename);
4956
if (mLUTHeader[ipdg] && !forceReload) {
5057
std::cout << " --- LUT table for PDG " << pdg << " has been already loaded with index " << ipdg << std::endl;
5158
return false;
5259
}
60+
if (strncmp(filename, "ccdb:", 5) == 0) { // Check if filename starts with "ccdb:"
61+
LOG(info) << " --- LUT file source identified as CCDB.";
62+
std::string path = std::string(filename).substr(5); // Remove "ccdb:" prefix
63+
const std::string outPath = "/tmp/LUTs/";
64+
filename = Form("%s/%s/snapshot.root", outPath.c_str(), path.c_str());
65+
std::ifstream checkFile(filename); // Check if file already exists
66+
if (!checkFile.is_open()) { // File does not exist, retrieve from CCDB
67+
LOG(info) << " --- CCDB source detected for PDG " << pdg << ": " << path;
68+
if (!mCcdbManager) {
69+
LOG(fatal) << " --- CCDB manager not set. Please set it before loading LUT from CCDB.";
70+
}
71+
std::map<std::string, std::string> metadata;
72+
mCcdbManager->getCCDBAccessor().retrieveBlob(path, outPath, metadata, 1);
73+
// Add CCDB handling logic here if needed
74+
LOG(info) << " --- Now retrieving LUT file from CCDB to: " << filename;
75+
} else { // File exists, proceed to load
76+
LOG(info) << " --- LUT file already exists: " << filename << ". Skipping download.";
77+
checkFile.close();
78+
}
79+
return loadTable(pdg, filename, forceReload);
80+
}
81+
5382
mLUTHeader[ipdg] = new lutHeader_t;
5483

5584
std::ifstream lutFile(filename, std::ifstream::binary);

ALICE3/Core/DelphesO2TrackSmearer.h

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@
2424
#ifndef ALICE3_CORE_DELPHESO2TRACKSMEARER_H_
2525
#define ALICE3_CORE_DELPHESO2TRACKSMEARER_H_
2626

27-
#include <map>
28-
#include <iostream>
29-
#include <fstream>
27+
#include <CCDB/BasicCCDBManager.h>
28+
#include <ReconstructionDataFormats/Track.h>
3029

31-
#include "TRandom.h"
32-
#include "ReconstructionDataFormats/Track.h"
30+
#include <TRandom.h>
31+
32+
#include <fstream>
33+
#include <iostream>
34+
#include <map>
3335

3436
///////////////////////////////
3537
/// DelphesO2/src/lutCovm.hh //
@@ -85,7 +87,7 @@ struct map_t {
8587
if (bin > nbins - 1)
8688
return nbins - 1;
8789
return bin;
88-
} //;
90+
} //;
8991
void print() { printf("nbins = %d, min = %f, max = %f, log = %s \n", nbins, min, max, log ? "on" : "off"); } //;
9092
};
9193

@@ -214,10 +216,34 @@ class TrackSmearer
214216
return 7; // Helium3
215217
default:
216218
return 2; // Default: pion
217-
} //;
218-
} //;
219+
}
220+
}
219221

220-
void setdNdEta(float val) { mdNdEta = val; } //;
222+
const char* getParticleName(int pdg)
223+
{
224+
switch (abs(pdg)) {
225+
case 11:
226+
return "electron";
227+
case 13:
228+
return "muon";
229+
case 211:
230+
return "pion";
231+
case 321:
232+
return "kaon";
233+
case 2212:
234+
return "proton";
235+
case 1000010020:
236+
return "deuteron";
237+
case 1000010030:
238+
return "triton";
239+
case 1000020030:
240+
return "helium3";
241+
default:
242+
return "pion"; // Default: pion
243+
}
244+
}
245+
void setdNdEta(float val) { mdNdEta = val; } //;
246+
void setCcdbManager(o2::ccdb::BasicCCDBManager* mgr) { mCcdbManager = mgr; } //;
221247

222248
protected:
223249
static constexpr unsigned int nLUTs = 8; // Number of LUT available
@@ -228,6 +254,9 @@ class TrackSmearer
228254
bool mSkipUnreconstructed = true; // don't smear tracks that are not reco'ed
229255
int mWhatEfficiency = 1;
230256
float mdNdEta = 1600.;
257+
258+
private:
259+
o2::ccdb::BasicCCDBManager* mCcdbManager = nullptr;
231260
};
232261

233262
} // namespace delphes

ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -239,42 +239,32 @@ struct OnTheFlyTracker {
239239

240240
// For TGenPhaseSpace seed
241241
TRandom3 rand;
242+
Service<o2::ccdb::BasicCCDBManager> ccdb;
242243

243244
void init(o2::framework::InitContext&)
244245
{
246+
247+
ccdb->setURL("http://alice-ccdb.cern.ch");
248+
ccdb->setTimestamp(-1);
249+
245250
if (enableLUT) {
246-
std::map<int, const char*> mapPdgLut;
247-
const char* lutElChar = lutEl->c_str();
248-
const char* lutMuChar = lutMu->c_str();
249-
const char* lutPiChar = lutPi->c_str();
250-
const char* lutKaChar = lutKa->c_str();
251-
const char* lutPrChar = lutPr->c_str();
252-
253-
LOGF(info, "Will load electron lut file ..: %s", lutElChar);
254-
LOGF(info, "Will load muon lut file ......: %s", lutMuChar);
255-
LOGF(info, "Will load pion lut file ......: %s", lutPiChar);
256-
LOGF(info, "Will load kaon lut file ......: %s", lutKaChar);
257-
LOGF(info, "Will load proton lut file ....: %s", lutPrChar);
258-
259-
mapPdgLut.insert(std::make_pair(11, lutElChar));
260-
mapPdgLut.insert(std::make_pair(13, lutMuChar));
261-
mapPdgLut.insert(std::make_pair(211, lutPiChar));
262-
mapPdgLut.insert(std::make_pair(321, lutKaChar));
263-
mapPdgLut.insert(std::make_pair(2212, lutPrChar));
264-
265-
if (enableNucleiSmearing) {
266-
const char* lutDeChar = lutDe->c_str();
267-
const char* lutTrChar = lutTr->c_str();
268-
const char* lutHe3Char = lutHe3->c_str();
269-
mapPdgLut.insert(std::make_pair(1000010020, lutDeChar));
270-
mapPdgLut.insert(std::make_pair(1000010030, lutTrChar));
271-
mapPdgLut.insert(std::make_pair(1000020030, lutHe3Char));
272-
}
273-
for (const auto& e : mapPdgLut) {
274-
if (!mSmearer.loadTable(e.first, e.second)) {
275-
LOG(fatal) << "Having issue with loading the LUT " << e.first << " " << e.second;
251+
mSmearer.setCcdbManager(ccdb.operator->());
252+
253+
auto loadLUT = [&](int pdg, const std::string& lutFile) {
254+
bool success = mSmearer.loadTable(pdg, lutFile.c_str());
255+
if (!success && !lutFile.empty()) {
256+
LOG(fatal) << "Having issue with loading the LUT " << pdg << " " << lutFile;
276257
}
277-
}
258+
};
259+
loadLUT(11, lutEl.value);
260+
loadLUT(13, lutMu.value);
261+
loadLUT(211, lutPi.value);
262+
loadLUT(321, lutKa.value);
263+
loadLUT(2212, lutPr.value);
264+
loadLUT(1000010020, lutDe.value);
265+
loadLUT(1000010030, lutTr.value);
266+
loadLUT(1000020030, lutHe3.value);
267+
278268
// interpolate efficiencies if requested to do so
279269
mSmearer.interpolateEfficiency(static_cast<bool>(interpolateLutEfficiencyVsNch));
280270

Common/CCDB/EventSelectionParams.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
#include "EventSelectionParams.h"
2020

21+
#include <cstddef>
22+
#include <cstring>
23+
2124
namespace o2::aod::evsel
2225
{
2326
const char* selectionLabels[kNsel] = {

Common/CCDB/RCTSelectionFlags.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
#define COMMON_CCDB_RCTSELECTIONFLAGS_H_
1919

2020
#include <CommonUtils/EnumFlags.h>
21-
#include <Rtypes.h>
22-
#include <TMath.h>
2321

24-
#include <stdexcept>
2522
#include <algorithm>
23+
#include <concepts>
24+
#include <cstdint>
25+
#include <initializer_list>
26+
#include <stdexcept>
2627
#include <string>
27-
#include <vector>
2828

2929
namespace o2::aod::rctsel
3030
{
@@ -98,7 +98,7 @@ class RCTFlagsChecker : public o2::utils::EnumFlags<RCTSelectionFlags>
9898
// - "CBT"
9999
// - "CBT_hadronPID"
100100
// - "CBT_electronPID"
101-
// - "CCBT_calo"
101+
// - "CBT_calo"
102102
// - "CBT_muon"
103103
// - "CBT_muon_glo"
104104
// The checkZDC boolean flag controls whether to iclude the ZDC quality in all the pre-defined selections (for Pb-Pb data)
@@ -121,7 +121,7 @@ class RCTFlagsChecker : public o2::utils::EnumFlags<RCTSelectionFlags>
121121
// - "CBT"
122122
// - "CBT_hadronPID"
123123
// - "CBT_electronPID"
124-
// - "CCBT_calo"
124+
// - "CBT_calo"
125125
// - "CBT_muon"
126126
// - "CBT_muon_glo"
127127
// The checkZDC boolean flag controls whether to iclude the ZDC quality in all the pre-defined selections (for Pb-Pb data)

Common/CCDB/TriggerAliases.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include "Common/CCDB/TriggerAliases.h"
13-
#include "Framework/Logger.h"
13+
14+
#include <Framework/Logger.h>
15+
16+
#include <cstdint>
17+
#include <string>
1418

1519
std::string aliasLabels[kNaliases] = {
1620
"kINT7",

Common/CCDB/TriggerAliases.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#define COMMON_CCDB_TRIGGERALIASES_H_
1414

1515
#include <Rtypes.h>
16+
#include <RtypesCore.h>
1617

1718
#include <cstdint>
1819
#include <map>

Common/CCDB/ctpRateFetcher.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@
1616
#include <DataFormatsCTP/Configuration.h>
1717
#include <DataFormatsCTP/Scalers.h>
1818
#include <DataFormatsParameters/GRPLHCIFData.h>
19+
#include <Framework/Logger.h>
1920

21+
#include <cmath>
22+
#include <cstddef>
23+
#include <cstdint>
2024
#include <map>
25+
#include <ostream>
2126
#include <string>
2227
#include <vector>
2328

Common/CCDB/ctpRateFetcher.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include <CCDB/BasicCCDBManager.h>
1616

17+
#include <cstdint>
1718
#include <string>
1819

1920
namespace o2

0 commit comments

Comments
 (0)