#include #include #include #include #include #include #include #include "Garfield/ViewDrift.hh" #include "Garfield/ComponentAnalyticField.hh" #include "Garfield/MediumMagboltz.hh" #include "Garfield/Sensor.hh" #include "Garfield/DriftLineRKF.hh" #include "Garfield/AvalancheMicroscopic.hh" #include "Garfield/AvalancheMC.hh" #include "Garfield/TrackHeed.hh" #include "Garfield/TrackSrim.hh" #include "Garfield/ViewField.hh" #include "Garfield/ViewDrift.hh" using namespace Garfield; int main(int argc, char * argv[]) { Time_t start=time(0); TApplication app("app", &argc, argv); // Make a gas medium. MediumMagboltz gas; gas.LoadGasFile("Ar90_CH4_10_1bar.gas"); auto installdir = std::getenv("GARFIELD_INSTALL"); if (!installdir) { std::cerr << "GARFIELD_INSTALL variable not set.\n"; return 1; } const std::string path = installdir; gas.LoadIonMobility(path + "/share/Garfield/Data/IonMobility_Ar+_Ar.txt"); // Make a component with analytic electric field. ComponentAnalyticField cmp; cmp.SetMedium(&gas); // Wire radius [cm] const double rWire = 25.e-4; // Outer radius of the tube [cm] const double rTube = 0.71; // Voltages const double vWire = 1500; const double vTube = 0.; // Add the wire in the centre. cmp.AddWire(0, 0, 2 * rWire, vWire, "s"); // Add the tube. cmp.AddTube(rTube, vTube, 0); // Make a sensor. Sensor sensor; sensor.AddComponent(&cmp); sensor.AddElectrode(&cmp, "s"); const double tstep = 2.; const double tmin = -0.5 * tstep; const unsigned int nbins = 1000; sensor.SetTimeWindow(tmin, tstep, nbins); TCanvas *cDrift=new TCanvas("","",1200,1200); ViewDrift driftview; driftview.SetCanvas(cDrift); // Set up Heed. TrackHeed track; track.SetParticle("electron"); track.SetKineticEnergy(1.e11); track.SetSensor(&sensor); track.EnablePlotting(&driftview); AvalancheMC mc; mc.SetSensor(&sensor); mc.SetDistanceSteps(5e-4); mc.EnableSignalCalculation(); mc.EnablePlotting(&driftview); const double rTrack = 0.3; const double x0 = rTrack; const double y0 = -sqrt(rTube * rTube - rTrack * rTrack); const unsigned int nTracks = 1; int status; double xx,yy,zz,tt,ee,dxx,dyy,dzz; double xx1,yy1,zz1,tt1; for (unsigned int j = 0; j < nTracks; ++j) { sensor.ClearSignal(); track.NewTrack(x0, y0, 0, 0, 0, 1, 0); for (const auto& cluster : track.GetClusters()) { for(int jj=0;jjPrint("drift.png"); TCanvas* cS = new TCanvas("cS", "", 1200, 1200); sensor.PlotSignal("s", cS); cS->Print("signal.png"); app.Run(kTRUE); time_t end=time(0); for(int i=0;i<10;i++)std::cout<<"********************************************"<