Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PWGUD] personal task modification #8907

Merged
merged 1 commit into from
Dec 10, 2024
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
159 changes: 125 additions & 34 deletions PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check warning on line 1 in PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Provide mandatory file documentation.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -11,7 +11,7 @@
///
/// \brief
/// \author Sara Haidlova, [email protected]
/// \since March 2024

Check warning on line 14 in PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.

Check warning on line 14 in PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

#include <vector>
#include <utility>
Expand Down Expand Up @@ -68,9 +68,9 @@

// configurable cuts (modify in json)
// track quality cuts
Configurable<int> TPCNClsCrossedRows{"TPCNClsCrossedRows", 70, "number of crossed rows in TPC"};

Check warning on line 71 in PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
Configurable<bool> TOFAtLeastOneProton{"TOFAtLeastOneProton", false, "at least one candidate track has TOF hits"};

Check warning on line 72 in PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
Configurable<bool> TOFBothProtons{"TOFBothProtons", false, "both candidate protons have TOF hits"};

Check warning on line 73 in PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
Configurable<bool> TOFOneProton{"TOFOneProton", false, "one candidate proton has TOF hits"};
Configurable<bool> DCAcut{"DCAcut", false, "DCA cut from run2."};
Configurable<bool> newCutTPC{"newCutTPC", false, "New cuts for TPC quality tracks."};
Expand Down Expand Up @@ -786,18 +786,39 @@

// MC histograms
MC.add("MC/hNumberOfMCCollisions", "hNumberOfCollisions", {HistType::kTH1F, {{10, 0, 10}}});
MC.add("MC/hNumberOfMCTracks", "hNumberOfMCTracks", {HistType::kTH1F, {{10, 0, 10}}});
MC.add("MC/hNumberOfRecoCollisions", "hNumberOfRecoCollisions", {HistType::kTH1F, {{10, 0, 10}}});
MC.add("MC/Muon/hNumberOfMCTracks", "hNumberOfMCTracks", {HistType::kTH1F, {{10, 0, 10}}});
MC.add("MC/Electron/hNumberOfMCTracks", "hNumberOfMCTracks", {HistType::kTH1F, {{10, 0, 10}}});
MC.add("MC/Proton/hNumberOfMCTracks", "hNumberOfMCTracks", {HistType::kTH1F, {{10, 0, 10}}});
MC.add("MC/hPosZ", "hPosZ", {HistType::kTH1F, {{60, -15, 15}}});
MC.add("MC/hPDG", "hPDG", {HistType::kTH1F, {{900, -450, 450}}});
MC.add("MC/hEta1", "hEta1", {HistType::kTH1F, {axisEta}});
MC.add("MC/hEta2", "hEta2", {HistType::kTH1F, {axisEta}});
MC.add("MC/hPhi1", "hPhi1", {HistType::kTH1F, {axisPhi}});
MC.add("MC/hPhi2", "hPhi2", {HistType::kTH1F, {axisPhi}});
MC.add("MC/hIVM", "hIVM", {HistType::kTH1F, {axisIVM}});
MC.add("MC/hRapidity", "hRapidity", {HistType::kTH1F, {axisEta}});
MC.add("MC/hPt1", "hPt1", {HistType::kTH1F, {axisPt}});
MC.add("MC/hPt2", "hPt2", {HistType::kTH1F, {axisPt}});
MC.add("MC/hPt", "hPt", {HistType::kTH1F, {axisPt}});
MC.add("MC/hPDG", "hPDG", {HistType::kTH1F, {{200000, -100000, 100000}}});
MC.add("MC/Electron/hEta1", "hEta1", {HistType::kTH1F, {axisEta}});
MC.add("MC/Electron/hEta2", "hEta2", {HistType::kTH1F, {axisEta}});
MC.add("MC/Electron/hPhi1", "hPhi1", {HistType::kTH1F, {axisPhi}});
MC.add("MC/Electron/hPhi2", "hPhi2", {HistType::kTH1F, {axisPhi}});
MC.add("MC/Electron/hIVM", "hIVM", {HistType::kTH1F, {axisIVM}});
MC.add("MC/Electron/hRapidity", "hRapidity", {HistType::kTH1F, {axisEta}});
MC.add("MC/Electron/hPt1", "hPt1", {HistType::kTH1F, {axisPt}});
MC.add("MC/Electron/hPt2", "hPt2", {HistType::kTH1F, {axisPt}});
MC.add("MC/Electron/hPt", "hPt", {HistType::kTH1F, {axisPt}});
MC.add("MC/Muon/hEta1", "hEta1", {HistType::kTH1F, {axisEta}});
MC.add("MC/Muon/hEta2", "hEta2", {HistType::kTH1F, {axisEta}});
MC.add("MC/Muon/hPhi1", "hPhi1", {HistType::kTH1F, {axisPhi}});
MC.add("MC/Muon/hPhi2", "hPhi2", {HistType::kTH1F, {axisPhi}});
MC.add("MC/Muon/hIVM", "hIVM", {HistType::kTH1F, {axisIVM}});
MC.add("MC/Muon/hRapidity", "hRapidity", {HistType::kTH1F, {axisEta}});
MC.add("MC/Muon/hPt1", "hPt1", {HistType::kTH1F, {axisPt}});
MC.add("MC/Muon/hPt2", "hPt2", {HistType::kTH1F, {axisPt}});
MC.add("MC/Muon/hPt", "hPt", {HistType::kTH1F, {axisPt}});
MC.add("MC/Proton/hEta1", "hEta1", {HistType::kTH1F, {axisEta}});
MC.add("MC/Proton/hEta2", "hEta2", {HistType::kTH1F, {axisEta}});
MC.add("MC/Proton/hPhi1", "hPhi1", {HistType::kTH1F, {axisPhi}});
MC.add("MC/Proton/hPhi2", "hPhi2", {HistType::kTH1F, {axisPhi}});
MC.add("MC/Proton/hIVM", "hIVM", {HistType::kTH1F, {axisIVM}});
MC.add("MC/Proton/hRapidity", "hRapidity", {HistType::kTH1F, {axisEta}});
MC.add("MC/Proton/hPt1", "hPt1", {HistType::kTH1F, {axisPt}});
MC.add("MC/Proton/hPt2", "hPt2", {HistType::kTH1F, {axisPt}});
MC.add("MC/Proton/hPt", "hPt", {HistType::kTH1F, {axisPt}});
}

