5#ifndef PROMPT_PROMPTUTILS_H
6#define PROMPT_PROMPTUTILS_H
25#include "GaudiKernel/MsgStream.h"
30#include "TStopwatch.h"
44 std::string
truthAsStr(
const xAOD::IParticle &particle);
51 void fillTH1(TH1 *h,
double val,
double weight = 1.0);
62 template<
class T1,
class T2>
bool getVar(T1 &obj, T2 &value,
const std::string &var_name)
65 std::cerr <<
"getVar - received a null object" << std::endl;
74 if(!acc.isAvailable(*obj)) {
83 template<
class T1,
class T2>
bool GetAuxVar(
const T1 &obj, T2 &value,
const std::string &var_name)
90 if(!acc.isAvailable(obj)) {
120 template<
class T>
bool operator()(
const T &lhs,
const T &rhs)
122 double val_rhs = 0.0;
123 double val_lhs = 0.0;
125 if(!lhs.getVar(
m_var, val_lhs) || !rhs.getVar(
m_var, val_rhs)) {
126 m_msg << MSG::WARNING <<
"SortObjectByVar - missing var" << std::endl;
130 return val_lhs > val_rhs;
133 return val_lhs < val_rhs;
Base class for elements of a container that can have aux data.
TimerScopeHelper(TStopwatch &timer)
SG::Accessor< T, ALLOC > Accessor
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Eigen::Matrix< double, 3, 1 > Vector3D
bool GetAuxVar(const T1 &obj, T2 &value, const std::string &var_name)
std::string PrintResetStopWatch(TStopwatch &watch)
void fillTH1(TH1 *h, double val, double weight=1.0)
std::string trkAsStr(const xAOD::TrackParticle *trk)
std::string printPromptVertexAsStr(const xAOD::Vertex *vtx, MsgStream &msg)
double getVertexFitProb(const xAOD::Vertex *vtx)
std::string truthAsStr(const xAOD::IParticle &particle)
bool getVar(T1 &obj, T2 &value, const std::string &var_name)
std::string vtxAsStr(const xAOD::Vertex *vtx, bool print_tracks=false)
double getNormDist(const Amg::Vector3D &PrimVtx, const Amg::Vector3D &SecVtx, const std::vector< float > &ErrorMatrix, MsgStream &msg)
double getDistance(const xAOD::Vertex *vtx1, const xAOD::Vertex *vtx2)
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
bool operator()(const xAOD::TrackParticle *lhs, const xAOD::TrackParticle *rhs)
bool operator()(const T &lhs, const T &rhs)
SortObjectByVar(const unsigned v, MsgStream &m, bool inverse=false)