ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/interface/MetTools.h
Revision: 1.5
Committed: Wed Jul 6 18:49:36 2011 UTC (13 years, 10 months ago) by phedex
Content type: text/plain
Branch: MAIN
Changes since 1.4: +3 -0 lines
Log Message:
add feature to add a particular particle to Met

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 phedex 1.5 #include "MitAna/DataTree/interface/ParticleCol.h"
13 mzanetti 1.1 #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 mzanetti 1.4 #include "MitAna/DataTree/interface/PFJetCol.h"
19 mzanetti 1.1 #include "MitCommon/MathTools/interface/MathUtils.h"
20    
21     namespace mithep {
22    
23     class MetTools {
24    
25     public:
26    
27 ceballos 1.2 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 mzanetti 1.4
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 ceballos 1.2 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 mzanetti 1.1
40 mzanetti 1.4 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 mzanetti 1.1 ~MetTools() {}
45    
46 phedex 1.5 void AddToCorrectedTrackMet ( const Particle *p);
47     void AddToCorrectedMet ( const Particle *p);
48 mzanetti 1.1 Met GetCorrectedMet() { return fCorrectedMet; }
49 ceballos 1.3 Met GetMinimumMet(const Met *UncorrectedMet);
50 ceballos 1.2 Met GetCorrectedTrackMet() { return fCorrectedTrackMet; }
51 ceballos 1.3 Met GetMinimumTrackMet(const Met *UncorrectedMet);
52 mzanetti 1.1
53     template<class V>
54 ceballos 1.2 double GetProjectedMet(const V *fV, const Met *UncorrectedMet);
55     template<class V>
56 mzanetti 1.1 double GetProjectedMet(const V *fV);
57     template<class V>
58 ceballos 1.2 double GetProjectedTrackMet(const V *fV);
59 mzanetti 1.1
60     private:
61     Met fCorrectedMet;
62 ceballos 1.2 Met fCorrectedTrackMet;
63 mzanetti 1.1
64     ClassDef(MetTools, 0) // Met tools
65     };
66    
67     template<class V>
68     double MetTools::GetProjectedMet(const V *fV, const Met *UncorrectedMet) {
69 ceballos 1.2 double projectedMet = UncorrectedMet->Pt();
70 mzanetti 1.1 double minDPhi = 999;
71     int index = -1;
72     for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
73     if (MathUtils::DeltaPhi(UncorrectedMet->Phi(), fV->At(m)->Phi()) < minDPhi) {
74     minDPhi = MathUtils::DeltaPhi(UncorrectedMet->Phi(), fV->At(m)->Phi());
75     index = m;
76     }
77     }
78 ceballos 1.2 if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
79     return projectedMet;
80 mzanetti 1.1 }
81    
82     template<class V>
83     double MetTools::GetProjectedMet(const V *fV) {
84 ceballos 1.2 double projectedMet = fCorrectedMet.Pt();
85 mzanetti 1.1 double minDPhi = 999;
86     int index = -1;
87     for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
88     if (MathUtils::DeltaPhi(fCorrectedMet.Phi(), fV->At(m)->Phi()) < minDPhi) {
89     minDPhi = MathUtils::DeltaPhi(fCorrectedMet.Phi(), fV->At(m)->Phi());
90     index = m;
91     }
92     }
93 ceballos 1.2 if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
94     return projectedMet;
95     }
96    
97     template<class V>
98     double MetTools::GetProjectedTrackMet(const V *fV) {
99     double projectedMet = fCorrectedTrackMet.Pt();
100     double minDPhi = 999;
101     int index = -1;
102     for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
103     if (MathUtils::DeltaPhi(fCorrectedTrackMet.Phi(), fV->At(m)->Phi()) < minDPhi) {
104     minDPhi = MathUtils::DeltaPhi(fCorrectedTrackMet.Phi(), fV->At(m)->Phi());
105     index = m;
106     }
107     }
108     if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
109     return projectedMet;
110 mzanetti 1.1 }
111    
112     }
113    
114     #endif