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-2024 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
12// EDM include(s)
13#include "xAODTau/TauJet.h"
14
15// local include(s)
16#include "TH1F.h"
17#include "TF1.h"
18#include "TKey.h"
19#include "TDirectory.h"
20#include "TROOT.h"
21#include "Math/VectorUtil.h"
22#include "Math/Vector2D.h"
23
25 using ROOT::Math::XYVector;
26 using ROOT::Math::VectorUtil::Phi_mpi_pi;
27
32
37
39{
41 const std::string name[MAXMMCCALIBRATIONSET]={ "MMC2015HIGHMASS", "UPGRADE", "LFVMMC2012", "MMC2019", "MMC2024"};
42}
43
44namespace MMCFitMethod
45{
46 enum e { MAXW=0, MLM, MLNU3P,MAX};
47 const std::string name[MAX]={ "MAXW=MaximumWeight", "MLM=MostLikelyMass", "MLNU3P=MostLikelyNeUtrino3Momentum"};
48 const std::string shortName[MAX]={ "MAXW", "MLM", "MLNU3P"};
49}
50
51namespace TauTypes
52{
53 enum e {ll=0, lh, hh};
54}
55
56// define ignore template to suppress warnings in MissingMassProb
57// see source file of MissingMassProb for further reasoning
58template <typename T> void ignore(T &&){}
59
60template <typename VectorType1, typename VectorType2>
61double Angle(const VectorType1& vec1, const VectorType2& vec2) {
62 // Calculate the dot product and magnitudes (similar to but faster than ::Angle())
63 double dotProduct = vec1.Px() * vec2.Px() + vec1.Py() * vec2.Py() + vec1.Pz() * vec2.Pz();
64 double magnitude1 = vec1.P();
65 double magnitude2 = vec2.P();
66
67 // Calculate and return the angle
68 return acos(dotProduct / (magnitude1 * magnitude2));
69}
70
71template <typename VectorType>
72double mT(const VectorType & vec,const XYVector & met_vec) {
73 double mt=0.0;
74 double dphi=std::abs(Phi_mpi_pi(vec.Phi()-met_vec.Phi()));
75 double cphi=1.0-cos(dphi);
76 if(cphi>0.0) mt=sqrt(2.0*vec.Pt()*met_vec.R()*cphi);
77 return mt;
78}
79
80//________________________________________________________________________
81
82bool updateDouble (const double in, double & out) ;
83void fastSinCos (const double & phi, double & sinPhi, double & cosPhi);
84double fixPhiRange (const double & phi);
85double MaxDelPhi(int tau_type, double Pvis, double dRmax_tau);
86int getLFVMode( const xAOD::IParticle* p1, const xAOD::IParticle* p2, int mmcType1, int mmcType2);
87int mmcType(const xAOD::IParticle* part); // returns particle type as required by MMC
88void 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);
89} // namespace DiTauMassTools
90
91#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)