ATLAS Offline Software
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 
8 using namespace std;
9 using namespace JetSubStructureUtils;
10 
11 double 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 }
get_generator_info.result
result
Definition: get_generator_info.py:21
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
test_pyathena.pt
pt
Definition: test_pyathena.py:11
JetSubStructureUtils
Definition: RCJet.h:49
Charge.h
LArCellBinning_test.retval
def retval
Definition: LArCellBinning_test.py:112
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
lumiFormat.i
int i
Definition: lumiFormat.py:92
charge
double charge(const T &p)
Definition: AtlasPID.h:494
TrackParticle.h
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57