From 6350aad03d92424f6dc4d6457de74bc5c1fa24e0 Mon Sep 17 00:00:00 2001 From: Jennifer Zonneveld Date: Mon, 13 Jun 2016 11:45:19 +0200 Subject: [PATCH 1/3] work impactkit --- contrib-05-PersistReco/PersistReco.md | 44 +++++++++++++++++++++++++ contrib-05-PersistReco/PersistReco.yaml | 4 +++ 2 files changed, 48 insertions(+) create mode 100755 contrib-05-PersistReco/PersistReco.md create mode 100644 contrib-05-PersistReco/PersistReco.yaml diff --git a/contrib-05-PersistReco/PersistReco.md b/contrib-05-PersistReco/PersistReco.md new file mode 100755 index 0000000..27d914c --- /dev/null +++ b/contrib-05-PersistReco/PersistReco.md @@ -0,0 +1,44 @@ +The PersistReco flag available in Turbo stream HLT2 lines allows all the reconstructed objects in an event to be saved to disk, rather than the usual behaviour of saving only the selected candidate. The objects can then be used in DaVinci just like in the stripping. This is useful when one wants to do things like spectroscopy studies, where there may be many final states of interesting that re-use the same ground state particle. Today, there is a bug that can cause the same underlying particle object to be used multiple times when building a decay. + + +The function CombineParticles()::checkOverlap() normally ensures this does not happen. The code "Phys/DaVinciOverlapsAndClones/src/CheckOverlap.cpp", which contains this function has been modified, so that no more duplicates will be used even in the case of objects from different locations. + +```C++ +//=========================================================================== +// Check duplicate entries +//=========================================================================== +bool CheckOverlap::searchOverlap( std::vector & proto ) +{ + if (msgLevel(MSG::VERBOSE)) verbose() << "searchOverlap(protos)" << endmsg ; + // It its a simple particle made from protoparticle. Check. + + for (std::vector::const_iterator i = proto.begin(); + i != proto.end() ; ++i) + { + for (std::vector::const_iterator j = i ; + j != proto.end(); ++j) + { + if (j==i) continue ; + if ( *i==*j ) + { + if (msgLevel(MSG::VERBOSE)) verbose() << "Found overlap " << *i << endmsg ; + return true ; + } + else { + const std::vector i_ids = (*i)->track()->lhcbIDs(); + const std::vector j_ids = (*j)->track()->lhcbIDs(); + std::vector diff; + std::set_symmetric_difference(i_ids.begin(), i_ids.end(), j_ids.begin(), j_ids.end(), std::back_inserter(diff)); + + if (std::all_of(diff.begin(), diff.end(), [] (LHCb::LHCbID id) { return id.isCalo(); } )) + { + if (msgLevel(MSG::VERBOSE)) verbose() << "Found overlap using LHCb IDs, ignoring isCalo IDs" << *i << endmsg ; + return true; + } + } + } + } + if (msgLevel(MSG::VERBOSE)) verbose() << "Found no overlap" << endmsg ; + return false; +} +``` diff --git a/contrib-05-PersistReco/PersistReco.yaml b/contrib-05-PersistReco/PersistReco.yaml new file mode 100644 index 0000000..7386b7f --- /dev/null +++ b/contrib-05-PersistReco/PersistReco.yaml @@ -0,0 +1,4 @@ +--- +title: PersistReco +author: Andreas Weiden, Jennifer Zonneveld, Wojciech Krupa +... From 32c5e2edf3175b7771b1ec8c7502aab2269fb209 Mon Sep 17 00:00:00 2001 From: jenniferzon Date: Fri, 22 Jul 2016 14:48:35 +0200 Subject: [PATCH 2/3] Update PersistReco.md --- contrib-05-PersistReco/PersistReco.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib-05-PersistReco/PersistReco.md b/contrib-05-PersistReco/PersistReco.md index 27d914c..5a9039c 100755 --- a/contrib-05-PersistReco/PersistReco.md +++ b/contrib-05-PersistReco/PersistReco.md @@ -1,4 +1,4 @@ -The PersistReco flag available in Turbo stream HLT2 lines allows all the reconstructed objects in an event to be saved to disk, rather than the usual behaviour of saving only the selected candidate. The objects can then be used in DaVinci just like in the stripping. This is useful when one wants to do things like spectroscopy studies, where there may be many final states of interesting that re-use the same ground state particle. Today, there is a bug that can cause the same underlying particle object to be used multiple times when building a decay. +The PersistReco flag available in Turbo stream HLT2 lines allows all the reconstructed objects in an event to be saved to disk, rather than the usual behaviour of saving only the selected candidate. The objects can then be used in DaVinci just like in the stripping. This is useful when one wants to do things like spectroscopy studies, where there may be many final states of interesting that re-use the same ground state particle. Today, there is a bug that can cause the same underlying particle object to be used multiple times when building a decay. For example, if one takes a D0 → K-π+ candidate that fired an HLT2 line, and adds a pion from PersistReco, it is possible to end up with D0 π candidates where the pion from the D0 is also used as the bachelor. This behaviour should not occur, as it is not physical and is not useful for analysis, and can even give spurious physics results. The function CombineParticles()::checkOverlap() normally ensures this does not happen. The code "Phys/DaVinciOverlapsAndClones/src/CheckOverlap.cpp", which contains this function has been modified, so that no more duplicates will be used even in the case of objects from different locations. From 9d67f29f2b487e5399a9283aeef700f6df2ba479 Mon Sep 17 00:00:00 2001 From: jenniferzon Date: Fri, 22 Jul 2016 15:07:12 +0200 Subject: [PATCH 3/3] Update PersistReco.md --- contrib-05-PersistReco/PersistReco.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib-05-PersistReco/PersistReco.md b/contrib-05-PersistReco/PersistReco.md index 5a9039c..cd2c17f 100755 --- a/contrib-05-PersistReco/PersistReco.md +++ b/contrib-05-PersistReco/PersistReco.md @@ -1,7 +1,8 @@ The PersistReco flag available in Turbo stream HLT2 lines allows all the reconstructed objects in an event to be saved to disk, rather than the usual behaviour of saving only the selected candidate. The objects can then be used in DaVinci just like in the stripping. This is useful when one wants to do things like spectroscopy studies, where there may be many final states of interesting that re-use the same ground state particle. Today, there is a bug that can cause the same underlying particle object to be used multiple times when building a decay. For example, if one takes a D0 → K-π+ candidate that fired an HLT2 line, and adds a pion from PersistReco, it is possible to end up with D0 π candidates where the pion from the D0 is also used as the bachelor. This behaviour should not occur, as it is not physical and is not useful for analysis, and can even give spurious physics results. - -The function CombineParticles()::checkOverlap() normally ensures this does not happen. The code "Phys/DaVinciOverlapsAndClones/src/CheckOverlap.cpp", which contains this function has been modified, so that no more duplicates will be used even in the case of objects from different locations. +We had a look at the CombineParticles() function to see where the overlap could be caused. There we found out that +the function CombineParticles()::checkOverlap() normally ensures this does not happen. However, objects were cloned and +saved at a new memory address, so that the same particles could be used again leading to unphysical situations. As each object has its own lhcbID, based on this a more thorough check can prevent any duplicates. The else statement below was added to the code "Phys/DaVinciOverlapsAndClones/src/CheckOverlap.cpp", in which the lhcbID check is done. ```C++ //===========================================================================