ATLAS Offline Software
Loading...
Searching...
No Matches
MuonInJetCorrectionTool.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5*/
6
7// MuonInJetCorrectionTool.cxx
8// Implementation file for class MuonInJetCorrectionTool
10
12
14 : asg::AsgTool( name ){ }
15
17(xAOD::Jet& jet, const std::vector< const xAOD::Muon* >& muons, int& nmuons) const {
18 const xAOD::Muon* muon_in_jet = getMuonInJet(jet, muons, nmuons);
19
20 if(nmuons>0){
21 float eLoss = 0.0;
22 muon_in_jet->parameter(eLoss,xAOD::Muon::EnergyLoss);
23 TLorentzVector mu_tlv = muon_in_jet->p4();
24 // Loss with same direction as muon + mass = 0
25 TLorentzVector Loss;
26 Loss.SetVectM(eLoss * (mu_tlv.Vect().Unit()), 0.);
27 TLorentzVector j = jet.p4() - Loss + mu_tlv;
28 xAOD::JetFourMom_t new_jet(j.Pt(), jet.eta(), jet.phi(), j.M());
29 jet.setJetP4(new_jet);
30 }
31
32 return StatusCode::SUCCESS;
33}
34
36(const xAOD::Jet& jet, const std::vector< const xAOD::Muon* >& muons, int& nmuons) const
37{
38 const xAOD::Muon* muon_in_jet = nullptr;
39
40 for(const auto& muon : muons){
41 double dR = jet.p4().DeltaR(muon->p4());
42 double dR_max = m_Jet_Muon_dR;
43 if(m_doVR){
44 if(m_doLargeR) dR_max = std::min(1.0, 0.04 + 200000./muon->pt());
45 else dR_max = std::min(0.4, 0.04 + 10000./muon->pt());
46 }
47 if(dR > dR_max) continue;
48
49 nmuons++;
50 if(!muon_in_jet || muon->pt() > muon_in_jet->pt()) muon_in_jet = muon;
51 }
52
53 return muon_in_jet;
54}
Gaudi::Property< bool > m_doVR
Gaudi::Property< bool > m_doLargeR
virtual StatusCode applyMuonInJetCorrection(xAOD::Jet &jet, const std::vector< const xAOD::Muon * > &muons, int &nmuons) const override
Destructor:
const xAOD::Muon * getMuonInJet(const xAOD::Jet &jet, const std::vector< const xAOD::Muon * > &muons, int &nmuons) const
MuonInJetCorrectionTool(const std::string &name)
Constructor with parameters:
Gaudi::Property< double > m_Jet_Muon_dR
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition Muon_v1.cxx:71
bool parameter(float &value, const ParamDef parameter) const
Get a parameter for this Muon - momentumBalanceSignificance for example.
virtual double pt() const
The transverse momentum ( ) of the particle.
Jet_v1 Jet
Definition of the current "jet version".
Muon_v1 Muon
Reference the current persistent version:
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition JetTypes.h:17