Skip to content

Commit

Permalink
Merge branch 'AliceO2Group:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
motomioya authored Sep 14, 2024
2 parents c860c80 + b256183 commit 7e91373
Show file tree
Hide file tree
Showing 24 changed files with 1,107 additions and 615 deletions.
5 changes: 5 additions & 0 deletions Common/TableProducer/Converters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ o2physics_add_dpl_workflow(bc-converter
PUBLIC_LINK_LIBRARIES O2::Framework
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(bc-flags-creator
SOURCES bcFlagsCreator.cxx
PUBLIC_LINK_LIBRARIES O2::Framework
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(calo-label-converter
SOURCES caloLabelConverter.cxx
PUBLIC_LINK_LIBRARIES
Expand Down
36 changes: 36 additions & 0 deletions Common/TableProducer/Converters/bcFlagsCreator.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "Framework/AnalysisDataModel.h"

using namespace o2;
using namespace o2::framework;

// Creates an empty BCFlags for data that doesn't have it to be used seamlessly
// n.b. this will overwrite existing BCFlags, to be discussed if data in mixed condition
struct bcFlagsCreator {
Produces<aod::BCFlags> bcFlags;

void process(aod::BCs const& bcTable)
{
for (auto& bc : bcTable) {
bcFlags(0);
}
}
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<bcFlagsCreator>(cfgc),
};
}
17 changes: 17 additions & 0 deletions Common/TableProducer/multiplicityExtraTable.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct MultiplicityExtraTable {
// Allow for downscaling of BC table for less space use in derived data
Configurable<float> bcDownscaleFactor{"bcDownscaleFactor", 2, "Downscale factor for BC table (0: save nothing, 1: save all)"};
Configurable<float> minFT0CforBCTable{"minFT0CforBCTable", 25.0f, "Minimum FT0C amplitude to fill BC table to reduce data"};
Configurable<bool> saveOnlyBCsWithCollisions{"saveOnlyBCsWithCollisions", true, "save only BCs with collisions in them"};

// needed for downscale
unsigned int randomSeed = 0;
Expand Down Expand Up @@ -66,13 +67,24 @@ struct MultiplicityExtraTable {
{
//+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+
// determine saved BCs and corresponding new BC table index
std::vector<int> bcHasCollision(bcs.size());
std::vector<int> newBCindex(bcs.size());
std::vector<int> bc2multArray(bcs.size());
int atIndex = 0;
for (const auto& bc : bcs) {
bcHasCollision[bc.globalIndex()] = false;
newBCindex[bc.globalIndex()] = -1;
bc2multArray[bc.globalIndex()] = -1;
}

//+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+
// tag BCs that have a collision (from evsel foundBC)
for (const auto& collision : collisions) {
bcHasCollision[collision.foundBCId()] = true;
}
//+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+

for (const auto& bc : bcs) {
// downscale if requested to do so
if (bcDownscaleFactor < 1.f && (static_cast<float>(rand_r(&randomSeed)) / static_cast<float>(RAND_MAX)) > bcDownscaleFactor) {
continue;
Expand All @@ -91,6 +103,11 @@ struct MultiplicityExtraTable {
if (multFT0C < minFT0CforBCTable) {
continue; // skip this event
}

if (saveOnlyBCsWithCollisions && !bcHasCollision[bc.globalIndex()]) {
continue; // skip if no collision is assigned to this BC (from evSel assignment)
}

newBCindex[bc.globalIndex()] = atIndex++;
}
//+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+
Expand Down
14 changes: 13 additions & 1 deletion PWGDQ/Core/HistogramsLibrary.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -812,12 +812,24 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h
hm->AddHistogram(histClass, "Mass_HighRange", "", false, 375, 0.0, 15.0, VarManager::kMass);
hm->AddHistogram(histClass, "Pt", "", false, 2000, 0.0, 20., VarManager::kPt);
hm->AddHistogram(histClass, "Mass_Pt", "", false, 125, 0.0, 5.0, VarManager::kMass, 40, 0.0, 20.0, VarManager::kPt);
double massBins[76];
for (int i = 0; i < 76; i++) {
massBins[i] = 1.5 + i * 0.04;
}
double ptBins[70];
for (int i = 0; i <= 50; i++) {
ptBins[i] = i * 0.01;
}
for (int i = 1; i <= 19; i++) {
ptBins[50 + i] = 0.5 + i * 0.5;
}
hm->AddHistogram(histClass, "Mass_PtFine", "", false, 75, massBins, VarManager::kMass, 69, ptBins, VarManager::kPt);
hm->AddHistogram(histClass, "Eta_Pt", "", false, 40, -2.0, 2.0, VarManager::kEta, 40, 0.0, 20.0, VarManager::kPt);
hm->AddHistogram(histClass, "Mass_VtxZ", "", true, 30, -15.0, 15.0, VarManager::kVtxZ, 500, 0.0, 5.0, VarManager::kMass);
if (subGroupStr.Contains("pbpb")) {
hm->AddHistogram(histClass, "Mass_CentFT0C", "", false, 125, 0.0, 5.0, VarManager::kMass, 20, 0.0, 100.0, VarManager::kCentFT0C);
hm->AddHistogram(histClass, "Pt_CentFT0C", "", false, 100, 0.0, 10.0, VarManager::kPt, 20, 0.0, 100.0, VarManager::kCentFT0C);
hm->AddHistogram(histClass, "Mass_Pt_CentFT0C", "", false, 125, 0.0, 5.0, VarManager::kMass, 100, 0.0, 10.0, VarManager::kPt, 10, 0.0, 100.0, VarManager::kCentFT0C);
hm->AddHistogram(histClass, "Mass_Pt_CentFT0C", "", false, 75, 1.5, 4.5, VarManager::kMass, 20, 0.0, 10.0, VarManager::kPt, 10, 0.0, 100.0, VarManager::kCentFT0C);
}
if (subGroupStr.Contains("mult")) {
hm->AddHistogram(histClass, "Mass_Pt_MultFV0A", "", false, 200, 0.0, 5.0, VarManager::kMass, 40, 0.0, 40.0, VarManager::kPt, 100, 0.0, 25000.0, VarManager::kMultFV0A);
Expand Down
30 changes: 22 additions & 8 deletions PWGDQ/TableProducer/tableMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include "DetectorsBase/Propagator.h"
#include "DetectorsBase/GeometryManager.h"
#include "EventFiltering/Zorro.h"
#include "Framework/HistogramRegistry.h"

using std::cout;
using std::endl;
Expand Down Expand Up @@ -172,13 +173,18 @@ struct TableMaker {
Configurable<bool> fConfigDetailedQA{"cfgDetailedQA", false, "If true, include more QA histograms (BeforeCuts classes)"};
Configurable<bool> fIsRun2{"cfgIsRun2", false, "Whether we analyze Run-2 or Run-3 data"};
Configurable<bool> fIsAmbiguous{"cfgIsAmbiguous", false, "Whether we enable QA plots for ambiguous tracks"};
Configurable<bool> fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"};
Configurable<string> fConfigZorroTrigMask{"cfgZorroTriggerMask", "fDiMuon", "DQ Trigger masks: fSingleE,fLMeeIMR,fLMeeHMR,fDiElectron,fSingleMuLow,fSingleMuHigh,fDiMuon"};

struct : ConfigurableGroup {
Configurable<bool> fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"};
Configurable<string> fConfigZorroTrigMask{"cfgZorroTriggerMask", "fDiMuon", "DQ Trigger masks: fSingleE,fLMeeIMR,fLMeeHMR,fDiElectron,fSingleMuLow,fSingleMuHigh,fDiMuon"};
} useZorro;

struct : ConfigurableGroup {
Configurable<string> fConfigCcdbUrl{"useCCDBConfigurations.ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<string> fConfigCcdbPathTPC{"useCCDBConfigurations.ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"};
Configurable<string> fConfigCcdbPathZorro{"useCCDBConfigurations.ccdb-path-zorro", "Users/r/rlietava/EventFiltering/OTS/", "base path to the ccdb object for zorro"};
} useCCDBConfigurations;

Configurable<int64_t> fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
Configurable<bool> fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas(electrons, pions, protons)"};
Configurable<bool> fConfigComputeTPCpostCalibKaon{"cfgTPCpostCalibKaon", false, "If true, compute TPC post-calibrated n-sigmas for kaons"};
Expand Down Expand Up @@ -212,6 +218,8 @@ struct TableMaker {
bool fDoDetailedQA = false; // Bool to set detailed QA true, if QA is set true
int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc.

HistogramRegistry registry{"registry"};

// TODO: filter on TPC dedx used temporarily until electron PID will be improved
Filter barrelSelectedTracks = ifnode(fIsRun2.node() == true, aod::track::trackType == uint8_t(aod::track::Run2Track), aod::track::trackType == uint8_t(aod::track::Track)) && o2::aod::track::pt >= fConfigBarrelTrackPtLow && nabs(o2::aod::track::eta) <= fConfigBarrelTrackMaxAbsEta && o2::aod::track::tpcSignal >= fConfigMinTpcSignal && o2::aod::track::tpcSignal <= fConfigMaxTpcSignal && o2::aod::track::tpcChi2NCl < 4.0f && o2::aod::track::itsChi2NCl < 36.0f;

Expand Down Expand Up @@ -406,7 +414,7 @@ struct TableMaker {
}
// Put the 8 first bits of the event filter in the last 8 bits of the tag
if constexpr ((TEventFillMap & VarManager::ObjTypes::EventFilter) > 0) {
if (!fConfigRunZorro) {
if (!useZorro.fConfigRunZorro) {
tag |= (collision.eventFilter() << 56);
}
}
Expand All @@ -432,9 +440,12 @@ struct TableMaker {
}
(reinterpret_cast<TH2F*>(fStatsList->At(0)))->Fill(2.0, static_cast<float>(kNaliases));

if (fConfigRunZorro) {
if (useZorro.fConfigRunZorro) {
zorro.setBaseCCDBPath(useCCDBConfigurations.fConfigCcdbPathZorro.value);
zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), fConfigZorroTrigMask.value);
zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), useZorro.fConfigZorroTrigMask.value);

zorro.populateHistRegistry(registry, fCurrentRun);

if (zorro.isSelected(bc.globalBC())) {
tag |= (static_cast<uint64_t>(true) << 56); // the same bit is used for this zorro selections from ccdb
}
Expand Down Expand Up @@ -861,7 +872,7 @@ struct TableMaker {
}
// Put the 8 first bits of the event filter in the last 8 bits of the tag
if constexpr ((TEventFillMap & VarManager::ObjTypes::EventFilter) > 0) {
if (!fConfigRunZorro) {
if (!useZorro.fConfigRunZorro) {
tag |= (collision.eventFilter() << 56);
}
}
Expand All @@ -886,9 +897,12 @@ struct TableMaker {
}
(reinterpret_cast<TH2F*>(fStatsList->At(0)))->Fill(2.0, static_cast<float>(kNaliases));

if (fConfigRunZorro) {
if (useZorro.fConfigRunZorro) {
zorro.setBaseCCDBPath(useCCDBConfigurations.fConfigCcdbPathZorro.value);
zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), fConfigZorroTrigMask.value);
zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), useZorro.fConfigZorroTrigMask.value);

zorro.populateHistRegistry(registry, fCurrentRun);

if (zorro.isSelected(bc.globalBC())) {
tag |= (static_cast<uint64_t>(true) << 56); // the same bit is used for this zorro selections from ccdb
}
Expand Down
62 changes: 35 additions & 27 deletions PWGDQ/Tasks/dqEfficiency_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1205,22 +1205,22 @@ struct AnalysisSameEventPairing {
if (!sigNamesStr.IsNull()) {
for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) {
auto sig = fRecMCSignals.at(isig);
names = {
Form("PairsBarrelSEPM_%s_%s", objArray->At(icut)->GetName(), sig.GetName()),
Form("PairsBarrelSEPP_%s_%s", objArray->At(icut)->GetName(), sig.GetName()),
Form("PairsBarrelSEMM_%s_%s", objArray->At(icut)->GetName(), sig.GetName())};
if (fConfigQA) {
names = {
Form("PairsBarrelSEPM_%s_%s", objArray->At(icut)->GetName(), sig.GetName()),
Form("PairsBarrelSEPMCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()),
Form("PairsBarrelSEPMIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()),
Form("PairsBarrelSEPM_ambiguousInBunch_%s_%s", objArray->At(icut)->GetName(), sig.GetName()),
Form("PairsBarrelSEPM_ambiguousInBunchCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()),
Form("PairsBarrelSEPM_ambiguousInBunchIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()),
Form("PairsBarrelSEPM_ambiguousOutOfBunch_%s_%s", objArray->At(icut)->GetName(), sig.GetName()),
Form("PairsBarrelSEPM_ambiguousOutOfBunchCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()),
Form("PairsBarrelSEPM_ambiguousOutOfBunchIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())};
histNames += Form("%s;%s;%s;%s;%s;%s;%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data(), names[3].Data(), names[4].Data(), names[5].Data(), names[6].Data(), names[7].Data(), names[8].Data());
} else {
names = {
Form("PairsBarrelSEPM_%s_%s", objArray->At(icut)->GetName(), sig.GetName())};
histNames += Form("%s;", names[0].Data());
names.push_back(Form("PairsBarrelSEPMCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()));
names.push_back(Form("PairsBarrelSEPMIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()));
names.push_back(Form("PairsBarrelSEPM_ambiguousInBunch_%s_%s", objArray->At(icut)->GetName(), sig.GetName()));
names.push_back(Form("PairsBarrelSEPM_ambiguousInBunchCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()));
names.push_back(Form("PairsBarrelSEPM_ambiguousInBunchIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()));
names.push_back(Form("PairsBarrelSEPM_ambiguousOutOfBunch_%s_%s", objArray->At(icut)->GetName(), sig.GetName()));
names.push_back(Form("PairsBarrelSEPM_ambiguousOutOfBunchCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()));
names.push_back(Form("PairsBarrelSEPM_ambiguousOutOfBunchIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()));
}
for (auto& n : names) {
histNames += Form("%s;", n.Data());
}
fBarrelHistNamesMCmatched.try_emplace(icut * fRecMCSignals.size() + isig, names);
} // end loop over MC signals
Expand Down Expand Up @@ -1579,37 +1579,40 @@ struct AnalysisSameEventPairing {
fHistMan->FillHistClass(histNames[icut][0].Data(), VarManager::fgValues); // reconstructed, unmatched
for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { // loop over MC signals
if (mcDecision & (uint32_t(1) << isig)) {
fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][0].Data(), VarManager::fgValues); // matched signal
if (fConfigQA) {
fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size()].Data(), VarManager::fgValues); // matched signal
if (isCorrectAssoc_leg1 && isCorrectAssoc_leg2) { // correct track-collision association
fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size() + 1].Data(), VarManager::fgValues);
if (isCorrectAssoc_leg1 && isCorrectAssoc_leg2) { // correct track-collision association
fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][3].Data(), VarManager::fgValues);
} else { // incorrect track-collision association
fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size() + 2].Data(), VarManager::fgValues);
fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][4].Data(), VarManager::fgValues);
}
if (isAmbiInBunch) { // ambiguous in bunch
fHistMan->FillHistClass(histNames[icut][isig * fRecMCSignals.size() + 3].Data(), VarManager::fgValues);
fHistMan->FillHistClass(histNames[icut * fRecMCSignals.size() + isig][5].Data(), VarManager::fgValues);
if (isCorrectAssoc_leg1 && isCorrectAssoc_leg2) {
fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size() + 4].Data(), VarManager::fgValues);
fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][6].Data(), VarManager::fgValues);
} else {
fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size() + 5].Data(), VarManager::fgValues);
fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][7].Data(), VarManager::fgValues);
}
}
if (isAmbiOutOfBunch) { // ambiguous out of bunch
fHistMan->FillHistClass(histNames[icut][isig * fRecMCSignals.size() + 6].Data(), VarManager::fgValues);
fHistMan->FillHistClass(histNames[icut * fRecMCSignals.size() + isig][8].Data(), VarManager::fgValues);
if (isCorrectAssoc_leg1 && isCorrectAssoc_leg2) {
fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size() + 7].Data(), VarManager::fgValues);
fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][9].Data(), VarManager::fgValues);
} else {
fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size() + 8].Data(), VarManager::fgValues);
fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][10].Data(), VarManager::fgValues);
}
}
} else {
fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][0].Data(), VarManager::fgValues); // matched signal
}
}
}
} else {
if (sign1 > 0) { // ++ pairs
fHistMan->FillHistClass(histNames[icut][1].Data(), VarManager::fgValues);
for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { // loop over MC signals
if (mcDecision & (uint32_t(1) << isig)) {
fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][1].Data(), VarManager::fgValues);
}
}
if (fConfigQA) {
if (isAmbiInBunch) {
fHistMan->FillHistClass(histNames[icut][4].Data(), VarManager::fgValues);
Expand All @@ -1620,6 +1623,11 @@ struct AnalysisSameEventPairing {
}
} else { // -- pairs
fHistMan->FillHistClass(histNames[icut][2].Data(), VarManager::fgValues);
for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { // loop over MC signals
if (mcDecision & (uint32_t(1) << isig)) {
fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][2].Data(), VarManager::fgValues);
}
}
if (fConfigQA) {
if (isAmbiInBunch) {
fHistMan->FillHistClass(histNames[icut][5].Data(), VarManager::fgValues);
Expand Down
Loading

0 comments on commit 7e91373

Please sign in to comment.