ATLAS Offline Software
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 
24 namespace DiTauMassTools{
25  using ROOT::Math::XYVector;
27 
28 namespace MaxHistStrategy
29 {
31 }
32 
33 namespace HistInfo
34 {
36 }
37 
38 namespace MMCCalibrationSet
39 {
41  const std::string name[MAXMMCCALIBRATIONSET]={ "MMC2015HIGHMASS", "UPGRADE", "LFVMMC2012", "MMC2016MC15C", "MMC2019"};
42 }
43 
44 namespace 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 
51 namespace 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
58 template <typename T> void ignore(T &&){}
59 
60 template <typename VectorType1, typename VectorType2>
61 double 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 
71 template <typename VectorType>
72 double 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 
82 bool updateDouble (const double in, double & out) ;
83 void fastSinCos (const double & phi, double & sinPhi, double & cosPhi);
84 double fixPhiRange (const double & phi);
85 double MaxDelPhi(int tau_type, double Pvis, double dRmax_tau);
86 int getLFVMode( const xAOD::IParticle* p1, const xAOD::IParticle* p2, int mmcType1, int mmcType2);
87 int mmcType(const xAOD::IParticle* part); // returns particle type as required by MMC
88 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);
89 } // namespace DiTauMassTools
90 
91 #endif // not DITAUMASSTOOLS_HELPERFUNCTIONS_H
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
D3PDMakerTestInstan::vec2
std::vector< D3PDTest::MyVec2 > vec2
Definition: D3PDMakerTestDict.h:14
DiTauMassTools::TauTypes::lh
@ lh
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:53
DiTauMassTools::MaxHistStrategy::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:30
DiTauMassTools::MMCFitMethod::MAX
@ MAX
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:46
DiTauMassTools::MMCCalibrationSet::MMC2015HIGHMASS
@ MMC2015HIGHMASS
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
DiTauMassTools::TauTypes::hh
@ hh
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:53
DiTauMassTools::MMCCalibrationSet::name
const std::string name[MAXMMCCALIBRATIONSET]
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:41
DiTauMassTools::MMCFitMethod::MLM
@ MLM
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:46
DiTauMassTools::HistInfo::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
DiTauMassTools::HistInfo::TANTHETA
@ TANTHETA
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
DiTauMassTools::MaxHistStrategy::MAXBINWINDOW
@ MAXBINWINDOW
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:30
DiTauMassTools::HistInfo::MEANBIN
@ MEANBIN
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
DiTauMassTools::MMCFitMethod::name
const std::string name[MAX]
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:47
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
Phi_mpi_pi
__HOSTDEV__ double Phi_mpi_pi(double)
Definition: GeoRegion.cxx:7
DiTauMassTools::MaxHistStrategy::MAXMAXHISTSTRATEGY
@ MAXMAXHISTSTRATEGY
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:30
DiTauMassTools::MMCCalibrationSet::LFVMMC2012
@ LFVMMC2012
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
DiTauMassTools::fastSinCos
void fastSinCos(const double &phi, double &sinPhi, double &cosPhi)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/Root/HelperFunctions.cxx:42
DiTauMassTools::updateDouble
bool updateDouble(const double in, double &out)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/Root/HelperFunctions.cxx:75
DiTauMassTools::HistInfo::MAXHISTINFO
@ MAXHISTINFO
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
DiTauMassTools::HistInfo::PROB
@ PROB
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:58
DiTauMassTools::MMCFitMethod::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:46
DiTauMassTools
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:24
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
DiTauMassTools::MaxDelPhi
double MaxDelPhi(int tau_type, double Pvis, double dRmax_tau)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/Root/HelperFunctions.cxx:15
DiTauMassTools::MaxHistStrategy::MAXBIN
@ MAXBIN
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:30
DiTauMassTools::readInParams
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)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/Root/HelperFunctions.cxx:173
DiTauMassTools::getLFVMode
int getLFVMode(const xAOD::IParticle *p1, const xAOD::IParticle *p2, int mmcType1, int mmcType2)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/Root/HelperFunctions.cxx:83
DiTauMassTools::MMCCalibrationSet::MMC2019
@ MMC2019
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
DiTauMassTools::mT
double mT(const VectorType &vec, const XYVector &met_vec)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:72
DiTauMassTools::MaxHistStrategy::FIT
@ FIT
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:30
DiTauMassTools::TauTypes::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:53
DiTauMassTools::MMCCalibrationSet::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
DiTauMassTools::MaxHistStrategy::SLIDINGWINDOW
@ SLIDINGWINDOW
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:30
DiTauMassTools::mmcType
int mmcType(const xAOD::IParticle *part)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/Root/HelperFunctions.cxx:136
beamspotman.dir
string dir
Definition: beamspotman.py:623
DiTauMassTools::HistInfo::RMS
@ RMS
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
DiTauMassTools::fixPhiRange
double fixPhiRange(const double &phi)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/Root/HelperFunctions.cxx:21
DiTauMassTools::HistInfo::INTEGRAL
@ INTEGRAL
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
DiTauMassTools::HistInfo::DISCRI
@ DISCRI
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
DiTauMassTools::MMCFitMethod::MAXW
@ MAXW
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:46
TauJet.h
DiTauMassTools::MMCFitMethod::MLNU3P
@ MLNU3P
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:46
DiTauMassTools::MMCCalibrationSet::MAXMMCCALIBRATIONSET
@ MAXMMCCALIBRATIONSET
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
DiTauMassTools::HistInfo::FITLENGTH
@ FITLENGTH
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
DiTauMassTools::HistInfo::RMSVSDISCRI
@ RMSVSDISCRI
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
DiTauMassTools::MMCCalibrationSet::MMC2016MC15C
@ MMC2016MC15C
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
DiTauMassTools::MMCFitMethod::shortName
const std::string shortName[MAX]
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:48
DiTauMassTools::HistInfo::TANTHETAW
@ TANTHETAW
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
DiTauMassTools::MMCCalibrationSet::UPGRADE
@ UPGRADE
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:40
DiTauMassTools::Angle
double Angle(const VectorType1 &vec1, const VectorType2 &vec2)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:61
DiTauMassTools::HistInfo::CHI2
@ CHI2
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
DiTauMassTools::TauTypes::ll
@ ll
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:53