REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestAxionAnalysisProcess.cxx
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 
52 #include "TRestAxionAnalysisProcess.h"
53 using namespace std;
54 
56 
61 
74  Initialize();
75 
76  LoadConfig(cfgFileName);
77 }
78 
83 
88  SetName(this->ClassName());
89  SetTitle("Default config");
90 }
91 
102 void TRestAxionAnalysisProcess::LoadConfig(std::string cfgFilename, std::string name) {
103  if (LoadConfigFromFile(cfgFilename, name)) LoadDefaultConfig();
104 }
105 
110  SetSectionName(this->ClassName());
111  SetLibraryVersion(LIBRARY_VERSION);
112 
113  fAxionEvent = new TRestAxionEvent();
114 
115  fAxionEvent->Initialize();
116 }
117 
122  fAxionEvent = (TRestAxionEvent*)evInput;
123 
124  RESTDebug << "TRestAxionAnalysisProcess::ProcessEvent : " << fAxionEvent->GetID() << RESTendl;
125 
126  SetObservableValue("energy", fAxionEvent->GetEnergy());
127  SetObservableValue("mass", fAxionEvent->GetMass() * units("eV"));
128 
129  Double_t x = fAxionEvent->GetPosition().X() - fAnalysisPosition.X();
130  Double_t y = fAxionEvent->GetPosition().Y() - fAnalysisPosition.Y();
131  SetObservableValue("posX", x);
132  SetObservableValue("posY", y);
133  SetObservableValue("posZ", fAxionEvent->GetPosition().Z());
134 
136  Double_t r = TMath::Sqrt(x * x + y * y);
137  SetObservableValue("R", r);
138 
139  SetObservableValue("thetaAngle", fAxionEvent->GetDirection().Theta());
140  SetObservableValue("phiAngle", fAxionEvent->GetDirection().Phi());
141 
142  if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Debug) fAxionEvent->PrintEvent();
143 
144  return fAxionEvent;
145 }
An analyis process to add TRestAxionEvent observables to the analysis tree.
TRestEvent * ProcessEvent(TRestEvent *evInput) override
The main processing event function.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
~TRestAxionAnalysisProcess()
Default destructor.
void LoadConfig(std::string cfgFilename, std::string name="")
Function to load the configuration from an external configuration file.
void Initialize() override
Function to initialize input/output event members and define the section name.
TRestAxionAnalysisProcess()
Default constructor.
An event data class to define the parameters related to an axion particle.
A base class for any REST event.
Definition: TRestEvent.h:38
@ REST_Debug
+show the defined debug messages