Add getters for excitation and ionisation rates and levels.
Example:
#include <iostream>
#include <TCanvas.h>
#include <TGraph.h>
#include <TROOT.h>
#include <TApplication.h>
#include "Garfield/MediumMagboltz.hh"
#include "Garfield/FundamentalConstants.hh"
using namespace Garfield;
int main(int argc, char * argv[]) {
TApplication app("app", &argc, argv);
// Load a gas file which includes excitation and ionisation rates.
MediumMagboltz gas;
gas.LoadGasFile("ar_93_co2_7.gas");
// gas.PrintGas();
auto nIon = gas.GetNumberOfIonisationLevels();
auto nExc = gas.GetNumberOfExcitationLevels();
std::cout << nIon << " ionisation levels:\n";
for (size_t i = 0; i < nIon; ++i) {
std::string label;
double energy = 0.;
gas.GetIonisationLevel(i, label, energy);
std::cout << label << ", " << energy << " eV.\n";
}
std::cout << nExc << " excitations:\n";
for (size_t i = 0; i < nExc; ++i) {
std::string label;
double energy = 0.;
gas.GetExcitationLevel(i, label, energy);
std::cout << label << ", " << energy << " eV.\n";
}
std::vector<double> efields;
std::vector<double> bfields;
std::vector<double> angles;
gas.GetFieldGrid(efields, bfields, angles);
const auto nE = efields.size();
TGraph gIon(nE);
TGraph gExc(nE);
for (size_t i = 0; i < nE; ++i) {
double fsum = 0.;
for (size_t j = 0; j < nIon; ++j) {
double f = 0.;
gas.GetElectronIonisationRate(j, i, 0, 0, f);
fsum += f;
}
gIon.SetPoint(i, efields[i], fsum);
fsum = 0.;
for (size_t j = 0; j < nExc; ++j) {
double f = 0.;
gas.GetElectronExcitationRate(j, i, 0, 0, f);
fsum += f;
}
gExc.SetPoint(i, efields[i], fsum);
}
gIon.SetMarkerStyle(20);
gIon.SetMarkerColor(kRed + 1);
gExc.SetMarkerStyle(21);
gExc.SetMarkerColor(kBlue + 1);
TCanvas c1("c1", "", 600, 600);
c1.cd();
gExc.Draw("apl");
gIon.Draw("plsame");
app.Run(true);
}
Edited by Heinrich Schindler