diff --git a/src/TRestTrackAnalysisProcess.cxx b/src/TRestTrackAnalysisProcess.cxx index 62aa774..c3b7818 100644 --- a/src/TRestTrackAnalysisProcess.cxx +++ b/src/TRestTrackAnalysisProcess.cxx @@ -1037,6 +1037,9 @@ TRestEvent* TRestTrackAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) { } Double_t trackSecondMaxEnergy = tckSecondMaxEnergy_X + tckSecondMaxEnergy_Y; + if (fInputTrackEvent->GetSecondMaxEnergyTrack("XYZ") != nullptr) { + trackSecondMaxEnergy = fInputTrackEvent->GetSecondMaxEnergyTrack("XYZ")->GetEnergy(); + } SetObservableValue((string) "SecondMaxTrackEnergy", trackSecondMaxEnergy); SetObservableValue((string) "SecondMaxTrackSigmaX", tckSecondMaxXYZ_SigmaX); diff --git a/src/TRestTrackEvent.cxx b/src/TRestTrackEvent.cxx index 915aadd..028f2d4 100644 --- a/src/TRestTrackEvent.cxx +++ b/src/TRestTrackEvent.cxx @@ -183,12 +183,12 @@ TRestTrack* TRestTrackEvent::GetSecondMaxEnergyTrack(TString option) { Double_t en = t->GetEnergy(); - if (option == "X" && t->isXZ()) { + if (option == "X" && (t->isXZ() || t->isXYZ())) { if (en > maxEnergy) { maxEnergy = t->GetEnergy(); track = tck; } - } else if (option == "Y" && t->isYZ()) { + } else if (option == "Y" && (t->isYZ() || t->isXYZ())) { if (t->GetEnergy() > maxEnergy) { maxEnergy = t->GetEnergy(); track = tck; @@ -226,10 +226,10 @@ Double_t TRestTrackEvent::GetEnergy(TString option) { if (option == "") en += t->GetEnergy(); - else if (option == "X" && t->isXZ()) + else if (option == "X" && (t->isXZ() || t->isXYZ())) en += t->GetEnergy(); - else if (option == "Y" && t->isYZ()) + else if (option == "Y" && (t->isYZ() || t->isXYZ())) en += t->GetEnergy(); else if (option == "XYZ" && t->isXYZ())