diff --git a/inc/TRestDetectorHitsToTrackProcess.h b/inc/TRestDetectorHitsToTrackProcess.h
index a723b1c..fe76d56 100644
--- a/inc/TRestDetectorHitsToTrackProcess.h
+++ b/inc/TRestDetectorHitsToTrackProcess.h
@@ -43,6 +43,7 @@ class TRestDetectorHitsToTrackProcess : public TRestEventProcess {
protected:
/// The hits distance used to define a cluster of hits
Double_t fClusterDistance = 2.5;
+ Bool_t fIgnoreOneHitTracks = false;
public:
RESTValue GetInputEvent() const override { return fHitsEvent; }
@@ -55,6 +56,7 @@ class TRestDetectorHitsToTrackProcess : public TRestEventProcess {
BeginPrintProcess();
RESTMetadata << " cluster-distance : " << fClusterDistance << " mm " << RESTendl;
+ RESTMetadata << " ignoreOneHitTracks : " << fIgnoreOneHitTracks << " 0=false, 1=true " << RESTendl;
EndPrintProcess();
}
@@ -62,10 +64,12 @@ class TRestDetectorHitsToTrackProcess : public TRestEventProcess {
/// Returns the name of this process
const char* GetProcessName() const override { return "hitsToTrack"; }
+ void InitFromConfigFile() override;
+
TRestDetectorHitsToTrackProcess();
~TRestDetectorHitsToTrackProcess();
- ClassDefOverride(TRestDetectorHitsToTrackProcess, 1); // Template for a REST "event process" class
+ ClassDefOverride(TRestDetectorHitsToTrackProcess, 2); // Template for a REST "event process" class
// inherited from TRestEventProcess
};
#endif
diff --git a/src/TRestDetectorHitsToTrackProcess.cxx b/src/TRestDetectorHitsToTrackProcess.cxx
index 41bf71e..ee0aa24 100644
--- a/src/TRestDetectorHitsToTrackProcess.cxx
+++ b/src/TRestDetectorHitsToTrackProcess.cxx
@@ -38,6 +38,7 @@
///
/// * **clusterDistance**: It is the distance at which two hits are
/// considered to belong to the same group of hits.
+/// * **ignoreOneHitTracks**: Flag to ignore one hit tracks if desired.
///
/// The following lines of code show how the process metadata should be
/// defined.
@@ -47,8 +48,10 @@
///
/// \code
///
-///
+///
+///
+///
+///
///
/// \endcode
///
@@ -249,10 +252,12 @@ Int_t TRestDetectorHitsToTrackProcess::FindTracks(TRestHits* hits) {
track->SetVolumeHits(volHit);
volHit.RemoveHits();
- RESTDebug << "Adding track : id=" << track->GetTrackID() << " parent : " << track->GetParentID()
- << RESTendl;
- fTrackEvent->AddTrack(track);
- nTracksFound++;
+ if (Q.size() > 1 || !fIgnoreOneHitTracks) {
+ RESTDebug << "Adding track : id=" << track->GetTrackID() << " parent : " << track->GetParentID()
+ << RESTendl;
+ fTrackEvent->AddTrack(track);
+ nTracksFound++;
+ }
Q.clear();
}
@@ -261,3 +266,8 @@ Int_t TRestDetectorHitsToTrackProcess::FindTracks(TRestHits* hits) {
return nTracksFound;
}
+
+void TRestDetectorHitsToTrackProcess::InitFromConfigFile() {
+ fClusterDistance = StringToDouble(GetParameter("clusterDistance", fClusterDistance));
+ fIgnoreOneHitTracks = StringToBool(GetParameter("ignoreOneHitTracks", fIgnoreOneHitTracks));
+}