ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HbbAnalysis/interface/JetDeltaRSelector.hh
Revision: 1.1
Committed: Wed Jun 24 16:18:47 2009 UTC (15 years, 10 months ago) by amagnan
Content type: text/plain
Branch: MAIN
CVS Tags: v00-01-00
Log Message:
add selection/veto of Zbb(cc) at generator level + deltaR(lepton-jet) filter

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
55
56 private:
57
58 template <class T>
59 double deltaRwithLepton(const pat::Jet & aJet,
60 const edm::Handle<std::vector<T> > & aCol
61 );
62
63 int debug_;
64
65 double jetLeptonIsolation_;
66
67 edm::InputTag genParticleSrc_;
68 edm::InputTag electronSrc_;
69 edm::InputTag muonSrc_;
70 edm::InputTag tauSrc_;
71
72 container selected_;
73
74 };//class
75
76
77
78 template <class T>
79 double JetDeltaRSelector::deltaRwithLepton(const pat::Jet & aJet,
80 const edm::Handle<std::vector< T > > & aCol
81 )
82 {
83 double lMin = 1000;
84 bool lValid=(aCol->empty())?true:false;
85
86 // pat::Lepton<LeptonType> lLep;
87 typename std::vector< T >::const_iterator iLepton;
88
89 for (iLepton= aCol->begin();
90 iLepton != aCol->end();
91 iLepton++)
92 // for (unsigned int iLepton(0); iLepton< aCol->size(); iLepton++)
93 {
94 //double lDeltaR = ROOT::Math::VectorUtil::DeltaR(aJet.p4(),aCol->at(iLepton).p4());
95 double lDeltaR = ROOT::Math::VectorUtil::DeltaR(aJet.p4(),iLepton->p4());
96 if (lDeltaR<lMin){
97 lMin=lDeltaR;
98 lValid=true;
99 }
100 }
101
102 if(!lValid){
103 std::cerr<<__PRETTY_FUNCTION__<<" : Invalid Return value "
104 << lMin
105 << "... AAAAAAARRRRRRRRRRRRGGGGGGGGGHHHHH"
106 <<std::endl;
107 }
108 if (lMin > 100) return -1;
109
110 return lMin;
111
112 }
113
114
115
116
117
118 #endif //HbbAnalysis_JetDeltaRSelector_hh