REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestAxionTransmissionProcess.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
42#include "TRestAxionTransmissionProcess.h"
43using namespace std;
44
46
51
64 Initialize();
65
66 LoadConfig(cfgFileName);
67}
68
73
78 SetName(this->ClassName());
79 SetTitle("Default config");
80}
81
92void TRestAxionTransmissionProcess::LoadConfig(std::string cfgFilename, std::string name) {
93 if (LoadConfigFromFile(cfgFilename, name)) LoadDefaultConfig();
94}
95
100 SetSectionName(this->ClassName());
101 SetLibraryVersion(LIBRARY_VERSION);
102
104}
105
111 RESTDebug << "Entering ... TRestAxionGeneratorProcess::InitProcess" << RESTendl;
112
113 RegisterAllObservables();
114
115 fXrayWindows.clear();
116 for (const auto& wName : fWindowNames) {
118
119 if (w == nullptr) {
120 RESTError << "TRestAxionTransmissionProcess. Window definition with name : " << wName
121 << " not found!" << RESTendl;
122 } else {
123 fXrayWindows.push_back(w);
124 }
125 }
126}
127
132 fAxionEvent = (TRestAxionEvent*)evInput;
133
134 TVector3 inPos = fAxionEvent->GetPosition();
135 TVector3 inDir = fAxionEvent->GetDirection();
136
139 TVector3 newPos = REST_Physics::MoveToPlane(inPos, inDir, TVector3(0, 0, 1), TVector3(0, 0, 0));
140
141 Double_t transmission = 1;
142 Double_t x = newPos.X();
143 Double_t y = newPos.Y();
144 Double_t z = newPos.Z();
145 Double_t en = fAxionEvent->GetEnergy();
146
147 RESTDebug << "Particle position to evaluate window transmission. " << RESTendl;
148 RESTDebug << "X : " << x << " Y: " << y << " Z: " << z << RESTendl;
149
150 for (const auto& window : fXrayWindows) {
151 transmission *= window->GetTransmission(en, x, y);
152 }
153 RESTDebug << "Transmission: " << transmission << RESTendl;
154
155 SetObservableValue("transmission", transmission);
156
158 fAxionEvent->PrintEvent();
159
161 }
162
163 return fAxionEvent;
164}
165
171
172 // This is the additional code required by the process to read window names
173 TiXmlElement* windowDefinition = GetElement("window");
174 while (windowDefinition) {
175 fWindowNames.push_back(GetFieldValue("name", windowDefinition));
176
177 windowDefinition = GetNextElement(windowDefinition);
178 }
179}
TRestAxionEvent * fAxionEvent
A pointer to the specific TRestAxionEvent.
An event data class to define the parameters related to an axion particle.
TVector3 GetPosition()
It keeps track of efficiency introduced at different helioscope components.
A process to include photon transmission using a combination of TRestAxionXrayWindow definitions.
TRestEvent * ProcessEvent(TRestEvent *evInput) override
The main processing event function.
std::vector< TRestAxionXrayWindow * > fXrayWindows
A list with pointers to the windows metadata descriptions.
void InitProcess() override
Process initialization. Data members that require initialization just before start processing should ...
std::vector< std::string > fWindowNames
The names of the metadata TRestAxionXrayWindow that will be combined for transmission.
void InitFromConfigFile() override
Function reading input parameters from the RML TRestAxionTransmissionProcess metadata section.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
void Initialize() override
Function to initialize input/output event members and define the section name.
void LoadConfig(std::string cfgFilename, std::string name="")
Function to load the configuration from an external configuration file.
A metadata class to create x-ray transmission window definitions.
virtual void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
T * GetMetadata()
Get a metadata object from the host TRestRun.
void SetObservableValue(const std::string &name, const T &value)
Set observable value for AnalysisTree.
A base class for any REST event.
Definition: TRestEvent.h:38
endl_t RESTendl
Termination flag object for TRestStringOutput.
TiXmlElement * GetElement(std::string eleDeclare, TiXmlElement *e=nullptr)
Get an xml element from a given parent element, according to its declaration.
Int_t LoadConfigFromFile(const std::string &configFilename, const std::string &sectionName="")
Give the file name, find out the corresponding section. Then call the main starter.
void SetLibraryVersion(TString version)
Set the library version of this metadata class.
TRestStringOutput::REST_Verbose_Level GetVerboseLevel()
returns the verboselevel in type of REST_Verbose_Level enumerator
std::string GetFieldValue(std::string parName, TiXmlElement *e)
Returns the field value of an xml element which has the specified name.
void SetSectionName(std::string sName)
set the section name, clear the section content
TiXmlElement * GetNextElement(TiXmlElement *e)
Get the next sibling xml element of this element, with same eleDeclare.
@ 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.