ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/interface/MetTools.h
(Generate patch)

Comparing UserCode/MitPhysics/Utils/interface/MetTools.h (file contents):
Revision 1.1 by mzanetti, Mon Mar 14 18:05:56 2011 UTC vs.
Revision 1.5 by phedex, Wed Jul 6 18:49:36 2011 UTC

# Line 9 | Line 9
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 {
# Line 22 | Line 24 | namespace mithep {
24  
25    public:
26  
27 <    MetTools(const MuonCol *fMuons, const PFCandidateCol *fPFCandidates, const Vertex *fVertex, float deltaZCut = 0.1, float ptCut=4.0, float etaCut = 3.0);
28 <    MetTools(const ElectronCol *fElectrons, const PFCandidateCol *fPFCandidates, const Vertex *fVertex, float deltaZCut = 0.1, float ptCut=4.0, float etaCut = 3.0);
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);
47 +    void AddToCorrectedMet ( const Particle *p);
48      Met GetCorrectedMet() { return fCorrectedMet; }
49 <    Met GetMimumMet(const Met *UncorrectedMet);
49 >    Met GetMinimumMet(const Met *UncorrectedMet);
50 >    Met GetCorrectedTrackMet() { return fCorrectedTrackMet; }
51 >    Met GetMinimumTrackMet(const Met *UncorrectedMet);
52  
53      template<class V>
54 +    double GetProjectedMet(const V *fV, const Met *UncorrectedMet);
55 +    template<class V>
56      double GetProjectedMet(const V *fV);
57      template<class V>
58 <    double GetProjectedMet(const V *fV, const Met *UncorrectedMet);
58 >    double GetProjectedTrackMet(const V *fV);
59  
60    private:
61      Met fCorrectedMet;
62 +    Met fCorrectedTrackMet;
63      
64      ClassDef(MetTools, 0) // Met tools
65        };
66  
67    template<class V>
68    double MetTools::GetProjectedMet(const V *fV, const Met *UncorrectedMet) {
69 <    double projectedMet = 0;
69 >    double projectedMet = UncorrectedMet->Pt();
70      double minDPhi = 999;
71      int index = -1;
72      for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
# Line 52 | Line 75 | namespace mithep {
75          index = m;
76        }
77      }
78 <    if (index==-1) return projectedMet;
79 <    if (minDPhi < TMath::Pi()/2.) projectedMet = projectedMet * sin(minDPhi);
78 >    if (minDPhi < TMath::Pi()/2.) return projectedMet = projectedMet * sin(minDPhi);
79 >    return projectedMet;
80    }
81  
59
82    template<class V>
83    double MetTools::GetProjectedMet(const V *fV) {
84 <    double projectedMet = 0;
84 >    double projectedMet = fCorrectedMet.Pt();
85      double minDPhi = 999;
86      int index = -1;
87      for (UInt_t m = 0; m < fV->GetEntries(); ++m) {
# Line 68 | Line 90 | namespace mithep {
90          index = m;
91        }
92      }
93 <    if (index==-1) return projectedMet;
94 <    if (minDPhi < TMath::Pi()/2.) projectedMet = projectedMet * sin(minDPhi);
93 >    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    }
111  
112   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines