ATLAS Offline Software
Loading...
Searching...
No Matches
Charge.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8using namespace std;
9using namespace JetSubStructureUtils;
10
11double Charge::result(const xAOD::Jet &jet) const
12{
13 vector<const xAOD::TrackParticle*> tracks;
14 bool retval = jet.getAssociatedObjects("GhostTrack", tracks);
15 if(!retval) {
16 return -999;
17 }
18
19 double charge = 0;
20 for(unsigned int i=0; i<tracks.size(); i++) {
21 charge += tracks[i]->charge() * pow(tracks[i]->pt(), m_k);
22 }
23 if(jet.pt() == 0) {
24 return -999;
25 }
26 else {
27 charge /= pow(jet.pt(), m_k);
28 }
29
30 return charge;
31}
double charge(const T &p)
Definition AtlasPID.h:997
constexpr int pow(int base, int exp) noexcept
virtual double result(const xAOD::Jet &jet) const
Definition Charge.cxx:11
STL namespace.
Jet_v1 Jet
Definition of the current "jet version".