REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestTrackLinearizationProcess.h
1 /*************************************************************************
2  * This file is part of the REST software framework. *
3  * *
4  * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5  * For more information see http://gifna.unizar.es/trex *
6  * *
7  * REST is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * REST is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have a copy of the GNU General Public License along with *
18  * REST in $REST_PATH/LICENSE. *
19  * If not, see http://www.gnu.org/licenses/. *
20  * For the list of contributors see $REST_PATH/CREDITS. *
21  *************************************************************************/
22 
23 #ifndef RestCore_TRestTrackLinearizationProcess
24 #define RestCore_TRestTrackLinearizationProcess
25 
26 #include <TRestTrackEvent.h>
27 
28 #include "TRestEventProcess.h"
29 
32  private:
33  TRestTrackEvent* fTrackEvent;
34  TRestTrackEvent* fOutTrackEvent;
35 
36  void Initialize() override;
37 
38  protected:
39  // A parameter which defines the maximum number of nodes for the track linearization
40  Int_t fMaxNodes = 6;
41 
42  public:
43  RESTValue GetInputEvent() const override { return fTrackEvent; }
44  RESTValue GetOutputEvent() const override { return fOutTrackEvent; }
45 
46  void InitProcess() override;
47  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
48  void EndProcess() override;
49 
50  void PrintMetadata() override {
52  RESTMetadata << "Max nodes: " << fMaxNodes << RESTendl;
53  EndPrintProcess();
54  }
55 
56  void GetHitsProjection(TRestVolumeHits* hits, const int& nodes, TRestVolumeHits& vHits);
57  std::vector<std::pair<double, double>> GetBestNodes(const std::vector<Float_t>& fXY,
58  const std::vector<Float_t>& fZ,
59  const std::vector<Float_t>& fEn, const int& nodes);
60 
61  const char* GetProcessName() const override { return "trackLinearization"; }
62 
65 
66  // ROOT class definition helper. Increase the number in it every time
67  // you add/rename/remove the process parameters
68  ClassDefOverride(TRestTrackLinearizationProcess, 1);
69 };
70 #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.
A process to perform track linearization.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
std::vector< std::pair< double, double > > GetBestNodes(const std::vector< Float_t > &fXY, const std::vector< Float_t > &fZ, const std::vector< Float_t > &fEn, const int &nodes)
This function performs a linear fit to the volumehits of the track weighthed by the energy of the hit...
void EndProcess() override
Function to include required actions after all events have been processed.
void Initialize() override
Function to initialize input/output event members and define the section name.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
void GetHitsProjection(TRestVolumeHits *hits, const int &nodes, TRestVolumeHits &vHits)
This function performs the track linearization towards a given number of nodes the nodes are extracte...
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
void InitProcess() override
Process initialization. Nothing to do here.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.