ATLAS Offline Software
Loading...
Searching...
No Matches
GenParticleJet.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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"
19
20namespace Trk {
21
30
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 const std::vector<HepMC::ConstGenParticlePtr >& getParticles() const {return m_particles;}
56
57 const 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;
91 double m_magP;
92};
93
94} // end of namespace
95
96#endif // TRK_TRKVALEVENT_GENPARTICLEJET_H
constexpr int pow(int base, int exp) noexcept
double getSphericity() const
std::pair< HepMC::ConstGenParticlePtr, int > getIndexedParticle(unsigned int i)
double getEnergy() const
std::vector< HepMC::ConstGenParticlePtr > m_particles
HepGeom::Vector3D< double > getMomentum() const
void setEnergy(double energy)
HepMC::ConstGenParticlePtr getParticle(unsigned int i) const
const std::vector< HepMC::ConstGenParticlePtr > & getParticles() const
int getNumParticles() const
void addParticle(HepMC::ConstGenParticlePtr part, int indexInEvent=-1)
HepGeom::Vector3D< double > m_momentum
std::vector< int > m_indices
double getThrust() const
const std::vector< int > & getIndicesInEvent() const
const GenParticle * ConstGenParticlePtr
Definition GenParticle.h:38
Ensure that the ATLAS eigen extensions are properly loaded.