Plotting the Townsend Coefficient for Gas Files in Garfield++

I am trying to Plot the Townsend and Attachment Coefficients for a specific Gas File I have generated. I have found success using a for loop that loops over the applied electric field and uses the MagBoltz function:

gas1->ElectronTownsend(ex, ey, ez, bx, by, bz, alpha)

I am now experimenting with another function I found in ViewMedium.hh: PlotElectronTownsend ().
I am unsure how to proceed and see the plot after defining the medium and electric field range.
This is the code:

using namespace Garfield;

int main(int argc, char * argv[]) {
    // Make a medium
    double temperature = ZeroCelsius + 20;
    double pressure = 1.1* AtmosphericPressure;
    MediumMagboltz* gas = new MediumMagboltz();
    gas->LoadGasFile("c2f4h2_85_ic4h10_5_sf6_10.gas");
    gas->Initialise(true);
    gas->SetTemperature(temperature);
    gas->SetPressure(pressure);
    TCanvas *c1 = new TCanvas("c1","Graph Draw Options", 600, 600);
    ViewMedium* viewer = new ViewMedium();
     viewer->SetMedium(gas);
     viewer->SetRangeE(100., 100000.,true);
     viewer->PlotElectronTownsend('e');
     viewer->SetCanvas(c1);
     c1->SaveAs("Townsend.png");
}

Of course, the proper Garfield files are included.

If anyone can help, I’d appreciate it.

Best,
Khalil

I guess @hschindl can help.

Hi,
you can use this example as a starting point:

Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.