most of the getters in example code on the documentation page: http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch08s05.html are incorrect. Perhaps they are from an older version. For example, G4HCofThisEvent * HCE = evt->get_HCofThisEvent(); should actually be G4HCofThisEvent * HCE = evt->GetHCofThisEvent(); There are several problems like this on this page.
Thank you for your report. Correction to the problems you pointed out will be included in the next version of G4 documents. The new version will be open to public in accordance with the next Geant4 code release. Regards, Katsuya Amako
Corrected text is now online.