ATLAS Offline Software
Loading...
Searching...
No Matches
MuonMatchingTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGMUONMONITORING_MUONMATCHINGTOOL_H
6#define TRIGMUONMONITORING_MUONMATCHINGTOOL_H
7
18#include "GaudiKernel/SystemOfUnits.h"
19#include <string>
20#include <memory>
21#include <tuple>
23
24
30
31 public:
32 MuonMatchingTool(const std::string& type, const std::string &name, const IInterface* parent);
33
34 virtual StatusCode initialize() override;
35
43 const xAOD::MuonRoI* matchL1(const xAOD::Muon *mu, const std::string& trigger, bool &pass) const;
44
52 const xAOD::MuonRoI* matchL1(const xAOD::TruthParticle *mu, const std::string& trigger, bool &pass) const;
53
63 const xAOD::MuonRoI* matchL1(double eta, double phi, double dR, const std::string& trigger, bool &pass) const;
64
73 const xAOD::L2StandAloneMuon* matchL2SA(const xAOD::Muon *mu, const std::string& trigger, bool &pass) const;
74
85
91 const xAOD::L2StandAloneMuon* matchL2SAReadHandle(const EventContext& ctx, const xAOD::Muon *mu) const;
92
101 const xAOD::L2CombinedMuon* matchL2CB(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
102
113
119 const xAOD::L2CombinedMuon* matchL2CBReadHandle(const EventContext& ctx, const xAOD::Muon *mu) const;
120
129 const xAOD::Muon* matchEFSA(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
130
139 const xAOD::Muon* matchEFSA(const xAOD::TruthParticle *mu, std::string trigger, bool &pass) const;
140
149
155 const xAOD::Muon* matchEFSAReadHandle(const EventContext& ctx, const xAOD::Muon *mu) const;
156
165 const xAOD::Muon* matchEFCB(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
166
175 const xAOD::Muon* matchEFCB(const xAOD::TruthParticle *mu, std::string trig, bool &pass) const;
176
185
191 const xAOD::Muon* matchEFCBReadHandle(const EventContext& ctx, const xAOD::Muon *mu) const;
192
201 const xAOD::Muon* matchEFSAFS(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
210 const xAOD::Muon* matchEFSAFS(const xAOD::TruthParticle *mu, std::string trigger, bool &pass) const;
211
220
226 const xAOD::Muon* matchEFSAFSReadHandle(const EventContext& ctx, const xAOD::Muon *mu) const;
227
236 const xAOD::Muon* matchEFCBFS(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
237
246 const xAOD::Muon* matchEFCBFS(const xAOD::TruthParticle *mu, std::string trig, bool &pass) const;
247
256
262 const xAOD::Muon* matchEFCBFSReadHandle(const EventContext& ctx, const xAOD::Muon *mu) const;
263
272 const xAOD::Muon* matchEFIso(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
273
282 const xAOD::Muon* matchEFIso(const xAOD::TruthParticle *mu, std::string trigger, bool &pass) const;
283
292
293
301 const xAOD::TrackParticle* SearchEFTrack(const EventContext &ctx, const TrigCompositeUtils::LinkInfo<xAOD::MuonContainer>& muLinkInfo, const SG::ReadHandleKey<xAOD::TrackParticleContainer>& ReadHandleKey) const;
302
303
310 const xAOD::Muon* matchL2SAtoOff(const EventContext& ctx, const xAOD::L2StandAloneMuon* samu) const;
311
318 const xAOD::Muon* matchL2CBtoOff(const EventContext& ctx, const xAOD::L2CombinedMuon* cbmu) const;
319
320
321 bool isMatchedL2SA(const xAOD::L2StandAloneMuon*, const xAOD::Muon*) const;
322 bool isMatchedL2CB(const xAOD::L2CombinedMuon*, const xAOD::Muon*) const;
323 bool isMatchedL2InsideOut(const xAOD::L2CombinedMuon*, const xAOD::Muon*) const;
324
334
341 static double reqdRL1byPt(double mupt);
342
343
344 static std::tuple<bool,double,double> trigPosForMatchSATrack(const xAOD::Muon *mu);
345 static std::tuple<bool,double,double> trigPosForMatchCBTrack(const xAOD::Muon *mu);
346 static std::tuple<bool,double,double> PosForMatchSATrack(const xAOD::Muon *mu);
347 static std::tuple<bool,double,double> PosForMatchCBTrack(const xAOD::Muon *mu);
348
349
350 private:
351
353 int L1ItemStringToInt(const std::string& l1item, int roiSource) const {
354 if( "L1_MU3V"==l1item) return roiSource==0 ? L1Items::L1B_MU3V : L1Items::L1E_MU3V;
355 if( "L1_MU5VF"==l1item) return roiSource==0 ? L1Items::L1B_MU5VF : L1Items::L1E_MU5VF;
356 if( "L1_MU8F"==l1item) return roiSource==0 ? L1Items::L1B_MU8F : L1Items::L1E_MU8F;
357 if( "L1_MU14FCH"==l1item) return roiSource==0 ? L1Items::L1B_MU14FCH : L1Items::L1E_MU14FCH;
358 if( "L1_MU14FCHR"==l1item) return roiSource==0 ? L1Items::L1B_MU14FCHR : L1Items::L1E_MU14FCHR;
359 return L1Items::ERROR;
360 }
361
362 const float m_L2SAreqdR = 0.25;
363 const float m_L2CBreqdR = 0.03;
364 const float m_L2InsideOutreqdR = 0.01;
365 const float m_EFreqdR = 0.03;
366
367 // private methods
379 template<class T, class OFFL> const T* matchReadHandle(const OFFL* offl, float reqdR,
380 SG::ReadHandleKey<DataVector<T> > ReadHandleKey, const EventContext& ctx,
381 std::tuple<bool,double,double> (*trigPosForMatchFunc)(const T*) = &MuonMatchingTool::trigPosForMatch<T>) const;
382
383
394 template<class T, class OFFL>
395 const TrigCompositeUtils::LinkInfo<DataVector<T> > matchLinkInfo(const OFFL *offl, std::string trigger, float reqdR, bool &pass,
396 const std::string& containerSGKey = "",
397 std::tuple<bool,double,double> (*trigPosForMatchFunc)(const T*) = &MuonMatchingTool::trigPosForMatch<T>) const;
398
411 template<class T, class OFFL> const T* match(const OFFL *offl, std::string trigger, float reqdR, bool &pass,
412 const std::string& containerSGKey = "",
413 std::tuple<bool,double,double> (*trigPosForMatchFunc)(const T*) = &MuonMatchingTool::trigPosForMatch<T>) const;
414
426 template<class T> const xAOD::Muon* matchOff(const EventContext& ctx, const T* trig, float reqdR,
427 std::tuple<bool,double,double> (*offlinePosForMatchFunc)(const xAOD::Muon*),
428 std::tuple<bool,double,double> (*trigPosForMatchFunc)(const T*) = &MuonMatchingTool::trigPosForMatch<T>) const;
429
430
431 const Amg::Vector3D offlineMuonAtPivot(const xAOD::Muon *mu) const;
432 static double FermiFunction(double x, double x0, double w) ;
433 const Trk::TrackParameters* extTrackToTGC(const xAOD::TrackParticle *track) const;
434 const Trk::TrackParameters* extTrackToRPC(const xAOD::TrackParticle *track) const;
435
436 // static methods
437 // Template methods that perform different matching schemes for T=xAOD::L2StandAloneMuon, xAOD::L2CombinedMuon and xAOD::Muon (EF).
438 template<class T> static inline std::tuple<bool,double,double> trigPosForMatch(const T *trig);
439
440 SG::ReadHandleKey<xAOD::MuonRoIContainer> m_MuonRoIContainerKey {this, "MuonRoIContainerName", "LVL1MuonRoIs", "Level 1 muon container"};
441 SG::ReadHandleKey<xAOD::MuonContainer> m_MuonContainerKey {this, "MuonContainerName", "Muons", "Offline muon container"};
442 SG::ReadHandleKey<xAOD::L2StandAloneMuonContainer> m_L2MuonSAContainerKey {this, "L2StandAloneMuonContainerName", "HLT_MuonL2SAInfo", "L2MuonSA container"};
443 SG::ReadHandleKey<xAOD::L2CombinedMuonContainer> m_L2muCombContainerKey {this, "L2CombinedMuonContainerName", "HLT_MuonL2CBInfo", "L2muComb container"};
444 SG::ReadHandleKey<xAOD::MuonContainer> m_EFSAMuonContainerKey {this, "EFSAMuonContainerName", "HLT_Muons_RoI", "EFSAMuon container"};
445 SG::ReadHandleKey<xAOD::MuonContainer> m_EFCBMuonContainerKey {this, "EFCBMuonContainerName", "HLT_MuonsCB_RoI", "EFCBMuon container"};
446 SG::ReadHandleKey<xAOD::MuonContainer> m_EFSAFSMuonContainerKey {this, "EFSAFSMuonContainerName", "HLT_Muons_FS", "EFSAFSMuon container"};
447 SG::ReadHandleKey<xAOD::MuonContainer> m_EFCBFSMuonContainerKey {this, "EFCBFSMuonContainerName", "HLT_MuonsCB_FS", "EFCBFSMuon container"};
448 SG::ReadHandleKey<xAOD::TrackParticleContainer> m_MStrackContainerKey {this, "ExtrapolatedMStrackConntainner", "HLT_MSExtrapolatedMuons_RoITrackParticles", "ExtrapolatedMuons track container"};
449 SG::ReadHandleKey<xAOD::TrackParticleContainer> m_CBtrackContainerKey {this, "CBtrackContainerName", "HLT_CBCombinedMuon_RoITrackParticles", "CombinedMuon track container"};
450
451 // properties
452 Gaudi::Property<bool> m_use_extrapolator {this, "UseExtrapolator", false, "Flag to enable the extrapolator for matching offline and trigger muons"};
453
454 // tools
455 ToolHandle<LVL1::ITrigThresholdDecisionTool> m_thresholdTool{
456 this, "TrigThresholdDecisionTool", "LVL1::TrigThresholdDecisionTool/LVL1__TrigThresholdDecisionTool",
457 "Tool to get pass/fail of each trigger threshold"};
458 PublicToolHandle<Trig::TrigDecisionTool> m_trigDec {this, "TrigDecisionTool", "Trig::TrigDecisionTool/TrigDecisionTool", "TrigDecisionTool"};
459 PublicToolHandle<Trk::IExtrapolator> m_extrapolator {"Trk::Extrapolator/AtlasExtrapolator"};
460
461 //The extrapolator is currently not available. Once it gets available, initialize it with the following, which attempts to retrieve:
462 //{this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator", "Track extrapolator"};
463};
464
465#include "MuonMatchingTool.icc"
466
467#endif //TRIGMUONMONITORING_MUONMATCHINGTOOL_H
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define x
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Derived DataVector<T>.
Definition DataVector.h:795
ToolHandle< LVL1::ITrigThresholdDecisionTool > m_thresholdTool
const Trk::TrackParameters * extTrackToPivot(const xAOD::TrackParticle *track) const
Function to extrapolate a Inner Detector track to the pivot plane i.e.
const T * match(const OFFL *offl, std::string trigger, float reqdR, bool &pass, const std::string &containerSGKey="", std::tuple< bool, double, double >(*trigPosForMatchFunc)(const T *)=&MuonMatchingTool::trigPosForMatch< T >) const
Function that searches for an online muon candidate of type T and judges if it is matched to a given ...
const xAOD::Muon * matchEFCBFSReadHandle(const EventContext &ctx, const xAOD::Muon *mu) const
Function that searches for an EF combined muon (EFCBFS) candidate by ReadHandle and judges if it is m...
static double FermiFunction(double x, double x0, double w)
const float m_L2SAreqdR
static std::tuple< bool, double, double > trigPosForMatch(const T *trig)
int L1ItemStringToInt(const std::string &l1item, int roiSource) const
const xAOD::Muon * matchEFSAFSReadHandle(const EventContext &ctx, const xAOD::Muon *mu) const
Function that searches for an EF standalone muon (EFSAFS) candidate by ReadHandle and judges if it is...
const float m_L2InsideOutreqdR
MuonMatchingTool(const std::string &type, const std::string &name, const IInterface *parent)
const Amg::Vector3D offlineMuonAtPivot(const xAOD::Muon *mu) const
const xAOD::Muon * matchEFSA(const xAOD::Muon *mu, std::string trigger, bool &pass) const
Function that searches for an EF standalone muon (EFSA) candidate and judges if it is matched to a gi...
static std::tuple< bool, double, double > trigPosForMatchSATrack(const xAOD::Muon *mu)
const TrigCompositeUtils::LinkInfo< xAOD::L2StandAloneMuonContainer > searchL2SALinkInfo(const xAOD::Muon *mu, std::string trigger) const
Function that searches for the L2 standalone muon (L2MuonSA) candidate closest to a given offline muo...
const xAOD::TrackParticle * SearchEFTrack(const EventContext &ctx, const TrigCompositeUtils::LinkInfo< xAOD::MuonContainer > &muLinkInfo, const SG::ReadHandleKey< xAOD::TrackParticleContainer > &ReadHandleKey) const
Function that searches for an EF muon track (e.g.
const xAOD::L2StandAloneMuon * matchL2SA(const xAOD::Muon *mu, const std::string &trigger, bool &pass) const
Function that searches for an L2 standalone muon (L2MuonSA) candidate and judges if it is matched to ...
SG::ReadHandleKey< xAOD::MuonRoIContainer > m_MuonRoIContainerKey
const xAOD::Muon * matchL2SAtoOff(const EventContext &ctx, const xAOD::L2StandAloneMuon *samu) const
Function that searches for an offline muon matched to L2SA muon.
const float m_L2CBreqdR
const xAOD::Muon * matchEFSAFS(const xAOD::Muon *mu, std::string trigger, bool &pass) const
Function that searches for an EF FS standalone muon (EFSAFS) candidate and judges if it is matched to...
static std::tuple< bool, double, double > PosForMatchSATrack(const xAOD::Muon *mu)
const xAOD::L2StandAloneMuon * matchL2SAReadHandle(const EventContext &ctx, const xAOD::Muon *mu) const
Function that searches for an L2 standalone muon (L2MuonSA) candidate by ReadHandle and judges if it ...
const xAOD::L2CombinedMuon * matchL2CBReadHandle(const EventContext &ctx, const xAOD::Muon *mu) const
Function that searches for an L2 combined muon (L2muComb) candidate by ReadHandle and judges if it is...
const xAOD::L2CombinedMuon * matchL2CB(const xAOD::Muon *mu, std::string trigger, bool &pass) const
Function that searches for an L2 combined muon (L2muComb) candidate and judges if it is matched to a ...
PublicToolHandle< Trig::TrigDecisionTool > m_trigDec
const TrigCompositeUtils::LinkInfo< xAOD::MuonContainer > matchEFCBLinkInfo(const xAOD::Muon *mu, std::string trig) const
Function that searches for an EF combined muon (EFCB) candidate and judges if it is matched to a give...
const TrigCompositeUtils::LinkInfo< DataVector< T > > matchLinkInfo(const OFFL *offl, std::string trigger, float reqdR, bool &pass, const std::string &containerSGKey="", std::tuple< bool, double, double >(*trigPosForMatchFunc)(const T *)=&MuonMatchingTool::trigPosForMatch< T >) const
Function that searches for an online muon candidate of type T closest to a given offline muon.
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_MStrackContainerKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_CBtrackContainerKey
const Trk::TrackParameters * extTrackToRPC(const xAOD::TrackParticle *track) const
const xAOD::Muon * matchL2CBtoOff(const EventContext &ctx, const xAOD::L2CombinedMuon *cbmu) const
Function that searches for an offline muon matched to L2CB muon.
const xAOD::Muon * matchEFIso(const xAOD::Muon *mu, std::string trigger, bool &pass) const
Function that searches for an EF isolation muon (EFIso) candidate and judges if it is matched to a gi...
const T * matchReadHandle(const OFFL *offl, float reqdR, SG::ReadHandleKey< DataVector< T > > ReadHandleKey, const EventContext &ctx, std::tuple< bool, double, double >(*trigPosForMatchFunc)(const T *)=&MuonMatchingTool::trigPosForMatch< T >) const
Function that searches for an online muon candidate of type T by ReadHandle and judges if it is match...
const TrigCompositeUtils::LinkInfo< xAOD::MuonContainer > matchEFCBFSLinkInfo(const xAOD::Muon *mu, std::string trig) const
Function that searches for an EF combined muon (EFCBFS) candidate and judges if it is matched to a gi...
SG::ReadHandleKey< xAOD::MuonContainer > m_EFCBMuonContainerKey
const xAOD::Muon * matchOff(const EventContext &ctx, const T *trig, float reqdR, std::tuple< bool, double, double >(*offlinePosForMatchFunc)(const xAOD::Muon *), std::tuple< bool, double, double >(*trigPosForMatchFunc)(const T *)=&MuonMatchingTool::trigPosForMatch< T >) const
Function that searches for an offline muon candidate matched to online muon of type T.
SG::ReadHandleKey< xAOD::MuonContainer > m_EFCBFSMuonContainerKey
const TrigCompositeUtils::LinkInfo< xAOD::L2CombinedMuonContainer > searchL2CBLinkInfo(const xAOD::Muon *mu, std::string trigger) const
Function that searches for the L2 combined muon (L2muComb) candidate closest to a given offline muon.
static std::tuple< bool, double, double > trigPosForMatchCBTrack(const xAOD::Muon *mu)
const TrigCompositeUtils::LinkInfo< xAOD::MuonContainer > matchEFSAFSLinkInfo(const xAOD::Muon *mu, std::string trig) const
Function that searches for an EF standalone muon (EFSAFS) candidate and judges if it is matched to a ...
static std::tuple< bool, double, double > PosForMatchCBTrack(const xAOD::Muon *mu)
SG::ReadHandleKey< xAOD::MuonContainer > m_EFSAFSMuonContainerKey
const Trk::TrackParameters * extTrackToTGC(const xAOD::TrackParticle *track) const
bool isMatchedL2SA(const xAOD::L2StandAloneMuon *, const xAOD::Muon *) const
const xAOD::Muon * matchEFCB(const xAOD::Muon *mu, std::string trigger, bool &pass) const
Function that searches for an EF combined muon (EFCB) candidate and judges if it is matched to a give...
SG::ReadHandleKey< xAOD::L2StandAloneMuonContainer > m_L2MuonSAContainerKey
PublicToolHandle< Trk::IExtrapolator > m_extrapolator
bool isMatchedL2InsideOut(const xAOD::L2CombinedMuon *, const xAOD::Muon *) const
const xAOD::Muon * matchEFCBReadHandle(const EventContext &ctx, const xAOD::Muon *mu) const
Function that searches for an EF combined muon (EFCB) candidate by ReadHandle and judges if it is mat...
SG::ReadHandleKey< xAOD::L2CombinedMuonContainer > m_L2muCombContainerKey
virtual StatusCode initialize() override
SG::ReadHandleKey< xAOD::MuonContainer > m_MuonContainerKey
static double reqdRL1byPt(double mupt)
Function compute dR used for matching offline muons and level 1 RoIs at the pivot plane.
const xAOD::Muon * matchEFCBFS(const xAOD::Muon *mu, std::string trigger, bool &pass) const
Function that searches for an EF combined muon (EFCBFS) candidate and judges if it is matched to a gi...
Gaudi::Property< bool > m_use_extrapolator
bool isMatchedL2CB(const xAOD::L2CombinedMuon *, const xAOD::Muon *) const
const xAOD::MuonRoI * matchL1(const xAOD::Muon *mu, const std::string &trigger, bool &pass) const
Function that searches for a Level 1 muon candidate and judges if it is matched to a given offline mu...
const TrigCompositeUtils::LinkInfo< xAOD::MuonContainer > matchEFIsoLinkInfo(const xAOD::Muon *mu, std::string trig) const
Function that searches for an EF isolation muon (EFIso) candidate and judges if it is matched to a gi...
SG::ReadHandleKey< xAOD::MuonContainer > m_EFSAMuonContainerKey
const xAOD::Muon * matchEFSAReadHandle(const EventContext &ctx, const xAOD::Muon *mu) const
Function that searches for an EF standalone muon (EFSA) candidate by ReadHandle and judges if it is m...
const TrigCompositeUtils::LinkInfo< xAOD::MuonContainer > matchEFSALinkInfo(const xAOD::Muon *mu, std::string trig) const
Function that searches for an EF standalone muon (EFSA) candidate and judges if it is matched to a gi...
Property holding a SG store/key/clid from which a ReadHandle is made.
Eigen::Matrix< double, 3, 1 > Vector3D
ParametersBase< TrackParametersDim, Charged > TrackParameters
L2CombinedMuon_v1 L2CombinedMuon
Define the latest version of the muon CB class.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.
Muon_v1 Muon
Reference the current persistent version:
L2StandAloneMuon_v2 L2StandAloneMuon
Define the latest version of the muon SA class.
MuonRoI_v1 MuonRoI
Definition MuonRoI.h:15
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
Definition LinkInfo.h:22