REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestTrackPathMinimizationProcess.h
1
11
12#ifndef RestCore_TRestTrackPathMinimizationProcess
13#define RestCore_TRestTrackPathMinimizationProcess
14
15#include <TRestEventProcess.h>
16
17#include "TRestTrackEvent.h"
18#include "trackMinimization.h"
19
21 private:
22#ifndef __CINT__
23 TRestTrackEvent* fInputTrackEvent;
24 TRestTrackEvent* fOutputTrackEvent;
25#endif
26
27 void Initialize() override;
28
29 protected:
30 Bool_t fWeightHits = false;
31
32 TString fMinMethod = "default"; // Minimization method, default is HeldKarp
33 Bool_t fCyclic = false; // In case you want to find the minimum path using a cyclic loop (e.g. first hit
34 // is connected to last hit)
35
36 public:
37 RESTValue GetInputEvent() const override { return fInputTrackEvent; }
38 RESTValue GetOutputEvent() const override { return fOutputTrackEvent; }
39
40 void InitProcess() override;
41 TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
42 void BruteForce(TRestVolumeHits* hits, std::vector<int>& bestPath);
43 void NearestNeighbour(TRestVolumeHits* hits, std::vector<int>& bestPath);
44 void HeldKarp(TRestVolumeHits* hits, std::vector<int>& bestPath);
45 void EndProcess() override;
46
47 void PrintMetadata() override {
49
50 // std::cout << "Maximum number of nodes (hits) allowed : " <<
51 // fMaxNodes << endl;
52
53 if (fWeightHits)
54 RESTMetadata << "Weight hits : enabled" << RESTendl;
55 else
56 RESTMetadata << "Weight hits : disabled" << RESTendl;
57
58 RESTMetadata << "Minimization method " << fMinMethod << RESTendl;
59 EndPrintProcess();
60 }
61
62 const char* GetProcessName() const override { return "trackPathMinimization"; }
63
64 // Constructor
66 // Destructor
68
69 ClassDefOverride(TRestTrackPathMinimizationProcess, 2);
70};
71#endif
A base class for any REST event process.
void BeginPrintProcess()
[name, cut range]
A base class for any REST event.
Definition: TRestEvent.h:38
endl_t RESTendl
Termination flag object for TRestStringOutput.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
void NearestNeighbour(TRestVolumeHits *hits, std::vector< int > &bestPath)
Return the index with the shortest path solving Travelling Salesman Problem (TSP) using nearest neigh...
void HeldKarp(TRestVolumeHits *hits, std::vector< int > &bestPath)
This function eturn the index with the shortest path Note that this method calls external tsp library...
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
void EndProcess() override
To be executed at the end of the run (outside event loop)
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
void Initialize() override
Making default settings.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
void BruteForce(TRestVolumeHits *hits, std::vector< int > &bestPath)
This function return the index with the shortest path solving Travelling Salesman Problem (TSP) using...