93 #include "TRestTrackLineAnalysisProcess.h"
95 #include "TRestTrackReductionProcess.h"
115 SetSectionName(this->ClassName());
116 SetLibraryVersion(LIBRARY_VERSION);
118 fTrackEvent =
nullptr;
135 for (
int t = 0; t < fTrackEvent->GetNumberOfTracks(); t++)
136 fOutTrackEvent->AddTrack(fTrackEvent->GetTrack(t));
138 TRestTrack* tckX = fTrackEvent->GetMaxEnergyTrackInX();
139 TRestTrack* tckY = fTrackEvent->GetMaxEnergyTrackInY();
141 TVector3 orig = TVector3(0, 0, 0), end = TVector3(0, 0, 0);
142 Double_t length = -1;
143 Double_t angle = -10;
144 bool downwards =
true;
145 Double_t trackEnergyX = 0, trackEnergyY = 0;
146 Double_t trackBalanceX = 0, trackBalanceY = 0, trackBalance = 0, relZ = 0;
150 if (fLineAnaMethod ==
"3D") {
151 fTrackEvent->GetMaxTrackBoundaries3D(orig, end);
153 if (fLineAnaMethod !=
"default") {
155 <<
"Line analysis method " << fLineAnaMethod
156 <<
" is not implemented, supported methods are: default and 3D. Falling back to default."
159 fTrackEvent->GetMaxTrackBoundaries(orig, end);
162 RESTDebug <<
"Origin: " << orig.X() <<
" y: " << orig.Y() <<
" z: " << orig.Z() << RESTendl;
163 RESTDebug <<
"End : " << end.X() <<
" y: " << end.Y() <<
" z: " << end.Z() << RESTendl;
166 double dX = (orig.X() - end.X());
167 double dY = (orig.Y() - end.Y());
168 double dZ = (orig.Z() - end.Z());
169 length = TMath::Sqrt(dX * dX + dY * dY + dZ * dZ);
170 angle = TMath::ACos(dZ / length);
173 RESTDebug <<
"Track length " << length <<
" angle: " << angle << RESTendl;
175 trackEnergyX = tckX->GetEnergy();
176 trackEnergyY = tckY->GetEnergy();
178 if (trackEnergyX > 0) trackBalanceX = trackEnergyX / fTrackEvent->GetEnergy(
"X");
179 if (trackEnergyY > 0) trackBalanceY = trackEnergyY / fTrackEvent->GetEnergy(
"Y");
180 if (trackEnergyX > 0 && trackEnergyY > 0)
182 (trackEnergyX + trackEnergyY) / (fTrackEvent->GetEnergy(
"X") + fTrackEvent->GetEnergy(
"Y"));
183 relZ = fTrackEvent->GetMaxTrackRelativeZ();
186 Double_t trackEnergy = trackEnergyX + trackEnergyY;
189 SetObservableValue(
"trackBalanceX", trackBalanceX);
190 SetObservableValue(
"trackBalanceY", trackBalanceY);
191 SetObservableValue(
"trackBalance", trackBalance);
192 SetObservableValue(
"originX", orig.X());
193 SetObservableValue(
"originY", orig.Y());
194 SetObservableValue(
"originZ", orig.Z());
195 SetObservableValue(
"endX", end.X());
196 SetObservableValue(
"endY", end.Y());
197 SetObservableValue(
"endZ", end.Z());
198 SetObservableValue(
"length", length);
199 SetObservableValue(
"angle", angle);
200 SetObservableValue(
"downwards", downwards);
201 SetObservableValue(
"totalEnergy", trackEnergy);
202 SetObservableValue(
"relativeZ", relZ);
204 if (!tckX || !tckY)
return nullptr;
207 tckX->SetParentID(tckX->GetTrackID());
208 tckX->SetTrackID(fOutTrackEvent->GetNumberOfTracks() + 1);
209 fOutTrackEvent->AddTrack(tckX);
212 tckY->SetParentID(tckY->GetTrackID());
213 tckY->SetTrackID(fOutTrackEvent->GetNumberOfTracks() + 1);
214 fOutTrackEvent->AddTrack(tckY);
216 fOutTrackEvent->SetLevels();
217 return fOutTrackEvent;
A base class for any REST event.
A process to identify and extrack origin and end of a track assuming a linear track.
void InitProcess() override
Process initialization. Nothing to do...
void Initialize() override
Function to initialize input/output event members and define the section name.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
~TRestTrackLineAnalysisProcess()
Default destructor.
void EndProcess() override
Function to include required actions after all events have been processed. Nothing to do....
TRestTrackLineAnalysisProcess()
Default constructor.