+ Double_t ptcorr = TMath::Sqrt(dx * dx + dy * dy);
+ if(save)
+ fPtSubVect = ptcorr;
+ return ptcorr;
+}
+
+//__________________________________________________________________________________________________
+TLorentzVector AliEmcalJet::SubtractRhoVect(Double_t rho, Bool_t save)
+{
+ // Return four-momentum after vectorial subtraction. Save pt if required.
+ // Saved value of pt is negative if the corrected momentum is pointing to the opposite half-plane in the x-y plane w.r.t. the raw momentum.
+
+ TLorentzVector vecCorr;
+ GetMom(vecCorr);
+ TLorentzVector vecBg;
+ vecBg.SetPtEtaPhiE(fArea, fAreaEta, fAreaPhi, fAreaE);
+ vecBg *= rho;
+ vecCorr -= vecBg;
+ if(save)
+ {
+ Double_t dPhi = TMath::Abs(TVector2::Phi_mpi_pi(Phi() - vecCorr.Phi()));
+ Int_t signum = dPhi <= TMath::PiOver2() ? 1 : -1;
+ fPtSubVect = signum * vecCorr.Pt();
+ }
+ return vecCorr;