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 |
|
//GenParticles |
37 |
< |
#include "DataFormats/HepMCCandidate/interface/GenParticle.h" |
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_; |
89 |
– |
edm::InputTag genParticles_; |
90 |
– |
|
91 |
|
// Counting variables // |
92 |
|
|
93 |
|
int eventNumber, runNumber, lumiSection, bunchCross; |
97 |
|
|
98 |
|
TClonesArray* jet_ak5PF; |
99 |
|
TClonesArray* jetP4_ak5Gen; |
100 |
– |
TClonesArray* genParticleP4; |
100 |
|
TClonesArray* primaryVtx; |
101 |
|
|
102 |
|
bool doGenJets_; |
120 |
|
PFJetHandle_(iConfig.getUntrackedParameter<edm::InputTag>("PFJetTag")), |
121 |
|
GenJetHandle_(iConfig.getUntrackedParameter<edm::InputTag>("GenJetTag")), |
122 |
|
PrimaryVtxHandle_(iConfig.getUntrackedParameter<edm::InputTag>("PrimaryVtxTag")), |
124 |
– |
genParticles_(iConfig.getUntrackedParameter<edm::InputTag>("genParticleTag")), |
123 |
|
doGenJets_(iConfig.getUntrackedParameter<bool>("doGenJets")), |
124 |
|
doPFJets_(iConfig.getUntrackedParameter<bool>("doPFJets")), |
125 |
|
triggerHLT_(iConfig.getUntrackedParameter<bool>("triggerHLT")), |
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 |
|
// |
166 |
|
|
167 |
|
int PFcount = 0; |
168 |
|
int Gencount = 0; |
158 |
– |
int GenPcount = 0; |
169 |
|
int Vtxcount = 0; |
170 |
|
|
171 |
|
if(doPFJets_){ |
240 |
|
|
241 |
|
if(!isRealData){ |
242 |
|
|
233 |
– |
Handle<reco::GenParticleCollection > genpcoll; |
234 |
– |
iEvent.getByLabel(genParticles_, genpcoll); |
243 |
|
|
244 |
|
Handle<reco::GenJetCollection> GenJets; |
245 |
|
iEvent.getByLabel(GenJetHandle_, GenJets); |
256 |
|
++Gencount; |
257 |
|
|
258 |
|
} |
259 |
< |
} |
252 |
< |
|
253 |
< |
for(reco::GenParticleCollection::const_iterator iGen = genpcoll->begin(); iGen!=genpcoll->end(); ++iGen) { |
254 |
< |
|
255 |
< |
reco::GenParticle p = reco::GenParticle(*iGen); |
256 |
< |
|
257 |
< |
new ((*genParticleP4)[GenPcount]) TLorentzVector(p.px(), p.py(), p.pz(), p.energy()); |
258 |
< |
|
259 |
< |
++GenPcount; |
260 |
< |
|
261 |
< |
} |
262 |
< |
|
263 |
< |
|
259 |
> |
} |
260 |
|
} |
261 |
|
|
262 |
|
|
266 |
|
for(VertexCollection::const_iterator vtx_iter = primaryVtcs->begin(); vtx_iter!= primaryVtcs->end(); ++vtx_iter){ |
267 |
|
|
268 |
|
reco::Vertex myVtx = reco::Vertex(*vtx_iter); |
269 |
< |
|
269 |
> |
if(!myVtx.isValid() || myVtx.isFake()) continue; |
270 |
|
TCPrimaryVtx* vtxCon = new ((*primaryVtx)[Vtxcount]) TCPrimaryVtx; |
271 |
|
|
272 |
|
vtxCon->SetPosition(myVtx.x(), myVtx.y(), myVtx.z()); |
273 |
|
vtxCon->SetNDof(myVtx.ndof()); |
274 |
|
vtxCon->SetChi2(myVtx.chi2()); |
275 |
< |
|
275 |
> |
vtxCon->SetNTrks(myVtx.tracksSize()); |
276 |
> |
vtxCon->SetSumPt2Trks(sumPtSquared(myVtx)); |
277 |
|
++Vtxcount; |
278 |
|
|
279 |
|
} |
315 |
|
} |
316 |
|
// cout<< "total status: "<<hex<<triggerStatus<<endl; |
317 |
|
|
318 |
< |
if(PFcount > 0 || Gencount > 0 || Vtxcount > 0); sTree -> Fill(); |
318 |
> |
if((PFcount > 3 || Gencount > 3) && Vtxcount > 0) sTree -> Fill(); |
319 |
|
|
320 |
|
jet_ak5PF->Clear(); |
321 |
|
primaryVtx->Clear(); |
333 |
|
|
334 |
|
jet_ak5PF = new TClonesArray("TCJet"); |
335 |
|
jetP4_ak5Gen = new TClonesArray("TLorentzVector"); |
339 |
– |
genParticleP4 = new TClonesArray("TLorentzVector"); |
336 |
|
primaryVtx = new TClonesArray("TCPrimaryVtx"); |
337 |
|
|
338 |
|
sTree->Branch("jet_ak5PF",&jet_ak5PF, 6400, 0); |
339 |
|
sTree->Branch("jetP4_ak5Gen",&jetP4_ak5Gen, 6400, 0); |
344 |
– |
sTree->Branch("genParticleP4",&genParticleP4, 6400, 0); |
340 |
|
sTree->Branch("primaryVtx",&primaryVtx, 6400, 0); |
341 |
|
|
342 |
|
sTree->Branch("eventNumber",&eventNumber, "eventNumber/I"); |