ATLAS Offline Software
Classes | Functions
MSVtxValidationAlgUtils Namespace Reference

Classes

struct  VtxIso
 

Functions

double getCTau (const xAOD::TruthVertex *decVtx)
 
double getCalEnergyLogRatio (double EMF)
 
bool comparePt (const xAOD::TruthParticle *part1, const xAOD::TruthParticle *part2)
 
std::vector< const xAOD::TruthParticle * > getChildren (const xAOD::TruthParticle *mother)
 
std::vector< const xAOD::TruthParticle * > getGenStableChildren (const xAOD::TruthParticle *particle)
 
bool isFromParticle (const xAOD::TruthParticle *ptcl, int pdgId)
 
const xAOD::TruthParticlegetMotherLLP (const xAOD::TruthParticle *ptcl, int pdgId_llp)
 
VtxIso getIso (const xAOD::Vertex *MSVtx, const xAOD::TrackParticleContainer &Tracks, const xAOD::JetContainer &Jets, double trackIso_pT, double softTrackIso_R, double jetIso_pT, double jetIso_LogRatio)
 

Function Documentation

◆ comparePt()

bool MSVtxValidationAlgUtils::comparePt ( const xAOD::TruthParticle part1,
const xAOD::TruthParticle part2 
)

Definition at line 33 of file MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx.

33  {
34  return (part1->pt()>part2->pt());
35 }

◆ getCalEnergyLogRatio()

double MSVtxValidationAlgUtils::getCalEnergyLogRatio ( double  EMF)

Definition at line 16 of file MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx.

16  {
17  double logRatio{-99.};
18  double zero{0.};
19  double one{1.};
20 
22  if(CxxUtils::fpcompare::greater_equal(EMF,one)) logRatio = -999.;
23  else logRatio = std::log10(double(1./EMF - 1.));
24  }
25  else {
26  logRatio = 999;
27  }
28 
29  return logRatio;
30 }

◆ getChildren()

std::vector< const xAOD::TruthParticle * > MSVtxValidationAlgUtils::getChildren ( const xAOD::TruthParticle mother)

Definition at line 38 of file MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx.

38  {
39  // returns pointers to children of a given particle
40  if (!mother) return {};
41 
42  std::vector<const xAOD::TruthParticle*> children{};
43  for (size_t i=0; i<mother->nChildren(); ++i) {
44  const xAOD::TruthParticle* child = mother->child(i);
45  // avoid infinite loop
46  if (!child || child == mother) continue;
47  children.push_back(child);
48  }
49 
50  return children;
51 }

◆ getCTau()

double MSVtxValidationAlgUtils::getCTau ( const xAOD::TruthVertex decVtx)

Definition at line 10 of file MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx.

10  {
11  // compute the ctau for a given decay vertex via: ctau = |r|/gamma
12  return decVtx->v4().Vect().Mag() / decVtx->genvecV4().Gamma();
13 }

◆ getGenStableChildren()

std::vector< const xAOD::TruthParticle * > MSVtxValidationAlgUtils::getGenStableChildren ( const xAOD::TruthParticle particle)

Definition at line 54 of file MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx.

54  {
55  // returns pointers to the generator stable children of a given particle
56 
57  std::vector<const xAOD::TruthParticle*> genStableChildren{};
58  if(!particle) return {};
59  if (particle->isGenStable()){
60  genStableChildren.push_back(particle);
61  return genStableChildren;
62  }
63 
64  std::vector<const xAOD::TruthParticle*> children = getChildren(particle);
65  for (const xAOD::TruthParticle* child : children){
66  // avoid infinite loops featured in some generators
67  if (!child || child == particle) continue;
68  if (child->hasDecayVtx() && child->decayVtx()->v4() == particle->decayVtx()->v4()) continue;
69  // go deeper in the decay chain
70  std::vector<const xAOD::TruthParticle*> grandChildren = getGenStableChildren(child);
71  genStableChildren.insert(genStableChildren.end(), grandChildren.begin(), grandChildren.end());
72  }
73 
74  return genStableChildren;
75 }

◆ getIso()

VtxIso MSVtxValidationAlgUtils::getIso ( const xAOD::Vertex MSVtx,
const xAOD::TrackParticleContainer Tracks,
const xAOD::JetContainer Jets,
double  trackIso_pT,
double  softTrackIso_R,
double  jetIso_pT,
double  jetIso_LogRatio 
)

Definition at line 92 of file MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx.

