Skip to content

Commit

Permalink
InitializeFromConfigFile - Added flag to remove one hit tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
JPorron committed Aug 29, 2024
1 parent a577f65 commit 2f620c8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
8 changes: 6 additions & 2 deletions inc/TRestDetectorHitsToTrackProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -55,17 +56,20 @@ class TRestDetectorHitsToTrackProcess : public TRestEventProcess {
BeginPrintProcess();

RESTMetadata << " cluster-distance : " << fClusterDistance << " mm " << RESTendl;
RESTMetadata << " ignoreOneHitTracks : " << fIgnoreOneHitTracks << " 0=false, 1=true " << RESTendl;

EndPrintProcess();
}

/// 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
15 changes: 11 additions & 4 deletions src/TRestDetectorHitsToTrackProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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));
}

0 comments on commit 2f620c8

Please sign in to comment.