Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-07-16 08:14:22

0001 #include <cstdlib>
0002 #include <iostream>
0003 #include <string>
0004 
0005 #include <Garfield/MediumMagboltz.hh>
0006 
0007 //------------------------------------------------------------
0008 //  This standalone executable makes gas calculations for
0009 //  whatever mixture you specify and range of electric,
0010 //  magnetic, and angle between values that you select.
0011 //                           TKH   5/27/2026
0012 //
0013 //
0014 //------------------------------------------------------------
0015 
0016 int main(int argc, char* argv[])
0017 {
0018   if (argc != 11)
0019   {
0020     std::cerr
0021         << "Usage:\n"
0022         << argv[0]
0023         << " Emin Emax nE Bmin Bmax nB Amin Amax nA output_file_name\n\n"
0024         << "Units:\n"
0025         << "  E: V/cm\n"
0026         << "  B: Tesla\n"
0027         << "  angle: radians\n";
0028     return 1;
0029   }
0030 
0031   const double Emin = std::atof(argv[1]);
0032   const double Emax = std::atof(argv[2]);
0033   const int nE = std::atoi(argv[3]);
0034 
0035   const double Bmin = std::atof(argv[4]);
0036   const double Bmax = std::atof(argv[5]);
0037   const int nB = std::atoi(argv[6]);
0038 
0039   const double Amin = std::atof(argv[7]);
0040   const double Amax = std::atof(argv[8]);
0041   const int nA = std::atoi(argv[9]);
0042 
0043   const std::string output_file(argv[10]);
0044 
0045   std::cout << "E grid: "
0046             << Emin << " -> " << Emax
0047             << " with " << nE << " points\n";
0048 
0049   std::cout << "B grid: "
0050             << Bmin << " -> " << Bmax
0051             << " with " << nB << " points\n";
0052 
0053   std::cout << "Angle grid: "
0054             << Amin << " -> " << Amax
0055             << " with " << nA << " points\n";
0056 
0057   std::cout << "Output File: " << output_file << std::endl;
0058 
0059   // ------------------------------------------------------------
0060   // Gas: Ar/CF4/isobutane = 75/20/5.
0061   // ------------------------------------------------------------
0062   Garfield::MediumMagboltz gas;
0063   gas.SetComposition("ar", 75., "cf4", 20., "isobutane", 5.);
0064   gas.SetTemperature(301.65);  // K     from Grafana
0065   gas.SetPressure(762.);       // Torr  from Grafana
0066 
0067   // Try to load an existing gas table.
0068   bool LogGrid = false;
0069   gas.SetFieldGrid(Emin, Emax, nE, LogGrid,
0070                    Bmin, Bmax, nB,
0071                    Amin, Amax, nA);
0072 
0073   gas.GenerateGasTable(10);
0074   gas.WriteGasFile(output_file);
0075 }