G4Allocator in Custom Hit Class

Hi,

I am trying to finish writing a hit class that gathers information from stepping action on location of interaction energy and particle momentum, however I have defined a memory allocation object with parameters
extern G4ThreadLocal however it is not being found in my sensitive detector class resulting in a subsequent compilation error of “undefined reference to (myObject)”.

Any ideas on how to address this problem would be very much appreciated.

You have to have the statement “extern G4Threadlocal x” in global scope (i.e., at the top) of all files that use it, except in one file you leave out the word “extern” so that it has an actual place in memory.

1 Like

Hi John,
Firstly thank you for your reply all this time later.

My initial question concerning compilation has been fixed I believe, however I am getting a segmentation fault now when I attempt to fill a ntuple in EventAction:EndOfEventAction.

I am not sure if the two questions are related however debugging statements suggests GetcollectionID is obtaining the correct collection, however it fails to fill the ntuple and simply seg faults. Prior to this the last action taken is to dynamic_cast the collectionId with the hit collection class I derived in a custom hit class.

Are there any common themes that one may look for, on such errors? Or perhaps I should create a new topic to discuss?
Best Regards