ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/interface/MetTools.h
Revision: 1.6
Committed: Thu Jul 7 20:22:19 2011 UTC (13 years, 9 months ago) by sixie
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_024b, Mit_025pre1, Mit_024a, Mit_024
Changes since 1.5: +25 -6 lines
Log Message:
Add some more features to the Met tools

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/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, 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
70 template<class V>
71 double GetProjectedMet(const V *fV, const Met *UncorrectedMet);
72 template<class V>
73 double GetProjectedMet(const V *fV);
74 template<class V>
75 double GetProjectedTrackMet(const V *fV);
76
77 private:
78 Met fCorrectedMet;
79 Met fCorrectedTrackMet;
80 FourVectorM fRecoil;
81 FourVectorM fChargedRecoil;
82
83 ClassDef(MetTools, 0) // Met tools
84 };
85
86 template<class V>
87 double MetTools::GetProjectedMet(const V *fV, const Met *UncorrectedMet) {
88 double projectedMet = UncorrectedMet->Pt();
89 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 if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
98 return projectedMet;
99 }
100
101 template<class V>
102 double MetTools::GetProjectedMet(const V *fV) {
103 double projectedMet = fCorrectedMet.Pt();
104 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 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 }
130
131 }
132
133 #endif