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!
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;
}
}