Skip to content

Commit

Permalink
Merge pull request #39 from rest-for-physics/DavidDiezIb-tracksXYZ
Browse files Browse the repository at this point in the history
Track observables for simulation events (XYZ tracks)
  • Loading branch information
DavidDiezIb authored Feb 21, 2024
2 parents b00afd2 + a3d8ed5 commit 6b3c09c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/TRestTrackAnalysisProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/TRestTrackEvent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 6b3c09c

Please sign in to comment.