# Help on Garfield::AvalancheMicroscopic() and AvalancheMC()

**URL:** <https://root-forum.cern.ch/t/help-on-garfield-avalanchemicroscopic-and-avalanchemc/53678>\
**Category:** Garfield++\
**Created:** [February 19, 2023, 1:17pm UTC](https://root-forum.cern.ch/t/help-on-garfield-avalanchemicroscopic-and-avalanchemc/53678 "2023-02-19T13:17:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [February 19, 2023, 1:17pm UTC](https://root-forum.cern.ch/t/help-on-garfield-avalanchemicroscopic-and-avalanchemc/53678/1 "2023-02-19T13:17:47Z")

</div>

Hello,experts!  
Recently I came across some code that made me confused, especially regarding DriftLineRKF(), AvalancheMicroscopic(), and AvalancheMC(). Here are the code and my questions.  
void HeedModel::SetTracking(){  
if(driftRKF){  
fDriftRKF = new Garfield::DriftLineRKF();  
fDriftRKF-\>SetSensor(fSensor);  
fDriftRKF-\>EnableDebugging();  
}  
else if(trackMicro){  
fAvalanche = new Garfield::AvalancheMicroscopic();  
fAvalanche-\>SetSensor(fSensor);  
fAvalanche-\>EnableSignalCalculation();  
}  
else{  
fDrift = new Garfield::AvalancheMC();  
fDrift-\>SetSensor(fSensor);  
fDrift-\>EnableSignalCalculation();  
fDrift-\>SetDistanceSteps(2.e-3);  
if(createAval) fDrift-\>EnableAttachment();  
else fDrift-\>DisableAttachment();  
}  
fTrackHeed = new Garfield::TrackHeed();  
fTrackHeed-\>SetSensor(fSensor);  
fTrackHeed-\>SetParticle(“e-”);  
fTrackHeed-\>EnableDeltaElectronTransport();  
}

1. I’m wondering what are the differences between AvalancheMicroscopic() and AvalancheMC().
2. In what situations should each of these three methods be used?  
3.AvalancheMC() consider EnableAttachment() or DisableAttachment()? When should i consider the attachment，Why the other two methods don 't need to consider attachment?

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [February 19, 2023, 3:04pm UTC](https://root-forum.cern.ch/t/help-on-garfield-avalanchemicroscopic-and-avalanchemc/53678/2 "2023-02-19T15:04:00Z")

</div>

`DriftLineRKF` calculates the path of an electron or ion by numerical integration of the drift velocity vector. In the absence of a magnetic field, the drift lines will follow the electric field lines. The method is well adapted to fields that are smooth, such as analytic potentials. The avalanche growth along a drift line is calculated by integrating the effective Townsend coefficient α - η; or the average gain and shape of the gain distribution can be set explicitly by the user.

`AvalancheMicroscopic` simulates electron trajectories using a “microscopic” Monte Carlo simulation based on the electron-atom/molecule scattering cross-sections. You would use it if you need an accurate simulation of event-by-event fluctuations of the electron signal.

`AvalancheMC`, similarly as `DriftLineRKF`, uses the macroscopic drift velocity as function of the electric field for calculating electron or ion drift lines but adds a random diffusion component to each drift line step. It simulates all electrons in an avalanche individually.

By default, attachment is switched on (enabled) in `AvalancheMC`. You would normally only switch it off for testing purposes. `AvalancheMicroscopic` does consider attachment (you cannot switch it off). `DriftLineRKF` also uses the attachment coefficient for calculating the induced signal and the average effective gain along a drift line.

---

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [February 20, 2023, 1:43am UTC](https://root-forum.cern.ch/t/help-on-garfield-avalanchemicroscopic-and-avalanchemc/53678/3 "2023-02-20T01:43:37Z")

</div>

I got it! Thanks a lot

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [March 6, 2023, 1:44am UTC](https://root-forum.cern.ch/t/help-on-garfield-avalanchemicroscopic-and-avalanchemc/53678/4 "2023-03-06T01:44:11Z")

</div>

Closed on March 6, 2023, 1:44am UTC

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