ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/interface/MetTools.h
Revision: 1.3
Committed: Tue Mar 15 11:00:57 2011 UTC (14 years, 1 month ago) by ceballos
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_020a, Mit_020
Changes since 1.2: +2 -2 lines
Log Message:
simple bug

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