Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Review #46

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions inc/TRestTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include <iostream>

class TRestTrack : public TObject {
class TRestTrack {
protected:
Int_t fTrackID; ///< Track ID
Int_t fParentID; ///< Parent ID
Expand Down Expand Up @@ -81,6 +81,6 @@ class TRestTrack : public TObject {
// Destructor
~TRestTrack();

ClassDef(TRestTrack, 2);
ClassDef(TRestTrack, 3);
};
#endif
4 changes: 2 additions & 2 deletions inc/TRestTrack2DAnalysisProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#ifndef RestCore_TRestTrack2DAnalysisProcess
#define RestCore_TRestTrack2DAnalysisProcess

#include <TRestTrackEvent.h>
#include <TRestEventProcess.h>

#include "TRestEventProcess.h"
#include "TRestTrackEvent.h"

//! An analysis REST process to extract valuable information from Track type of data.
class TRestTrack2DAnalysisProcess : public TRestEventProcess {
Expand Down
4 changes: 2 additions & 2 deletions inc/TRestTrack3DAnalysisProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#ifndef RestCore_TRestTrack3DAnalysisProcess
#define RestCore_TRestTrack3DAnalysisProcess

#include <TRestTrackEvent.h>
#include <TRestEventProcess.h>

#include "TRestEventProcess.h"
#include "TRestTrackEvent.h"

//! An analysis REST process to extract valuable information from Track type of data.
class TRestTrack3DAnalysisProcess : public TRestEventProcess {
Expand Down
4 changes: 2 additions & 2 deletions inc/TRestTrackAnalysisProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#ifndef RestCore_TRestTrackAnalysisProcess
#define RestCore_TRestTrackAnalysisProcess

#include <TRestTrackEvent.h>
#include <TRestEventProcess.h>

#include "TRestEventProcess.h"
#include "TRestTrackEvent.h"

//! An analysis REST process to extract valuable information from Track type of data.
class TRestTrackAnalysisProcess : public TRestEventProcess {
Expand Down
4 changes: 2 additions & 2 deletions inc/TRestTrackBlobAnalysisProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#ifndef RestCore_TRestTrackBlobAnalysisProcess
#define RestCore_TRestTrackBlobAnalysisProcess

#include <TRestTrackEvent.h>
#include <TRestEventProcess.h>

#include "TRestEventProcess.h"
#include "TRestTrackEvent.h"

class TRestTrackBlobAnalysisProcess : public TRestEventProcess {
private:
Expand Down
4 changes: 2 additions & 2 deletions inc/TRestTrackDetachIsolatedNodesProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#ifndef RestCore_TRestTrackDetachIsolatedNodesProcess
#define RestCore_TRestTrackDetachIsolatedNodesProcess

#include <TRestTrackEvent.h>
#include <TRestEventProcess.h>

#include "TRestEventProcess.h"
#include "TRestTrackEvent.h"

class TRestTrackDetachIsolatedNodesProcess : public TRestEventProcess {
private:
Expand Down
1 change: 1 addition & 0 deletions inc/TRestTrackEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,5 @@ class TRestTrackEvent : public TRestEvent {

ClassDef(TRestTrackEvent, 1); // REST event superclass
};

#endif
4 changes: 2 additions & 2 deletions inc/TRestTrackLineAnalysisProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#ifndef RestCore_TRestTrackLineAnalysisProcess
#define RestCore_TRestTrackLineAnalysisProcess

#include <TRestTrackEvent.h>
#include <TRestEventProcess.h>

#include "TRestEventProcess.h"
#include "TRestTrackEvent.h"

//! A process to identify and extrack origin and end of a track assuming a linear track
class TRestTrackLineAnalysisProcess : public TRestEventProcess {
Expand Down
4 changes: 2 additions & 2 deletions inc/TRestTrackLinearizationProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#ifndef RestCore_TRestTrackLinearizationProcess
#define RestCore_TRestTrackLinearizationProcess

#include <TRestTrackEvent.h>
#include <TRestEventProcess.h>

#include "TRestEventProcess.h"
#include "TRestTrackEvent.h"

//! A process to perform track linearization
class TRestTrackLinearizationProcess : public TRestEventProcess {
Expand Down
6 changes: 3 additions & 3 deletions inc/TRestTrackPathMinimizationProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#ifndef RestCore_TRestTrackPathMinimizationProcess
#define RestCore_TRestTrackPathMinimizationProcess

#include <TRestTrackEvent.h>
#include <trackMinimization.h>
#include <TRestEventProcess.h>

#include "TRestEventProcess.h"
#include "TRestTrackEvent.h"
#include "trackMinimization.h"

class TRestTrackPathMinimizationProcess : public TRestEventProcess {
private:
Expand Down
4 changes: 2 additions & 2 deletions inc/TRestTrackPointLikeAnalysisProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#ifndef RestCore_TRestTrackPointLikeAnalysisProcess
#define RestCore_TRestTrackPointLikeAnalysisProcess

#include <TRestTrackEvent.h>
#include <TRestEventProcess.h>

#include "TRestEventProcess.h"
#include "TRestTrackEvent.h"

class TRestTrackPointLikeAnalysisProcess : public TRestEventProcess {
private:
Expand Down
4 changes: 2 additions & 2 deletions inc/TRestTrackReconnectionProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#ifndef RestCore_TRestTrackReconnectionProcess
#define RestCore_TRestTrackReconnectionProcess

#include <TRestTrackEvent.h>
#include <TRestEventProcess.h>

#include "TRestEventProcess.h"
#include "TRestTrackEvent.h"

class TRestTrackReconnectionProcess : public TRestEventProcess {
private:
Expand Down
4 changes: 2 additions & 2 deletions inc/TRestTrackReductionProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#ifndef RestCore_TRestTrackReductionProcess
#define RestCore_TRestTrackReductionProcess

#include <TRestTrackEvent.h>
#include <TRestEventProcess.h>

#include "TRestEventProcess.h"
#include "TRestTrackEvent.h"

class TRestTrackReductionProcess : public TRestEventProcess {
private:
Expand Down
2 changes: 1 addition & 1 deletion inc/TRestTrackViewerProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

#include <TGraph.h>
#include <TLegend.h>
#include <TRestEventProcess.h>

#include "TRestEventProcess.h"
#include "TRestTrackEvent.h"

//! A generic viewer REST process to visualize track events
Expand Down
2 changes: 1 addition & 1 deletion src/TRestTrack.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void TRestTrack::RemoveVolumeHits() {
/// track based on the most energetic hit. The origin is defined as the further
/// hit deposition edge to the most energetic hit, while the track end is defined
/// as the closest edge to the most energetic hit. The hits are expected to be
/// ordered following the minimim path.
/// ordered following the minimum path.
///
void TRestTrack::GetBoundaries(TVector3& orig, TVector3& end) {
const int nHits = fVolumeHits.GetNumberOfHits();
Expand Down
32 changes: 14 additions & 18 deletions src/TRestTrack2DAnalysisProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
/////////////////////////////////////////////////////////////////////////////

#include "TRestTrack2DAnalysisProcess.h"

using namespace std;

// Comparator function for sorting in descending order
Expand All @@ -111,7 +112,9 @@ TRestTrack2DAnalysisProcess::TRestTrack2DAnalysisProcess() { Initialize(); }

TRestTrack2DAnalysisProcess::TRestTrack2DAnalysisProcess(const char* configFilename) {
Initialize();
if (LoadConfigFromFile(configFilename)) LoadDefaultConfig();
if (LoadConfigFromFile(configFilename)) {
LoadDefaultConfig();
}
}

TRestTrack2DAnalysisProcess::~TRestTrack2DAnalysisProcess() { delete fTrackEvent; }
Expand Down Expand Up @@ -142,7 +145,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) {
Double_t XZ_TotalEnergyX;
Double_t YZ_TotalEnergyY;

/// Number of traks per type
/// Number of tracks per type
int NTracksX;
int NTracksY;

Expand Down Expand Up @@ -176,7 +179,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) {
map<int, Double_t> XZ_YZ_GaussSigmaXYBalance;
map<int, Double_t> XZ_YZ_GaussSigmaZBalance;

/// Espacial measuremets
/// Spatial measurements
map<int, Double_t> XZ_LengthX;
map<int, Double_t> YZ_LengthY;

Expand Down Expand Up @@ -205,7 +208,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) {
NTracksX = fTrackEvent->GetNumberOfTracks("X");
NTracksY = fTrackEvent->GetNumberOfTracks("Y");

/// Map oservables
/// Map observables
for (int tck = 0; tck < fTrackEvent->GetNumberOfTracks(); tck++) {
if (!fTrackEvent->isTopLevel(tck)) continue;

Expand Down Expand Up @@ -291,10 +294,10 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) {
/// From map to vector
map<int, Double_t>::iterator it;
for (it = XZ_EnergyX.begin(); it != XZ_EnergyX.end(); it++) {
energiesX.push_back(make_pair(it->first, it->second));
energiesX.emplace_back(it->first, it->second);
}
for (it = YZ_EnergyY.begin(); it != YZ_EnergyY.end(); it++) {
energiesY.push_back(make_pair(it->first, it->second));
energiesY.emplace_back(it->first, it->second);
}

/// Sort the vector by decreasing order of its pair's second value
Expand Down Expand Up @@ -343,7 +346,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) {
YZ_TotalEnergyY += pair.second;
}

/// Skew and sigm Z observables combining max traks in XZ and YZ
/// Skew and sigma Z observables combining max tracks in XZ and YZ
TRestHits hits;
TRestHits* hitsXZ = nullptr;
TRestHits* hitsYZ = nullptr;
Expand Down Expand Up @@ -454,7 +457,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) {
std::cerr << "Error: energiesY is empty. The observables are set to 0." << std::endl;
}

if (!energiesX.empty() & !energiesY.empty()) {
if (!energiesX.empty() && !energiesY.empty()) {
Double_t energiesX0SecondKey = energiesX[0].second;
Double_t energiesY0SecondKey = energiesY[0].second;

Expand Down Expand Up @@ -518,7 +521,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) {
SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaXYBalance", XZ_YZ_GaussSigmaXYBalance[1]);
SetObservableValue("SecondMaxTrack_XZ_YZ_GaussSigmaZBalance", XZ_YZ_GaussSigmaZBalance[1]);

if (!energiesX.empty() & !energiesY.empty()) {
if (!energiesX.empty() && !energiesY.empty()) {
Double_t energiesX1SecondKey = energiesX[1].second;
Double_t energiesY1SecondKey = energiesY[1].second;

Expand All @@ -538,7 +541,7 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) {
std::cerr << "Error: energiesX or energiesY is empty. The observables are set to 0." << std::endl;
}

// --- Distance obsevables between first two tracks --- //
// --- Distance observables between first two tracks --- //
SetObservableValue("XZ_FirstSecondTracksDistanceXZ", XZ_FirstSecondTracksDistanceXZ);
SetObservableValue("YZ_FirstSecondTracksDistanceYZ", YZ_FirstSecondTracksDistanceYZ);
SetObservableValue("XZ_YZ_FirstSecondTracksDistanceSum",
Expand All @@ -554,13 +557,6 @@ TRestEvent* TRestTrack2DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) {
return fTrackEvent;
}

void TRestTrack2DAnalysisProcess::EndProcess() {
// Function to be executed once at the end of the process
// (after all events have been processed)

// Start by calling the EndProcess function of the abstract class.
// Comment this if you don't want it.
// TRestEventProcess::EndProcess();
}
void TRestTrack2DAnalysisProcess::EndProcess() {}

void TRestTrack2DAnalysisProcess::InitFromConfigFile() {}
15 changes: 4 additions & 11 deletions src/TRestTrack3DAnalysisProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) {
/// ------------------ COMPUTE OBSERVABLES ------------------- ///
/// ---------------------------------------------------------- ///

/// Map oservables
/// Map observables
for (int tck = 0; tck < fTrackEvent->GetNumberOfTracks(); tck++) {
if (!fTrackEvent->isTopLevel(tck)) continue;

Expand Down Expand Up @@ -197,7 +197,7 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) {
/// From map to vector
map<int, Double_t>::iterator it;
for (it = XYZ_Energy.begin(); it != XYZ_Energy.end(); it++) {
energies.push_back(make_pair(it->first, it->second));
energies.emplace_back(make_pair(it->first, it->second));
}

/// Sort the vector by decreasing order of its pair's second value
Expand Down Expand Up @@ -298,19 +298,12 @@ TRestEvent* TRestTrack3DAnalysisProcess::ProcessEvent(TRestEvent* inputEvent) {
std::cerr << "Error: energies is empty. Some observables will not be set." << std::endl;
}

// --- Distance obsevables between first two tracks --- //
// --- Distance observables between first two tracks --- //
SetObservableValue("XYZ_FirstSecondTracksDistance", XYZ_FirstSecondTracksDistance);

return fTrackEvent;
}

void TRestTrack3DAnalysisProcess::EndProcess() {
// Function to be executed once at the end of the process
// (after all events have been processed)

// Start by calling the EndProcess function of the abstract class.
// Comment this if you don't want it.
// TRestEventProcess::EndProcess();
}
void TRestTrack3DAnalysisProcess::EndProcess() {}

void TRestTrack3DAnalysisProcess::InitFromConfigFile() {}
Loading
Loading