Reconfigure the detectors to use global code for the Binary Serializers #116
Replies: 10 comments 35 replies
-
Thanks for thinking through this, @lmalenfant! I agree with your suggestion that we provide a default implementation, so that there is less duplicated code. And, appreciate the POC, as it helps us think concretely about the approach. Browsing the POC, I wonder if there's even more we can do here to simplify implementation. One concern I have is relying on static internal libraries - implementing "internal" detectors should "look just like" implementing detectors from a different assembly. I think we can swing that - I'll do a little work here and provide any feedback/suggestions. Thanks again - long overdue consolidation, on the path to making detectors as "small" as reasonably possible. |
Beta Was this translation helpful? Give feedback.
-
I am under the weather. I'll try to review when I'm feeling better. |
Beta Was this translation helpful? Give feedback.
-
I pulled down the latest code and there are 2 failing unit tests, I had this exact issue, when you are reading the binary, it reads the values from the text file and the Mean is null so you do actually need the value to be maintained in DataArray. This is the reason why I modified the BinaryArraySerializer to accept the IBinaryArray so I could access this value. This data is not available in the detector so was tricky to resolve. I would check the code coverage for the other detector because it might not be covered by tests to show failures there also. |
Beta Was this translation helpful? Give feedback.
-
Hi, I have pulled the latest on the branch and stepped through the code. Looks good! I have a few comments/questions:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for your responses! You mentioned: The last version 3 is the shortest and the first thing I wrote, but I'd worried that maybe it wasn't as easy to understand/duplicate (and it leaves something possibly null - the implementer must remember to filter for non-null cases at the end. |
Beta Was this translation helpful? Give feedback.
-
Would it be okay if I tried implementing it on another detector on your branch? |
Beta Was this translation helpful? Give feedback.
-
I implemented Solution 3 in two new detectors: AOfRhoAndZDetector and ReflectedDynamicMTOfRhoAndSubregionHistDetector. It was very straight-forward to implement and all unit tests pass. I did the second detector because it serializes additional arrays. On the 2nd moment for the additional arrays, I used the "TallySecondMoment ? " preface to all. This could possibly be simplified. |
Beta Was this translation helpful? Give feedback.
-
Once we finalize an implementation, I'd like to volunteer to update the rest of the detectors, since I use the code the most. |
Beta Was this translation helpful? Give feedback.
-
I modified Method3 and pulled the array assignment out of the expression. Code now looks like: If this looks okay, I plan to implement in all detectors. |
Beta Was this translation helpful? Give feedback.
-
This work will continue in issue #112 |
Beta Was this translation helpful? Give feedback.
-
There are currently 72 detectors in the Monte Carlo code and new ones are added periodically, there are currently 2 new detectors being developed. When creating new detectors, the issue is that they are often modelled on an existing detector and a lot of the code get's duplicated. One of the areas of duplication is the array serialization. I am proposing that we make this code parameterizable and then implement it just once for each scenario.
The 72 detectors fall into one of 17 categories:
In general there are 2 binary serializers for each detector and some detectors have additional binary output, these outputs would be supported by one of the 17 categories.
Here is the complete list for each category:
DetectorSerializationTypes.txt
Spike issue #112 Reconfigure the detectors to use global code for the Binary Serializers has a feature branch with a POC for FluenceOfRhoAndZDetector using global parameterized code. To support the serialization of all detectors during the transition, I added ReadDataGeneric in addition to ReadData, this would be changed back to just one Action ReadData once all detectors are implemented.
Beta Was this translation helpful? Give feedback.
All reactions