Skip to content

Commit 611a90a

Browse files
authored
fix O2linter bug in computekstar
1 parent 0477da3 commit 611a90a

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@
1818
#include <TH1F.h>
1919
#include <TDirectory.h>
2020
#include <THn.h>
21-
#include <TLorentzVector.h>
2221
#include <TMath.h>
2322
#include <TObjArray.h>
2423
#include <TFile.h>
2524
#include <TH2F.h>
26-
#include <TLorentzVector.h>
2725

2826
#include <cmath>
2927
#include <string>
@@ -33,6 +31,9 @@
3331
#include <cstdlib>
3432
#include <iterator> // std::prev
3533

34+
#include "Math/Vector4D.h"
35+
#include "Math/Boost.h"
36+
3637
#include "Framework/ASoAHelpers.h"
3738
#include "Framework/runDataProcessing.h"
3839
#include "Framework/AnalysisTask.h"
@@ -731,21 +732,27 @@ struct PiDeuteronFemto {
731732

732733
double computeKstar(const PiDecandidate& piDecand)
733734
{
734-
TLorentzVector De, hadron;
735-
float massDe = 1.8756;
736-
float massHad = 0.1395704;
737-
De.SetPtEtaPhiM(abs(piDecand.recoPtDe()), piDecand.recoEtaDe(), piDecand.recoPhiDe(), massDe);
738-
hadron.SetPtEtaPhiM(abs(piDecand.recoPtPi()), piDecand.recoEtaPi(), piDecand.recoPhiPi(), massHad);
739-
740-
TLorentzVector p_total_lab = De + hadron;
741-
TVector3 v_cm = p_total_lab.BoostVector();
742-
TLorentzVector p1_cm = De;
743-
TLorentzVector p2_cm = hadron;
744-
p1_cm.Boost(-v_cm);
745-
p2_cm.Boost(-v_cm);
746-
TLorentzVector p_diff_cm = p1_cm - p2_cm;
747-
double kStar = sqrt(p_diff_cm.X() * p_diff_cm.X() + p_diff_cm.Y() * p_diff_cm.Y() + p_diff_cm.Z() * p_diff_cm.Z());
748-
return kStar / 2.0;
735+
constexpr double massDe = 1.8756;
736+
constexpr double massHad = 0.1395704;
737+
738+
const ROOT::Math::PtEtaPhiMVector De(std::abs(piDecand.recoPtDe()), piDecand.recoEtaDe(), piDecand.recoPhiDe(), massDe);
739+
const ROOT::Math::PtEtaPhiMVector Had(std::abs(piDecand.recoPtPi()), piDecand.recoEtaPi(), piDecand.recoPhiPi(), massHad);
740+
const ROOT::Math::PtEtaPhiMVector trackSum = De + Had;
741+
742+
const float beta = trackSum.Beta();
743+
const float betax = beta * std::cos(trackSum.Phi()) * std::sin(trackSum.Theta());
744+
const float betay = beta * std::sin(trackSum.Phi()) * std::sin(trackSum.Theta());
745+
const float betaz = beta * std::cos(trackSum.Theta());
746+
747+
ROOT::Math::PxPyPzMVector DeCMS(De);
748+
ROOT::Math::PxPyPzMVector HadCMS(Had);
749+
750+
const ROOT::Math::Boost boostPRF = ROOT::Math::Boost(-betax, -betay, -betaz);
751+
DeCMS = boostPRF(DeCMS);
752+
HadCMS = boostPRF(HadCMS);
753+
754+
const ROOT::Math::PxPyPzMVector RelKstar = DeCMS - HadCMS;
755+
return 0.5 * RelKstar.P();
749756
}
750757

751758
void fillKstar(const PiDecandidate& piDecand)

0 commit comments

Comments
 (0)