diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index d068b07620e..7b927d99215 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -605,8 +605,12 @@ void VarManager::FillEvent(T const& event, float* values) values[kQ3Y0C] = event.q3y0c(); values[kR2SP] = (event.q2x0b() * event.q2x0c() + event.q2y0b() * event.q2y0c()); values[kR3SP] = (event.q3x0b() * event.q3x0c() + event.q3y0b() * event.q3y0c()); - values[kR2EP] = TMath::Cos(2 * (getEventPlane(2, event.q2x0b(), event.q2y0b()) - getEventPlane(2, event.q2x0c(), event.q2y0c()))); - values[kR3EP] = TMath::Cos(3 * (getEventPlane(3, event.q3x0b(), event.q3y0b()) - getEventPlane(3, event.q3x0c(), event.q3y0c()))); + if (event.q2y0b() * event.q2y0c() != 0.0) { + values[kR2EP] = TMath::Cos(2 * (getEventPlane(2, event.q2x0b(), event.q2y0b()) - getEventPlane(2, event.q2x0c(), event.q2y0c()))); + } + if (event.q3y0b() * event.q3y0c() != 0.0) { + values[kR3EP] = TMath::Cos(3 * (getEventPlane(3, event.q3x0b(), event.q3y0b()) - getEventPlane(3, event.q3x0c(), event.q3y0c()))); + } } if constexpr ((fillMap & CollisionMC) > 0) { @@ -1299,8 +1303,12 @@ void VarManager::FillQVectorFromGFW(C const& collision, A const& compA2, A const auto Psi3C = getEventPlane(3, values[kQ3X0C], values[kQ3Y0C]); values[kR2SP] = (values[kQ2X0B] * values[kQ2X0C] + values[kQ2Y0B] * values[kQ2Y0C]); values[kR3SP] = (values[kQ3X0B] * values[kQ3X0C] + values[kQ3Y0B] * values[kQ3Y0C]); - values[kR2EP] = TMath::Cos(2 * (Psi2B - Psi2C)); - values[kR3EP] = TMath::Cos(3 * (Psi3B - Psi3C)); + if (values[kQ2Y0B] * values[kQ2Y0C] != 0.0) { + values[kR2EP] = TMath::Cos(2 * (Psi2B - Psi2C)); + } + if (values[kQ3Y0B] * values[kQ3Y0C] != 0.0) { + values[kR3EP] = TMath::Cos(3 * (Psi3B - Psi3C)); + } } template diff --git a/PWGDQ/Tasks/dqFlow.cxx b/PWGDQ/Tasks/dqFlow.cxx index 3238978524a..613280bdf82 100644 --- a/PWGDQ/Tasks/dqFlow.cxx +++ b/PWGDQ/Tasks/dqFlow.cxx @@ -289,29 +289,41 @@ struct AnalysisQvector { // FillFC(corrconfigs.at(l_ind), collision.centRun2V0M(), l_Random, fillFlag, DQEventFlag); // }; - // Obtain the GFWCumulant where Q is calculated (index=region, with different eta gaps) - GFWCumulant gfwCumN = fGFW->GetCumulant(0); - GFWCumulant gfwCumP = fGFW->GetCumulant(1); - GFWCumulant gfwCumFull = fGFW->GetCumulant(2); - - // Get the multiplicity of the event in this region - int nentriesN = gfwCumN.GetN(); - int nentriesP = gfwCumP.GetN(); - int nentriesFull = gfwCumFull.GetN(); - - // Get the Q vector for selected harmonic, power (for minPt=0) - TComplex Q2vecN = gfwCumN.Vec(2, fConfigNPow); - TComplex Q2vecP = gfwCumP.Vec(2, fConfigNPow); - TComplex Q2vecFull = gfwCumFull.Vec(2, fConfigNPow); - TComplex Q3vecN = gfwCumN.Vec(3, fConfigNPow); - TComplex Q3vecP = gfwCumP.Vec(3, fConfigNPow); - TComplex Q3vecFull = gfwCumFull.Vec(3, fConfigNPow); + int nentriesN = 0.0; + int nentriesP = 0.0; + int nentriesFull = 0.0; + TComplex Q2vecN; + TComplex Q2vecP; + TComplex Q2vecFull; + TComplex Q3vecN; + TComplex Q3vecP; + TComplex Q3vecFull; + + if (fGFW && (tracks1.size() > 0)) { + // Obtain the GFWCumulant where Q is calculated (index=region, with different eta gaps) + GFWCumulant gfwCumN = fGFW->GetCumulant(0); + GFWCumulant gfwCumP = fGFW->GetCumulant(1); + GFWCumulant gfwCumFull = fGFW->GetCumulant(2); + + // and the multiplicity of the event in each region + nentriesN = gfwCumN.GetN(); + nentriesP = gfwCumP.GetN(); + nentriesFull = gfwCumFull.GetN(); + + // Get the Q vector for selected harmonic, power (for minPt=0) + Q2vecN = gfwCumN.Vec(2, fConfigNPow); + Q2vecP = gfwCumP.Vec(2, fConfigNPow); + Q2vecFull = gfwCumFull.Vec(2, fConfigNPow); + Q3vecN = gfwCumN.Vec(3, fConfigNPow); + Q3vecP = gfwCumP.Vec(3, fConfigNPow); + Q3vecFull = gfwCumFull.Vec(3, fConfigNPow); + } // Fill the VarManager::fgValues with the Q vector quantities VarManager::FillQVectorFromGFW(collision, Q2vecFull, Q2vecN, Q2vecP, Q3vecFull, Q3vecN, Q3vecP, nentriesFull, nentriesN, nentriesP); if (fConfigQA) { - if (nentriesN * nentriesP * nentriesFull != 0) { + if ((tracks1.size() > 0) && (nentriesFull * nentriesN * nentriesP != 0.0)) { fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); if (fEventCut->IsSelected(VarManager::fgValues)) { fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues);