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/MetCol.h"
|
13 |
#include "MitAna/DataTree/interface/VertexCol.h"
|
14 |
#include "MitAna/DataTree/interface/MuonCol.h"
|
15 |
#include "MitAna/DataTree/interface/ElectronCol.h"
|
16 |
#include "MitAna/DataTree/interface/PFCandidateCol.h"
|
17 |
#include "MitCommon/MathTools/interface/MathUtils.h"
|
18 |
|
19 |
namespace mithep {
|
20 |
|
21 |
class MetTools {
|
22 |
|
23 |
public:
|
24 |
|
25 |
MetTools(const MuonCol *fMuons, const PFCandidateCol *fPFCandidates, const Vertex *fVertex, float deltaZCut = 0.1, float ptCut=4.0, float etaCut = 3.0);
|
26 |
MetTools(const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates, const Vertex *fVertex, float deltaZCut = 0.1, float ptCut=4.0, float etaCut = 3.0);
|
27 |
|
28 |
~MetTools() {}
|
29 |
|
30 |
Met GetCorrectedMet() { return fCorrectedMet; }
|
31 |
Met GetMimumMet(const Met *UncorrectedMet);
|
32 |
|
33 |
template<class V>
|
34 |
double GetProjectedMet(const V *fV);
|
35 |
template<class V>
|
36 |
double GetProjectedMet(const V *fV, const Met *UncorrectedMet);
|
37 |
|
38 |
private:
|
39 |
Met fCorrectedMet;
|
40 |
|
41 |
ClassDef(MetTools, 0) // Met tools
|
42 |
};
|
43 |
|
44 |
template<class V>
|
45 |
double MetTools::GetProjectedMet(const V *fV, const Met *UncorrectedMet) {
|
46 |
double projectedMet = 0;
|
47 |
double minDPhi = 999;
|
48 |
int index = -1;
|
49 |
for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
|
50 |
if (MathUtils::DeltaPhi(UncorrectedMet->Phi(), fV->At(m)->Phi()) < minDPhi) {
|
51 |
minDPhi = MathUtils::DeltaPhi(UncorrectedMet->Phi(), fV->At(m)->Phi());
|
52 |
index = m;
|
53 |
}
|
54 |
}
|
55 |
if (index==-1) return projectedMet;
|
56 |
if (minDPhi < TMath::Pi()/2.) projectedMet = projectedMet * sin(minDPhi);
|
57 |
}
|
58 |
|
59 |
|
60 |
template<class V>
|
61 |
double MetTools::GetProjectedMet(const V *fV) {
|
62 |
double projectedMet = 0;
|
63 |
double minDPhi = 999;
|
64 |
int index = -1;
|
65 |
for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
|
66 |
if (MathUtils::DeltaPhi(fCorrectedMet.Phi(), fV->At(m)->Phi()) < minDPhi) {
|
67 |
minDPhi = MathUtils::DeltaPhi(fCorrectedMet.Phi(), fV->At(m)->Phi());
|
68 |
index = m;
|
69 |
}
|
70 |
}
|
71 |
if (index==-1) return projectedMet;
|
72 |
if (minDPhi < TMath::Pi()/2.) projectedMet = projectedMet * sin(minDPhi);
|
73 |
}
|
74 |
|
75 |
}
|
76 |
|
77 |
#endif
|