|Message: confused by hits, hit collections, and sensitive detectors||Not Logged In (login)|
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
I'm struggling with ExN02's treatment of sensitive detectors, hits, and hit collections. Each on their own is clear. The confusion arises from hit collections being a data member of SensitiveDetector sub-class. In this case, ExN02TrackerSD.
I want to process the hits at the end of each event to create "raw data" which are then written out to a file. It seems to me this is best done with UserEventAction sub-class. However, the UserEventAction sub-class needs to know the name of the collection in order to access it. This would suggest the hit collections be created outside of the SensitiveDetector sub-class so information about the collection object can be passed to the UserEventAction sub-class. It seems to me that it is sufficient to pass the collection object to the SensitiveDetector sub-class so it can register the collection object with HCofThisEvent and fill hits into it during the ProcessHits().
But, in the ExN02 example, the hits collection is allocated each time inside the SensitiveDetector's Initialize() method. Is this necessary? It seems to me that what's required per event is that the hits in the collection be deleted (by HCofThisEvent, I guess) and the number of entries in the collection reset to zero. The collection itself does not have to deleted.
If the collection must be allocated and deleted per event, then it makes perfect sense for the collection to be a data member of the sensitive detector. But, how does UserEventAction know about the collection? If 2 separate classes are to know about an object, then that object needs to be promoted outside of either these 2 classes.
My apologies if I sound like I'm splitting hairs. I'm sure it is because I don't quite understand the whole picture. If someone could explain this or assure me that all will be clear in time, I'd appreciate it.
|Inline Depth:||Outline Depth:||Add message:|