Closed agoose77 closed 7 years ago
The sensitivity can be "mirror:" (assigned in the geometry). In this case the hitType in event action is reverted to mirror so it can pick it in the hit process map.
This mechanism is indeed a bit clunky. It was added to allow recording hit positions for photons bouncing off mirrors.
In gemc 3 the syntax is much less confusing and there are no ambiguities.
Isn't this the hittype though? I'm aware of the mirror mechanism (I'm using it), but IIRC this is not the sensitivity variable.
Yes, it is hittype. I should have said:
The hittype can be "mirror:" (assigned in the geometry). In this case the hitType in event action is reverted to mirror so it can pick it in the hit process map.
In event action the variable "hitType" is used to pick the right digitization routine from the factory map. Alternatively I could add a line in the register:
hitMap["mirror"] = &flux_HitProcess::createHitClass;
hitMap["mirror:"] = &flux_HitProcess::createHitClass;
Which would essentially do the same thing. As I said, this mechanism is far from ideal (was a quick patch) but it is addressed in gemc 3.
Sorry, what I'm saying is that the variable "hitType" should never be "mirror:". It can be "mirror", but the "mirror: mirror_name" syntax is used only for sensitivity.
So, to recap: We search for "mirror:" in sensitivity
And 1. changes the sensitivity to "flux"
But, then https://github.com/gemc/source/blob/master/sensitivity/HitProcess.cc#L13 checks for "mirror:" in the hitType variable. Why does it do this? We should get the mirror name from sensitivity, not hitType?
The same thing here: https://github.com/gemc/source/blob/master/src/MEventAction.cc#L420, we're checking hitType, not sensitivity?
Apologies if i've missed something
Good catch.
I misunderstood the issue. The checks in HitProcess and EventAction are on hitType. That is correct since that's the name (key) in the map<string, HitProcess_Factory> hitMap.
However you are correct:
In both HitProcess and EventAction there is no need of this check. The routine is registered under "mirror", and hitType will never be "mirror:".
Fixed in the repository.
I have since determined why this check was in place:
cad_det_factory.cc:201
and gdml_det_factory.cc:148
both revert the hitType to the sensitivity if it is not given.
best revert this for now @maureeungaro
Agree. Modified in the repository: hitType is not copied anymore, its value must be explicitly requested by user.
Should this condition every be true? The mirror handling is done in
sensitivity
nothitType
, so this should never happen.https://github.com/gemc/source/blob/6d247fb113eb27647e7c8f0063339d59277d4941/src/MEventAction.cc#L420