-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetNumObjects is always 0 for factories created in multifactories #275
Comments
@nathanwbrei will probably want to comment here, but let me at least help hone in on the issue. It is true that in JANA2 the So if the goal is to have
I may also be missing something about multifactory that is the true root of the issue. |
Like David said, GetNumObjects() doesn't trigger Create(). This is very much on purpose -- the main reason we need GetNumObjects() is so we can distinguish between these different cases:
I don't remember exactly why Create() returns void instead of numObjects like JANA1 did, but we could easily change that back without breaking anything. Of the three options David lists, I prefer (2). While you are at it, could you quickly test the following just to make sure there isn't a multifactory bug? for (auto factory: event->GetFactorySet()->GetAllFactories()) {
const std::string &obj_name = factory->GetObjectName(); // F125Cluster
auto obj_num = factory->GetNumObjects(); // (!) <== always 0
auto f125_clusters = event->Get<ml4fpga::fpgacon::F125Cluster>(); // returns 15 objects
obj_num = factory->GetNumObjects(); // SHOULD BE 15 NOW One thing I'm working on right now is improving our handling of missing/optional values from inside OmniFactories and JEventProcessors. If you are around the week I'd love to hear more about your use case for GetNumObjects(). |
I'll check that! For the record, OmniFactories are completely brocken for outside of PodIO... But I create another bug report for that |
Thanks for the heads-up. Go ahead and file the bug report. I was aware that the non-podio template wouldn't even instantiate, but I thought Wouter or Dmitry K. fixed it... No problem, I have a bunch of other small fixes coming on that front |
Yeah, mee too. So I wanted to talk in general of such approach and not about particular small bugs |
Closing this. After looking into it closely, I decided against modifying |
If factory is produced by specifying the output of multifactory its GetNumObjects == 0 all the time. It is better illustrated by this code:
The real problem I am facing behind this bug is that in real events some EVIO information might not exist for some events. This leads to a case when some chain of factories are not producing results. So in upstream Processor I have to check what types are there.
It might be that GetNumObjects is just misleading. GetNumObjects shows always 0 because the factory hasn't produced data yet. One can deduce which absence of EVIO data would lead to which factory chain crashes. But the problem is that upstream Processor should know all implementation details, while by design its just asking the data it needs, right? So how to check that?
The text was updated successfully, but these errors were encountered: