Dear Garfieldpp experts:
I am doing some numerical calculation of field distortion nearly the TPC detector readout modules edge. I build my simplified model in Comsol and export the field map to Garfiled++, than simulate the drift electron using the AvalancheMicroscopic class.It works very well and can get the result very quickly.
But When I use the neBEM to calculate the electrostastic field(the field results are almost consistent with Comsol ) and simulate the drift electron(also using the AvalancheMicroscopic class), it becomes very slow. Furthermore, when I change AvalancheMicroscopic calss to the DriftLineRKF calss, the speed also improved a lot.
May I ask what is the possible reason?
Here is part of my code:
//Define Sensor
Sensor sensor;
sensor.AddComponent(&neBEM);
sensor.SetArea(-24,-24,0,24,24,20.4);
//Simulate drift electron
ViewDrift driftView;
AvalancheMicroscopic driftElectron;
//DriftLineRKF driftElectron;
driftElectron.SetSensor(&sensor);
//driftElectron.EnableMagneticField();
constexpr int nEvents=1;
constexpr bool plotDrift=false;
double x0,y0,z0,t0(0.),e0(1.);
double x1,y1,z1(0),t1,e1,velocity;
int Stat(1);
for(int i=0;i<nEvents;++i){
if(i%100==0){
std::cout<<i<<" / "<<nEvents<<std::endl;
std::cout<<"===>>>> "<<i<<" zend= "<<z1<<" status "<<Stat<<std::endl;
}
y0=rnd.Uniform(-15,15);x0=-6.75;z0=2.4;
driftElectron.DriftElectron(x0,y0,z0,t0,e0);
//driftElectron.DriftElectron(x0,y0,z0,t0);
driftElectron.GetElectronEndpoint(0,x0,y0,z0,t0,e0,x1,y1,z1,t1,e1,Stat);
//driftElectron.GetEndPoint(x1,y1,z1,t1,Stat);
if(plotDrift) driftElectron.EnablePlotting(&driftView);
}