Skip to content

Commit 443ee51

Browse files
sawankumawatSawan Sawan
andauthored
[PWGLF] Optimised both codes (#11999)
Co-authored-by: Sawan Sawan <sawan.sawan@cern.ch>
1 parent 1d80c4b commit 443ee51

File tree

2 files changed

+332
-92
lines changed

2 files changed

+332
-92
lines changed

PWGLF/Tasks/Resonances/higherMassResonances.cxx

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ struct HigherMassResonances {
178178
// variables declaration
179179
float multiplicity = 0.0f;
180180
float theta2;
181-
ROOT::Math::PxPyPzMVector daughter1, daughter2, daughterRot, daughterRotCM, mother, mother1, motherRot, fourVecDauCM, fourVecDauCM1;
181+
ROOT::Math::PxPyPzMVector daughter1, daughter2, daughterRot, daughterRotCM, mother, motherRot, fourVecDauCM, fourVecDauCM1;
182+
ROOT::Math::PxPyPzEVector mother1;
182183
ROOT::Math::XYZVector randomVec, beamVec, normalVec;
183184
ROOT::Math::XYZVectorF v1_CM, zaxis_HE, yaxis_HE, xaxis_HE;
184185
// ROOT::Math::XYZVector threeVecDauCM, helicityVec, randomVec, beamVec, normalVec;
@@ -313,13 +314,15 @@ struct HigherMassResonances {
313314
hMChists.add("events_check", "No. of events in the generated MC", kTH1I, {{20, 0, 20}});
314315
hMChists.add("events_checkrec", "No. of events in the reconstructed MC", kTH1I, {{25, 0, 25}});
315316
hMChists.add("Genf1710", "Gen f_{0}(1710)", kTHnSparseF, {multiplicityAxis, ptAxis, thnAxisPOL});
317+
hMChists.add("Genf17102", "Gen f_{0}(1710)", kTHnSparseF, {multiplicityAxis, ptAxis, thnAxisPOL});
316318
hMChists.add("Recf1710_pt1", "Rec f_{0}(1710) p_{T}", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL});
317319
hMChists.add("Recf1710_pt2", "Rec f_{0}(1710) p_{T}", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL});
318320
// hMChists.add("Recf1710_p", "Rec f_{0}(1710) p", kTH1F, {ptAxis});
319321
hMChists.add("h1Recsplit", "Rec p_{T}2", kTH1F, {ptAxis});
320322
// hMChists.add("Recf1710_mass", "Rec f_{0}(1710) mass", kTH1F, {glueballMassAxis});
321323
hMChists.add("Genf1710_mass", "Gen f_{0}(1710) mass", kTH1F, {glueballMassAxis});
322-
hMChists.add("Genf1710_pt2", "Gen f_{0}(1710) p_{T}", kTH1F, {ptAxis});
324+
hMChists.add("Genf1710_mass2", "Gen f_{0}(1710) mass", kTH1F, {glueballMassAxis});
325+
// hMChists.add("Genf1710_pt2", "Gen f_{0}(1710) p_{T}", kTH1F, {ptAxis});
323326
hMChists.add("GenPhi", "Gen Phi", kTH1F, {{70, 0.0, 7.0f}});
324327
hMChists.add("GenPhi2", "Gen Phi", kTH1F, {{70, 0.0, 7.0f}});
325328
hMChists.add("GenEta", "Gen Eta", kTHnSparseF, {{150, -1.5f, 1.5f}});
@@ -992,7 +995,8 @@ struct HigherMassResonances {
992995
int counter = 0;
993996
float multiplicityGen = 0.0;
994997
std::vector<bool> passKs;
995-
ROOT::Math::PxPyPzMVector lResonance_gen, lResonance_gen2;
998+
ROOT::Math::PxPyPzMVector lResonance_gen1;
999+
ROOT::Math::PxPyPzEVector lResonance_gen;
9961000

9971001
void processGen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups<EventCandidatesMC>& collisions)
9981002
{
@@ -1084,26 +1088,32 @@ struct HigherMassResonances {
10841088
}
10851089
if (passKs.size() == 2) {
10861090
lResonance_gen = ROOT::Math::PxPyPzEVector(mcParticle.pt(), mcParticle.eta(), mcParticle.phi(), mcParticle.e());
1087-
lResonance_gen2 = daughter1 + daughter2;
1091+
lResonance_gen1 = daughter1 + daughter2;
10881092

1089-
if (config.applyPairRapidityGen && std::abs(lResonance_gen2.Y()) >= 0.5) {
1093+
ROOT::Math::Boost boost{lResonance_gen.BoostToCM()};
1094+
ROOT::Math::Boost boost1{lResonance_gen1.BoostToCM()};
1095+
1096+
fourVecDauCM = boost(daughter1);
1097+
fourVecDauCM1 = boost1(daughter1);
1098+
1099+
auto helicity_gen = lResonance_gen.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(lResonance_gen.Vect().Mag2()));
1100+
auto helicity_gen1 = lResonance_gen1.Vect().Dot(fourVecDauCM1.Vect()) / (std::sqrt(fourVecDauCM1.Vect().Mag2()) * std::sqrt(lResonance_gen1.Vect().Mag2()));
1101+
1102+
hMChists.fill(HIST("Genf1710"), multiplicityGen, lResonance_gen.pt(), helicity_gen);
1103+
hMChists.fill(HIST("Genf1710_mass"), lResonance_gen.M());
1104+
hMChists.fill(HIST("GenRapidity"), mcParticle.y());
1105+
hMChists.fill(HIST("GenEta"), mcParticle.eta());
1106+
hMChists.fill(HIST("GenPhi"), mcParticle.phi());
1107+
1108+
if (config.applyPairRapidityGen && std::abs(lResonance_gen1.Y()) >= 0.5) {
10901109
continue;
10911110
}
10921111

1093-
ROOT::Math::Boost boost{lResonance_gen.BoostToCM()};
1094-
fourVecDauCM = boost(daughter1); // boost the frame of daughter to the center of mass frame
1095-
1096-
auto helicity_gen = lResonance_gen2.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(lResonance_gen2.Vect().Mag2()));
1097-
1098-
hMChists.fill(HIST("Genf1710"), multiplicityGen, lResonance_gen2.pt(), helicity_gen);
1099-
hMChists.fill(HIST("Genf1710_mass"), lResonance_gen2.M());
1100-
hMChists.fill(HIST("Genf1710_pt2"), mcParticle.pt());
1101-
hMChists.fill(HIST("GenRapidity"), lResonance_gen2.Y());
1102-
hMChists.fill(HIST("GenRapidity2"), mcParticle.y());
1103-
hMChists.fill(HIST("GenEta"), lResonance_gen2.Eta());
1104-
hMChists.fill(HIST("GenEta2"), mcParticle.eta());
1105-
hMChists.fill(HIST("GenPhi"), lResonance_gen2.Phi());
1106-
hMChists.fill(HIST("GenPhi2"), mcParticle.phi());
1112+
hMChists.fill(HIST("Genf17102"), multiplicityGen, lResonance_gen1.pt(), helicity_gen1);
1113+
hMChists.fill(HIST("Genf1710_mass2"), lResonance_gen1.M());
1114+
hMChists.fill(HIST("GenRapidity2"), lResonance_gen1.Y());
1115+
hMChists.fill(HIST("GenEta2"), lResonance_gen1.Eta());
1116+
hMChists.fill(HIST("GenPhi2"), lResonance_gen1.Phi());
11071117
}
11081118
passKs.clear(); // clear the vector for the next iteration
11091119
}
@@ -1118,7 +1128,7 @@ struct HigherMassResonances {
11181128
return;
11191129
}
11201130

