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::ParamDef::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(
29 j.Pt(),
30 m_changeAngularComponents ? j.Eta() : jet.eta(),
31 m_changeAngularComponents ? j.Phi() : jet.phi(),
32 j.M());
33 jet.setJetP4(new_jet);
34 }
35
36 return StatusCode::SUCCESS;
37}
38
40(const xAOD::Jet& jet, const std::vector< const xAOD::Muon* >& muons, int& nmuons) const
41{
42 const xAOD::Muon* muon_in_jet = nullptr;
43
44 for(const auto& muon : muons){
45 double dR = jet.p4().DeltaR(muon->p4());
46 double dR_max = m_Jet_Muon_dR;
47 if(m_doVR){
48 if(m_doLargeR) dR_max = std::min(1.0, 0.04 + 200000./muon->pt());
49 else dR_max = std::min(0.4, 0.04 + 10000./muon->pt());
50 }
51 if(dR > dR_max) continue;
52
53 nmuons++;
54 if(!muon_in_jet || muon->pt() > muon_in_jet->pt()) muon_in_jet = muon;
55 }
56
57 return muon_in_jet;
58}
Gaudi::Property< bool > m_doVR
Gaudi::Property< bool > m_changeAngularComponents
Gaudi::Property< bool > m_doLargeR
virtual StatusCode applyMuonInJetCorrection(xAOD::Jet &jet, const std::vector< const xAOD::Muon * > &muons, int &nmuons) const override
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 double pt() const override
The transverse momentum ( ) of the particle.
bool parameter(float &value, const ParamDef parameter) const
Get a parameter for this Muon - momentumBalanceSignificance for example.
Definition Muon_v1.cxx:175
virtual FourMom_t p4() const override
The full 4-momentum of the particle.
Definition Muon_v1.cxx:84
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