Skip to content

Commit

Permalink
Merge branch 'AliceO2Group:master' into cBranch
Browse files Browse the repository at this point in the history
  • Loading branch information
cnkoster authored Jul 2, 2024
2 parents 09662ad + 4a27579 commit fa9484f
Show file tree
Hide file tree
Showing 49 changed files with 3,840 additions and 1,670 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/Common/Tools/Multiplicity @alibuild @ddobrigk @victor-gonzalez
/ALICE3 @alibuild @njacazio @hscheid
/DPG @alibuild @chiarazampolli @noferini
/DPG/Tasks/AOTEvent @alibuild @ekryshen @strogolo
/DPG/Tasks/AOTEvent @alibuild @ekryshen @strogolo @altsybee
/DPG/Tasks/AOTTrack @alibuild @mfaggin @iouribelikov @njacazio
/DPG/Tasks/TOF @alibuild @noferini @njacazio
/DPG/Tasks/FT0 @alibuild @afurs
Expand Down
49 changes: 46 additions & 3 deletions DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ struct DetectorOccupancyQaTask {
Configurable<bool> confAddTracksVsFwdHistos{"AddTracksVsFwdHistos", true, "0 - add histograms, 1 - skip"};
Configurable<int> nBinsTracks{"nBinsTracks", 400, "N bins in n tracks histo"};
Configurable<int> nMaxTracks{"nMaxTracks", 8000, "N max in n tracks histo"};
Configurable<int> nMaxGlobalTracks{"nMaxGlobalTracks", 4000, "N max in n tracks histo"};
Configurable<int> nMaxGlobalTracks{"nMaxGlobalTracks", 3000, "N max in n tracks histo"};
Configurable<int> nBinsMultFwd{"nBinsMultFwd", 400, "N bins in mult fwd histo"};
Configurable<float> nMaxMultFwd{"nMaxMultFwd", 200000, "N max in mult fwd histo"};

Configurable<int> nBinsOccupancy{"nBinsOccupancy", 150, "N bins for occupancy axis"};
Configurable<float> nMaxOccupancy{"nMaxOccupancy", 15000, "N for max of the occupancy axis"};

uint64_t minGlobalBC = 0;
Service<o2::ccdb::BasicCCDBManager> ccdb;
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
Expand Down Expand Up @@ -99,6 +102,17 @@ struct DetectorOccupancyQaTask {
double kMaxOccup = confOccupancyHistCoeffNtracksForOccupancy;
double kMaxThisEv = confCoeffMaxNtracksThisEvent;

AxisSpec axisBC{3601, -0.5, 3600.5, "bc"};
histos.add("h2D_diff_FoundBC_vs_BC", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}});
histos.add("h2D_diff_FoundBC_vs_BC_multAbove10", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}});
histos.add("h2D_diff_FoundBC_vs_BC_multAbove20", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}});
histos.add("h2D_diff_FoundBC_vs_BC_multAbove50", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}});
histos.add("h2D_diff_FoundBC_vs_BC_multAbove100", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}});
histos.add("h2D_diff_FoundBC_vs_BC_hasTOF", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}});
histos.add("h2D_diff_FoundBC_vs_BC_hasTRD", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}});
histos.add("h2D_diff_FoundBC_vs_BC_hasTOF_multAbove10", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}});
histos.add("h2D_diff_FoundBC_vs_BC_hasTRD_multAbove10", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}});

