1 |
mzanetti |
1.1 |
//--------------------------------------------------------------------------------------------------
|
2 |
|
|
// $Id:
|
3 |
|
|
//
|
4 |
|
|
// MetTools
|
5 |
|
|
//
|
6 |
|
|
// Authors: M. Zanetti
|
7 |
|
|
//--------------------------------------------------------------------------------------------------
|
8 |
|
|
|
9 |
|
|
#ifndef MITPHYSICS_UTILS_METTOOLS_H
|
10 |
|
|
#define MITPHYSICS_UTILS_METTOOLS_H
|
11 |
|
|
|
12 |
phedex |
1.5 |
#include "MitAna/DataTree/interface/ParticleCol.h"
|
13 |
mzanetti |
1.1 |
#include "MitAna/DataTree/interface/MetCol.h"
|
14 |
|
|
#include "MitAna/DataTree/interface/VertexCol.h"
|
15 |
|
|
#include "MitAna/DataTree/interface/MuonCol.h"
|
16 |
|
|
#include "MitAna/DataTree/interface/ElectronCol.h"
|
17 |
|
|
#include "MitAna/DataTree/interface/PFCandidateCol.h"
|
18 |
mzanetti |
1.4 |
#include "MitAna/DataTree/interface/PFJetCol.h"
|
19 |
mzanetti |
1.1 |
#include "MitCommon/MathTools/interface/MathUtils.h"
|
20 |
|
|
|
21 |
|
|
namespace mithep {
|
22 |
|
|
|
23 |
|
|
class MetTools {
|
24 |
|
|
|
25 |
|
|
public:
|
26 |
|
|
|
27 |
ceballos |
1.2 |
MetTools(const MuonCol *fMuons, const PFCandidateCol *fPFCandidates,
|
28 |
ceballos |
1.7 |
const Vertex *fVertex, float deltaZCut = 0.1, float ptCut = 8.0, float etaCut = 5.0);
|
29 |
ceballos |
1.2 |
MetTools(const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates,
|
30 |
ceballos |
1.7 |
const Vertex *fVertex, float deltaZCut = 0.1, float ptCut = 8.0, float etaCut = 5.0);
|
31 |
mzanetti |
1.4 |
|
32 |
|
|
MetTools(const MuonCol *fMuons, const PFCandidateCol *fPFCandidates, const PFJetCol *fPFJets,
|
33 |
ceballos |
1.7 |
const Vertex *fVertex, float deltaZCut = 0.1, float ptCut = 8.0, float etaCut = 5.0);
|
34 |
mzanetti |
1.4 |
MetTools(const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates, const PFJetCol *fPFJets,
|
35 |
ceballos |
1.7 |
const Vertex *fVertex, float deltaZCut = 0.1, float ptCut = 8.0, float etaCut = 5.0);
|
36 |
mzanetti |
1.4 |
|
37 |
ceballos |
1.2 |
MetTools(const MuonCol *fMuons, const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates,
|
38 |
ceballos |
1.7 |
const Vertex *fVertex, float deltaZCut = 0.1, float ptCut = 8.0, float etaCut = 5.0, float intRadius = 0.0);
|
39 |
mzanetti |
1.1 |
|
40 |
mzanetti |
1.4 |
MetTools(const MuonCol *fMuons, const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates, const PFJetCol *fPFJets,
|
41 |
ceballos |
1.7 |
const Vertex *fVertex, float deltaZCut = 0.1, float ptCut = 8.0, float etaCut = 5.0, float intRadius = 0.0);
|
42 |
mzanetti |
1.4 |
|
43 |
|
|
|
44 |
mzanetti |
1.1 |
~MetTools() {}
|
45 |
|
|
|
46 |
sixie |
1.6 |
void AddToCorrectedTrackMet ( const Particle *p, bool debug = false);
|
47 |
|
|
void AddToCorrectedMet ( const Particle *p );
|
48 |
|
|
void AddToRecoil ( const Particle *p );
|
49 |
|
|
void RemoveParticleInIsoConeFromTrackMet ( const Particle *p,
|
50 |
|
|
const PFCandidateCol *fPFCandidates,
|
51 |
|
|
const Vertex *fVertex, float deltaZCut,
|
52 |
|
|
float deltaR, bool debug = false );
|
53 |
|
|
void RemoveParticleInIsoConeFromCorrectedMet ( const Particle *p,
|
54 |
|
|
const PFCandidateCol *fPFCandidates,
|
55 |
|
|
const Vertex *fVertex,
|
56 |
|
|
float deltaZCut, float ptCut, float etaCut,
|
57 |
|
|
float deltaR);
|
58 |
|
|
void RemoveParticleInIsoConeFromRecoil ( const Particle *p,
|
59 |
|
|
const PFCandidateCol *fPFCandidates,
|
60 |
|
|
const Vertex *fVertex,
|
61 |
|
|
float deltaZCut, float ptCut, float etaCut,
|
62 |
|
|
float deltaR);
|
63 |
|
|
Met GetMinimumMet (const Met *UncorrectedMet);
|
64 |
|
|
Met GetMinimumTrackMet (const Met *UncorrectedMet);
|
65 |
|
|
Met GetCorrectedMet() { return fCorrectedMet; }
|
66 |
|
|
Met GetCorrectedTrackMet() { return fCorrectedTrackMet; }
|
67 |
|
|
FourVectorM Recoil() { return fRecoil; }
|
68 |
|
|
FourVectorM ChargedRecoil() { return fChargedRecoil; }
|
69 |
mzanetti |
1.1 |
|
70 |
|
|
template<class V>
|
71 |
ceballos |
1.2 |
double GetProjectedMet(const V *fV, const Met *UncorrectedMet);
|
72 |
|
|
template<class V>
|
73 |
mzanetti |
1.1 |
double GetProjectedMet(const V *fV);
|
74 |
|
|
template<class V>
|
75 |
ceballos |
1.2 |
double GetProjectedTrackMet(const V *fV);
|
76 |
mzanetti |
1.1 |
|
77 |
|
|
private:
|
78 |
|
|
Met fCorrectedMet;
|
79 |
ceballos |
1.2 |
Met fCorrectedTrackMet;
|
80 |
sixie |
1.6 |
FourVectorM fRecoil;
|
81 |
|
|
FourVectorM fChargedRecoil;
|
82 |
mzanetti |
1.1 |
|
83 |
|
|
ClassDef(MetTools, 0) // Met tools
|
84 |
|
|
};
|
85 |
|
|
|
86 |
|
|
template<class V>
|
87 |
|
|
double MetTools::GetProjectedMet(const V *fV, const Met *UncorrectedMet) {
|
88 |
ceballos |
1.2 |
double projectedMet = UncorrectedMet->Pt();
|
89 |
mzanetti |
1.1 |
double minDPhi = 999;
|
90 |
|
|
int index = -1;
|
91 |
|
|
for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
|
92 |
|
|
if (MathUtils::DeltaPhi(UncorrectedMet->Phi(), fV->At(m)->Phi()) < minDPhi) {
|
93 |
|
|
minDPhi = MathUtils::DeltaPhi(UncorrectedMet->Phi(), fV->At(m)->Phi());
|
94 |
|
|
index = m;
|
95 |
|
|
}
|
96 |
|
|
}
|
97 |
ceballos |
1.2 |
if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
|
98 |
|
|
return projectedMet;
|
99 |
mzanetti |
1.1 |
}
|
100 |
|
|
|
101 |
|
|
template<class V>
|
102 |
|
|
double MetTools::GetProjectedMet(const V *fV) {
|
103 |
ceballos |
1.2 |
double projectedMet = fCorrectedMet.Pt();
|
104 |
mzanetti |
1.1 |
double minDPhi = 999;
|
105 |
|
|
int index = -1;
|
106 |
|
|
for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
|
107 |
|
|
if (MathUtils::DeltaPhi(fCorrectedMet.Phi(), fV->At(m)->Phi()) < minDPhi) {
|
108 |
|
|
minDPhi = MathUtils::DeltaPhi(fCorrectedMet.Phi(), fV->At(m)->Phi());
|
109 |
|
|
index = m;
|
110 |
|
|
}
|
111 |
|
|
}
|
112 |
ceballos |
1.2 |
if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
|
113 |
|
|
return projectedMet;
|
114 |
|
|
}
|
115 |
|
|
|
116 |
|
|
template<class V>
|
117 |
|
|
double MetTools::GetProjectedTrackMet(const V *fV) {
|
118 |
|
|
double projectedMet = fCorrectedTrackMet.Pt();
|
119 |
|
|
double minDPhi = 999;
|
120 |
|
|
int index = -1;
|
121 |
|
|
for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
|
122 |
|
|
if (MathUtils::DeltaPhi(fCorrectedTrackMet.Phi(), fV->At(m)->Phi()) < minDPhi) {
|
123 |
|
|
minDPhi = MathUtils::DeltaPhi(fCorrectedTrackMet.Phi(), fV->At(m)->Phi());
|
124 |
|
|
index = m;
|
125 |
|
|
}
|
126 |
|
|
}
|
127 |
|
|
if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
|
128 |
|
|
return projectedMet;
|
129 |
mzanetti |
1.1 |
}
|
130 |
|
|
|
131 |
|
|
}
|
132 |
|
|
|
133 |
|
|
#endif
|