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
58 changes: 33 additions & 25 deletions PWGLF/Tasks/Resonances/higherMassResonances.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include <TH1F.h>
#include <TH2F.h>
#include <THn.h>
#include <TLorentzVector.h>

Check failure on line 45 in PWGLF/Tasks/Resonances/higherMassResonances.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
#include <TMath.h>
#include <TObjArray.h>
#include <TPDGCode.h>
Expand Down Expand Up @@ -181,7 +181,7 @@
ROOT::Math::XYZVectorF v1_CM, zaxis_HE, yaxis_HE, xaxis_HE;
// ROOT::Math::XYZVector threeVecDauCM, helicityVec, randomVec, beamVec, normalVec;
ROOT::Math::XYZVector zBeam; // ẑ: beam direction in lab frame
double BeamMomentum = TMath::Sqrt(13600 * 13600 / 4 - 0.938 * 0.938); // GeV

Check failure on line 184 in PWGLF/Tasks/Resonances/higherMassResonances.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-mass]

Avoid hard-coded particle masses. Use o2::constants::physics::Mass... instead.

Check failure on line 184 in PWGLF/Tasks/Resonances/higherMassResonances.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
ROOT::Math::PxPyPzEVector Beam1{0., 0., -BeamMomentum, 13600. / 2.};
ROOT::Math::PxPyPzEVector Beam2{0., 0., BeamMomentum, 13600. / 2.};
ROOT::Math::XYZVectorF Beam1_CM, Beam2_CM;
Expand Down Expand Up @@ -310,20 +310,22 @@
if (config.isMC) {
hMChists.add("events_check", "No. of events in the generated MC", kTH1I, {{20, 0, 20}});
hMChists.add("events_checkrec", "No. of events in the reconstructed MC", kTH1I, {{20, 0, 20}});
hMChists.add("Genf1710", "Gen f_{0}(1710)", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL});
hMChists.add("Genf1710", "Gen f_{0}(1710)", kTHnSparseF, {multiplicityAxis, ptAxis, thnAxisPOL});
hMChists.add("Recf1710_pt1", "Rec f_{0}(1710) p_{T}", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL});
hMChists.add("Recf1710_pt2", "Rec f_{0}(1710) p_{T}", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL});
// hMChists.add("Recf1710_p", "Rec f_{0}(1710) p", kTH1F, {ptAxis});
hMChists.add("h1Recsplit", "Rec p_{T}2", kTH1F, {ptAxis});
// hMChists.add("Recf1710_mass", "Rec f_{0}(1710) mass", kTH1F, {glueballMassAxis});
// hMChists.add("Genf1710_mass", "Gen f_{0}(1710) mass", kTH1F, {glueballMassAxis});
hMChists.add("Genf1710_mass", "Gen f_{0}(1710) mass", kTH1F, {glueballMassAxis});
hMChists.add("Genf1710_mass2", "Gen f_{0}(1710) mass", kTH1F, {glueballMassAxis});
hMChists.add("Genf1710_pt2", "Gen f_{0}(1710) mass", kTH1F, {glueballMassAxis});
hMChists.add("GenEta", "Gen Eta", kTHnSparseF, {ptAxis, {100, -1.0f, 1.0f}});
hMChists.add("GenPhi", "Gen Phi", kTH1F, {{70, -3.5f, 3.5f}});
hMChists.add("GenRapidity", "Gen Rapidity", kTHnSparseF, {ptAxis, {100, -1.0f, 1.0f}});
hMChists.add("RecEta", "Rec Eta", kTH1F, {{100, -1.0f, 1.0f}});
hMChists.add("RecPhi", "Rec Phi", kTH1F, {{70, 0.0f, 7.0f}});
hMChists.add("RecRapidity", "Rec Rapidity", kTH1F, {{100, -1.0f, 1.0f}});
hMChists.add("MC_mult", "Multiplicity in MC", kTH1F, {multiplicityAxis});
hMChists.add("Rec_Multiplicity", "Multiplicity in MC", kTH1F, {multiplicityAxis});
hMChists.add("MC_mult_after_event_sel", "Multiplicity in MC", kTH1F, {multiplicityAxis});
// hMChists.add("GenPx", "Gen Px", kTH1F, {{100, -10.0f, 10.0f}});
// hMChists.add("GenPy", "Gen Py", kTH1F, {{100, -10.0f, 10.0f}});
Expand Down Expand Up @@ -376,7 +378,7 @@
const float cpav0 = candidate.v0cosPA();

