Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions DPG/Tasks/AOTTrack/qaEfficiency.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
Configurable<bool> doPtEta{"doPtEta", false, "Flag to produce the efficiency vs pT and Eta"};
Configurable<bool> doPtRadius{"doPtRadius", false, "Flag to produce the efficiency vs pT and Radius"};
Configurable<int> applyEvSel{"applyEvSel", 0, "Flag to apply event selection: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"};
Configurable<bool> applyTimeFrameBorderCut{"applyTimeFrameBorderCut", false, "Flag to apply the TF border cut"};
// Custom track cuts for debug purposes
TrackSelection customTrackCuts;
struct : ConfigurableGroup {
Expand Down Expand Up @@ -264,6 +265,7 @@
using CollisionCandidatesMC = o2::soa::Join<CollisionCandidates, o2::aod::McCollisionLabels>;
using TrackCandidates = o2::soa::Join<o2::aod::Tracks, o2::aod::TracksExtra, o2::aod::TrackSelection, o2::aod::TrackSelectionExtension, o2::aod::TracksDCA>;
using TrackCandidatesMC = o2::soa::Join<TrackCandidates, o2::aod::McTrackLabels>;
using BCsInfo = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels>;

// Histograms
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
Expand Down Expand Up @@ -964,7 +966,7 @@
histos.get<TH1>(HIST("eventSelection"))->GetXaxis()->SetBinLabel(2, "Passed Ev. Sel. (no ev. sel)");
} else if (applyEvSel == 1) {
histos.get<TH1>(HIST("eventSelection"))->GetXaxis()->SetBinLabel(2, "Passed Ev. Sel. (sel7)");
} else if (applyEvSel == 2) {

Check failure on line 969 in DPG/Tasks/AOTTrack/qaEfficiency.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.get<TH1>(HIST("eventSelection"))->GetXaxis()->SetBinLabel(2, "Passed Ev. Sel. (sel8)");
} else {
LOG(fatal) << "Can't interpret event selection asked " << applyEvSel << " (0: no event selection, 1: sel7, 2: sel8)";
Expand All @@ -972,6 +974,7 @@

histos.get<TH1>(HIST("eventSelection"))->GetXaxis()->SetBinLabel(3, "Passed Contrib.");
histos.get<TH1>(HIST("eventSelection"))->GetXaxis()->SetBinLabel(4, "Passed Position");
histos.get<TH1>(HIST("eventSelection"))->GetXaxis()->SetBinLabel(5, "Passed Time Frame border cut");

if (doprocessMC) {
histos.add("MC/generatedCollisions", "Generated Collisions", kTH1D, {{10, 0.5, 10.5, "Generated collisions"}});
Expand All @@ -987,7 +990,7 @@
initMC(axisSel);

// Custom track cuts
if (globalTrackSelection.value == 6) {

Check failure on line 993 in DPG/Tasks/AOTTrack/qaEfficiency.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
customTrackCuts = getGlobalTrackSelectionRun3ITSMatch(cfgCustomTrackCuts.itsPattern);
LOG(info) << "Customizing track cuts:";
if (cfgCustomTrackCuts.tracksIU.value) {
Expand Down Expand Up @@ -1019,7 +1022,7 @@

bool isPhysicalPrimary(const o2::aod::McParticles::iterator& mcParticle)
{
if (maxProdRadius < 999.f) {

Check failure on line 1025 in DPG/Tasks/AOTTrack/qaEfficiency.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if ((mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy()) > maxProdRadius * maxProdRadius) {
return false;
}
Expand All @@ -1028,10 +1031,10 @@
}
bool isFinal(const o2::aod::McParticles::iterator& mcParticle)
{
if (!mcParticle.has_daughters() && !mcParticle.isPhysicalPrimary() && mcParticle.getProcess() == 4) {

Check failure on line 1034 in DPG/Tasks/AOTTrack/qaEfficiency.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
auto mothers = mcParticle.mothers_as<o2::aod::McParticles>();
for (const auto& mother : mothers) {
if (!mother.isPhysicalPrimary() && mother.getProcess() == 4) {

Check failure on line 1037 in DPG/Tasks/AOTTrack/qaEfficiency.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return true;
}
}
Expand Down Expand Up @@ -1151,7 +1154,7 @@
}
}
}
} else if (mcParticle.getProcess() == 4) { // Particle decay

Check failure on line 1157 in DPG/Tasks/AOTTrack/qaEfficiency.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
// Checking mothers
bool motherIsAccepted = true;
if (checkForMothers.value && mothersPDGs.value.size() > 0 && mcParticle.has_mothers()) {
Expand Down Expand Up @@ -1255,7 +1258,7 @@
hPtRadiusGeneratedPrm[histogramIndex]->Fill(mcParticle.pt(), radius);
}
} else {
if (mcParticle.getProcess() == 4) { // Particle decay

Check failure on line 1261 in DPG/Tasks/AOTTrack/qaEfficiency.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
bool motherIsAccepted = true;
// Check for mothers if needed
if (checkForMothers.value && mothersPDGs.value.size() > 0 && mcParticle.has_mothers()) {
Expand All @@ -1265,7 +1268,7 @@
for (const auto& mother : mothers) {
for (const auto& pdgToCheck : mothersPDGs.value) {
if (mother.pdgCode() == pdgToCheck) {
motherIsAccepted = true; // Mother matches the list of specified PDGs
motherIsAccepted = true; // Mother matches the list of specified PDGs
hPtmotherGenerated[histogramIndex]->Fill(mother.pt()); // Fill generated pT for mother
break;
}
Expand Down Expand Up @@ -1436,7 +1439,7 @@
}
if (applyEvSel == 1 && !collision.sel7()) {
return false;
} else if (applyEvSel == 2 && !collision.sel8()) {

Check failure on line 1442 in DPG/Tasks/AOTTrack/qaEfficiency.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return false;
}
if constexpr (doFillHistograms) {
Expand All @@ -1454,6 +1457,12 @@
if constexpr (doFillHistograms) {
histos.fill(HIST("eventSelection"), 4);
}
if (applyTimeFrameBorderCut && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
return false;
}
if constexpr (doFillHistograms) {
histos.fill(HIST("eventSelection"), 5);
}
return true;
}

Expand Down Expand Up @@ -1528,7 +1537,7 @@

if (noFakesHits) { // Selecting tracks with no fake hits
bool hasFakeHit = false;
for (int i = 0; i < 10; i++) { // From ITS to TPC

Check failure on line 1540 in DPG/Tasks/AOTTrack/qaEfficiency.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (track.mcMask() & 1 << i) {
hasFakeHit = true;
break;
Expand Down Expand Up @@ -1743,7 +1752,8 @@
// o2::soa::SmallGroups<CollisionCandidatesMC> const& collisions,
CollisionCandidatesMC const& collisions,
TrackCandidatesMC const& tracks,
o2::aod::McParticles const& mcParticles)
o2::aod::McParticles const& mcParticles,
BCsInfo const&)
{

/// loop over generated collisions
Expand Down Expand Up @@ -1874,6 +1884,13 @@
continue;
}
}
// apply time-frame border cut also to the generated collision
if (applyTimeFrameBorderCut) {
auto bc = mcCollision.bc_as<BCsInfo>();
if (!bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
continue;
}
}
}

/// only to fill denominator of ITS-TPC matched primary tracks only in MC events with at least 1 reco. vtx
Expand Down Expand Up @@ -1922,11 +1939,18 @@
continue;
}
}
// apply time-frame border cut also to the generated collision
if (applyTimeFrameBorderCut) {
auto bc = mcCollision.bc_as<BCsInfo>();
if (!bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
continue;
}
}

// Loop on particles to fill the denominator
float dNdEta = 0; // Multiplicity
for (const auto& mcParticle : groupedMcParticles) {
if (TMath::Abs(mcParticle.eta()) <= 2.f && !mcParticle.has_daughters()) {

Check failure on line 1953 in DPG/Tasks/AOTTrack/qaEfficiency.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
dNdEta += 1.f;
}
if (!isInAcceptance(mcParticle, HIST("MC/particleSelection"))) {
Expand Down Expand Up @@ -1976,7 +2000,8 @@
void processMCWithoutCollisions(TrackCandidatesMC const& tracks,
o2::aod::Collisions const&,
o2::aod::McParticles const& mcParticles,
o2::aod::McCollisions const&)
o2::aod::McCollisions const&,
BCsInfo const&)
{
// Track loop
for (const auto& track : tracks) {
Expand Down Expand Up @@ -2028,6 +2053,14 @@
continue;
}
}
// apply time-frame border cut also to the generated collision
if (applyTimeFrameBorderCut) {
const auto mcCollision = mcParticle.mcCollision();
auto bc = mcCollision.bc_as<BCsInfo>();
if (!bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
continue;
}
}

// search for particles from HF decays
if (keepOnlyHfParticles && !RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, /*searchUpToQuark*/ true)) {
Expand Down
Loading