if (confAddBasicQAhistos) {
int nMax1D = kMaxThisEv * 8000;
histos.add("hNumITS567tracksPerCollision", ";n tracks;n events", kTH1D, {{nMax1D, -0.5, nMax1D - 0.5}});
Expand Down Expand Up @@ -160,9 +174,9 @@ struct DetectorOccupancyQaTask {

if (confAddTracksVsFwdHistos) {
AxisSpec axisNtracks{nBinsTracks, -0.5, nMaxTracks - 0.5, "n tracks"};
AxisSpec axisNtracksGlobal{nMaxGlobalTracks, -0.5, nMaxGlobalTracks - 0.5, "n tracks"};
AxisSpec axisNtracksGlobal{nBinsTracks, -0.5, nMaxGlobalTracks - 0.5, "n tracks"};
AxisSpec axisMultFw{nBinsMultFwd, 0., static_cast<float>(nMaxMultFwd), "mult Fwd"};
AxisSpec axisOccupancy{60, 0., 15000, "occupancy (n ITS tracks weighted)"};
AxisSpec axisOccupancy{nBinsOccupancy, 0., nMaxOccupancy, "occupancy (n ITS tracks weighted)"};

histos.add("nTracksPV_vs_V0A_kNoHighOccupancyAgressive", "nTracksPV_vs_V0A_kNoHighOccupancyAgressive", kTH2F, {axisMultFw, axisNtracks});
histos.add("nTracksPV_vs_V0A_kNoHighOccupancyStrict", "nTracksPV_vs_V0A_kNoHighOccupancyStrict", kTH2F, {axisMultFw, axisNtracks});
Expand Down Expand Up @@ -298,6 +312,7 @@ struct DetectorOccupancyQaTask {
int nITSTPCtracks = 0;
int nITSTPCtracksPtEtaCuts = 0;
int nTOFtracks = 0;
int nTRDtracks = 0;
auto tracksGrouped = tracks.sliceBy(perCollision, col.globalIndex());
for (auto& track : tracksGrouped) {
if (!track.isPVContributor()) {
Expand All @@ -307,6 +322,7 @@ struct DetectorOccupancyQaTask {
nITS567cls++;
nITSTPCtracks += track.hasITS() && track.hasTPC();
nTOFtracks += track.hasTOF();
nTRDtracks += track.hasTRD();

if (track.pt() < confCutPtMinThisEvent || track.pt() > confCutPtMaxThisEvent)
continue;
Expand Down Expand Up @@ -348,6 +364,33 @@ struct DetectorOccupancyQaTask {
vIsFullInfoForOccupancy[colIndex] = ((bcInTF - 300) * bcNS > timeWinOccupancyCalcNS) && ((nBCsPerTF - 4000 - bcInTF) * bcNS > timeWinOccupancyCalcNS) ? true : false;

LOGP(debug, "### check bcInTF cut: colIndex={} bcInTF={} vIsFullInfoForOccupancy={}", colIndex, bcInTF, static_cast<int>(vIsFullInfoForOccupancy[colIndex]));

// additional QA:
if (col.selection_bit(kNoTimeFrameBorder) && col.selection_bit(kNoITSROFrameBorder)) {
auto bcFoundId = bc.globalBC() % 3564;
auto bcNonFound = col.bc_as<BCsRun3>();
auto bcNonFoundId = bcNonFound.globalBC() % 3564;
int64_t diffFoundBC_vs_BC = (int64_t)bcFoundId - (int64_t)bcNonFoundId;
histos.fill(HIST("h2D_diff_FoundBC_vs_BC"), bcNonFoundId, diffFoundBC_vs_BC);
if (nITS567cls > 10)
histos.fill(HIST("h2D_diff_FoundBC_vs_BC_multAbove10"), bcNonFoundId, diffFoundBC_vs_BC);
if (nITS567cls > 20)
histos.fill(HIST("h2D_diff_FoundBC_vs_BC_multAbove20"), bcNonFoundId, diffFoundBC_vs_BC);
if (nITS567cls > 50)
histos.fill(HIST("h2D_diff_FoundBC_vs_BC_multAbove50"), bcNonFoundId, diffFoundBC_vs_BC);
if (nITS567cls > 100)
histos.fill(HIST("h2D_diff_FoundBC_vs_BC_multAbove100"), bcNonFoundId, diffFoundBC_vs_BC);

if (nTOFtracks > 0)
histos.fill(HIST("h2D_diff_FoundBC_vs_BC_hasTOF"), bcNonFoundId, diffFoundBC_vs_BC);
if (nTRDtracks > 0)
histos.fill(HIST("h2D_diff_FoundBC_vs_BC_hasTRD"), bcNonFoundId, diffFoundBC_vs_BC);

if (nITS567cls > 10 && nTOFtracks > 0)
histos.fill(HIST("h2D_diff_FoundBC_vs_BC_hasTOF_multAbove10"), bcNonFoundId, diffFoundBC_vs_BC);
if (nITS567cls > 10 && nTRDtracks > 0)
histos.fill(HIST("h2D_diff_FoundBC_vs_BC_hasTRD_multAbove10"), bcNonFoundId, diffFoundBC_vs_BC);
}
}

// find for each collision all collisions within the defined time window
Expand Down
55 changes: 50 additions & 5 deletions DPG/Tasks/AOTTrack/qaEfficiency.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ std::array<std::shared_ptr<TH1>, nParticles> hPtTrkItsTpcMat;
std::array<std::shared_ptr<TH1>, nParticles> hPtItsTpcTofMat;
std::array<std::shared_ptr<TH1>, nParticles> hPtGeneratedMat;

// Pt for tertiaries from secondary weak decay
std::array<std::shared_ptr<TH1>, nParticles> hPtItsTpcTer;
std::array<std::shared_ptr<TH1>, nParticles> hPtTrkItsTpcTer;
std::array<std::shared_ptr<TH1>, nParticles> hPtItsTpcTofTer;
std::array<std::shared_ptr<TH1>, nParticles> hPtGeneratedTer;

// P
std::array<std::shared_ptr<TH1>, nParticles> hPItsTpc;
std::array<std::shared_ptr<TH1>, nParticles> hPTrkItsTpc;
Expand Down Expand Up @@ -325,6 +331,12 @@ struct QaEfficiency {
hPtItsTpcTofStr[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/str/its_tpc_tof", PDGs[histogramIndex]), "ITS-TPC-TOF tracks (from weak decays) " + tagPt, kTH1D, {axisPt});
hPtGeneratedStr[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/str/generated", PDGs[histogramIndex]), "Generated (from weak decays) " + tagPt, kTH1D, {axisPt});

// Ter
hPtItsTpcTer[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/ter/its_tpc", PDGs[histogramIndex]), "ITS-TPC tracks (from secondary weak decays) " + tagPt, kTH1D, {axisPt});
hPtTrkItsTpcTer[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/ter/trk/its_tpc", PDGs[histogramIndex]), "ITS-TPC tracks (reco from secondary weak decays) " + tagPt, kTH1D, {axisPt});
hPtItsTpcTofTer[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/ter/its_tpc_tof", PDGs[histogramIndex]), "ITS-TPC-TOF tracks (from secondary weak decays) " + tagPt, kTH1D, {axisPt});
hPtGeneratedTer[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/ter/generated", PDGs[histogramIndex]), "Generated (from secondary weak decays) " + tagPt, kTH1D, {axisPt});

// Mat
hPtItsTpcMat[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/mat/its_tpc", PDGs[histogramIndex]), "ITS-TPC tracks (from material)" + tagPt, kTH1D, {axisPt});
hPtTrkItsTpcMat[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/mat/trk/its_tpc", PDGs[histogramIndex]), "ITS-TPC tracks (reco from material) " + tagPt, kTH1D, {axisPt});
Expand Down Expand Up @@ -437,17 +449,19 @@ struct QaEfficiency {
makeEfficiency("ITS-TPC_vsPt_Prm_Trk", hPtTrkItsTpcPrm[histogramIndex]);
makeEfficiency("ITS-TPC-TOF_vsPt_Prm", hPtItsTpcTofPrm[histogramIndex]);
makeEfficiency("ITS-TPC-TOF_vsPt_Prm_Trk", hPtTrkItsTpcTofPrm[histogramIndex]);

makeEfficiency("ITS-TPC_vsPt_Prm_RecoEv", hPtItsTpcPrm[histogramIndex]);

makeEfficiency("ITS-TPC_vsPt_Str", hPtItsTpcStr[histogramIndex]);
makeEfficiency("ITS-TPC_vsPt_Str_Trk", hPtTrkItsTpcStr[histogramIndex]);
makeEfficiency("ITS-TPC-TOF_vsPt_Str", hPtItsTpcTofStr[histogramIndex]);

makeEfficiency("ITS-TPC_vsPt_Mat", hPtItsTpcMat[histogramIndex]);
makeEfficiency("ITS-TPC_vsPt_Mat_Trk", hPtTrkItsTpcMat[histogramIndex]);
makeEfficiency("ITS-TPC-TOF_vsPt_Mat", hPtItsTpcTofMat[histogramIndex]);

makeEfficiency("ITS-TPC_vsPt_Ter", hPtItsTpcTer[histogramIndex]);
makeEfficiency("ITS-TPC_vsPt_Ter_Trk", hPtTrkItsTpcTer[histogramIndex]);
makeEfficiency("ITS-TPC-TOF_vsPt_Ter", hPtItsTpcTofTer[histogramIndex]);

makeEfficiency("ITS-TPC_vsP", hPItsTpc[histogramIndex]);
makeEfficiency("ITS-TPC_vsP_Trk", hPTrkItsTpc[histogramIndex]);
makeEfficiency("ITS-TPC-TOF_vsP", hPItsTpcTof[histogramIndex]);
Expand Down Expand Up @@ -909,7 +923,24 @@ struct QaEfficiency {
}
return mcParticle.isPhysicalPrimary();
}

bool isFinal(const o2::aod::McParticles::iterator& mcParticle)
{
// Example conditions to determine if a particle is final (tertiary)
// Here, we assume that final state particles are those not originating from primary vertex
// and not further decaying into other particles
// Check if the particle has no daughters
if (!mcParticle.has_daughters()) {

// Check if the particle is not a primary particle
if (!mcParticle.isPhysicalPrimary()) {
// Check if the particle is produced in a secondary decay
if (mcParticle.getProcess() == 4) {
return true; // Consider it as a tertiary particle
}
}
}
return false; // Otherwise, not considered a tertiary particle
}
template <int pdgSign, o2::track::PID::ID id>
void fillMCTrackHistograms(const TrackCandidatesMC::iterator& track, const bool doMakeHistograms)
{
Expand All @@ -927,7 +958,6 @@ struct QaEfficiency {
return;
}
}

constexpr int histogramIndex = id + pdgSign * nSpecies;
LOG(debug) << "fillMCTrackHistograms for pdgSign '" << pdgSign << "' and id '" << static_cast<int>(id) << "' " << particleName(pdgSign, id) << " with index " << histogramIndex;
const o2::aod::McParticles::iterator& mcParticle = track.mcParticle();
Expand Down Expand Up @@ -1036,6 +1066,15 @@ struct QaEfficiency {
hPtItsTpcTofStr[histogramIndex]->Fill(mcParticle.pt());
}
}
if (isFinal(mcParticle)) {
if (passedITS && passedTPC && motherIsAccepted) {
hPtItsTpcTer[histogramIndex]->Fill(mcParticle.pt());
hPtTrkItsTpcTer[histogramIndex]->Fill(track.pt());
if (passedTOF) {
hPtItsTpcTofTer[histogramIndex]->Fill(mcParticle.pt());
}
}
}
} else { // Material
if (passedITS && passedTPC) {
hPtItsTpcMat[histogramIndex]->Fill(mcParticle.pt());
Expand Down Expand Up @@ -1107,12 +1146,14 @@ struct QaEfficiency {
}
if (motherIsAccepted) {
hPtGeneratedStr[histogramIndex]->Fill(mcParticle.pt());
if (isFinal(mcParticle)) {
hPtGeneratedTer[histogramIndex]->Fill(mcParticle.pt());
}
}
} else { // Material
hPtGeneratedMat[histogramIndex]->Fill(mcParticle.pt());
}
}

hEtaGenerated[histogramIndex]->Fill(mcParticle.eta());
hYGenerated[histogramIndex]->Fill(mcParticle.y());
hPhiGenerated[histogramIndex]->Fill(mcParticle.phi());
Expand Down Expand Up @@ -1191,6 +1232,10 @@ struct QaEfficiency {
doFillEfficiency("ITS-TPC_vsPt_Mat_Trk", hPtTrkItsTpcMat[histogramIndex], hPtGeneratedMat[histogramIndex]);
doFillEfficiency("ITS-TPC-TOF_vsPt_Mat", hPtItsTpcTofMat[histogramIndex], hPtGeneratedMat[histogramIndex]);

doFillEfficiency("ITS-TPC_vsPt_Ter", hPtItsTpcTer[histogramIndex], hPtGeneratedTer[histogramIndex]);
doFillEfficiency("ITS-TPC_vsPt_Ter_Trk", hPtTrkItsTpcTer[histogramIndex], hPtGeneratedTer[histogramIndex]);
doFillEfficiency("ITS-TPC-TOF_vsPt_Ter", hPtItsTpcTofTer[histogramIndex], hPtGeneratedTer[histogramIndex]);

doFillEfficiency("ITS-TPC_vsP", hPItsTpc[histogramIndex], hPGenerated[histogramIndex]);
doFillEfficiency("ITS-TPC_vsP_Trk", hPTrkItsTpc[histogramIndex], hPGenerated[histogramIndex]);
doFillEfficiency("ITS-TPC-TOF_vsP", hPItsTpcTof[histogramIndex], hPGenerated[histogramIndex]);
Expand Down
Loading

0 comments on commit fa9484f

Please sign in to comment.