Skip to content
Snippets Groups Projects
Commit aa5fc793 authored by Miroslav Saur's avatar Miroslav Saur
Browse files

Merge branch 'cherry-pick-14c6805a' into 'v36r12p3-patches'

Merge branch 'decianm-AdditionalMuonHitsForMatching' into 'v36r12p3-patches'

See merge request !4208
parents b2152fad 490b80ae
No related branches found
No related tags found
1 merge request!4208Merge branch 'decianm-AdditionalMuonHitsForMatching' into 'v36r12p3-patches'
Pipeline #9751003 passed
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
\*****************************************************************************/ \*****************************************************************************/
#include "Event/Particle.h" #include "Event/Particle.h"
#include "Event/PrHits.h"
#include "Kernel/HashIDs.h" #include "Kernel/HashIDs.h"
#include "Kernel/LHCbID.h" #include "Kernel/LHCbID.h"
#include "LHCbAlgs/Transformer.h" #include "LHCbAlgs/Transformer.h"
...@@ -25,15 +26,18 @@ ...@@ -25,15 +26,18 @@
class MuonProbeToLongMatcher class MuonProbeToLongMatcher
: public LHCb::Algorithm::MultiTransformerFilter<std::tuple<LHCb::Particle::Selection, LHCb::Particle::Selection>( : public LHCb::Algorithm::MultiTransformerFilter<std::tuple<LHCb::Particle::Selection, LHCb::Particle::Selection>(
LHCb::Particle::Range const&, LHCb::Particle::Range const& )> { LHCb::Particle::Range const&, LHCb::Particle::Range const&, MuonHitContainer const& )> {
public: public:
MuonProbeToLongMatcher( const std::string& name, ISvcLocator* pSvcLocator ); MuonProbeToLongMatcher( const std::string& name, ISvcLocator* pSvcLocator );
std::tuple<bool, LHCb::Particle::Selection, LHCb::Particle::Selection> std::tuple<bool, LHCb::Particle::Selection, LHCb::Particle::Selection>
operator()( LHCb::Particle::Range const& composites, LHCb::Particle::Range const& longparts ) const override; operator()( LHCb::Particle::Range const& composites, LHCb::Particle::Range const& longparts,
MuonHitContainer const& ) const override;
private: private:
void addNeighbouringMuonIDs( std::vector<LHCb::LHCbID>& muonIDs, const MuonHitContainer& muonHits ) const;
// properties are members of the class // properties are members of the class
// need to specify owner, name, default value, doc // need to specify owner, name, default value, doc
Gaudi::Property<double> m_thresMuon{this, "MinMuonFrac", 0.4}; // overlap threshold of Muon stations Gaudi::Property<double> m_thresMuon{this, "MinMuonFrac", 0.4}; // overlap threshold of Muon stations
...@@ -46,6 +50,8 @@ private: ...@@ -46,6 +50,8 @@ private:
Gaudi::Property<bool> p_checkUT{this, "checkUT", false}; Gaudi::Property<bool> p_checkUT{this, "checkUT", false};
Gaudi::Property<bool> p_checkFT{this, "checkFT", false}; Gaudi::Property<bool> p_checkFT{this, "checkFT", false};
Gaudi::Property<bool> p_addNeighbouringMuonHits{this, "addNeighbouringMuonHits", false};
mutable Gaudi::Accumulators::StatCounter<unsigned int> m_all{this, "#Input composites"}; // Number of JPsi candidates mutable Gaudi::Accumulators::StatCounter<unsigned int> m_all{this, "#Input composites"}; // Number of JPsi candidates
mutable Gaudi::Accumulators::StatCounter<unsigned int> m_matched{ mutable Gaudi::Accumulators::StatCounter<unsigned int> m_matched{
this, "#Matched composites"}; // Number of JPsi candidates with a matched probe track this, "#Matched composites"}; // Number of JPsi candidates with a matched probe track
...@@ -59,12 +65,36 @@ DECLARE_COMPONENT( MuonProbeToLongMatcher ) ...@@ -59,12 +65,36 @@ DECLARE_COMPONENT( MuonProbeToLongMatcher )
// Implementation // Implementation
MuonProbeToLongMatcher::MuonProbeToLongMatcher( const std::string& name, ISvcLocator* pSvcLocator ) MuonProbeToLongMatcher::MuonProbeToLongMatcher( const std::string& name, ISvcLocator* pSvcLocator )
: MultiTransformerFilter( name, pSvcLocator, {KeyValue{"TwoBodyComposites", ""}, KeyValue{"LongTracks", ""}}, : MultiTransformerFilter(
{KeyValue{"MatchedComposites", ""}, KeyValue{"MatchedLongTracks", ""}} ) {} name, pSvcLocator,
{KeyValue{"TwoBodyComposites", ""}, KeyValue{"LongTracks", ""}, KeyValue{"MuonHitContainer", ""}},
{KeyValue{"MatchedComposites", ""}, KeyValue{"MatchedLongTracks", ""}} ) {}
void MuonProbeToLongMatcher::addNeighbouringMuonIDs( std::vector<LHCb::LHCbID>& muonIDs,
const MuonHitContainer& muonHits ) const {
const auto muonIDsToLoop = muonIDs;
for ( auto id : muonIDsToLoop ) {
auto tileID = id.muonID();
const auto station = tileID.station();
auto hits = muonHits.hits( station );
for ( auto const& hit : hits ) {
// -- Add hits which are identical in X but neighbouring in Y, or vide versa
if ( ( (int)hit.tile().nX() == (int)tileID.nX() && std::abs( (int)hit.tile().nY() - (int)tileID.nY() ) == 1 ) ||
( (int)hit.tile().nY() == (int)tileID.nY() && std::abs( (int)hit.tile().nX() - (int)tileID.nX() ) == 1 ) ) {
muonIDs.push_back( LHCb::LHCbID( hit.tile() ) );
}
}
}
std::sort( muonIDs.begin(), muonIDs.end() );
}
std::tuple<bool, LHCb::Particle::Selection, LHCb::Particle::Selection> MuonProbeToLongMatcher:: std::tuple<bool, LHCb::Particle::Selection, LHCb::Particle::Selection> MuonProbeToLongMatcher::
operator() // we use a mulitransformer to define multiple outputs operator() // we use a mulitransformer to define multiple outputs
( LHCb::Particle::Range const& composites, LHCb::Particle::Range const& longparts ) const { ( LHCb::Particle::Range const& composites, LHCb::Particle::Range const& longparts,
MuonHitContainer const& muonhits ) const {
// initialize counter // initialize counter
m_all += composites.size(); m_all += composites.size();
...@@ -121,6 +151,7 @@ std::tuple<bool, LHCb::Particle::Selection, LHCb::Particle::Selection> MuonProbe ...@@ -121,6 +151,7 @@ std::tuple<bool, LHCb::Particle::Selection, LHCb::Particle::Selection> MuonProbe
std::vector<LHCb::LHCbID> longmuonids; std::vector<LHCb::LHCbID> longmuonids;
longmuonids.reserve( 10 ); longmuonids.reserve( 10 );
LHCb::HashIDs::lhcbIDs( longmuonpid, longmuonids ); LHCb::HashIDs::lhcbIDs( longmuonpid, longmuonids );
if ( p_addNeighbouringMuonHits ) addNeighbouringMuonIDs( longmuonids, muonhits );
// evaluate the overlap // evaluate the overlap
std::pair<double, double> fracVP( 0., 0. ), fracUT( 0., 0. ), fracFT( 0., 0. ), fracMuon( 0., 0. ); std::pair<double, double> fracVP( 0., 0. ), fracUT( 0., 0. ), fracFT( 0., 0. ), fracMuon( 0., 0. );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment