Skip to content

Commit b51dc6f

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 581a455 + e366f21 commit b51dc6f

File tree

60 files changed

+4560
-1074
lines changed

Some content is hidden

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

60 files changed

+4560
-1074
lines changed

.github/workflows/codeowner-self-approval.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
2626
steps:
2727
- name: Install dependencies
28-
run: pip install codeowners PyGithub
28+
run: pip install --break-system-packages codeowners PyGithub
2929

3030
# Approve the PR, if the author is only editing files owned by themselves.
3131
- name: Auto-approve PR if permitted

Common/TableProducer/centralityTable.cxx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,21 @@ struct CentralityTable {
249249
/* check the previous run number */
250250
auto bc = collision.bc_as<BCsWithTimestampsAndRun2Infos>();
251251
if (bc.runNumber() != mRunNumber) {
252+
mRunNumber = bc.runNumber(); // mark that this run has been attempted already regardless of outcome
252253
LOGF(debug, "timestamp=%llu", bc.timestamp());
253254
TList* callst = nullptr;
254255
if (ccdbConfig.reconstructionPass.value == "") {
255-
callst = ccdb->getForTimeStamp<TList>(ccdbConfig.ccdbPath, bc.timestamp());
256+
callst = ccdb->getForRun<TList>(ccdbConfig.ccdbPath, bc.runNumber());
256257
} else if (ccdbConfig.reconstructionPass.value == "metadata") {
257258
std::map<std::string, std::string> metadata;
258259
metadata["RecoPassName"] = metadataInfo.get("RecoPassName");
259-
callst = ccdb->getSpecific<TList>(ccdbConfig.ccdbPath, bc.timestamp(), metadata);
260+
LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName"));
261+
callst = ccdb->getSpecificForRun<TList>(ccdbConfig.ccdbPath, bc.runNumber(), metadata);
260262
} else {
261263
std::map<std::string, std::string> metadata;
262264
metadata["RecoPassName"] = ccdbConfig.reconstructionPass.value;
263-
callst = ccdb->getSpecific<TList>(ccdbConfig.ccdbPath, bc.timestamp(), metadata);
265+
LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", ccdbConfig.reconstructionPass.value);
266+
callst = ccdb->getSpecificForRun<TList>(ccdbConfig.ccdbPath, bc.runNumber(), metadata);
264267
}
265268

266269
Run2V0MInfo.mCalibrationStored = false;
@@ -350,15 +353,11 @@ struct CentralityTable {
350353
LOGF(fatal, "Calibration information from CL1 multiplicity for run %d corrupted", bc.runNumber());
351354
}
352355
}
353-
if (Run2V0MInfo.mCalibrationStored || Run2V0AInfo.mCalibrationStored || Run2SPDTksInfo.mCalibrationStored || Run2SPDClsInfo.mCalibrationStored || Run2CL0Info.mCalibrationStored || Run2CL1Info.mCalibrationStored) {
354-
mRunNumber = bc.runNumber();
355-
}
356356
} else {
357357
if (!ccdbConfig.doNotCrashOnNull) { // default behaviour: crash
358358
LOGF(fatal, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp());
359359
} else { // only if asked: continue filling with non-valid values (105)
360360
LOGF(info, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu, will fill tables with dummy values", bc.runNumber(), bc.timestamp());
361-
mRunNumber = bc.runNumber();
362361
}
363362
}
364363
}
@@ -473,6 +472,7 @@ struct CentralityTable {
473472
/* check the previous run number */
474473
auto bc = collision.template bc_as<BCsWithTimestamps>();
475474
if (bc.runNumber() != mRunNumber) {
475+
mRunNumber = bc.runNumber(); // mark that this run has been attempted already regardless of outcome
476476
LOGF(info, "timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber());
477477
TList* callst = nullptr;
478478
// Check if the ccdb path is a root file
@@ -485,15 +485,17 @@ struct CentralityTable {
485485
}
486486
} else {
487487
if (ccdbConfig.reconstructionPass.value == "") {
488-
callst = ccdb->getForTimeStamp<TList>(ccdbConfig.ccdbPath, bc.timestamp());
488+
callst = ccdb->getForRun<TList>(ccdbConfig.ccdbPath, bc.runNumber());
489489
} else if (ccdbConfig.reconstructionPass.value == "metadata") {
490490
std::map<std::string, std::string> metadata;
491491
metadata["RecoPassName"] = metadataInfo.get("RecoPassName");
492-
callst = ccdb->getSpecific<TList>(ccdbConfig.ccdbPath, bc.timestamp(), metadata);
492+
LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName"));
493+
callst = ccdb->getSpecificForRun<TList>(ccdbConfig.ccdbPath, bc.runNumber(), metadata);
493494
} else {
494495
std::map<std::string, std::string> metadata;
495496
metadata["RecoPassName"] = ccdbConfig.reconstructionPass.value;
496-
callst = ccdb->getSpecific<TList>(ccdbConfig.ccdbPath, bc.timestamp(), metadata);
497+
LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", ccdbConfig.reconstructionPass.value);
498+
callst = ccdb->getSpecificForRun<TList>(ccdbConfig.ccdbPath, bc.runNumber(), metadata);
497499
}
498500
}
499501

@@ -555,13 +557,11 @@ struct CentralityTable {
555557
break;
556558
}
557559
}
558-
mRunNumber = bc.runNumber();
559560
} else {
560561
if (!ccdbConfig.doNotCrashOnNull) { // default behaviour: crash
561562
LOGF(fatal, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp());
562563
} else { // only if asked: continue filling with non-valid values (105)
563564
LOGF(info, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu, will fill tables with dummy values", bc.runNumber(), bc.timestamp());
564-
mRunNumber = bc.runNumber();
565565
}
566566
}
567567
}

Common/TableProducer/multiplicityExtraTable.cxx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ struct MultiplicityExtraTable {
4141
Configurable<float> minFT0CforBCTable{"minFT0CforBCTable", 25.0f, "Minimum FT0C amplitude to fill BC table to reduce data"};
4242
Configurable<bool> saveOnlyBCsWithCollisions{"saveOnlyBCsWithCollisions", true, "save only BCs with collisions in them"};
4343

44+
Configurable<float> bcTableFloatPrecision{"bcTableFloatPrecision", 0.1, "float precision in bc table for data reduction"};
45+
46+
float tru(float value)
47+
{
48+
if (bcTableFloatPrecision < 1e-4)
49+
return value; // make sure nothing bad happens in case zero (best precision)
50+
return bcTableFloatPrecision * std::round(value / bcTableFloatPrecision) + 0.5f * bcTableFloatPrecision;
51+
};
52+
4453
// needed for downscale
4554
unsigned int randomSeed = 0;
4655

@@ -231,9 +240,10 @@ struct MultiplicityExtraTable {
231240

232241
bc2mult(bc2multArray[bc.globalIndex()]);
233242
multBC(
234-
multFT0A, multFT0C, posZFT0, posZFT0valid, multFV0A,
235-
multFDDA, multFDDC, multZNA, multZNC, multZEM1,
236-
multZEM2, multZPA, multZPC, Tvx, isFV0OrA,
243+
tru(multFT0A), tru(multFT0C),
244+
tru(posZFT0), posZFT0valid, tru(multFV0A),
245+
tru(multFDDA), tru(multFDDC), tru(multZNA), tru(multZNC), tru(multZEM1),
246+
tru(multZEM2), tru(multZPA), tru(multZPC), Tvx, isFV0OrA,
237247
multFV0TriggerBits, multFT0TriggerBits, multFDDTriggerBits, multBCTriggerMask, collidingBC,
238248
bc.flags());
239249
}

Common/TableProducer/multiplicityTable.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,15 +379,17 @@ struct MultiplicityTable {
379379
if (bc.runNumber() != mRunNumber) {
380380
mRunNumber = bc.runNumber(); // mark this run as at least tried
381381
if (ccdbConfig.reconstructionPass.value == "") {
382-
lCalibObjects = ccdb->getForTimeStamp<TList>(ccdbConfig.ccdbPath, bc.timestamp());
382+
lCalibObjects = ccdb->getForRun<TList>(ccdbConfig.ccdbPath, mRunNumber);
383383
} else if (ccdbConfig.reconstructionPass.value == "metadata") {
384384
std::map<std::string, std::string> metadata;
385385
metadata["RecoPassName"] = metadataInfo.get("RecoPassName");
386-
lCalibObjects = ccdb->getSpecific<TList>(ccdbConfig.ccdbPath, bc.timestamp(), metadata);
386+
LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName"));
387+
lCalibObjects = ccdb->getSpecificForRun<TList>(ccdbConfig.ccdbPath, mRunNumber, metadata);
387388
} else {
388389
std::map<std::string, std::string> metadata;
389390
metadata["RecoPassName"] = ccdbConfig.reconstructionPass.value;
390-
lCalibObjects = ccdb->getSpecific<TList>(ccdbConfig.ccdbPath, bc.timestamp(), metadata);
391+
LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", ccdbConfig.reconstructionPass.value);
392+
lCalibObjects = ccdb->getSpecificForRun<TList>(ccdbConfig.ccdbPath, mRunNumber, metadata);
391393
}
392394

393395
if (lCalibObjects) {

DPG/Tasks/AOTTrack/qaImpPar.cxx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ struct QaImpactPar {
112112
Configurable<bool> keepAllTracksPVrefit{"keepAllTracksPVrefit", false, "Keep all tracks for PV refit (for debug)"};
113113
Configurable<bool> use_customITSHitMap{"use_customITSHitMap", false, "Use custom ITS hitmap selection"};
114114
Configurable<int> customITShitmap{"customITShitmap", 0, "Custom ITS hitmap (consider the binary representation)"};
115+
Configurable<int> customITShitmap_exclude{"customITShitmap_exclude", 0, "Custom ITS hitmap of layers to be excluded (consider the binary representation)"};
115116
Configurable<int> n_customMinITShits{"n_customMinITShits", 0, "Minimum number of layers crossed by a track among those in \"customITShitmap\""};
116117
Configurable<bool> custom_forceITSTPCmatching{"custom_forceITSTPCmatching", false, "Consider or not only ITS-TPC macthed tracks when using custom ITS hitmap"};
117118

@@ -135,9 +136,9 @@ struct QaImpactPar {
135136

136137
/// Histogram registry (from o2::framework)
137138
HistogramRegistry histograms{"HistogramsImpParQA"};
138-
bool isPIDPionApplied = ((nSigmaTPCPionMin > -10.001 && nSigmaTPCPionMax < 10.001) || (nSigmaTOFPionMin > -10.001 && nSigmaTOFPionMax < 10.001));
139-
bool isPIDKaonApplied = ((nSigmaTPCKaonMin > -10.001 && nSigmaTPCKaonMax < 10.001) || (nSigmaTOFKaonMin > -10.001 && nSigmaTOFKaonMax < 10.001));
140-
bool isPIDProtonApplied = ((nSigmaTPCProtonMin > -10.001 && nSigmaTPCProtonMax < 10.001) || (nSigmaTOFProtonMin > -10.001 && nSigmaTOFProtonMax < 10.001));
139+
bool isPIDPionApplied;
140+
bool isPIDKaonApplied;
141+
bool isPIDProtonApplied;
141142

142143
// Needed for PV refitting
143144
Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -239,7 +240,7 @@ struct QaImpactPar {
239240
// }
240241
mRunNumber = -1;
241242

242-
/// Custom cut selection objects
243+
/// Custom cut selection objects - ITS layers that must be present
243244
std::set<uint8_t> set_customITShitmap; // = {};
244245
if (use_customITSHitMap) {
245246
for (int index_ITSlayer = 0; index_ITSlayer < 7; index_ITSlayer++) {
@@ -258,6 +259,24 @@ struct QaImpactPar {
258259

259260
selector_ITShitmap.SetRequireHitsInITSLayers(n_customMinITShits, set_customITShitmap);
260261
}
262+
/// Custom cut selection objects - ITS layers that must be absent
263+
std::set<uint8_t> set_customITShitmap_exclude; // = {};
264+
if (use_customITSHitMap) {
265+
for (int index_ITSlayer = 0; index_ITSlayer < 7; index_ITSlayer++) {
266+
if ((customITShitmap_exclude & (1 << index_ITSlayer)) > 0) {
267+
set_customITShitmap_exclude.insert(static_cast<uint8_t>(index_ITSlayer));
268+
}
269+
}
270+
LOG(info) << "### customITShitmap_exclude: " << customITShitmap_exclude;
271+
LOG(info) << "### set_customITShitmap_exclude.size(): " << set_customITShitmap_exclude.size();
272+
LOG(info) << "### ITS layers to be excluded: ";
273+
for (std::set<uint8_t>::iterator it = set_customITShitmap_exclude.begin(); it != set_customITShitmap_exclude.end(); it++) {
274+
LOG(info) << "Layer " << static_cast<int>(*it) << " ";
275+
}
276+
LOG(info) << "############";
277+
278+
selector_ITShitmap.SetRequireNoHitsInITSLayers(set_customITShitmap_exclude);
279+
}
261280

262281
// tracks
263282
const AxisSpec trackPtAxis{binningPt, "#it{p}_{T} (GeV/#it{c})"};
@@ -303,14 +322,17 @@ struct QaImpactPar {
303322
histograms.add("Reco/h4ImpParPulls", "", kTHnSparseD, {trackPtAxis, trackImpParRPhiPullsAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib});
304323
histograms.add("Reco/h4ImpParZPulls", "", kTHnSparseD, {trackPtAxis, trackImpParZPullsAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib});
305324
}
325+
isPIDPionApplied = ((nSigmaTPCPionMin > -10.001 && nSigmaTPCPionMax < 10.001) || (nSigmaTOFPionMin > -10.001 && nSigmaTOFPionMax < 10.001));
306326
if (isPIDPionApplied) {
307327
histograms.add("Reco/h4ImpPar_Pion", "", kTHnSparseD, {trackPtAxis, trackImpParRPhiAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib});
308328
histograms.add("Reco/h4ImpParZ_Pion", "", kTHnSparseD, {trackPtAxis, trackImpParZAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib});
309329
}
330+
isPIDKaonApplied = ((nSigmaTPCKaonMin > -10.001 && nSigmaTPCKaonMax < 10.001) || (nSigmaTOFKaonMin > -10.001 && nSigmaTOFKaonMax < 10.001));
310331
if (isPIDKaonApplied) {
311332
histograms.add("Reco/h4ImpPar_Kaon", "", kTHnSparseD, {trackPtAxis, trackImpParRPhiAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib});
312333
histograms.add("Reco/h4ImpParZ_Kaon", "", kTHnSparseD, {trackPtAxis, trackImpParZAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib});
313334
}
335+
isPIDProtonApplied = ((nSigmaTPCProtonMin > -10.001 && nSigmaTPCProtonMax < 10.001) || (nSigmaTOFProtonMin > -10.001 && nSigmaTOFProtonMax < 10.001));
314336
if (isPIDProtonApplied) {
315337
histograms.add("Reco/h4ImpPar_Proton", "", kTHnSparseD, {trackPtAxis, trackImpParRPhiAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib});
316338
histograms.add("Reco/h4ImpParZ_Proton", "", kTHnSparseD, {trackPtAxis, trackImpParZAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib});

EventFiltering/macros/uploadOTSobjects.C

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <string>
1717
#include <map>
1818
#include <array>
19+
#include <cmath>
1920

2021
#include "TFile.h"
2122
#include "TGrid.h"
@@ -26,16 +27,23 @@
2627

2728
#include "CCDB/BasicCCDBManager.h"
2829
#include "EventFiltering/ZorroHelper.h"
30+
#include "CommonConstants/LHCConstants.h"
2931

30-
void uploadOTSobjects(std::string inputList, std::string passName, bool useAlien)
32+
constexpr uint32_t chunkSize = 1000000;
33+
34+
void uploadOTSobjects(std::string inputList, std::string passName, bool useAlien, bool chunkedProcessing)
3135
{
3236
const std::string kBaseCCDBPath = "Users/m/mpuccio/EventFiltering/OTS/";
3337
std::string baseCCDBpath = passName.empty() ? kBaseCCDBPath : kBaseCCDBPath + passName + "/";
38+
if (chunkedProcessing) {
39+
baseCCDBpath += "Chunked/";
40+
}
3441
if (useAlien) {
3542
TGrid::Connect("alien://");
3643
}
3744
o2::ccdb::CcdbApi api;
3845
api.init("http://alice-ccdb.cern.ch");
46+
auto& ccdb = o2::ccdb::BasicCCDBManager::instance();
3947

4048
std::ifstream file(inputList.data());
4149
std::string path;
@@ -47,9 +55,11 @@ void uploadOTSobjects(std::string inputList, std::string passName, bool useAlien
4755
const int runNumber = std::stoi(runString);
4856
metadata["runNumber"] = runString;
4957
std::pair<int64_t, int64_t> duration = o2::ccdb::BasicCCDBManager::getRunDuration(api, runNumber);
50-
duration.first -= 10000; // subtract 3 minutes from the run start
51-
duration.second += 180000; // add 3 minutes to the run duration
58+
duration.first -= 60000; // subtract 1 minutes from the run start
59+
duration.second += 60000; // add 1 minutes to the run duration
5260
std::cout << ">>> Begin - end timestamps for the upload: " << duration.first << " - " << duration.second << std::endl;
61+
auto ctp = ccdb.getForTimeStamp<std::vector<Long64_t>>("CTP/Calib/OrbitReset", duration.first / 2 + duration.second / 2);
62+
auto orbitResetTimestamp = (*ctp)[0];
5363
path = useAlien ? "alien://" + path : path;
5464
std::unique_ptr<TFile> scalersFile{TFile::Open((path + "/AnalysisResults_fullrun.root").data(), "READ")};
5565
TH1* scalers = static_cast<TH1*>(scalersFile->Get("central-event-filter-task/scalers/mScalers"));
@@ -85,13 +95,48 @@ void uploadOTSobjects(std::string inputList, std::string passName, bool useAlien
8595
}
8696
}
8797
}
88-
api.storeAsTFileAny(&zorroHelpers, baseCCDBpath + "ZorroHelpers", metadata, duration.first, duration.second);
98+
std::sort(zorroHelpers.begin(), zorroHelpers.end(), [](const ZorroHelper& a, const ZorroHelper& b) {
99+
return a.bcAOD < b.bcAOD;
100+
});
101+
if (!chunkedProcessing) {
102+
api.storeAsTFileAny(&zorroHelpers, baseCCDBpath + "ZorroHelpers", metadata, duration.first, duration.second);
103+
std::cout << std::endl;
104+
} else {
105+
uint32_t helperIndex{0};
106+
auto startTS = duration.first;
107+
int64_t endTS = 0;
108+
while (helperIndex < zorroHelpers.size()) {
109+
std::vector<ZorroHelper> chunk;
110+
uint32_t endIndex = helperIndex + chunkSize;
111+
while (true) {
112+
if (endIndex >= zorroHelpers.size() - 2) {
113+
endTS = duration.second;
114+
chunk.insert(chunk.begin(), zorroHelpers.begin() + helperIndex, zorroHelpers.end());
115+
break;
116+
}
117+
auto bcEnd{zorroHelpers[endIndex].bcAOD > zorroHelpers[endIndex].bcEvSel ? zorroHelpers[endIndex].bcAOD : zorroHelpers[endIndex].bcEvSel};
118+
const auto& nextHelper = zorroHelpers[endIndex + 1];
119+
auto bcNext{nextHelper.bcAOD < nextHelper.bcEvSel ? nextHelper.bcAOD : nextHelper.bcEvSel};
120+
if (bcNext - bcEnd > 2001 / o2::constants::lhc::LHCBunchSpacingMUS) { /// ensure a gap of 2ms between chunks
121+
chunk.insert(chunk.begin(), zorroHelpers.begin() + helperIndex, zorroHelpers.begin() + endIndex + 1);
122+
endTS = (orbitResetTimestamp + int64_t(bcEnd * o2::constants::lhc::LHCBunchSpacingNS * 1e-3)) / 1000 + 1;
123+
break;
124+
}
125+
bcEnd = nextHelper.bcAOD > nextHelper.bcEvSel ? nextHelper.bcAOD : nextHelper.bcEvSel;
126+
endIndex++;
127+
}
128+
std::cout << ">>> Chunk " << helperIndex << " - " << helperIndex + chunk.size() << " : " << startTS << " - " << endTS << " \t" << (endTS - startTS) * 1.e-3 << std::endl;
129+
api.storeAsTFileAny(&zorroHelpers, baseCCDBpath + "ZorroHelpers", metadata, startTS, endTS);
130+
startTS = endTS + 1;
131+
helperIndex += chunk.size();
132+
}
133+
}
89134
}
90135
}
91136

92-
void uploadOTSobjects(std::string periodName)
137+
void uploadOTSobjects(std::string periodName, bool chunkedProcessing)
93138
{
94139
int year = 2000 + std::stoi(periodName.substr(3, 2));
95140
gSystem->Exec(Form("alien_find /alice/data/%i/%s/ ctf_skim_full/AnalysisResults_fullrun.root | sed 's:/AnalysisResults_fullrun\\.root::' > list_%s.txt", year, periodName.data(), periodName.data()));
96-
uploadOTSobjects(Form("list_%s.txt", periodName.data()), "", true);
141+
uploadOTSobjects(Form("list_%s.txt", periodName.data()), "", true, chunkedProcessing);
97142
}

0 commit comments

Comments
 (0)