97 #include "TRestAxionXrayWindow.h"
100 #include "TRestSystemOfUnits.h"
126 RESTDebug <<
"Entering TRestAxionXrayWindow constructor( cfgFileName, name )" <<
RESTendl;
166 RESTDebug <<
"TRestAxionXrayWindow::ReadMaterial. Reading file : " << materialFileName <<
RESTendl;
169 RESTError <<
"TRestAxionXrayWindow::ReadMaterial( )" <<
RESTendl;
170 RESTError <<
"Material file not found : " << materialFileName <<
RESTendl;
174 FILE* fin = fopen(materialFileName.c_str(),
"rt");
179 while (fscanf(fin,
"%lf\t%lf\n", &en, &value) != EOF) {
180 RESTDebug <<
"Energy : " << en <<
"eV -- Abs : " << value <<
RESTendl;
210 if (energyIndex < 0) {
211 RESTWarning <<
"Energy : " << energy <<
" keV is out of range!" <<
RESTendl;
220 double x2 =
fEnergy[energyIndex + 1];
221 double x1 =
fEnergy[energyIndex];
223 double m = (y2 - y1) / (x2 - x1);
224 double n = y1 - m * x1;
226 if (m * energy + n < 0) {
227 RESTError <<
"TRestAxionXrayWindow::GetAbsorptionCoefficient. Negative coefficient!" <<
RESTendl;
228 cout <<
"y2 : " << y2 <<
" y1 : " << y1 << endl;
229 cout <<
"x2 : " << x2 <<
" x1 : " << x1 << endl;
230 cout <<
"m : " << m <<
" n : " << n << endl;
231 cout <<
"E : " << energy <<
" bin : " << energyIndex << endl;
235 return (m * energy + n);
288 for (
unsigned int n = 0; n <
fEnergy.size(); n++)
289 if (energy <
fEnergy[n])
return n - 1;
299 for (
unsigned int n = 0; n <
fEnergy.size(); n++)
316 RESTWarning <<
"TRestAxionXrayWindow. Name : " << this->GetName() <<
RESTendl;
317 RESTWarning <<
"No mask pattern was defined for the X-ray window!" <<
RESTendl;
333 RESTMetadata <<
" - Pattern type: foil" <<
RESTendl;
336 RESTMetadata <<
"+++++++++++++++++++++++++++++++++++++++++++++++++" <<
RESTendl;
A metadata class to create x-ray transmission window definitions.
Double_t GetTransmission(Double_t energy, Double_t x, Double_t y)
It returns the window transmission probability for the given energy (in keV) and window position,...
void PrintTransmissionData()
Prints out the transmission probability curve loaded in memory. for debugging pourposes.
Bool_t HitsPattern(Double_t x, Double_t y)
It returns true if the window pattern is hitted. False otherwise.
void Initialize()
Initialization of TRestAxionXrayWindow members. It removes all gases.
Int_t GetEnergyIndex(Double_t energy)
It returns the vector element index, from fEnergy, that is just below the given input energy.
std::vector< Double_t > fTransmission
A vector with the transmission already renormalized using the material thickness. Not stored in disk.
void PrintMetadata()
Prints on screen the information about the metadata members of TRestAxionXrayWindow.
TRestPatternMask * fMask
A mask defining a pattern where the transmission will be effective.
TRestAxionXrayWindow()
Default constructor.
~TRestAxionXrayWindow()
Default destructor.
std::string fMaterial
Window material name.
void InitFromConfigFile()
To make settings from rml file. This method must be implemented in the derived class.
void ReadMaterial()
It reads the data files from the corresponding material that needs to be found in the axiolib databas...
Double_t fThickness
Thicknesss of window material in mm.
std::vector< Double_t > fEnergy
A vector with the energies loaded from the material file. Not stored in disk.
An abstract class used to encapsulate different mask pattern class definitions.
Double_t GetMaskRadius()
It returns the mask radius.
Bool_t HitsPattern(Double_t x, Double_t y)
Returns true if the pattern was hit. If (x,y) it is inside a region then, the pattern was not hit by ...
This namespace defines the unit conversion for different units which are understood by REST.