ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HbbAnalysis/interface/TauDeltaRSelector.hh
Revision: 1.1
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
Log Message:
add selector for Hbb in etau

File Contents

# User Rev Content
1 amagnan 1.1 #ifndef HbbAnalysis_TauDeltaRSelector_hh
2     #define HbbAnalysis_TauDeltaRSelector_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 TauDeltaRSelector {//class
25    
26     public:
27    
28     typedef std::vector<pat::Tau> collection;
29    
30     typedef std::vector<const pat::Tau *> container;
31    
32     typedef container::const_iterator const_iterator;
33    
34     TauDeltaRSelector(const edm::ParameterSet & pset);
35     ~TauDeltaRSelector();
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 tauLeptonIsolation(const pat::Tau & aTau,
49     const edm::Handle<std::vector<pat::Electron> > & aColEle,
50     const edm::Handle<std::vector<pat::Muon> > & aColMu
51     );
52    
53    
54    
55     private:
56    
57     template <class T>
58     double deltaRwithLepton(const pat::Tau & aTau,
59     const edm::Handle<std::vector<T> > & aCol
60     );
61    
62     int debug_;
63    
64     double tauLeptonIsolation_;
65    
66     bool doElectron_;
67    
68     edm::InputTag genParticleSrc_;
69     edm::InputTag electronSrc_;
70     edm::InputTag muonSrc_;
71    
72     container selected_;
73    
74     };//class
75    
76    
77     template <class T>
78     double TauDeltaRSelector::deltaRwithLepton(const pat::Tau & aTau,
79     const edm::Handle<std::vector< T > > & aCol
80     )
81     {
82     double lMin = 1000;
83     bool lValid=(aCol->empty())?true:false;
84    
85     // pat::Lepton<LeptonType> lLep;
86     typename std::vector< T >::const_iterator iLepton;
87    
88     for (iLepton= aCol->begin();
89     iLepton != aCol->end();
90     iLepton++)
91     // for (unsigned int iLepton(0); iLepton< aCol->size(); iLepton++)
92     {
93     //double lDeltaR = ROOT::Math::VectorUtil::DeltaR(aTau.p4(),aCol->at(iLepton).p4());
94     double lDeltaR = ROOT::Math::VectorUtil::DeltaR(aTau.p4(),iLepton->p4());
95     if (lDeltaR<lMin){
96     lMin=lDeltaR;
97     lValid=true;
98     }
99     }
100    
101     if(!lValid){
102     std::cerr<<__PRETTY_FUNCTION__<<" : Invalid Return value "
103     << lMin
104     << "... AAAAAAARRRRRRRRRRRRGGGGGGGGGHHHHH"
105     <<std::endl;
106     }
107     if (lMin > 100) return -1;
108    
109     return lMin;
110    
111     }
112    
113    
114    
115    
116    
117     #endif //HbbAnalysis_TauDeltaRSelector_hh