REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestAxionSolarQCDFlux.cxx
1 /******************** REST disclaimer ***********************************
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 
211 
212 #include "TRestAxionSolarQCDFlux.h"
213 using namespace std;
214 
215 ClassImp(TRestAxionSolarQCDFlux);
216 
221 
236 TRestAxionSolarQCDFlux::TRestAxionSolarQCDFlux(const char* cfgFileName, string name)
237  : TRestAxionSolarFlux(cfgFileName) {
239 
241 }
242 
247 
253  if (fFluxDataFile == "" && fFluxSptFile == "") return false;
254 
256  ReadFluxFile();
257  } else {
260  }
261 
263 
264  return true;
265 }
266 
272  if (fFluxDataFile == "") {
273  RESTDebug << "TRestAxionSolarflux::LoadContinuumFluxTable. No solar flux table was defined"
274  << RESTendl;
275  return;
276  }
277 
278  string fullPathName = SearchFile((string)fFluxDataFile);
279 
280  RESTDebug << "Loading table from file : " << RESTendl;
281  RESTDebug << "File : " << fullPathName << RESTendl;
282 
283  std::vector<std::vector<Float_t>> fluxTable;
285  std::vector<std::vector<Double_t>> doubleTable;
286  if (!TRestTools::ReadASCIITable(fullPathName, doubleTable)) {
287  RESTError << "TRestAxionSolarQCDFlux::LoadContinuumFluxTable. " << RESTendl;
288  RESTError << "Could not read solar flux table : " << fFluxDataFile << RESTendl;
289  return;
290  }
291  for (const auto& row : doubleTable) {
292  std::vector<Float_t> floatVec(row.begin(), row.end());
293  fluxTable.push_back(floatVec);
294  }
296  TRestTools::ReadBinaryTable(fullPathName, fluxTable);
297  else {
298  fluxTable.clear();
299  RESTError << "Filename extension was not recognized!" << RESTendl;
300  RESTError << "Solar flux table will not be populated" << RESTendl;
301  RESTError << "Filename extension: " << TRestTools::GetFileNameExtension(fFluxDataFile) << RESTendl;
302  }
303 
304  if (fluxTable.size() != 100 && fluxTable[0].size() != 200) {
305  fluxTable.clear();
306  RESTError << "LoadContinuumFluxTable. The table does not contain the right number of rows or columns"
307  << RESTendl;
308  RESTError << "Table will not be populated" << RESTendl;
309  }
310 
311  for (unsigned int n = 0; n < fluxTable.size(); n++) {
312  TH1F* h = new TH1F(Form("%s_ContinuumFluxAtRadius%d", GetName(), n), "", 200, 0, 20);
313  for (unsigned int m = 0; m < fluxTable[n].size(); m++) h->SetBinContent(m + 1, fluxTable[n][m]);
314  fFluxTable.push_back(h);
315  }
316 }
317 
323  if (fFluxSptFile == "") {
324  RESTDebug << "TRestAxionSolarflux::LoadMonoChromaticFluxTable. No solar flux monochromatic table was "
325  "defined"
326  << RESTendl;
327  return;
328  }
329 
330  string fullPathName = SearchFile((string)fFluxSptFile);
331 
332  RESTDebug << "Loading monochromatic lines from file : " << RESTendl;
333  RESTDebug << "File : " << fullPathName << RESTendl;
334 
335  std::vector<std::vector<Double_t>> doubleTable;
336  if (!TRestTools::ReadASCIITable(fullPathName, doubleTable)) {
337  RESTError << "TRestAxionSolarQCDFlux::LoadMonoChromaticFluxTable." << RESTendl;
338  RESTError << "Could not read solar flux table : " << fFluxSptFile << RESTendl;
339  return;
340  }
341 
342  std::vector<std::vector<Float_t>> asciiTable;
343  for (const auto& row : doubleTable) {
344  std::vector<Float_t> floatVec(row.begin(), row.end());
345  asciiTable.push_back(floatVec);
346  }
347 
348  fFluxLines.clear();
349 
350  if (asciiTable.size() != 101) {
351  RESTError << "LoadMonoChromaticFluxTable. The table does not contain the right number of rows"
352  << RESTendl;
353  RESTError << "Table will not be populated" << RESTendl;
354  return;
355  }
356 
357  for (unsigned int en = 0; en < asciiTable[0].size(); en++) {
358  Float_t energy = asciiTable[0][en];
359  TH1F* h = new TH1F(Form("%s_MonochromeFluxAtEnergy%6.4lf", GetName(), energy), "", 100, 0, 1);
360  for (unsigned int r = 1; r < asciiTable.size(); r++) h->SetBinContent(r, asciiTable[r][en]);
361  fFluxLines[energy] = h;
362  }
363 }
364 
370  if (fBinSize <= 0) {
371  RESTError << "TRestAxionSolarflux::ReadFluxFile. Energy bin size of .flux file must be specified."
372  << RESTendl;
373  RESTError << "Please, define binSize parameter in eV." << RESTendl;
374  return;
375  }
376 
377  if (fPeakSigma <= 0) {
378  RESTWarning << "TRestAxionSolarflux::ReadFluxFile. Peak sigma must be specified to generate "
379  "monochromatic spectrum."
380  << RESTendl;
381  RESTWarning << "Only continuum table will be generated. If this was intentional, please, ignore this "
382  "RESTWarning."
383  << RESTendl;
384  return;
385  }
386 
387  string fullPathName = SearchFile((string)fFluxDataFile);
388 
389  RESTDebug << "Loading flux table ... " << RESTendl;
390  RESTDebug << "File : " << fullPathName << RESTendl;
391  std::vector<std::vector<Double_t>> fluxData;
392  TRestTools::ReadASCIITable(fullPathName, fluxData, 3);
393 
394  RESTDebug << "Table loaded" << RESTendl;
395  TH2F* originalHist = new TH2F("FullTable", "", 100, 0., 1., (Int_t)(20. / fBinSize), 0., 20.);
396  TH2F* continuumHist = new TH2F("ContinuumTable", "", 100, 0., 1., (Int_t)(20. / fBinSize), 0., 20.);
397  TH2F* spectrumHist = new TH2F("LinesTable", "", 100, 0., 1., (Int_t)(20. / fBinSize), 0., 20.);
398 
399  Double_t fluxBinSize = TRestTools::GetLowestIncreaseFromTable(fluxData, 1);
400 
401  for (const auto& data : fluxData) {
402  Float_t r = 0.005 + data[0];
403  Float_t en = data[1] - 0.005;
404  Float_t flux = data[2] * fluxBinSize; // flux in cm-2 s-1 bin-1
405 
406  originalHist->Fill(r, en, (Float_t)flux);
407  continuumHist->Fill(r, en, (Float_t)flux);
408  }
409  RESTDebug << "Histograms filled" << RESTendl;
410 
411  Int_t peaks = 0;
412  do {
413  peaks = 0;
414  // We just identify pronounced peaks, not smoothed gaussians!
415  const int smearPoints = (Int_t)(5 / (fBinSize * 100));
416  const int excludePoints = smearPoints / 5;
417  for (const auto& data : fluxData) {
418  Float_t r = 0.005 + data[0];
419  Float_t en = data[1] - 0.005;
420 
421  Int_t binR = continuumHist->GetXaxis()->FindBin(r);
422  Int_t binE = continuumHist->GetYaxis()->FindBin(en);
423 
424  Double_t avgFlux = 0;
425  Int_t n = 0;
426  for (int e = binE - smearPoints; e <= binE + smearPoints; e++) {
427  if (e < 1 || (e < binE + excludePoints && e > binE - excludePoints)) continue;
428  n++;
429  avgFlux += continuumHist->GetBinContent(binR, e);
430  }
431  avgFlux /= n;
432 
433  Float_t targetBinFlux = continuumHist->GetBinContent(binR, binE);
434  Float_t thrFlux = avgFlux + fPeakSigma * TMath::Sqrt(avgFlux);
435  if (targetBinFlux > 0 && targetBinFlux > thrFlux) {
436  continuumHist->SetBinContent(binR, binE, avgFlux);
437  peaks++;
438  }
439  }
440  } while (peaks > 0);
441 
442  for (int n = 0; n < originalHist->GetNbinsX(); n++)
443  for (int m = 0; m < originalHist->GetNbinsY(); m++) {
444  Float_t orig = originalHist->GetBinContent(n + 1, m + 1);
445  Float_t cont = continuumHist->GetBinContent(n + 1, m + 1);
446 
447  spectrumHist->SetBinContent(n + 1, m + 1, orig - cont);
448  }
449 
450  continuumHist->Rebin2D(1, (Int_t)(0.1 / fBinSize)); // cm-2 s-1 (100eV)-1
451  continuumHist->Scale(10); // cm-2 s-1 keV-1
452  // It could be over here if we would use directly a TH2D
453 
454  fFluxTable.clear();
455  for (int n = 0; n < continuumHist->GetNbinsX(); n++) {
456  TH1F* hc =
457  (TH1F*)continuumHist->ProjectionY(Form("%s_ContinuumFluxAtRadius%d", GetName(), n), n + 1, n + 1);
458  fFluxTable.push_back(hc);
459  }
460 
461  fFluxLines.clear();
462  for (int n = 0; n < spectrumHist->GetNbinsY(); n++) {
463  if (spectrumHist->ProjectionX("", n + 1, n + 1)->Integral() > 0) {
464  Double_t energy = spectrumHist->ProjectionY()->GetBinCenter(n + 1);
465  TH1F* hm = (TH1F*)spectrumHist->ProjectionX(
466  Form("%s_MonochromeFluxAtEnergy%5.3lf", GetName(), energy), n + 1, n + 1);
467  fFluxLines[energy] = hm;
468  }
469  }
470 
471  cout << "Number of peaks identified: " << fFluxLines.size() << endl;
472 }
473 
479  if (fContinuumHist != nullptr) {
480  delete fContinuumHist;
481  fContinuumHist = nullptr;
482  }
483 
484  fContinuumHist = new TH1F("ContinuumHist", "", 200, 0, 20);
485  for (const auto& x : fFluxTable) {
486  fContinuumHist->Add(x);
487  }
488 
489  fContinuumHist->SetStats(0);
490  fContinuumHist->GetXaxis()->SetTitle("Energy [keV]");
491  fContinuumHist->GetXaxis()->SetTitleSize(0.05);
492  fContinuumHist->GetXaxis()->SetLabelSize(0.05);
493  fContinuumHist->GetYaxis()->SetTitle("Flux [cm-2 s-1 keV-1]");
494  fContinuumHist->GetYaxis()->SetTitleSize(0.05);
495  fContinuumHist->GetYaxis()->SetLabelSize(0.05);
496 
497  return fContinuumHist;
498 }
499 
505  if (fMonoHist != nullptr) {
506  delete fMonoHist;
507  fMonoHist = nullptr;
508  }
509 
510  fMonoHist = new TH1F("MonochromaticHist", "", 20000, 0, 20);
511  for (const auto& x : fFluxLines) {
512  fMonoHist->Fill(x.first, x.second->Integral()); // cm-2 s-1 eV-1
513  }
514 
515  fMonoHist->SetStats(0);
516  fMonoHist->GetXaxis()->SetTitle("Energy [keV]");
517  fMonoHist->GetXaxis()->SetTitleSize(0.05);
518  fMonoHist->GetXaxis()->SetLabelSize(0.05);
519  fMonoHist->GetYaxis()->SetTitle("Flux [cm-2 s-1 eV-1]");
520  fMonoHist->GetYaxis()->SetTitleSize(0.05);
521  fMonoHist->GetYaxis()->SetLabelSize(0.05);
522 
523  return fMonoHist;
524 }
525 
532  TH1F* hm = GetMonochromaticSpectrum();
533  TH1F* hc = GetContinuumSpectrum();
534 
535  if (fTotalHist != nullptr) {
536  delete fTotalHist;
537  fTotalHist = nullptr;
538  }
539 
540  fTotalHist = new TH1F("fTotalHist", "", 20000, 0, 20);
541  for (int n = 0; n < hc->GetNbinsX(); n++) {
542  for (int m = 0; m < 100; m++) {
543  fTotalHist->SetBinContent(n * 100 + 1 + m, hc->GetBinContent(n + 1));
544  }
545  }
546 
547  for (int n = 0; n < hm->GetNbinsX(); n++)
548  // 1e-2 is the renormalization from 20000 bins to 200 bins
549  fTotalHist->SetBinContent(n + 1, fTotalHist->GetBinContent(n + 1) + 100 * hm->GetBinContent(n + 1));
550 
551  fTotalHist->SetStats(0);
552  fTotalHist->GetXaxis()->SetTitle("Energy [keV]");
553  fTotalHist->GetXaxis()->SetTitleSize(0.05);
554  fTotalHist->GetXaxis()->SetLabelSize(0.05);
555  fTotalHist->GetYaxis()->SetTitle("Flux [cm-2 s-1 keV-1]");
556  fTotalHist->GetYaxis()->SetTitleSize(0.05);
557  fTotalHist->GetYaxis()->SetLabelSize(0.05);
558 
559  return fTotalHist;
560 }
561 
566  if (fCanvas != nullptr) {
567  delete fCanvas;
568  fCanvas = nullptr;
569  }
570  fCanvas = new TCanvas("canv", "This is the canvas title", 1200, 500);
571  fCanvas->Draw();
572 
573  TPad* pad1 = new TPad("pad1", "This is pad1", 0.01, 0.02, 0.99, 0.97);
574  pad1->Divide(2, 1);
575  pad1->Draw();
576 
577  pad1->cd(1);
578  pad1->cd(1)->SetLogy();
579  pad1->cd(1)->SetRightMargin(0.09);
580  pad1->cd(1)->SetLeftMargin(0.15);
581  pad1->cd(1)->SetBottomMargin(0.15);
582 
583  TH1F* ht = GetTotalSpectrum();
584  ht->SetLineColor(kBlack);
585  ht->SetFillStyle(4050);
586  ht->SetFillColor(kBlue - 10);
587 
588  TH1F* hm = GetMonochromaticSpectrum();
589  hm->SetLineColor(kBlack);
590  hm->Scale(100); // renormalizing per 100eV-1
591 
592  ht->Draw("hist");
593  hm->Draw("hist same");
594 
595  pad1->cd(2);
596  pad1->cd(2)->SetRightMargin(0.09);
597  pad1->cd(2)->SetLeftMargin(0.15);
598  pad1->cd(2)->SetBottomMargin(0.15);
599 
600  ht->Draw("hist");
601  hm->Draw("hist same");
602 
603  return fCanvas;
604 }
605 
611  fFluxLineIntegrals.clear();
613 
614  for (const auto& line : fFluxLines) {
615  fTotalMonochromaticFlux += line.second->Integral();
617  }
618 
619  for (unsigned int n = 0; n < fFluxLineIntegrals.size(); n++)
621 
622  fTotalContinuumFlux = 0.0;
623  for (unsigned int n = 0; n < fFluxTable.size(); n++) {
624  fTotalContinuumFlux += fFluxTable[n]->Integral() * 0.1; // We integrate in 100eV steps
626  }
627 
628  for (unsigned int n = 0; n < fFluxTableIntegrals.size(); n++)
630 
632 }
633 
637 Double_t TRestAxionSolarQCDFlux::IntegrateFluxInRange(TVector2 eRange, Double_t mass) {
638  if (eRange.X() == -1 && eRange.Y() == -1) {
639  if (GetTotalFlux() == 0) IntegrateSolarFluxes();
640  return GetTotalFlux();
641  }
642 
643  Double_t flux = 0;
644  for (const auto& line : fFluxLines)
645  if (line.first > eRange.X() && line.first < eRange.Y()) flux += line.second->Integral();
646 
647  fTotalContinuumFlux = 0.0;
648  for (unsigned int n = 0; n < fFluxTable.size(); n++) {
649  flux += fFluxTable[n]->Integral(fFluxTable[n]->FindFixBin(eRange.X()),
650  fFluxTable[n]->FindFixBin(eRange.Y())) *
651  0.1; // We integrate in 100eV steps
652  }
653 
654  return flux;
655 }
656 
661 std::pair<Double_t, Double_t> TRestAxionSolarQCDFlux::GetRandomEnergyAndRadius(TVector2 eRange,
662  Double_t mass) {
663  std::pair<Double_t, Double_t> result = {0, 0};
664  if (!AreTablesLoaded()) return result;
665  Double_t rnd = fRandom->Rndm();
666  if (fTotalMonochromaticFlux == 0 || fRandom->Rndm() > fFluxRatio) {
667  // Continuum
668  for (unsigned int r = 0; r < fFluxTableIntegrals.size(); r++) {
669  if (rnd < fFluxTableIntegrals[r]) {
670  Double_t energy = fFluxTable[r]->GetRandom();
671  if (eRange.X() != -1 && eRange.Y() != -1) {
672  if (energy < eRange.X() || energy > eRange.Y()) return GetRandomEnergyAndRadius(eRange);
673  }
674  Double_t radius = ((Double_t)r + fRandom->Rndm()) * 0.01;
675  std::pair<Double_t, Double_t> p = {energy, radius};
676  return p;
677  }
678  }
679  } else {
680  // Monochromatic
681  int n = 0;
682  for (const auto& line : fFluxLines) {
683  if (rnd < fFluxLineIntegrals[n]) {
684  std::pair<Double_t, Double_t> p = {line.first, line.second->GetRandom()};
685  return p;
686  }
687  n++;
688  }
689  }
690  return result;
691 }
692 
697  cout << "Continuum solar flux table: " << endl;
698  cout << "--------------------------- " << endl;
699  for (unsigned int n = 0; n < fFluxTable.size(); n++) {
700  for (int m = 0; m < fFluxTable[n]->GetNbinsX(); m++)
701  cout << fFluxTable[n]->GetBinContent(m + 1) << "\t";
702  cout << endl;
703  cout << endl;
704  }
705  cout << endl;
706 }
707 
712  cout << "Integrated solar flux per solar ring: " << endl;
713  cout << "--------------------------- " << endl;
714  /*
715  for (int n = 0; n < fFluxPerRadius.size(); n++)
716  cout << "n : " << n << " flux : " << fFluxPerRadius[n] << endl;
717  cout << endl;
718  */
719 }
720 
725  // cout << "Number of monochromatic lines: " << fFluxPerRadius.size() << endl;
726  cout << "+++++++++++++++++++++++++++++++++++" << endl;
727  for (auto const& line : fFluxLines) {
728  cout << "Energy : " << line.first << " keV" << endl;
729  cout << "-----------------" << endl;
730  for (int n = 0; n < line.second->GetNbinsX(); n++)
731  cout << "R : " << line.second->GetBinCenter(n + 1)
732  << " flux : " << line.second->GetBinContent(n + 1) << " cm-2 s-1" << endl;
733  }
734 }
735 
741 
742  if (fFluxDataFile != "")
743  RESTMetadata << " - Solar axion flux datafile (continuum) : " << fFluxDataFile << RESTendl;
744  if (fFluxSptFile != "")
745  RESTMetadata << " - Solar axion flux datafile (monochromatic) : " << fFluxSptFile << RESTendl;
746  RESTMetadata << "-------" << RESTendl;
747  RESTMetadata << " - Total monochromatic flux : " << fTotalMonochromaticFlux << " cm-2 s-1" << RESTendl;
748  RESTMetadata << " - Total continuum flux : " << fTotalContinuumFlux << " cm-2 s-1" << RESTendl;
749  RESTMetadata << "++++++++++++++++++" << RESTendl;
750 
755  }
756 }
757 
763  string rootFilename = TRestTools::GetFileNameRoot(fFluxDataFile);
764 
765  string path = REST_USER_PATH + "/export/";
766 
767  if (!TRestTools::fileExists(path)) {
768  std::cout << "Creating path: " << path << std::endl;
769  int z = system(("mkdir -p " + path).c_str());
770  if (z != 0) RESTError << "Could not create directory " << path << RESTendl;
771  }
772 
773  if (fFluxTable.size() > 0) {
774  std::vector<std::vector<Float_t>> table;
775  for (const auto& x : fFluxTable) {
776  std::vector<Float_t> row;
777  for (int n = 0; n < x->GetNbinsX(); n++) row.push_back(x->GetBinContent(n + 1));
778 
779  table.push_back(row);
780  }
781 
782  if (!ascii)
783  TRestTools::ExportBinaryTable(path + "/" + rootFilename + ".N200f", table);
784  else
785  TRestTools::ExportASCIITable(path + "/" + rootFilename + ".dat", table);
786  }
787 
788  if (fFluxLines.size() > 0) {
789  std::vector<std::vector<Float_t>> table;
790  for (const auto& x : fFluxLines) {
791  std::vector<Float_t> row;
792  row.push_back(x.first);
793  for (int n = 0; n < x.second->GetNbinsX(); n++) row.push_back(x.second->GetBinContent(n + 1));
794 
795  table.push_back(row);
796  }
797 
799 
800  TRestTools::ExportASCIITable(path + "/" + rootFilename + ".spt", table);
801  }
802 }
A metadata class to load tabulated solar axion fluxes.
TCanvas * fCanvas
A canvas pointer for drawing.
TRandom3 * fRandom
Random number generator.
void PrintMetadata()
Prints on screen the information about the metadata members of TRestAxionSolarFlux.
A metadata class to load tabulated solar axion fluxes. Mass independent.
void PrintMetadata() override
Prints on screen the information about the metadata members of TRestAxionSolarQCDFlux.
std::string fFluxSptFile
The filename containning the solar flux spectra for monochromatic spectrum.
Double_t fPeakSigma
It will be used when loading .flux files to define the threshold for peak identification.
TRestAxionSolarQCDFlux()
Default constructor.
~TRestAxionSolarQCDFlux()
Default destructor.
void ReadFluxFile()
It loads a .flux file. It will split continuum and monochromatic peaks, loading both internal flux ta...
TH1F * GetTotalSpectrum()
It builds a histogram adding the continuum and the monochromatic spectrum component....
TH1F * fMonoHist
A pointer to the monochromatic spectrum histogram.
TH1F * fTotalHist
A pointer to the superposed monochromatic and continuum spectrum histogram.
void LoadContinuumFluxTable()
A helper method to load the data file containning continuum spectra as a function of the solar radius...
void PrintIntegratedRingFlux()
It prints on screen the integrated solar flux per solar ring.
std::vector< Double_t > fFluxTableIntegrals
Accumulative integrated solar flux for each solar ring for continuum spectrum (renormalized to unity)
Double_t GetTotalFlux(Double_t mass=0) override
It returns the total integrated flux at earth in cm-2 s-1.
Double_t IntegrateFluxInRange(TVector2 eRange=TVector2(-1, -1), Double_t mass=0) override
It returns the integrated flux at earth in cm-2 s-1 for the given energy range.
Bool_t LoadTables() override
It defines how to read the solar tables at the inhereted class.
std::vector< TH1F * > fFluxTable
The tabulated solar flux continuum spectra TH1F(200,0,20)keV in cm-2 s-1 keV-1 versus solar radius.
TH1F * GetContinuumSpectrum()
It builds a histogram with the continuum spectrum component. The flux will be expressed in cm-2 s-1 k...
void IntegrateSolarFluxes()
A helper method to initialize the internal class data members with the integrated flux for each solar...
TH1F * fContinuumHist
A pointer to the continuum spectrum histogram.
void LoadMonoChromaticFluxTable()
A helper method to load the data file containning monochromatic spectral lines as a function of the s...
void ExportTables(Bool_t ascii=false) override
It will create files with the continuum and spectral flux components to be used in a later ocasion.
std::vector< Double_t > fFluxLineIntegrals
Accumulative integrated solar flux for each monochromatic energy (renormalized to unity)
TH1F * GetMonochromaticSpectrum()
It builds a histogram with the monochromatic spectrum component. The flux will be expressed in cm-2 s...
std::pair< Double_t, Double_t > GetRandomEnergyAndRadius(TVector2 eRange=TVector2(-1, -1), Double_t mass=0) override
It defines how to generate Monte Carlo energy and radius values to reproduce the flux.
std::map< Double_t, TH1F * > fFluxLines
The tabulated solar flux in cm-2 s-1 for a number of monochromatic energies versus solar radius.
virtual TCanvas * DrawSolarFlux() override
It draws the contents of a .flux file. This method just receives the.
void PrintMonoChromaticFlux()
It prints on screen the spectral lines loaded in memory.
std::string fFluxDataFile
The filename containning the solar flux table with continuum spectrum.
Double_t fFluxRatio
The ratio between monochromatic and total flux.
void PrintContinuumSolarTable()
It prints on screen the table that has been loaded in memory.
Double_t fBinSize
It will be used when loading .flux files to define the input file energy binsize in eV.
Double_t fTotalContinuumFlux
Total solar flux for monochromatic contributions.
Double_t fTotalMonochromaticFlux
Total solar flux for monochromatic contributions.
endl_t RESTendl
Termination flag object for TRestStringOutput.
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.
TRestStringOutput::REST_Verbose_Level GetVerboseLevel()
returns the verboselevel in type of REST_Verbose_Level enumerator
std::string SearchFile(std::string filename)
Search files in current directory and directories specified in "searchPath" section.
std::string fConfigFileName
Full name of the rml file.
@ REST_Info
+show most of the information for each steps
@ REST_Debug
+show the defined debug messages
static void TransposeTable(std::vector< std::vector< T >> &data)
It transposes the std::vector<std::vector> table given in the argument. It will transform rows in col...
Definition: TRestTools.cxx:345
static int ExportASCIITable(std::string fname, std::vector< std::vector< T >> &data)
Writes the contents of the vector table given as argument to fname. Allowed types are Int_t,...
Definition: TRestTools.cxx:185
static std::string GetFileNameExtension(const std::string &fullname)
Gets the file extension as the substring found after the latest ".".
Definition: TRestTools.cxx:823
static std::string GetFileNameRoot(const std::string &fullname)
Gets the filename root as the substring found before the latest ".".
Definition: TRestTools.cxx:834
static bool fileExists(const std::string &filename)
Returns true if the file (or directory) with path filename exists.
Definition: TRestTools.cxx:728
static Bool_t IsBinaryFile(std::string fname)
It identifies if the filename extension follows the formatting ".Nxyzf", where the number of columns ...
Definition: TRestTools.cxx:303
static int ReadBinaryTable(std::string fName, std::vector< std::vector< T >> &data, Int_t columns=-1)
Reads a binary file containing a fixed-columns table with values.
Definition: TRestTools.cxx:253
static int ReadASCIITable(std::string fName, std::vector< std::vector< Double_t >> &data, Int_t skipLines=0, std::string separator="\t")
Reads an ASCII file containing a table with values.
Definition: TRestTools.cxx:577
static T GetLowestIncreaseFromTable(std::vector< std::vector< T >> data, Int_t column)
It returns the lowest increase, different from zero, between the elements of a particular column from...
Definition: TRestTools.cxx:442
static int ExportBinaryTable(std::string fname, std::vector< std::vector< T >> &data)
Writes the contents of the vector table given as argument to fname as a binary file....
Definition: TRestTools.cxx:214