When using MCTruthAndBkgCat in master on a sample produced in Moore there is unexpected and incorrect behaviour.
Running on an Lb2JpsiLambda sample (15144103), the MC truth information (TRUEID etc) for the reconstructed Lb appears identical to the reconstructed Jpsi.
When running over the same inputs and scripts with lb-run DaVinci/latest ... the MC truth information appears as expected.
Example scripts and files can be found at /eos/user/i/isanders/public_lhcb/MCBkgCatBug
Designs
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related or that one is blocking others.
Learn more.
I also see some unexpected behaviour of the truth persistence. I run with my DaVinci option (attached) over four trigger lines in a loop, for each saving variable information for two muon daughters and the J/psi mother. However, while all reconstructed information as well as the truth information for one of the muons is always saved, in three of four lines the truth information for the other muon as well as the mother is not stored and the background category is set to 60. Running over each of the lines separately leads to all information being stored sucessfully.I saw this issue first with DaVinci/v63r3 and reproduced it with the nightlies and the current master build since.davinci_nightly.py
Interesting @isanders . This change of behaviour is something we ought to catch. In fact we've been discussing on checks on the actual ntuple contents in #94 (closed), and a first stab at this work got done in !822 (merged). I will try and move with more checks in the near future ... And we should understand why the behaviour changed, though it is not that surprising given all changes related to persistency that went in recently. This is again a reminder that tests are super important.
@rowina, maybe you should make a separate issue for the problem you found since a bit different. I had no time yet to dig into your script but it does look reasonably standard, hence something we test (modulo content checks, as said above). Now, why are you only reporting now a problem that you observed with a release from a month ago? Never wait to report, that's appreciated ;-).
I only ran into the problem very recently when I started an Analysis Production using that released version of DaVinci. Until then, the older tuples I had produced worked perfectly well, so I also can't say whether older versions of DaVinci releases have the problem or not, unfortunately.
I did report the problem in the DPA WP3 mattermost channel as soon as I found it (see https://mattermost.web.cern.ch/lhcb/pl/sf4gg9efgtrkbfik3nrnwopo5r), but got distracted by the issue with the warning that turned out to be completely unrelated.
I opened an issue here #100 (closed).
I had a look at the related issue #100 (closed) but so far cannot understand. I will try and post some comments soon ... As for the PIDs in the tables you paste above: it is totally weird that on master the protons and pions are no longer matched to MC and then the Lb is given the same TRUEID as the J/psi, as if the relation tables were no longer found/existing and somehow the functor retrieving the TRUEID given a wrong match! Did you look into this at all, @amathad?
I guess we need to start by running the example with the OutputLevel of MCTruthAndBkgCat set to verbose. I set the option msg_svc_format: str = '% F%60W%S %7W%R%T %0W%M' to be able to see the algo names properly ...
BTW, in my investigations I find it difficult to follow nicely the flow of all printouts from the algos and tools instantiated in MCTruthAndBkgCat. At some point we should revisit them, also to modernise the code to make them functional (I know, not a trivial task!).
The test you suggest might as well wait 1 day for your set of MRs to go in and given that I read earlier today that @nskidmor is producing a new input file. Seems more effective than doing it in parallel the hard way. Now, this cannot explain why the present test jobs we have in DaVinci were giving correct results in the past - files from months back - but no longer now. I could be wrong.
BTW, in the meantime I also had a look at the diffs in Rec and I could not spot anything obvious. Maybe in LHCb indeed ...
@nskidmor, keep us posted for when you have new files. Anyway we said somewhere else - can't remember where - that we need to update several test files. Thanks a lot.
Nicole's new file will only get rid of the warnings. But we don't have any test that tells us if truth matching is done properly in detail. I would suggest @isanders to do the check anyway before we merge LHCb!3963 (merged). The two issues appeared around same time, so likely have the same source.
That's actually not true anymore given the first batch of work I did with !842 (merged). Believe me, I will be very happy to see some of those fail as clearly for now they contain checks of ntuple contents that we know ae not OK ;-). I will finalise that kind of work so that in the future we have more detailed checks on what exactly the ntuples contain as values of key variables. Happy to receive more ideas there, BTW.
Yes, somehow several things happened at the same time. (I'm trying to help but cannot devote all my time right now, unfortunately.)
Sometimes it's not possible to see everything that can go wrong. In this case, there seems to be something not covered by tests. Perhaps @isanders can make a little test out of this once it's resolved.
Ideally this particular issue gets promoted into an additional integration test -- in general, if there is any new issue discovered that is not covered by the existing tests (and as @sesen writes above, this is the case here) it should be turned into a test so that we increase our coverage. Also, it makes diagnosing/fixing the underlying problem a lot easier (as it becomes even more trivial to reproduce)...
You seem to not be reading what I say. I've just said I updated some of the tests to catch these issues, and there is more in the pipeline.
Yes Gerhard I work the way you mention, and for sure the issue reported in the related #100 (closed) needs to be made a test since it runs 4 instances of MC matching where trouble appears, which we did not test at all so far.
If this one here catches something else, we need to add a test as well. In the same vain we also need to duplicate some of the existing tests for data and MC inputs, precisely to increase coverage and be maniac ;-).
Still to be more comprehensive - some tests related to packing-unpacking should be done already in Moore, with Sprucing jobs most likely, as that's the natural dataflow. No need to wait for tupling in DaVinci to see some data is missing or not related OR or ... We all agree we're far from such an ideal situation - there's work to be done.
as long as you made sure to rebuild the code in LHCb, that should have been enough -- so in that case, that MR doesn't fix (as a side-effect) this issue.
can you then also check (after getting rid of the above MR) what happens if you instead use LHCb!3970 (merged)? In that case, there is no need to re-make the input file(s), as the change is to the unpacking only.
I think different input file. I think I was running with a locally saved file for testing (it should be the one commented out in the jOs and might correspond to one of the streaming files but not 100% sure) sorry can’t check today as am doing an outreach event
OK, fine. I went ahead with the latest file. Shame I did not start looking at this MR before looking at #100 (closed) as it seems I got distracted by non-optimal settings that seem not the actual source of troubles.
@graven, the following show some changes and I wonder if your "amalgamation MR in Phys/DaVinciTools got something wrong in there, as it was done post the DaVinci v63r4 release. See the following diff from the first candidate looked at in v63r4 and with the nightlies version:
Version v63r4:
MCTruthAndBkgCatAlg#1 VERBOSE Making relation tablesMCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Added 2 daughtersMCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Level: 1 - inserted 2 daughters to get 2MCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Level 1 of 0 : 2 daughters 1MCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Added 2 daughtersMCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Added 2 daughtersMCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Level: 2 - inserted 4 daughters to get 6MCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Level 2 of 0 : 4 daughters 1MCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Level: 3 - inserted 0 daughters to get 6MCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Level 3 of 0 : 0 daughters 0MCTruthAndBkgCatAlg#1.ParticleDescendants DEBUG Reached 3. Returning 6 daughtersMCTruthAndBkgCatAlg#1 VERBOSE Looping over the flatted vector of a single input particle and its descendantsMCTruthAndBkgCatAlg#1 VERBOSE The particle ID of the input particle (for MC association) is 5122MCTruthAndBkgCatAlg#1.DaVinciSmartAssociator DEBUG The object of type 'KeyedContainer<LHCb::MCParticle,Containers::KeyedObjectManager<Containers::hashmap> >*' could not be retrieved from TS at address 'MC/Particles'MCTruthAndBkgCatAlg#1.DaVinciSmartAssociator DEBUG The object of type 'KeyedContainer<LHCb::MCParticle,Containers::KeyedObjectManager<Containers::hashmap> >*' has been retrieved from TS at address '/Event/HLT2/MC/Particles'MCTruthAndBkgCatAlg#1.DaVinciSmartAssociator VERBOSE Performing smart association on { particleID : LHCb.ParticleID(5122)measuredMass : 6164.29measuredMassErr : 0momentum : (376.8,5758.33,117227,117531)referencePoint : (0.0038,0.1937,-1.1977)momCovMatrix :[ 10689.5 15388.5 520094 521282 15388.5 22521 754712 756435 520094 754712 2.54985e+07 2.55567e+07 521282 756435 2.55567e+07 2.5615e+07 ]posCovMatrix :[ 0.00016641 9.76238e-06 9.71401e-05 9.76238e-06 0.00087616 0.00709164 9.71401e-05 0.00709164 0.070969 ]posMomCovMatrix :[ -0.0527984 -0.00822821 -0.0829877 -0.001739 -0.0853968 -0.33194 0.0109584 -0.0162401 -0.237089 0.011008 -0.016793 -0.198156 ]extraInfo : [ ]TES=/Event/HLT2/Hlt2Lb2JpsiLambda/Particles }MCTruthAndBkgCatAlg#1.DaVinciSmartAssociator VERBOSE Associating a composite particle with pid = 5122
Nightlies:
MCTruthAndBkgCatAlg#1 VERBOSE Making relation tablesMCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Added 2 daughtersMCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Level: 1 - inserted 2 daughters to get 2MCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Level 1 of 0 : 2 daughters 1MCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Added 2 daughtersMCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Level: 2 - inserted 2 daughters to get 4MCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Level 2 of 0 : 2 daughters 1MCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Level: 3 - inserted 0 daughters to get 4MCTruthAndBkgCatAlg#1.ParticleDescendants VERBOSE Level 3 of 0 : 0 daughters 0MCTruthAndBkgCatAlg#1.ParticleDescendants DEBUG Reached 3. Returning 4 daughtersMCTruthAndBkgCatAlg#1 VERBOSE Looping over the flatted vector of a single input particle and its descendantsMCTruthAndBkgCatAlg#1 VERBOSE The particle ID of the input particle (for MC association) is 5122MCTruthAndBkgCatAlg#1.DaVinciSmartAssociator DEBUG The object of type 'KeyedContainer<LHCb::MCParticle,Containers::KeyedObjectManager<Containers::hashmap> >*' could not be retrieved from TS at address 'MC/Particles'MCTruthAndBkgCatAlg#1.DaVinciSmartAssociator DEBUG The object of type 'KeyedContainer<LHCb::MCParticle,Containers::KeyedObjectManager<Containers::hashmap> >*' has been retrieved from TS at address '/Event/HLT2/MC/Particles'MCTruthAndBkgCatAlg#1.DaVinciSmartAssociator VERBOSE Performing smart association on { particleID : LHCb.ParticleID(5122)measuredMass : 6164.29measuredMassErr : 0momentum : (376.8,5758.33,117227,117531)referencePoint : (0.0038,0.1937,-1.1977)momCovMatrix :[ 10689.5 15388.5 520094 521282 15388.5 22521 754712 756435 520094 754712 2.54985e+07 2.55567e+07 521282 756435 2.55567e+07 2.5615e+07 ]posCovMatrix :[ 0.00016641 9.76238e-06 9.71401e-05 9.76238e-06 0.00087616 0.00709164 9.71401e-05 0.00709164 0.070969 ]posMomCovMatrix :[ -0.0527984 -0.00822821 -0.0829877 -0.001739 -0.0853968 -0.33194 0.0109584 -0.0162401 -0.237089 0.011008 -0.016793 -0.198156 ]extraInfo : [ ]TES=/Event/HLT2/Hlt2Lb2JpsiLambda/Particles }MCTruthAndBkgCatAlg#1.DaVinciSmartAssociator VERBOSE Associating a composite particle with pid = 5122
In short the descendants algo in the tagged release finds the 2 immediate daughters and then their 2+2 daughters but that does not happen with master.
I had no time to dive more but any first thoughts?
Gerhard, I already replied on that above, twice. Note that the code we're talking about never had tests since years and years! Not my fault. I'm actually working these days on improving the situation, though I have no authorship or responsibility for the code ;-).
I will anyway look into your MR on the amalgamation ... Thanks for your help.
I forgot to day - I will make your reproducer a DaVinciTest unless you do it yourself. Let me know if you @isanders get to it to avoid duplication of work.
In any case could you make available to me the previous test files comment out at