Suppress Penning Transfer G++ Warning?

Hey! Real quick question. Is it possible to suppress the following warning message in Garfield++?

“MediumMagboltz::EnablePenningTransfer:
Warning: present gas table has no ionisation rates.
Ignore this message if you are using microscopic tracking only.”

I am using microscopic tracking, so there is no issue, but I am tired of always seeing it pop up in my logs whenever I run a simulation. Does it have a designated warning code?

Thanks in advance for any insight you can provide.

Hello, I invite @hschindl to have a look.

Dear @JamesIV

This warning originates from MediumGas::EnablePenningTransfer:

https://gitlab.cern.ch/garfield/garfieldpp/-/blob/master/Source/MediumGas.cc#L2550-L2579

However, your mediumGas object does not know whether in your sensor object you use objects of either AvalanceMC, driftLineRKF or AvalancheMicroscopic classes. I would invite you to hack around and see if you can come up with a reasonable solution. In that case please let us know ;-). If you just want a brute-force suppression and you don’t care about losing debug information, just comment out lines 2566-2571 and recompile.

Piet

Hello,

I guess they could also try the following if they only want to suppress the warning for specific function calls/programs:

#include <cstdlib>
#include <iostream>
#include <fstream>
#include <Garfield/MediumMagboltz.hh>

using namespace Garfield;

int main(void) {
  MediumMagboltz gas("Ar", .9, "CO2", .1);
  
  auto EnablePenningTransferWrapper = [&gas]() -> bool {
    std::ofstream nullStream("/dev/null");

    // Swap the buffer of cerr with null stream
    std::streambuf* oldBuffer = std::cerr.rdbuf(nullStream.rdbuf());

    bool ret = gas.EnablePenningTransfer();

    // Restore the original buffer
    std::cerr.rdbuf(oldBuffer);

    return ret;
  };

  return EnablePenningTransferWrapper() ? EXIT_SUCCESS : EXIT_FAILURE;
}

Output:

MediumMagboltz::SetComposition: Ar/CO2 (90/10)
MediumMagboltz::EnablePenningTransfer:
    Penning transfer probability for 44 Ar excitation levels set to r = 0.456061

Cheers,

Gabriel

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