float ctauK0s = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short;
float lowmasscutks0 = 0.497 - config.cWidthKs0 * config.cSigmaMassKs0;

Check failure on line 381 in PWGLF/Tasks/Resonances/higherMassResonances.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-mass]

Avoid hard-coded particle masses. Use o2::constants::physics::Mass... instead.
float highmasscutks0 = 0.497 + config.cWidthKs0 * config.cSigmaMassKs0;
// float decayLength = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * RecoDecay::sqrtSumOfSquares(candidate.px(), candidate.py(), candidate.pz());

Expand Down Expand Up @@ -634,9 +636,9 @@

// CosThetaHE = zaxis_HE.Dot(v_CM);

auto angle_phi = TMath::ATan2(yaxis_HE.Dot(v1_CM), xaxis_HE.Dot(v1_CM));

Check failure on line 639 in PWGLF/Tasks/Resonances/higherMassResonances.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
if (angle_phi < 0) {
angle_phi += 2 * TMath::Pi(); // ensure phi is in [0, 2pi]

Check failure on line 641 in PWGLF/Tasks/Resonances/higherMassResonances.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pi-multiple-fraction]

Use multiples/fractions of PI defined in o2::constants::math.

Check failure on line 641 in PWGLF/Tasks/Resonances/higherMassResonances.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[two-pi-add-subtract]

Use RecoDecay::constrainAngle to restrict angle to a given range.

Check failure on line 641 in PWGLF/Tasks/Resonances/higherMassResonances.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
}

if (std::abs(mother.Rapidity()) < 0.5) {
Expand Down Expand Up @@ -982,12 +984,14 @@

int counter = 0;
float multiplicityGen = 0.0;
std::vector<bool> passKs;
ROOT::Math::PxPyPzMVector lResonance_gen, lResonance_gen2;

void processGen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups<EventCandidatesMC>& collisions)
{
if (config.isMC == false) {
return;
}
ROOT::Math::PxPyPzMVector lResonance_gen;
hMChists.fill(HIST("events_check"), 0.5);
if (std::abs(mcCollision.posZ()) < config.cutzvertex) {
hMChists.fill(HIST("events_check"), 1.5);
Expand Down Expand Up @@ -1039,6 +1043,11 @@
}
hMChists.fill(HIST("events_check"), 5.5);

if (config.apply_rapidityMC && std::abs(mcParticle.y()) >= 0.5) {
continue;
}
hMChists.fill(HIST("events_check"), 6.5);

// if (counter < 1e3)
// std::cout << "px " << mcParticle.px() << " py " << mcParticle.py() << " pz " << mcParticle.pz() << " y " << mcParticle.y() << std::endl;
// counter++;
Expand All @@ -1050,43 +1059,44 @@
// hMChists.fill(HIST("GenPy"), mcParticle.py());
// hMChists.fill(HIST("GenPz"), mcParticle.pz());

if (config.apply_rapidityMC && std::abs(mcParticle.y()) >= 0.5) {
continue;
}
hMChists.fill(HIST("events_check"), 6.5);

auto kDaughters = mcParticle.daughters_as<aod::McParticles>();
if (kDaughters.size() != 2) {
continue;
}
hMChists.fill(HIST("events_check"), 7.5);

auto passKs = false;
for (const auto& kCurrentDaughter : kDaughters) {
// int daupdg = std::abs(kCurrentDaughter.pdgCode());

if (!kCurrentDaughter.isPhysicalPrimary()) {
continue;
}
hMChists.fill(HIST("events_check"), 8.5);

if (std::abs(kCurrentDaughter.pdgCode()) == 310) {

Check failure on line 1075 in PWGLF/Tasks/Resonances/higherMassResonances.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
passKs = true;
passKs.push_back(true);
hMChists.fill(HIST("events_check"), 9.5);
daughter1 = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassK0Short);
if (passKs.size() == 1) {
daughter1 = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassK0Short);
} else if (passKs.size() == 2) {
daughter2 = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassK0Short);
}
}
}
if (passKs) {
if (passKs.size() == 2) {
lResonance_gen = ROOT::Math::PxPyPzMVector(mcParticle.pt(), mcParticle.eta(), mcParticle.phi(), mcParticle.e());
mother = ROOT::Math::PxPyPzMVector(lResonance_gen.Px(), lResonance_gen.Py(), lResonance_gen.Pz(), lResonance_gen.M());
ROOT::Math::Boost boost{mother.BoostToCM()};
lResonance_gen2 = daughter1 + daughter2; // invariant mass of Kshort pair

ROOT::Math::Boost boost{lResonance_gen.BoostToCM()};
fourVecDauCM = boost(daughter1); // boost the frame of daughter to the center of mass frame

auto helicity_gen = daughter1.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(daughter1.Vect().Mag2()));
auto helicity_gen = lResonance_gen.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(lResonance_gen.Vect().Mag2()));

