REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestAxionTransportProcess.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 
46 #include "TRestAxionTransportProcess.h"
47 using namespace std;
48 
50 
55 
68  Initialize();
69 
70  LoadConfig(cfgFileName);
71 }
72 
77 
82  SetName(this->ClassName());
83  SetTitle("Default config");
84 }
85 
96 void TRestAxionTransportProcess::LoadConfig(std::string cfgFilename, std::string name) {
97  if (LoadConfigFromFile(cfgFilename, name)) LoadDefaultConfig();
98 }
99 
104  SetSectionName(this->ClassName());
105  SetLibraryVersion(LIBRARY_VERSION);
106 
107  fAxionEvent = new TRestAxionEvent();
108 }
109 
115  RESTDebug << "Entering ... TRestAxionGeneratorProcess::InitProcess" << RESTendl;
116 }
117 
122  fAxionEvent = (TRestAxionEvent*)evInput;
123 
124  TVector3 inPos = fAxionEvent->GetPosition();
125  TVector3 inDir = fAxionEvent->GetDirection();
126 
127  if ((inPos.Z() - fZPosition) * inDir.Z() >= 0) {
128  RESTWarning << "TRestAxionTransportProcess::ProcessEvent (" << GetName()
129  << "). Not appropiate particle direction to reach Z=" << fZPosition << RESTendl;
130  RESTWarning << "Axion position. Z:" << inPos.Z() << " direction Z: " << inDir.Z() << RESTendl;
131  fAxionEvent->PrintEvent();
132 
133  return fAxionEvent;
134  }
135 
136  TVector3 newPosition =
137  REST_Physics::MoveToPlane(inPos, inDir, TVector3(0, 0, 1), TVector3(0, 0, fZPosition));
138 
139  fAxionEvent->SetPosition(newPosition);
140 
141  if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Debug) {
142  fAxionEvent->PrintEvent();
143 
145  }
146 
147  return fAxionEvent;
148 }
An event data class to define the parameters related to an axion particle.
A process to transport the axion to a given z-position without changing direction.
void LoadConfig(std::string cfgFilename, std::string name="")
Function to load the configuration from an external configuration file.
~TRestAxionTransportProcess()
Default destructor.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
TRestAxionTransportProcess()
Default constructor.
void Initialize() override
Function to initialize input/output event members and define the section name.
TRestEvent * ProcessEvent(TRestEvent *evInput) override
The main processing event function.
void InitProcess() override
Process initialization. Data members that require initialization just before start processing should ...
A base class for any REST event.
Definition: TRestEvent.h:38
virtual void PrintEvent() const
Definition: TRestEvent.cxx:187
@ REST_Debug
+show the defined debug messages
TVector3 MoveToPlane(const TVector3 &pos, const TVector3 &dir, const TVector3 &n, const TVector3 &a)
This method will translate the vector with direction dir starting at position pos to the plane define...
Int_t GetChar(std::string hint="Press a KEY to continue ...")
Helps to pause the program, printing a message before pausing.