The position of radicals over time

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:_Geant4_11.2.1
_Operating System:_Linux


Dear Friends,

How should I get the position of radicals over time? In other words, how should I get the position distribution of radicals at any time?

Best Wishes.

Dear,

Can get this info from TimeStepAction:

void TimeStepAction::UserPostTimeStepAction()
{
  if (G4Scheduler::Instance()->GetGlobalTime() > 1 * ps) {
    G4cout << "_________________" << G4endl;
    G4cout << "At : " << G4BestUnit(G4Scheduler::Instance()->GetGlobalTime(), "Time") << G4endl;

    auto species = G4MoleculeTable::Instance()->GetConfiguration("°OH");
    PrintSpecieInfo(species);
  }
}

with

void TimeStepAction::PrintSpecieInfo(G4MolecularConfiguration* molconf)
{
  // this function shows how to get a specific species ID, positions at each time step.
  auto moleculeID = molconf->GetMoleculeID();
  const G4String& moleculeName = molconf->GetFormatedName();
  G4cout << "Get inf of : " << moleculeName << G4endl;
  auto trackList = G4ITTrackHolder::Instance()->GetMainList(moleculeID);

  if (trackList == nullptr) {
    G4cout << "No species" << G4endl;
    return;
  }
  G4TrackList::iterator it = trackList->begin();
  G4TrackList::iterator end = trackList->end();
  for (; it != end; ++it) {
    auto track = *it;
    G4cout << "TrackID: " << track->GetTrackID() << "  position : " << track->GetPosition() / nm
           << G4endl;
  }
}