Skip to content
Open
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
8 changes: 5 additions & 3 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 <TRestEventProcess.h>
#include <TRestTrackEvent.h>

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

//! A process to perform track linearization
class TRestTrackLinearizationProcess : public TRestEventProcess {
Expand All @@ -38,6 +38,7 @@ class TRestTrackLinearizationProcess : public TRestEventProcess {
protected:
// A parameter which defines the maximum number of nodes for the track linearization
Int_t fMaxNodes = 6;
Bool_t fFixBoundaries = false;

public:
RESTValue GetInputEvent() const override { return fTrackEvent; }
Expand All @@ -50,6 +51,7 @@ class TRestTrackLinearizationProcess : public TRestEventProcess {
void PrintMetadata() override {
BeginPrintProcess();
RESTMetadata << "Max nodes: " << fMaxNodes << RESTendl;
RESTMetadata << "Fix boundaries: " << (fFixBoundaries ? "true" : "false") << RESTendl;
EndPrintProcess();
}

Expand All @@ -65,6 +67,6 @@ class TRestTrackLinearizationProcess : public TRestEventProcess {

// ROOT class definition helper. Increase the number in it every time
// you add/rename/remove the process parameters
ClassDefOverride(TRestTrackLinearizationProcess, 1);
ClassDefOverride(TRestTrackLinearizationProcess, 2);
};
#endif
8 changes: 6 additions & 2 deletions src/TRestTrackLinearizationProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
///
/// ### Parameters
/// * fMaxNodes : Maximum number of nodes (hits) to reduce the hits to a line
/// * fFixBoundaries : Fix the boundaries of the track, i.e. the first and last nodes. It
/// is recommended to add 2 more nodes to fMaxNodes when setting this parameter to true. This
/// avoids the first and last nodes being pulled into the center of the track by the
/// kMeansClustering algorithm. This is useful when you need an accurate measurement of the
/// track length, but it is less precise (worse length resolution). Default is false.
///
/// ### Examples
/// \code
Expand Down Expand Up @@ -63,7 +68,6 @@
#include "TRestTrackLinearizationProcess.h"

#include "TRestTrackReductionProcess.h"

using namespace std;

ClassImp(TRestTrackLinearizationProcess);
Expand Down Expand Up @@ -167,7 +171,7 @@ void TRestTrackLinearizationProcess::GetHitsProjection(TRestVolumeHits* hits, co
return;
}

TRestVolumeHits::kMeansClustering(hits, vHits, 1);
TRestVolumeHits::kMeansClustering(hits, vHits, 1, fFixBoundaries);

if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Debug)
for (unsigned int i = 0; i < vHits.GetNumberOfHits(); i++)
Expand Down