20 |
|
#include "Geometry/Records/interface/CaloGeometryRecord.h" |
21 |
|
#include "DataFormats/Math/interface/deltaPhi.h" |
22 |
|
|
23 |
< |
// Jet and vertex functions |
23 |
> |
// Libraries for objects |
24 |
|
#include "DataFormats/JetReco/interface/CaloJet.h" |
25 |
|
#include "DataFormats/JetReco/interface/CaloJetCollection.h" |
26 |
|
#include "DataFormats/JetReco/interface/PFJet.h" |
31 |
|
#include "DataFormats/VertexReco/interface/Vertex.h" |
32 |
|
#include "DataFormats/VertexReco/interface/VertexFwd.h" |
33 |
|
#include "DataFormats/BTauReco/interface/JetTag.h" |
34 |
+ |
#include "DataFormats/TrackReco/interface/Track.h" |
35 |
+ |
#include "DataFormats/BeamSpot/interface/BeamSpot.h" |
36 |
+ |
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" |
37 |
+ |
#include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h" |
38 |
+ |
|
39 |
|
//#include "RecoVertex/PrimaryVertexProducer/interface/VertexHigherPtSquared.h" |
40 |
|
|
41 |
|
//GenParticles |
42 |
< |
//#include "DataFormats/HepMCCandidate/interface/GenParticle.h" |
42 |
> |
#include "DataFormats/HepMCCandidate/interface/GenParticle.h" |
43 |
|
|
44 |
|
// Need to get correctors |
45 |
|
#include "JetMETCorrections/Objects/interface/JetCorrector.h" |
55 |
|
|
56 |
|
//Root stuff |
57 |
|
#include "TROOT.h" |
58 |
+ |
#include "TH1.h" |
59 |
+ |
#include "TH2.h" |
60 |
+ |
#include "TProfile.h" |
61 |
|
#include "TFile.h" |
62 |
|
#include "TTree.h" |
63 |
|
#include "TString.h" |
99 |
|
// Counting variables // |
100 |
|
|
101 |
|
int eventNumber, runNumber, lumiSection, bunchCross; |
102 |
< |
|
102 |
> |
double ptHat, qScale, crossSection; |
103 |
> |
|
104 |
|
TTree* sTree; |
105 |
|
TFile* ntupleFile; |
106 |
|
|
121 |
|
vector<string> hlNames; |
122 |
|
unsigned int triggerStatus; |
123 |
|
|
124 |
+ |
//Histograms |
125 |
+ |
TH1D * h1_fracAssociatedTracks; |
126 |
+ |
TH1D * h1_meanJetTrackZ; |
127 |
+ |
TH1D * h1_trackDxy; |
128 |
+ |
TH1D * h1_jetVertexZ; |
129 |
+ |
TH1D * h1_associatedSumPt; |
130 |
+ |
TH1D * h1_associatedVertexIndex; |
131 |
+ |
TH2F * h2_nAssTracksVsJetPt; |
132 |
+ |
TProfile * p1_nVtcs; |
133 |
|
|
116 |
– |
}; |
134 |
|
|
135 |
< |
MPIntuple::MPIntuple(const edm::ParameterSet& iConfig): |
135 |
> |
}; |
136 |
|
|
137 |
< |
PFJetHandle_(iConfig.getUntrackedParameter<edm::InputTag>("PFJetTag")), |
121 |
< |
GenJetHandle_(iConfig.getUntrackedParameter<edm::InputTag>("GenJetTag")), |
122 |
< |
PrimaryVtxHandle_(iConfig.getUntrackedParameter<edm::InputTag>("PrimaryVtxTag")), |
123 |
< |
doGenJets_(iConfig.getUntrackedParameter<bool>("doGenJets")), |
124 |
< |
doPFJets_(iConfig.getUntrackedParameter<bool>("doPFJets")), |
125 |
< |
triggerHLT_(iConfig.getUntrackedParameter<bool>("triggerHLT")), |
126 |
< |
rootfilename(iConfig.getUntrackedParameter<string>("rootfilename")), |
127 |
< |
hlTriggerResults_(iConfig.getUntrackedParameter<string>("HLTriggerResults","TriggerResults")), |
128 |
< |
hltName_(iConfig.getUntrackedParameter<string>("hltName","HLT")) |
137 |
> |
MPIntuple::MPIntuple(const edm::ParameterSet& iConfig) |
138 |
|
{ |
139 |
< |
|
140 |
< |
|
139 |
> |
PFJetHandle_ = iConfig.getUntrackedParameter<edm::InputTag>("PFJetTag"); |
140 |
> |
GenJetHandle_ = iConfig.getUntrackedParameter<edm::InputTag>("GenJetTag"); |
141 |
> |
PrimaryVtxHandle_ = iConfig.getUntrackedParameter<edm::InputTag>("PrimaryVtxTag"); |
142 |
> |
doGenJets_ = iConfig.getUntrackedParameter<bool>("doGenJets"); |
143 |
> |
doPFJets_ = iConfig.getUntrackedParameter<bool>("doPFJets"); |
144 |
> |
triggerHLT_ = iConfig.getUntrackedParameter<bool>("triggerHLT"); |
145 |
> |
rootfilename = iConfig.getUntrackedParameter<string>("rootfilename"); |
146 |
> |
hlTriggerResults_ = iConfig.getUntrackedParameter<string>("HLTriggerResults","TriggerResults"); |
147 |
> |
hltName_ = iConfig.getUntrackedParameter<string>("hltName"); |
148 |
|
} |
149 |
|
|
134 |
– |
|
150 |
|
MPIntuple::~MPIntuple() |
151 |
|
{ |
152 |
|
|
153 |
|
} |
154 |
|
|
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 |
– |
|
155 |
|
// |
156 |
|
// member functions |
157 |
|
// |
166 |
|
bunchCross = (unsigned int)iEvent.bunchCrossing(); |
167 |
|
isRealData = iEvent.isRealData(); |
168 |
|
|
169 |
< |
int PFcount = 0; |
170 |
< |
int Gencount = 0; |
171 |
< |
int Vtxcount = 0; |
169 |
> |
|
170 |
> |
edm::Handle<reco::BeamSpot> beamSpotHandle; |
171 |
> |
iEvent.getByLabel("offlineBeamSpot", beamSpotHandle); |
172 |
> |
reco::BeamSpot vertexBeamSpot = *beamSpotHandle; |
173 |
> |
|
174 |
> |
int pfCount = 0; |
175 |
> |
int genCount = 0; |
176 |
> |
int vtxCount = 0; |
177 |
> |
double primaryVertexZ = -999; |
178 |
> |
|
179 |
> |
////////////////////////// |
180 |
> |
//Get vertex information// |
181 |
> |
////////////////////////// |
182 |
> |
|
183 |
> |
Handle<reco::VertexCollection> primaryVtcs; |
184 |
> |
iEvent.getByLabel(PrimaryVtxHandle_, primaryVtcs); |
185 |
> |
|
186 |
> |
for(VertexCollection::const_iterator vtx_iter = primaryVtcs->begin(); vtx_iter!= primaryVtcs->end(); ++vtx_iter){ |
187 |
> |
|
188 |
> |
reco::Vertex myVtx = reco::Vertex(*vtx_iter); |
189 |
> |
if(!myVtx.isValid() || myVtx.isFake()) continue; |
190 |
> |
TCPrimaryVtx* vtxCon = new ((*primaryVtx)[vtxCount]) TCPrimaryVtx; |
191 |
> |
|
192 |
> |
//cout<<myVtx.nTracks()<<endl; |
193 |
> |
|
194 |
> |
vtxCon->SetPosition(myVtx.x(), myVtx.y(), myVtx.z()); |
195 |
> |
vtxCon->SetNDof(myVtx.ndof()); |
196 |
> |
vtxCon->SetChi2(myVtx.chi2()); |
197 |
> |
vtxCon->SetNTrks(myVtx.tracksSize()); |
198 |
> |
vtxCon->SetSumPt2Trks(sumPtSquared(myVtx)); |
199 |
> |
|
200 |
> |
if(vtxCount == 0) primaryVertexZ = myVtx.z(); |
201 |
> |
|
202 |
> |
++vtxCount; |
203 |
> |
|
204 |
> |
} |
205 |
> |
|
206 |
> |
p1_nVtcs->Fill(runNumber, vtxCount); |
207 |
> |
|
208 |
> |
/////////////////////// |
209 |
> |
//get jet information// |
210 |
> |
/////////////////////// |
211 |
|
|
212 |
|
if(doPFJets_){ |
213 |
|
|
221 |
|
const reco::JetTagCollection & bTags2 = *(bTagHandle2.product()); |
222 |
|
reco::JetTagCollection::const_iterator jet_it_2; |
223 |
|
|
224 |
+ |
|
225 |
|
const JetCorrector* correctorL2 = JetCorrector::getJetCorrector ("ak5PFL2Relative",iSetup); |
226 |
|
const JetCorrector* correctorL3 = JetCorrector::getJetCorrector ("ak5PFL3Absolute",iSetup); |
227 |
|
|
228 |
|
Handle<reco::PFJetCollection> PFJets; |
229 |
|
iEvent.getByLabel(PFJetHandle_, PFJets); |
230 |
< |
|
189 |
< |
PFcount = 0; |
190 |
< |
|
230 |
> |
|
231 |
|
for(PFJetCollection::const_iterator jet_iter = PFJets->begin(); jet_iter!= PFJets->end(); ++jet_iter){ |
232 |
|
|
233 |
|
reco::PFJet myJet = reco::PFJet(*jet_iter); |
234 |
< |
|
195 |
< |
// float scale2 = correctorL2->correction(myJet); |
196 |
< |
// float scale3 = correctorL3->correction(myJet); |
197 |
< |
|
198 |
< |
if(myJet.et() > 5){ |
234 |
> |
if(myJet.pt() > 5){ |
235 |
|
|
236 |
|
for(jet_it_1 = bTags1.begin(); jet_it_1 != bTags1.end(); jet_it_1++) { |
237 |
|
if( (fabs(jet_it_1->first->eta() - myJet.eta()) < .005) && (deltaPhi(jet_it_1->first->phi(),myJet.phi()) < .005)) break; |
241 |
|
if( (fabs(jet_it_2->first->eta() - myJet.eta()) < .005) && (deltaPhi(jet_it_2->first->phi(),myJet.phi()) < .005)) break; |
242 |
|
} |
243 |
|
|
244 |
< |
TCJet* jetCon = new ((*jet_ak5PF)[PFcount]) TCJet; |
244 |
> |
TCJet* jetCon = new ((*jet_ak5PF)[pfCount]) TCJet; |
245 |
|
|
246 |
|
jetCon->SetP4(myJet.px(), myJet.py(), myJet.pz(), myJet.energy()); |
247 |
< |
jetCon->SetVtx(myJet.vx(), myJet.vy(), myJet.vz()); |
247 |
> |
jetCon->SetVtx(-999.0, -999.0, -999.0); |
248 |
|
|
249 |
|
jetCon->SetChHadFrac(myJet.chargedHadronEnergyFraction()); |
250 |
|
jetCon->SetNeuHadFrac(myJet.neutralHadronEnergyFraction()); |
259 |
|
if(jet_it_2 != bTags2.end()) jetCon->SetBDiscrTrkCountHiPure(jet_it_2->second); |
260 |
|
if(jet_it_1 != bTags1.end()) jetCon->SetBDiscrTrkCountHiEff(jet_it_1->second); |
261 |
|
|
262 |
< |
float scale2 = correctorL2->correction(myJet); |
262 |
> |
double scale2 = correctorL2->correction(myJet); |
263 |
|
myJet.scaleEnergy(scale2); |
264 |
< |
float scale3 = correctorL3->correction(myJet); |
264 |
> |
double scale3 = correctorL3->correction(myJet); |
265 |
|
myJet.scaleEnergy(scale3); |
266 |
|
|
267 |
|
//more corrections? |
269 |
|
jetCon->SetJetCorr(2, scale2); |
270 |
|
jetCon->SetJetCorr(3, scale3); |
271 |
|
|
272 |
< |
++PFcount; |
272 |
> |
///////////////////////// |
273 |
> |
//get associated tracks// |
274 |
> |
///////////////////////// |
275 |
> |
|
276 |
> |
const reco::TrackRefVector &tracks = myJet.getTrackRefs(); |
277 |
> |
|
278 |
> |
vector<TVector3> vtxPositionCollection; |
279 |
> |
vector<double> associatedTrackSumPt; |
280 |
> |
vector<unsigned int> jetTrackAddresses; |
281 |
> |
double sumTrackX, sumTrackY, sumTrackZ, sumTrackIP, sumTrackPt; |
282 |
> |
//double meanTrackX, meanTrackY, meanTrackZ, meanTrackIP; |
283 |
> |
int nJetTracks, nVertexTracks, nAssociatedTracks, vertexIndex; |
284 |
> |
int vCount = 0; |
285 |
> |
|
286 |
> |
nJetTracks = nVertexTracks = nAssociatedTracks = 0; |
287 |
> |
sumTrackX = sumTrackY = sumTrackZ = sumTrackIP = sumTrackPt = 0; |
288 |
> |
//meanTrackZ = meanTrackIP = -999; |
289 |
> |
|
290 |
> |
if(myJet.pt() > 10 && fabs(myJet.eta()) < 2.4){ |
291 |
> |
|
292 |
> |
for(TrackRefVector::const_iterator iTrack = tracks.begin(); iTrack != tracks.end(); ++iTrack){ |
293 |
> |
|
294 |
> |
const reco::Track &myJetTrack = **iTrack; |
295 |
> |
|
296 |
> |
sumTrackPt += myJetTrack.pt(); |
297 |
> |
sumTrackX += myJetTrack.vx(); |
298 |
> |
sumTrackY += myJetTrack.vy(); |
299 |
> |
sumTrackZ += myJetTrack.vz(); |
300 |
> |
sumTrackIP += myJetTrack.dxy(vertexBeamSpot.position()); |
301 |
> |
jetTrackAddresses.push_back((unsigned int)&myJetTrack); |
302 |
> |
++nJetTracks; |
303 |
> |
} |
304 |
> |
|
305 |
> |
if(nJetTracks > 0){ |
306 |
> |
|
307 |
> |
jetCon->SetVtx(sumTrackX/nJetTracks, sumTrackY/nJetTracks, sumTrackZ/nJetTracks); |
308 |
> |
|
309 |
> |
h1_meanJetTrackZ->Fill(sumTrackZ/nJetTracks); |
310 |
> |
h1_trackDxy->Fill(sumTrackIP/nJetTracks); |
311 |
> |
|
312 |
> |
} |
313 |
> |
/*meanTrackX = sumTrackX/nJetTracks; |
314 |
> |
meanTrackY = sumTrackY/nJetTracks; |
315 |
> |
meanTrackZ = sumTrackZ/nJetTracks; |
316 |
> |
*/ |
317 |
> |
|
318 |
> |
if(jetTrackAddresses.size() > 0){ |
319 |
> |
|
320 |
> |
for(VertexCollection::const_iterator vtx_iter = primaryVtcs->begin(); vtx_iter!= primaryVtcs->end(); ++vtx_iter){ |
321 |
> |
|
322 |
> |
reco::Vertex myVtx = reco::Vertex(*vtx_iter); |
323 |
> |
if(!myVtx.isValid() || myVtx.isFake()) continue; |
324 |
> |
|
325 |
> |
TVector3 *iVtxPosition = new TVector3(myVtx.x(), myVtx.y(), myVtx.z()); |
326 |
> |
vtxPositionCollection.push_back(*iVtxPosition); |
327 |
> |
associatedTrackSumPt.push_back(0); |
328 |
> |
|
329 |
> |
for(Vertex::trackRef_iterator iTrackRef = myVtx.tracks_begin(); iTrackRef != myVtx.tracks_end(); ++iTrackRef){ |
330 |
> |
const edm::RefToBase<reco::Track> &myTrackRef = *iTrackRef; |
331 |
> |
|
332 |
> |
if(myTrackRef.isAvailable()){ |
333 |
> |
const reco::Track &myVertexTrack = *myTrackRef.get(); |
334 |
> |
|
335 |
> |
for(vector<unsigned int>::const_iterator iTrackAddress = jetTrackAddresses.begin(); iTrackAddress != jetTrackAddresses.end(); ++iTrackAddress){ |
336 |
> |
|
337 |
> |
if(*iTrackAddress == (unsigned int)&myVertexTrack){ |
338 |
> |
|
339 |
> |
associatedTrackSumPt.at(vCount) += myVertexTrack.pt()/sumTrackPt; |
340 |
> |
++nAssociatedTracks; |
341 |
> |
|
342 |
> |
} |
343 |
> |
} |
344 |
> |
} |
345 |
> |
} |
346 |
> |
++vCount; |
347 |
> |
} |
348 |
> |
|
349 |
> |
double maxSumPtFraction = 0; |
350 |
> |
vCount = vertexIndex = 0; |
351 |
> |
|
352 |
> |
for(vector<double>::const_iterator iTrackSumPt = associatedTrackSumPt.begin(); iTrackSumPt != associatedTrackSumPt.end(); ++iTrackSumPt) { |
353 |
> |
|
354 |
> |
if(*iTrackSumPt > maxSumPtFraction){ |
355 |
> |
|
356 |
> |
maxSumPtFraction = *iTrackSumPt; |
357 |
> |
vertexIndex = vCount + 1; |
358 |
> |
|
359 |
> |
} |
360 |
> |
++vCount; |
361 |
> |
} |
362 |
> |
|
363 |
> |
if(vertexIndex > 0){ |
364 |
> |
|
365 |
> |
h1_jetVertexZ->Fill(vtxPositionCollection[vertexIndex-1].z()); |
366 |
> |
|
367 |
> |
} |
368 |
> |
|
369 |
> |
jetCon->SetVtxSumPt(maxSumPtFraction); |
370 |
> |
jetCon->SetVtxIndex(vertexIndex); |
371 |
> |
|
372 |
> |
h1_fracAssociatedTracks->Fill((double)nAssociatedTracks/(double)nJetTracks); |
373 |
> |
h1_associatedSumPt->Fill(maxSumPtFraction); |
374 |
> |
h1_associatedVertexIndex->Fill(vertexIndex); |
375 |
> |
h2_nAssTracksVsJetPt->Fill(myJet.pt(), nAssociatedTracks); |
376 |
> |
} |
377 |
> |
} |
378 |
> |
++pfCount; |
379 |
|
} |
380 |
|
} |
381 |
|
} |
382 |
|
|
383 |
|
if(!isRealData){ |
384 |
|
|
385 |
+ |
Handle<GenEventInfoProduct> GenEventInfoHandle; |
386 |
+ |
iEvent.getByLabel("generator", GenEventInfoHandle); |
387 |
+ |
|
388 |
+ |
Handle<GenRunInfoProduct> GenRunInfoHandle; |
389 |
+ |
iEvent.getByLabel("generator", GenRunInfoHandle); |
390 |
|
|
391 |
|
Handle<reco::GenJetCollection> GenJets; |
392 |
|
iEvent.getByLabel(GenJetHandle_, GenJets); |
393 |
< |
|
394 |
< |
|
393 |
> |
|
394 |
> |
ptHat = qScale = -1; crossSection = 0; |
395 |
> |
|
396 |
> |
if(GenEventInfoHandle.isValid()) |
397 |
> |
{ |
398 |
> |
qScale = GenEventInfoHandle->qScale(); |
399 |
> |
ptHat = (GenEventInfoHandle->hasBinningValues() ? GenEventInfoHandle->binningValues()[0] : 0.0); |
400 |
> |
} |
401 |
> |
if(GenRunInfoHandle.isValid()) |
402 |
> |
{ |
403 |
> |
crossSection = GenRunInfoHandle->crossSection(); |
404 |
> |
} |
405 |
> |
|
406 |
|
for(GenJetCollection::const_iterator jet_iter = GenJets->begin(); jet_iter!= GenJets->end(); ++jet_iter){ |
407 |
|
|
408 |
|
reco::GenJet myJet = reco::GenJet(*jet_iter); |
409 |
|
|
410 |
|
if(myJet.pt() > 5){ |
411 |
|
|
412 |
< |
new ((*jetP4_ak5Gen)[Gencount]) TLorentzVector(myJet.px(), myJet.py(), myJet.pz(), myJet.energy()); |
413 |
< |
|
414 |
< |
++Gencount; |
412 |
> |
new ((*jetP4_ak5Gen)[genCount]) TLorentzVector(myJet.px(), myJet.py(), myJet.pz(), myJet.energy()); |
413 |
> |
|
414 |
> |
const reco::GenParticle *myGenParticle = myJet.getGenConstituent(0); |
415 |
> |
const reco::Candidate *myMother = myGenParticle->mother(); |
416 |
> |
int nGrandMas = 1; |
417 |
> |
|
418 |
> |
for(int iter = 0; nGrandMas != 0; ++iter) |
419 |
> |
{ |
420 |
> |
myMother = myMother->mother(); |
421 |
> |
nGrandMas = myMother->mother()->numberOfMothers(); |
422 |
> |
} |
423 |
> |
//cout<<myJet.print()<<endl; |
424 |
> |
cout<<"Jet flavor: "<< myMother->pdgId()<<endl; |
425 |
> |
++genCount; |
426 |
|
|
427 |
|
} |
428 |
|
} |
429 |
|
} |
430 |
|
|
431 |
< |
|
432 |
< |
Handle<reco::VertexCollection> primaryVtcs; |
433 |
< |
iEvent.getByLabel(PrimaryVtxHandle_, primaryVtcs); |
265 |
< |
|
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 |
< |
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 |
< |
vtxCon->SetNTrks(myVtx.tracksSize()); |
276 |
< |
vtxCon->SetSumPt2Trks(sumPtSquared(myVtx)); |
277 |
< |
++Vtxcount; |
278 |
< |
|
279 |
< |
} |
280 |
< |
|
431 |
> |
/////////////////////////// |
432 |
> |
//get trigger information// |
433 |
> |
/////////////////////////// |
434 |
|
|
435 |
|
if(triggerHLT_){ |
436 |
|
|
284 |
– |
//---------- Filling HLT trigger bits! ------------ |
285 |
– |
|
437 |
|
edm::Handle<TriggerResults> hltR; |
438 |
|
triggerResultsTag_ = InputTag(hlTriggerResults_,"",hltName_); |
439 |
|
iEvent.getByLabel(triggerResultsTag_,hltR); |
441 |
|
const TriggerNames & triggerNames = iEvent.triggerNames(*hltR); |
442 |
|
hlNames=triggerNames.triggerNames(); |
443 |
|
|
444 |
< |
string MPI_TriggerNames[] = {"HLT_PixelTracks_Multiplicity70", "HLT_MinBiasBSC_NoBPTX", "HLT_PixelTracks_Multiplicity40","HLT_L1Tech_HCAL_HF", "HLT_IsoTrackHB_8E29", "HLT_IsoTrackHE_8E29", "HLT_L1Tech_RPC_TTU_RBst1_collisions", "HLT_L1_BscMinBiasOR_BptxPlusORMinus", "HLT_L1Tech_BSC_halo_forPhysicsBackground", "HLT_L1Tech_BSC_HighMultiplicity", "HLT_MinBiasPixel_DoubleIsoTrack5", "HLT_MinBiasPixel_DoubleTrack", "HLT_MinBiasPixel_SingleTrack", "HLT_ZeroBiasPixel_SingleTrack", "HLT_MinBiasBSC", "HLT_StoppedHSCP_8E29", "HLT_Jet15U_HcalNoiseFiltered", "HLT_QuadJet15U", "HLT_DiJetAve30U_8E29", "HLT_DiJetAve15U_8E29", "HLT_FwdJet20U", "HLT_Jet50U", "HLT_Jet30U", "HLT_Jet15U", "HLT_BTagMu_Jet10U", "HLT_DoubleJet15U_ForwardBackward", "HLT_BTagIP_Jet50U", "HLT_DoubleLooseIsoTau15", "HLT_SingleLooseIsoTau20", "HLT_HT100U", "HLT_MET100", "HLT_MET45"}; |
444 |
> |
string MPI_TriggerNames[] = {"HLT_PixelTracks_Multiplicity70", |
445 |
> |
"HLT_MinBiasBSC_NoBPTX", |
446 |
> |
"HLT_PixelTracks_Multiplicity40", |
447 |
> |
"HLT_L1Tech_HCAL_HF", |
448 |
> |
"HLT_IsoTrackHB_8E29", |
449 |
> |
"HLT_IsoTrackHE_8E29", |
450 |
> |
"HLT_L1Tech_RPC_TTU_RBst1_collisions", |
451 |
> |
"HLT_L1_BscMinBiasOR_BptxPlusORMinus", |
452 |
> |
"HLT_L1Tech_BSC_halo_forPhysicsBackground", |
453 |
> |
"HLT_L1Tech_BSC_HighMultiplicity", |
454 |
> |
"HLT_MinBiasPixel_DoubleIsoTrack5", |
455 |
> |
"HLT_MinBiasPixel_DoubleTrack", |
456 |
> |
"HLT_MinBiasPixel_SingleTrack", |
457 |
> |
"HLT_ZeroBiasPixel_SingleTrack", |
458 |
> |
"HLT_MinBiasBSC", |
459 |
> |
"HLT_StoppedHSCP_8E29", |
460 |
> |
"HLT_Jet15U_HcalNoiseFiltered", |
461 |
> |
"HLT_QuadJet15U", |
462 |
> |
"HLT_DiJetAve30U_8E29", |
463 |
> |
"HLT_DiJetAve15U_8E29", |
464 |
> |
"HLT_FwdJet20U", |
465 |
> |
"HLT_Jet50U", |
466 |
> |
"HLT_Jet30U", |
467 |
> |
"HLT_Jet15U", |
468 |
> |
"HLT_BTagMu_Jet10U", |
469 |
> |
"HLT_DoubleJet15U_ForwardBackward", |
470 |
> |
"HLT_BTagIP_Jet50U", |
471 |
> |
"HLT_DoubleLooseIsoTau15", |
472 |
> |
"HLT_SingleLooseIsoTau20", |
473 |
> |
"HLT_HT100U", |
474 |
> |
"HLT_MET100", |
475 |
> |
"HLT_MET45"}; |
476 |
|
|
477 |
|
bool triggerPassed = false; |
478 |
|
triggerStatus = 0x0; |
484 |
|
if(triggerPassed){ |
485 |
|
|
486 |
|
for (uint j = 0; j != 32; ++j){ |
487 |
< |
|
487 |
> |
|
488 |
|
if (hlNames[i] == MPI_TriggerNames[j]) |
489 |
< |
{ |
490 |
< |
// cout<<"trigger name: "<<hlNames[i]<<"list: "<<dec<<j+1<<endl; |
491 |
< |
triggerStatus |= 0x01 << j; |
492 |
< |
|
311 |
< |
} |
489 |
> |
{ |
490 |
> |
//cout<<"HLTrigger name: "<<hlNames[i]<<" bit: "<<dec<<j+1<<endl; |
491 |
> |
triggerStatus |= 0x01 << j; |
492 |
> |
} |
493 |
|
} |
494 |
|
} |
495 |
|
} |
496 |
|
} |
497 |
< |
// cout<< "total status: "<<hex<<triggerStatus<<endl; |
498 |
< |
|
499 |
< |
if((PFcount > 3 || Gencount > 3) && Vtxcount > 0) sTree -> Fill(); |
500 |
< |
|
497 |
> |
//cout<< "total status: "<<hex<<triggerStatus<<endl; |
498 |
> |
|
499 |
> |
|
500 |
> |
|
501 |
> |
if((pfCount > 1 || genCount > 1) && vtxCount > 0) sTree -> Fill(); |
502 |
> |
|
503 |
|
jet_ak5PF->Clear(); |
504 |
|
primaryVtx->Clear(); |
505 |
|
jetP4_ak5Gen->Clear(); |
511 |
|
void MPIntuple::beginJob() |
512 |
|
{ |
513 |
|
|
514 |
< |
ntupleFile = new TFile(rootfilename.c_str(), "RECREATE"); |
515 |
< |
sTree = new TTree("mpiTree", "Tree for Jets"); |
516 |
< |
|
517 |
< |
jet_ak5PF = new TClonesArray("TCJet"); |
518 |
< |
jetP4_ak5Gen = new TClonesArray("TLorentzVector"); |
519 |
< |
primaryVtx = new TClonesArray("TCPrimaryVtx"); |
514 |
> |
ntupleFile = new TFile(rootfilename.c_str(), "RECREATE"); |
515 |
> |
sTree = new TTree("mpiTree", "Tree for Jets"); |
516 |
> |
|
517 |
> |
h1_fracAssociatedTracks = new TH1D("h1_fracAssociatedTracks", "Fraction of associated jet tracks", 20, 0.0, 1.0); |
518 |
> |
h1_trackDxy = new TH1D("h1_trackDxy", "dxy for all associated tracks", 50, -0.4, 0.4); |
519 |
> |
h1_meanJetTrackZ = new TH1D("h1_meanJetTrackZ", "<z> from jet tracks", 50, -25.0, 25.0); |
520 |
> |
h1_jetVertexZ = new TH1D("h1_jetVertexZ", "z for vertex associated to jet", 50, -25.0, 25.0); |
521 |
> |
h1_associatedSumPt = new TH1D("h1_associatedSumPt", "ratio of sum p_{T} between associatedTracks and jetTracks", 20, 0.0, 1.0); |
522 |
> |
h1_associatedVertexIndex = new TH1D("h1_associatedVertex", "number of jets associated to primary vertex", 5, -0.5, 4.5); |
523 |
> |
h2_nAssTracksVsJetPt = new TH2F("h2_nAssTracksVsJetPt", "nTracks vs Jet p_{T}", 50, 0, 100, 20, -0.5, 19.5); |
524 |
> |
p1_nVtcs = new TProfile("p1_nVtcs", "<N> per run", 5200.0, 132300.0, 137500.0, 0.0, 6.0); |
525 |
> |
|
526 |
> |
jet_ak5PF = new TClonesArray("TCJet"); |
527 |
> |
jetP4_ak5Gen = new TClonesArray("TLorentzVector"); |
528 |
> |
primaryVtx = new TClonesArray("TCPrimaryVtx"); |
529 |
> |
|
530 |
|
|
531 |
|
sTree->Branch("jet_ak5PF",&jet_ak5PF, 6400, 0); |
532 |
|
sTree->Branch("jetP4_ak5Gen",&jetP4_ak5Gen, 6400, 0); |
538 |
|
sTree->Branch("triggerStatus",&triggerStatus, "triggerStatus/i"); |
539 |
|
sTree->Branch("isRealData",&isRealData, "isRealData/i"); |
540 |
|
sTree->Branch("bunchCross",&bunchCross, "bunchCross/i"); |
541 |
< |
|
541 |
> |
sTree->Branch("ptHat",&ptHat, "ptHat/d"); |
542 |
> |
sTree->Branch("qScale", &qScale, "qScale/d"); |
543 |
> |
sTree->Branch("crossSection", &crossSection, "crossSection/d"); |
544 |
|
} |
545 |
|
|
546 |
|
// ------------ method called once each job just after ending the event loop ------------ |
547 |
|
void MPIntuple::endJob() |
548 |
|
{ |
549 |
+ |
|
550 |
+ |
ntupleFile->cd(); |
551 |
+ |
|
552 |
+ |
h1_fracAssociatedTracks->Write(); |
553 |
+ |
h1_meanJetTrackZ->Write(); |
554 |
+ |
h1_trackDxy->Write(); |
555 |
+ |
h1_jetVertexZ->Write(); |
556 |
+ |
h1_associatedSumPt->Write(); |
557 |
+ |
h1_associatedVertexIndex->Write(); |
558 |
+ |
h2_nAssTracksVsJetPt->Write(); |
559 |
+ |
p1_nVtcs->Write(); |
560 |
+ |
|
561 |
|
ntupleFile->Write(); |
562 |
|
ntupleFile->Close(); |
563 |
|
|
573 |
|
triggerPassed = true; |
574 |
|
} |
575 |
|
return triggerPassed; |
576 |
< |
} |
576 |
> |
} |
577 |
|
|
578 |
+ |
double MPIntuple::sumPtSquared(const Vertex & v) |
579 |
+ |
{ |
580 |
+ |
double sum = 0.; |
581 |
+ |
double pT; |
582 |
+ |
for (Vertex::trackRef_iterator it = v.tracks_begin(); it != v.tracks_end(); it++) { |
583 |
+ |
pT = (**it).pt(); |
584 |
+ |
double epT=(**it).ptError(); pT=pT>epT ? pT-epT : 0; |
585 |
+ |
|
586 |
+ |
sum += pT*pT; |
587 |
+ |
} |
588 |
+ |
return sum; |
589 |
+ |
} |
590 |
|
|
591 |
|
//define this as a plug-in |
592 |
|
DEFINE_FWK_MODULE(MPIntuple); |