From 3ada65c397034a1883e4cd5e08bdb526c140ea83 Mon Sep 17 00:00:00 2001 From: JPorron Date: Fri, 5 Jul 2024 10:50:17 +0200 Subject: [PATCH 01/13] Comment checkpoint --- src/TRestTrack2DAnalysisProcess.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TRestTrack2DAnalysisProcess.cxx b/src/TRestTrack2DAnalysisProcess.cxx index 90855a7..b79f2a4 100644 --- a/src/TRestTrack2DAnalysisProcess.cxx +++ b/src/TRestTrack2DAnalysisProcess.cxx @@ -415,6 +415,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("Map_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance); // --- Max track observables --- // +/* SetObservableValue("MaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX[0].first]); SetObservableValue("MaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX[0].first]); SetObservableValue("MaxTrack_XZ_SigmaX", XZ_SigmaX[energiesX[0].first]); @@ -505,7 +506,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); - +*/ return fTrackEvent; } From 3145c3390c506a2bdf72421ec276f12f6c414a21 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 09:03:20 +0000 Subject: [PATCH 02/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/TRestTrack2DAnalysisProcess.cxx | 182 ++++++++++++++-------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/src/TRestTrack2DAnalysisProcess.cxx b/src/TRestTrack2DAnalysisProcess.cxx index b79f2a4..4f9dfff 100644 --- a/src/TRestTrack2DAnalysisProcess.cxx +++ b/src/TRestTrack2DAnalysisProcess.cxx @@ -415,98 +415,98 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("Map_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance); // --- Max track observables --- // -/* - SetObservableValue("MaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_SigmaX", XZ_SigmaX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_SigmaZ", XZ_SigmaZ[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_GaussSigmaX", XZ_GaussSigmaX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_GaussSigmaZ", XZ_GaussSigmaZ[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_LengthX", XZ_LengthX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_VolumeX", XZ_VolumeX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_MeanX", XZ_MeanX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_MeanZ", XZ_MeanZ[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_SkewZ", XZ_SkewZ[energiesX[0].first]); - - SetObservableValue("MaxTrack_YZ_NHitsY", YZ_NHitsY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_EnergyY", YZ_EnergyY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_SigmaY", YZ_SigmaY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_SigmaZ", YZ_SigmaZ[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_GaussSigmaY", YZ_GaussSigmaY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_GaussSigmaZ", YZ_GaussSigmaZ[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_LengthY", YZ_LengthY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_VolumeY", YZ_VolumeY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_MeanY", YZ_MeanY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_MeanZ", YZ_MeanZ[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_SkewZ", YZ_SkewZ[energiesY[0].first]); - - SetObservableValue("MaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[0]); - SetObservableValue("MaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[0]); - SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[0]); - SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[0]); - - SetObservableValue("MaxTrack_XZ_YZ_Energy", energiesX[0].second + energiesY[0].second); - SetObservableValue("MaxTrack_XZ_YZ_MaxTrackEnergyPercentage", - (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); - SetObservableValue("MaxTrack_XZ_YZ_EnergyBalanceXY", (energiesX[0].second - energiesY[0].second) / - (energiesX[0].second + energiesY[0].second)); - - // --- Second max track observables --- // - SetObservableValue("SecondMaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_SigmaX", XZ_SigmaX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_SigmaZ", XZ_SigmaZ[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_GaussSigmaX", XZ_GaussSigmaX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_GaussSigmaZ", XZ_GaussSigmaZ[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_LengthX", XZ_LengthX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_VolumeX", XZ_VolumeX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_MeanX", XZ_MeanX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_MeanZ", XZ_MeanZ[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_SkewZ", XZ_SkewZ[energiesX[1].first]); - - SetObservableValue("SecondMaxTrack_YZ_NHitsY", YZ_NHitsY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_EnergyY", YZ_EnergyY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_SigmaY", YZ_SigmaY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_SigmaZ", YZ_SigmaZ[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_GaussSigmaY", YZ_GaussSigmaY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_GaussSigmaZ", YZ_GaussSigmaZ[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_LengthY", YZ_LengthY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_VolumeY", YZ_VolumeY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_MeanY", YZ_MeanY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_MeanZ", YZ_MeanZ[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_SkewZ", YZ_SkewZ[energiesY[1].first]); - - SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[1]); - SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[1]); - SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[1]); - SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[1]); - - if (fTrackEvent->GetNumberOfTracks() > 1) { - SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX[1].second + energiesY[1].second); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", - (energiesX[1].second + energiesY[1].second) / fTrackEvent->GetEnergy()); - SetObservableValue( - "SecondMaxTrack_XZ_YZ_EnergyBalanceXY", - (energiesX[1].second - energiesY[1].second) / (energiesX[1].second + energiesY[1].second)); - } else { - SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0); - } + /* + SetObservableValue("MaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX[0].first]); + SetObservableValue("MaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX[0].first]); + SetObservableValue("MaxTrack_XZ_SigmaX", XZ_SigmaX[energiesX[0].first]); + SetObservableValue("MaxTrack_XZ_SigmaZ", XZ_SigmaZ[energiesX[0].first]); + SetObservableValue("MaxTrack_XZ_GaussSigmaX", XZ_GaussSigmaX[energiesX[0].first]); + SetObservableValue("MaxTrack_XZ_GaussSigmaZ", XZ_GaussSigmaZ[energiesX[0].first]); + SetObservableValue("MaxTrack_XZ_LengthX", XZ_LengthX[energiesX[0].first]); + SetObservableValue("MaxTrack_XZ_VolumeX", XZ_VolumeX[energiesX[0].first]); + SetObservableValue("MaxTrack_XZ_MeanX", XZ_MeanX[energiesX[0].first]); + SetObservableValue("MaxTrack_XZ_MeanZ", XZ_MeanZ[energiesX[0].first]); + SetObservableValue("MaxTrack_XZ_SkewZ", XZ_SkewZ[energiesX[0].first]); + + SetObservableValue("MaxTrack_YZ_NHitsY", YZ_NHitsY[energiesY[0].first]); + SetObservableValue("MaxTrack_YZ_EnergyY", YZ_EnergyY[energiesY[0].first]); + SetObservableValue("MaxTrack_YZ_SigmaY", YZ_SigmaY[energiesY[0].first]); + SetObservableValue("MaxTrack_YZ_SigmaZ", YZ_SigmaZ[energiesY[0].first]); + SetObservableValue("MaxTrack_YZ_GaussSigmaY", YZ_GaussSigmaY[energiesY[0].first]); + SetObservableValue("MaxTrack_YZ_GaussSigmaZ", YZ_GaussSigmaZ[energiesY[0].first]); + SetObservableValue("MaxTrack_YZ_LengthY", YZ_LengthY[energiesY[0].first]); + SetObservableValue("MaxTrack_YZ_VolumeY", YZ_VolumeY[energiesY[0].first]); + SetObservableValue("MaxTrack_YZ_MeanY", YZ_MeanY[energiesY[0].first]); + SetObservableValue("MaxTrack_YZ_MeanZ", YZ_MeanZ[energiesY[0].first]); + SetObservableValue("MaxTrack_YZ_SkewZ", YZ_SkewZ[energiesY[0].first]); + + SetObservableValue("MaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[0]); + SetObservableValue("MaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[0]); + SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[0]); + SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[0]); + + SetObservableValue("MaxTrack_XZ_YZ_Energy", energiesX[0].second + energiesY[0].second); + SetObservableValue("MaxTrack_XZ_YZ_MaxTrackEnergyPercentage", + (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); + SetObservableValue("MaxTrack_XZ_YZ_EnergyBalanceXY", (energiesX[0].second - energiesY[0].second) / + (energiesX[0].second + energiesY[0].second)); + + // --- Second max track observables --- // + SetObservableValue("SecondMaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX[1].first]); + SetObservableValue("SecondMaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX[1].first]); + SetObservableValue("SecondMaxTrack_XZ_SigmaX", XZ_SigmaX[energiesX[1].first]); + SetObservableValue("SecondMaxTrack_XZ_SigmaZ", XZ_SigmaZ[energiesX[1].first]); + SetObservableValue("SecondMaxTrack_XZ_GaussSigmaX", XZ_GaussSigmaX[energiesX[1].first]); + SetObservableValue("SecondMaxTrack_XZ_GaussSigmaZ", XZ_GaussSigmaZ[energiesX[1].first]); + SetObservableValue("SecondMaxTrack_XZ_LengthX", XZ_LengthX[energiesX[1].first]); + SetObservableValue("SecondMaxTrack_XZ_VolumeX", XZ_VolumeX[energiesX[1].first]); + SetObservableValue("SecondMaxTrack_XZ_MeanX", XZ_MeanX[energiesX[1].first]); + SetObservableValue("SecondMaxTrack_XZ_MeanZ", XZ_MeanZ[energiesX[1].first]); + SetObservableValue("SecondMaxTrack_XZ_SkewZ", XZ_SkewZ[energiesX[1].first]); + + SetObservableValue("SecondMaxTrack_YZ_NHitsY", YZ_NHitsY[energiesY[1].first]); + SetObservableValue("SecondMaxTrack_YZ_EnergyY", YZ_EnergyY[energiesY[1].first]); + SetObservableValue("SecondMaxTrack_YZ_SigmaY", YZ_SigmaY[energiesY[1].first]); + SetObservableValue("SecondMaxTrack_YZ_SigmaZ", YZ_SigmaZ[energiesY[1].first]); + SetObservableValue("SecondMaxTrack_YZ_GaussSigmaY", YZ_GaussSigmaY[energiesY[1].first]); + SetObservableValue("SecondMaxTrack_YZ_GaussSigmaZ", YZ_GaussSigmaZ[energiesY[1].first]); + SetObservableValue("SecondMaxTrack_YZ_LengthY", YZ_LengthY[energiesY[1].first]); + SetObservableValue("SecondMaxTrack_YZ_VolumeY", YZ_VolumeY[energiesY[1].first]); + SetObservableValue("SecondMaxTrack_YZ_MeanY", YZ_MeanY[energiesY[1].first]); + SetObservableValue("SecondMaxTrack_YZ_MeanZ", YZ_MeanZ[energiesY[1].first]); + SetObservableValue("SecondMaxTrack_YZ_SkewZ", YZ_SkewZ[energiesY[1].first]); + + SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[1]); + SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[1]); + SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[1]); + SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[1]); + + if (fTrackEvent->GetNumberOfTracks() > 1) { + SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX[1].second + energiesY[1].second); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", + (energiesX[1].second + energiesY[1].second) / fTrackEvent->GetEnergy()); + SetObservableValue( + "SecondMaxTrack_XZ_YZ_EnergyBalanceXY", + (energiesX[1].second - energiesY[1].second) / (energiesX[1].second + energiesY[1].second)); + } else { + SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0); + } - // --- Distance obsevables between first two tracks --- // - SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ); - SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ); - SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum", - TMath::Sqrt(XZ_FirstSecondTracksDistanceXZ * XZ_FirstSecondTracksDistanceXZ + - YZ_FirstSecondTracksDistanceYZ * YZ_FirstSecondTracksDistanceYZ)); - - // --- Observables merging max tracks XZ and YZ --- // - SetObservableValue("MaxTrack_XZ_YZ_SigmaZ", MaxTrack_XZ_YZ_SigmaZ); - SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); - SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); - SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); -*/ + // --- Distance obsevables between first two tracks --- // + SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ); + SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ); + SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum", + TMath::Sqrt(XZ_FirstSecondTracksDistanceXZ * XZ_FirstSecondTracksDistanceXZ + + YZ_FirstSecondTracksDistanceYZ * YZ_FirstSecondTracksDistanceYZ)); + + // --- Observables merging max tracks XZ and YZ --- // + SetObservableValue("MaxTrack_XZ_YZ_SigmaZ", MaxTrack_XZ_YZ_SigmaZ); + SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); + SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); + SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); + */ return fTrackEvent; } From 024bb5063478949913a8e36ac74645743baa5fc5 Mon Sep 17 00:00:00 2001 From: JPorron Date: Fri, 5 Jul 2024 11:57:57 +0200 Subject: [PATCH 03/13] Solve First Issue --- src/TRestTrack2DAnalysisProcess.cxx | 218 +++++++++++++++++----------- 1 file changed, 131 insertions(+), 87 deletions(-) diff --git a/src/TRestTrack2DAnalysisProcess.cxx b/src/TRestTrack2DAnalysisProcess.cxx index 4f9dfff..e1ed568 100644 --- a/src/TRestTrack2DAnalysisProcess.cxx +++ b/src/TRestTrack2DAnalysisProcess.cxx @@ -414,99 +414,143 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("Map_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance); SetObservableValue("Map_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance); + // --- Max track observables --- // - /* - SetObservableValue("MaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_SigmaX", XZ_SigmaX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_SigmaZ", XZ_SigmaZ[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_GaussSigmaX", XZ_GaussSigmaX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_GaussSigmaZ", XZ_GaussSigmaZ[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_LengthX", XZ_LengthX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_VolumeX", XZ_VolumeX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_MeanX", XZ_MeanX[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_MeanZ", XZ_MeanZ[energiesX[0].first]); - SetObservableValue("MaxTrack_XZ_SkewZ", XZ_SkewZ[energiesX[0].first]); - - SetObservableValue("MaxTrack_YZ_NHitsY", YZ_NHitsY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_EnergyY", YZ_EnergyY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_SigmaY", YZ_SigmaY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_SigmaZ", YZ_SigmaZ[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_GaussSigmaY", YZ_GaussSigmaY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_GaussSigmaZ", YZ_GaussSigmaZ[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_LengthY", YZ_LengthY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_VolumeY", YZ_VolumeY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_MeanY", YZ_MeanY[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_MeanZ", YZ_MeanZ[energiesY[0].first]); - SetObservableValue("MaxTrack_YZ_SkewZ", YZ_SkewZ[energiesY[0].first]); - - SetObservableValue("MaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[0]); - SetObservableValue("MaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[0]); - SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[0]); - SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[0]); + int energiesX0FirstKey = -1; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... + int energiesX0SecondKey = -1; + int energiesY0FirstKey = -1; + int energiesY0SecondKey = -1; + + // Copy the MaxTrack keys immediately after checking the vector + if (!energiesX.empty()) { + int energiesX0FirstKey = energiesX[0].first; + + SetObservableValue("MaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX0FirstKey]); + SetObservableValue("MaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX0FirstKey]); + SetObservableValue("MaxTrack_XZ_SigmaX", XZ_SigmaX[energiesX0FirstKey]); + SetObservableValue("MaxTrack_XZ_SigmaZ", XZ_SigmaZ[energiesX0FirstKey]); + SetObservableValue("MaxTrack_XZ_GaussSigmaX", XZ_GaussSigmaX[energiesX0FirstKey]); + SetObservableValue("MaxTrack_XZ_GaussSigmaZ", XZ_GaussSigmaZ[energiesX0FirstKey]); + SetObservableValue("MaxTrack_XZ_LengthX", XZ_LengthX[energiesX0FirstKey]); + SetObservableValue("MaxTrack_XZ_VolumeX", XZ_VolumeX[energiesX0FirstKey]); + SetObservableValue("MaxTrack_XZ_MeanX", XZ_MeanX[energiesX0FirstKey]); + SetObservableValue("MaxTrack_XZ_MeanZ", XZ_MeanZ[energiesX0FirstKey]); + SetObservableValue("MaxTrack_XZ_SkewZ", XZ_SkewZ[energiesX0FirstKey]); + } else { + std::cerr << "Error: energiesX is empty. Some observables will not be set." << std::endl; + } + + if (!energiesY.empty()) { + int energiesY0FirstKey = energiesY[0].first; + + SetObservableValue("MaxTrack_YZ_NHitsY", YZ_NHitsY[energiesY0FirstKey]); + SetObservableValue("MaxTrack_YZ_EnergyY", YZ_EnergyY[energiesY0FirstKey]); + SetObservableValue("MaxTrack_YZ_SigmaY", YZ_SigmaY[energiesY0FirstKey]); + SetObservableValue("MaxTrack_YZ_SigmaZ", YZ_SigmaZ[energiesY0FirstKey]); + SetObservableValue("MaxTrack_YZ_GaussSigmaY", YZ_GaussSigmaY[energiesY0FirstKey]); + SetObservableValue("MaxTrack_YZ_GaussSigmaZ", YZ_GaussSigmaZ[energiesY0FirstKey]); + SetObservableValue("MaxTrack_YZ_LengthY", YZ_LengthY[energiesY0FirstKey]); + SetObservableValue("MaxTrack_YZ_VolumeY", YZ_VolumeY[energiesY0FirstKey]); + SetObservableValue("MaxTrack_YZ_MeanY", YZ_MeanY[energiesY0FirstKey]); + SetObservableValue("MaxTrack_YZ_MeanZ", YZ_MeanZ[energiesY0FirstKey]); + SetObservableValue("MaxTrack_YZ_SkewZ", YZ_SkewZ[energiesY0FirstKey]); + } else { + std::cerr << "Error: energiesY is empty. Some observables will not be set." << std::endl; + } + + if (!energiesX.empty() & !energiesY.empty()) { + int energiesX0SecondKey = energiesX[0].second; + int energiesY0SecondKey = energiesY[0].second; SetObservableValue("MaxTrack_XZ_YZ_Energy", energiesX[0].second + energiesY[0].second); SetObservableValue("MaxTrack_XZ_YZ_MaxTrackEnergyPercentage", - (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); + (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); SetObservableValue("MaxTrack_XZ_YZ_EnergyBalanceXY", (energiesX[0].second - energiesY[0].second) / - (energiesX[0].second + energiesY[0].second)); - - // --- Second max track observables --- // - SetObservableValue("SecondMaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_SigmaX", XZ_SigmaX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_SigmaZ", XZ_SigmaZ[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_GaussSigmaX", XZ_GaussSigmaX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_GaussSigmaZ", XZ_GaussSigmaZ[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_LengthX", XZ_LengthX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_VolumeX", XZ_VolumeX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_MeanX", XZ_MeanX[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_MeanZ", XZ_MeanZ[energiesX[1].first]); - SetObservableValue("SecondMaxTrack_XZ_SkewZ", XZ_SkewZ[energiesX[1].first]); - - SetObservableValue("SecondMaxTrack_YZ_NHitsY", YZ_NHitsY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_EnergyY", YZ_EnergyY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_SigmaY", YZ_SigmaY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_SigmaZ", YZ_SigmaZ[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_GaussSigmaY", YZ_GaussSigmaY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_GaussSigmaZ", YZ_GaussSigmaZ[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_LengthY", YZ_LengthY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_VolumeY", YZ_VolumeY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_MeanY", YZ_MeanY[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_MeanZ", YZ_MeanZ[energiesY[1].first]); - SetObservableValue("SecondMaxTrack_YZ_SkewZ", YZ_SkewZ[energiesY[1].first]); - - SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[1]); - SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[1]); - SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[1]); - SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[1]); - - if (fTrackEvent->GetNumberOfTracks() > 1) { - SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX[1].second + energiesY[1].second); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", - (energiesX[1].second + energiesY[1].second) / fTrackEvent->GetEnergy()); - SetObservableValue( - "SecondMaxTrack_XZ_YZ_EnergyBalanceXY", - (energiesX[1].second - energiesY[1].second) / (energiesX[1].second + energiesY[1].second)); - } else { - SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0); - } + (energiesX[0].second + energiesY[0].second)); + + } else { + std::cerr << "Error: energiesX or energiesY is empty. Some observables will not be set." << std::endl; + } + + SetObservableValue("MaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[0]); + SetObservableValue("MaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[0]); + SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[0]); + SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[0]); + + // --- Second max track observables --- // + int energiesX1FirstKey = -1; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... + int energiesX1SecondKey = -1; + int energiesY1FirstKey = -1; + int energiesY1SecondKey = -1; + + // Copy the SecondTrack keys immediately after checking the vector + if (!energiesX.empty()) { + int energiesX1FirstKey = energiesX[1].first; + + SetObservableValue("SecondMaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX1FirstKey]); + SetObservableValue("SecondMaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX1FirstKey]); + SetObservableValue("SecondMaxTrack_XZ_SigmaX", XZ_SigmaX[energiesX1FirstKey]); + SetObservableValue("SecondMaxTrack_XZ_SigmaZ", XZ_SigmaZ[energiesX1FirstKey]); + SetObservableValue("SecondMaxTrack_XZ_GaussSigmaX", XZ_GaussSigmaX[energiesX1FirstKey]); + SetObservableValue("SecondMaxTrack_XZ_GaussSigmaZ", XZ_GaussSigmaZ[energiesX1FirstKey]); + SetObservableValue("SecondMaxTrack_XZ_LengthX", XZ_LengthX[energiesX1FirstKey]); + SetObservableValue("SecondMaxTrack_XZ_VolumeX", XZ_VolumeX[energiesX1FirstKey]); + SetObservableValue("SecondMaxTrack_XZ_MeanX", XZ_MeanX[energiesX1FirstKey]); + SetObservableValue("SecondMaxTrack_XZ_MeanZ", XZ_MeanZ[energiesX1FirstKey]); + SetObservableValue("SecondMaxTrack_XZ_SkewZ", XZ_SkewZ[energiesX1FirstKey]); + } else { + std::cerr << "Error: energiesX is empty. Some observables will not be set." << std::endl; + } + + if (!energiesY.empty()) { + int energiesY1FirstKey = energiesY[1].first; + + SetObservableValue("SecondMaxTrack_YZ_NHitsY", YZ_NHitsY[energiesY1FirstKey]); + SetObservableValue("SecondMaxTrack_YZ_EnergyY", YZ_EnergyY[energiesY1FirstKey]); + SetObservableValue("SecondMaxTrack_YZ_SigmaY", YZ_SigmaY[energiesY1FirstKey]); + SetObservableValue("SecondMaxTrack_YZ_SigmaZ", YZ_SigmaZ[energiesY1FirstKey]); + SetObservableValue("SecondMaxTrack_YZ_GaussSigmaY", YZ_GaussSigmaY[energiesY1FirstKey]); + SetObservableValue("SecondMaxTrack_YZ_GaussSigmaZ", YZ_GaussSigmaZ[energiesY1FirstKey]); + SetObservableValue("SecondMaxTrack_YZ_LengthY", YZ_LengthY[energiesY1FirstKey]); + SetObservableValue("SecondMaxTrack_YZ_VolumeY", YZ_VolumeY[energiesY1FirstKey]); + SetObservableValue("SecondMaxTrack_YZ_MeanY", YZ_MeanY[energiesY1FirstKey]); + SetObservableValue("SecondMaxTrack_YZ_MeanZ", YZ_MeanZ[energiesY1FirstKey]); + SetObservableValue("SecondMaxTrack_YZ_SkewZ", YZ_SkewZ[energiesY1FirstKey]); + } else { + std::cerr << "Error: energiesY is empty. Some observables will not be set." << std::endl; + } +/* + SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[1]); + SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[1]); + SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[1]); + SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[1]); + + if (fTrackEvent->GetNumberOfTracks() > 1) { + SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX[1].second + energiesY[1].second); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", + (energiesX[1].second + energiesY[1].second) / fTrackEvent->GetEnergy()); + SetObservableValue( + "SecondMaxTrack_XZ_YZ_EnergyBalanceXY", + (energiesX[1].second - energiesY[1].second) / (energiesX[1].second + energiesY[1].second)); + } else { + SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0); + } - // --- Distance obsevables between first two tracks --- // - SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ); - SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ); - SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum", - TMath::Sqrt(XZ_FirstSecondTracksDistanceXZ * XZ_FirstSecondTracksDistanceXZ + - YZ_FirstSecondTracksDistanceYZ * YZ_FirstSecondTracksDistanceYZ)); - - // --- Observables merging max tracks XZ and YZ --- // - SetObservableValue("MaxTrack_XZ_YZ_SigmaZ", MaxTrack_XZ_YZ_SigmaZ); - SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); - SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); - SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); - */ + // --- Distance obsevables between first two tracks --- // + SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ); + SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ); + SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum", + TMath::Sqrt(XZ_FirstSecondTracksDistanceXZ * XZ_FirstSecondTracksDistanceXZ + + YZ_FirstSecondTracksDistanceYZ * YZ_FirstSecondTracksDistanceYZ)); + + // --- Observables merging max tracks XZ and YZ --- // + SetObservableValue("MaxTrack_XZ_YZ_SigmaZ", MaxTrack_XZ_YZ_SigmaZ); + SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); + SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); + SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); +*/ return fTrackEvent; } From a0128bbf81578a11cd5b52fdb33913350a3f5ad1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 09:58:08 +0000 Subject: [PATCH 04/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/TRestTrack2DAnalysisProcess.cxx | 73 +++++++++++++++-------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/src/TRestTrack2DAnalysisProcess.cxx b/src/TRestTrack2DAnalysisProcess.cxx index e1ed568..301f52a 100644 --- a/src/TRestTrack2DAnalysisProcess.cxx +++ b/src/TRestTrack2DAnalysisProcess.cxx @@ -414,9 +414,9 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("Map_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance); SetObservableValue("Map_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance); - // --- Max track observables --- // - int energiesX0FirstKey = -1; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... + int energiesX0FirstKey = + -1; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... int energiesX0SecondKey = -1; int energiesY0FirstKey = -1; int energiesY0SecondKey = -1; @@ -464,9 +464,9 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XZ_YZ_Energy", energiesX[0].second + energiesY[0].second); SetObservableValue("MaxTrack_XZ_YZ_MaxTrackEnergyPercentage", - (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); + (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); SetObservableValue("MaxTrack_XZ_YZ_EnergyBalanceXY", (energiesX[0].second - energiesY[0].second) / - (energiesX[0].second + energiesY[0].second)); + (energiesX[0].second + energiesY[0].second)); } else { std::cerr << "Error: energiesX or energiesY is empty. Some observables will not be set." << std::endl; @@ -478,7 +478,8 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[0]); // --- Second max track observables --- // - int energiesX1FirstKey = -1; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... + int energiesX1FirstKey = + -1; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... int energiesX1SecondKey = -1; int energiesY1FirstKey = -1; int energiesY1SecondKey = -1; @@ -519,38 +520,38 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { } else { std::cerr << "Error: energiesY is empty. Some observables will not be set." << std::endl; } -/* - SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[1]); - SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[1]); - SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[1]); - SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[1]); - - if (fTrackEvent->GetNumberOfTracks() > 1) { - SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX[1].second + energiesY[1].second); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", - (energiesX[1].second + energiesY[1].second) / fTrackEvent->GetEnergy()); - SetObservableValue( - "SecondMaxTrack_XZ_YZ_EnergyBalanceXY", - (energiesX[1].second - energiesY[1].second) / (energiesX[1].second + energiesY[1].second)); - } else { - SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0); - } + /* + SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[1]); + SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[1]); + SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[1]); + SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[1]); + + if (fTrackEvent->GetNumberOfTracks() > 1) { + SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX[1].second + energiesY[1].second); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", + (energiesX[1].second + energiesY[1].second) / fTrackEvent->GetEnergy()); + SetObservableValue( + "SecondMaxTrack_XZ_YZ_EnergyBalanceXY", + (energiesX[1].second - energiesY[1].second) / (energiesX[1].second + energiesY[1].second)); + } else { + SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0); + } - // --- Distance obsevables between first two tracks --- // - SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ); - SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ); - SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum", - TMath::Sqrt(XZ_FirstSecondTracksDistanceXZ * XZ_FirstSecondTracksDistanceXZ + - YZ_FirstSecondTracksDistanceYZ * YZ_FirstSecondTracksDistanceYZ)); - - // --- Observables merging max tracks XZ and YZ --- // - SetObservableValue("MaxTrack_XZ_YZ_SigmaZ", MaxTrack_XZ_YZ_SigmaZ); - SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); - SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); - SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); -*/ + // --- Distance obsevables between first two tracks --- // + SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ); + SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ); + SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum", + TMath::Sqrt(XZ_FirstSecondTracksDistanceXZ * XZ_FirstSecondTracksDistanceXZ + + YZ_FirstSecondTracksDistanceYZ * YZ_FirstSecondTracksDistanceYZ)); + + // --- Observables merging max tracks XZ and YZ --- // + SetObservableValue("MaxTrack_XZ_YZ_SigmaZ", MaxTrack_XZ_YZ_SigmaZ); + SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); + SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); + SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); + */ return fTrackEvent; } From 7c3edde2acf3eb2902aa7d7191746a0a91c9c291 Mon Sep 17 00:00:00 2001 From: JPorron Date: Fri, 5 Jul 2024 12:00:54 +0200 Subject: [PATCH 05/13] Missed some observables --- src/TRestTrack2DAnalysisProcess.cxx | 73 ++++++++++++++--------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/src/TRestTrack2DAnalysisProcess.cxx b/src/TRestTrack2DAnalysisProcess.cxx index 301f52a..35a4255 100644 --- a/src/TRestTrack2DAnalysisProcess.cxx +++ b/src/TRestTrack2DAnalysisProcess.cxx @@ -414,9 +414,9 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("Map_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance); SetObservableValue("Map_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance); + // --- Max track observables --- // - int energiesX0FirstKey = - -1; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... + int energiesX0FirstKey = -1; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... int energiesX0SecondKey = -1; int energiesY0FirstKey = -1; int energiesY0SecondKey = -1; @@ -464,9 +464,9 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XZ_YZ_Energy", energiesX[0].second + energiesY[0].second); SetObservableValue("MaxTrack_XZ_YZ_MaxTrackEnergyPercentage", - (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); + (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); SetObservableValue("MaxTrack_XZ_YZ_EnergyBalanceXY", (energiesX[0].second - energiesY[0].second) / - (energiesX[0].second + energiesY[0].second)); + (energiesX[0].second + energiesY[0].second)); } else { std::cerr << "Error: energiesX or energiesY is empty. Some observables will not be set." << std::endl; @@ -478,8 +478,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[0]); // --- Second max track observables --- // - int energiesX1FirstKey = - -1; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... + int energiesX1FirstKey = -1; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... int energiesX1SecondKey = -1; int energiesY1FirstKey = -1; int energiesY1SecondKey = -1; @@ -520,38 +519,38 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { } else { std::cerr << "Error: energiesY is empty. Some observables will not be set." << std::endl; } - /* - SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[1]); - SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[1]); - SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[1]); - SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[1]); - - if (fTrackEvent->GetNumberOfTracks() > 1) { - SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX[1].second + energiesY[1].second); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", - (energiesX[1].second + energiesY[1].second) / fTrackEvent->GetEnergy()); - SetObservableValue( - "SecondMaxTrack_XZ_YZ_EnergyBalanceXY", - (energiesX[1].second - energiesY[1].second) / (energiesX[1].second + energiesY[1].second)); - } else { - SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0); - } - // --- Distance obsevables between first two tracks --- // - SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ); - SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ); - SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum", - TMath::Sqrt(XZ_FirstSecondTracksDistanceXZ * XZ_FirstSecondTracksDistanceXZ + - YZ_FirstSecondTracksDistanceYZ * YZ_FirstSecondTracksDistanceYZ)); - - // --- Observables merging max tracks XZ and YZ --- // - SetObservableValue("MaxTrack_XZ_YZ_SigmaZ", MaxTrack_XZ_YZ_SigmaZ); - SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); - SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); - SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); - */ + SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[1]); + SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[1]); + SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[1]); + SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[1]); +/* + if (fTrackEvent->GetNumberOfTracks() > 1) { + SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX[1].second + energiesY[1].second); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", + (energiesX[1].second + energiesY[1].second) / fTrackEvent->GetEnergy()); + SetObservableValue( + "SecondMaxTrack_XZ_YZ_EnergyBalanceXY", + (energiesX[1].second - energiesY[1].second) / (energiesX[1].second + energiesY[1].second)); + } else { + SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0); + } + + // --- Distance obsevables between first two tracks --- // + SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ); + SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ); + SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum", + TMath::Sqrt(XZ_FirstSecondTracksDistanceXZ * XZ_FirstSecondTracksDistanceXZ + + YZ_FirstSecondTracksDistanceYZ * YZ_FirstSecondTracksDistanceYZ)); + + // --- Observables merging max tracks XZ and YZ --- // + SetObservableValue("MaxTrack_XZ_YZ_SigmaZ", MaxTrack_XZ_YZ_SigmaZ); + SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); + SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); + SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); +*/ return fTrackEvent; } From 2ca5e7dd23e264bd19e1148b9b114307d077ea6b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:02:00 +0000 Subject: [PATCH 06/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/TRestTrack2DAnalysisProcess.cxx | 63 +++++++++++++++-------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/src/TRestTrack2DAnalysisProcess.cxx b/src/TRestTrack2DAnalysisProcess.cxx index 35a4255..f7c1d4b 100644 --- a/src/TRestTrack2DAnalysisProcess.cxx +++ b/src/TRestTrack2DAnalysisProcess.cxx @@ -414,9 +414,9 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("Map_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance); SetObservableValue("Map_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance); - // --- Max track observables --- // - int energiesX0FirstKey = -1; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... + int energiesX0FirstKey = + -1; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... int energiesX0SecondKey = -1; int energiesY0FirstKey = -1; int energiesY0SecondKey = -1; @@ -464,9 +464,9 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XZ_YZ_Energy", energiesX[0].second + energiesY[0].second); SetObservableValue("MaxTrack_XZ_YZ_MaxTrackEnergyPercentage", - (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); + (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); SetObservableValue("MaxTrack_XZ_YZ_EnergyBalanceXY", (energiesX[0].second - energiesY[0].second) / - (energiesX[0].second + energiesY[0].second)); + (energiesX[0].second + energiesY[0].second)); } else { std::cerr << "Error: energiesX or energiesY is empty. Some observables will not be set." << std::endl; @@ -478,7 +478,8 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[0]); // --- Second max track observables --- // - int energiesX1FirstKey = -1; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... + int energiesX1FirstKey = + -1; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... int energiesX1SecondKey = -1; int energiesY1FirstKey = -1; int energiesY1SecondKey = -1; @@ -524,33 +525,33 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[1]); SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[1]); SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[1]); -/* - if (fTrackEvent->GetNumberOfTracks() > 1) { - SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX[1].second + energiesY[1].second); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", - (energiesX[1].second + energiesY[1].second) / fTrackEvent->GetEnergy()); - SetObservableValue( - "SecondMaxTrack_XZ_YZ_EnergyBalanceXY", - (energiesX[1].second - energiesY[1].second) / (energiesX[1].second + energiesY[1].second)); - } else { - SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0); - } + /* + if (fTrackEvent->GetNumberOfTracks() > 1) { + SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX[1].second + energiesY[1].second); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", + (energiesX[1].second + energiesY[1].second) / fTrackEvent->GetEnergy()); + SetObservableValue( + "SecondMaxTrack_XZ_YZ_EnergyBalanceXY", + (energiesX[1].second - energiesY[1].second) / (energiesX[1].second + energiesY[1].second)); + } else { + SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0); + } - // --- Distance obsevables between first two tracks --- // - SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ); - SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ); - SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum", - TMath::Sqrt(XZ_FirstSecondTracksDistanceXZ * XZ_FirstSecondTracksDistanceXZ + - YZ_FirstSecondTracksDistanceYZ * YZ_FirstSecondTracksDistanceYZ)); - - // --- Observables merging max tracks XZ and YZ --- // - SetObservableValue("MaxTrack_XZ_YZ_SigmaZ", MaxTrack_XZ_YZ_SigmaZ); - SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); - SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); - SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); -*/ + // --- Distance obsevables between first two tracks --- // + SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ); + SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ); + SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum", + TMath::Sqrt(XZ_FirstSecondTracksDistanceXZ * XZ_FirstSecondTracksDistanceXZ + + YZ_FirstSecondTracksDistanceYZ * YZ_FirstSecondTracksDistanceYZ)); + + // --- Observables merging max tracks XZ and YZ --- // + SetObservableValue("MaxTrack_XZ_YZ_SigmaZ", MaxTrack_XZ_YZ_SigmaZ); + SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); + SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); + SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); + */ return fTrackEvent; } From d5c7e0b9c7f49bc49658405ec80d50c5e7f5d380 Mon Sep 17 00:00:00 2001 From: JPorron Date: Mon, 8 Jul 2024 11:13:24 +0200 Subject: [PATCH 07/13] Type mismatch correction --- src/TRestTrack2DAnalysisProcess.cxx | 75 +++++++++++++++-------------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/src/TRestTrack2DAnalysisProcess.cxx b/src/TRestTrack2DAnalysisProcess.cxx index f7c1d4b..44a60bb 100644 --- a/src/TRestTrack2DAnalysisProcess.cxx +++ b/src/TRestTrack2DAnalysisProcess.cxx @@ -414,12 +414,12 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("Map_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance); SetObservableValue("Map_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance); + // --- Max track observables --- // - int energiesX0FirstKey = - -1; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... - int energiesX0SecondKey = -1; + int energiesX0FirstKey = -1; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... + Double_t energiesX0SecondKey = -1.0; int energiesY0FirstKey = -1; - int energiesY0SecondKey = -1; + Double_t energiesY0SecondKey = -1.0; // Copy the MaxTrack keys immediately after checking the vector if (!energiesX.empty()) { @@ -459,14 +459,14 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { } if (!energiesX.empty() & !energiesY.empty()) { - int energiesX0SecondKey = energiesX[0].second; - int energiesY0SecondKey = energiesY[0].second; + Double_t energiesX0SecondKey = energiesX[0].second; + Double_t energiesY0SecondKey = energiesY[0].second; SetObservableValue("MaxTrack_XZ_YZ_Energy", energiesX[0].second + energiesY[0].second); SetObservableValue("MaxTrack_XZ_YZ_MaxTrackEnergyPercentage", - (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); + (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); SetObservableValue("MaxTrack_XZ_YZ_EnergyBalanceXY", (energiesX[0].second - energiesY[0].second) / - (energiesX[0].second + energiesY[0].second)); + (energiesX[0].second + energiesY[0].second)); } else { std::cerr << "Error: energiesX or energiesY is empty. Some observables will not be set." << std::endl; @@ -478,11 +478,10 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[0]); // --- Second max track observables --- // - int energiesX1FirstKey = - -1; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... - int energiesX1SecondKey = -1; + int energiesX1FirstKey = -1; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... + Double_t energiesX1SecondKey = -1.0; int energiesY1FirstKey = -1; - int energiesY1SecondKey = -1; + Double_t energiesY1SecondKey = -1.0; // Copy the SecondTrack keys immediately after checking the vector if (!energiesX.empty()) { @@ -525,33 +524,39 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaZBalance", XZ_YZ_SigmaZBalance[1]); SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[1]); SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[1]); - /* - if (fTrackEvent->GetNumberOfTracks() > 1) { - SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX[1].second + energiesY[1].second); + + if (!energiesX.empty() & !energiesY.empty()) { + Double_t energiesX1SecondKey = energiesX[1].second; + Double_t energiesY1SecondKey = energiesY[1].second; + + if (fTrackEvent->GetNumberOfTracks() > 2) { + SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX1SecondKey + energiesY1SecondKey); SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", - (energiesX[1].second + energiesY[1].second) / fTrackEvent->GetEnergy()); - SetObservableValue( - "SecondMaxTrack_XZ_YZ_EnergyBalanceXY", - (energiesX[1].second - energiesY[1].second) / (energiesX[1].second + energiesY[1].second)); + (energiesX1SecondKey + energiesY1SecondKey) / fTrackEvent->GetEnergy()); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", + (energiesX1SecondKey - energiesY1SecondKey) / (energiesX1SecondKey + energiesY1SecondKey)); } else { - SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0); + SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0.0); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0.0); + SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0.0); } + } else { + std::cerr << "Error: energiesX or energiesY is empty. Some observables will not be set." << std::endl; + } + + // --- Distance obsevables between first two tracks --- // + SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ); + SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ); + SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum", + TMath::Sqrt(XZ_FirstSecondTracksDistanceXZ * XZ_FirstSecondTracksDistanceXZ + + YZ_FirstSecondTracksDistanceYZ * YZ_FirstSecondTracksDistanceYZ)); + + // --- Observables merging max tracks XZ and YZ --- // + SetObservableValue("MaxTrack_XZ_YZ_SigmaZ", MaxTrack_XZ_YZ_SigmaZ); + SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); + SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); + SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); - // --- Distance obsevables between first two tracks --- // - SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ); - SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ); - SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum", - TMath::Sqrt(XZ_FirstSecondTracksDistanceXZ * XZ_FirstSecondTracksDistanceXZ + - YZ_FirstSecondTracksDistanceYZ * YZ_FirstSecondTracksDistanceYZ)); - - // --- Observables merging max tracks XZ and YZ --- // - SetObservableValue("MaxTrack_XZ_YZ_SigmaZ", MaxTrack_XZ_YZ_SigmaZ); - SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZ", MaxTrack_XZ_YZ_GaussSigmaZ); - SetObservableValue("MaxTrack_XZ_YZ_SkewXY", MaxTrack_XZ_YZ_SkewXY); - SetObservableValue("MaxTrack_XZ_YZ_SkewZ", MaxTrack_XZ_YZ_SkewZ); - */ return fTrackEvent; } From 18ba57a1e5964370052532127e2322d293cf37ff Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 09:14:59 +0000 Subject: [PATCH 08/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/TRestTrack2DAnalysisProcess.cxx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/TRestTrack2DAnalysisProcess.cxx b/src/TRestTrack2DAnalysisProcess.cxx index 44a60bb..4ce183f 100644 --- a/src/TRestTrack2DAnalysisProcess.cxx +++ b/src/TRestTrack2DAnalysisProcess.cxx @@ -414,9 +414,9 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("Map_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance); SetObservableValue("Map_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance); - // --- Max track observables --- // - int energiesX0FirstKey = -1; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... + int energiesX0FirstKey = + -1; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... Double_t energiesX0SecondKey = -1.0; int energiesY0FirstKey = -1; Double_t energiesY0SecondKey = -1.0; @@ -464,9 +464,9 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XZ_YZ_Energy", energiesX[0].second + energiesY[0].second); SetObservableValue("MaxTrack_XZ_YZ_MaxTrackEnergyPercentage", - (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); + (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); SetObservableValue("MaxTrack_XZ_YZ_EnergyBalanceXY", (energiesX[0].second - energiesY[0].second) / - (energiesX[0].second + energiesY[0].second)); + (energiesX[0].second + energiesY[0].second)); } else { std::cerr << "Error: energiesX or energiesY is empty. Some observables will not be set." << std::endl; @@ -478,7 +478,8 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[0]); // --- Second max track observables --- // - int energiesX1FirstKey = -1; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... + int energiesX1FirstKey = + -1; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... Double_t energiesX1SecondKey = -1.0; int energiesY1FirstKey = -1; Double_t energiesY1SecondKey = -1.0; @@ -532,9 +533,10 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { if (fTrackEvent->GetNumberOfTracks() > 2) { SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", energiesX1SecondKey + energiesY1SecondKey); SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", - (energiesX1SecondKey + energiesY1SecondKey) / fTrackEvent->GetEnergy()); - SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", - (energiesX1SecondKey - energiesY1SecondKey) / (energiesX1SecondKey + energiesY1SecondKey)); + (energiesX1SecondKey + energiesY1SecondKey) / fTrackEvent->GetEnergy()); + SetObservableValue( + "SecondMaxTrack_XZ_YZ_EnergyBalanceXY", + (energiesX1SecondKey - energiesY1SecondKey) / (energiesX1SecondKey + energiesY1SecondKey)); } else { SetObservableValue("SecondMaxTrack_XZ_YZ_Energy", 0.0); SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyPercentage", 0.0); From c056655120067188fa9ef591eaeead0c29399704 Mon Sep 17 00:00:00 2001 From: JPorron Date: Mon, 8 Jul 2024 11:59:36 +0200 Subject: [PATCH 09/13] Same changes as 2D for 3D --- src/TRestTrack3DAnalysisProcess.cxx | 101 +++++++++++++++++----------- 1 file changed, 60 insertions(+), 41 deletions(-) diff --git a/src/TRestTrack3DAnalysisProcess.cxx b/src/TRestTrack3DAnalysisProcess.cxx index 6b2153d..d46ca54 100644 --- a/src/TRestTrack3DAnalysisProcess.cxx +++ b/src/TRestTrack3DAnalysisProcess.cxx @@ -241,48 +241,67 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("Map_XYZ_SkewXY", XYZ_SkewXY); SetObservableValue("Map_XYZ_SkewZ", XYZ_SkewZ); - // --- Max track observables --- // - SetObservableValue("MaxTrack_XYZ_NHits", XYZ_NHits[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_Energy", XYZ_Energy[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_SigmaX", XYZ_SigmaX[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_SigmaY", XYZ_SigmaY[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_SigmaZ", XYZ_SigmaZ[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_GaussSigmaX", XYZ_GaussSigmaX[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_GaussSigmaY", XYZ_GaussSigmaY[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_GaussSigmaZ", XYZ_GaussSigmaZ[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_Length", XYZ_Length[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_Volume", XYZ_Volume[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_MeanX", XYZ_MeanX[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_MeanY", XYZ_MeanY[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_MeanZ", XYZ_MeanZ[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_SkewZ", XYZ_SkewXY[energies[0].first]); - SetObservableValue("MaxTrack_XYZ_SkewZ", XYZ_SkewZ[energies[0].first]); - - SetObservableValue("MaxTrack_XYZ_MaxTrackEnergyPercentage", - (energies[0].second) / fTrackEvent->GetEnergy()); - - // --- Second max track observables --- // - SetObservableValue("SecondMaxTrack_XYZ_NHits", XYZ_NHits[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_Energy", XYZ_Energy[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_SigmaX", XYZ_SigmaX[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_SigmaY", XYZ_SigmaY[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_SigmaZ", XYZ_SigmaZ[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_GaussSigmaX", XYZ_GaussSigmaX[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_GaussSigmaY", XYZ_GaussSigmaY[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_GaussSigmaZ", XYZ_GaussSigmaZ[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_Length", XYZ_Length[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_Volume", XYZ_Volume[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_MeanX", XYZ_MeanX[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_MeanY", XYZ_MeanY[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_MeanZ", XYZ_MeanZ[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_SkewZ", XYZ_SkewXY[energies[1].first]); - SetObservableValue("SecondMaxTrack_XYZ_SkewZ", XYZ_SkewZ[energies[1].first]); - - if (fTrackEvent->GetNumberOfTracks() > 1) { - SetObservableValue("SecondMaxTrack_XYZ_MaxTrackEnergyPercentage", - (energies[1].second) / fTrackEvent->GetEnergy()); + int energies0FirstKey = -1; // Declare Keys outside to avoid error when accessing "energies[0].first"... + Double_t energies0SecondKey = -1.0; + + int energies1FirstKey = -1; // Declare Keys outside to avoid error when accessing "energies[1].first"... + Double_t energies1SecondKey = -1.0; + + // Copy the MaxTrack keys immediately after checking the vector + if (!energies.empty()) { + + // --- Max track observables --- // + int energies0FirstKey = energies[0].first; + Double_t energies0SecondKey = energies[0].second; + + SetObservableValue("MaxTrack_XYZ_NHits", XYZ_NHits[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_Energy", XYZ_Energy[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_SigmaX", XYZ_SigmaX[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_SigmaY", XYZ_SigmaY[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_SigmaZ", XYZ_SigmaZ[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_GaussSigmaX", XYZ_GaussSigmaX[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_GaussSigmaY", XYZ_GaussSigmaY[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_GaussSigmaZ", XYZ_GaussSigmaZ[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_Length", XYZ_Length[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_Volume", XYZ_Volume[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_MeanX", XYZ_MeanX[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_MeanY", XYZ_MeanY[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_MeanZ", XYZ_MeanZ[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_SkewZ", XYZ_SkewXY[energies0FirstKey]); + SetObservableValue("MaxTrack_XYZ_SkewZ", XYZ_SkewZ[energies0FirstKey]); + + SetObservableValue("MaxTrack_XYZ_MaxTrackEnergyPercentage", + (energies0SecondKey) / fTrackEvent->GetEnergy()); + + // --- Second max track observables --- // + int energies1FirstKey = energies[1].first; + + SetObservableValue("SecondMaxTrack_XYZ_NHits", XYZ_NHits[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_Energy", XYZ_Energy[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_SigmaX", XYZ_SigmaX[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_SigmaY", XYZ_SigmaY[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_SigmaZ", XYZ_SigmaZ[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_GaussSigmaX", XYZ_GaussSigmaX[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_GaussSigmaY", XYZ_GaussSigmaY[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_GaussSigmaZ", XYZ_GaussSigmaZ[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_Length", XYZ_Length[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_Volume", XYZ_Volume[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_MeanX", XYZ_MeanX[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_MeanY", XYZ_MeanY[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_MeanZ", XYZ_MeanZ[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_SkewZ", XYZ_SkewXY[energies1FirstKey]); + SetObservableValue("SecondMaxTrack_XYZ_SkewZ", XYZ_SkewZ[energies1FirstKey]); + + Double_t energies1SecondKey = energies[1].second; + + if (fTrackEvent->GetNumberOfTracks() > 2) { + SetObservableValue("SecondMaxTrack_XYZ_MaxTrackEnergyPercentage", + (energies1SecondKey) / fTrackEvent->GetEnergy()); + } else { + SetObservableValue("SecondMaxTrack_XYZ_MaxTrackEnergyPercentage", 0.0); + } } else { - SetObservableValue("SecondMaxTrack_XYZ_MaxTrackEnergyPercentage", 0); + std::cerr << "Error: energies is empty. Some observables will not be set." << std::endl; } // --- Distance obsevables between first two tracks --- // From fc58ef877899902462398b92f63dcd5d7c4308b6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:00:37 +0000 Subject: [PATCH 10/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/TRestTrack3DAnalysisProcess.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/TRestTrack3DAnalysisProcess.cxx b/src/TRestTrack3DAnalysisProcess.cxx index d46ca54..345e175 100644 --- a/src/TRestTrack3DAnalysisProcess.cxx +++ b/src/TRestTrack3DAnalysisProcess.cxx @@ -241,15 +241,14 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("Map_XYZ_SkewXY", XYZ_SkewXY); SetObservableValue("Map_XYZ_SkewZ", XYZ_SkewZ); - int energies0FirstKey = -1; // Declare Keys outside to avoid error when accessing "energies[0].first"... + int energies0FirstKey = -1; // Declare Keys outside to avoid error when accessing "energies[0].first"... Double_t energies0SecondKey = -1.0; - int energies1FirstKey = -1; // Declare Keys outside to avoid error when accessing "energies[1].first"... + int energies1FirstKey = -1; // Declare Keys outside to avoid error when accessing "energies[1].first"... Double_t energies1SecondKey = -1.0; // Copy the MaxTrack keys immediately after checking the vector if (!energies.empty()) { - // --- Max track observables --- // int energies0FirstKey = energies[0].first; Double_t energies0SecondKey = energies[0].second; @@ -271,7 +270,7 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XYZ_SkewZ", XYZ_SkewZ[energies0FirstKey]); SetObservableValue("MaxTrack_XYZ_MaxTrackEnergyPercentage", - (energies0SecondKey) / fTrackEvent->GetEnergy()); + (energies0SecondKey) / fTrackEvent->GetEnergy()); // --- Second max track observables --- // int energies1FirstKey = energies[1].first; @@ -296,7 +295,7 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { if (fTrackEvent->GetNumberOfTracks() > 2) { SetObservableValue("SecondMaxTrack_XYZ_MaxTrackEnergyPercentage", - (energies1SecondKey) / fTrackEvent->GetEnergy()); + (energies1SecondKey) / fTrackEvent->GetEnergy()); } else { SetObservableValue("SecondMaxTrack_XYZ_MaxTrackEnergyPercentage", 0.0); } From 41d27d1835946c1041d087a673a2799ed941e8b0 Mon Sep 17 00:00:00 2001 From: JPorron Date: Mon, 8 Jul 2024 12:32:11 +0200 Subject: [PATCH 11/13] Solve validation issues --- src/TRestTrack2DAnalysisProcess.cxx | 22 ++++++---------------- src/TRestTrack3DAnalysisProcess.cxx | 13 ++++--------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/TRestTrack2DAnalysisProcess.cxx b/src/TRestTrack2DAnalysisProcess.cxx index 4ce183f..4ee59f1 100644 --- a/src/TRestTrack2DAnalysisProcess.cxx +++ b/src/TRestTrack2DAnalysisProcess.cxx @@ -415,15 +415,10 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("Map_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance); // --- Max track observables --- // - int energiesX0FirstKey = - -1; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... - Double_t energiesX0SecondKey = -1.0; - int energiesY0FirstKey = -1; - Double_t energiesY0SecondKey = -1.0; // Copy the MaxTrack keys immediately after checking the vector if (!energiesX.empty()) { - int energiesX0FirstKey = energiesX[0].first; + int energiesX0FirstKey = energiesX[0].first; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... SetObservableValue("MaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX0FirstKey]); SetObservableValue("MaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX0FirstKey]); @@ -462,11 +457,11 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { Double_t energiesX0SecondKey = energiesX[0].second; Double_t energiesY0SecondKey = energiesY[0].second; - SetObservableValue("MaxTrack_XZ_YZ_Energy", energiesX[0].second + energiesY[0].second); + SetObservableValue("MaxTrack_XZ_YZ_Energy", energiesX0SecondKey + energiesY0SecondKey); SetObservableValue("MaxTrack_XZ_YZ_MaxTrackEnergyPercentage", - (energiesX[0].second + energiesY[0].second) / fTrackEvent->GetEnergy()); - SetObservableValue("MaxTrack_XZ_YZ_EnergyBalanceXY", (energiesX[0].second - energiesY[0].second) / - (energiesX[0].second + energiesY[0].second)); + (energiesX0SecondKey + energiesY0SecondKey) / fTrackEvent->GetEnergy()); + SetObservableValue("MaxTrack_XZ_YZ_EnergyBalanceXY", (energiesX0SecondKey - energiesY0SecondKey) / + (energiesX0SecondKey + energiesY0SecondKey)); } else { std::cerr << "Error: energiesX or energiesY is empty. Some observables will not be set." << std::endl; @@ -478,15 +473,10 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[0]); // --- Second max track observables --- // - int energiesX1FirstKey = - -1; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... - Double_t energiesX1SecondKey = -1.0; - int energiesY1FirstKey = -1; - Double_t energiesY1SecondKey = -1.0; // Copy the SecondTrack keys immediately after checking the vector if (!energiesX.empty()) { - int energiesX1FirstKey = energiesX[1].first; + int energiesX1FirstKey = energiesX[1].first; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... SetObservableValue("SecondMaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX1FirstKey]); SetObservableValue("SecondMaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX1FirstKey]); diff --git a/src/TRestTrack3DAnalysisProcess.cxx b/src/TRestTrack3DAnalysisProcess.cxx index 345e175..146c735 100644 --- a/src/TRestTrack3DAnalysisProcess.cxx +++ b/src/TRestTrack3DAnalysisProcess.cxx @@ -241,16 +241,11 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("Map_XYZ_SkewXY", XYZ_SkewXY); SetObservableValue("Map_XYZ_SkewZ", XYZ_SkewZ); - int energies0FirstKey = -1; // Declare Keys outside to avoid error when accessing "energies[0].first"... - Double_t energies0SecondKey = -1.0; - - int energies1FirstKey = -1; // Declare Keys outside to avoid error when accessing "energies[1].first"... - Double_t energies1SecondKey = -1.0; - // Copy the MaxTrack keys immediately after checking the vector if (!energies.empty()) { + // --- Max track observables --- // - int energies0FirstKey = energies[0].first; + int energies0FirstKey = energies[0].first; // Declare Keys outside to avoid error when accessing "energies[0].first"... Double_t energies0SecondKey = energies[0].second; SetObservableValue("MaxTrack_XYZ_NHits", XYZ_NHits[energies0FirstKey]); @@ -270,7 +265,7 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XYZ_SkewZ", XYZ_SkewZ[energies0FirstKey]); SetObservableValue("MaxTrack_XYZ_MaxTrackEnergyPercentage", - (energies0SecondKey) / fTrackEvent->GetEnergy()); + (energies0SecondKey) / fTrackEvent->GetEnergy()); // --- Second max track observables --- // int energies1FirstKey = energies[1].first; @@ -295,7 +290,7 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { if (fTrackEvent->GetNumberOfTracks() > 2) { SetObservableValue("SecondMaxTrack_XYZ_MaxTrackEnergyPercentage", - (energies1SecondKey) / fTrackEvent->GetEnergy()); + (energies1SecondKey) / fTrackEvent->GetEnergy()); } else { SetObservableValue("SecondMaxTrack_XYZ_MaxTrackEnergyPercentage", 0.0); } From 407dd20fa5e9e344271fc9256353a3dff53c88bc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:32:59 +0000 Subject: [PATCH 12/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/TRestTrack2DAnalysisProcess.cxx | 6 ++++-- src/TRestTrack3DAnalysisProcess.cxx | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/TRestTrack2DAnalysisProcess.cxx b/src/TRestTrack2DAnalysisProcess.cxx index 4ee59f1..728c3c8 100644 --- a/src/TRestTrack2DAnalysisProcess.cxx +++ b/src/TRestTrack2DAnalysisProcess.cxx @@ -418,7 +418,8 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { // Copy the MaxTrack keys immediately after checking the vector if (!energiesX.empty()) { - int energiesX0FirstKey = energiesX[0].first; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... + int energiesX0FirstKey = + energiesX[0].first; // Declare Keys outside to avoid error when accessing "energiesX[0].first"... SetObservableValue("MaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX0FirstKey]); SetObservableValue("MaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX0FirstKey]); @@ -476,7 +477,8 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { // Copy the SecondTrack keys immediately after checking the vector if (!energiesX.empty()) { - int energiesX1FirstKey = energiesX[1].first; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... + int energiesX1FirstKey = + energiesX[1].first; // Declare Keys outside to avoid error when accessing "energiesX[1].first"... SetObservableValue("SecondMaxTrack_XZ_NHitsX", XZ_NHitsX[energiesX1FirstKey]); SetObservableValue("SecondMaxTrack_XZ_EnergyX", XZ_EnergyX[energiesX1FirstKey]); diff --git a/src/TRestTrack3DAnalysisProcess.cxx b/src/TRestTrack3DAnalysisProcess.cxx index 146c735..c0e383c 100644 --- a/src/TRestTrack3DAnalysisProcess.cxx +++ b/src/TRestTrack3DAnalysisProcess.cxx @@ -243,9 +243,9 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { // Copy the MaxTrack keys immediately after checking the vector if (!energies.empty()) { - // --- Max track observables --- // - int energies0FirstKey = energies[0].first; // Declare Keys outside to avoid error when accessing "energies[0].first"... + int energies0FirstKey = + energies[0].first; // Declare Keys outside to avoid error when accessing "energies[0].first"... Double_t energies0SecondKey = energies[0].second; SetObservableValue("MaxTrack_XYZ_NHits", XYZ_NHits[energies0FirstKey]); @@ -265,7 +265,7 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XYZ_SkewZ", XYZ_SkewZ[energies0FirstKey]); SetObservableValue("MaxTrack_XYZ_MaxTrackEnergyPercentage", - (energies0SecondKey) / fTrackEvent->GetEnergy()); + (energies0SecondKey) / fTrackEvent->GetEnergy()); // --- Second max track observables --- // int energies1FirstKey = energies[1].first; @@ -290,7 +290,7 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { if (fTrackEvent->GetNumberOfTracks() > 2) { SetObservableValue("SecondMaxTrack_XYZ_MaxTrackEnergyPercentage", - (energies1SecondKey) / fTrackEvent->GetEnergy()); + (energies1SecondKey) / fTrackEvent->GetEnergy()); } else { SetObservableValue("SecondMaxTrack_XYZ_MaxTrackEnergyPercentage", 0.0); } From b0ae3e836f382a802652e6e509458d53b741a769 Mon Sep 17 00:00:00 2001 From: JPorron Date: Tue, 9 Jul 2024 16:32:25 +0200 Subject: [PATCH 13/13] Change error message --- src/TRestTrack2DAnalysisProcess.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/TRestTrack2DAnalysisProcess.cxx b/src/TRestTrack2DAnalysisProcess.cxx index 728c3c8..9c0ae3d 100644 --- a/src/TRestTrack2DAnalysisProcess.cxx +++ b/src/TRestTrack2DAnalysisProcess.cxx @@ -433,7 +433,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_XZ_MeanZ", XZ_MeanZ[energiesX0FirstKey]); SetObservableValue("MaxTrack_XZ_SkewZ", XZ_SkewZ[energiesX0FirstKey]); } else { - std::cerr << "Error: energiesX is empty. Some observables will not be set." << std::endl; + std::cerr << "Error: energiesX is empty. The observables are set to 0." << std::endl; } if (!energiesY.empty()) { @@ -451,7 +451,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("MaxTrack_YZ_MeanZ", YZ_MeanZ[energiesY0FirstKey]); SetObservableValue("MaxTrack_YZ_SkewZ", YZ_SkewZ[energiesY0FirstKey]); } else { - std::cerr << "Error: energiesY is empty. Some observables will not be set." << std::endl; + std::cerr << "Error: energiesY is empty. The observables are set to 0." << std::endl; } if (!energiesX.empty() & !energiesY.empty()) { @@ -465,7 +465,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { (energiesX0SecondKey + energiesY0SecondKey)); } else { - std::cerr << "Error: energiesX or energiesY is empty. Some observables will not be set." << std::endl; + std::cerr << "Error: energiesX or energiesY is empty. The observables are set to 0." << std::endl; } SetObservableValue("MaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[0]); @@ -492,7 +492,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("SecondMaxTrack_XZ_MeanZ", XZ_MeanZ[energiesX1FirstKey]); SetObservableValue("SecondMaxTrack_XZ_SkewZ", XZ_SkewZ[energiesX1FirstKey]); } else { - std::cerr << "Error: energiesX is empty. Some observables will not be set." << std::endl; + std::cerr << "Error: energiesX is empty. The observables are set to 0." << std::endl; } if (!energiesY.empty()) { @@ -510,7 +510,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("SecondMaxTrack_YZ_MeanZ", YZ_MeanZ[energiesY1FirstKey]); SetObservableValue("SecondMaxTrack_YZ_SkewZ", YZ_SkewZ[energiesY1FirstKey]); } else { - std::cerr << "Error: energiesY is empty. Some observables will not be set." << std::endl; + std::cerr << "Error: energiesY is empty. The observables are set to 0." << std::endl; } SetObservableValue("SecondMaxTrack_XZ_YZ_SigmaXYBalance", XZ_YZ_SigmaXYBalance[1]); @@ -535,7 +535,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { SetObservableValue("SecondMaxTrack_XZ_YZ_EnergyBalanceXY", 0.0); } } else { - std::cerr << "Error: energiesX or energiesY is empty. Some observables will not be set." << std::endl; + std::cerr << "Error: energiesX or energiesY is empty. The observables are set to 0." << std::endl; } // --- Distance obsevables between first two tracks --- //