30 {
31
32
34 if (!tauJetsReadHandle.isValid()) {
35 ATH_MSG_ERROR (
"Could not retrieve TauJetContainer with key " << tauJetsReadHandle.key());
36 return StatusCode::FAILURE;
37 }
39
40
41 static const SG::Accessor<float> acc_absEtaLead("ABS_ETA_LEAD_TRACK");
42
43 std::vector<SG::WriteDecorHandle<xAOD::TauJetContainer, float> > scoreDecors;
45 for (
const SG::WriteDecorHandleKey<xAOD::TauJetContainer>& k :
m_scoreDecorKeys) {
46 scoreDecors.emplace_back (k, ctx);
47 }
48 std::vector<SG::WriteDecorHandle<xAOD::TauJetContainer, char> > WPDecors;
50 for (
const SG::WriteDecorHandleKey<xAOD::TauJetContainer>& k :
m_WPDecorKeys) {
51 WPDecors.emplace_back (k, ctx);
52 }
53
54 SG::WriteDecorHandle<xAOD::TauJetContainer, float> dec_trackWidth (
m_trackWidthKey, ctx);
56 for (const auto tau : *tauContainer) {
57 float tauTrackBasedWidth = 0.;
58
59 std::vector<const xAOD::TauTrack *> tauTracks = tau->tracks();
61 tauTracks.push_back(trk);
62 }
63 double sumWeightedDR = 0.;
64 double ptSum = 0.;
69 }
70 if (ptSum > 0.) {
71 tauTrackBasedWidth = sumWeightedDR / ptSum;
72 }
73
74 dec_trackWidth(*tau) = tauTrackBasedWidth;
75 }
76
77
79
80 for (auto tau : *shallowCopy.first) {
81
82
83
85 float absEtaLead = -1111.;
86 if(tau->nTracks() > 0) {
88 absEtaLead = std::abs(
track->eta() );
89 }
90 acc_absEtaLead(*tau) = absEtaLead;
91 }
92
93
96 }
97
98
99 const xAOD::TauJet* xTau = tauContainer->at(tau->index());
100 for (SG::WriteDecorHandle<xAOD::TauJetContainer, float>& dec : scoreDecors) {
101 SG::ConstAccessor<float> scoreAcc (dec.auxid());
102 dec(*xTau) = scoreAcc(*tau);
103 }
104 for (SG::WriteDecorHandle<xAOD::TauJetContainer, char>& dec : WPDecors) {
105 SG::ConstAccessor<char> WPAcc (dec.auxid());
106 dec(*xTau) = WPAcc(*tau);
107 }
108 }
109
110 delete shallowCopy.first;
111 delete shallowCopy.second;
112
113
115 if (!muonReadHandle.isValid()) {
116 ATH_MSG_DEBUG (
"Could not retrieve MuonContainer with key " << muonReadHandle.key() <<
" so won't add TAT MuonOLR flag");
117 return StatusCode::SUCCESS;
118 }
120
121 for (const auto tau : *tauContainer) {
122 bool bTauMuonOLR = true;
124 if(
muon->pt() < 2000.)
continue;
125 if(
muon->muonType() == xAOD::Muon::CaloTagged)
continue;
126 if(
muon->p4().DeltaR( tau->p4() ) > 0.2 )
continue;
127 bTauMuonOLR = false;
128 break;
129 }
130 dec_passTATTauMuonOLR(*tau) = bTauMuonOLR;
131 }
132
133 return StatusCode::SUCCESS;
134 }
#define ATH_CHECK
Evaluate an expression and check for errors.
xAOD::MuonContainer * muonContainer
SG::ReadHandleKey< xAOD::TauJetContainer > m_tauContainerKey
SG::WriteDecorHandleKey< xAOD::TauJetContainer > m_trackWidthKey
SG::WriteDecorHandleKey< xAOD::TauJetContainer > m_passTATTauMuonOLRKey
Gaudi::Property< bool > m_doEvetoWP
SG::WriteDecorHandleKeyArray< xAOD::TauJetContainer > m_WPDecorKeys
SG::ReadHandleKey< xAOD::MuonContainer > m_muonContainerKey
SG::WriteDecorHandleKeyArray< xAOD::TauJetContainer > m_scoreDecorKeys
ToolHandleArray< TauRecToolBase > m_tauIDTools
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, const EventContext &ctx)
Function making a shallow copy of a constant container.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TauTrack_v1 TauTrack
Definition of the current version.
TauJet_v3 TauJet
Definition of the current "tau version".
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".