G4CMP primary particle

Hi,

In the “charge” example of G4CMP, the primary particle is generated inner the detector.
But I want to set the start position outer the detector.
So, I changed a part of “ChargePrimaryGeneratorAction.cc”

before,
particleGun->SetParticlePosition(G4ThreeVector(0.0,0.0,0.0));
after,
particleGun->SetParticlePosition(G4ThreeVector(0.0,0.0,-10.*cm));

But, doesn’t work.
How can I generate the primary particle at out of the detector?

What you wrote should work correctly, assuming that the world volume is larger than ±10 cm in Z.

However, note that the G4CMP charge example generates the G4CMP “drift” particles (conduction-band electrons and holes), not Geant4 electrons, and those particles are created with “almost zero” energy,

particleGun->SetParticleEnergy(1e-6*eV);

Outside of the detector volume (and it’s associated lattice configuration), these particles will be treated by Geant4 as simple charged particles, and with an energy of 1 ueV will be stopped and killed immediately, probably in a single step.

Having said that, the charge example main uses the G4CMPPhysicsList, which does include G4CMPSecondaryProduction process. You could modify the generator to produce some other, regular G4 particle outside the detector, and have that incident particle’s energy deposits in the detector volume create e/h pairs in the detector volume, which G4CMP would then transport as usual.

Following up on this, the G4CMP documentation is clearly poor at best. This kind of thing ought to be documented better, either with a more complete set of examples or with actual user documentation.

I got a hint from your answer.
Thank you for your answer! :slightly_smiling_face: