REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestAxionFieldPropagationProcess.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 
117 #include "TRestAxionFieldPropagationProcess.h"
118 
119 #include <TVectorD.h>
120 
121 #include <numeric>
122 using namespace std;
123 
125 
130 
143 
148 
153  SetSectionName(this->ClassName());
154  SetLibraryVersion(LIBRARY_VERSION);
155 
156  fAxionEvent = new TRestAxionEvent();
157 }
158 
164  RESTDebug << "Entering ... TRestAxionFieldPropagationProcess::InitProcess" << RESTendl;
165 
166  fMagneticField = (TRestAxionMagneticField*)this->GetMetadata("TRestAxionMagneticField");
167 
168  if (!fMagneticField) {
169  RESTError << "TRestAxionFieldPropagationprocess. Magnetic Field was not defined!" << RESTendl;
170  exit(0);
171  }
172 
173  for (size_t n = 0; n < fMagneticField->GetNumberOfVolumes(); n++) fMagneticField->ReMap(n, fReMap);
174 
175  if (!fAxionField) {
176  fAxionField = new TRestAxionField();
177 
178  fBufferGas = (TRestAxionBufferGas*)this->GetMetadata("TRestAxionBufferGas");
179  if (fBufferGas)
180  fAxionField->AssignBufferGas(fBufferGas);
181  else
182  fBufferGasAdditionalLength = 0;
183 
184  fAxionField->AssignMagneticField(fMagneticField);
185  if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Info)
186  fMagneticField->PrintMetadata();
187  }
188 
189  RESTDebug << "Axion-field : " << fAxionField << RESTendl;
190  RESTDebug << "Buffer gas : " << fBufferGas << RESTendl;
191  RESTDebug << "Magnetic field : " << fMagneticField << RESTendl;
192 }
193 
195  fAxionEvent = (TRestAxionEvent*)evInput;
196 
197  RESTDebug << "TRestAxionFieldPropagationProcess::ProcessEvent : " << fAxionEvent->GetID() << RESTendl;
198 
199  fMagneticField->SetTrack(fAxionEvent->GetPosition(), fAxionEvent->GetDirection());
200 
201  Double_t Ea = fAxionEvent->GetEnergy();
202  Double_t ma = fAxionEvent->GetMass() * units("eV");
203 
204  std::pair<Double_t, Double_t> prob =
205  fAxionField->GammaTransmissionFieldMapProbability(Ea, ma, fAccuracy, fNumIntervals, fQawoLevels);
206 
207  SetObservableValue("probability", prob.first);
208  SetObservableValue("error", prob.second);
209 
210  Double_t transmission = 1;
211  if (fBufferGas && fBufferGasAdditionalLength > 0) {
212  Double_t Gamma = fBufferGas->GetPhotonAbsorptionLength(Ea); // cm-1
213  Double_t GammaL = Gamma * fBufferGasAdditionalLength * units("cm");
214  transmission = exp(-GammaL);
215  }
216 
217  SetObservableValue("transmission", transmission);
218 
219  RESTDebug << " --- Process observables: " << RESTendl;
220  RESTDebug << "Probability: " << prob.first << " T" << RESTendl;
221  RESTDebug << "Error: " << prob.second << " T" << RESTendl;
222  RESTDebug << "Transmission: " << transmission << " mm" << RESTendl;
223 
224  if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Debug) fAxionEvent->PrintEvent();
225 
229 
230  return fAxionEvent;
231 }
A metadata class to define the gas properties used in axion search calculations.
An event data class to define the parameters related to an axion particle.
A process to introduce the magnetic field profile integration along the track.
TRestEvent * ProcessEvent(TRestEvent *eventInput) override
Process one event.
void InitProcess() override
Process initialization. Data members that require initialization just before start processing should ...
void Initialize() override
Function to initialize input/output event members and define the section name.
A basic class to define analytical axion-photon conversion calculations for axion helioscopes.
A class to load magnetic field maps and evaluate the field on those maps including interpolation.
A base class for any REST event.
Definition: TRestEvent.h:38
@ REST_Info
+show most of the information for each steps
@ REST_Debug
+show the defined debug messages