ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/interface/MetTools.h
Revision: 1.2
Committed: Tue Mar 15 08:34:56 2011 UTC (14 years, 1 month ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.1: +33 -10 lines
Log Message:
update

File Contents

# User Rev Content
1 mzanetti 1.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 ceballos 1.2 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 mzanetti 1.1
32     ~MetTools() {}
33    
34     Met GetCorrectedMet() { return fCorrectedMet; }
35     Met GetMimumMet(const Met *UncorrectedMet);
36 ceballos 1.2 Met GetCorrectedTrackMet() { return fCorrectedTrackMet; }
37     Met GetMimumTrackMet(const Met *UncorrectedMet);
38 mzanetti 1.1
39     template<class V>
40 ceballos 1.2 double GetProjectedMet(const V *fV, const Met *UncorrectedMet);
41     template<class V>
42 mzanetti 1.1 double GetProjectedMet(const V *fV);
43     template<class V>
44 ceballos 1.2 double GetProjectedTrackMet(const V *fV);
45 mzanetti 1.1
46     private:
47     Met fCorrectedMet;
48 ceballos 1.2 Met fCorrectedTrackMet;
49 mzanetti 1.1
50     ClassDef(MetTools, 0) // Met tools
51     };
52    
53     template<class V>
54     double MetTools::GetProjectedMet(const V *fV, const Met *UncorrectedMet) {
55 ceballos 1.2 double projectedMet = UncorrectedMet->Pt();
56 mzanetti 1.1 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 ceballos 1.2 if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
65     return projectedMet;
66 mzanetti 1.1 }
67    
68     template<class V>
69     double MetTools::GetProjectedMet(const V *fV) {
70 ceballos 1.2 double projectedMet = fCorrectedMet.Pt();
71 mzanetti 1.1 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 ceballos 1.2 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 mzanetti 1.1 }
97    
98     }
99    
100     #endif