Ion from photoeffect

Greetings! How to detect which element gamma quanta affect in photo effect process on? I have an G4_AIR, therefore there is many variants to choose.

If i have had pick random element, electron energy deposition would be different besed on subshell and would not match this element.

as no one helped, i did little research by myself.

After all i couldn’t find the method supposed to save current photo induced ion( i suppose it has to be saved in fcurrentElement, but G4LivermorePhotoElectricModel::SimpleSacondadires() didn’t save to it. So i did small ivory tower as like this:

wrote in the end of G4LivermorePhotoElectricModel::SimpleSacondadires():

  std::ofstream writer("/home/.../dat.dat", std::iostream::app);
  G4ThreeVector ionMom = aDynamicGamma->GetMomentum();
for(G4DynamicParticle* elec : *fvect){
      ion.Mom -= elec->GetMomentum();
  writer << elm->GetName() << " " << Z - fvect->size() << " " << ionMom.x() 
                                                       << " " << ionMom.y() 
                                                       << " " << ionMom.z();

to get Ion name, ionisation level(if deexcitation flag on, it could be different), ion momentum. However, it’s impossible to get position. Therefore, little injection in UserSteppingAction() method:

const std::vector<const G4Track*>* secondary
                                                      = step->GetSecondaryInCurrentStep();
                    if (secondary){
                        int i = 0;
                        for(const G4Track* sec : *secondary){
                            if(sec->GetCreatorProcess()->GetProcessName() == "phot"){
                                std::ofstream writer("dat.dat", std::iostream::app);
                                if(i == 0){
                                    writer << " " << sec->GetPosition().x()
                                           << " " << sec->GetPosition().y()
                                           << " " << sec->GetPosition().z() << std::endl;

I think it could be implemented somehow in Geant4 as its a some probability to interact with molecular dynamics.