Logic Volume coordinates

Hi All,

I have an array of fibers, namely Fiber_0 to Fiber_199. In my code I use as unique identifier the number that appears in the Fiber name. But, If I wanted to retrieve the fiber coordinates and use them (or only one of them) as unique identifier, what would I do?

In your SD, you have access to the both the exact coordinates of the hit (G4Step::GetPostStepPoint()) as well as the placement volume (via G4Touchable). So you can get the coordinates that way.

If you place your fibers assigning a copy number that matches the string in the name, then you can get that copy number (rather than chopping up the volume name).

If I were doing it, I’d continue as you are using the volume name or copy number as the abstract “unique identifier,” but also include the coordinates of the hit in your output. That way, at analysis time you know which fiber was hit, and you can also do studies like “are there hotspots along the fiber?” or “is the efficiency dependent upon location?”

Hi @mkelsey ,

Thanks. So, if I understood correctly, I can add in the SD class a cout line in the code to print the coordinates. Right?

Sorry if the question sounds stupid, but I’m newer to geant and it’s the first time I use it to manage a complex code.

Cheers

That you certainly can do. Do you just want to dump the coordinates to your log file? Simple cout (but use G4cout and G4endl!) will get you that. Or do you want them available in your ROOT output to use with your analysis? If so, then you should modify the code you’re using to fill your ROOT N-tuple to include the coordinates as new branches.

Thank you!

So, If I want simply to use cout, what is the best class where I can add the proper code lines? Is the SD class right?

Yes, in your SD – don’t bother changing the Geant4 base class, that won’t do anything useful for you.