Electrons generated inside anode wire during avalanche

Dear experts

I tried to simulate particle passing drift chamber, using AvalancheMC::AvalancheElectrons().
Part of my codes are:

//Setup GeometrySimple(box with gas) and AnalyticField(wires) and sensor...
void simXT::MakeTrack(int nTrack){
        clock_t tStart = clock();
        TrackHeed* track = new TrackHeed();    //Heed++ model
        AvalancheMC* drift = new AvalancheMC();              //Change model here to use MC or microscopic
        ViewCell* cellView = new ViewCell();
        ViewDrift* draw_drift = new ViewDrift();

        track->SetSensor(fSensor_e);
        track->SetParticle(fPrimaryParticle);
        track->SetMomentum(fPrimaryMomentum);


        track->EnableDeltaElectronTransport();       //Enable Secondary ionization
        std::cout<<track->GetEnergy()<<std::endl;

        //Enable field to calculate track trajectory
        double maxrange = 0.;
        double rforstraight = 0.;
        double stepstraight = 0.;
        double stepcurved = 0.;
        track->EnableElectricField();
        track->EnableMagneticField();
        track->GetSteppingLimits(maxrange, rforstraight, stepstraight, stepcurved);
        std::cout<<maxrange<<" "<<rforstraight<<" "<<stepstraight<<" "<<stepcurved<<std::endl;
        stepcurved = 0.02;
        track->SetSteppingLimits(maxrange, rforstraight, stepstraight, stepcurved);

        drift->SetSensor(fSensor_e);
        drift->EnableSignalCalculation();

        //loop over tracks
        for(int i=0; i<nTrack; i++){
                //define track starting point and direction
                double track_x = gRandom->Uniform(-1., 1.);
                double track_y = 1.;
                double track_z = 0.;
                double track_t = 0.;
                double track_dx = gRandom->Uniform(-1., 1.);
                double track_dy = -1.;
                double track_dz = gRandom->Uniform(-1., 1.);
                //Initialize signal
                fSensor_e->ClearSignal();

                //Make new track
                track->NewTrack(track_x, track_y, track_z, track_t, track_dx, track_dy, track_dz);
while(track->GetCluster(xc, yc, zc, tc, nc, ec, extra)){        // Why not use references but normal variables?
                        if(yc<-1.||yc>1.) continue;              //Only use clusters in up/down edge of center cell
                       
                        double del_x, del_y, del_z, del_t;
                        double ke;
                        int i_dummy;
                        double dummy;
                        //loop over electrons in one cluster
                        for(int j=0; j<nc; j++){
                                track->GetElectron(j, del_x, del_y, del_z, del_t, ke, dummy, dummy, dummy);
                               
                                if(del_y<-1.||del_y>1.) continue;       //avoid large cluster that electron exceed up/down edge of cell
                                drift->AvalancheElectron(del_x, del_y, del_z, del_t);
                                size_t ne = drift->GetNumberOfElectronEndpoints();
                                if(ne == 0) continue;            //Situation that electron of cluster is inside field wire       
                                }
                }
}

But I got lots of messages like

AvalancheMC::DriftLine: (0.000370, 0.001194, -0.251615) is not in a valid drift region.

I noticed the position of these electrons are inside the anode wire where I set the wire at (0,0) with radius of 0.00125 mm. Are these electrons caused by previous ones flying into anode wire? I’m not sure if this is normal, if it’s not do I need to add a SolidWire to avoid this (assume SolidWire can fix this…)?

Hello,

Please @hschindl could you answer this one too? Thanks!

After I tried to add SolidWires the message still keep appearing, I wonder what does SolideWire do. So I remain two questions:
1.
Why the warning message keep coming out and how to solve that
2.
If a track passing through a SolidWire with the medium MediumConductor, will it interact with the metal just like Geant4 does (elastic scattering, etc.)? Or it will just stop ionizing inside the metal just like vacuum?

Apologies for the delay in getting back to you.

You don’t need to define any Solids actually when using ComponentAnalyticField. It’s sufficient to call ComponentAnalyticField::SetMedium to define the gas medium in the active region of your chamber.

The fact that you get these messages is strange though. They indeed suggest that there are electrons starting from within the wire which should normally never happen.

Is this still the same code you sent a few days ago?
If possible, could you provide a minimal version of it to help debugging the cause of this issue?

Thank you for the reply, yes it’s the same one and I will try to make a minimal version of this.

But before that I still have a question, though I can set medium (gas) with ComponentAnalyticField, I believe this won’t setup the metal of wires, so my question is still:
If a track passing through a SolidWire with the medium MediumConductor , will it interact with the metal (not the same with gas)? Or it will just stop ionizing inside the metal just like vacuum? Or it will ionize as the same of background medium (gas)?
And, if I set the medium of SolidWire to metal, then set the medium of ComponentAnalyticField to gas, which one will be used?

The track will not interact with the metal, MediumConductor is not an “active”/“ionisable” medium. As I said, you really do not need to add SolidWire objects to your geometry.

Thank you, I see.
And here is the minimal version of my code:
xt_minimal.zip (24.7 KB)

Thanks a lot for the minimal working example! I can reproduce the issue. I’ve not yet managed to track down the cause, but it seems to happen only with the default setting/model of the step size.

As a workaround, can you add a line like

drift.SetDistanceSteps(1.e-4);

to the program to set the step size explicitly?

I also noticed that the average gain is very high. With DriftLineRKF I get a gain of about 106 so if you use AvalancheMC or AvalancheMicroscopic (which both track every single electron in the avalanche) the calculation will take a very long time.
If this is indeed the gain you expect then I would suggest to use DriftLineRKF.

Just to follow-up: the issue should be fixed now:

Thank you for the quick reply and response! I will update now :slight_smile:

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