17 |
|
// |
18 |
|
// |
19 |
|
|
20 |
+ |
|
21 |
+ |
//uncomment to save also jet collections 1 and 4 |
22 |
+ |
//#define ENABLE_SIMPLEJETS1 |
23 |
+ |
//#define ENABLE_SIMPLEJETS4 |
24 |
+ |
|
25 |
+ |
#include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h" |
26 |
+ |
#include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h" |
27 |
+ |
#include "JetMETCorrections/Objects/interface/JetCorrector.h" |
28 |
+ |
#include "JetMETCorrections/Objects/interface/JetCorrectionsRecord.h" |
29 |
+ |
#include "DataFormats/TrackReco/interface/TrackFwd.h" |
30 |
+ |
|
31 |
|
#include "VHbbAnalysis/HbbAnalyzer/interface/HbbAnalyzerNew.h" |
32 |
< |
#include "VHbbAnalysis/HbbAnalyzer/interface/VHbbEvent.h" |
32 |
> |
#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" |
33 |
> |
|
34 |
> |
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" |
35 |
|
|
36 |
|
#define GENPTOLOR(a) TLorentzVector((a).px(), (a).py(), (a).pz(), (a).energy()) |
37 |
|
#define GENPTOLORP(a) TLorentzVector((a)->px(), (a)->py(), (a)->pz(), (a)->energy()) |
38 |
|
|
39 |
< |
HbbAnalyzerNew::HbbAnalyzerNew(const edm::ParameterSet& iConfig): |
40 |
< |
eleLabel_(iConfig.getUntrackedParameter<edm::InputTag>("electronTag")), |
41 |
< |
muoLabel_(iConfig.getUntrackedParameter<edm::InputTag>("muonTag")), |
42 |
< |
jetLabel_(iConfig.getUntrackedParameter<edm::InputTag>("jetTag")), |
43 |
< |
subjetLabel_(iConfig.getUntrackedParameter<edm::InputTag>("subjetTag")), |
44 |
< |
simplejet1Label_(iConfig.getUntrackedParameter<edm::InputTag>("simplejet1Tag")), |
45 |
< |
simplejet2Label_(iConfig.getUntrackedParameter<edm::InputTag>("simplejet2Tag")), |
46 |
< |
simplejet3Label_(iConfig.getUntrackedParameter<edm::InputTag>("simplejet3Tag")), |
47 |
< |
simplejet4Label_(iConfig.getUntrackedParameter<edm::InputTag>("simplejet4Tag")), |
48 |
< |
tauLabel_(iConfig.getUntrackedParameter<edm::InputTag>("tauTag")), |
49 |
< |
metLabel_(iConfig.getUntrackedParameter<edm::InputTag>("metTag")), |
50 |
< |
phoLabel_(iConfig.getUntrackedParameter<edm::InputTag>("photonTag")), |
51 |
< |
dimuLabel_(iConfig.getUntrackedParameter<edm::InputTag>("dimuTag")), |
52 |
< |
dielecLabel_(iConfig.getUntrackedParameter<edm::InputTag>("dielecTag")), |
53 |
< |
hltResults_(iConfig.getUntrackedParameter<edm::InputTag>("hltResultsTag")), |
54 |
< |
runOnMC_(iConfig.getParameter<bool>("runOnMC")) { |
39 |
> |
|
40 |
> |
struct CompareJetPtMuons { |
41 |
> |
bool operator()( const VHbbEvent::MuonInfo& j1, const VHbbEvent::MuonInfo& j2 ) const { |
42 |
> |
return j1.p4.Pt() > j2.p4.Pt(); |
43 |
> |
} |
44 |
> |
}; |
45 |
> |
struct CompareJetPtElectrons { |
46 |
> |
bool operator()( const VHbbEvent::ElectronInfo& j1, const VHbbEvent::ElectronInfo& j2 ) const { |
47 |
> |
return j1.p4.Pt() > j2.p4.Pt(); |
48 |
> |
} |
49 |
> |
}; |
50 |
> |
struct CompareJetPtTaus { |
51 |
> |
bool operator()( const VHbbEvent::TauInfo& j1, const VHbbEvent::TauInfo& j2 ) const { |
52 |
> |
return j1.p4.Pt() > j2.p4.Pt(); |
53 |
> |
} |
54 |
> |
}; |
55 |
> |
|
56 |
|
|
57 |
|
|
58 |
+ |
HbbAnalyzerNew::HbbAnalyzerNew(const edm::ParameterSet& iConfig): |
59 |
+ |
eleLabel_(iConfig.getParameter<edm::InputTag>("electronTag")), |
60 |
+ |
muoLabel_(iConfig.getParameter<edm::InputTag>("muonTag")), |
61 |
+ |
jetLabel_(iConfig.getParameter<edm::InputTag>("jetTag")), |
62 |
+ |
subjetLabel_(iConfig.getParameter<edm::InputTag>("subjetTag")), |
63 |
+ |
simplejet1Label_(iConfig.getParameter<edm::InputTag>("simplejet1Tag")), |
64 |
+ |
simplejet2Label_(iConfig.getParameter<edm::InputTag>("simplejet2Tag")), |
65 |
+ |
simplejet3Label_(iConfig.getParameter<edm::InputTag>("simplejet3Tag")), |
66 |
+ |
simplejet4Label_(iConfig.getParameter<edm::InputTag>("simplejet4Tag")), |
67 |
+ |
tauLabel_(iConfig.getParameter<edm::InputTag>("tauTag")), |
68 |
+ |
metLabel_(iConfig.getParameter<edm::InputTag>("metTag")), |
69 |
+ |
phoLabel_(iConfig.getParameter<edm::InputTag>("photonTag")), |
70 |
+ |
hltResults_(iConfig.getParameter<edm::InputTag>("hltResultsTag")), |
71 |
+ |
runOnMC_(iConfig.getParameter<bool>("runOnMC")), verbose_(iConfig.getUntrackedParameter<bool>("verbose")) { |
72 |
+ |
|
73 |
|
// |
74 |
|
// put the setwhatproduced etc etc |
75 |
|
|
76 |
|
produces<VHbbEvent>(); |
77 |
+ |
produces<VHbbEventAuxInfo>(); |
78 |
|
|
79 |
|
|
80 |
|
} |
97 |
|
HbbAnalyzerNew::produce(edm::Event& iEvent, const edm::EventSetup& iSetup){ |
98 |
|
using namespace edm; |
99 |
|
using namespace reco; |
100 |
+ |
|
101 |
+ |
|
102 |
+ |
// JEC Uncertainty |
103 |
+ |
|
104 |
+ |
// JetCorrectionUncertainty *jecUnc=0; |
105 |
+ |
edm::ESHandle<JetCorrectorParametersCollection> JetCorParColl; |
106 |
+ |
iSetup.get<JetCorrectionsRecord>().get("AK5PF",JetCorParColl); |
107 |
+ |
JetCorrectionUncertainty *jecUnc=0; |
108 |
+ |
// if (!runOnMC_){ |
109 |
+ |
JetCorrectorParameters const & JetCorPar = (*JetCorParColl)["Uncertainty"]; |
110 |
+ |
jecUnc = new JetCorrectionUncertainty(JetCorPar); |
111 |
+ |
// } |
112 |
|
|
113 |
< |
|
114 |
< |
std::auto_ptr<VHbbEvent> hbbInfo( new VHbbEvent() ); |
115 |
< |
|
113 |
> |
std::auto_ptr<VHbbEvent> hbbInfo( new VHbbEvent() ); |
114 |
> |
std::auto_ptr<VHbbEventAuxInfo> auxInfo( new VHbbEventAuxInfo() ); |
115 |
> |
|
116 |
> |
|
117 |
> |
if (runOnMC_){ |
118 |
> |
Handle<GenEventInfoProduct> evt_info; |
119 |
> |
iEvent.getByType(evt_info); |
120 |
> |
auxInfo->weightMCProd = evt_info->weight(); |
121 |
> |
} |
122 |
> |
else |
123 |
> |
{ auxInfo->weightMCProd =1.;} |
124 |
|
// |
125 |
|
// ?? |
126 |
< |
|
126 |
> |
|
127 |
> |
// trigger |
128 |
> |
|
129 |
|
// trigger |
130 |
|
edm::Handle<edm::TriggerResults> hltresults; |
131 |
|
//iEvent.getByLabel("TriggerResults", hltresults); |
135 |
|
iEvent.getByLabel(hltResults_, hltresults); |
136 |
|
|
137 |
|
const edm::TriggerNames & triggerNames_ = iEvent.triggerNames(*hltresults); |
86 |
– |
|
87 |
– |
int ntrigs = hltresults->size(); |
88 |
– |
if (ntrigs==0){std::cout << "%HLTInfo -- No trigger name given in TriggerResults of the input " << std::endl;} |
89 |
– |
|
90 |
– |
for (int itrig = 0; itrig != ntrigs; ++itrig){ |
91 |
– |
|
92 |
– |
TString trigName=triggerNames_.triggerName(itrig); |
93 |
– |
bool accept = hltresults->accept(itrig); |
94 |
– |
|
95 |
– |
if (accept){(hbbInfo->triggerInfo.flag)[itrig] = 1;} |
96 |
– |
else { (hbbInfo->triggerInfo.flag)[itrig] = 0;} |
97 |
– |
|
98 |
– |
// std::cout << "%HLTInfo -- Number of HLT Triggers: " << ntrigs << std::endl; |
99 |
– |
// std::cout << "%HLTInfo -- HLTTrigger(" << itrig << "): " << trigName << " = " << accept << std::endl; |
100 |
– |
} |
101 |
– |
|
102 |
– |
// |
103 |
– |
// big bloat |
104 |
– |
// |
105 |
– |
|
106 |
– |
|
107 |
– |
int goodDoubleMu3=0,goodDoubleMu3_2=0, |
108 |
– |
goodMu9=0, goodIsoMu9=0, goodMu11=0, goodIsoMu13_3=0, goodMu15=0, goodMu15_1=0; |
109 |
– |
int goodDoubleElec10=0,goodDoubleElec15_1=0,goodDoubleElec17_1=0; |
110 |
– |
int goodMet100=0; |
111 |
– |
int goodSingleEle1=0,goodSingleEle2=0,goodSingleEle3=0,goodSingleEle4=0; |
112 |
– |
int goodBtagMu1=0,goodBtagMu2=0,goodBtagMu0=0,goodBtagMu11=0; |
113 |
– |
int goodBtagMuJet1=0, goodBtagMuJet2=0, goodBtagMuJet3=0, goodBtagMuJet4=0; |
114 |
– |
int goodIsoMu15=0,goodIsoMu17v5=0,goodIsoMu17v6=0; |
115 |
– |
|
116 |
– |
for (int itrig = 0; itrig != ntrigs; ++itrig){ |
117 |
– |
TString trigName=triggerNames_.triggerName(itrig); |
118 |
– |
if(strcmp(trigName,"HLT_Mu9")==0) goodMu9++; |
119 |
– |
if(strcmp(trigName,"HLT_IsoMu9")==0) goodIsoMu9++; |
120 |
– |
if(strcmp(trigName,"HLT_IsoMu13_v3")==0) goodIsoMu13_3++; |
121 |
– |
if(strcmp(trigName,"HLT_Mu11")==0) goodMu11++; |
122 |
– |
if(strcmp(trigName,"HLT_DoubleMu3")==0) goodDoubleMu3++; |
123 |
– |
if(strcmp(trigName,"HLT_DoubleMu3_v2")==0) goodDoubleMu3_2++; |
124 |
– |
if(strcmp(trigName,"HLT_Mu15")==0) goodMu15++; |
125 |
– |
if(strcmp(trigName,"HLT_Mu15_v1")==0) goodMu15_1++; |
126 |
– |
|
127 |
– |
if(strcmp(trigName,"HLT_DoubleEle10_SW_L1R")==0) goodDoubleElec10++; |
128 |
– |
if(strcmp(trigName,"HLT_DoubleEle15_SW_L1R_v1")==0) goodDoubleElec15_1++; |
129 |
– |
if(strcmp(trigName,"HLT_DoubleEle17_SW_L1R_v1")==0) goodDoubleElec17_1++; |
130 |
– |
if(strcmp(trigName,"HLT_MET100_v1")==0) goodMet100++; |
131 |
– |
if(strcmp(trigName,"HLT_Ele15_SW_L1R")==0) goodSingleEle1++; |
132 |
– |
if(strcmp(trigName,"HLT_Ele17_SW_TightEleId_L1R")==0) goodSingleEle2++; |
133 |
– |
if(strcmp(trigName,"HLT_Ele17_SW_TighterEleIdIsol_L1R_v2")==0) goodSingleEle3++; |
134 |
– |
if(strcmp(trigName,"HLT_Ele17_SW_TighterEleIdIsol_L1R_v3")==0) goodSingleEle4++; |
135 |
– |
if(strcmp(trigName,"HLT_BTagMu_DiJet20U_v1")==0) goodBtagMu1++; |
136 |
– |
if(strcmp(trigName,"HLT_BTagMu_DiJet30U_Mu5_v3")==0) goodBtagMu2++; |
137 |
– |
if(strcmp(trigName,"HLT_BTagMu_Jet20U")==0) goodBtagMu0++; |
138 |
– |
if(strcmp(trigName,"HLT_BTagMu_DiJet20U_Mu5_v1")==0) goodBtagMu11++; |
139 |
– |
if(strcmp(trigName,"HLT_Mu17_CentralJet30_BTagIP_v2")==0) goodBtagMuJet1++; |
140 |
– |
if(strcmp(trigName,"HLT_Mu17_CentralJet30_v2")==0) goodBtagMuJet2++; |
141 |
– |
if(strcmp(trigName,"HLT_HT200_Mu5_PFMHT35_v2")==0) goodBtagMuJet3++; |
142 |
– |
if(strcmp(trigName,"HLT_Mu12_CentralJet30_BTagIP_v2")==0) goodBtagMuJet4++; |
143 |
– |
|
144 |
– |
if(strcmp(trigName,"HLT_IsoMu15_v5")==0) goodIsoMu15++; |
145 |
– |
if(strcmp(trigName,"HLT_IsoMu17_v5")==0) goodIsoMu17v5++; |
146 |
– |
if(strcmp(trigName,"HLT_IsoMu17_v6")==0) goodIsoMu17v6++; |
147 |
– |
} |
148 |
– |
int itrig1=-99; |
149 |
– |
if(goodMu9!=0) itrig1 = triggerNames_.triggerIndex("HLT_Mu9"); |
150 |
– |
int itrig2=-99; |
151 |
– |
if(goodIsoMu9!=0) itrig2 = triggerNames_.triggerIndex("HLT_IsoMu9"); |
152 |
– |
int itrig3=-99; |
153 |
– |
if(goodIsoMu13_3!=0) itrig3 = triggerNames_.triggerIndex("HLT_IsoMu13_v3"); |
154 |
– |
int itrig4=-99; |
155 |
– |
if(goodMu11!=0) itrig4 = triggerNames_.triggerIndex("HLT_Mu11"); |
156 |
– |
int itrig5=-99; |
157 |
– |
if(goodDoubleMu3!=0) itrig5 = triggerNames_.triggerIndex("HLT_DoubleMu3"); |
158 |
– |
int itrig6=-99; |
159 |
– |
if(goodDoubleMu3_2!=0) itrig6 = triggerNames_.triggerIndex("HLT_DoubleMu3_v2"); |
160 |
– |
int itrig7=-99; |
161 |
– |
if(goodMu15!=0) itrig7 = triggerNames_.triggerIndex("HLT_Mu15"); |
162 |
– |
int itrig8=-99; |
163 |
– |
if(goodMu15_1!=0) itrig8 = triggerNames_.triggerIndex("HLT_Mu15_v1"); |
164 |
– |
|
165 |
– |
int itrig9=-99; |
166 |
– |
if(goodDoubleElec10!=0) itrig9 = triggerNames_.triggerIndex("HLT_DoubleEle10_SW_L1R"); |
167 |
– |
int itrig10=-99; |
168 |
– |
if(goodDoubleElec15_1!=0) itrig10 = triggerNames_.triggerIndex("HLT_DoubleEle15_SW_L1R_v1"); |
169 |
– |
int itrig11=-99; |
170 |
– |
if(goodDoubleElec17_1!=0) itrig11 = triggerNames_.triggerIndex("HLT_DoubleEle17_SW_L1R_v1"); |
171 |
– |
int itrig12=-99; |
172 |
– |
if(goodMet100!=0) itrig12 = triggerNames_.triggerIndex("HLT_MET100_v1"); |
173 |
– |
|
174 |
– |
int itrig13=-99; |
175 |
– |
if(goodSingleEle1!=0) itrig13 = triggerNames_.triggerIndex("HLT_Ele15_SW_L1R"); |
176 |
– |
int itrig14=-99; |
177 |
– |
if(goodSingleEle2!=0) itrig14 = triggerNames_.triggerIndex("HLT_Ele17_SW_TightEleId_L1R"); |
178 |
– |
int itrig15=-99; |
179 |
– |
if(goodSingleEle3!=0) itrig15 = triggerNames_.triggerIndex("HLT_Ele17_SW_TighterEleIdIsol_L1R_v2"); |
180 |
– |
int itrig16=-99; |
181 |
– |
if(goodSingleEle4!=0) itrig16 = triggerNames_.triggerIndex("HLT_Ele17_SW_TighterEleIdIsol_L1R_v3"); |
182 |
– |
|
183 |
– |
int itrig17=-99; |
184 |
– |
if(goodBtagMu1!=0) itrig17 = triggerNames_.triggerIndex("HLT_BTagMu_DiJet20U_v1"); |
185 |
– |
int itrig18=-99; |
186 |
– |
if(goodBtagMu2!=0) itrig18 = triggerNames_.triggerIndex("HLT_BTagMu_DiJet30U_Mu5_v3"); |
187 |
– |
int itrig19=-99; |
188 |
– |
if(goodBtagMu0!=0) itrig19 = triggerNames_.triggerIndex("HLT_BTagMu_Jet20U"); |
189 |
– |
int itrig20=-99; |
190 |
– |
if(goodBtagMu11!=0) itrig20 = triggerNames_.triggerIndex("HLT_BTagMu_DiJet20U_Mu5_v1"); |
191 |
– |
int itrig21=-99; |
192 |
– |
if(goodBtagMuJet1!=0) itrig21 = triggerNames_.triggerIndex("HLT_Mu17_CentralJet30_BTagIP_v2"); |
193 |
– |
int itrig22=-99; |
194 |
– |
if(goodBtagMuJet2!=0) itrig22 = triggerNames_.triggerIndex("HLT_Mu17_CentralJet30_v2"); |
195 |
– |
int itrig23=-99; |
196 |
– |
if(goodBtagMuJet3!=0) itrig23 = triggerNames_.triggerIndex("HLT_HT200_Mu5_PFMHT35_v2"); |
197 |
– |
int itrig231=-99; |
198 |
– |
if(goodBtagMuJet4!=0) itrig231 = triggerNames_.triggerIndex("HLT_Mu12_CentralJet30_BTagIP_v2"); |
199 |
– |
|
200 |
– |
int itrig24=-99; |
201 |
– |
if(goodIsoMu15!=0) itrig24 = triggerNames_.triggerIndex("HLT_IsoMu15_v5"); |
202 |
– |
int itrig25=-99; |
203 |
– |
if(goodIsoMu17v5!=0) itrig25 = triggerNames_.triggerIndex("HLT_IsoMu17_v5"); |
204 |
– |
int itrig26=-99; |
205 |
– |
if(goodIsoMu17v6!=0) itrig26 = triggerNames_.triggerIndex("HLT_IsoMu17_v6"); |
206 |
– |
|
207 |
– |
if (itrig1!=-99 && hltresults->accept(itrig1)) hbbInfo->triggerInfo.triggerMu9=1; else hbbInfo->triggerInfo.triggerMu9=0; |
208 |
– |
if (itrig2!=-99 && hltresults->accept(itrig2)) hbbInfo->triggerInfo.triggerIsoMu9=1; else hbbInfo->triggerInfo.triggerIsoMu9=0; |
209 |
– |
if (itrig3!=-99 && hltresults->accept(itrig3)) hbbInfo->triggerInfo.triggerIsoMu13_3=1; else hbbInfo->triggerInfo.triggerIsoMu13_3=0; |
210 |
– |
if (itrig4!=-99 && hltresults->accept(itrig4)) hbbInfo->triggerInfo.triggerMu11=1; else hbbInfo->triggerInfo.triggerMu11=0; |
211 |
– |
if (itrig5!=-99 && hltresults->accept(itrig5)) hbbInfo->triggerInfo.triggerDoubleMu3=1; else hbbInfo->triggerInfo.triggerDoubleMu3=0; |
212 |
– |
if (itrig6!=-99 && hltresults->accept(itrig6)) hbbInfo->triggerInfo.triggerDoubleMu3_2=1; else hbbInfo->triggerInfo.triggerDoubleMu3_2=0; |
213 |
– |
if (itrig7!=-99 && hltresults->accept(itrig7)) hbbInfo->triggerInfo.triggerMu15=1; else hbbInfo->triggerInfo.triggerMu15=0; |
214 |
– |
if (itrig8!=-99 && hltresults->accept(itrig8)) hbbInfo->triggerInfo.triggerMu15_1=1; else hbbInfo->triggerInfo.triggerMu15_1=0; |
215 |
– |
|
216 |
– |
if (itrig9!=-99 && hltresults->accept(itrig9)) hbbInfo->triggerInfo.triggerDoubleElec10=1; else hbbInfo->triggerInfo.triggerDoubleElec10=0; |
217 |
– |
if (itrig10!=-99 && hltresults->accept(itrig10)) hbbInfo->triggerInfo.triggerDoubleElec15_1=1; else hbbInfo->triggerInfo.triggerDoubleElec15_1=0; |
218 |
– |
if (itrig11!=-99 && hltresults->accept(itrig11)) hbbInfo->triggerInfo.triggerDoubleElec17_1=1; else hbbInfo->triggerInfo.triggerDoubleElec17_1=0; |
219 |
– |
if (itrig12!=-99 && hltresults->accept(itrig12)) hbbInfo->triggerInfo.triggerMet100_1=1; else hbbInfo->triggerInfo.triggerMet100_1=0; |
220 |
– |
|
221 |
– |
if (itrig13!=-99 && hltresults->accept(itrig13)) hbbInfo->triggerInfo.triggerSingleEle1=1; else hbbInfo->triggerInfo.triggerSingleEle1=0; |
222 |
– |
if (itrig14!=-99 && hltresults->accept(itrig14)) hbbInfo->triggerInfo.triggerSingleEle2=1; else hbbInfo->triggerInfo.triggerSingleEle2=0; |
223 |
– |
if (itrig15!=-99 && hltresults->accept(itrig15)) hbbInfo->triggerInfo.triggerSingleEle3=1; else hbbInfo->triggerInfo.triggerSingleEle3=0; |
224 |
– |
if (itrig16!=-99 && hltresults->accept(itrig16)) hbbInfo->triggerInfo.triggerSingleEle4=1; else hbbInfo->triggerInfo.triggerSingleEle4=0; |
225 |
– |
|
226 |
– |
if (itrig17!=-99 && hltresults->accept(itrig17)) hbbInfo->triggerInfo.triggerBtagMu1=1; else hbbInfo->triggerInfo.triggerBtagMu1=0; |
227 |
– |
if (itrig18!=-99 && hltresults->accept(itrig18)) hbbInfo->triggerInfo.triggerBtagMu2=1; else hbbInfo->triggerInfo.triggerBtagMu2=0; |
228 |
– |
if (itrig19!=-99 && hltresults->accept(itrig19)) hbbInfo->triggerInfo.triggerBtagMu0=1; else hbbInfo->triggerInfo.triggerBtagMu0=0; |
229 |
– |
if (itrig20!=-99 && hltresults->accept(itrig20)) hbbInfo->triggerInfo.triggerBtagMu11=1; else hbbInfo->triggerInfo.triggerBtagMu11=0; |
230 |
– |
if (itrig21!=-99 && hltresults->accept(itrig21)) hbbInfo->triggerInfo.triggerBtagMuJet1=1; else hbbInfo->triggerInfo.triggerBtagMuJet1=0; |
231 |
– |
if (itrig22!=-99 && hltresults->accept(itrig22)) hbbInfo->triggerInfo.triggerBtagMuJet2=1; else hbbInfo->triggerInfo.triggerBtagMuJet2=0; |
232 |
– |
if (itrig23!=-99 && hltresults->accept(itrig23)) hbbInfo->triggerInfo.triggerBtagMuJet3=1; else hbbInfo->triggerInfo.triggerBtagMuJet3=0; |
233 |
– |
if (itrig231!=-99 && hltresults->accept(itrig231)) hbbInfo->triggerInfo.triggerBtagMuJet4=1; else hbbInfo->triggerInfo.triggerBtagMuJet4=0; |
234 |
– |
|
235 |
– |
if (itrig24!=-99 && hltresults->accept(itrig24)) hbbInfo->triggerInfo.triggerIsoMu15=1; else hbbInfo->triggerInfo.triggerIsoMu15=0; |
236 |
– |
if (itrig25!=-99 && hltresults->accept(itrig25)) hbbInfo->triggerInfo.triggerIsoMu17v5=1; else hbbInfo->triggerInfo.triggerIsoMu17v5=0; |
237 |
– |
if (itrig26!=-99 && hltresults->accept(itrig26)) hbbInfo->triggerInfo.triggerIsoMu17v6=1; else hbbInfo->triggerInfo.triggerIsoMu17v6=0; |
238 |
– |
|
239 |
– |
if (itrig1==-99) hbbInfo->triggerInfo.triggerMu9=-99; |
240 |
– |
if (itrig2==-99) hbbInfo->triggerInfo.triggerIsoMu9=-99; |
241 |
– |
if (itrig3==-99) hbbInfo->triggerInfo.triggerIsoMu13_3=-99; |
242 |
– |
if (itrig4==-99) hbbInfo->triggerInfo.triggerMu11=-99; |
243 |
– |
if (itrig5==-99) hbbInfo->triggerInfo.triggerDoubleMu3=-99; |
244 |
– |
if (itrig6==-99) hbbInfo->triggerInfo.triggerDoubleMu3_2=-99; |
245 |
– |
if (itrig7==-99) hbbInfo->triggerInfo.triggerMu15=-99; |
246 |
– |
if (itrig8==-99) hbbInfo->triggerInfo.triggerMu15_1=-99; |
247 |
– |
|
248 |
– |
if (itrig9==-99) hbbInfo->triggerInfo.triggerDoubleElec10=-99; |
249 |
– |
if (itrig10==-99) hbbInfo->triggerInfo.triggerDoubleElec15_1=-99; |
250 |
– |
if (itrig11==-99) hbbInfo->triggerInfo.triggerDoubleElec17_1=-99; |
251 |
– |
if (itrig12==-99) hbbInfo->triggerInfo.triggerMet100_1=-99; |
252 |
– |
|
253 |
– |
if (itrig13==-99) hbbInfo->triggerInfo.triggerSingleEle1=-99; |
254 |
– |
if (itrig14==-99) hbbInfo->triggerInfo.triggerSingleEle2=-99; |
255 |
– |
if (itrig15==-99) hbbInfo->triggerInfo.triggerSingleEle3=-99; |
256 |
– |
if (itrig16==-99) hbbInfo->triggerInfo.triggerSingleEle4=-99; |
257 |
– |
|
258 |
– |
if(itrig17==-99) hbbInfo->triggerInfo.triggerBtagMu1=-99; |
259 |
– |
if(itrig18==-99) hbbInfo->triggerInfo.triggerBtagMu2=-99; |
260 |
– |
if(itrig19==-99) hbbInfo->triggerInfo.triggerBtagMu0=-99; |
261 |
– |
if(itrig20==-99) hbbInfo->triggerInfo.triggerBtagMu11=-99; |
262 |
– |
if(itrig21==-99) hbbInfo->triggerInfo.triggerBtagMuJet1=-99; |
263 |
– |
if(itrig22==-99) hbbInfo->triggerInfo.triggerBtagMuJet2=-99; |
264 |
– |
if(itrig23==-99) hbbInfo->triggerInfo.triggerBtagMuJet3=-99; |
265 |
– |
if(itrig231==-99) hbbInfo->triggerInfo.triggerBtagMuJet4=-99; |
266 |
– |
|
267 |
– |
if(itrig24==-99) hbbInfo->triggerInfo.triggerIsoMu15=-99; |
268 |
– |
if(itrig25==-99) hbbInfo->triggerInfo.triggerIsoMu17v5=-99; |
269 |
– |
if(itrig26==-99) hbbInfo->triggerInfo.triggerIsoMu17v6=-99; |
270 |
– |
|
271 |
– |
// MinDRMu=-99.,MCBestMuId=-99,MCBestMuMomId=-99,MCBestMuGMomId=-99; |
272 |
– |
// for(int i=0;i<50;i++) {DeltaRMu[i]=-99;} |
273 |
– |
|
138 |
|
|
139 |
+ |
int ntrigs = hltresults->size(); |
140 |
+ |
if (ntrigs==0){std::cerr << "%HLTInfo -- No trigger name given in TriggerResults of the input " << std::endl;} |
141 |
|
|
142 |
|
BeamSpot vertexBeamSpot; |
143 |
|
edm::Handle<reco::BeamSpot> recoBeamSpotHandle; |
155 |
|
Handle<reco::VertexCollection> recVtxs; |
156 |
|
iEvent.getByLabel("offlinePrimaryVertices", recVtxs); |
157 |
|
|
158 |
+ |
auxInfo->pvInfo.nVertices = recVtxs->size(); |
159 |
+ |
|
160 |
|
for(size_t i = 0; i < recVtxs->size(); ++ i) { |
161 |
|
const Vertex &vtx = (*recVtxs)[i]; |
162 |
|
double RecVtxProb=TMath::Prob(vtx.chi2(),vtx.ndof()); |
169 |
|
const Vertex &RecVtx = (*recVtxs)[VtxIn]; |
170 |
|
const Vertex &RecVtxFirst = (*recVtxs)[0]; |
171 |
|
|
172 |
< |
hbbInfo->pvInfo.firstPVInPT2 = TVector3(RecVtxFirst.x(), RecVtxFirst.y(), RecVtxFirst.z()); |
173 |
< |
hbbInfo->pvInfo.firstPVInProb = TVector3(RecVtx.x(), RecVtx.y(), RecVtx.z()); |
174 |
< |
|
172 |
> |
auxInfo->pvInfo.firstPVInPT2 = TVector3(RecVtxFirst.x(), RecVtxFirst.y(), RecVtxFirst.z()); |
173 |
> |
auxInfo->pvInfo.firstPVInProb = TVector3(RecVtx.x(), RecVtx.y(), RecVtx.z()); |
174 |
> |
|
175 |
> |
(auxInfo->pvInfo).efirstPVInPT2 = (RecVtxFirst.error()); |
176 |
> |
(auxInfo->pvInfo).efirstPVInProb = RecVtx.error(); |
177 |
|
|
178 |
|
edm::Handle<double> rhoHandle; |
179 |
< |
iEvent.getByLabel(edm::InputTag("kt6PFJets", "rho"),rhoHandle); // configure srcRho = cms.InputTag('kt6PFJets") |
180 |
< |
hbbInfo->puInfo.rho = *rhoHandle; |
181 |
< |
|
179 |
> |
iEvent.getByLabel(edm::InputTag("kt6PFJets", "rho"),rhoHandle); |
180 |
> |
auxInfo->puInfo.rho = *rhoHandle; |
181 |
> |
|
182 |
> |
edm::Handle<double> rho25Handle; |
183 |
> |
iEvent.getByLabel(edm::InputTag("kt6PFJets25", "rho"),rho25Handle); |
184 |
> |
auxInfo->puInfo.rho25 = *rho25Handle; |
185 |
> |
|
186 |
> |
edm::Handle<std::vector< PileupSummaryInfo> > puHandle; |
187 |
> |
|
188 |
> |
if (runOnMC_){ |
189 |
> |
iEvent.getByType(puHandle); |
190 |
> |
if (puHandle.isValid()){ |
191 |
> |
|
192 |
> |
std::vector< PileupSummaryInfo> pu = (*puHandle); |
193 |
> |
for (std::vector<PileupSummaryInfo>::const_iterator it= pu.begin(); it!=pu.end(); ++it){ |
194 |
> |
int bx = (*it).getBunchCrossing(); |
195 |
> |
unsigned int num = (*it).getPU_NumInteractions(); |
196 |
> |
// std::cout <<" PU PUSHING "<<bx<<" " <<num<<std::endl; |
197 |
> |
auxInfo->puInfo.pus[bx] =num; |
198 |
> |
} |
199 |
> |
} |
200 |
> |
} |
201 |
> |
|
202 |
|
//// real start |
203 |
|
|
204 |
|
|
209 |
|
|
210 |
|
if(runOnMC_){ |
211 |
|
|
212 |
< |
int Hin=-99,Win=-99,Zin=-99,bin=-99,bbarin=-99; |
323 |
< |
|
324 |
< |
iEvent.getByLabel("genParticles", genParticles); |
212 |
> |
iEvent.getByLabel("genParticles", genParticles); |
213 |
|
|
214 |
|
for(size_t i = 0; i < genParticles->size(); ++ i) { |
215 |
+ |
|
216 |
|
const GenParticle & p = (*genParticles)[i]; |
217 |
|
int id = p.pdgId(); |
218 |
|
int st = p.status(); |
219 |
< |
|
219 |
> |
|
220 |
|
if(id==25){ |
221 |
< |
|
222 |
< |
/* int wh=0; |
223 |
< |
int nMoth = p.numberOfMothers(); |
224 |
< |
for(size_t jj = 0; jj < nMoth; ++ jj) { |
225 |
< |
const Candidate * mom = p.mother( jj ); |
226 |
< |
int nmomdau= mom->numberOfDaughters(); |
227 |
< |
for(size_t j = 0; j < nmomdau; ++ j) { |
228 |
< |
const Candidate * Wmomdau = mom->daughter( j ); |
340 |
< |
if(abs(Wmomdau->pdgId())==24) wh++; |
341 |
< |
} |
342 |
< |
} |
343 |
< |
|
344 |
< |
if(wh==0) continue; |
345 |
< |
*/ |
346 |
< |
Hin=i; |
347 |
< |
hbbInfo->mcH.status=st; |
348 |
< |
hbbInfo->mcH.charge=p.charge(); |
349 |
< |
if(p.mother(0)!=0) hbbInfo->mcH.momid=p.mother(0)->pdgId(); |
350 |
< |
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) hbbInfo->mcH.gmomid=p.mother(0)->mother(0)->pdgId(); |
351 |
< |
hbbInfo->mcH.fourMomentum = GENPTOLOR(p); |
352 |
< |
|
221 |
> |
|
222 |
> |
VHbbEventAuxInfo::ParticleMCInfo htemp; |
223 |
> |
htemp.status=st; |
224 |
> |
htemp.charge=p.charge(); |
225 |
> |
if(p.mother(0)!=0) htemp.momid=p.mother(0)->pdgId(); |
226 |
> |
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) htemp.gmomid=p.mother(0)->mother(0)->pdgId(); |
227 |
> |
htemp.p4 = GENPTOLOR(p); |
228 |
> |
|
229 |
|
int ndau = p.numberOfDaughters(); |
230 |
|
for(int j = 0; j < ndau; ++ j) { |
231 |
|
const Candidate * Hdau = p.daughter( j ); |
232 |
< |
hbbInfo->mcH.dauid.push_back(Hdau->pdgId()); |
233 |
< |
hbbInfo->mcH.dauFourMomentum.push_back(GENPTOLORP(Hdau)); |
232 |
> |
htemp.dauid.push_back(Hdau->pdgId()); |
233 |
> |
htemp.dauFourMomentum.push_back(GENPTOLORP(Hdau)); |
234 |
|
} |
235 |
+ |
(auxInfo->mcH).push_back(htemp); |
236 |
|
} |
237 |
+ |
|
238 |
+ |
|
239 |
+ |
if(abs(id)==24){ |
240 |
|
|
241 |
+ |
VHbbEventAuxInfo::ParticleMCInfo wtemp; |
242 |
+ |
wtemp.status=st; |
243 |
+ |
wtemp.charge=p.charge(); |
244 |
+ |
if(p.mother(0)!=0) wtemp.momid=p.mother(0)->pdgId(); |
245 |
+ |
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) wtemp.gmomid=p.mother(0)->mother(0)->pdgId(); |
246 |
+ |
wtemp.p4=GENPTOLOR(p); |
247 |
|
|
362 |
– |
if(abs(id)==24){ |
363 |
– |
|
364 |
– |
Win=i; |
365 |
– |
hbbInfo->mcW.status=st; |
366 |
– |
hbbInfo->mcW.charge=p.charge(); |
367 |
– |
if(p.mother(0)!=0) hbbInfo->mcW.momid=p.mother(0)->pdgId(); |
368 |
– |
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) hbbInfo->mcW.gmomid=p.mother(0)->mother(0)->pdgId(); |
369 |
– |
hbbInfo->mcW.fourMomentum=GENPTOLOR(p); |
370 |
– |
|
248 |
|
int ndau = p.numberOfDaughters(); |
249 |
|
for(int j = 0; j < ndau; ++ j) { |
250 |
|
const Candidate * Wdau = p.daughter( j ); |
251 |
< |
hbbInfo->mcW.dauid.push_back(Wdau->pdgId()); |
252 |
< |
hbbInfo->mcW.dauFourMomentum.push_back(GENPTOLORP(Wdau)); |
251 |
> |
wtemp.dauid.push_back(Wdau->pdgId()); |
252 |
> |
wtemp.dauFourMomentum.push_back(GENPTOLORP(Wdau)); |
253 |
|
} |
254 |
+ |
auxInfo->mcW.push_back(wtemp); |
255 |
|
} |
256 |
|
|
257 |
|
if(abs(id)==23){ |
258 |
|
|
259 |
< |
Zin=i; |
260 |
< |
hbbInfo->mcZ.status=st; |
261 |
< |
hbbInfo->mcZ.charge=p.charge(); |
262 |
< |
if(p.mother(0)!=0) hbbInfo->mcZ.momid=p.mother(0)->pdgId(); |
263 |
< |
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) hbbInfo->mcZ.gmomid=p.mother(0)->mother(0)->pdgId(); |
264 |
< |
hbbInfo->mcZ.fourMomentum=GENPTOLOR(p); |
259 |
> |
|
260 |
> |
VHbbEventAuxInfo::ParticleMCInfo ztemp; |
261 |
> |
ztemp.status=st; |
262 |
> |
ztemp.charge=p.charge(); |
263 |
> |
if(p.mother(0)!=0) ztemp.momid=p.mother(0)->pdgId(); |
264 |
> |
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) ztemp.gmomid=p.mother(0)->mother(0)->pdgId(); |
265 |
> |
ztemp.p4=GENPTOLOR(p); |
266 |
|
|
267 |
|
int ndau = p.numberOfDaughters(); |
268 |
|
for(int j = 0; j < ndau; ++ j) { |
269 |
|
const Candidate * Zdau = p.daughter( j ); |
270 |
< |
hbbInfo->mcZ.dauid.push_back(Zdau->pdgId()); |
271 |
< |
hbbInfo->mcZ.dauFourMomentum.push_back(GENPTOLOR(p)); |
270 |
> |
ztemp.dauid.push_back(Zdau->pdgId()); |
271 |
> |
ztemp.dauFourMomentum.push_back(GENPTOLOR(p)); |
272 |
|
} |
273 |
+ |
auxInfo->mcZ.push_back(ztemp); |
274 |
|
} |
275 |
|
// |
276 |
|
// binfo |
277 |
|
// |
278 |
< |
|
278 |
> |
|
279 |
|
|
280 |
|
if(id==5){ |
281 |
< |
bin=i; |
282 |
< |
hbbInfo->mcB.status=st; |
283 |
< |
hbbInfo->mcB.charge=p.charge(); |
284 |
< |
if(p.mother(0)!=0) hbbInfo->mcB.momid=p.mother(0)->pdgId(); |
285 |
< |
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) hbbInfo->mcB.gmomid=p.mother(0)->mother(0)->pdgId(); |
281 |
> |
|
282 |
> |
VHbbEventAuxInfo::ParticleMCInfo btemp; |
283 |
> |
btemp.status=st; |
284 |
> |
btemp.charge=p.charge(); |
285 |
> |
if(p.mother(0)!=0) btemp.momid=p.mother(0)->pdgId(); |
286 |
> |
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) btemp.gmomid=p.mother(0)->mother(0)->pdgId(); |
287 |
> |
|
288 |
> |
btemp.p4=GENPTOLOR(p); |
289 |
> |
|
290 |
> |
int nHDaubdau = p.numberOfDaughters(); |
291 |
> |
for(int j = 0; j < nHDaubdau; ++ j) { |
292 |
> |
const Candidate * Bdau = p.daughter( j ); |
293 |
> |
btemp.dauid.push_back(Bdau->pdgId()); |
294 |
> |
} |
295 |
> |
auxInfo->mcB.push_back(btemp); |
296 |
|
} |
297 |
|
|
298 |
|
if(id==-5){ |
409 |
– |
bbarin=i; |
410 |
– |
hbbInfo->mcBbar.status=st; |
411 |
– |
hbbInfo->mcBbar.charge=p.charge(); |
412 |
– |
if(p.mother(0)!=0) hbbInfo->mcBbar.momid=p.mother(0)->pdgId(); |
413 |
– |
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) hbbInfo->mcBbar.gmomid=p.mother(0)->mother(0)->pdgId(); |
414 |
– |
} |
415 |
– |
|
416 |
– |
if(abs(id)==4){ |
417 |
– |
hbbInfo->mcC.status=st; |
418 |
– |
hbbInfo->mcC.charge=p.charge(); |
419 |
– |
if(p.mother(0)!=0) hbbInfo->mcC.momid=p.mother(0)->pdgId(); |
420 |
– |
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) hbbInfo->mcC.gmomid=p.mother(0)->mother(0)->pdgId(); |
421 |
– |
} |
299 |
|
|
300 |
+ |
VHbbEventAuxInfo::ParticleMCInfo bbtemp; |
301 |
+ |
|
302 |
+ |
bbtemp.status=st; |
303 |
+ |
bbtemp.charge=p.charge(); |
304 |
+ |
if(p.mother(0)!=0) bbtemp.momid=p.mother(0)->pdgId(); |
305 |
+ |
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) bbtemp.gmomid=p.mother(0)->mother(0)->pdgId(); |
306 |
|
|
307 |
< |
} |
307 |
> |
bbtemp.p4=GENPTOLOR(p); |
308 |
> |
|
309 |
> |
int nHDaubdau = p.numberOfDaughters(); |
310 |
> |
for(int j = 0; j < nHDaubdau; ++ j) { |
311 |
> |
const Candidate * Bdau = p.daughter( j ); |
312 |
> |
bbtemp.dauid.push_back(Bdau->pdgId()); |
313 |
> |
} |
314 |
|
|
315 |
|
|
316 |
< |
if(bin!=-99 && bbarin!=-99){ |
317 |
< |
const Candidate & bGen = (*genParticles)[bin]; |
429 |
< |
const Candidate & bbarGen = (*genParticles)[bbarin]; |
430 |
< |
hbbInfo->mcB.fourMomentum=GENPTOLOR(bGen); |
431 |
< |
hbbInfo->mcBbar.fourMomentum=GENPTOLOR(bbarGen); |
316 |
> |
auxInfo->mcBbar.push_back(bbtemp); |
317 |
> |
} |
318 |
|
|
319 |
< |
int nHDaubdau = bGen.numberOfDaughters(); |
320 |
< |
for(int j = 0; j < nHDaubdau; ++ j) { |
321 |
< |
const Candidate * Bdau = bGen.daughter( j ); |
322 |
< |
hbbInfo->mcB.dauid.push_back(Bdau->pdgId()); |
323 |
< |
hbbInfo->mcB.dauFourMomentum.push_back(GENPTOLORP(Bdau)); |
324 |
< |
} |
439 |
< |
int nHDaubbardau = bbarGen.numberOfDaughters(); |
440 |
< |
for(int j = 0; j < nHDaubbardau; ++ j) { |
441 |
< |
const Candidate * Bbardau = bbarGen.daughter( j ); |
442 |
< |
hbbInfo->mcBbar.dauid.push_back(Bbardau->pdgId()); |
443 |
< |
hbbInfo->mcBbar.dauFourMomentum.push_back(GENPTOLORP(Bbardau)); |
444 |
< |
} |
319 |
> |
if(abs(id)==4){ |
320 |
> |
VHbbEventAuxInfo::ParticleMCInfo ctemp; |
321 |
> |
ctemp.status=st; |
322 |
> |
ctemp.charge=p.charge(); |
323 |
> |
if(p.mother(0)!=0) ctemp.momid=p.mother(0)->pdgId(); |
324 |
> |
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) ctemp.gmomid=p.mother(0)->mother(0)->pdgId(); |
325 |
|
|
326 |
< |
|
326 |
> |
ctemp.p4=GENPTOLOR(p); |
327 |
> |
|
328 |
> |
int nHDaubdau = p.numberOfDaughters(); |
329 |
> |
for(int j = 0; j < nHDaubdau; ++ j) { |
330 |
> |
const Candidate * Bdau = p.daughter( j ); |
331 |
> |
ctemp.dauid.push_back(Bdau->pdgId()); |
332 |
> |
} |
333 |
|
|
334 |
< |
} |
334 |
> |
auxInfo->mcC.push_back(ctemp); |
335 |
|
|
336 |
+ |
} |
337 |
+ |
|
338 |
+ |
} |
339 |
|
|
340 |
|
} // isMC |
341 |
|
|
379 |
|
iEvent.getByLabel(eleLabel_,electronHandle); |
380 |
|
edm::View<pat::Electron> electrons = *electronHandle; |
381 |
|
|
493 |
– |
edm::Handle<edm::View<pat::MET> > metHandle; |
494 |
– |
iEvent.getByLabel(metLabel_,metHandle); |
495 |
– |
edm::View<pat::MET> mets = *metHandle; |
382 |
|
|
383 |
|
// edm::Handle<edm::View<pat::Photon> > phoHandle; |
384 |
|
// iEvent.getByLabel(phoLabel_,phoHandle); |
388 |
|
iEvent.getByLabel(tauLabel_,tauHandle); |
389 |
|
edm::View<pat::Tau> taus = *tauHandle; |
390 |
|
|
505 |
– |
edm::Handle<CandidateView> dimuons; |
506 |
– |
iEvent.getByLabel(dimuLabel_,dimuons); |
507 |
– |
|
508 |
– |
edm::Handle<CandidateView> dielectrons; |
509 |
– |
iEvent.getByLabel(dielecLabel_,dielectrons); |
391 |
|
|
392 |
+ |
//BTAGGING SCALE FACTOR FROM DATABASE |
393 |
+ |
//Combined Secondary Vertex Loose |
394 |
+ |
edm::ESHandle<BtagPerformance> bTagSF_CSVL_; |
395 |
+ |
iSetup.get<BTagPerformanceRecord>().get("BTAGCSVL",bTagSF_CSVL_); |
396 |
+ |
//Combined Secondary Vertex Medium |
397 |
+ |
edm::ESHandle<BtagPerformance> bTagSF_CSVM_; |
398 |
+ |
iSetup.get<BTagPerformanceRecord>().get("BTAGCSVM",bTagSF_CSVM_); |
399 |
+ |
//Combined Secondary Vertex Tight |
400 |
+ |
edm::ESHandle<BtagPerformance> bTagSF_CSVT_; |
401 |
+ |
iSetup.get<BTagPerformanceRecord>().get("BTAGCSVT",bTagSF_CSVT_); |
402 |
+ |
|
403 |
+ |
edm::ESHandle<BtagPerformance> mistagSF_CSVL_; |
404 |
+ |
iSetup.get<BTagPerformanceRecord>().get("MISTAGCSVL",mistagSF_CSVL_); |
405 |
+ |
//Combined Secondary Vertex Medium |
406 |
+ |
edm::ESHandle<BtagPerformance> mistagSF_CSVM_; |
407 |
+ |
iSetup.get<BTagPerformanceRecord>().get("MISTAGCSVM",mistagSF_CSVM_); |
408 |
+ |
//Combined Secondary Vertex Tight |
409 |
+ |
edm::ESHandle<BtagPerformance> mistagSF_CSVT_; |
410 |
+ |
iSetup.get<BTagPerformanceRecord>().get("MISTAGCSVT",mistagSF_CSVT_); |
411 |
+ |
|
412 |
+ |
BTagSFContainer btagSFs; |
413 |
+ |
btagSFs.BTAGSF_CSVL = (bTagSF_CSVL_.product()); |
414 |
+ |
btagSFs.BTAGSF_CSVM = (bTagSF_CSVM_.product()); |
415 |
+ |
btagSFs.BTAGSF_CSVT = (bTagSF_CSVT_.product()); |
416 |
+ |
btagSFs.MISTAGSF_CSVL = (mistagSF_CSVL_.product()); |
417 |
+ |
btagSFs.MISTAGSF_CSVM = (mistagSF_CSVM_.product()); |
418 |
+ |
btagSFs.MISTAGSF_CSVT = (mistagSF_CSVT_.product()); |
419 |
|
|
420 |
+ |
#ifdef ENABLE_SIMPLEJETS1 |
421 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets1.begin(); jet_iter!=simplejets1.end(); ++jet_iter){ |
422 |
|
// if(jet_iter->pt()>50) |
423 |
|
// njetscounter++; |
424 |
|
VHbbEvent::SimpleJet sj; |
425 |
< |
sj.flavour = jet_iter->partonFlavour(); |
425 |
> |
// std::cout <<" sj1"<<std::endl; |
426 |
> |
fillSimpleJet(sj,jet_iter); |
427 |
> |
// if(!runOnMC_) |
428 |
|
|
429 |
< |
|
519 |
< |
sj.tche=jet_iter->bDiscriminator("trackCountingHighEffBJetTags"); |
520 |
< |
sj.tchp=jet_iter->bDiscriminator("trackCountingHighPurBJetTags"); |
521 |
< |
sj.jp=jet_iter->bDiscriminator("jetProbabilityBJetTags"); |
522 |
< |
sj.jpb=jet_iter->bDiscriminator("jetBProbabilityBJetTags"); |
523 |
< |
sj.ssvhe=jet_iter->bDiscriminator("simpleSecondaryVertexHighEffBJetTags"); |
524 |
< |
sj.csv=jet_iter->bDiscriminator("combinedSecondaryVertexBJetTags"); |
525 |
< |
sj.csvmva=jet_iter->bDiscriminator("combinedSecondaryVertexMVABJetTags"); |
526 |
< |
sj.charge=jet_iter->jetCharge(); |
527 |
< |
sj.ntracks=jet_iter->associatedTracks().size(); |
528 |
< |
sj.fourMomentum=GENPTOLORP(jet_iter); |
429 |
> |
setJecUnc(sj,jecUnc); |
430 |
|
|
431 |
|
Particle::LorentzVector p4Jet = jet_iter->p4(); |
432 |
|
|
433 |
|
if(runOnMC_){ |
434 |
< |
double minb1DR=9999.; |
435 |
< |
for(size_t i = 0; i < genParticles->size(); ++ i) { |
436 |
< |
const GenParticle & p = (*genParticles)[i]; |
437 |
< |
int id = p.pdgId(); |
438 |
< |
if(abs(id)<=6 || id==21 || id==23 || abs(id)==24){ |
439 |
< |
double bb1DR=TMath::Sqrt((p.eta()-p4Jet.eta())*(p.eta()-p4Jet.eta())+ |
440 |
< |
(p.phi()-p4Jet.phi())*(p.phi()-p4Jet.phi())); |
441 |
< |
if(bb1DR<minb1DR) {minb1DR=bb1DR; sj.b1BestMCid=id; if(p.mother()!=0) sj.b1BestMCmomid=p.mother()->pdgId();} |
434 |
> |
|
435 |
> |
fillScaleFactors(sj, btagSFs); |
436 |
> |
|
437 |
> |
//PAT genJet matching |
438 |
> |
//genJet |
439 |
> |
const reco::GenJet *gJ = jet_iter->genJet(); |
440 |
> |
//physical parton for mother info ONLY |
441 |
> |
if( (jet_iter->genParton()) ){ |
442 |
> |
sj.bestMCid = jet_iter->genParton()->pdgId(); |
443 |
> |
if( (jet_iter->genParton()->mother()) ) |
444 |
> |
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId(); |
445 |
> |
} |
446 |
> |
TLorentzVector gJp4; |
447 |
> |
if(gJ){ |
448 |
> |
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
449 |
> |
sj.bestMCp4 = gJp4; |
450 |
> |
if(verbose_){ |
451 |
> |
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl; |
452 |
> |
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl; |
453 |
> |
std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl; |
454 |
> |
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl; |
455 |
|
} |
456 |
|
} |
457 |
< |
} //isMC |
457 |
> |
|
458 |
> |
} //isMC |
459 |
|
hbbInfo->simpleJets.push_back(sj); |
460 |
|
|
461 |
|
} |
462 |
< |
|
462 |
> |
#endif //ENABLE_SIMPLEJETS1 |
463 |
> |
|
464 |
> |
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets3.begin(); jet_iter!=simplejets3.end(); ++jet_iter){ |
465 |
> |
// if(jet_iter->pt()>50) |
466 |
> |
// njetscounter++; |
467 |
> |
VHbbEvent::SimpleJet sj; |
468 |
> |
// std::cout <<" sj3"<<std::endl; |
469 |
> |
fillSimpleJet(sj,jet_iter); |
470 |
> |
// if(!runOnMC_) |
471 |
> |
setJecUnc(sj,jecUnc); |
472 |
> |
|
473 |
> |
|
474 |
> |
Particle::LorentzVector p4Jet = jet_iter->p4(); |
475 |
> |
|
476 |
> |
if(runOnMC_){ |
477 |
> |
|
478 |
> |
fillScaleFactors(sj, btagSFs); |
479 |
> |
|
480 |
> |
//PAT genJet matching |
481 |
> |
//genJet |
482 |
> |
const reco::GenJet *gJ = jet_iter->genJet(); |
483 |
> |
//physical parton for mother info ONLY |
484 |
> |
if( (jet_iter->genParton()) ){ |
485 |
> |
sj.bestMCid = jet_iter->genParton()->pdgId(); |
486 |
> |
if( (jet_iter->genParton()->mother()) ) |
487 |
> |
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId(); |
488 |
> |
} |
489 |
> |
TLorentzVector gJp4; |
490 |
> |
if(gJ){ |
491 |
> |
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
492 |
> |
sj.bestMCp4 = gJp4; |
493 |
> |
if(verbose_){ |
494 |
> |
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl; |
495 |
> |
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl; |
496 |
> |
std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl; |
497 |
> |
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl; |
498 |
> |
} |
499 |
> |
} |
500 |
> |
|
501 |
> |
} //isMC |
502 |
> |
hbbInfo->simpleJets3.push_back(sj); |
503 |
> |
|
504 |
> |
} |
505 |
> |
|
506 |
> |
#ifdef ENABLE_SIMPLEJETS4 |
507 |
> |
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets4.begin(); jet_iter!=simplejets4.end(); ++jet_iter){ |
508 |
> |
// if(jet_iter->pt()>50) |
509 |
> |
// njetscounter++; |
510 |
> |
VHbbEvent::SimpleJet sj; |
511 |
> |
// std::cout <<" sj4"<<std::endl; |
512 |
> |
fillSimpleJet(sj,jet_iter); |
513 |
> |
// if(!runOnMC_) |
514 |
> |
setJecUnc(sj,jecUnc); |
515 |
> |
|
516 |
> |
|
517 |
> |
Particle::LorentzVector p4Jet = jet_iter->p4(); |
518 |
> |
|
519 |
> |
if(runOnMC_){ |
520 |
> |
|
521 |
> |
fillScaleFactors(sj, btagSFs); |
522 |
> |
|
523 |
> |
//PAT genJet matching |
524 |
> |
//genJet |
525 |
> |
const reco::GenJet *gJ = jet_iter->genJet(); |
526 |
> |
//physical parton for mother info ONLY |
527 |
> |
if( (jet_iter->genParton()) ){ |
528 |
> |
sj.bestMCid = jet_iter->genParton()->pdgId(); |
529 |
> |
if( (jet_iter->genParton()->mother()) ) |
530 |
> |
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId(); |
531 |
> |
} |
532 |
> |
TLorentzVector gJp4; |
533 |
> |
if(gJ){ |
534 |
> |
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
535 |
> |
sj.bestMCp4 = gJp4; |
536 |
> |
if(verbose_){ |
537 |
> |
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl; |
538 |
> |
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl; |
539 |
> |
std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl; |
540 |
> |
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl; |
541 |
> |
} |
542 |
> |
} |
543 |
> |
|
544 |
> |
} //isMC |
545 |
> |
hbbInfo->simpleJets4.push_back(sj); |
546 |
> |
|
547 |
> |
} |
548 |
> |
#endif //ENABLE SIMPLEJETS4 |
549 |
> |
|
550 |
|
|
551 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets2.begin(); jet_iter!=simplejets2.end(); ++jet_iter){ |
552 |
|
|
553 |
|
VHbbEvent::SimpleJet sj; |
554 |
< |
sj.flavour = jet_iter->partonFlavour(); |
554 |
> |
// std::cout <<" sj2"<<std::endl; |
555 |
> |
fillSimpleJet(sj,jet_iter); |
556 |
> |
// if(!runOnMC_) |
557 |
> |
setJecUnc(sj,jecUnc); |
558 |
> |
/* sj.flavour = jet_iter->partonFlavour(); |
559 |
|
|
560 |
|
|
561 |
|
sj.tche=jet_iter->bDiscriminator("trackCountingHighEffBJetTags"); |
567 |
|
sj.csvmva=jet_iter->bDiscriminator("combinedSecondaryVertexMVABJetTags"); |
568 |
|
sj.charge=jet_iter->jetCharge(); |
569 |
|
sj.ntracks=jet_iter->associatedTracks().size(); |
570 |
< |
sj.fourMomentum=GENPTOLORP(jet_iter); |
570 |
> |
sj.p4=GENPTOLORP(jet_iter); |
571 |
> |
sj.chargedTracksFourMomentum=(getChargedTracksMomentum(&*(jet_iter))); |
572 |
> |
sj.SF_CSVL=1; |
573 |
> |
sj.SF_CSVM=1; |
574 |
> |
sj.SF_CSVT=1; |
575 |
> |
sj.SF_CSVLerr=0; |
576 |
> |
sj.SF_CSVMerr=0; |
577 |
> |
sj.SF_CSVTerr=0; |
578 |
> |
|
579 |
> |
// |
580 |
> |
// addtaginfo for csv |
581 |
> |
// |
582 |
> |
|
583 |
> |
if (jet_iter->hasTagInfo("SimpleSecondaryVertex")) { |
584 |
> |
|
585 |
> |
const reco::SecondaryVertexTagInfo * tf = jet_iter->tagInfoSecondaryVertex(); |
586 |
> |
sj.vtxMass = tf->secondaryVertex(0).p4().mass(); |
587 |
> |
sj.vtxNTracks = tf->secondaryVertex(0).nTracks(); |
588 |
> |
Measurement1D m = tf->flightDistance(0); |
589 |
> |
sj.vtx3dL = m.value(); |
590 |
> |
sj.vtx3deL = m.error(); |
591 |
> |
} |
592 |
> |
|
593 |
|
|
594 |
+ |
// |
595 |
+ |
// add tVector |
596 |
+ |
// |
597 |
+ |
sj.tVector = getTvect(&(*jet_iter)); |
598 |
+ |
*/ |
599 |
|
Particle::LorentzVector p4Jet = jet_iter->p4(); |
600 |
|
|
601 |
|
if(runOnMC_){ |
602 |
< |
double minb2DR=9999.; |
603 |
< |
for(size_t i = 0; i < genParticles->size(); ++ i) { |
604 |
< |
const GenParticle & p = (*genParticles)[i]; |
605 |
< |
int id = p.pdgId(); |
606 |
< |
if(abs(id)<=6 || id==21 || id==23 || abs(id)==24){ |
607 |
< |
double bb2DR=TMath::Sqrt((p.eta()-p4Jet.eta())*(p.eta()-p4Jet.eta())+ |
608 |
< |
(p.phi()-p4Jet.phi())*(p.phi()-p4Jet.phi())); |
609 |
< |
if(bb2DR<minb2DR) {minb2DR=bb2DR; sj.b1BestMCid=id; if(p.mother()!=0) sj.b1BestMCmomid=p.mother()->pdgId();} |
602 |
> |
|
603 |
> |
//BTV scale factors |
604 |
> |
fillScaleFactors(sj, btagSFs); |
605 |
> |
|
606 |
> |
//PAT genJet matching |
607 |
> |
//genJet |
608 |
> |
const reco::GenJet *gJ = jet_iter->genJet(); |
609 |
> |
//physical parton for mother info ONLY |
610 |
> |
if( (jet_iter->genParton()) ){ |
611 |
> |
sj.bestMCid = jet_iter->genParton()->pdgId(); |
612 |
> |
if( (jet_iter->genParton()->mother()) ) |
613 |
> |
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId(); |
614 |
> |
} |
615 |
> |
TLorentzVector gJp4; |
616 |
> |
if(gJ){ |
617 |
> |
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
618 |
> |
sj.bestMCp4 = gJp4; |
619 |
> |
if(verbose_){ |
620 |
> |
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl; |
621 |
> |
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl; |
622 |
> |
std::clog << "genJet matched deltaR = " << gJp4.DeltaR(sj.p4) << std::endl; |
623 |
> |
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl; |
624 |
|
} |
625 |
|
} |
626 |
+ |
|
627 |
|
} //isMC |
628 |
|
|
629 |
|
hbbInfo->simpleJets2.push_back(sj); |
661 |
|
// if(printJet) {std::cout << "NsubJets: " << constituents.size() << "\n";} |
662 |
|
VHbbEvent::HardJet hj; |
663 |
|
hj.constituents=constituents.size(); |
664 |
< |
hj.fourMomentum =GENPTOLORP(jet_iter); |
665 |
< |
|
664 |
> |
hj.p4 =GENPTOLORP(jet_iter); |
665 |
> |
|
666 |
|
for (unsigned int iJC(0); iJC<constituents.size(); ++iJC ){ |
667 |
|
Jet::Constituent icandJet = constituents[iJC]; |
668 |
|
|
673 |
|
hj.subFourMomentum.push_back(GENPTOLORP(icandJet)); |
674 |
|
hj.etaSub.push_back(icandJet->eta()); |
675 |
|
hj.phiSub.push_back(icandJet->phi()); |
628 |
– |
|
676 |
|
|
677 |
|
} |
678 |
|
hbbInfo->hardJets.push_back(hj); |
695 |
|
<< "," << subjet_iter->bDiscriminator("combinedSecondaryVertexBJetTags") << "\n";} |
696 |
|
|
697 |
|
VHbbEvent::SimpleJet sj; |
698 |
< |
|
699 |
< |
sj.flavour = subjet_iter->partonFlavour(); |
700 |
< |
|
698 |
> |
// std::cout <<" sub jet "<<std::endl; |
699 |
> |
fillSimpleJet(sj,subjet_iter); |
700 |
> |
// if(!runOnMC_) |
701 |
> |
setJecUnc(sj,jecUnc); |
702 |
> |
/* sj.flavour = subjet_iter->partonFlavour(); |
703 |
> |
sj.tVector = getTvect(&(*subjet_iter)); |
704 |
|
sj.tche=subjet_iter->bDiscriminator("trackCountingHighEffBJetTags"); |
705 |
|
sj.tchp=subjet_iter->bDiscriminator("trackCountingHighPurBJetTags"); |
706 |
|
sj.jp=subjet_iter->bDiscriminator("jetProbabilityBJetTags"); |
710 |
|
sj.csvmva=subjet_iter->bDiscriminator("combinedSecondaryVertexMVABJetTags"); |
711 |
|
sj.charge=subjet_iter->jetCharge(); |
712 |
|
sj.ntracks=subjet_iter->associatedTracks().size(); |
713 |
< |
sj.fourMomentum=GENPTOLORP(subjet_iter); |
713 |
> |
sj.p4=GENPTOLORP(subjet_iter); |
714 |
> |
sj.p4=(getChargedTracksMomentum(&*(subjet_iter))); |
715 |
|
|
716 |
+ |
// |
717 |
+ |
// addtaginfo for csv |
718 |
+ |
// |
719 |
+ |
|
720 |
+ |
if (subjet_iter->hasTagInfo("SimpleSecondaryVertex")) { |
721 |
+ |
|
722 |
+ |
const reco::SecondaryVertexTagInfo * tf = subjet_iter->tagInfoSecondaryVertex(); |
723 |
+ |
sj.vtxMass = tf->secondaryVertex(0).p4().mass(); |
724 |
+ |
sj.vtxNTracks = tf->secondaryVertex(0).nTracks(); |
725 |
+ |
Measurement1D m = tf->flightDistance(0); |
726 |
+ |
sj.vtx3dL = m.value(); |
727 |
+ |
sj.vtx3deL = m.error(); |
728 |
+ |
} |
729 |
+ |
*/ |
730 |
|
hbbInfo->subJets.push_back(sj); |
731 |
|
|
732 |
|
} |
736 |
|
// met is calomet |
737 |
|
// |
738 |
|
|
674 |
– |
|
675 |
– |
for(edm::View<pat::MET>::const_iterator met = mets.begin(); met!=mets.end(); ++met){ |
676 |
– |
hbbInfo->calomet.sumEt=met->sumEt(); |
677 |
– |
hbbInfo->calomet.metSig=met->mEtSig(); |
678 |
– |
hbbInfo->calomet.eLong=met->e_longitudinal(); |
679 |
– |
hbbInfo->calomet.fourMomentum=GENPTOLORP(met); |
680 |
– |
} |
681 |
– |
|
739 |
|
edm::Handle<edm::View<pat::MET> > metTCHandle; |
740 |
|
iEvent.getByLabel("patMETsTC",metTCHandle); |
741 |
|
edm::View<pat::MET> metsTC = *metTCHandle; |
742 |
< |
for(edm::View<pat::MET>::const_iterator metTC = metsTC.begin(); metTC!=metsTC.end(); ++metTC){ |
743 |
< |
hbbInfo->calomet.sumEt=metTC->sumEt(); |
744 |
< |
hbbInfo->calomet.metSig=metTC->mEtSig(); |
745 |
< |
hbbInfo->calomet.eLong=metTC->e_longitudinal(); |
746 |
< |
hbbInfo->calomet.fourMomentum=GENPTOLORP(metTC); |
742 |
> |
if(metsTC.size()){ |
743 |
> |
hbbInfo->tcmet.sumEt=(metsTC[0]).sumEt(); |
744 |
> |
hbbInfo->tcmet.metSig=(metsTC[0]).significance(); |
745 |
> |
hbbInfo->tcmet.eLong=(metsTC[0]).e_longitudinal(); |
746 |
> |
hbbInfo->tcmet.p4=GENPTOLOR((metsTC[0])); |
747 |
> |
if (verbose_) std::cout <<" METTC "<< hbbInfo->tcmet.metSig <<" " << hbbInfo->tcmet.sumEt<<std::endl; |
748 |
> |
} |
749 |
> |
|
750 |
> |
edm::Handle<edm::View<reco::MET> > pfMETNoPUHandle; |
751 |
> |
iEvent.getByLabel("pfMETNoPU",pfMETNoPUHandle); |
752 |
> |
edm::View<reco::MET> metspfMETNoPU = *pfMETNoPUHandle; |
753 |
> |
if(metspfMETNoPU.size()){ |
754 |
> |
hbbInfo->metNoPU.sumEt=(metspfMETNoPU[0]).sumEt(); |
755 |
> |
hbbInfo->metNoPU.metSig=(metspfMETNoPU[0]).significance(); |
756 |
> |
hbbInfo->metNoPU.eLong=(metspfMETNoPU[0]).e_longitudinal(); |
757 |
> |
hbbInfo->metNoPU.p4=GENPTOLOR((metspfMETNoPU[0])); |
758 |
> |
if (verbose_) std::cout <<" pfMETNoPU "<< hbbInfo->metNoPU.metSig <<" " << hbbInfo->metNoPU.sumEt<<std::endl; |
759 |
> |
} |
760 |
> |
|
761 |
> |
edm::Handle<edm::View<reco::MET> > mHTHandle; |
762 |
> |
iEvent.getByLabel("patMETsHT",mHTHandle); |
763 |
> |
edm::View<reco::MET> metsHT = *mHTHandle; |
764 |
> |
if(metsHT.size()){ |
765 |
> |
hbbInfo->mht.sumEt=(metsHT[0]).sumEt(); |
766 |
> |
hbbInfo->mht.metSig=(metsHT[0]).significance(); |
767 |
> |
hbbInfo->mht.eLong=(metsHT[0]).e_longitudinal(); |
768 |
> |
hbbInfo->mht.p4=GENPTOLOR((metsHT[0])); |
769 |
> |
if (verbose_) std::cout <<" METHT "<< hbbInfo->mht.metSig <<" " << hbbInfo->mht.sumEt<<std::endl; |
770 |
> |
} |
771 |
> |
|
772 |
> |
edm::Handle<edm::View<reco::MET> > metHandle; |
773 |
> |
iEvent.getByLabel(metLabel_,metHandle); |
774 |
> |
edm::View<reco::MET> mets = *metHandle; |
775 |
> |
|
776 |
> |
if(mets.size()){ |
777 |
> |
hbbInfo->calomet.sumEt=(mets[0]).sumEt(); |
778 |
> |
hbbInfo->calomet.metSig=(mets[0]).significance(); |
779 |
> |
hbbInfo->calomet.eLong=(mets[0]).e_longitudinal(); |
780 |
> |
hbbInfo->calomet.p4=GENPTOLOR((mets[0])); |
781 |
> |
if (verbose_) std::cout <<" METCALO "<< hbbInfo->calomet.metSig <<" " << hbbInfo->calomet.sumEt<<std::endl; |
782 |
|
} |
783 |
+ |
|
784 |
|
edm::Handle<edm::View<pat::MET> > metPFHandle; |
785 |
|
iEvent.getByLabel("patMETsPF",metPFHandle); |
786 |
|
edm::View<pat::MET> metsPF = *metPFHandle; |
787 |
< |
for(edm::View<pat::MET>::const_iterator metPF = metsPF.begin(); metPF!=metsPF.end(); ++metPF){ |
788 |
< |
hbbInfo->calomet.sumEt=metPF->sumEt(); |
789 |
< |
hbbInfo->calomet.metSig=metPF->mEtSig(); |
790 |
< |
hbbInfo->calomet.eLong=metPF->e_longitudinal(); |
791 |
< |
hbbInfo->calomet.fourMomentum=GENPTOLORP(metPF); |
787 |
> |
|
788 |
> |
if(metsPF.size()){ |
789 |
> |
hbbInfo->pfmet.sumEt=(metsPF[0]).sumEt(); |
790 |
> |
hbbInfo->pfmet.metSig=(metsPF[0]).significance(); |
791 |
> |
hbbInfo->pfmet.eLong=(metsPF[0]).e_longitudinal(); |
792 |
> |
hbbInfo->pfmet.p4=GENPTOLOR((metsPF[0])); |
793 |
> |
if (verbose_) std::cout <<" METPF "<< hbbInfo->pfmet.metSig <<" " << hbbInfo->pfmet.sumEt<<std::endl; |
794 |
> |
} |
795 |
> |
|
796 |
> |
|
797 |
> |
if(verbose_){ |
798 |
> |
std::cout << "METs: calomet "<<mets.size()<<" tcmet"<<metsTC.size()<<" pfmet "<<metsPF.size()<<" MHT" <<metsHT.size()<<std::endl; |
799 |
|
} |
800 |
|
|
801 |
< |
|
801 |
> |
if(verbose_) |
802 |
> |
std::cout << " INPUT MUONS "<<muons.size()<<std::endl; |
803 |
|
|
804 |
|
for(edm::View<pat::Muon>::const_iterator mu = muons.begin(); mu!=muons.end(); ++mu){ |
805 |
|
VHbbEvent::MuonInfo mf; |
806 |
< |
mf.fourMomentum =GENPTOLORP( mu); |
806 |
> |
mf.p4 =GENPTOLORP( mu); |
807 |
|
mf.charge=mu->charge(); |
808 |
|
mf.tIso=mu->trackIso(); |
809 |
|
mf.eIso=mu->ecalIso(); |
810 |
|
mf.hIso=mu->hcalIso(); |
811 |
< |
Geom::Phi<double> deltaphi(mu->phi()-atan2(mf.fourMomentum.Px(), mf.fourMomentum.Py())); |
811 |
> |
mf.pfChaIso=mu->chargedHadronIso(); |
812 |
> |
mf.pfChaPUIso=mu->userIso(5); |
813 |
> |
mf.pfPhoIso=mu->photonIso(); |
814 |
> |
mf.pfNeuIso=mu->neutralHadronIso(); |
815 |
> |
Geom::Phi<double> deltaphi(mu->phi()-atan2(mf.p4.Px(), mf.p4.Py())); |
816 |
|
double acop = deltaphi.value(); |
817 |
|
mf.acop=acop; |
818 |
|
|
819 |
+ |
mf.nMatches = mu->numberOfMatches(); |
820 |
+ |
|
821 |
|
mf.ipDb=mu->dB(); |
822 |
|
mf.ipErrDb=mu->edB(); |
823 |
< |
if(mu->isGlobalMuon()) mf.cat=1; |
824 |
< |
else if(mu->isTrackerMuon()) mf.cat=2; |
825 |
< |
else mf.cat=3; |
823 |
> |
mf.cat=0; |
824 |
> |
if(mu->isGlobalMuon()) mf.cat|=1; |
825 |
> |
if(mu->isTrackerMuon()) mf.cat|=2; |
826 |
> |
if(mu->isStandAloneMuon()) mf.cat|=4; |
827 |
|
TrackRef trkMu1Ref = mu->get<TrackRef>(); |
828 |
|
if(trkMu1Ref.isNonnull()){ |
829 |
|
const Track* MuTrk1 = mu->get<TrackRef>().get(); |
834 |
|
TrackRef iTrack1 = mu->innerTrack(); |
835 |
|
const reco::HitPattern& p1 = iTrack1->hitPattern(); |
836 |
|
mf.nPixelHits=p1.pixelLayersWithMeasurement(); |
837 |
< |
} |
837 |
> |
|
838 |
> |
mf.nValidTracker = p1.numberOfValidTrackerHits(); |
839 |
> |
mf.nValidPixel = p1.numberOfValidPixelHits(); |
840 |
> |
|
841 |
> |
|
842 |
> |
|
843 |
> |
} |
844 |
|
if(mu->isGlobalMuon()){ |
845 |
|
TrackRef gTrack = mu->globalTrack(); |
846 |
|
const reco::HitPattern& q = gTrack->hitPattern(); |
847 |
|
mf.globChi2=gTrack.get()->normalizedChi2(); |
848 |
|
mf.globNHits=q.numberOfValidMuonHits(); |
849 |
+ |
mf.validMuStations = q.muonStationsWithValidHits(); |
850 |
|
}else{ |
851 |
|
mf.globChi2=-99; |
852 |
|
mf.globNHits=-99; |
853 |
|
} |
854 |
|
|
855 |
+ |
//Muon trigger matching |
856 |
+ |
for (int itrig = 0; itrig != ntrigs; ++itrig){ |
857 |
+ |
std::string trigName=triggerNames_.triggerName(itrig); |
858 |
+ |
if( (mu->triggerObjectMatchesByPath(trigName,false,false).size() != 0) ){ |
859 |
+ |
mf.hltMatchedBits.push_back(itrig); |
860 |
+ |
if(verbose_){ |
861 |
+ |
std::clog << "Trigger Matching box" << std::endl; |
862 |
+ |
std::clog << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl; |
863 |
+ |
std::clog << "Matching parameters are defined in the cfg" << std::endl; |
864 |
+ |
std::clog << "Trigger bit = " << itrig << std::endl; |
865 |
+ |
std::clog << "Trigger name = " << trigName << std::endl; |
866 |
+ |
std::clog << "Trigger object matched collection size = " << mu->triggerObjectMatchesByPath(trigName,false,false).size() << std::endl; |
867 |
+ |
std::clog << "Pat Muon pt = " << mf.p4.Pt() << " HLT object matched = " << mu->triggerObjectMatch(0)->p4().Pt() << std::endl; |
868 |
+ |
std::clog << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl; |
869 |
+ |
} |
870 |
+ |
} |
871 |
+ |
} |
872 |
+ |
// |
873 |
+ |
|
874 |
+ |
// add stamuon |
875 |
+ |
|
876 |
+ |
// if (mu->isStandAloneMuon()) { |
877 |
+ |
// reco::TrackRef sta = mu->standAloneMuon(); |
878 |
+ |
// |
879 |
+ |
// } |
880 |
+ |
|
881 |
+ |
|
882 |
|
// int muInfo[12]; |
883 |
|
// fillMuBlock(mu, muInfo); |
884 |
|
if(runOnMC_){ |
892 |
|
hbbInfo->muInfo.push_back(mf); |
893 |
|
} |
894 |
|
|
895 |
< |
|
895 |
> |
if(verbose_) |
896 |
> |
std::cout << " INPUT electrons "<<electrons.size()<<std::endl; |
897 |
|
for(edm::View<pat::Electron>::const_iterator elec = electrons.begin(); elec!=electrons.end(); ++elec){ |
898 |
|
VHbbEvent::ElectronInfo ef; |
899 |
< |
ef.fourMomentum=GENPTOLORP(elec); |
899 |
> |
ef.p4=GENPTOLORP(elec); |
900 |
|
ef.scEta =elec->superCluster()->eta(); |
901 |
|
ef.scPhi =elec->superCluster()->phi(); |
902 |
|
// if(ElecEta[eleccont]!=0) ElecEt[eleccont]=elec->superCluster()->energy()/cosh(elec->superCluster()->eta()); |
904 |
|
ef.tIso=elec->trackIso(); |
905 |
|
ef.eIso=elec->ecalIso(); |
906 |
|
ef.hIso=elec->hcalIso(); |
907 |
< |
Geom::Phi<double> deltaphi(elec->superCluster()->phi()-atan2(hbbInfo->calomet.fourMomentum.Py(),hbbInfo->calomet.fourMomentum.Px())); |
908 |
< |
ef.acop = deltaphi.value(); |
907 |
> |
ef.pfChaIso=elec->chargedHadronIso(); |
908 |
> |
ef.pfChaPUIso=elec->userIso(5); |
909 |
> |
ef.pfPhoIso=elec->photonIso(); |
910 |
> |
ef.pfNeuIso=elec->neutralHadronIso(); |
911 |
> |
|
912 |
> |
// |
913 |
> |
// ip info |
914 |
> |
// |
915 |
> |
|
916 |
> |
ef.ipDb=elec->dB(); |
917 |
> |
ef.ipErrDb=elec->edB(); |
918 |
|
|
919 |
+ |
|
920 |
+ |
|
921 |
+ |
Geom::Phi<double> deltaphi(elec->superCluster()->phi()-atan2(hbbInfo->pfmet.p4.Py(),hbbInfo->pfmet.p4.Px())); |
922 |
+ |
ef.acop = deltaphi.value(); |
923 |
+ |
// |
924 |
+ |
ef.sihih = elec->sigmaIetaIeta(); |
925 |
+ |
ef.Dphi = elec->deltaPhiSuperClusterTrackAtVtx(); |
926 |
+ |
ef.Deta = elec->deltaEtaSuperClusterTrackAtVtx(); |
927 |
+ |
ef.HoE = elec->hadronicOverEm(); |
928 |
+ |
ef.convDist = elec->convDist(); |
929 |
+ |
ef.convDcot = elec->convDcot(); |
930 |
+ |
if(elec->gsfTrack().isNonnull()) ef.innerHits = elec->gsfTrack()->trackerExpectedHitsInner().numberOfHits(); |
931 |
+ |
ef.isEB = elec->isEB(); |
932 |
+ |
ef.isEE = elec->isEE(); |
933 |
+ |
// |
934 |
+ |
// fill eleids |
935 |
+ |
// |
936 |
+ |
/* ef.id95 = elec->electronID("simpleEleId95cIso"); |
937 |
+ |
ef.id85 = elec->electronID("simpleEleId85cIso"); |
938 |
+ |
ef.id70 = elec->electronID("simpleEleId70cIso"); |
939 |
+ |
ef.id95r = elec->electronID("simpleEleId95relIso"); |
940 |
+ |
ef.id70r = elec->electronID("simpleEleId70relIso"); |
941 |
+ |
ef.id85r = elec->electronID("simpleEleId85relIso"); |
942 |
+ |
*/ |
943 |
+ |
ef.id95 =elec->electronID("eidVBTFCom95"); |
944 |
+ |
ef.id95r=elec->electronID("eidVBTFRel95"); |
945 |
+ |
ef.id85 =elec->electronID("eidVBTFCom85"); |
946 |
+ |
ef.id85r=elec->electronID("eidVBTFRel85"); |
947 |
+ |
ef.id80 =elec->electronID("eidVBTFCom80"); |
948 |
+ |
ef.id80r=elec->electronID("eidVBTFRel80"); |
949 |
+ |
ef.id70 =elec->electronID("eidVBTFCom70"); |
950 |
+ |
ef.id70r=elec->electronID("eidVBTFRel70"); |
951 |
+ |
|
952 |
+ |
//Electron trigger matching |
953 |
+ |
for (int itrig = 0; itrig != ntrigs; ++itrig){ |
954 |
+ |
std::string trigName=triggerNames_.triggerName(itrig); |
955 |
+ |
if( (elec->triggerObjectMatchesByPath(trigName).size() != 0) ){ |
956 |
+ |
ef.hltMatchedBits.push_back(itrig); |
957 |
+ |
if(verbose_){ |
958 |
+ |
std::clog << "Trigger Matching box" << std::endl; |
959 |
+ |
std::clog << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl; |
960 |
+ |
std::clog << "Matching parameters are defined in the cfg" << std::endl; |
961 |
+ |
std::clog << "Trigger bit = " << itrig << std::endl; |
962 |
+ |
std::clog << "Trigger name = " << trigName << std::endl; |
963 |
+ |
std::clog << "Trigger object matched collection size = " << elec->triggerObjectMatchesByPath(trigName).size() << std::endl; |
964 |
+ |
std::clog << "Pat Electron pt = " << ef.p4.Pt() << " HLT object matched = " << elec->triggerObjectMatch(0)->p4().Pt() << std::endl; |
965 |
+ |
std::clog << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl; |
966 |
+ |
} |
967 |
+ |
} |
968 |
+ |
} |
969 |
+ |
|
970 |
|
if(runOnMC_){ |
971 |
|
const GenParticle* elecMc = elec->genLepton(); |
972 |
|
if(elecMc!=0){ |
978 |
|
hbbInfo->eleInfo.push_back(ef); |
979 |
|
} |
980 |
|
|
981 |
+ |
if(verbose_) |
982 |
+ |
std::cout << " INPUT taus "<<taus.size()<<std::endl; |
983 |
|
for(edm::View<pat::Tau>::const_iterator tau = taus.begin(); tau!=taus.end(); ++tau){ |
984 |
|
VHbbEvent::TauInfo tf; |
985 |
< |
tf.fourMomentum=GENPTOLORP(tau); |
985 |
> |
tf.p4=GENPTOLORP(tau); |
986 |
|
tf.charge=tau->charge(); |
987 |
|
tf.tIso=tau->trackIso(); |
988 |
|
tf.eIso=tau->ecalIso(); |
989 |
|
tf.hIso=tau->hcalIso(); |
990 |
< |
Geom::Phi<double> deltaphi(tau->phi()-atan2(hbbInfo->calomet.fourMomentum.Py(),hbbInfo->calomet.fourMomentum.Px())); |
990 |
> |
Geom::Phi<double> deltaphi(tau->phi()-atan2(hbbInfo->pfmet.p4.Py(),hbbInfo->pfmet.p4.Px())); |
991 |
|
double acop = deltaphi.value(); |
992 |
|
tf.acop=acop; |
993 |
|
tf.idbyIso=tau->tauID("byIsolation"); |
1000 |
|
hbbInfo->tauInfo.push_back(tf); |
1001 |
|
} |
1002 |
|
|
1003 |
+ |
CompareJetPtMuons ptComparatorMu; |
1004 |
+ |
CompareJetPtElectrons ptComparatorE; |
1005 |
+ |
CompareJetPtTaus ptComparatorTau; |
1006 |
+ |
|
1007 |
+ |
std::sort(hbbInfo->muInfo.begin(), hbbInfo->muInfo.end(), ptComparatorMu); |
1008 |
+ |
std::sort(hbbInfo->eleInfo.begin(), hbbInfo->eleInfo.end(), ptComparatorE); |
1009 |
+ |
std::sort(hbbInfo->tauInfo.begin(), hbbInfo->tauInfo.end(), ptComparatorTau); |
1010 |
|
|
799 |
– |
// dimuons and dielectrons |
800 |
– |
|
801 |
– |
for( size_t i = 0; i < dimuons->size(); i++ ) { |
802 |
– |
VHbbEvent::DiMuonInfo df; |
803 |
– |
const Candidate & dimuonCand = (*dimuons)[ i ]; |
804 |
– |
df.fourMomentum= GENPTOLOR(dimuonCand); |
805 |
– |
const Candidate * lep0 = dimuonCand.daughter( 0 ); |
806 |
– |
const Candidate * lep1 = dimuonCand.daughter( 1 ); |
807 |
– |
// needed to access specific methods of pat::Muon |
808 |
– |
const pat::Muon & muonDau0 = dynamic_cast<const pat::Muon &>(*lep0->masterClone()); |
809 |
– |
const pat::Muon & muonDau1 = dynamic_cast<const pat::Muon &>(*lep1->masterClone()); |
810 |
– |
|
811 |
– |
df.daughter1.fourMomentum=GENPTOLOR(muonDau0); |
812 |
– |
df.daughter2.fourMomentum=GENPTOLOR(muonDau1); |
813 |
– |
|
814 |
– |
df.daughter1.tIso= muonDau0.trackIso(); |
815 |
– |
df.daughter2.tIso= muonDau1.trackIso(); |
816 |
– |
|
817 |
– |
df.daughter1.eIso= muonDau0.ecalIso(); |
818 |
– |
df.daughter2.eIso= muonDau1.ecalIso(); |
819 |
– |
|
820 |
– |
df.daughter1.hIso= muonDau0.hcalIso(); |
821 |
– |
df.daughter2.hIso= muonDau1.hcalIso(); |
822 |
– |
|
823 |
– |
df.daughter1.ipDb=muonDau0.dB(); |
824 |
– |
df.daughter2.ipDb=muonDau1.dB(); |
825 |
– |
|
826 |
– |
df.daughter1.ipErrDb=muonDau0.edB(); |
827 |
– |
df.daughter2.ipErrDb=muonDau1.edB(); |
828 |
– |
|
829 |
– |
|
830 |
– |
if(muonDau0.isGlobalMuon()) df.daughter1.cat =1; |
831 |
– |
else if(muonDau0.isTrackerMuon()) df.daughter1.cat=2; |
832 |
– |
else df.daughter1.cat=3; |
833 |
– |
if(muonDau1.isGlobalMuon()) df.daughter2.cat =1; |
834 |
– |
else if(muonDau1.isTrackerMuon()) df.daughter2.cat=2; |
835 |
– |
else df.daughter2.cat=3; |
836 |
– |
|
837 |
– |
TrackRef trkMu1Ref = muonDau0.get<TrackRef>(); |
838 |
– |
TrackRef trkMu2Ref = muonDau1.get<TrackRef>(); |
839 |
– |
|
840 |
– |
if(trkMu1Ref.isNonnull() && trkMu2Ref.isNonnull()){ |
841 |
– |
const Track* MuTrk1 = muonDau0.get<TrackRef>().get(); |
842 |
– |
const Track* MuTrk2 = muonDau1.get<TrackRef>().get(); |
843 |
– |
df.daughter1.zPVPt=MuTrk1->dz(RecVtxFirst.position()); |
844 |
– |
df.daughter1.zPVProb=MuTrk1->dz(RecVtx.position()); |
845 |
– |
df.daughter2.zPVPt=MuTrk2->dz(RecVtxFirst.position()); |
846 |
– |
df.daughter2.zPVProb=MuTrk2->dz(RecVtx.position()); |
847 |
– |
|
848 |
– |
df.daughter1.nHits = MuTrk1->numberOfValidHits(); |
849 |
– |
df.daughter2.nHits = MuTrk2->numberOfValidHits(); |
1011 |
|
|
1012 |
< |
df.daughter1.chi2 = MuTrk1->normalizedChi2(); |
852 |
< |
df.daughter2.chi2 = MuTrk2->normalizedChi2(); |
853 |
< |
|
854 |
< |
TrackRef iTrack1 = muonDau0.innerTrack(); |
855 |
< |
const reco::HitPattern& p1 = iTrack1->hitPattern(); |
856 |
< |
TrackRef iTrack2 = muonDau1.innerTrack(); |
857 |
< |
const reco::HitPattern& p2 = iTrack2->hitPattern(); |
858 |
< |
|
859 |
< |
df.daughter1.nPixelHits = p1.pixelLayersWithMeasurement(); |
860 |
< |
df.daughter2.nPixelHits = p2.pixelLayersWithMeasurement(); |
861 |
< |
|
862 |
< |
if(muonDau0.isGlobalMuon()){ |
863 |
< |
TrackRef gTrack = muonDau0.globalTrack(); |
864 |
< |
const reco::HitPattern& q = gTrack->hitPattern(); |
865 |
< |
df.daughter1.globNHits=q.numberOfValidMuonHits(); |
866 |
< |
df.daughter1.globChi2=gTrack.get()->normalizedChi2(); |
867 |
< |
} |
868 |
< |
if(muonDau1.isGlobalMuon()){ |
869 |
< |
TrackRef gTrack = muonDau1.globalTrack(); |
870 |
< |
const reco::HitPattern& q = gTrack->hitPattern(); |
871 |
< |
df.daughter2.globNHits=q.numberOfValidMuonHits(); |
872 |
< |
df.daughter2.globChi2=gTrack.get()->normalizedChi2(); |
873 |
< |
} |
1012 |
> |
|
1013 |
|
|
1014 |
< |
} |
1015 |
< |
|
1016 |
< |
hbbInfo->diMuonInfo.push_back(df); |
1014 |
> |
if (verbose_){ |
1015 |
> |
std::cout <<" Pushing hbbInfo "<<std::endl; |
1016 |
> |
std::cout <<" SimpleJets1 = "<<hbbInfo->simpleJets.size()<<std::endl<< |
1017 |
> |
" SimpleJets2 = "<<hbbInfo->simpleJets2.size()<<std::endl<< |
1018 |
> |
" SubJets = "<<hbbInfo->subJets.size()<<std::endl<< |
1019 |
> |
" HardJets = "<<hbbInfo->hardJets.size()<<std::endl<< |
1020 |
> |
" Muons = "<<hbbInfo->muInfo.size()<<std::endl<< |
1021 |
> |
" Electrons = "<<hbbInfo->eleInfo.size()<<std::endl<< |
1022 |
> |
" Taus = "<<hbbInfo->tauInfo.size()<<std::endl<< |
1023 |
> |
" Electrons = "<<hbbInfo->eleInfo.size()<<std::endl<< |
1024 |
> |
"--------------------- "<<std::endl; |
1025 |
|
} |
1026 |
|
|
880 |
– |
for( size_t i = 0; i < dielectrons->size(); i++ ) { |
881 |
– |
VHbbEvent::DiElectronInfo df; |
882 |
– |
const Candidate & dielecCand = (*dielectrons)[ i ]; |
1027 |
|
|
884 |
– |
df.fourMomentum=GENPTOLOR(dielecCand); |
885 |
– |
|
886 |
– |
// accessing the daughters of the dimuon candidate |
887 |
– |
const Candidate * lep0 = dielecCand.daughter( 0 ); |
888 |
– |
const Candidate * lep1 = dielecCand.daughter( 1 ); |
889 |
– |
// needed to access specific methods of pat::Muon |
890 |
– |
const pat::Electron & elecDau0 = dynamic_cast<const pat::Electron &>(*lep0->masterClone()); |
891 |
– |
const pat::Electron & elecDau1 = dynamic_cast<const pat::Electron &>(*lep1->masterClone()); |
892 |
– |
|
893 |
– |
df.daughter1.fourMomentum = GENPTOLOR(elecDau0); |
894 |
– |
df.daughter2.fourMomentum = GENPTOLOR(elecDau1); |
895 |
– |
|
896 |
– |
df.daughter1.tIso = elecDau0.trackIso(); |
897 |
– |
df.daughter2.tIso = elecDau1.trackIso(); |
898 |
– |
|
899 |
– |
df.daughter1.eIso = elecDau0.ecalIso(); |
900 |
– |
df.daughter2.eIso = elecDau1.ecalIso(); |
901 |
– |
|
902 |
– |
df.daughter1.hIso = elecDau0.hcalIso(); |
903 |
– |
df.daughter2.hIso = elecDau1.hcalIso(); |
904 |
– |
|
905 |
– |
|
906 |
– |
hbbInfo->diElectronInfo.push_back(df); |
907 |
– |
|
908 |
– |
} |
1028 |
|
iEvent.put(hbbInfo); |
1029 |
+ |
iEvent.put(auxInfo); |
1030 |
+ |
|
1031 |
|
|
1032 |
|
} |
1033 |
|
|
1062 |
|
HbbAnalyzerNew::endJob() { |
1063 |
|
} |
1064 |
|
|
1065 |
+ |
TVector2 HbbAnalyzerNew::getTvect( const pat::Jet* patJet ){ |
1066 |
+ |
|
1067 |
+ |
TVector2 t_Vect(0,0); |
1068 |
+ |
TVector2 null(0,0); |
1069 |
+ |
TVector2 ci(0,0); |
1070 |
+ |
TLorentzVector pi(0,0,0,0); |
1071 |
+ |
TLorentzVector J(0,0,0,0); |
1072 |
+ |
TVector2 r(0,0); |
1073 |
+ |
double patJetpfcPt = 1e10; |
1074 |
+ |
double r_mag = 1e10; |
1075 |
+ |
unsigned int nOfconst = 0; |
1076 |
+ |
|
1077 |
+ |
|
1078 |
+ |
if (patJet->isPFJet() == false) { |
1079 |
+ |
return t_Vect; |
1080 |
+ |
} |
1081 |
+ |
|
1082 |
+ |
|
1083 |
+ |
//re-reconstruct the jet direction with the charged tracks |
1084 |
+ |
std::vector<reco::PFCandidatePtr> |
1085 |
+ |
patJetpfc = patJet->getPFConstituents(); |
1086 |
+ |
for(size_t idx = 0; idx < patJetpfc.size(); idx++){ |
1087 |
+ |
if( patJetpfc.at(idx)->charge() != 0 ){ |
1088 |
+ |
pi.SetPtEtaPhiE( patJetpfc.at(idx)->pt(), patJetpfc.at(idx)->eta(), patJetpfc.at(idx)->phi(), patJetpfc.at(idx)->energy() ); |
1089 |
+ |
J += pi; |
1090 |
+ |
nOfconst++; |
1091 |
+ |
} |
1092 |
+ |
} |
1093 |
+ |
// if there are less than two charged tracks do not calculate the pull (there is not enough info). It returns a null vector |
1094 |
+ |
|
1095 |
+ |
if( nOfconst < 2 ) |
1096 |
+ |
return null; |
1097 |
+ |
|
1098 |
+ |
|
1099 |
+ |
|
1100 |
+ |
TVector2 v_J( J.Rapidity(), J.Phi() ); |
1101 |
+ |
//calculate TVector using only charged tracks |
1102 |
+ |
for(size_t idx = 0; idx < patJetpfc.size(); idx++){ |
1103 |
+ |
if( patJetpfc.at(idx)->charge() != 0 ){ |
1104 |
+ |
patJetpfcPt = patJetpfc.at(idx)->pt(); |
1105 |
+ |
pi.SetPtEtaPhiE( patJetpfc.at(idx)->pt(), patJetpfc.at(idx)->eta(), patJetpfc.at(idx)->phi(), patJetpfc.at(idx)->energy() ); |
1106 |
+ |
r.Set( pi.Rapidity() - J.Rapidity(), Geom::deltaPhi( patJetpfc.at(idx)->phi(), J.Phi() ) ); |
1107 |
+ |
r_mag = r.Mod(); |
1108 |
+ |
t_Vect += ( patJetpfcPt / J.Pt() ) * r_mag * r; |
1109 |
+ |
} |
1110 |
+ |
} |
1111 |
+ |
|
1112 |
+ |
|
1113 |
+ |
return t_Vect; |
1114 |
+ |
|
1115 |
+ |
} |
1116 |
+ |
|
1117 |
+ |
TLorentzVector HbbAnalyzerNew::getChargedTracksMomentum(const pat::Jet* patJet ){ |
1118 |
+ |
// return TLorentzVector(); |
1119 |
+ |
TLorentzVector pi(0,0,0,0); |
1120 |
+ |
TLorentzVector v_j1(0,0,0,0); |
1121 |
+ |
|
1122 |
+ |
|
1123 |
+ |
// std::cout <<"fff ECCCCCCOOOOO "<<patJet->isPFJet()<<std::endl; |
1124 |
+ |
|
1125 |
+ |
if (patJet->isPFJet() == false ){ |
1126 |
+ |
v_j1 = GENPTOLORP(patJet); |
1127 |
+ |
return v_j1; |
1128 |
+ |
} |
1129 |
+ |
std::vector<reco::PFCandidatePtr> |
1130 |
+ |
j1pfc = patJet->getPFConstituents(); |
1131 |
+ |
for(size_t idx = 0; idx < j1pfc.size(); idx++){ |
1132 |
+ |
if( j1pfc.at(idx)->charge() != 0 ){ |
1133 |
+ |
pi.SetPtEtaPhiE( j1pfc.at(idx)->pt(), j1pfc.at(idx)->eta(), j1pfc.at(idx)->phi(), j1pfc.at(idx)->energy() ); |
1134 |
+ |
v_j1 += pi; |
1135 |
+ |
} |
1136 |
+ |
} |
1137 |
+ |
return v_j1; |
1138 |
+ |
//re- |
1139 |
+ |
} |
1140 |
+ |
|
1141 |
+ |
|
1142 |
+ |
//Btagging scale factors |
1143 |
+ |
void HbbAnalyzerNew::fillScaleFactors(VHbbEvent::SimpleJet& sj, BTagSFContainer iSF){ |
1144 |
+ |
|
1145 |
+ |
|
1146 |
+ |
BinningPointByMap measurePoint; |
1147 |
+ |
//for a USDG |
1148 |
+ |
//for CB jets |
1149 |
+ |
//scale factor 1 for CB jets over 240GeV/c |
1150 |
+ |
if( TMath::Abs(sj.flavour) == 4 or TMath::Abs(sj.flavour) == 5 ){ |
1151 |
+ |
measurePoint.insert( BinningVariables::JetEt, sj.p4.Et() ); |
1152 |
+ |
measurePoint.insert( BinningVariables::JetAbsEta, fabs(sj.p4.Eta()) ); |
1153 |
+ |
if( iSF.BTAGSF_CSVL->isResultOk(PerformanceResult::BTAGBEFFCORR , measurePoint) ){ |
1154 |
+ |
sj.SF_CSVL = iSF.BTAGSF_CSVL->getResult(PerformanceResult::BTAGBEFFCORR , measurePoint); |
1155 |
+ |
sj.SF_CSVLerr = iSF.BTAGSF_CSVL->getResult(PerformanceResult::BTAGBERRCORR , measurePoint); |
1156 |
+ |
if(verbose_){ |
1157 |
+ |
std::clog << "C/B Jet flavour = " << sj.flavour << std::endl; |
1158 |
+ |
std::clog << "C/B Jet Et = " << sj.p4.Et() << std::endl; |
1159 |
+ |
std::clog << "C/B Jet eta = " << sj.p4.Eta() << std::endl; |
1160 |
+ |
std::clog << "C/B CSVL Scale Factor = " << sj.SF_CSVL << std::endl; |
1161 |
+ |
std::clog << "C/B CSVL Scale Factor error = " << sj.SF_CSVLerr << std::endl; |
1162 |
+ |
} |
1163 |
+ |
} |
1164 |
+ |
if( iSF.BTAGSF_CSVM->isResultOk(PerformanceResult::BTAGBEFFCORR , measurePoint) ){ |
1165 |
+ |
sj.SF_CSVM = iSF.BTAGSF_CSVM->getResult(PerformanceResult::BTAGBEFFCORR , measurePoint); |
1166 |
+ |
sj.SF_CSVMerr = iSF.BTAGSF_CSVM->getResult(PerformanceResult::BTAGBERRCORR , measurePoint); |
1167 |
+ |
} |
1168 |
+ |
if( iSF.BTAGSF_CSVT->isResultOk(PerformanceResult::BTAGBEFFCORR , measurePoint) ){ |
1169 |
+ |
sj.SF_CSVT = iSF.BTAGSF_CSVT->getResult(PerformanceResult::BTAGBEFFCORR , measurePoint); |
1170 |
+ |
sj.SF_CSVTerr = iSF.BTAGSF_CSVT->getResult(PerformanceResult::BTAGBERRCORR , measurePoint); |
1171 |
+ |
} |
1172 |
+ |
else{ |
1173 |
+ |
if(verbose_){ |
1174 |
+ |
std::cerr << "No SF found in the database for this jet" << std::endl; |
1175 |
+ |
std::clog << "No SF found: Jet flavour = " << sj.flavour << std::endl; |
1176 |
+ |
std::clog << "No SF found: Jet Et = " << sj.p4.Et() << std::endl; |
1177 |
+ |
std::clog << "No SF found: Jet eta = " << sj.p4.Eta() << std::endl; |
1178 |
+ |
} |
1179 |
+ |
} |
1180 |
+ |
} |
1181 |
+ |
else { |
1182 |
+ |
measurePoint.insert( BinningVariables::JetEt, sj.p4.Et() ); |
1183 |
+ |
measurePoint.insert( BinningVariables::JetAbsEta, fabs(sj.p4.Eta()) ); |
1184 |
+ |
if( iSF.MISTAGSF_CSVL->isResultOk(PerformanceResult::BTAGLEFFCORR , measurePoint) ){ |
1185 |
+ |
sj.SF_CSVL = iSF.MISTAGSF_CSVL->getResult(PerformanceResult::BTAGLEFFCORR , measurePoint); |
1186 |
+ |
sj.SF_CSVLerr = iSF.MISTAGSF_CSVL->getResult(PerformanceResult::BTAGLERRCORR , measurePoint); |
1187 |
+ |
if(verbose_){ |
1188 |
+ |
std::clog << "Light Jet flavour = " << sj.flavour << std::endl; |
1189 |
+ |
std::clog << "Light Jet Et = " << sj.p4.Et() << std::endl; |
1190 |
+ |
std::clog << "Light Jet eta = " << sj.p4.Eta() << std::endl; |
1191 |
+ |
std::clog << "Light CSVL Scale Factor = " << sj.SF_CSVL << std::endl; |
1192 |
+ |
std::clog << "Light CSVL Scale Factor error = " << sj.SF_CSVLerr << std::endl; |
1193 |
+ |
} |
1194 |
+ |
} |
1195 |
+ |
if( iSF.MISTAGSF_CSVM->isResultOk(PerformanceResult::BTAGLEFFCORR , measurePoint) ){ |
1196 |
+ |
sj.SF_CSVM = iSF.MISTAGSF_CSVM->getResult(PerformanceResult::BTAGLEFFCORR , measurePoint); |
1197 |
+ |
sj.SF_CSVMerr = iSF.MISTAGSF_CSVM->getResult(PerformanceResult::BTAGLERRCORR , measurePoint); |
1198 |
+ |
} |
1199 |
+ |
if( iSF.MISTAGSF_CSVT->isResultOk(PerformanceResult::BTAGLEFFCORR , measurePoint) ){ |
1200 |
+ |
sj.SF_CSVT = iSF.MISTAGSF_CSVT->getResult(PerformanceResult::BTAGLEFFCORR , measurePoint); |
1201 |
+ |
sj.SF_CSVTerr = iSF.MISTAGSF_CSVT->getResult(PerformanceResult::BTAGLERRCORR , measurePoint); |
1202 |
+ |
} |
1203 |
+ |
else{ |
1204 |
+ |
if(verbose_){ |
1205 |
+ |
std::cerr << "No SF found in the database for this jet" << std::endl; |
1206 |
+ |
std::clog << "No SF found: Jet flavour = " << sj.flavour << std::endl; |
1207 |
+ |
std::clog << "No SF found: Jet Et = " << sj.p4.Et() << std::endl; |
1208 |
+ |
std::clog << "No SF found: Jet eta = " << sj.p4.Eta() << std::endl; |
1209 |
+ |
} |
1210 |
+ |
} |
1211 |
+ |
} |
1212 |
+ |
|
1213 |
+ |
} |
1214 |
+ |
|
1215 |
+ |
void HbbAnalyzerNew::setJecUnc(VHbbEvent::SimpleJet& sj,JetCorrectionUncertainty* jecunc){ |
1216 |
+ |
// |
1217 |
+ |
// test |
1218 |
+ |
// |
1219 |
+ |
|
1220 |
+ |
// return; |
1221 |
+ |
double eta = sj.p4.Eta(); |
1222 |
+ |
double pt = sj.p4.Pt(); |
1223 |
+ |
|
1224 |
+ |
jecunc->setJetEta(eta); |
1225 |
+ |
jecunc->setJetPt(pt); // here you must use the CORRECTED jet pt |
1226 |
+ |
double unc = jecunc->getUncertainty(true); |
1227 |
+ |
sj.jecunc= unc; |
1228 |
+ |
} |
1229 |
+ |
|
1230 |
+ |
|
1231 |
+ |
void HbbAnalyzerNew ::fillSimpleJet (VHbbEvent::SimpleJet& sj, edm::View<pat::Jet>::const_iterator jet_iter){ |
1232 |
+ |
sj.flavour = jet_iter->partonFlavour(); |
1233 |
+ |
|
1234 |
+ |
sj.tche=jet_iter->bDiscriminator("trackCountingHighEffBJetTags"); |
1235 |
+ |
sj.tchp=jet_iter->bDiscriminator("trackCountingHighPurBJetTags"); |
1236 |
+ |
sj.jp=jet_iter->bDiscriminator("jetProbabilityBJetTags"); |
1237 |
+ |
sj.jpb=jet_iter->bDiscriminator("jetBProbabilityBJetTags"); |
1238 |
+ |
sj.ssvhe=jet_iter->bDiscriminator("simpleSecondaryVertexHighEffBJetTags"); |
1239 |
+ |
sj.csv=jet_iter->bDiscriminator("combinedSecondaryVertexBJetTags"); |
1240 |
+ |
sj.csvmva=jet_iter->bDiscriminator("combinedSecondaryVertexMVABJetTags"); |
1241 |
+ |
sj.charge=jet_iter->jetCharge(); |
1242 |
+ |
sj.ntracks=jet_iter->associatedTracks().size(); |
1243 |
+ |
sj.p4=GENPTOLORP(jet_iter); |
1244 |
+ |
// std::cout << " ECCO "<<sj.csv<< " "<< sj.p4.Pt()<<std::endl; |
1245 |
+ |
sj.chargedTracksFourMomentum=(getChargedTracksMomentum(&*(jet_iter))); |
1246 |
+ |
sj.SF_CSVL=1; |
1247 |
+ |
sj.SF_CSVM=1; |
1248 |
+ |
sj.SF_CSVT=1; |
1249 |
+ |
sj.SF_CSVLerr=0; |
1250 |
+ |
sj.SF_CSVMerr=0; |
1251 |
+ |
sj.SF_CSVTerr=0; |
1252 |
+ |
|
1253 |
+ |
|
1254 |
+ |
if (jet_iter->isPFJet() == true) { |
1255 |
+ |
|
1256 |
+ |
sj.chargedHadronEFraction = jet_iter-> chargedHadronEnergyFraction(); |
1257 |
+ |
sj.neutralHadronEFraction = jet_iter-> neutralHadronEnergyFraction (); |
1258 |
+ |
sj.chargedEmEFraction = jet_iter-> chargedEmEnergyFraction (); |
1259 |
+ |
sj.neutralEmEFraction = jet_iter-> neutralEmEnergyFraction (); |
1260 |
+ |
sj.nConstituents = jet_iter->getPFConstituents().size(); |
1261 |
+ |
|
1262 |
+ |
} |
1263 |
+ |
// |
1264 |
+ |
// addtaginfo for csv |
1265 |
+ |
// |
1266 |
+ |
|
1267 |
+ |
// if (jet_iter->hasTagInfo("SimpleSecondaryVertex")) { |
1268 |
+ |
|
1269 |
+ |
const reco::SecondaryVertexTagInfo * tf = jet_iter->tagInfoSecondaryVertex(); |
1270 |
+ |
if (tf){ |
1271 |
+ |
if (tf->nVertices() >0){ |
1272 |
+ |
sj.vtxMass = tf->secondaryVertex(0).p4().mass(); |
1273 |
+ |
sj.vtxNTracks = tf->secondaryVertex(0).nTracks(); |
1274 |
+ |
std::vector<reco::TrackBaseRef >::const_iterator tit = tf->secondaryVertex(0).tracks_begin(); |
1275 |
+ |
for (; tit< tf->secondaryVertex(0).tracks_end(); ++tit){ |
1276 |
+ |
sj.vtxTrackIds.push_back(tit->key()); |
1277 |
+ |
} |
1278 |
+ |
Measurement1D m = tf->flightDistance(0); |
1279 |
+ |
sj.vtx3dL = m.value(); |
1280 |
+ |
sj.vtx3deL = m.error(); |
1281 |
+ |
} |
1282 |
+ |
} |
1283 |
+ |
// |
1284 |
+ |
// add tVector |
1285 |
+ |
// |
1286 |
+ |
sj.tVector = getTvect(&(*jet_iter)); |
1287 |
+ |
} |
1288 |
+ |
|
1289 |
+ |
|
1290 |
|
//define this as a plug-in |
1291 |
|
DEFINE_FWK_MODULE(HbbAnalyzerNew); |