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 |
#include "MitAna/DataTree/interface/ParticleCol.h"
|
13 |
#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 |
#include "MitAna/DataTree/interface/PFJetCol.h"
|
19 |
#include "MitCommon/MathTools/interface/MathUtils.h"
|
20 |
|
21 |
namespace mithep {
|
22 |
|
23 |
class MetTools {
|
24 |
|
25 |
public:
|
26 |
|
27 |
MetTools(const MuonCol *fMuons, const PFCandidateCol *fPFCandidates,
|
28 |
const Vertex *fVertex, float deltaZCut = 0.1, float ptCut=4.0, float etaCut = 3.0);
|
29 |
MetTools(const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates,
|
30 |
const Vertex *fVertex, float deltaZCut = 0.1, float ptCut=4.0, float etaCut = 3.0);
|
31 |
|
32 |
MetTools(const MuonCol *fMuons, const PFCandidateCol *fPFCandidates, const PFJetCol *fPFJets,
|
33 |
const Vertex *fVertex, float deltaZCut = 0.1, float ptCut=4.0, float etaCut = 3.0);
|
34 |
MetTools(const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates, const PFJetCol *fPFJets,
|
35 |
const Vertex *fVertex, float deltaZCut = 0.1, float ptCut=4.0, float etaCut = 3.0);
|
36 |
|
37 |
MetTools(const MuonCol *fMuons, const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates,
|
38 |
const Vertex *fVertex, float deltaZCut = 0.1, float ptCut=4.0, float etaCut = 3.0);
|
39 |
|
40 |
MetTools(const MuonCol *fMuons, const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates, const PFJetCol *fPFJets,
|
41 |
const Vertex *fVertex, float deltaZCut = 0.1, float ptCut=4.0, float etaCut = 3.0);
|
42 |
|
43 |
|
44 |
~MetTools() {}
|
45 |
|
46 |
void AddToCorrectedTrackMet ( const Particle *p);
|
47 |
void AddToCorrectedMet ( const Particle *p);
|
48 |
Met GetCorrectedMet() { return fCorrectedMet; }
|
49 |
Met GetMinimumMet(const Met *UncorrectedMet);
|
50 |
Met GetCorrectedTrackMet() { return fCorrectedTrackMet; }
|
51 |
Met GetMinimumTrackMet(const Met *UncorrectedMet);
|
52 |
|
53 |
template<class V>
|
54 |
double GetProjectedMet(const V *fV, const Met *UncorrectedMet);
|
55 |
template<class V>
|
56 |
double GetProjectedMet(const V *fV);
|
57 |
template<class V>
|
58 |
double GetProjectedTrackMet(const V *fV);
|
59 |
|
60 |
private:
|
61 |
Met fCorrectedMet;
|
62 |
Met fCorrectedTrackMet;
|
63 |
|
64 |
ClassDef(MetTools, 0) // Met tools
|
65 |
};
|
66 |
|
67 |
template<class V>
|
68 |
double MetTools::GetProjectedMet(const V *fV, const Met *UncorrectedMet) {
|
69 |
double projectedMet = UncorrectedMet->Pt();
|
70 |
double minDPhi = 999;
|
71 |
int index = -1;
|
72 |
for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
|
73 |
if (MathUtils::DeltaPhi(UncorrectedMet->Phi(), fV->At(m)->Phi()) < minDPhi) {
|
74 |
minDPhi = MathUtils::DeltaPhi(UncorrectedMet->Phi(), fV->At(m)->Phi());
|
75 |
index = m;
|
76 |
}
|
77 |
}
|
78 |
if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
|
79 |
return projectedMet;
|
80 |
}
|
81 |
|
82 |
template<class V>
|
83 |
double MetTools::GetProjectedMet(const V *fV) {
|
84 |
double projectedMet = fCorrectedMet.Pt();
|
85 |
double minDPhi = 999;
|
86 |
int index = -1;
|
87 |
for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
|
88 |
if (MathUtils::DeltaPhi(fCorrectedMet.Phi(), fV->At(m)->Phi()) < minDPhi) {
|
89 |
minDPhi = MathUtils::DeltaPhi(fCorrectedMet.Phi(), fV->At(m)->Phi());
|
90 |
index = m;
|
91 |
}
|
92 |
}
|
93 |
if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
|
94 |
return projectedMet;
|
95 |
}
|
96 |
|
97 |
template<class V>
|
98 |
double MetTools::GetProjectedTrackMet(const V *fV) {
|
99 |
double projectedMet = fCorrectedTrackMet.Pt();
|
100 |
double minDPhi = 999;
|
101 |
int index = -1;
|
102 |
for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
|
103 |
if (MathUtils::DeltaPhi(fCorrectedTrackMet.Phi(), fV->At(m)->Phi()) < minDPhi) {
|
104 |
minDPhi = MathUtils::DeltaPhi(fCorrectedTrackMet.Phi(), fV->At(m)->Phi());
|
105 |
index = m;
|
106 |
}
|
107 |
}
|
108 |
if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
|
109 |
return projectedMet;
|
110 |
}
|
111 |
|
112 |
}
|
113 |
|
114 |
#endif
|