diff --git a/inc/TRestDetectorHitsToTrackProcess.h b/inc/TRestDetectorHitsToTrackProcess.h index a723b1c..32bb1fa 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 +#endif \ No newline at end of file diff --git a/src/TRestDetectorHitsToTrackProcess.cxx b/src/TRestDetectorHitsToTrackProcess.cxx index 41bf71e..e8e8e97 100644 --- a/src/TRestDetectorHitsToTrackProcess.cxx +++ b/src/TRestDetectorHitsToTrackProcess.cxx @@ -249,10 +249,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 +263,8 @@ Int_t TRestDetectorHitsToTrackProcess::FindTracks(TRestHits* hits) { return nTracksFound; } + +void TRestDetectorHitsToTrackProcess::InitFromConfigFile() { + fClusterDistance = StringToDouble(GetParameter("clusterDistance", fClusterDistance)); + fIgnoreOneHitTracks = StringToBool(GetParameter("ignoreOneHitTracks", fIgnoreOneHitTracks)); +} \ No newline at end of file