93  {
94  // compute the isolation metrics of the MS vertex:
95  // - delta R to closest hard track
96  // - delta R to closest punch-through candidate jet
97  // - sum of soft track pT in a cone around the vertex
98 
99  VtxIso iso{};
100  const Amg::Vector3D vtx_pos = MSVtx->position();
101 
102  // isolation towards tracks
103  Amg::Vector3D softTrack_pTsum{Amg::Vector3D::Zero()};
104  double hardTrack_mindR{99.};
105  for(const xAOD::TrackParticle* Track : Tracks){
106  double dR = xAOD::P4Helpers::deltaR(vtx_pos.eta(), vtx_pos.phi(), Track->eta(), Track->phi());
107  // hard tracks
108  if(Track->pt() >= trackIso_pT && dR < hardTrack_mindR) hardTrack_mindR = dR;
109  // soft tracks
110  if(Track->pt() < trackIso_pT && dR < softTrackIso_R) softTrack_pTsum += Amg::Vector3D(Track->p4()[0], Track->p4()[1], Track->p4()[2]);
111  }
112 
113  iso.track_mindR = hardTrack_mindR != 99. ? hardTrack_mindR : -1.;
114  iso.track_pTsum = softTrack_pTsum.mag() != 0. ? softTrack_pTsum.perp()/Gaudi::Units::GeV : -1.;
115 
116  // isolation towards jets
117  double jet_mindR{99.};
118  for(const xAOD::Jet* Jet : Jets){
119  if(Jet->pt() < jetIso_pT) continue;
120  // if(!Jet->getAttribute<char>("passJVT")) continue;
121  double logratio = getCalEnergyLogRatio(Jet->getAttribute<float>("EMFrac"));
122  if(logratio >= jetIso_LogRatio) continue;
123 
124  double dR = xAOD::P4Helpers::deltaR(vtx_pos.eta(), vtx_pos.phi(), Jet->eta(), Jet->phi());
125  if(dR < jet_mindR){
126  jet_mindR = dR;
127  }
128  }
129  iso.jet_mindR = jet_mindR != 99. ? jet_mindR : -1.;
130 
131  return iso;
132 }

◆ getMotherLLP()

const xAOD::TruthParticle * MSVtxValidationAlgUtils::getMotherLLP ( const xAOD::TruthParticle ptcl,
int  pdgId_llp 
)

Definition at line 85 of file MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx.

85  {
86  if (std::abs(ptcl->pdgId())==pdgId_llp) return ptcl;
87  if (ptcl->parent()==nullptr) return nullptr;
88  return getMotherLLP(ptcl->parent(),pdgId_llp);
89 }

◆ isFromParticle()

bool MSVtxValidationAlgUtils::isFromParticle ( const xAOD::TruthParticle ptcl,
int  pdgId 
)

Definition at line 78 of file MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx.

78  {
79  if (std::abs(ptcl->pdgId())==pdgId) return true;
80  if (ptcl->parent()==nullptr) return false;
81  return isFromParticle(ptcl->parent(),pdgId);
82 }
xAOD::TruthParticle_v1::parent
const TruthParticle_v1 * parent(size_t i=0) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
Definition: TruthParticle_v1.cxx:131
InDetGNNHardScatterSelection::getter_utils::Tracks
std::vector< const xAOD::TrackParticle * > Tracks
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/CustomGetterUtils.h:49
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
ParticleSigStateImpl::eta
virtual double eta() const
pseudo rapidity
Definition: ParticleSigStateImpl.h:735
MSVtxValidationAlgUtils::getGenStableChildren
std::vector< const xAOD::TruthParticle * > getGenStableChildren(const xAOD::TruthParticle *particle)
Definition: MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx:54
Jet
Basic data class defines behavior for all Jet objects The Jet class is the principal data class for...
Definition: Reconstruction/Jet/JetEvent/JetEvent/Jet.h:47
Jets
Definition: Jets.py:1
Trk::one
@ one
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:22
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
MSVtxValidationAlgUtils::getCalEnergyLogRatio
double getCalEnergyLogRatio(double EMF)
Definition: MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx:16
MSVtxValidationAlgUtils::isFromParticle
bool isFromParticle(const xAOD::TruthParticle *ptcl, int pdgId)
Definition: MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx:78
CxxUtils::fpcompare::greater
bool greater(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition: fpcompare.h:140
xAOD::TruthVertex_v1::v4
FourVec_t v4() const
The full 4-vector of the vertex.
Definition: TruthVertex_v1.cxx:184
part1
Definition: part1.py:1
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::P4Helpers::deltaR
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
Definition: xAODP4Helpers.h:150
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
ParticleSigStateImpl::phi
virtual double phi() const
phi in [-pi,pi[
Definition: ParticleSigStateImpl.h:743
part2
Definition: part2.py:1
CxxUtils::fpcompare::greater_equal
bool greater_equal(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition: fpcompare.h:192
xAOD::TruthParticle_v1::nChildren
size_t nChildren() const
Number of children of this particle.
Definition: TruthParticle_v1.cxx:140
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
MSVtxValidationAlgUtils::getMotherLLP
const xAOD::TruthParticle * getMotherLLP(const xAOD::TruthParticle *ptcl, int pdgId_llp)
Definition: MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx:85
xAOD::TruthParticle_v1::child
const TruthParticle_v1 * child(size_t i=0) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
Definition: TruthParticle_v1.cxx:149
ParticleSigStateImpl::pt
virtual double pt() const
transverse momentum
Definition: ParticleSigStateImpl.h:767
python.DecayParser.children
children
Definition: DecayParser.py:32
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
xAOD::TruthVertex_v1::genvecV4
GenVecFourVec_t genvecV4() const
The full 4-vector of the particle : GenVector form.
Definition: TruthVertex_v1.cxx:188
xAOD::TruthParticle_v1::pdgId
int pdgId() const
PDG ID code.
zero
void zero(TH2 *h)
zero the contents of a 2d histogram
Definition: comparitor.cxx:436
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
MSVtxValidationAlgUtils::getChildren
std::vector< const xAOD::TruthParticle * > getChildren(const xAOD::TruthParticle *mother)
Definition: MuonSpectrometer/MuonValidation/MuonVertexValidation/src/Utils.cxx:38