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

InitializeFromConfigFile - Added flag to remove one hit tracks #46

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
6 changes: 5 additions & 1 deletion 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
22 changes: 16 additions & 6 deletions src/TRestDetectorHitsToTrackProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -47,8 +48,10 @@
///
/// \code
///
/// <addProcess type="TRestDetectorHitsToTrackProcess name="hitsToTrack"
/// clusterDistance="2.5mm" />
/// <addProcess type="TRestDetectorHitsToTrackProcess" name="hitsToTrack" value="ON" verboseLevel="silent">
/// <parameter name="clusterDistance" value="3.5"/>
/// <parameter name="ignoreOneHitTracks" value="true"/>
/// </addProcess>
///
/// \endcode
///
Expand Down Expand Up @@ -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();
}
Expand All @@ -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));
}
Loading