18 |
|
#include "FWCore/ParameterSet/interface/ParameterSet.h" |
19 |
|
#include "DataFormats/GeometryVector/interface/GlobalPoint.h" |
20 |
|
#include "Geometry/Records/interface/CaloGeometryRecord.h" |
21 |
+ |
#include "DataFormats/Math/interface/deltaPhi.h" |
22 |
|
|
23 |
|
// Jet and vertex functions |
24 |
|
#include "DataFormats/JetReco/interface/CaloJet.h" |
31 |
|
#include "DataFormats/VertexReco/interface/Vertex.h" |
32 |
|
#include "DataFormats/VertexReco/interface/VertexFwd.h" |
33 |
|
#include "DataFormats/BTauReco/interface/JetTag.h" |
34 |
+ |
//#include "RecoVertex/PrimaryVertexProducer/interface/VertexHigherPtSquared.h" |
35 |
|
|
36 |
< |
#include "DataFormats/Math/interface/deltaPhi.h" |
36 |
> |
//GenParticles |
37 |
> |
//#include "DataFormats/HepMCCandidate/interface/GenParticle.h" |
38 |
|
|
39 |
|
// Need to get correctors |
40 |
|
#include "JetMETCorrections/Objects/interface/JetCorrector.h" |
80 |
|
virtual void endJob() ; |
81 |
|
|
82 |
|
bool triggerDecision(edm::Handle<edm::TriggerResults> &hltR, int iTrigger); |
83 |
+ |
double sumPtSquared(const Vertex & v); |
84 |
|
|
85 |
|
// ----------member data --------------------------- |
86 |
|
|
88 |
|
edm::InputTag GenJetHandle_; |
89 |
|
edm::InputTag PrimaryVtxHandle_; |
90 |
|
edm::InputTag triggerResultsTag_; |
87 |
– |
|
88 |
– |
|
91 |
|
// Counting variables // |
92 |
|
|
93 |
|
int eventNumber, runNumber, lumiSection, bunchCross; |
127 |
|
hlTriggerResults_(iConfig.getUntrackedParameter<string>("HLTriggerResults","TriggerResults")), |
128 |
|
hltName_(iConfig.getUntrackedParameter<string>("hltName","HLT")) |
129 |
|
{ |
130 |
< |
//edm::TriggerNames |
129 |
< |
// triggerNames(iConfig); |
130 |
> |
|
131 |
|
|
132 |
|
} |
133 |
|
|
137 |
|
|
138 |
|
} |
139 |
|
|
140 |
+ |
double MPIntuple::sumPtSquared(const Vertex & v) |
141 |
+ |
{ |
142 |
+ |
double sum = 0.; |
143 |
+ |
double pT; |
144 |
+ |
for (Vertex::trackRef_iterator it = v.tracks_begin(); it != v.tracks_end(); it++) { |
145 |
+ |
pT = (**it).pt(); |
146 |
+ |
double epT=(**it).ptError(); pT=pT>epT ? pT-epT : 0; |
147 |
+ |
|
148 |
+ |
sum += pT*pT; |
149 |
+ |
} |
150 |
+ |
return sum; |
151 |
+ |
} |
152 |
+ |
|
153 |
|
// |
154 |
|
// member functions |
155 |
|
// |
158 |
|
void MPIntuple::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) |
159 |
|
{ |
160 |
|
|
161 |
+ |
|
162 |
|
eventNumber = iEvent.id().event(); |
163 |
|
runNumber = iEvent.id().run(); |
164 |
|
lumiSection = (unsigned int)iEvent.getLuminosityBlock().luminosityBlock(); |
165 |
|
bunchCross = (unsigned int)iEvent.bunchCrossing(); |
166 |
|
isRealData = iEvent.isRealData(); |
167 |
|
|
168 |
< |
int PFcount = 0; |
169 |
< |
int Gencount = 0; |
170 |
< |
int Vtxcount = 0; |
168 |
> |
int PFcount = 0; |
169 |
> |
int Gencount = 0; |
170 |
> |
int Vtxcount = 0; |
171 |
|
|
172 |
|
if(doPFJets_){ |
173 |
|
|
181 |
|
const reco::JetTagCollection & bTags2 = *(bTagHandle2.product()); |
182 |
|
reco::JetTagCollection::const_iterator jet_it_2; |
183 |
|
|
184 |
+ |
|
185 |
|
const JetCorrector* correctorL2 = JetCorrector::getJetCorrector ("ak5PFL2Relative",iSetup); |
186 |
|
const JetCorrector* correctorL3 = JetCorrector::getJetCorrector ("ak5PFL3Absolute",iSetup); |
187 |
|
|
193 |
|
for(PFJetCollection::const_iterator jet_iter = PFJets->begin(); jet_iter!= PFJets->end(); ++jet_iter){ |
194 |
|
|
195 |
|
reco::PFJet myJet = reco::PFJet(*jet_iter); |
180 |
– |
|
181 |
– |
// float scale2 = correctorL2->correction(myJet); |
182 |
– |
// float scale3 = correctorL3->correction(myJet); |
183 |
– |
|
196 |
|
if(myJet.et() > 5){ |
197 |
|
|
198 |
|
for(jet_it_1 = bTags1.begin(); jet_it_1 != bTags1.end(); jet_it_1++) { |
236 |
|
} |
237 |
|
} |
238 |
|
|
239 |
< |
if(doGenJets_){ |
239 |
> |
if(!isRealData){ |
240 |
|
|
241 |
+ |
|
242 |
|
Handle<reco::GenJetCollection> GenJets; |
243 |
|
iEvent.getByLabel(GenJetHandle_, GenJets); |
244 |
|
|
254 |
|
++Gencount; |
255 |
|
|
256 |
|
} |
257 |
< |
} |
257 |
> |
} |
258 |
|
} |
259 |
< |
|
260 |
< |
|
259 |
> |
|
260 |
> |
|
261 |
|
Handle<reco::VertexCollection> primaryVtcs; |
262 |
|
iEvent.getByLabel(PrimaryVtxHandle_, primaryVtcs); |
263 |
< |
|
263 |
> |
|
264 |
|
for(VertexCollection::const_iterator vtx_iter = primaryVtcs->begin(); vtx_iter!= primaryVtcs->end(); ++vtx_iter){ |
265 |
|
|
266 |
|
reco::Vertex myVtx = reco::Vertex(*vtx_iter); |
267 |
< |
|
267 |
> |
if(!myVtx.isValid() || myVtx.isFake()) continue; |
268 |
|
TCPrimaryVtx* vtxCon = new ((*primaryVtx)[Vtxcount]) TCPrimaryVtx; |
269 |
|
|
270 |
|
vtxCon->SetPosition(myVtx.x(), myVtx.y(), myVtx.z()); |
271 |
|
vtxCon->SetNDof(myVtx.ndof()); |
272 |
|
vtxCon->SetChi2(myVtx.chi2()); |
273 |
< |
|
273 |
> |
vtxCon->SetNTrks(myVtx.tracksSize()); |
274 |
> |
vtxCon->SetSumPt2Trks(sumPtSquared(myVtx)); |
275 |
|
++Vtxcount; |
276 |
|
|
277 |
|
} |
312 |
|
} |
313 |
|
} |
314 |
|
// cout<< "total status: "<<hex<<triggerStatus<<endl; |
315 |
< |
|
316 |
< |
if(PFcount > 0 || Gencount > 0 || Vtxcount > 0); sTree -> Fill(); |
315 |
> |
|
316 |
> |
|
317 |
> |
|
318 |
> |
if((PFcount > 3 || Gencount > 3) && Vtxcount > 0) sTree -> Fill(); |
319 |
|
|
320 |
|
jet_ak5PF->Clear(); |
321 |
|
primaryVtx->Clear(); |