11 #include "TRestTrackReductionProcess.h"
17 TRestTrackReductionProcess::TRestTrackReductionProcess() { Initialize(); }
19 TRestTrackReductionProcess::~TRestTrackReductionProcess() {
delete fOutputTrackEvent; }
22 SetSectionName(this->ClassName());
23 SetLibraryVersion(LIBRARY_VERSION);
25 fInputTrackEvent =
nullptr;
36 for (
int tck = 0; tck < fInputTrackEvent->GetNumberOfTracks(); tck++)
37 fOutputTrackEvent->AddTrack(fInputTrackEvent->GetTrack(tck));
40 fInputTrackEvent->PrintOnlyTracks();
43 for (
int tck = 0; tck < fInputTrackEvent->GetNumberOfTracks(); tck++) {
44 if (!fInputTrackEvent->isTopLevel(tck))
continue;
46 TRestTrack* track = fInputTrackEvent->GetTrack(tck);
50 cout <<
"TRestTrackReductionProcess. Reducing hits in track id : " << track->GetTrackID() << endl;
55 TRestVolumeHits::kMeansClustering(hits, vHits, fMaxIt);
59 nHitsBefore = vHits.GetNumberOfHits();
61 TRestVolumeHits::kMeansClustering(hits, vHits, fMaxIt);
62 nHitsAfter = vHits.GetNumberOfHits();
63 }
while (nHitsBefore != nHitsAfter);
66 newTrack.SetVolumeHits(vHits);
67 newTrack.SetParentID(track->GetTrackID());
68 newTrack.SetTrackID(fOutputTrackEvent->GetNumberOfTracks() + 1);
69 fOutputTrackEvent->AddTrack(&newTrack);
72 fOutputTrackEvent->SetLevels();
73 return fOutputTrackEvent;
77 Double_t distance = fStartingDistance;
78 while (distance < fMinimumDistance || hits.GetNumberOfHits() > fMaxNodes) {
80 cout <<
"TRestTrackReductionProcess. Merging track hits within a "
81 <<
"distance : " << distance <<
" mm" << endl;
82 cout <<
"TRestTrackReductionProcess. Hits now : " << hits.GetNumberOfHits() << endl;
90 for (
unsigned int i = 0; i < hits.GetNumberOfHits(); i++) {
91 for (
unsigned int j = i + 1; j < hits.GetNumberOfHits(); j++) {
101 RESTDebug <<
"TRestTrackReductionProcess. Number of hits merged : " << mergedHits << RESTendl;
104 distance *= fDistanceStepFactor;
A base class for any REST event.
void SetEventInfo(TRestEvent *eve)
Double_t GetDistance2(int n, int m) const
It returns the euclidian distance between hits n and m.
@ REST_Debug
+show the defined debug messages
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
void EndProcess() override
To be executed at the end of the run (outside event loop)
void Initialize() override
Making default settings.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)