1121-
auto multiplicity = collision.centFT0C();
1131+
auto multiplicity = collision.centFT0M();
11221132
hMChists.fill(HIST("Rec_Multiplicity"), multiplicity);
11231133

11241134
hMChists.fill(HIST("events_checkrec"), 0.5);
@@ -1277,20 +1287,19 @@ struct HigherMassResonances {
12771287

12781288
auto helicity_rec2 = mother1.Vect().Dot(fourVecDauCM1.Vect()) / (std::sqrt(fourVecDauCM1.Vect().Mag2()) * std::sqrt(mother1.Vect().Mag2()));
12791289

1290+
hMChists.fill(HIST("Recf1710_pt1"), multiplicity, mothertrack1.pt(), mother1.M(), helicity_rec2);
1291+
hMChists.fill(HIST("RecRapidity"), mothertrack1.y());
1292+
hMChists.fill(HIST("RecPhi"), mothertrack1.phi());
1293+
hMChists.fill(HIST("RecEta"), mothertrack1.eta());
1294+
12801295
if (config.applyPairRapidityRec && std::abs(mother.Y()) >= 0.5) {
12811296
continue;
12821297
}
12831298

1284-
// std::cout << "mother pT is " << mother.Pt() << std::endl;
1285-
1286-
hMChists.fill(HIST("Recf1710_pt1"), multiplicity, mother.Pt(), mother.M(), helicity_rec);
1287-
hMChists.fill(HIST("Recf1710_pt2"), multiplicity, mother1.Pt(), mother1.M(), helicity_rec2);
1288-
hMChists.fill(HIST("RecRapidity"), mother.Y());
1289-
hMChists.fill(HIST("RecRapidity2"), mothertrack1.y());
1290-
hMChists.fill(HIST("RecPhi"), mother.Phi());
1291-
hMChists.fill(HIST("RecPhi2"), mothertrack1.phi());
1292-
hMChists.fill(HIST("RecEta"), mother.Eta());
1293-
hMChists.fill(HIST("RecEta2"), mothertrack1.eta());
1299+
hMChists.fill(HIST("Recf1710_pt2"), multiplicity, mother.Pt(), mother.M(), helicity_rec);
1300+
hMChists.fill(HIST("RecRapidity2"), mother.Y());
1301+
hMChists.fill(HIST("RecPhi2"), mother.Phi());
1302+
hMChists.fill(HIST("RecEta2"), mother.Eta());
12941303
}
12951304
gindex2.clear();
12961305
}

0 commit comments

Comments
 (0)