11 #include "TRestTrackPointLikeAnalysisProcess.h"
17 TRestTrackPointLikeAnalysisProcess::TRestTrackPointLikeAnalysisProcess() { Initialize(); }
19 TRestTrackPointLikeAnalysisProcess::TRestTrackPointLikeAnalysisProcess(
const char* configFilename) {
22 if (LoadConfigFromFile(configFilename)) LoadDefaultConfig();
25 TRestTrackPointLikeAnalysisProcess::~TRestTrackPointLikeAnalysisProcess() {}
27 void TRestTrackPointLikeAnalysisProcess::LoadDefaultConfig() { SetTitle(
"Default config"); }
30 SetSectionName(this->ClassName());
31 SetLibraryVersion(LIBRARY_VERSION);
33 fTrackEvent =
nullptr;
36 void TRestTrackPointLikeAnalysisProcess::LoadConfig(
string configFilename) {
37 if (LoadConfigFromFile(configFilename)) LoadDefaultConfig();
47 Int_t nTracks = fTrackEvent->GetNumberOfTracks();
48 Int_t nTotalHits = fTrackEvent->GetTotalHits();
50 Double_t totEnergy = 0;
51 Double_t maxTrackEnergy = 0;
53 Double_t totLength = 0;
54 Double_t maxTrackLength = 0;
56 Int_t maxNumberHits = 0;
60 for (
int tck = 0; tck < fTrackEvent->GetNumberOfTracks(); tck++) {
61 Double_t trackEnergy = fTrackEvent->GetTrack(tck)->GetEnergy();
62 if (trackEnergy > maxTrackEnergy) {
63 maxTrackEnergy = trackEnergy;
66 totEnergy += trackEnergy;
68 Double_t trackLength = fTrackEvent->GetTrack(tck)->GetTrackLength();
69 if (trackLength > maxTrackLength) maxTrackLength = trackLength;
70 totLength += trackLength;
72 Int_t numberHits = fTrackEvent->GetTrack(tck)->GetVolumeHits()->GetNumberOfHits();
73 if (numberHits > maxNumberHits) maxNumberHits = numberHits;
77 Double_t maxClusterSize = 0;
79 for (
unsigned int cl = 0; cl < fTrackEvent->GetTrack(maxIndex)->GetVolumeHits()->GetNumberOfHits();
81 Double_t clusterSize = fTrackEvent->GetTrack(maxIndex)->GetVolumeHits()->GetClusterSize(cl);
82 if (clusterSize > maxClusterSize) maxClusterSize = clusterSize;
83 totSize += clusterSize;
86 Double_t clusterEnergyBalance = maxTrackEnergy / totEnergy;
87 Double_t clusterLengthBalance = maxTrackLength / totLength;
88 Double_t hitsBalance = maxNumberHits / nTotalHits;
89 Double_t clusterSizeBalance = maxClusterSize / totSize;
92 SetObservableValue(
"nTracks", nTracks);
93 SetObservableValue(
"nTotalHits", nTotalHits);
94 SetObservableValue(
"totalEnergy", totEnergy);
95 SetObservableValue(
"clusterEnergyBalance", clusterEnergyBalance);
96 SetObservableValue(
"clusterLengthBalance", clusterLengthBalance);
97 SetObservableValue(
"hitsBalance", hitsBalance);
98 SetObservableValue(
"size", totSize);
99 SetObservableValue(
"sizeBalance", clusterSizeBalance);
A base class for any REST event.
void EndProcess() override
To be executed at the end of the run (outside event loop)
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
void Initialize() override
Making default settings.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)