hMChists.fill(HIST("Genf1710"), multiplicityGen, mcParticle.pt(), lResonance_gen.M(), helicity_gen);
// hMChists.fill(HIST("Genf1710_mass"), lResonance_gen.M());
hMChists.fill(HIST("Genf1710"), multiplicityGen, mcParticle.pt(), helicity_gen);
hMChists.fill(HIST("Genf1710_mass"), lResonance_gen.M());
hMChists.fill(HIST("Genf1710_mass2"), lResonance_gen2.M());
hMChists.fill(HIST("Genf1710_pt2"), lResonance_gen2.Pt());
}
passKs.clear(); // clear the vector for the next iteration
}
}
PROCESS_SWITCH(HigherMassResonances, processGen, "Process Generated", false);
Expand All @@ -1102,7 +1112,7 @@

ROOT::Math::PxPyPzMVector lDecayDaughter1, lDecayDaughter2, lResonance;
auto multiplicity = collision.centFT0C();
hMChists.fill(HIST("MC_mult"), multiplicity);
hMChists.fill(HIST("Rec_Multiplicity"), multiplicity);

hMChists.fill(HIST("events_checkrec"), 0.5);
if (!collision.has_mcCollision()) {
Expand Down Expand Up @@ -1183,7 +1193,7 @@
int trackv0PDG1 = std::abs(mctrackv01.pdgCode());
int trackv0PDG2 = std::abs(mctrackv02.pdgCode());

if (std::abs(trackv0PDG1) != 310 || std::abs(trackv0PDG2) != 310) {

Check failure on line 1196 in PWGLF/Tasks/Resonances/higherMassResonances.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
continue;
}
hMChists.fill(HIST("events_checkrec"), 12.5);
Expand Down Expand Up @@ -1270,11 +1280,9 @@
continue;
}
// daughter1, mother, fourVecDauCM
mother = ROOT::Math::PxPyPzMVector(lResonance.Px(), lResonance.Py(), lResonance.Pz(), lResonance.M());
daughter1 = ROOT::Math::PxPyPzMVector(lDecayDaughter1.Px(), lDecayDaughter1.Py(), lDecayDaughter1.Pz(), o2::constants::physics::MassK0Short);
ROOT::Math::Boost boost{mother.BoostToCM()};
fourVecDauCM = boost(daughter1); // boost the frame of daughter to the center of mass frame
auto helicity_rec = daughter1.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(daughter1.Vect().Mag2()));
ROOT::Math::Boost boost{lResonance.BoostToCM()};
fourVecDauCM = boost(lDecayDaughter1); // boost the frame of daughter to the center of mass frame
auto helicity_rec = lResonance.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(lResonance.Vect().Mag2()));

// hMChists.fill(HIST("Recf1710_p"), motherP);
// hMChists.fill(HIST("Recf1710_mass"), recMass);
Expand Down
Loading