1 |
amagnan |
1.1 |
#ifndef HbbAnalysis_HbbAnalyzer_hh
|
2 |
|
|
#define HbbAnalysis_HbbAnalyzer_hh
|
3 |
|
|
|
4 |
|
|
#include <fstream>
|
5 |
|
|
#include <string>
|
6 |
|
|
#include <iostream>
|
7 |
|
|
#include <vector>
|
8 |
|
|
|
9 |
amagnan |
1.5 |
#include "Math/VectorUtil.h"
|
10 |
|
|
|
11 |
amagnan |
1.1 |
#include "FWCore/Framework/interface/EDAnalyzer.h"
|
12 |
|
|
#include "FWCore/Framework/interface/ESHandle.h"
|
13 |
|
|
#include "FWCore/Framework/interface/Event.h"
|
14 |
|
|
#include "FWCore/Framework/interface/EventSetup.h"
|
15 |
|
|
#include "FWCore/Framework/interface/TriggerNames.h"
|
16 |
|
|
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
17 |
amagnan |
1.5 |
|
18 |
|
|
#include "DataFormats/Common/interface/Handle.h"
|
19 |
|
|
#include "DataFormats/PatCandidates/interface/Lepton.h"
|
20 |
|
|
#include "DataFormats/PatCandidates/interface/Jet.h"
|
21 |
|
|
#include "DataFormats/PatCandidates/interface/Muon.h"
|
22 |
|
|
#include "DataFormats/PatCandidates/interface/Electron.h"
|
23 |
|
|
#include "DataFormats/PatCandidates/interface/Tau.h"
|
24 |
amagnan |
1.1 |
|
25 |
amagnan |
1.3 |
#include "UserCode/HbbAnalysis/interface/HistosElecs.hh"
|
26 |
amagnan |
1.1 |
#include "UserCode/HbbAnalysis/interface/HistosMuons.hh"
|
27 |
|
|
#include "UserCode/HbbAnalysis/interface/HistosTaus.hh"
|
28 |
|
|
#include "UserCode/HbbAnalysis/interface/HistosJets.hh"
|
29 |
amagnan |
1.3 |
#include "UserCode/HbbAnalysis/interface/HistosPairs.hh"
|
30 |
|
|
#include "UserCode/HbbAnalysis/interface/HistosMET.hh"
|
31 |
amagnan |
1.4 |
#include "UserCode/HbbAnalysis/interface/JetFlavour.hh"
|
32 |
amagnan |
1.1 |
|
33 |
|
|
|
34 |
|
|
//#include "TFile.h"
|
35 |
|
|
#include "TH1F.h"
|
36 |
|
|
|
37 |
|
|
class HbbAnalyzer : public edm::EDAnalyzer {//class
|
38 |
|
|
|
39 |
|
|
public:
|
40 |
|
|
|
41 |
|
|
HbbAnalyzer(const edm::ParameterSet & pset);
|
42 |
|
|
~HbbAnalyzer();
|
43 |
|
|
|
44 |
|
|
void beginJob(const edm::EventSetup&);
|
45 |
amagnan |
1.5 |
void analyze(const edm::Event& ,
|
46 |
|
|
const edm::EventSetup&
|
47 |
|
|
);
|
48 |
amagnan |
1.1 |
void endJob();
|
49 |
amagnan |
1.5 |
void dumpContent(const edm::Event& aEvt,
|
50 |
|
|
std::string aName,
|
51 |
|
|
std::string aProcess
|
52 |
|
|
);
|
53 |
|
|
|
54 |
amagnan |
1.9 |
|
55 |
amagnan |
1.1 |
private:
|
56 |
|
|
|
57 |
amagnan |
1.5 |
template <class T>
|
58 |
|
|
double deltaRwithLepton(const pat::Jet & aJet,
|
59 |
|
|
const edm::Handle<std::vector<T> > & aCol
|
60 |
|
|
);
|
61 |
|
|
|
62 |
amagnan |
1.1 |
//void processFirstEvent(const edm::Event& aEvt, std::string aName, std::vector<std::string> & aProcVec);
|
63 |
|
|
//void InitialiseHistograms();
|
64 |
|
|
//void FillHistograms(std::string aDirName, std::string aSubDirName, unsigned int aIndex, double apT, double aEta, double aPhi);
|
65 |
|
|
//void SaveHistograms();
|
66 |
|
|
|
67 |
|
|
int debug_;
|
68 |
amagnan |
1.4 |
|
69 |
|
|
//flavour of jets required :
|
70 |
|
|
// 3 = u,d,s,g, 21 = g
|
71 |
|
|
// 4=c, 5=b, 45=b or c
|
72 |
|
|
unsigned int flavour_;
|
73 |
amagnan |
1.1 |
//TFile* file_;
|
74 |
|
|
|
75 |
amagnan |
1.5 |
double jetLeptonIsolation_;
|
76 |
|
|
|
77 |
amagnan |
1.8 |
bool doElectrons_;
|
78 |
|
|
bool doMuons_;
|
79 |
|
|
bool doTaus_;
|
80 |
|
|
bool doJets_;
|
81 |
|
|
bool doMETs_;
|
82 |
amagnan |
1.9 |
bool doPairs_;
|
83 |
|
|
//bool doLepLepPairs_;
|
84 |
amagnan |
1.8 |
|
85 |
|
|
|
86 |
amagnan |
1.4 |
HbbAnalysis::JetFlavour jetFlav_;
|
87 |
|
|
|
88 |
amagnan |
1.3 |
edm::InputTag genParticleSrc_;
|
89 |
|
|
edm::InputTag electronSrc_;
|
90 |
amagnan |
1.1 |
edm::InputTag muonSrc_;
|
91 |
amagnan |
1.9 |
edm::InputTag tauSrc_;
|
92 |
|
|
//edm::InputTag pfTauSrc_;
|
93 |
amagnan |
1.1 |
edm::InputTag jetSrc_;
|
94 |
amagnan |
1.9 |
//edm::InputTag jptjetSrc_;
|
95 |
|
|
//edm::InputTag pfjetSrc_;
|
96 |
|
|
edm::InputTag metSrc_;
|
97 |
|
|
//edm::InputTag tcMetSrc_;
|
98 |
|
|
//edm::InputTag pfMetSrc_;
|
99 |
|
|
edm::InputTag pairSrc_;
|
100 |
|
|
//edm::InputTag mmPairSrc_;
|
101 |
|
|
//edm::InputTag etPairSrc_;
|
102 |
|
|
//edm::InputTag mtPairSrc_;
|
103 |
amagnan |
1.1 |
edm::InputTag vertexSrc_;
|
104 |
|
|
edm::InputTag triggerSrc_;
|
105 |
amagnan |
1.3 |
std::vector<std::string> hltPaths_;
|
106 |
amagnan |
1.1 |
//vector filled during processing with all existing collections
|
107 |
|
|
//std::vector<std::pair<std::string,std::string> > collections_;
|
108 |
|
|
|
109 |
|
|
//list of processes to consider to find input collections
|
110 |
|
|
//std::vector<std::string> processVec_;
|
111 |
|
|
|
112 |
amagnan |
1.3 |
//HbbAnalysis::HistosGenParticles GenHist_;
|
113 |
|
|
HbbAnalysis::HistosElecs ElecHistLead_;
|
114 |
|
|
HbbAnalysis::HistosElecs ElecHistLeadGenMatched_;
|
115 |
|
|
HbbAnalysis::HistosElecs ElecHistNtoLead_;
|
116 |
|
|
HbbAnalysis::HistosElecs ElecHistNtoLeadGenMatched_;
|
117 |
amagnan |
1.7 |
HbbAnalysis::HistosElecs ElecHistBarrelLead_;
|
118 |
|
|
HbbAnalysis::HistosElecs ElecHistBarrelLeadGenMatched_;
|
119 |
|
|
HbbAnalysis::HistosElecs ElecHistBarrelNtoLead_;
|
120 |
|
|
HbbAnalysis::HistosElecs ElecHistBarrelNtoLeadGenMatched_;
|
121 |
|
|
HbbAnalysis::HistosElecs ElecHistEndCapLead_;
|
122 |
|
|
HbbAnalysis::HistosElecs ElecHistEndCapLeadGenMatched_;
|
123 |
|
|
HbbAnalysis::HistosElecs ElecHistEndCapNtoLead_;
|
124 |
|
|
HbbAnalysis::HistosElecs ElecHistEndCapNtoLeadGenMatched_;
|
125 |
amagnan |
1.3 |
HbbAnalysis::HistosMuons MuHistLead_;
|
126 |
|
|
HbbAnalysis::HistosMuons MuHistLeadGenMatched_;
|
127 |
|
|
HbbAnalysis::HistosMuons MuHistNtoLead_;
|
128 |
|
|
HbbAnalysis::HistosMuons MuHistNtoLeadGenMatched_;
|
129 |
amagnan |
1.9 |
HbbAnalysis::HistosTaus TauHist_;
|
130 |
|
|
HbbAnalysis::HistosTaus TauHistGenMatched_;
|
131 |
|
|
//HbbAnalysis::HistosTaus PFTauHist_;
|
132 |
|
|
//HbbAnalysis::HistosTaus PFTauHistGenMatched_;
|
133 |
amagnan |
1.5 |
HbbAnalysis::HistosJets JetHist_;
|
134 |
amagnan |
1.9 |
// HbbAnalysis::HistosJets JPTJetHist_;
|
135 |
|
|
//HbbAnalysis::HistosJets PFJetHist_;
|
136 |
amagnan |
1.4 |
HbbAnalysis::HistosJets JetHistLead_;
|
137 |
amagnan |
1.9 |
//HbbAnalysis::HistosJets JPTJetHistLead_;
|
138 |
|
|
//HbbAnalysis::HistosJets PFJetHistLead_;
|
139 |
amagnan |
1.4 |
HbbAnalysis::HistosJets JetHistNtoLead_;
|
140 |
amagnan |
1.9 |
//HbbAnalysis::HistosJets JPTJetHistNtoLead_;
|
141 |
|
|
//HbbAnalysis::HistosJets PFJetHistNtoLead_;
|
142 |
|
|
HbbAnalysis::HistosPairs PairHist_;
|
143 |
|
|
HbbAnalysis::HistosPairs PairHistLead_;
|
144 |
|
|
//HbbAnalysis::HistosPairs MMPairHist_;
|
145 |
|
|
//HbbAnalysis::HistosPairs ETPairHist_;
|
146 |
|
|
//HbbAnalysis::HistosPairs MTPairHist_;
|
147 |
|
|
HbbAnalysis::HistosMET MetHist_;
|
148 |
|
|
//HbbAnalysis::HistosMET TcMetHist_;
|
149 |
|
|
//HbbAnalysis::HistosMET PFMetHist_;
|
150 |
amagnan |
1.3 |
//HbbAnalysis::HistosTrigs TrigHist_;
|
151 |
amagnan |
1.1 |
|
152 |
|
|
//TH1F *p_muonpT;
|
153 |
|
|
//TH1F *p_muoneta;
|
154 |
|
|
//TH1F *p_muonphi;
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
};//class
|
158 |
|
|
|
159 |
|
|
|
160 |
amagnan |
1.5 |
|
161 |
|
|
template <class T>
|
162 |
|
|
double HbbAnalyzer::deltaRwithLepton(const pat::Jet & aJet,
|
163 |
|
|
const edm::Handle<std::vector< T > > & aCol
|
164 |
|
|
)
|
165 |
|
|
{
|
166 |
|
|
double lMin = 1000;
|
167 |
|
|
bool lValid=(aCol->empty())?true:false;
|
168 |
|
|
|
169 |
|
|
// pat::Lepton<LeptonType> lLep;
|
170 |
amagnan |
1.6 |
typename std::vector< T >::const_iterator iLepton;
|
171 |
amagnan |
1.5 |
|
172 |
amagnan |
1.6 |
for (iLepton= aCol->begin();
|
173 |
|
|
iLepton != aCol->end();
|
174 |
|
|
iLepton++)
|
175 |
|
|
// for (unsigned int iLepton(0); iLepton< aCol->size(); iLepton++)
|
176 |
amagnan |
1.5 |
{
|
177 |
amagnan |
1.6 |
//double lDeltaR = ROOT::Math::VectorUtil::DeltaR(aJet.p4(),aCol->at(iLepton).p4());
|
178 |
|
|
double lDeltaR = ROOT::Math::VectorUtil::DeltaR(aJet.p4(),iLepton->p4());
|
179 |
amagnan |
1.5 |
if (lDeltaR<lMin){
|
180 |
|
|
lMin=lDeltaR;
|
181 |
|
|
lValid=true;
|
182 |
|
|
}
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
if(!lValid){
|
186 |
|
|
std::cerr<<__PRETTY_FUNCTION__<<" : Invalid Return value "
|
187 |
|
|
<< lMin
|
188 |
|
|
<< "... AAAAAAARRRRRRRRRRRRGGGGGGGGGHHHHH"
|
189 |
|
|
<<std::endl;
|
190 |
|
|
}
|
191 |
|
|
if (lMin > 100) return -1;
|
192 |
|
|
|
193 |
|
|
return lMin;
|
194 |
|
|
|
195 |
|
|
}
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
|
200 |
|
|
|
201 |
amagnan |
1.1 |
#endif //HbbAnalysis_HbbAnalyzer_hh
|