ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HbbAnalysis/interface/JetDeltaRSelector.hh
Revision: 1.2
Committed: Thu Aug 6 07:36:34 2009 UTC (15 years, 8 months ago) by amagnan
Content type: text/plain
Branch: MAIN
CVS Tags: v01-00-00, beforeMETHacks, v00-05-03, v00-05-02, v00-05-01, v00-05-00, HbbAnaFor35X, v00-04-02, v00-04-01, v00-04-00, v00-03-00, v00-02-01, v00-02-00, HEAD
Changes since 1.1: +2 -7 lines
Error occurred while calculating annotation data.
Log Message:
add selector for Hbb in etau

File Contents

# Content
1 #ifndef HbbAnalysis_JetDeltaRSelector_hh
2 #define HbbAnalysis_JetDeltaRSelector_hh
3
4 #include <fstream>
5 #include <string>
6 #include <iostream>
7 #include <vector>
8
9 #include "Math/VectorUtil.h"
10
11 #include "FWCore/Framework/interface/ESHandle.h"
12 #include "FWCore/Framework/interface/Event.h"
13 #include "FWCore/Framework/interface/EventSetup.h"
14 #include "FWCore/ParameterSet/interface/ParameterSet.h"
15
16 #include "DataFormats/Common/interface/Handle.h"
17 #include "DataFormats/PatCandidates/interface/Lepton.h"
18 #include "DataFormats/PatCandidates/interface/Jet.h"
19 #include "DataFormats/PatCandidates/interface/Muon.h"
20 #include "DataFormats/PatCandidates/interface/Electron.h"
21 #include "DataFormats/PatCandidates/interface/Tau.h"
22
23
24 class JetDeltaRSelector {//class
25
26 public:
27
28 typedef std::vector<pat::Jet> collection;
29
30 typedef std::vector<const pat::Jet *> container;
31
32 typedef container::const_iterator const_iterator;
33
34 JetDeltaRSelector(const edm::ParameterSet & pset);
35 ~JetDeltaRSelector();
36
37 void select(edm::Handle<collection> &,
38 edm::Event& ,
39 const edm::EventSetup&
40 );
41
42 inline const_iterator begin() const {return selected_.begin(); };
43
44 inline const_iterator end() const {return selected_.end(); };
45
46 inline size_t size() const { return selected_.size(); };
47
48 bool jetLeptonIsolation(const pat::Jet & aJet,
49 const edm::Handle<std::vector<pat::Electron> > & aColEle,
50 const edm::Handle<std::vector<pat::Muon> > & aColMu,
51 const edm::Handle<std::vector<pat::Tau> > & aColTau
52 );
53
54 private:
55
56 template <class T>
57 double deltaRwithLepton(const pat::Jet & aJet,
58 const edm::Handle<std::vector<T> > & aCol
59 );
60
61 int debug_;
62
63 double jetLeptonIsolation_;
64
65 edm::InputTag genParticleSrc_;
66 edm::InputTag electronSrc_;
67 edm::InputTag muonSrc_;
68 edm::InputTag tauSrc_;
69
70 container selected_;
71
72 };//class
73
74
75
76 template <class T>
77 double JetDeltaRSelector::deltaRwithLepton(const pat::Jet & aJet,
78 const edm::Handle<std::vector< T > > & aCol
79 )
80 {
81 double lMin = 1000;
82 bool lValid=(aCol->empty())?true:false;
83
84 // pat::Lepton<LeptonType> lLep;
85 typename std::vector< T >::const_iterator iLepton;
86
87 for (iLepton= aCol->begin();
88 iLepton != aCol->end();
89 iLepton++)
90 // for (unsigned int iLepton(0); iLepton< aCol->size(); iLepton++)
91 {
92 //double lDeltaR = ROOT::Math::VectorUtil::DeltaR(aJet.p4(),aCol->at(iLepton).p4());
93 double lDeltaR = ROOT::Math::VectorUtil::DeltaR(aJet.p4(),iLepton->p4());
94 if (lDeltaR<lMin){
95 lMin=lDeltaR;
96 lValid=true;
97 }
98 }
99
100 if(!lValid){
101 std::cerr<<__PRETTY_FUNCTION__<<" : Invalid Return value "
102 << lMin
103 << "... AAAAAAARRRRRRRRRRRRGGGGGGGGGHHHHH"
104 <<std::endl;
105 }
106 if (lMin > 100) return -1;
107
108 return lMin;
109
110 }
111
112
113 #endif //HbbAnalysis_JetDeltaRSelector_hh