From 56df23392b55ef40a369eb0220ecc3c02c88ead6 Mon Sep 17 00:00:00 2001 From: rcaron Date: Mon, 10 Oct 2022 16:51:11 +0200 Subject: [PATCH 1/6] fix error exception when accessing GFWCumulant vector --- PWGDQ/Tasks/dqFlow.cxx | 54 ++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/PWGDQ/Tasks/dqFlow.cxx b/PWGDQ/Tasks/dqFlow.cxx index 3238978524a..d789e79271a 100644 --- a/PWGDQ/Tasks/dqFlow.cxx +++ b/PWGDQ/Tasks/dqFlow.cxx @@ -289,34 +289,36 @@ struct AnalysisQvector { // FillFC(corrconfigs.at(l_ind), collision.centRun2V0M(), l_Random, fillFlag, DQEventFlag); // }; + int nentriesN = 0, nentriesP = 0, nentriesFull = 0; + TComplex Q2vecN, Q2vecP, Q2vecFull; + TComplex Q3vecN, Q3vecP, Q3vecFull; + // 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); - - // Fill the VarManager::fgValues with the Q vector quantities - VarManager::FillQVectorFromGFW(collision, Q2vecFull, Q2vecN, Q2vecP, Q3vecFull, Q3vecN, Q3vecP, nentriesFull, nentriesN, nentriesP); + if (fGFW && (tracks1.size() > 1)) { + // Get Q vectors for positive, negative and full eta gaps + // and the multiplicity of the event in this region + GFWCumulant gfwCumN = fGFW->GetCumulant(0); + nentriesN = gfwCumN.GetN(); + GFWCumulant gfwCumP = fGFW->GetCumulant(1); + nentriesP = gfwCumP.GetN(); + GFWCumulant gfwCumFull = fGFW->GetCumulant(2); + 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) { - fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); - if (fEventCut->IsSelected(VarManager::fgValues)) { - fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); - } - } + fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); + if (fEventCut->IsSelected(VarManager::fgValues)) { + fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); } // Fill the tree for the reduced event table with Q vector quantities From 81eeef4a8120051ff503be50d33ed8dfd117f65a Mon Sep 17 00:00:00 2001 From: rcaron Date: Wed, 12 Oct 2022 16:08:48 +0200 Subject: [PATCH 2/6] fix: no fill of QA histos if no tracks --- PWGDQ/Core/VarManager.h | 16 ++++++++++++---- PWGDQ/Tasks/dqFlow.cxx | 31 +++++++++++++++++-------------- 2 files changed, 29 insertions(+), 18 deletions(-) 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 d789e79271a..36b3b51c4c4 100644 --- a/PWGDQ/Tasks/dqFlow.cxx +++ b/PWGDQ/Tasks/dqFlow.cxx @@ -186,9 +186,9 @@ struct AnalysisQvector { int pows[] = {3, 0, 2, 2, 3, 3, 3}; int powsFull[] = {5, 0, 4, 4, 3, 3, 3}; // Define regions of positive and negative eta in order to create gaps - fGFW->AddRegion("refN", 7, pows, -fConfigCutEta, -fConfigEtaLimit, 1, 1); - fGFW->AddRegion("refP", 7, pows, fConfigEtaLimit, fConfigCutEta, 1, 1); - fGFW->AddRegion("full", 7, powsFull, -fConfigCutEta, fConfigCutEta, 1, 2); + fGFW->AddRegion("refN", 7, pows, -fConfigCutEta.value, -fConfigEtaLimit.value, 1, 1); + fGFW->AddRegion("refP", 7, pows, fConfigEtaLimit.value, fConfigCutEta.value, 1, 1); + fGFW->AddRegion("full", 7, powsFull, -fConfigCutEta.value, fConfigCutEta.value, 1, 2); //corrconfigs.push_back(fGFW->GetCorrelatorConfig("refP {2} refN {-2}", "ChGap22", kFALSE)); //corrconfigs.push_back(fGFW->GetCorrelatorConfig("refP {2 2} refN {-2 -2}", "ChGap24", kFALSE)); @@ -289,19 +289,18 @@ struct AnalysisQvector { // FillFC(corrconfigs.at(l_ind), collision.centRun2V0M(), l_Random, fillFlag, DQEventFlag); // }; - int nentriesN = 0, nentriesP = 0, nentriesFull = 0; + int nentriesN = 1.0, nentriesP = 1.0, nentriesFull = 1.0; TComplex Q2vecN, Q2vecP, Q2vecFull; TComplex Q3vecN, Q3vecP, Q3vecFull; - // Obtain the GFWCumulant where Q is calculated (index=region, with different eta gaps) - if (fGFW && (tracks1.size() > 1)) { - // Get Q vectors for positive, negative and full eta gaps + if (fGFW && (tracks1.size() > 0)) { + // Obtain the GFWCumulant where Q is calculated (index=region, with different eta gaps) // and the multiplicity of the event in this region GFWCumulant gfwCumN = fGFW->GetCumulant(0); - nentriesN = gfwCumN.GetN(); GFWCumulant gfwCumP = fGFW->GetCumulant(1); - nentriesP = gfwCumP.GetN(); GFWCumulant gfwCumFull = fGFW->GetCumulant(2); + nentriesN = gfwCumN.GetN(); + nentriesP = gfwCumP.GetN(); nentriesFull = gfwCumFull.GetN(); // Get the Q vector for selected harmonic, power (for minPt=0) @@ -311,14 +310,18 @@ struct AnalysisQvector { 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); - } + VarManager::FillQVectorFromGFW(collision, Q2vecFull, Q2vecN, Q2vecP, Q3vecFull, Q3vecN, Q3vecP, nentriesFull, nentriesN, nentriesP); - fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); - if (fEventCut->IsSelected(VarManager::fgValues)) { - fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); + if (fConfigQA) { + 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); + } + } } // Fill the tree for the reduced event table with Q vector quantities From c69f03e25319d76a68334d0008fd88d1160ee5b4 Mon Sep 17 00:00:00 2001 From: rcaron Date: Wed, 12 Oct 2022 16:27:40 +0200 Subject: [PATCH 3/6] format --- PWGDQ/Tasks/dqFlow.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PWGDQ/Tasks/dqFlow.cxx b/PWGDQ/Tasks/dqFlow.cxx index 36b3b51c4c4..a792e81deca 100644 --- a/PWGDQ/Tasks/dqFlow.cxx +++ b/PWGDQ/Tasks/dqFlow.cxx @@ -289,16 +289,18 @@ struct AnalysisQvector { // FillFC(corrconfigs.at(l_ind), collision.centRun2V0M(), l_Random, fillFlag, DQEventFlag); // }; - int nentriesN = 1.0, nentriesP = 1.0, nentriesFull = 1.0; + int nentriesN = 0.0; + int nentriesP = 0.0; + int nentriesFull = 0.0; TComplex Q2vecN, Q2vecP, Q2vecFull; TComplex Q3vecN, Q3vecP, Q3vecFull; if (fGFW && (tracks1.size() > 0)) { // Obtain the GFWCumulant where Q is calculated (index=region, with different eta gaps) - // and the multiplicity of the event in this region 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(); From fd4e6d5ac22d05336cbdfc10e36c170211f3441d Mon Sep 17 00:00:00 2001 From: rcaron Date: Wed, 12 Oct 2022 16:37:58 +0200 Subject: [PATCH 4/6] format again --- PWGDQ/Tasks/dqFlow.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PWGDQ/Tasks/dqFlow.cxx b/PWGDQ/Tasks/dqFlow.cxx index a792e81deca..fc0bf1c78d3 100644 --- a/PWGDQ/Tasks/dqFlow.cxx +++ b/PWGDQ/Tasks/dqFlow.cxx @@ -292,8 +292,12 @@ struct AnalysisQvector { int nentriesN = 0.0; int nentriesP = 0.0; int nentriesFull = 0.0; - TComplex Q2vecN, Q2vecP, Q2vecFull; - TComplex Q3vecN, Q3vecP, Q3vecFull; + 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) From 7dcb9d54b1e4f9a99258a2a4c0fcb6915cf8e946 Mon Sep 17 00:00:00 2001 From: rcaron Date: Wed, 12 Oct 2022 16:56:31 +0200 Subject: [PATCH 5/6] try format again --- PWGDQ/Tasks/dqFlow.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGDQ/Tasks/dqFlow.cxx b/PWGDQ/Tasks/dqFlow.cxx index fc0bf1c78d3..6f912decb07 100644 --- a/PWGDQ/Tasks/dqFlow.cxx +++ b/PWGDQ/Tasks/dqFlow.cxx @@ -186,9 +186,9 @@ struct AnalysisQvector { int pows[] = {3, 0, 2, 2, 3, 3, 3}; int powsFull[] = {5, 0, 4, 4, 3, 3, 3}; // Define regions of positive and negative eta in order to create gaps - fGFW->AddRegion("refN", 7, pows, -fConfigCutEta.value, -fConfigEtaLimit.value, 1, 1); - fGFW->AddRegion("refP", 7, pows, fConfigEtaLimit.value, fConfigCutEta.value, 1, 1); - fGFW->AddRegion("full", 7, powsFull, -fConfigCutEta.value, fConfigCutEta.value, 1, 2); + fGFW->AddRegion("refN", 7, pows, -fConfigCutEta, -fConfigEtaLimit, 1, 1); + fGFW->AddRegion("refP", 7, pows, fConfigEtaLimit, fConfigCutEta, 1, 1); + fGFW->AddRegion("full", 7, powsFull, -fConfigCutEta, fConfigCutEta, 1, 2); //corrconfigs.push_back(fGFW->GetCorrelatorConfig("refP {2} refN {-2}", "ChGap22", kFALSE)); //corrconfigs.push_back(fGFW->GetCorrelatorConfig("refP {2 2} refN {-2 -2}", "ChGap24", kFALSE)); From fd9ae5d71ab06868b3141fde210d3c1167963efd Mon Sep 17 00:00:00 2001 From: rcaron Date: Wed, 12 Oct 2022 17:10:32 +0200 Subject: [PATCH 6/6] remove empty spaces --- PWGDQ/Tasks/dqFlow.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGDQ/Tasks/dqFlow.cxx b/PWGDQ/Tasks/dqFlow.cxx index 6f912decb07..613280bdf82 100644 --- a/PWGDQ/Tasks/dqFlow.cxx +++ b/PWGDQ/Tasks/dqFlow.cxx @@ -304,6 +304,7 @@ struct AnalysisQvector { 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(); @@ -318,7 +319,7 @@ struct AnalysisQvector { Q3vecFull = gfwCumFull.Vec(3, fConfigNPow); } - // Fill the VarManager::fgValues with the Q vector quantities + // Fill the VarManager::fgValues with the Q vector quantities VarManager::FillQVectorFromGFW(collision, Q2vecFull, Q2vecN, Q2vecP, Q3vecFull, Q3vecN, Q3vecP, nentriesFull, nentriesN, nentriesP); if (fConfigQA) {