Geant4-DNA and G4MoleculeCounter

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-v.11.2.1


Dear friends,

I want to get the location information of Primary radiation product (1 ps). I noticed that such information was included in G4MoleculeCounter, but it was commented out.


void G4MoleculeCounter::AddAMoleculeAtTime(Reactant* molecule,
G4double time,
const G4ThreeVector* /position/,
int number)
{
if (fDontRegister[molecule->GetDefinition()])
{
return;
}

if (fVerbose != 0)
{
    G4cout << "G4MoleculeCounter::AddAMoleculeAtTime : " << molecule->GetName()
           << " at time : " << G4BestUnit(time, "Time") << G4endl;
}

I modified the source code, uncommented the section, and tried to export the location information. But run error: core dump. Is the annotated content not supported? How do I get information about the location of the radicals produced at 1ps?

Best wishes.

Hi,

if you try chem3 example, you can see in ITTrackingAction.cc a function void ITTrackingAction::PreUserTrackingAction(const G4Track* /track).
In the content of this function, do :

  G4cout << "Track ID : " << track->GetTrackID()
         << "\t"
         << "Molecule name : " << GetMolecule(track)->GetName()
         << "\t"
         <<" postion :  "<<track->GetPosition()<<"\t"
         <<"Track time " << G4BestUnit(track->GetGlobalTime(), "Time")
        << " tracking " << G4endl;

Of course, you need uncomment

#include “G4Molecule.hh”
#include “G4Track.hh”
#include “G4UnitsTable.hh”

You can find the position of all species at each time step.