1 |
– |
/* |
2 |
– |
Description: <one line class summary> |
3 |
– |
|
4 |
– |
Implementation: |
5 |
– |
n-tuple creator for jet studies |
6 |
– |
*/ |
7 |
– |
// |
1 |
|
// Original Author: "Nathaniel Odell" |
2 |
|
// Secondary Author: Steven Won |
3 |
|
// With contributions from: Andrey Pozdnyakov |
4 |
|
// Created: Thurs April 22 2010 |
5 |
|
// $Id$ |
13 |
– |
// |
14 |
– |
// |
15 |
– |
|
6 |
|
|
7 |
|
// system include files |
8 |
|
#include <memory> |
15 |
|
#include "FWCore/Framework/interface/EventSetup.h" |
16 |
|
#include "FWCore/Framework/interface/Event.h" |
17 |
|
#include "FWCore/Framework/interface/MakerMacros.h" |
28 |
– |
|
18 |
|
#include "FWCore/ParameterSet/interface/ParameterSet.h" |
30 |
– |
|
19 |
|
#include "DataFormats/GeometryVector/interface/GlobalPoint.h" |
20 |
|
#include "Geometry/Records/interface/CaloGeometryRecord.h" |
21 |
|
|
29 |
|
#include "DataFormats/JetReco/interface/Jet.h" |
30 |
|
#include "DataFormats/VertexReco/interface/Vertex.h" |
31 |
|
#include "DataFormats/VertexReco/interface/VertexFwd.h" |
32 |
+ |
#include "DataFormats/BTauReco/interface/JetTag.h" |
33 |
+ |
|
34 |
+ |
#include "DataFormats/Math/interface/deltaPhi.h" |
35 |
|
|
36 |
|
// Need to get correctors |
37 |
|
#include "JetMETCorrections/Objects/interface/JetCorrector.h" |
88 |
|
|
89 |
|
// Counting variables // |
90 |
|
|
91 |
< |
int eventNumber, runNumber, lumiSection; |
91 |
> |
int eventNumber, runNumber, lumiSection, bunchCross; |
92 |
|
|
93 |
< |
TTree *sTree; |
93 |
> |
TTree* sTree; |
94 |
|
TFile* ntupleFile; |
95 |
|
|
96 |
|
TClonesArray* jet_ak5PF; |
97 |
|
TClonesArray* jetP4_ak5Gen; |
98 |
< |
TClonesArray* vtx_offline; |
98 |
> |
TClonesArray* primaryVtx; |
99 |
|
|
100 |
|
bool doGenJets_; |
101 |
|
bool doPFJets_; |
102 |
< |
|
102 |
> |
bool triggerHLT_; |
103 |
> |
bool isRealData; |
104 |
|
string rootfilename; |
105 |
|
|
106 |
|
//Triggers |
108 |
|
TriggerNames triggerNames; |
109 |
|
HLTConfigProvider hltConfig_; |
110 |
|
vector<string> hlNames; |
111 |
+ |
unsigned int triggerStatus; |
112 |
|
|
113 |
|
|
114 |
|
}; |
120 |
|
PrimaryVtxHandle_(iConfig.getUntrackedParameter<edm::InputTag>("PrimaryVtxTag")), |
121 |
|
doGenJets_(iConfig.getUntrackedParameter<bool>("doGenJets")), |
122 |
|
doPFJets_(iConfig.getUntrackedParameter<bool>("doPFJets")), |
123 |
+ |
triggerHLT_(iConfig.getUntrackedParameter<bool>("triggerHLT")), |
124 |
|
rootfilename(iConfig.getUntrackedParameter<string>("rootfilename")), |
125 |
|
hlTriggerResults_(iConfig.getUntrackedParameter<string>("HLTriggerResults","TriggerResults")), |
126 |
|
hltName_(iConfig.getUntrackedParameter<string>("hltName","HLT")) |
144 |
|
void MPIntuple::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) |
145 |
|
{ |
146 |
|
|
147 |
< |
eventNumber = iEvent.id().event(); |
148 |
< |
runNumber = iEvent.id().run(); |
147 |
> |
eventNumber = iEvent.id().event(); |
148 |
> |
runNumber = iEvent.id().run(); |
149 |
|
lumiSection = (unsigned int)iEvent.getLuminosityBlock().luminosityBlock(); |
150 |
< |
|
151 |
< |
int PFcount = 0; |
150 |
> |
bunchCross = (unsigned int)iEvent.bunchCrossing(); |
151 |
> |
isRealData = iEvent.isRealData(); |
152 |
> |
|
153 |
> |
int PFcount = 0; |
154 |
|
int Gencount = 0; |
155 |
|
int Vtxcount = 0; |
156 |
|
|
157 |
|
if(doPFJets_){ |
158 |
|
|
159 |
+ |
edm::Handle<reco::JetTagCollection> bTagHandle1; |
160 |
+ |
iEvent.getByLabel("trackCountingHighEffBJetTags", bTagHandle1); |
161 |
+ |
const reco::JetTagCollection & bTags1 = *(bTagHandle1.product()); |
162 |
+ |
reco::JetTagCollection::const_iterator jet_it_1; |
163 |
+ |
|
164 |
+ |
edm::Handle<reco::JetTagCollection> bTagHandle2; |
165 |
+ |
iEvent.getByLabel("trackCountingHighPurBJetTags", bTagHandle2); |
166 |
+ |
const reco::JetTagCollection & bTags2 = *(bTagHandle2.product()); |
167 |
+ |
reco::JetTagCollection::const_iterator jet_it_2; |
168 |
+ |
|
169 |
|
const JetCorrector* correctorL2 = JetCorrector::getJetCorrector ("ak5PFL2Relative",iSetup); |
170 |
|
const JetCorrector* correctorL3 = JetCorrector::getJetCorrector ("ak5PFL3Absolute",iSetup); |
171 |
|
|
178 |
|
|
179 |
|
reco::PFJet myJet = reco::PFJet(*jet_iter); |
180 |
|
|
181 |
< |
float scale2 = correctorL2->correction(myJet); |
182 |
< |
float scale3 = correctorL3->correction(myJet); |
181 |
> |
// float scale2 = correctorL2->correction(myJet); |
182 |
> |
// float scale3 = correctorL3->correction(myJet); |
183 |
|
|
184 |
|
if(myJet.et() > 5){ |
179 |
– |
|
180 |
– |
TCJet jetCon; |
181 |
– |
|
182 |
– |
jetCon.SetP4(myJet.px(), myJet.py(), myJet.pz(), myJet.energy()); |
183 |
– |
jetCon.SetVtx(myJet.vx(), myJet.vy(), myJet.vz()); |
185 |
|
|
186 |
< |
jetCon.SetChHadFrac(myJet.chargedHadronEnergyFraction()); |
187 |
< |
jetCon.SetNeuHadFrac(myJet.neutralHadronEnergyFraction()); |
188 |
< |
jetCon.SetChEmFrac(myJet.chargedEmEnergyFraction()); |
189 |
< |
jetCon.SetNeuEmFrac(myJet.neutralEmEnergyFraction()); |
186 |
> |
for(jet_it_1 = bTags1.begin(); jet_it_1 != bTags1.end(); jet_it_1++) { |
187 |
> |
if( (fabs(jet_it_1->first->eta() - myJet.eta()) < .005) && (deltaPhi(jet_it_1->first->phi(),myJet.phi()) < .005)) break; |
188 |
> |
} |
189 |
> |
|
190 |
> |
for(jet_it_2 = bTags2.begin(); jet_it_2 != bTags2.end(); jet_it_2++) { |
191 |
> |
if( (fabs(jet_it_2->first->eta() - myJet.eta()) < .005) && (deltaPhi(jet_it_2->first->phi(),myJet.phi()) < .005)) break; |
192 |
> |
} |
193 |
> |
|
194 |
> |
TCJet* jetCon = new ((*jet_ak5PF)[PFcount]) TCJet; |
195 |
> |
|
196 |
> |
jetCon->SetP4(myJet.px(), myJet.py(), myJet.pz(), myJet.energy()); |
197 |
> |
jetCon->SetVtx(myJet.vx(), myJet.vy(), myJet.vz()); |
198 |
|
|
199 |
< |
jetCon.SetNumConstit(myJet.chargedMultiplicity() + myJet.neutralMultiplicity()); |
200 |
< |
jetCon.SetNumChPart(myJet.chargedMultiplicity()); |
199 |
> |
jetCon->SetChHadFrac(myJet.chargedHadronEnergyFraction()); |
200 |
> |
jetCon->SetNeuHadFrac(myJet.neutralHadronEnergyFraction()); |
201 |
> |
jetCon->SetChEmFrac(myJet.chargedEmEnergyFraction()); |
202 |
> |
jetCon->SetNeuEmFrac(myJet.neutralEmEnergyFraction()); |
203 |
|
|
204 |
< |
jetCon.SetNumChPart(myJet.chargedMultiplicity()); |
204 |
> |
jetCon->SetNumConstit(myJet.chargedMultiplicity() + myJet.neutralMultiplicity()); |
205 |
> |
jetCon->SetNumChPart(myJet.chargedMultiplicity()); |
206 |
> |
|
207 |
> |
jetCon->SetNumChPart(myJet.chargedMultiplicity()); |
208 |
> |
|
209 |
> |
if(jet_it_2 != bTags2.end()) jetCon->SetBDiscrTrkCountHiPure(jet_it_2->second); |
210 |
> |
if(jet_it_1 != bTags1.end()) jetCon->SetBDiscrTrkCountHiEff(jet_it_1->second); |
211 |
> |
|
212 |
> |
float scale2 = correctorL2->correction(myJet); |
213 |
> |
myJet.scaleEnergy(scale2); |
214 |
> |
float scale3 = correctorL3->correction(myJet); |
215 |
> |
myJet.scaleEnergy(scale3); |
216 |
> |
|
217 |
> |
//more corrections? |
218 |
> |
|
219 |
> |
jetCon->SetJetCorr(2, scale2); |
220 |
> |
jetCon->SetJetCorr(3, scale3); |
221 |
|
|
195 |
– |
jetCon.SetJetCorr(2, scale2); |
196 |
– |
jetCon.SetJetCorr(3, scale3); |
197 |
– |
|
198 |
– |
new ((*jet_ak5PF)[PFcount]) TCJet(jetCon); |
199 |
– |
|
222 |
|
++PFcount; |
223 |
|
} |
224 |
|
} |
245 |
|
} |
246 |
|
|
247 |
|
|
248 |
< |
Handle<reco::VertexCollection> primaryVtx; |
249 |
< |
iEvent.getByLabel(PrimaryVtxHandle_, primaryVtx); |
248 |
> |
Handle<reco::VertexCollection> primaryVtcs; |
249 |
> |
iEvent.getByLabel(PrimaryVtxHandle_, primaryVtcs); |
250 |
|
|
251 |
< |
for(VertexCollection::const_iterator vtx_iter = primaryVtx->begin(); vtx_iter!= primaryVtx->end(); ++vtx_iter){ |
251 |
> |
for(VertexCollection::const_iterator vtx_iter = primaryVtcs->begin(); vtx_iter!= primaryVtcs->end(); ++vtx_iter){ |
252 |
|
|
253 |
|
reco::Vertex myVtx = reco::Vertex(*vtx_iter); |
254 |
|
|
255 |
< |
TCPrimaryVtx vtxCon; |
234 |
< |
|
235 |
< |
vtxCon.SetPosition(myVtx.x(), myVtx.y(), myVtx.z()); |
236 |
< |
vtxCon.SetNDof(myVtx.ndof()); |
237 |
< |
vtxCon.SetChi2(myVtx.chi2()); |
238 |
< |
|
239 |
< |
new ((*vtx_offline)[Vtxcount]) TCPrimaryVtx(vtxCon); |
255 |
> |
TCPrimaryVtx* vtxCon = new ((*primaryVtx)[Vtxcount]) TCPrimaryVtx; |
256 |
|
|
257 |
+ |
vtxCon->SetPosition(myVtx.x(), myVtx.y(), myVtx.z()); |
258 |
+ |
vtxCon->SetNDof(myVtx.ndof()); |
259 |
+ |
vtxCon->SetChi2(myVtx.chi2()); |
260 |
+ |
|
261 |
|
++Vtxcount; |
262 |
|
|
263 |
|
} |
264 |
|
|
265 |
|
|
266 |
+ |
if(triggerHLT_){ |
267 |
|
|
268 |
< |
//---------- Filling HLT trigger bits! ------------ |
248 |
< |
|
249 |
< |
edm::Handle<TriggerResults> hltR; |
250 |
< |
triggerResultsTag_ = InputTag(hlTriggerResults_,"",hltName_); |
251 |
< |
iEvent.getByLabel(triggerResultsTag_,hltR); |
252 |
< |
|
253 |
< |
const TriggerNames & triggerNames = iEvent.triggerNames(*hltR); |
254 |
< |
hlNames=triggerNames.triggerNames(); |
255 |
< |
|
256 |
< |
string MPI_TriggerNames[32] = {"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"}; |
268 |
> |
//---------- Filling HLT trigger bits! ------------ |
269 |
|
|
270 |
< |
bool triggerPassed = false; |
271 |
< |
unsigned int triggerStatus = 0x0; |
272 |
< |
|
273 |
< |
for (uint iT=0; iT<hlNames.size(); ++iT) { |
274 |
< |
|
275 |
< |
triggerPassed = triggerDecision(hltR, iT); |
270 |
> |
edm::Handle<TriggerResults> hltR; |
271 |
> |
triggerResultsTag_ = InputTag(hlTriggerResults_,"",hltName_); |
272 |
> |
iEvent.getByLabel(triggerResultsTag_,hltR); |
273 |
> |
|
274 |
> |
const TriggerNames & triggerNames = iEvent.triggerNames(*hltR); |
275 |
> |
hlNames=triggerNames.triggerNames(); |
276 |
> |
|
277 |
> |
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"}; |
278 |
> |
|
279 |
> |
bool triggerPassed = false; |
280 |
> |
triggerStatus = 0x0; |
281 |
|
|
282 |
< |
if(triggerPassed){ |
282 |
> |
for (uint i=0; i<hlNames.size(); ++i) { |
283 |
|
|
284 |
< |
for (int j = 0; j != 32; ++j){ |
284 |
> |
triggerPassed = triggerDecision(hltR, i); |
285 |
> |
|
286 |
> |
if(triggerPassed){ |
287 |
|
|
288 |
< |
if (hlNames[iT] == MPI_TriggerNames[j]) |
289 |
< |
{ |
290 |
< |
cout<<"trigger name: "<<hlNames[iT]<<" status: "<<triggerPassed<<endl; |
291 |
< |
triggerStatus |= 0x01 << j; |
292 |
< |
} |
288 |
> |
for (uint j = 0; j != 32; ++j){ |
289 |
> |
|
290 |
> |
if (hlNames[i] == MPI_TriggerNames[j]) |
291 |
> |
{ |
292 |
> |
// cout<<"trigger name: "<<hlNames[i]<<"list: "<<dec<<j+1<<endl; |
293 |
> |
triggerStatus |= 0x01 << j; |
294 |
> |
|
295 |
> |
} |
296 |
> |
} |
297 |
|
} |
298 |
< |
} |
299 |
< |
} |
298 |
> |
} |
299 |
> |
} |
300 |
> |
// cout<< "total status: "<<hex<<triggerStatus<<endl; |
301 |
|
|
278 |
– |
cout<<triggerStatus<<endl; |
279 |
– |
|
302 |
|
if(PFcount > 0 || Gencount > 0 || Vtxcount > 0); sTree -> Fill(); |
303 |
|
|
304 |
|
jet_ak5PF->Clear(); |
305 |
< |
vtx_offline->Clear(); |
305 |
> |
primaryVtx->Clear(); |
306 |
|
jetP4_ak5Gen->Clear(); |
307 |
|
|
308 |
|
} |
313 |
|
{ |
314 |
|
|
315 |
|
ntupleFile = new TFile(rootfilename.c_str(), "RECREATE"); |
316 |
< |
sTree = new TTree("dpsTree", "Tree for Jets"); |
316 |
> |
sTree = new TTree("mpiTree", "Tree for Jets"); |
317 |
|
|
318 |
|
jet_ak5PF = new TClonesArray("TCJet"); |
319 |
|
jetP4_ak5Gen = new TClonesArray("TLorentzVector"); |
320 |
< |
vtx_offline = new TClonesArray("TCPrimaryVtx"); |
320 |
> |
primaryVtx = new TClonesArray("TCPrimaryVtx"); |
321 |
|
|
322 |
|
sTree->Branch("jet_ak5PF",&jet_ak5PF, 6400, 0); |
323 |
|
sTree->Branch("jetP4_ak5Gen",&jetP4_ak5Gen, 6400, 0); |
324 |
< |
sTree->Branch("vtx_offline",&vtx_offline, 6400, 0); |
324 |
> |
sTree->Branch("primaryVtx",&primaryVtx, 6400, 0); |
325 |
|
|
326 |
|
sTree->Branch("eventNumber",&eventNumber, "eventNumber/I"); |
327 |
|
sTree->Branch("runNumber",&runNumber, "runNumber/I"); |
328 |
|
sTree->Branch("lumiSection",&lumiSection, "lumiSection/I"); |
329 |
+ |
sTree->Branch("triggerStatus",&triggerStatus, "triggerStatus/i"); |
330 |
+ |
sTree->Branch("isRealData",&isRealData, "isRealData/i"); |
331 |
+ |
sTree->Branch("bunchCross",&bunchCross, "bunchCross/i"); |
332 |
|
|
333 |
|
} |
334 |
|
|