15 |
|
#include "FWCore/Framework/interface/EventSetup.h" |
16 |
|
#include "FWCore/Framework/interface/Event.h" |
17 |
|
#include "FWCore/Framework/interface/MakerMacros.h" |
18 |
+ |
#include "FWCore/Framework/interface/LuminosityBlock.h" |
19 |
|
#include "FWCore/ParameterSet/interface/ParameterSet.h" |
20 |
< |
#include "DataFormats/GeometryVector/interface/GlobalPoint.h" |
20 |
> |
|
21 |
|
#include "Geometry/Records/interface/CaloGeometryRecord.h" |
22 |
+ |
#include "DataFormats/GeometryVector/interface/GlobalPoint.h" |
23 |
+ |
#include "DataFormats/GeometryVector/interface/GlobalVector.h" |
24 |
+ |
#include "DataFormats/GeometryVector/interface/LocalPoint.h" |
25 |
+ |
#include "DataFormats/GeometryVector/interface/LocalVector.h" |
26 |
+ |
#include "DataFormats/Math/interface/Point3D.h" |
27 |
+ |
#include "DataFormats/Math/interface/Vector3D.h" |
28 |
+ |
#include "DataFormats/Math/interface/LorentzVector.h" |
29 |
|
#include "DataFormats/Math/interface/deltaPhi.h" |
30 |
|
|
31 |
|
// Libraries for objects |
32 |
+ |
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" |
33 |
+ |
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" |
34 |
+ |
#include "DataFormats/HepMCCandidate/interface/GenParticle.h" |
35 |
|
#include "DataFormats/JetReco/interface/CaloJet.h" |
36 |
|
#include "DataFormats/JetReco/interface/CaloJetCollection.h" |
26 |
– |
#include "DataFormats/JetReco/interface/PFJet.h" |
27 |
– |
#include "DataFormats/JetReco/interface/PFJetCollection.h" |
37 |
|
#include "DataFormats/JetReco/interface/GenJet.h" |
38 |
|
#include "DataFormats/JetReco/interface/GenJetCollection.h" |
39 |
< |
#include "DataFormats/JetReco/interface/Jet.h" |
39 |
> |
#include "DataFormats/JetReco/interface/PFJet.h" |
40 |
> |
#include "DataFormats/JetReco/interface/PFJetCollection.h" |
41 |
> |
#include "DataFormats/MuonReco/interface/Muon.h" |
42 |
> |
#include "DataFormats/MuonReco/interface/MuonFwd.h" |
43 |
> |
#include "DataFormats/MuonReco/interface/MuonSelectors.h" |
44 |
> |
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" |
45 |
> |
#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" |
46 |
> |
#include "DataFormats/EgammaCandidates/interface/Photon.h" |
47 |
> |
#include "DataFormats/EgammaCandidates/interface/PhotonFwd.h" |
48 |
> |
#include "DataFormats/TrackReco/interface/Track.h" |
49 |
> |
#include "DataFormats/TrackReco/interface/TrackFwd.h" |
50 |
> |
#include "DataFormats/GsfTrackReco/interface/GsfTrack.h" |
51 |
|
#include "DataFormats/VertexReco/interface/Vertex.h" |
52 |
|
#include "DataFormats/VertexReco/interface/VertexFwd.h" |
53 |
|
#include "DataFormats/BTauReco/interface/JetTag.h" |
34 |
– |
#include "DataFormats/TrackReco/interface/Track.h" |
54 |
|
#include "DataFormats/BeamSpot/interface/BeamSpot.h" |
55 |
+ |
#include "DataFormats/Luminosity/interface/LumiSummary.h" |
56 |
+ |
#include "DataFormats/Common/interface/ValueMap.h" |
57 |
|
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" |
58 |
+ |
#include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h" |
59 |
+ |
#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" |
60 |
|
|
61 |
|
//#include "RecoVertex/PrimaryVertexProducer/interface/VertexHigherPtSquared.h" |
62 |
|
|
63 |
< |
//GenParticles |
41 |
< |
//#include "DataFormats/HepMCCandidate/interface/GenParticle.h" |
42 |
< |
|
43 |
< |
// Need to get correctors |
63 |
> |
// Need to get corrections |
64 |
|
#include "JetMETCorrections/Objects/interface/JetCorrector.h" |
65 |
|
|
66 |
|
// ntuple storage classes |
67 |
|
#include "TCJet.h" |
68 |
|
#include "TCPrimaryVtx.h" |
69 |
+ |
#include "TCGenJet.h" |
70 |
+ |
#include "TCMuon.h" |
71 |
+ |
#include "TCElectron.h" |
72 |
|
|
73 |
|
// Need for HLT trigger info: |
74 |
|
#include "FWCore/Common/interface/TriggerNames.h" |
106 |
|
|
107 |
|
private: |
108 |
|
virtual void beginJob() ; |
109 |
+ |
virtual void beginRun(const edm::Run&, const edm::EventSetup&) ; |
110 |
|
virtual void analyze(const edm::Event&, const edm::EventSetup&); |
111 |
+ |
virtual void endLuminosityBlock(const edm::LuminosityBlock&,const edm::EventSetup&); |
112 |
+ |
virtual void endRun(const edm::Run&, const edm::EventSetup&); |
113 |
|
virtual void endJob() ; |
114 |
|
|
115 |
< |
bool triggerDecision(edm::Handle<edm::TriggerResults> &hltR, int iTrigger); |
116 |
< |
double sumPtSquared(const Vertex & v); |
115 |
> |
bool triggerDecision(edm::Handle<edm::TriggerResults>& hltR, int iTrigger); |
116 |
> |
double sumPtSquared(const Vertex& v); |
117 |
|
|
118 |
|
// ----------member data --------------------------- |
119 |
|
|
94 |
– |
edm::InputTag PFJetHandle_; |
95 |
– |
edm::InputTag GenJetHandle_; |
96 |
– |
edm::InputTag PrimaryVtxHandle_; |
97 |
– |
edm::InputTag triggerResultsTag_; |
98 |
– |
// Counting variables // |
120 |
|
|
121 |
< |
int eventNumber, runNumber, lumiSection, bunchCross; |
122 |
< |
double ptHat, qScale; |
121 |
> |
int eventNumber, runNumber, lumiSection, bunchCross; |
122 |
> |
double ptHat, qScale, crossSection; |
123 |
|
|
124 |
< |
TTree* sTree; |
125 |
< |
TFile* ntupleFile; |
126 |
< |
|
127 |
< |
TClonesArray* jet_ak5PF; |
128 |
< |
TClonesArray* jetP4_ak5Gen; |
129 |
< |
TClonesArray* primaryVtx; |
130 |
< |
|
131 |
< |
bool doGenJets_; |
132 |
< |
bool doPFJets_; |
133 |
< |
bool triggerHLT_; |
134 |
< |
bool isRealData; |
135 |
< |
string rootfilename; |
136 |
< |
|
137 |
< |
//Triggers |
138 |
< |
string hlTriggerResults_, hltName_, triggerName_; |
139 |
< |
TriggerNames triggerNames; |
140 |
< |
HLTConfigProvider hltConfig_; |
141 |
< |
vector<string> hlNames; |
142 |
< |
unsigned int triggerStatus; |
143 |
< |
|
144 |
< |
//Histograms |
145 |
< |
TH1F * h1_nAssociatedTracks; |
146 |
< |
TH1F * h1_trackZ; |
147 |
< |
TH1F * h1_trackDxy; |
148 |
< |
TH1F * h1_allTrackDeltaZ_PV; |
149 |
< |
TH1F * h1_allTrackDeltaZ_LJ; |
150 |
< |
TH1F * h1_ptHat; |
151 |
< |
TH2F * h2_nAssTracksVsJetPt; |
152 |
< |
TProfile * p1_nVtcs; |
153 |
< |
|
154 |
< |
|
124 |
> |
TTree* sTree; |
125 |
> |
TFile* ntupleFile; |
126 |
> |
edm::InputTag recoJetTag_; |
127 |
> |
edm::InputTag genJetTag_; |
128 |
> |
edm::InputTag muonTag_; |
129 |
> |
edm::InputTag electronTag_; |
130 |
> |
edm::InputTag primaryVtxTag_; |
131 |
> |
edm::InputTag triggerResultsTag_; |
132 |
> |
edm::InputTag electronIDMap_; |
133 |
> |
bool doGenJets_; |
134 |
> |
bool doPFJets_; |
135 |
> |
bool triggerHLT_; |
136 |
> |
bool isRealData; |
137 |
> |
string rootfilename; |
138 |
> |
|
139 |
> |
TClonesArray* recoJets; |
140 |
> |
TClonesArray* genJets; |
141 |
> |
TClonesArray* primaryVtx; |
142 |
> |
TClonesArray* recoMuons; |
143 |
> |
TClonesArray* recoElectrons; |
144 |
> |
|
145 |
> |
//Triggers |
146 |
> |
string hlTriggerResults_, hltProcess_, triggerName_; |
147 |
> |
TriggerNames triggerNames; |
148 |
> |
HLTConfigProvider hltConfig_; |
149 |
> |
vector<string> hlNames; |
150 |
> |
unsigned int triggerStatus; |
151 |
> |
|
152 |
> |
//Histograms |
153 |
> |
TH1D * h1_fracAssociatedTracks; |
154 |
> |
TH1D * h1_meanJetTrackZ; |
155 |
> |
TH1D * h1_trackDxy; |
156 |
> |
TH1D * h1_jetVertexZ; |
157 |
> |
TH1D * h1_associatedSumPt; |
158 |
> |
TH1D * h1_associatedVertexIndex; |
159 |
> |
TH2F * h2_nAssTracksVsJetPt; |
160 |
> |
TProfile * p1_nVtcs; |
161 |
|
}; |
162 |
|
|
163 |
|
MPIntuple::MPIntuple(const edm::ParameterSet& iConfig) |
164 |
|
{ |
165 |
< |
PFJetHandle_ = iConfig.getUntrackedParameter<edm::InputTag>("PFJetTag"); |
166 |
< |
GenJetHandle_ = iConfig.getUntrackedParameter<edm::InputTag>("GenJetTag"); |
167 |
< |
PrimaryVtxHandle_ = iConfig.getUntrackedParameter<edm::InputTag>("PrimaryVtxTag"); |
168 |
< |
doGenJets_ = iConfig.getUntrackedParameter<bool>("doGenJets"); |
169 |
< |
doPFJets_ = iConfig.getUntrackedParameter<bool>("doPFJets"); |
170 |
< |
triggerHLT_ = iConfig.getUntrackedParameter<bool>("triggerHLT"); |
171 |
< |
rootfilename = iConfig.getUntrackedParameter<string>("rootfilename"); |
165 |
> |
recoJetTag_ = iConfig.getUntrackedParameter<edm::InputTag>("RecoJetTag"); |
166 |
> |
muonTag_ = iConfig.getUntrackedParameter<edm::InputTag>("MuonTag"); |
167 |
> |
electronTag_ = iConfig.getUntrackedParameter<edm::InputTag>("ElectronTag"); |
168 |
> |
genJetTag_ = iConfig.getUntrackedParameter<edm::InputTag>("GenJetTag"); |
169 |
> |
primaryVtxTag_ = iConfig.getUntrackedParameter<edm::InputTag>("PrimaryVtxTag"); |
170 |
> |
electronIDMap_ = iConfig.getParameter<edm::InputTag>("electronIDMap"); |
171 |
> |
doGenJets_ = iConfig.getUntrackedParameter<bool>("doGenJets"); |
172 |
> |
doPFJets_ = iConfig.getUntrackedParameter<bool>("doPFJets"); |
173 |
> |
triggerHLT_ = iConfig.getUntrackedParameter<bool>("triggerHLT"); |
174 |
|
hlTriggerResults_ = iConfig.getUntrackedParameter<string>("HLTriggerResults","TriggerResults"); |
175 |
< |
hltName_ = iConfig.getUntrackedParameter<string>("hltName","RECO"); |
175 |
> |
hltProcess_ = iConfig.getUntrackedParameter<string>("hltName"); |
176 |
> |
rootfilename = iConfig.getUntrackedParameter<string>("rootfilename"); |
177 |
|
} |
178 |
|
|
179 |
|
MPIntuple::~MPIntuple() |
203 |
|
int pfCount = 0; |
204 |
|
int genCount = 0; |
205 |
|
int vtxCount = 0; |
206 |
< |
float ljVertexZ = -999; |
177 |
< |
float primaryVertexZ = -999; |
206 |
> |
double primaryVertexZ = -999; |
207 |
|
|
208 |
|
////////////////////////// |
209 |
|
//Get vertex information// |
210 |
|
////////////////////////// |
211 |
|
|
212 |
|
Handle<reco::VertexCollection> primaryVtcs; |
213 |
< |
iEvent.getByLabel(PrimaryVtxHandle_, primaryVtcs); |
213 |
> |
iEvent.getByLabel(primaryVtxTag_, primaryVtcs); |
214 |
|
|
215 |
|
for(VertexCollection::const_iterator vtx_iter = primaryVtcs->begin(); vtx_iter!= primaryVtcs->end(); ++vtx_iter){ |
216 |
|
|
218 |
|
if(!myVtx.isValid() || myVtx.isFake()) continue; |
219 |
|
TCPrimaryVtx* vtxCon = new ((*primaryVtx)[vtxCount]) TCPrimaryVtx; |
220 |
|
|
221 |
+ |
//cout<<myVtx.nTracks()<<endl; |
222 |
+ |
|
223 |
|
vtxCon->SetPosition(myVtx.x(), myVtx.y(), myVtx.z()); |
224 |
|
vtxCon->SetNDof(myVtx.ndof()); |
225 |
|
vtxCon->SetChi2(myVtx.chi2()); |
250 |
|
const reco::JetTagCollection & bTags2 = *(bTagHandle2.product()); |
251 |
|
reco::JetTagCollection::const_iterator jet_it_2; |
252 |
|
|
222 |
– |
|
253 |
|
const JetCorrector* correctorL2 = JetCorrector::getJetCorrector ("ak5PFL2Relative",iSetup); |
254 |
|
const JetCorrector* correctorL3 = JetCorrector::getJetCorrector ("ak5PFL3Absolute",iSetup); |
255 |
|
|
256 |
|
Handle<reco::PFJetCollection> PFJets; |
257 |
< |
iEvent.getByLabel(PFJetHandle_, PFJets); |
257 |
> |
iEvent.getByLabel(recoJetTag_, PFJets); |
258 |
|
|
259 |
|
for(PFJetCollection::const_iterator jet_iter = PFJets->begin(); jet_iter!= PFJets->end(); ++jet_iter){ |
260 |
|
|
261 |
|
reco::PFJet myJet = reco::PFJet(*jet_iter); |
262 |
< |
if(myJet.et() > 5){ |
262 |
> |
if(myJet.pt() > 5){ |
263 |
|
|
264 |
|
for(jet_it_1 = bTags1.begin(); jet_it_1 != bTags1.end(); jet_it_1++) { |
265 |
|
if( (fabs(jet_it_1->first->eta() - myJet.eta()) < .005) && (deltaPhi(jet_it_1->first->phi(),myJet.phi()) < .005)) break; |
269 |
|
if( (fabs(jet_it_2->first->eta() - myJet.eta()) < .005) && (deltaPhi(jet_it_2->first->phi(),myJet.phi()) < .005)) break; |
270 |
|
} |
271 |
|
|
272 |
< |
TCJet* jetCon = new ((*jet_ak5PF)[pfCount]) TCJet; |
272 |
> |
TCJet* jetCon = new ((*recoJets)[pfCount]) TCJet; |
273 |
|
|
274 |
|
jetCon->SetP4(myJet.px(), myJet.py(), myJet.pz(), myJet.energy()); |
275 |
|
jetCon->SetVtx(-999.0, -999.0, -999.0); |
246 |
– |
|
276 |
|
jetCon->SetChHadFrac(myJet.chargedHadronEnergyFraction()); |
277 |
|
jetCon->SetNeuHadFrac(myJet.neutralHadronEnergyFraction()); |
278 |
|
jetCon->SetChEmFrac(myJet.chargedEmEnergyFraction()); |
279 |
|
jetCon->SetNeuEmFrac(myJet.neutralEmEnergyFraction()); |
251 |
– |
|
280 |
|
jetCon->SetNumConstit(myJet.chargedMultiplicity() + myJet.neutralMultiplicity()); |
281 |
|
jetCon->SetNumChPart(myJet.chargedMultiplicity()); |
282 |
|
|
255 |
– |
jetCon->SetNumChPart(myJet.chargedMultiplicity()); |
256 |
– |
|
283 |
|
if(jet_it_2 != bTags2.end()) jetCon->SetBDiscrTrkCountHiPure(jet_it_2->second); |
284 |
|
if(jet_it_1 != bTags1.end()) jetCon->SetBDiscrTrkCountHiEff(jet_it_1->second); |
285 |
|
|
286 |
< |
float scale2 = correctorL2->correction(myJet); |
286 |
> |
double scale2 = correctorL2->correction(myJet); |
287 |
|
myJet.scaleEnergy(scale2); |
288 |
< |
float scale3 = correctorL3->correction(myJet); |
288 |
> |
double scale3 = correctorL3->correction(myJet); |
289 |
|
myJet.scaleEnergy(scale3); |
290 |
|
|
291 |
|
//more corrections? |
299 |
|
|
300 |
|
const reco::TrackRefVector &tracks = myJet.getTrackRefs(); |
301 |
|
|
302 |
< |
float sumTrackZ, sumTrackIP; |
303 |
< |
float meanTrackZ, meanTrackIP; |
304 |
< |
int nAssociatedTracks = -1; |
302 |
> |
vector<TVector3> vtxPositionCollection; |
303 |
> |
vector<double> associatedTrackSumPt; |
304 |
> |
vector<unsigned int> jetTrackAddresses; |
305 |
> |
double sumTrackX, sumTrackY, sumTrackZ, sumTrackIP, sumTrackPt; |
306 |
> |
int nJetTracks, nVertexTracks, nAssociatedTracks, vertexIndex; |
307 |
> |
int vCount = 0; |
308 |
|
|
309 |
< |
sumTrackZ = sumTrackIP = 0; |
310 |
< |
meanTrackZ = meanTrackIP = -999; |
309 |
> |
nJetTracks = nVertexTracks = nAssociatedTracks = 0; |
310 |
> |
sumTrackX = sumTrackY = sumTrackZ = sumTrackIP = sumTrackPt = 0; |
311 |
|
|
312 |
< |
if(myJet.pt() > 20 && fabs(myJet.eta()) < 2.4){ |
284 |
< |
|
285 |
< |
nAssociatedTracks = 0; |
312 |
> |
if(myJet.pt() > 10 && fabs(myJet.eta()) < 2.4){ |
313 |
|
|
314 |
|
for(TrackRefVector::const_iterator iTrack = tracks.begin(); iTrack != tracks.end(); ++iTrack){ |
315 |
+ |
const reco::Track &myJetTrack = **iTrack; |
316 |
|
|
317 |
< |
const reco::Track& myTrack = **iTrack; |
317 |
> |
sumTrackPt += myJetTrack.pt(); |
318 |
> |
sumTrackX += myJetTrack.vx(); |
319 |
> |
sumTrackY += myJetTrack.vy(); |
320 |
> |
sumTrackZ += myJetTrack.vz(); |
321 |
> |
sumTrackIP += myJetTrack.dxy(vertexBeamSpot.position()); |
322 |
> |
jetTrackAddresses.push_back((unsigned int)&myJetTrack); |
323 |
> |
++nJetTracks; |
324 |
> |
} |
325 |
> |
|
326 |
> |
if (nJetTracks > 0) { |
327 |
> |
jetCon->SetVtx(sumTrackX/nJetTracks, sumTrackY/nJetTracks, sumTrackZ/nJetTracks); |
328 |
> |
h1_meanJetTrackZ->Fill(sumTrackZ/nJetTracks); |
329 |
> |
h1_trackDxy->Fill(sumTrackIP/nJetTracks); |
330 |
> |
} |
331 |
> |
if(jetTrackAddresses.size() > 0){ |
332 |
|
|
333 |
< |
sumTrackZ += myTrack.vz(); |
334 |
< |
sumTrackIP += myTrack.dxy(vertexBeamSpot.position()); |
335 |
< |
++nAssociatedTracks; |
336 |
< |
|
337 |
< |
} |
338 |
< |
|
339 |
< |
meanTrackZ = sumTrackZ/nAssociatedTracks; |
340 |
< |
h1_nAssociatedTracks->Fill(nAssociatedTracks); |
341 |
< |
h2_nAssTracksVsJetPt->Fill(myJet.pt(), nAssociatedTracks); |
342 |
< |
|
343 |
< |
for(TrackRefVector::const_iterator iTrack = tracks.begin(); iTrack != tracks.end(); ++iTrack){ |
344 |
< |
|
345 |
< |
const reco::Track& myTrack = **iTrack; |
346 |
< |
|
347 |
< |
h1_trackZ->Fill(meanTrackZ - myTrack.vz()); |
348 |
< |
h1_trackDxy->Fill(myTrack.dxy(vertexBeamSpot.position())); |
349 |
< |
|
350 |
< |
} |
351 |
< |
|
352 |
< |
if(pfCount == 0){ |
353 |
< |
|
354 |
< |
ljVertexZ = meanTrackZ; |
355 |
< |
|
356 |
< |
}else{ |
357 |
< |
|
358 |
< |
h1_allTrackDeltaZ_LJ->Fill(ljVertexZ - meanTrackZ); |
359 |
< |
|
360 |
< |
} |
361 |
< |
|
362 |
< |
h1_allTrackDeltaZ_PV->Fill(primaryVertexZ - meanTrackZ); |
363 |
< |
|
364 |
< |
} |
365 |
< |
|
366 |
< |
jetCon->SetVtx(0, 0, meanTrackZ); |
367 |
< |
|
333 |
> |
for (VertexCollection::const_iterator vtx_iter = primaryVtcs->begin(); vtx_iter!= primaryVtcs->end(); ++vtx_iter) { |
334 |
> |
reco::Vertex myVtx = reco::Vertex(*vtx_iter); |
335 |
> |
if(!myVtx.isValid() || myVtx.isFake()) continue; |
336 |
> |
TVector3 *iVtxPosition = new TVector3(myVtx.x(), myVtx.y(), myVtx.z()); |
337 |
> |
vtxPositionCollection.push_back(*iVtxPosition); |
338 |
> |
associatedTrackSumPt.push_back(0); |
339 |
> |
|
340 |
> |
for(Vertex::trackRef_iterator iTrackRef = myVtx.tracks_begin(); iTrackRef != myVtx.tracks_end(); ++iTrackRef){ |
341 |
> |
const edm::RefToBase<reco::Track> &myTrackRef = *iTrackRef; |
342 |
> |
if(myTrackRef.isAvailable()){ |
343 |
> |
const reco::Track &myVertexTrack = *myTrackRef.get(); |
344 |
> |
|
345 |
> |
for(vector<unsigned int>::const_iterator iTrackAddress = jetTrackAddresses.begin(); iTrackAddress != jetTrackAddresses.end(); ++iTrackAddress){ |
346 |
> |
if (*iTrackAddress == (unsigned int)&myVertexTrack) { |
347 |
> |
associatedTrackSumPt.at(vCount) += myVertexTrack.pt()/sumTrackPt; |
348 |
> |
++nAssociatedTracks; |
349 |
> |
} |
350 |
> |
} |
351 |
> |
} |
352 |
> |
} |
353 |
> |
++vCount; |
354 |
> |
} |
355 |
> |
|
356 |
> |
double maxSumPtFraction = 0; |
357 |
> |
vCount = vertexIndex = 0; |
358 |
> |
|
359 |
> |
for (vector<double>::const_iterator iTrackSumPt = associatedTrackSumPt.begin(); iTrackSumPt != associatedTrackSumPt.end(); ++iTrackSumPt) { |
360 |
> |
if (*iTrackSumPt > maxSumPtFraction) { |
361 |
> |
maxSumPtFraction = *iTrackSumPt; |
362 |
> |
vertexIndex = vCount + 1; |
363 |
> |
} |
364 |
> |
++vCount; |
365 |
> |
} |
366 |
> |
if (vertexIndex > 0) { |
367 |
> |
h1_jetVertexZ->Fill(vtxPositionCollection[vertexIndex-1].z()); |
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 |
+ |
|
384 |
+ |
/////////////////// |
385 |
+ |
// Get muon info // |
386 |
+ |
/////////////////// |
387 |
+ |
|
388 |
+ |
|
389 |
+ |
Handle<MuonCollection> muons; |
390 |
+ |
iEvent.getByLabel(muonTag_,muons); |
391 |
+ |
|
392 |
+ |
int muCount = 0; |
393 |
+ |
for (MuonCollection::const_iterator mu = muons->begin(); mu != muons->end(); ++mu) { |
394 |
+ |
if (mu->isGlobalMuon() && mu->pt() > 8){ |
395 |
+ |
TCMuon* lepCon = new ((*recoMuons)[muCount]) TCMuon; |
396 |
+ |
lepCon->Setp4(mu->px(), mu->py(), mu->pz(), mu->p()); |
397 |
+ |
lepCon->SetVtx(mu->globalTrack()->vx(),mu->globalTrack()->vy(),mu->globalTrack()->vz()); |
398 |
+ |
lepCon->SetEta(mu->eta()); |
399 |
+ |
lepCon->SetPhi(mu->phi()); |
400 |
+ |
lepCon->SetCharge(mu->charge()); |
401 |
+ |
lepCon->SetisGLB(mu->isGlobalMuon()); |
402 |
+ |
lepCon->SetisTRK(mu->isTrackerMuon()); |
403 |
+ |
lepCon->Setdxy(mu->globalTrack()->dxy(vertexBeamSpot.position())); |
404 |
+ |
lepCon->SetnPXLHits(mu->globalTrack()->hitPattern().numberOfValidPixelHits()); |
405 |
+ |
lepCon->SetnTRKHits(mu->globalTrack()->hitPattern().numberOfValidTrackerHits()); |
406 |
+ |
lepCon->SetnValidMuHits(mu->globalTrack()->hitPattern().numberOfValidMuonHits()); |
407 |
+ |
lepCon->SetnMatchSeg(mu->numberOfMatches()); |
408 |
+ |
lepCon->SetNormChi2(mu->globalTrack()->normalizedChi2()); |
409 |
+ |
lepCon->SetCaloComp(mu->caloCompatibility()); |
410 |
+ |
lepCon->SetSegComp(muon::segmentCompatibility(*mu)); |
411 |
+ |
lepCon->SetEMIso(mu->isolationR03().emEt); |
412 |
+ |
lepCon->SetHADIso(mu->isolationR03().hadEt); |
413 |
+ |
lepCon->SetTRKIso(mu->isolationR03().sumPt); |
414 |
+ |
muCount++; |
415 |
+ |
} |
416 |
+ |
} |
417 |
+ |
|
418 |
|
|
419 |
< |
if(!isRealData){ |
420 |
< |
|
421 |
< |
Handle<GenEventInfoProduct> GenInfoHandle; |
334 |
< |
iEvent.getByLabel("generator", GenInfoHandle); |
419 |
> |
/////////////////////// |
420 |
> |
// Get electron info // |
421 |
> |
/////////////////////// |
422 |
|
|
336 |
– |
Handle<reco::GenJetCollection> GenJets; |
337 |
– |
iEvent.getByLabel(GenJetHandle_, GenJets); |
423 |
|
|
424 |
< |
ptHat = qScale = -1; |
424 |
> |
Handle<edm::ValueMap<float> > eIDValueMap; |
425 |
> |
iEvent.getByLabel( electronIDMap_ , eIDValueMap ); |
426 |
> |
const edm::ValueMap<float> & eIDmap = * eIDValueMap ; |
427 |
> |
|
428 |
> |
Handle<GsfElectronCollection> electrons; |
429 |
> |
iEvent.getByLabel(electronTag_,electrons); |
430 |
> |
|
431 |
> |
int elCount = 0; |
432 |
> |
for (unsigned int i = 0; i < electrons->size(); i++){ |
433 |
> |
edm::Ref<reco::GsfElectronCollection> electronRef(electrons,i); |
434 |
> |
if ( eIDmap[electronRef] == 7 && electronRef->pt() > 15){ |
435 |
> |
TCElectron* lepCon = new ((*recoElectrons)[elCount]) TCElectron; |
436 |
> |
lepCon->Setp4(electronRef->px(),electronRef->py(),electronRef->pz(),electronRef->p()); |
437 |
> |
lepCon->SetVtx(electronRef->gsfTrack()->vx(),electronRef->gsfTrack()->vy(),electronRef->gsfTrack()->vz()); |
438 |
> |
lepCon->SetCharge(electronRef->charge()); |
439 |
> |
lepCon->SetEta(electronRef->eta()); |
440 |
> |
lepCon->SetPhi(electronRef->phi()); |
441 |
> |
lepCon->Setdxy(electronRef->gsfTrack()->dxy(vertexBeamSpot.position())); |
442 |
> |
lepCon->SetNormChi2(electronRef->gsfTrack()->normalizedChi2()); |
443 |
> |
lepCon->SetEMIso(electronRef->dr03EcalRecHitSumEt()); |
444 |
> |
lepCon->SetHADIso(electronRef->dr03HcalTowerSumEt()); |
445 |
> |
lepCon->SetTRKIso(electronRef->dr03TkSumPt()); |
446 |
> |
elCount++; |
447 |
> |
} |
448 |
> |
} |
449 |
> |
|
450 |
> |
|
451 |
> |
//////////////////////// |
452 |
> |
// Get gen-level info // |
453 |
> |
//////////////////////// |
454 |
|
|
341 |
– |
if(GenInfoHandle.isValid()){ |
455 |
|
|
456 |
< |
qScale = GenInfoHandle->qScale(); |
457 |
< |
ptHat = (GenInfoHandle->hasBinningValues() ? GenInfoHandle->binningValues()[0] : 0.0); |
456 |
> |
if (!isRealData) { |
457 |
> |
|
458 |
> |
Handle<GenEventInfoProduct> GenEventInfoHandle; |
459 |
> |
iEvent.getByLabel("generator", GenEventInfoHandle); |
460 |
> |
Handle<GenRunInfoProduct> GenRunInfoHandle; |
461 |
> |
iEvent.getByLabel("generator", GenRunInfoHandle); |
462 |
> |
Handle<reco::GenJetCollection> GenJets; |
463 |
> |
iEvent.getByLabel(genJetTag_, GenJets); |
464 |
|
|
465 |
< |
h1_ptHat->Fill(ptHat); |
465 |
> |
ptHat = qScale = -1; crossSection = 0; |
466 |
|
|
467 |
+ |
if (GenEventInfoHandle.isValid()) { |
468 |
+ |
qScale = GenEventInfoHandle->qScale(); |
469 |
+ |
ptHat = (GenEventInfoHandle->hasBinningValues() ? GenEventInfoHandle->binningValues()[0] : 0.0); |
470 |
+ |
} |
471 |
+ |
if (GenRunInfoHandle.isValid()) { |
472 |
+ |
crossSection = GenRunInfoHandle->crossSection(); |
473 |
|
} |
474 |
|
|
475 |
< |
for(GenJetCollection::const_iterator jet_iter = GenJets->begin(); jet_iter!= GenJets->end(); ++jet_iter){ |
476 |
< |
|
477 |
< |
reco::GenJet myJet = reco::GenJet(*jet_iter); |
478 |
< |
|
479 |
< |
if(myJet.pt() > 5){ |
480 |
< |
|
481 |
< |
new ((*jetP4_ak5Gen)[genCount]) TLorentzVector(myJet.px(), myJet.py(), myJet.pz(), myJet.energy()); |
482 |
< |
|
483 |
< |
++genCount; |
484 |
< |
|
475 |
> |
for (GenJetCollection::const_iterator jet_iter = GenJets->begin(); jet_iter!= GenJets->end(); ++jet_iter) { |
476 |
> |
reco::GenJet myJet = reco::GenJet(*jet_iter); |
477 |
> |
if (myJet.pt() > 5) { |
478 |
> |
|
479 |
> |
TCGenJet* jetCon = new ((*genJets)[genCount]) TCGenJet; |
480 |
> |
jetCon->SetP4(myJet.px(), myJet.py(), myJet.pz(), myJet.energy()); |
481 |
> |
jetCon->SetHadEnergy(myJet.hadEnergy()); |
482 |
> |
jetCon->SetEmEnergy(myJet.emEnergy()); |
483 |
> |
jetCon->SetInvEnergy(myJet.invisibleEnergy()); |
484 |
> |
jetCon->SetAuxEnergy(myJet.auxiliaryEnergy()); |
485 |
> |
jetCon->SetNumConstit(myJet.getGenConstituents().size()); |
486 |
> |
|
487 |
> |
/*const reco::GenParticle *myGenParticle = myJet.getGenConstituent(0); |
488 |
> |
|
489 |
> |
if(myGenParticle->numberOfMothers() == 1) |
490 |
> |
{ |
491 |
> |
const reco::Candidate *myMother = myGenParticle->mother(); |
492 |
> |
int nGrandMas = myMother->numberOfMothers(); |
493 |
> |
|
494 |
> |
for(int iter = 0; nGrandMas != 0 ; ++iter) |
495 |
> |
{ |
496 |
> |
myMother = myMother->mother(); |
497 |
> |
nGrandMas = myMother->mother()->numberOfMothers(); |
498 |
> |
//cout<<myMother->pdgId()<<endl; |
499 |
> |
} |
500 |
> |
//if(nGrandMas == 0) jetCon->SetJetFlavor((int)myMother->pdgId()); else jetCon->SetJetFlavor(0); |
501 |
> |
}*/ |
502 |
> |
++genCount; |
503 |
|
} |
504 |
|
} |
505 |
|
} |
508 |
|
//get trigger information// |
509 |
|
/////////////////////////// |
510 |
|
|
511 |
< |
if(triggerHLT_){ |
511 |
> |
if (triggerHLT_) { |
512 |
|
|
513 |
|
edm::Handle<TriggerResults> hltR; |
514 |
< |
triggerResultsTag_ = InputTag(hlTriggerResults_,"",hltName_); |
514 |
> |
triggerResultsTag_ = InputTag(hlTriggerResults_,"",hltProcess_); |
515 |
|
iEvent.getByLabel(triggerResultsTag_,hltR); |
516 |
< |
|
516 |
> |
|
517 |
|
const TriggerNames & triggerNames = iEvent.triggerNames(*hltR); |
518 |
< |
hlNames=triggerNames.triggerNames(); |
519 |
< |
|
377 |
< |
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"}; |
378 |
< |
|
518 |
> |
hlNames=triggerNames.triggerNames(); |
519 |
> |
|
520 |
|
bool triggerPassed = false; |
521 |
< |
triggerStatus = 0x0; |
522 |
< |
|
523 |
< |
for (uint i=0; i<hlNames.size(); ++i) { |
524 |
< |
|
525 |
< |
triggerPassed = triggerDecision(hltR, i); |
526 |
< |
|
527 |
< |
if(triggerPassed){ |
528 |
< |
|
529 |
< |
for (uint j = 0; j != 32; ++j){ |
530 |
< |
|
531 |
< |
if (hlNames[i] == MPI_TriggerNames[j]) |
532 |
< |
{ |
533 |
< |
//cout<<"trigger name: "<<hlNames[i]<<"list: "<<dec<<j+1<<endl; |
534 |
< |
triggerStatus |= 0x01 << j; |
535 |
< |
|
536 |
< |
} |
521 |
> |
triggerStatus = 0x0; |
522 |
> |
string MPI_TriggerNames[] = {"HLT_QuadJet15U", |
523 |
> |
"HLT_DiJetAve50U", |
524 |
> |
"HLT_DiJetAve30U", |
525 |
> |
"HLT_DiJetAve15U", |
526 |
> |
"HLT_FwdJet20U", |
527 |
> |
"HLT_Jet100U", |
528 |
> |
"HLT_Jet70U", |
529 |
> |
"HLT_Jet50U", |
530 |
> |
"HLT_Jet30U", |
531 |
> |
"HLT_Jet15U", |
532 |
> |
"HLT_BTagMu_Jet10U", |
533 |
> |
"HLT_DoubleJet15U_ForwardBackward", |
534 |
> |
"HLT_BTagIP_Jet50U", |
535 |
> |
"HLT_DoubleLooseIsoTau15", |
536 |
> |
"HLT_SingleLooseIsoTau20", |
537 |
> |
"HLT_HT100U", |
538 |
> |
"HLT_MET100", |
539 |
> |
"HLT_MET45"}; |
540 |
> |
|
541 |
> |
for (int i=0; i < (int)hlNames.size(); ++i) { |
542 |
> |
triggerPassed = triggerDecision(hltR, i); |
543 |
> |
if(triggerPassed){ |
544 |
> |
for (int j = 0; j < 17; ++j){ |
545 |
> |
if (hlNames[i] == MPI_TriggerNames[j]) { |
546 |
> |
triggerStatus |= 0x01 << j; |
547 |
> |
} |
548 |
|
} |
549 |
|
} |
550 |
|
} |
551 |
|
} |
400 |
– |
//cout<< "total status: "<<hex<<triggerStatus<<endl; |
401 |
– |
|
402 |
– |
|
552 |
|
|
553 |
< |
if((pfCount > 3 || genCount > 3) && vtxCount > 0) sTree -> Fill(); |
553 |
> |
if((pfCount > 1 || genCount > 1) && vtxCount > 0) sTree -> Fill(); |
554 |
|
|
555 |
< |
jet_ak5PF->Clear(); |
555 |
> |
recoJets->Clear(); |
556 |
> |
recoElectrons->Clear(); |
557 |
> |
recoMuons->Clear(); |
558 |
|
primaryVtx->Clear(); |
559 |
< |
jetP4_ak5Gen->Clear(); |
409 |
< |
|
559 |
> |
genJets->Clear(); |
560 |
|
} |
561 |
|
|
412 |
– |
|
562 |
|
// ------------ method called once each job just before starting event loop ------------ |
563 |
|
void MPIntuple::beginJob() |
564 |
< |
{ |
565 |
< |
|
566 |
< |
ntupleFile = new TFile(rootfilename.c_str(), "RECREATE"); |
567 |
< |
sTree = new TTree("mpiTree", "Tree for Jets"); |
568 |
< |
|
569 |
< |
h1_trackZ = new TH1F("h1_trackZ", "#Delta z for associated tracks", 60, -0.3, 0.3); |
570 |
< |
h1_nAssociatedTracks = new TH1F("h1_nAssociatedTracks", "Number of tracks associated to jet", 20, -0.5, 19.5); |
571 |
< |
h1_trackDxy = new TH1F("h1_trackDxy", "dxy for all associated tracks", 50, -0.4, 0.4); |
572 |
< |
h1_allTrackDeltaZ_PV = new TH1F("h1_allTrackDeltaZ_PV", "#Delta z between jet and primary vertex", 60, -0.3, 0.3); |
573 |
< |
h1_allTrackDeltaZ_LJ = new TH1F("h1_allTrackDeltaZ_LJ", "#Delta z between leading jet and other jet vertices", 60, -0.3, 0.3); |
574 |
< |
h1_ptHat = new TH1F("h1_ptHat", "ptHat", 50, 10, 100); |
575 |
< |
h2_nAssTracksVsJetPt = new TH2F("h2_nAssTracksVsJetPt", "nTracks vs Jet p_{T}", 50, 0, 100, 20, -0.5, 19.5); |
576 |
< |
p1_nVtcs = new TProfile("p1_nVtcs", "<N> per run", 5200.0, 132300.0, 137500.0, 0.0, 6.0); |
577 |
< |
|
578 |
< |
jet_ak5PF = new TClonesArray("TCJet"); |
579 |
< |
jetP4_ak5Gen = new TClonesArray("TLorentzVector"); |
580 |
< |
primaryVtx = new TClonesArray("TCPrimaryVtx"); |
581 |
< |
|
582 |
< |
|
583 |
< |
sTree->Branch("jet_ak5PF",&jet_ak5PF, 6400, 0); |
584 |
< |
sTree->Branch("jetP4_ak5Gen",&jetP4_ak5Gen, 6400, 0); |
564 |
> |
{ |
565 |
> |
ntupleFile = new TFile(rootfilename.c_str(), "RECREATE"); |
566 |
> |
sTree = new TTree("mpiTree", "Tree for Jets"); |
567 |
> |
|
568 |
> |
h1_fracAssociatedTracks = new TH1D("h1_fracAssociatedTracks", "Fraction of associated jet tracks", 20, 0.0, 1.0); |
569 |
> |
h1_trackDxy = new TH1D("h1_trackDxy", "dxy for all associated tracks", 50, -0.4, 0.4); |
570 |
> |
h1_meanJetTrackZ = new TH1D("h1_meanJetTrackZ", "<z> from jet tracks", 50, -25.0, 25.0); |
571 |
> |
h1_jetVertexZ = new TH1D("h1_jetVertexZ", "z for vertex associated to jet", 50, -25.0, 25.0); |
572 |
> |
h1_associatedSumPt = new TH1D("h1_associatedSumPt", "ratio of sum p_{T} between associatedTracks and jetTracks", 20, 0.0, 1.0); |
573 |
> |
h1_associatedVertexIndex = new TH1D("h1_associatedVertex", "number of jets associated to primary vertex", 5, -0.5, 4.5); |
574 |
> |
h2_nAssTracksVsJetPt = new TH2F("h2_nAssTracksVsJetPt", "nTracks vs Jet p_{T}", 50, 0, 100, 20, -0.5, 19.5); |
575 |
> |
p1_nVtcs = new TProfile("p1_nVtcs", "<N> per run", 5200.0, 132300.0, 137500.0, 0.0, 6.0); |
576 |
> |
|
577 |
> |
recoJets = new TClonesArray("TCJet"); |
578 |
> |
recoElectrons = new TClonesArray("TCElectron"); |
579 |
> |
recoMuons = new TClonesArray("TCMuon"); |
580 |
> |
genJets = new TClonesArray("TCGenJet"); |
581 |
> |
primaryVtx = new TClonesArray("TCPrimaryVtx"); |
582 |
> |
|
583 |
> |
sTree->Branch("recoJets",&recoJets, 6400, 0); |
584 |
> |
sTree->Branch("recoElectrons",&recoElectrons, 6400, 0); |
585 |
> |
sTree->Branch("recoMuons",&recoMuons, 6400, 0); |
586 |
> |
sTree->Branch("genJets",&genJets, 6400, 0); |
587 |
|
sTree->Branch("primaryVtx",&primaryVtx, 6400, 0); |
437 |
– |
|
588 |
|
sTree->Branch("eventNumber",&eventNumber, "eventNumber/I"); |
589 |
|
sTree->Branch("runNumber",&runNumber, "runNumber/I"); |
590 |
|
sTree->Branch("lumiSection",&lumiSection, "lumiSection/I"); |
592 |
|
sTree->Branch("isRealData",&isRealData, "isRealData/i"); |
593 |
|
sTree->Branch("bunchCross",&bunchCross, "bunchCross/i"); |
594 |
|
sTree->Branch("ptHat",&ptHat, "ptHat/d"); |
595 |
+ |
sTree->Branch("qScale", &qScale, "qScale/d"); |
596 |
+ |
sTree->Branch("crossSection", &crossSection, "crossSection/d"); |
597 |
+ |
} |
598 |
|
|
599 |
+ |
void MPIntuple::beginRun(const edm::Run& iRun, const edm::EventSetup& iEvent) |
600 |
+ |
{ |
601 |
+ |
bool changed = true; |
602 |
+ |
hltConfig_.init(iRun, iEvent, hltProcess_, changed); |
603 |
+ |
|
604 |
|
} |
605 |
|
|
606 |
+ |
void MPIntuple::endLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& iEvent) |
607 |
+ |
{ |
608 |
+ |
edm::Handle<LumiSummary> lumiSummary; |
609 |
+ |
iLumi.getByLabel("lumiProducer", lumiSummary); |
610 |
+ |
|
611 |
+ |
|
612 |
+ |
} |
613 |
+ |
|
614 |
+ |
void MPIntuple::endRun(const edm::Run& iRun, const edm::EventSetup& iEvent) |
615 |
+ |
{ |
616 |
+ |
|
617 |
+ |
} |
618 |
|
// ------------ method called once each job just after ending the event loop ------------ |
619 |
|
void MPIntuple::endJob() |
620 |
|
{ |
621 |
|
|
622 |
|
ntupleFile->cd(); |
623 |
|
|
624 |
< |
h1_trackZ->Write(); |
625 |
< |
h1_nAssociatedTracks->Write(); |
624 |
> |
h1_fracAssociatedTracks->Write(); |
625 |
> |
h1_meanJetTrackZ->Write(); |
626 |
|
h1_trackDxy->Write(); |
627 |
< |
h1_allTrackDeltaZ_PV->Write(); |
628 |
< |
h1_allTrackDeltaZ_LJ->Write(); |
629 |
< |
h1_ptHat->Write(); |
627 |
> |
h1_jetVertexZ->Write(); |
628 |
> |
h1_associatedSumPt->Write(); |
629 |
> |
h1_associatedVertexIndex->Write(); |
630 |
|
h2_nAssTracksVsJetPt->Write(); |
631 |
|
p1_nVtcs->Write(); |
632 |
|
|