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 |
#include "Math/VectorUtil.h"
|
10 |
|
11 |
#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/Common/interface/TriggerNames.h"
|
16 |
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
17 |
|
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 |
|
25 |
#include "UserCode/HbbAnalysis/interface/HistosElecs.hh"
|
26 |
#include "UserCode/HbbAnalysis/interface/HistosMuons.hh"
|
27 |
#include "UserCode/HbbAnalysis/interface/HistosTaus.hh"
|
28 |
#include "UserCode/HbbAnalysis/interface/HistosJets.hh"
|
29 |
#include "UserCode/HbbAnalysis/interface/HistosPairs.hh"
|
30 |
#include "UserCode/HbbAnalysis/interface/HistosMET.hh"
|
31 |
#include "UserCode/HbbAnalysis/interface/JetFlavour.hh"
|
32 |
|
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();
|
45 |
void analyze(const edm::Event& ,
|
46 |
const edm::EventSetup&
|
47 |
);
|
48 |
void endJob();
|
49 |
void dumpContent(const edm::Event& aEvt,
|
50 |
std::string aName,
|
51 |
std::string aProcess
|
52 |
);
|
53 |
|
54 |
|
55 |
private:
|
56 |
|
57 |
template <class T>
|
58 |
double deltaRwithLepton(const pat::Jet & aJet,
|
59 |
const edm::Handle<std::vector<T> > & aCol
|
60 |
);
|
61 |
|
62 |
//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 |
|
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 |
//TFile* file_;
|
74 |
|
75 |
double jetLeptonIsolation_;
|
76 |
|
77 |
bool doElectrons_;
|
78 |
bool doMuons_;
|
79 |
bool doTaus_;
|
80 |
bool doJets_;
|
81 |
bool doMETs_;
|
82 |
bool doPairs_;
|
83 |
//bool doLepLepPairs_;
|
84 |
|
85 |
|
86 |
HbbAnalysis::JetFlavour jetFlav_;
|
87 |
|
88 |
edm::InputTag genParticleSrc_;
|
89 |
edm::InputTag electronSrc_;
|
90 |
edm::InputTag muonSrc_;
|
91 |
edm::InputTag tauSrc_;
|
92 |
//edm::InputTag pfTauSrc_;
|
93 |
edm::InputTag jetSrc_;
|
94 |
//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 |
edm::InputTag vertexSrc_;
|
104 |
edm::InputTag triggerSrc_;
|
105 |
std::vector<std::string> hltPaths_;
|
106 |
//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 |
//HbbAnalysis::HistosGenParticles GenHist_;
|
113 |
HbbAnalysis::HistosElecs ElecHistLead_;
|
114 |
HbbAnalysis::HistosElecs ElecHistLeadGenMatched_;
|
115 |
HbbAnalysis::HistosElecs ElecHistNtoLead_;
|
116 |
HbbAnalysis::HistosElecs ElecHistNtoLeadGenMatched_;
|
117 |
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 |
HbbAnalysis::HistosMuons MuHistLead_;
|
126 |
HbbAnalysis::HistosMuons MuHistLeadGenMatched_;
|
127 |
HbbAnalysis::HistosMuons MuHistNtoLead_;
|
128 |
HbbAnalysis::HistosMuons MuHistNtoLeadGenMatched_;
|
129 |
HbbAnalysis::HistosTaus TauHist_;
|
130 |
HbbAnalysis::HistosTaus TauHistGenMatched_;
|
131 |
//HbbAnalysis::HistosTaus PFTauHist_;
|
132 |
//HbbAnalysis::HistosTaus PFTauHistGenMatched_;
|
133 |
HbbAnalysis::HistosJets JetHist_;
|
134 |
// HbbAnalysis::HistosJets JPTJetHist_;
|
135 |
//HbbAnalysis::HistosJets PFJetHist_;
|
136 |
HbbAnalysis::HistosJets JetHistLead_;
|
137 |
//HbbAnalysis::HistosJets JetHistLeadGenMatched_;
|
138 |
//HbbAnalysis::HistosJets JPTJetHistLead_;
|
139 |
//HbbAnalysis::HistosJets PFJetHistLead_;
|
140 |
HbbAnalysis::HistosJets JetHistNtoLead_;
|
141 |
//HbbAnalysis::HistosJets JetHistNtoLeadGenMatched_;
|
142 |
//HbbAnalysis::HistosJets JPTJetHistNtoLead_;
|
143 |
//HbbAnalysis::HistosJets PFJetHistNtoLead_;
|
144 |
HbbAnalysis::HistosPairs PairHist_;
|
145 |
HbbAnalysis::HistosPairs PairHistLead_;
|
146 |
//HbbAnalysis::HistosPairs MMPairHist_;
|
147 |
//HbbAnalysis::HistosPairs ETPairHist_;
|
148 |
//HbbAnalysis::HistosPairs MTPairHist_;
|
149 |
HbbAnalysis::HistosMET MetHist_;
|
150 |
//HbbAnalysis::HistosMET TcMetHist_;
|
151 |
//HbbAnalysis::HistosMET PFMetHist_;
|
152 |
//HbbAnalysis::HistosTrigs TrigHist_;
|
153 |
|
154 |
//TH1F *p_muonpT;
|
155 |
//TH1F *p_muoneta;
|
156 |
//TH1F *p_muonphi;
|
157 |
|
158 |
|
159 |
};//class
|
160 |
|
161 |
|
162 |
|
163 |
template <class T>
|
164 |
double HbbAnalyzer::deltaRwithLepton(const pat::Jet & aJet,
|
165 |
const edm::Handle<std::vector< T > > & aCol
|
166 |
)
|
167 |
{
|
168 |
double lMin = 1000;
|
169 |
bool lValid=(aCol->empty())?true:false;
|
170 |
|
171 |
// pat::Lepton<LeptonType> lLep;
|
172 |
typename std::vector< T >::const_iterator iLepton;
|
173 |
|
174 |
for (iLepton= aCol->begin();
|
175 |
iLepton != aCol->end();
|
176 |
iLepton++)
|
177 |
// for (unsigned int iLepton(0); iLepton< aCol->size(); iLepton++)
|
178 |
{
|
179 |
//double lDeltaR = ROOT::Math::VectorUtil::DeltaR(aJet.p4(),aCol->at(iLepton).p4());
|
180 |
double lDeltaR = ROOT::Math::VectorUtil::DeltaR(aJet.p4(),iLepton->p4());
|
181 |
if (lDeltaR<lMin){
|
182 |
lMin=lDeltaR;
|
183 |
lValid=true;
|
184 |
}
|
185 |
}
|
186 |
|
187 |
if(!lValid){
|
188 |
std::cerr<<__PRETTY_FUNCTION__<<" : Invalid Return value "
|
189 |
<< lMin
|
190 |
<< "... AAAAAAARRRRRRRRRRRRGGGGGGGGGHHHHH"
|
191 |
<<std::endl;
|
192 |
}
|
193 |
if (lMin > 100) return -1;
|
194 |
|
195 |
return lMin;
|
196 |
|
197 |
}
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
#endif //HbbAnalysis_HbbAnalyzer_hh
|