bool cutITSLayers(uint8_t itsClusterMap) const
Expand All @@ -805,7 +826,7 @@
std::vector<std::pair<int8_t, std::array<uint8_t, 3>>> requiredITSHits{};
requiredITSHits.push_back(std::make_pair(1, std::array<uint8_t, 3>{0, 1, 2})); // at least one hit in the innermost layer
constexpr uint8_t bit = 1;
for (auto& itsRequirement : requiredITSHits) {

Check warning on line 829 in PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return itsClusterMap & (bit << requiredLayer); });

if ((itsRequirement.first == -1) && (hits > 0)) {
Expand Down Expand Up @@ -841,7 +862,7 @@
return false;
}
if (DCAcut) {
float dcaXYPtCut = 0.0105f + 0.0350f / pow(track.pt(), 1.1f);

Check warning on line 865 in PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
if (std::abs(track.dcaXY()) > dcaXYPtCut) {
Statistics.get<TH1>(HIST("Statistics/hCutCounterTracks"))->Fill(5);
return false;
Expand Down Expand Up @@ -945,7 +966,7 @@
}

// loop over tracks without selections
for (auto& track : tracks) {

Check warning on line 969 in PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
float trkPx = track.px();
float trkPy = track.py();
float trkPz = track.pz();
Expand Down Expand Up @@ -1014,7 +1035,7 @@
RawData.get<TH1>(HIST("RawData/hZNATime"))->Fill(collision.timeZNA());
RawData.get<TH2>(HIST("RawData/hZNAvsZNCTime"))->Fill(collision.timeZNA(), collision.timeZNC());

for (auto& track : tracks) {

Check warning on line 1038 in PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.

Statistics.get<TH1>(HIST("Statistics/hNumberOfTracks"))->Fill(2.);

Expand Down Expand Up @@ -1227,7 +1248,8 @@
} else if (OnOn) {
JPsiToEl.get<TH1>(HIST("JPsiToEl/NotCoherent/OnOn/hIVM"))->Fill(massJpsi);
}
} else {
}
if (RecoDecay::pt(mother) > 0.2f) {
JPsiToEl.get<TH1>(HIST("JPsiToEl/Incoherent/hIVM"))->Fill(massJpsi);
if (XnXn) {
JPsiToEl.get<TH1>(HIST("JPsiToEl/Incoherent/XnXn/hIVM"))->Fill(massJpsi);
Expand Down Expand Up @@ -1631,7 +1653,8 @@
} else if (OnOn) {
JPsiToMu.get<TH1>(HIST("JPsiToMu/NotCoherent/OnOn/hIVM"))->Fill(massJpsi);
}
} else {
}
if (RecoDecay::pt(mother) > 0.2f) {
JPsiToMu.get<TH1>(HIST("JPsiToMu/Incoherent/hIVM"))->Fill(massJpsi);
if (XnXn) {
JPsiToMu.get<TH1>(HIST("JPsiToMu/Incoherent/XnXn/hIVM"))->Fill(massJpsi);
Expand Down Expand Up @@ -2083,44 +2106,106 @@
MC.get<TH1>(HIST("MC/hNumberOfMCCollisions"))->Fill(1.);
MC.get<TH1>(HIST("MC/hPosZ"))->Fill(mcCollision.posZ());

std::array<float, 3> daughPart1;
std::array<float, 3> daughPart2;
std::array<float, 3> daughPart1Mu;
std::array<float, 3> daughPart2Mu;
std::array<float, 3> daughPart1El;
std::array<float, 3> daughPart2El;
std::array<float, 3> daughPart1Pr;
std::array<float, 3> daughPart2Pr;

// fill number of particles
for (auto const& mcParticle : mcParticles) {
MC.get<TH1>(HIST("MC/hNumberOfMCTracks"))->Fill(1.);
MC.get<TH1>(HIST("MC/Muon/hNumberOfMCTracks"))->Fill(1.);
MC.get<TH1>(HIST("MC/Electron/hNumberOfMCTracks"))->Fill(1.);
MC.get<TH1>(HIST("MC/Proton/hNumberOfMCTracks"))->Fill(1.);
MC.get<TH1>(HIST("MC/hPDG"))->Fill(mcParticle.pdgCode());

// check if only muons and physical primaries are present
if ((mcParticle.pdgCode() == 13) && mcParticle.isPhysicalPrimary()) {
daughPart1 = {mcParticle.px(), mcParticle.py(), mcParticle.pz()};
daughPart1Mu = {mcParticle.px(), mcParticle.py(), mcParticle.pz()};

MC.get<TH1>(HIST("MC/hNumberOfMCTracks"))->Fill(2.);
MC.get<TH1>(HIST("MC/Muon/hNumberOfMCTracks"))->Fill(2.);
}
if ((mcParticle.pdgCode() == -13) && mcParticle.isPhysicalPrimary()) {
daughPart2 = {mcParticle.px(), mcParticle.py(), mcParticle.pz()};
daughPart2Mu = {mcParticle.px(), mcParticle.py(), mcParticle.pz()};

MC.get<TH1>(HIST("MC/Muon/hNumberOfMCTracks"))->Fill(3.);
}
if ((mcParticle.pdgCode() == 11) && mcParticle.isPhysicalPrimary()) {
daughPart1El = {mcParticle.px(), mcParticle.py(), mcParticle.pz()};

MC.get<TH1>(HIST("MC/Electron/hNumberOfMCTracks"))->Fill(2.);
}
if ((mcParticle.pdgCode() == -11) && mcParticle.isPhysicalPrimary()) {
daughPart2El = {mcParticle.px(), mcParticle.py(), mcParticle.pz()};

MC.get<TH1>(HIST("MC/Electron/hNumberOfMCTracks"))->Fill(3.);
}
if ((mcParticle.pdgCode() == 2212) && mcParticle.isPhysicalPrimary()) {
daughPart1Pr = {mcParticle.px(), mcParticle.py(), mcParticle.pz()};

MC.get<TH1>(HIST("MC/hNumberOfMCTracks"))->Fill(3.);
MC.get<TH1>(HIST("MC/Proton/hNumberOfMCTracks"))->Fill(2.);
}
if ((mcParticle.pdgCode() == -2212) && mcParticle.isPhysicalPrimary()) {
daughPart2Pr = {mcParticle.px(), mcParticle.py(), mcParticle.pz()};

MC.get<TH1>(HIST("MC/Proton/hNumberOfMCTracks"))->Fill(3.);
}
}

// calculate J/psi system and needed distributions
std::array<double, 3> motherPart = {daughPart1[0] + daughPart2[0], daughPart1[1] + daughPart2[1], daughPart1[2] + daughPart2[2]};
std::array<double, 3> motherPartMu = {daughPart1Mu[0] + daughPart2Mu[0], daughPart1Mu[1] + daughPart2Mu[1], daughPart1Mu[2] + daughPart2Mu[2]};
std::array<double, 3> motherPartEl = {daughPart1El[0] + daughPart2El[0], daughPart1El[1] + daughPart2El[1], daughPart1El[2] + daughPart2El[2]};
std::array<double, 3> motherPartPr = {daughPart1Pr[0] + daughPart2Pr[0], daughPart1Pr[1] + daughPart2Pr[1], daughPart1Pr[2] + daughPart2Pr[2]};

float massEl = o2::constants::physics::MassElectron;
float massMu = o2::constants::physics::MassMuonMinus;
auto arrMom = std::array{daughPart1, daughPart2};
float massJpsi = RecoDecay::m(arrMom, std::array{massMu, massMu});

MC.get<TH1>(HIST("MC/hEta1"))->Fill(RecoDecay::eta(daughPart1));
MC.get<TH1>(HIST("MC/hEta2"))->Fill(RecoDecay::eta(daughPart2));
MC.get<TH1>(HIST("MC/hPhi1"))->Fill(RecoDecay::phi(daughPart1));
MC.get<TH1>(HIST("MC/hPhi2"))->Fill(RecoDecay::phi(daughPart2));
MC.get<TH1>(HIST("MC/hPt1"))->Fill(RecoDecay::pt(daughPart1));
MC.get<TH1>(HIST("MC/hPt2"))->Fill(RecoDecay::pt(daughPart2));
MC.get<TH1>(HIST("MC/hPt"))->Fill(RecoDecay::pt(motherPart));
MC.get<TH1>(HIST("MC/hIVM"))->Fill(massJpsi);
MC.get<TH1>(HIST("MC/hRapidity"))->Fill(RecoDecay::y(motherPart, massJpsi));
} // end MC process
float massPr = o2::constants::physics::MassProton;

auto arrMomMu = std::array{daughPart1Mu, daughPart2Mu};
float massJpsiMu = RecoDecay::m(arrMomMu, std::array{massMu, massMu});
auto arrMomEl = std::array{daughPart1El, daughPart2El};
float massJpsiEl = RecoDecay::m(arrMomEl, std::array{massEl, massEl});
auto arrMomPr = std::array{daughPart1Pr, daughPart2Pr};
float massJpsiPr = RecoDecay::m(arrMomPr, std::array{massPr, massPr});

MC.get<TH1>(HIST("MC/Muon/hEta1"))->Fill(RecoDecay::eta(daughPart1Mu));
MC.get<TH1>(HIST("MC/Muon/hEta2"))->Fill(RecoDecay::eta(daughPart2Mu));
MC.get<TH1>(HIST("MC/Muon/hPhi1"))->Fill(RecoDecay::phi(daughPart1Mu));
MC.get<TH1>(HIST("MC/Muon/hPhi2"))->Fill(RecoDecay::phi(daughPart2Mu));
MC.get<TH1>(HIST("MC/Muon/hPt1"))->Fill(RecoDecay::pt(daughPart1Mu));
MC.get<TH1>(HIST("MC/Muon/hPt2"))->Fill(RecoDecay::pt(daughPart2Mu));
MC.get<TH1>(HIST("MC/Muon/hPt"))->Fill(RecoDecay::pt(motherPartMu));
MC.get<TH1>(HIST("MC/Muon/hIVM"))->Fill(massJpsiMu);
MC.get<TH1>(HIST("MC/Muon/hRapidity"))->Fill(RecoDecay::y(motherPartMu, massJpsiMu));

MC.get<TH1>(HIST("MC/Electron/hEta1"))->Fill(RecoDecay::eta(daughPart1El));
MC.get<TH1>(HIST("MC/Electron/hEta2"))->Fill(RecoDecay::eta(daughPart2El));
MC.get<TH1>(HIST("MC/Electron/hPhi1"))->Fill(RecoDecay::phi(daughPart1El));
MC.get<TH1>(HIST("MC/Electron/hPhi2"))->Fill(RecoDecay::phi(daughPart2El));
MC.get<TH1>(HIST("MC/Electron/hPt1"))->Fill(RecoDecay::pt(daughPart1El));
MC.get<TH1>(HIST("MC/Electron/hPt2"))->Fill(RecoDecay::pt(daughPart2El));
MC.get<TH1>(HIST("MC/Electron/hPt"))->Fill(RecoDecay::pt(motherPartEl));
MC.get<TH1>(HIST("MC/Electron/hIVM"))->Fill(massJpsiEl);
MC.get<TH1>(HIST("MC/Electron/hRapidity"))->Fill(RecoDecay::y(motherPartEl, massJpsiEl));

MC.get<TH1>(HIST("MC/Proton/hEta1"))->Fill(RecoDecay::eta(daughPart1Pr));
MC.get<TH1>(HIST("MC/Proton/hEta2"))->Fill(RecoDecay::eta(daughPart2Pr));
MC.get<TH1>(HIST("MC/Proton/hPhi1"))->Fill(RecoDecay::phi(daughPart1Pr));
MC.get<TH1>(HIST("MC/Proton/hPhi2"))->Fill(RecoDecay::phi(daughPart2Pr));
MC.get<TH1>(HIST("MC/Proton/hPt1"))->Fill(RecoDecay::pt(daughPart1Pr));
MC.get<TH1>(HIST("MC/Proton/hPt2"))->Fill(RecoDecay::pt(daughPart2Pr));
MC.get<TH1>(HIST("MC/Proton/hPt"))->Fill(RecoDecay::pt(motherPartPr));
MC.get<TH1>(HIST("MC/Proton/hIVM"))->Fill(massJpsiPr);
MC.get<TH1>(HIST("MC/Proton/hRapidity"))->Fill(RecoDecay::y(motherPartPr, massJpsiPr));

} // end MC skimmed process

template <typename C>
void processMCU(C const& collisions)
{
MC.fill(HIST("MC/hNumberOfRecoCollisions"), collisions.size());
} // end MC unskimmed process

void processDGrecoLevel(UDCollisionFull const& collision, UDTracksFull const& tracks)
{
Expand All @@ -2146,9 +2231,15 @@
processMC(mcCollision, mcParticles);
}

void processMCUnskimmed(aod::McCollision const& mcCollision, soa::SmallGroups<soa::Join<aod::McCollisionLabels, aod::Collisions>> const& collisions /*, aod::McParticles const& mcParticles, aod::TracksIU const& tracks*/)
{
processMCU(collisions);
}

PROCESS_SWITCH(UpcJpsiCentralBarrel, processDGrecoLevel, "Iterate over DG skimmed data.", false);
PROCESS_SWITCH(UpcJpsiCentralBarrel, processSGrecoLevel, "Iterate over SG skimmed data.", false);
PROCESS_SWITCH(UpcJpsiCentralBarrel, processMCtruth, "Iterate of MC true data.", true);
PROCESS_SWITCH(UpcJpsiCentralBarrel, processMCUnskimmed, "Iterate over unskimmed data.", true);
}; // end struct

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down
Loading