ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Asg wrapper around the MissingMassCalculator
6// author Michael Huebner <michael.huebner@no.spam.cern.ch>
7#ifndef DITAUMASSTOOLS_HELPERFUNCTIONS_H
8#define DITAUMASSTOOLS_HELPERFUNCTIONS_H
9
10// Framework includes
11#include "Math/VectorUtil.h"
12#include "Math/Vector2D.h"
13
14#include <vector>
15
16class TF1;
17class TDirectory;
18
19namespace xAOD{
20 class IParticle;
21}
22
24 using ROOT::Math::XYVector;
25 using ROOT::Math::VectorUtil::Phi_mpi_pi;
26
31
36
38{
40 const std::string name[MAXMMCCALIBRATIONSET]={ "MMC2015HIGHMASS", "UPGRADE", "LFVMMC2012", "MMC2019", "MMC2024"};
41}
42
43namespace MMCFitMethod
44{
45 enum e { MAXW=0, MLM, MLNU3P,MAX};
46 const std::string name[MAX]={ "MAXW=MaximumWeight", "MLM=MostLikelyMass", "MLNU3P=MostLikelyNeUtrino3Momentum"};
47 const std::string shortName[MAX]={ "MAXW", "MLM", "MLNU3P"};
48}
49
50namespace TauTypes
51{
52 enum e {ll=0, lh, hh};
53}
54
55// define ignore template to suppress warnings in MissingMassProb
56// see source file of MissingMassProb for further reasoning
57template <typename T> void ignore(T &&){}
58
59template <typename VectorType1, typename VectorType2>
60double Angle(const VectorType1& vec1, const VectorType2& vec2) {
61 // Calculate the dot product and magnitudes (similar to but faster than ::Angle())
62 double dotProduct = vec1.Px() * vec2.Px() + vec1.Py() * vec2.Py() + vec1.Pz() * vec2.Pz();
63 double magnitude1 = vec1.P();
64 double magnitude2 = vec2.P();
65
66 // Calculate and return the angle
67 return acos(dotProduct / (magnitude1 * magnitude2));
68}
69
70template <typename VectorType>
71double mT(const VectorType & vec,const XYVector & met_vec) {
72 double mt=0.0;
73 double dphi=std::abs(Phi_mpi_pi(vec.Phi()-met_vec.Phi()));
74 double cphi=1.0-cos(dphi);
75 if(cphi>0.0) mt=sqrt(2.0*vec.Pt()*met_vec.R()*cphi);
76 return mt;
77}
78
79//________________________________________________________________________
80
81bool updateDouble (const double in, double & out) ;
82void fastSinCos (const double & phi, double & sinPhi, double & cosPhi);
83double fixPhiRange (const double & phi);
84double MaxDelPhi(int tau_type, double Pvis, double dRmax_tau);
85int getLFVMode( const xAOD::IParticle* p1, const xAOD::IParticle* p2, int mmcType1, int mmcType2);
86int mmcType(const xAOD::IParticle* part); // returns particle type as required by MMC
87void readInParams(TDirectory* dir, MMCCalibrationSet::e aset, std::vector<TF1*>& lep_numass, std::vector<TF1*>& lep_angle, std::vector<TF1*>& lep_ratio, std::vector<TF1*>& had_angle, std::vector<TF1*>& had_ratio);
88} // namespace DiTauMassTools
89
90#endif // not DITAUMASSTOOLS_HELPERFUNCTIONS_H
Scalar phi() const
phi method
std::vector< size_t > vec
__HOSTDEV__ double Phi_mpi_pi(double)
Definition GeoRegion.cxx:10
Class providing the definition of the 4-vector interface.
int getLFVMode(const xAOD::IParticle *p1, const xAOD::IParticle *p2, int mmcType1, int mmcType2)
double MaxDelPhi(int tau_type, double Pvis, double dRmax_tau)
double Angle(const VectorType1 &vec1, const VectorType2 &vec2)
double mT(const VectorType &vec, const XYVector &met_vec)
void fastSinCos(const double &phi, double &sinPhi, double &cosPhi)
void readInParams(TDirectory *dir, MMCCalibrationSet::e aset, std::vector< TF1 * > &lep_numass, std::vector< TF1 * > &lep_angle, std::vector< TF1 * > &lep_ratio, std::vector< TF1 * > &had_angle, std::vector< TF1 * > &had_ratio)
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.