ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/interface/MetTools.h
Revision: 1.4
Committed: Tue Apr 12 07:30:29 2011 UTC (14 years ago) by mzanetti
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b
Changes since 1.3: +11 -0 lines
Log Message:
tracks+neutrals+jets MET

File Contents

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