ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/interface/MetTools.h
Revision: 1.10
Committed: Sat Jul 7 11:33:58 2012 UTC (12 years, 9 months ago) by ceballos
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_029c, Mit_029b, Mit_029a, HEAD
Changes since 1.9: +5 -2 lines
Log Message:
new pmet

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 ceballos 1.10 #include "MitAna/DataTree/interface/GenericParticleCol.h"
20 mzanetti 1.1 #include "MitCommon/MathTools/interface/MathUtils.h"
21    
22     namespace mithep {
23    
24     class MetTools {
25    
26     public:
27    
28 ceballos 1.2 MetTools(const MuonCol *fMuons, const PFCandidateCol *fPFCandidates,
29 ceballos 1.7 const Vertex *fVertex, float deltaZCut = 0.1, float ptCut = 8.0, float etaCut = 5.0);
30 ceballos 1.2 MetTools(const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates,
31 ceballos 1.7 const Vertex *fVertex, float deltaZCut = 0.1, float ptCut = 8.0, float etaCut = 5.0);
32 mzanetti 1.4
33     MetTools(const MuonCol *fMuons, const PFCandidateCol *fPFCandidates, const PFJetCol *fPFJets,
34 ceballos 1.7 const Vertex *fVertex, float deltaZCut = 0.1, float ptCut = 8.0, float etaCut = 5.0);
35 mzanetti 1.4 MetTools(const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates, const PFJetCol *fPFJets,
36 ceballos 1.7 const Vertex *fVertex, float deltaZCut = 0.1, float ptCut = 8.0, float etaCut = 5.0);
37 mzanetti 1.4
38 ceballos 1.2 MetTools(const MuonCol *fMuons, const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates,
39 ceballos 1.10 const Vertex *fVertex, float deltaZCut = 0.1, float ptCut = 8.0, float etaCut = 5.0, float intRadius = 0.0,
40     const GenericParticle *genP = NULL);
41 mzanetti 1.1
42 mzanetti 1.4 MetTools(const MuonCol *fMuons, const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates, const PFJetCol *fPFJets,
43 ceballos 1.10 const Vertex *fVertex, float deltaZCut = 0.1, float ptCut = 8.0, float etaCut = 5.0, float intRadius = 0.0,
44     const GenericParticle *genP = NULL);
45 mzanetti 1.4
46    
47 mzanetti 1.1 ~MetTools() {}
48    
49 sixie 1.6 void AddToCorrectedTrackMet ( const Particle *p, bool debug = false);
50     void AddToCorrectedMet ( const Particle *p );
51     void AddToRecoil ( const Particle *p );
52     void RemoveParticleInIsoConeFromTrackMet ( const Particle *p,
53     const PFCandidateCol *fPFCandidates,
54     const Vertex *fVertex, float deltaZCut,
55     float deltaR, bool debug = false );
56     void RemoveParticleInIsoConeFromCorrectedMet ( const Particle *p,
57     const PFCandidateCol *fPFCandidates,
58     const Vertex *fVertex,
59     float deltaZCut, float ptCut, float etaCut,
60     float deltaR);
61     void RemoveParticleInIsoConeFromRecoil ( const Particle *p,
62     const PFCandidateCol *fPFCandidates,
63     const Vertex *fVertex,
64     float deltaZCut, float ptCut, float etaCut,
65     float deltaR);
66     Met GetMinimumMet (const Met *UncorrectedMet);
67     Met GetMinimumTrackMet (const Met *UncorrectedMet);
68     Met GetCorrectedMet() { return fCorrectedMet; }
69     Met GetCorrectedTrackMet() { return fCorrectedTrackMet; }
70 ceballos 1.9 Met GetCHSMet() { return fCHSMet; }
71     Met GetNHSMet() { return fNHSMet; }
72 sixie 1.6 FourVectorM Recoil() { return fRecoil; }
73     FourVectorM ChargedRecoil() { return fChargedRecoil; }
74 mzanetti 1.1
75     template<class V>
76 ceballos 1.2 double GetProjectedMet(const V *fV, const Met *UncorrectedMet);
77     template<class V>
78 mzanetti 1.1 double GetProjectedMet(const V *fV);
79     template<class V>
80 ceballos 1.2 double GetProjectedTrackMet(const V *fV);
81 mzanetti 1.1
82     private:
83     Met fCorrectedMet;
84 ceballos 1.2 Met fCorrectedTrackMet;
85 ceballos 1.9 Met fCHSMet;
86     Met fNHSMet;
87 sixie 1.6 FourVectorM fRecoil;
88     FourVectorM fChargedRecoil;
89 mzanetti 1.1
90     ClassDef(MetTools, 0) // Met tools
91     };
92    
93     template<class V>
94     double MetTools::GetProjectedMet(const V *fV, const Met *UncorrectedMet) {
95 ceballos 1.2 double projectedMet = UncorrectedMet->Pt();
96 mzanetti 1.1 double minDPhi = 999;
97     for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
98 sixie 1.8 if (fabs(MathUtils::DeltaPhi(UncorrectedMet->Phi(), fV->At(m)->Phi())) < minDPhi) {
99     minDPhi = fabs(MathUtils::DeltaPhi(UncorrectedMet->Phi(), fV->At(m)->Phi()));
100 mzanetti 1.1 }
101     }
102 ceballos 1.2 if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
103     return projectedMet;
104 mzanetti 1.1 }
105    
106     template<class V>
107     double MetTools::GetProjectedMet(const V *fV) {
108 ceballos 1.2 double projectedMet = fCorrectedMet.Pt();
109 mzanetti 1.1 double minDPhi = 999;
110     for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
111 sixie 1.8 if (fabs(MathUtils::DeltaPhi(fCorrectedMet.Phi(), fV->At(m)->Phi())) < minDPhi) {
112     minDPhi = fabs(MathUtils::DeltaPhi(fCorrectedMet.Phi(), fV->At(m)->Phi()));
113 mzanetti 1.1 }
114     }
115 ceballos 1.2 if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
116     return projectedMet;
117     }
118    
119     template<class V>
120     double MetTools::GetProjectedTrackMet(const V *fV) {
121     double projectedMet = fCorrectedTrackMet.Pt();
122     double minDPhi = 999;
123     for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
124 sixie 1.8 if (fabs(MathUtils::DeltaPhi(fCorrectedTrackMet.Phi(), fV->At(m)->Phi())) < minDPhi) {
125     minDPhi = fabs(MathUtils::DeltaPhi(fCorrectedTrackMet.Phi(), fV->At(m)->Phi()));
126 ceballos 1.2 }
127     }
128     if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
129     return projectedMet;
130 mzanetti 1.1 }
131    
132     }
133    
134     #endif