ATLAS Offline Software
GenParticleJet.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // GenParticleJet.h
7 // Header file for GenParticleJet helper class
9 // (c) ATLAS Detector software
11 
12 #ifndef TRK_TRKVALEVENT_GENPARTICLEJET_H
13 #define TRK_TRKVALEVENT_GENPARTICLEJET_H
14 
15 #include <vector>
16 #include <utility>
17 #include "CLHEP/Geometry/Vector3D.h"
18 #include "AtlasHepMC/GenParticle.h"
19 
20 namespace Trk {
21 
32 {
33 
34  public:
36  {
37 
38  }; // constructor
39 
40  ~GenParticleJet(){}; // destructor
41 
42  void setEnergy(double energy){m_energy = energy;}
43 
44  double getEnergy() const {return m_energy;}
45 
47  {
48  return m_particles.at(i);
49  }
50  std::pair<HepMC::ConstGenParticlePtr,int> getIndexedParticle(unsigned int i)
51  {
52  return std::make_pair(m_particles.at(i),m_indices.at(i));
53  }
54 
55  std::vector<HepMC::ConstGenParticlePtr > getParticles() const {return m_particles;}
56 
57  std::vector<int> getIndicesInEvent() const {return m_indices;}
58 
59  int getNumParticles() const {return m_particles.size();}
60 
62  int indexInEvent = -1 ){
63  m_particles.push_back(part);
64  m_indices.push_back(indexInEvent);
65  m_energy = m_energy + part->momentum().e();
66  HepGeom::Vector3D<double> moment(part->momentum().px(), part->momentum().py(), part->momentum().pz());
67  m_momentum = m_momentum + moment;
68 
69  m_totalMom2 = m_totalMom2 + pow((moment.mag()), 2);
70  m_magP = m_magP + moment.mag();
71  HepGeom::Vector3D<double> partMom(part->momentum().px(), part->momentum().py(), part->momentum().pz());
72  double longMoment = partMom.dot((m_momentum)/(m_momentum.mag()));
73  m_pDotJetAxis = m_pDotJetAxis + longMoment;
74  m_totalPt2 = m_totalPt2 + pow(partMom.mag(), 2) - pow(longMoment, 2);
75  }
76 
77  HepGeom::Vector3D<double> getMomentum() const {return m_momentum;}
78 
79  double getThrust() const {return m_pDotJetAxis/m_magP;}
80  double getSphericity() const {return m_totalPt2/m_totalMom2;}
81 
82 
83  private:
84  std::vector<HepMC::ConstGenParticlePtr > m_particles;
85  std::vector< int > m_indices;
86  double m_energy;
87  HepGeom::Vector3D<double> m_momentum;
88  double m_totalPt2;
89  double m_totalMom2;
90  double m_pDotJetAxis;
91  double m_magP;
92 };
93 
94 } // end of namespace
95 
96 #endif // TRK_TRKVALEVENT_GENPARTICLEJET_H
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
Trk::GenParticleJet::~GenParticleJet
~GenParticleJet()
Definition: GenParticleJet.h:40
Trk::GenParticleJet::getMomentum
HepGeom::Vector3D< double > getMomentum() const
Definition: GenParticleJet.h:77
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
Trk::GenParticleJet::setEnergy
void setEnergy(double energy)
Definition: GenParticleJet.h:42
GenParticle.h
Trk::GenParticleJet::m_energy
double m_energy
Definition: GenParticleJet.h:86
Trk::GenParticleJet::getEnergy
double getEnergy() const
Definition: GenParticleJet.h:44
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
Trk::GenParticleJet::m_totalPt2
double m_totalPt2
Definition: GenParticleJet.h:88
lumiFormat.i
int i
Definition: lumiFormat.py:92
Trk::GenParticleJet::addParticle
void addParticle(HepMC::ConstGenParticlePtr part, int indexInEvent=-1)
Definition: GenParticleJet.h:61
Trk::GenParticleJet::m_totalMom2
double m_totalMom2
Definition: GenParticleJet.h:89
Trk::GenParticleJet::m_momentum
HepGeom::Vector3D< double > m_momentum
Definition: GenParticleJet.h:87
Trk::GenParticleJet::getIndicesInEvent
std::vector< int > getIndicesInEvent() const
Definition: GenParticleJet.h:57
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::GenParticleJet::getThrust
double getThrust() const
Definition: GenParticleJet.h:79
Trk::GenParticleJet::getIndexedParticle
std::pair< HepMC::ConstGenParticlePtr, int > getIndexedParticle(unsigned int i)
Definition: GenParticleJet.h:50
Trk::GenParticleJet::getNumParticles
int getNumParticles() const
Definition: GenParticleJet.h:59
Trk::GenParticleJet
short class to organise MC generated particles as a jet.
Definition: GenParticleJet.h:32
Trk::GenParticleJet::m_magP
double m_magP
Definition: GenParticleJet.h:91
Trk::GenParticleJet::m_pDotJetAxis
double m_pDotJetAxis
Definition: GenParticleJet.h:90
Trk::GenParticleJet::GenParticleJet
GenParticleJet()
Definition: GenParticleJet.h:35
Trk::GenParticleJet::m_indices
std::vector< int > m_indices
Definition: GenParticleJet.h:85
Trk::GenParticleJet::getSphericity
double getSphericity() const
Definition: GenParticleJet.h:80
Trk::GenParticleJet::getParticles
std::vector< HepMC::ConstGenParticlePtr > getParticles() const
Definition: GenParticleJet.h:55
Trk::GenParticleJet::m_particles
std::vector< HepMC::ConstGenParticlePtr > m_particles
Definition: GenParticleJet.h:84
Trk::GenParticleJet::getParticle
HepMC::ConstGenParticlePtr getParticle(unsigned int i) const
Definition: GenParticleJet.h:46