1 |
efe |
1.1 |
// -*- C++ -*-
|
2 |
|
|
//
|
3 |
|
|
// Package: AFB
|
4 |
|
|
// Class: AFB
|
5 |
|
|
//
|
6 |
|
|
/**\class AFB AFB.cc ZJet/AFB/src/AFB.cc
|
7 |
|
|
|
8 |
|
|
Description: <one line class summary>
|
9 |
|
|
|
10 |
|
|
Implementation:
|
11 |
|
|
<Notes on implementation>
|
12 |
|
|
*/
|
13 |
|
|
//
|
14 |
|
|
// Original Author: Efe Yazgan
|
15 |
|
|
// Created: Tue Feb 3 10:08:43 CET 2009
|
16 |
|
|
// $Id: MuonTree.cc,v 1.15 2010/10/22 16:47:00 efe Exp $
|
17 |
|
|
//
|
18 |
|
|
//
|
19 |
|
|
#include <memory>
|
20 |
|
|
#include "FWCore/Framework/interface/Frameworkfwd.h"
|
21 |
|
|
#include "FWCore/Framework/interface/EDAnalyzer.h"
|
22 |
|
|
#include "FWCore/Framework/interface/Event.h"
|
23 |
|
|
#include "FWCore/Framework/interface/MakerMacros.h"
|
24 |
|
|
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
25 |
|
|
#include "FWCore/Framework/interface/Event.h"
|
26 |
|
|
#include "FWCore/Framework/interface/Run.h"
|
27 |
|
|
#include "TH1.h"
|
28 |
|
|
#include "TH1F.h"
|
29 |
|
|
#include "TH2F.h"
|
30 |
|
|
#include "TProfile.h"
|
31 |
|
|
#include <TROOT.h>
|
32 |
|
|
#include "TF1.h"
|
33 |
|
|
#include "TMath.h"
|
34 |
|
|
#include <TSystem.h>
|
35 |
|
|
#include "TFile.h"
|
36 |
|
|
#include <TCanvas.h>
|
37 |
|
|
#include <cmath>
|
38 |
|
|
#include <iostream>
|
39 |
|
|
#include <fstream>
|
40 |
|
|
#include <vector>
|
41 |
|
|
#include <functional>
|
42 |
|
|
#include <Math/VectorUtil.h>
|
43 |
|
|
#include "DataFormats/Common/interface/Handle.h"
|
44 |
|
|
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
|
45 |
|
|
#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
|
46 |
|
|
#include "DataFormats/Candidate/interface/CompositePtrCandidate.h"
|
47 |
|
|
#include "DataFormats/Candidate/interface/Candidate.h"
|
48 |
|
|
#include "DataFormats/Candidate/interface/CandAssociation.h"
|
49 |
|
|
#include "FWCore/ServiceRegistry/interface/Service.h"
|
50 |
|
|
#include "CommonTools/UtilAlgos/interface/TFileService.h"
|
51 |
|
|
//muons
|
52 |
|
|
#include "DataFormats/MuonReco/interface/MuonFwd.h"
|
53 |
|
|
#include "DataFormats/MuonReco/interface/Muon.h"
|
54 |
|
|
#include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
|
55 |
|
|
#include "DataFormats/MuonReco/interface/MuonChamberMatch.h"
|
56 |
|
|
#include "DataFormats/MuonReco/interface/MuonIsolation.h"
|
57 |
|
|
#include "DataFormats/MuonReco/interface/MuonEnergy.h"
|
58 |
|
|
#include "DataFormats/MuonReco/interface/MuonTime.h"
|
59 |
|
|
#include "DataFormats/MuonReco/interface/MuonQuality.h"
|
60 |
|
|
#include "DataFormats/MuonReco/interface/MuonSelectors.h"
|
61 |
|
|
#include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
|
62 |
|
|
#include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h"
|
63 |
|
|
#include "DataFormats/TrackReco/interface/Track.h"
|
64 |
|
|
#include "DataFormats/TrackReco/interface/TrackFwd.h"
|
65 |
|
|
#include "DataFormats/Common/interface/ValueMap.h"
|
66 |
|
|
//jets
|
67 |
|
|
#include "DataFormats/JetReco/interface/CaloJetCollection.h"
|
68 |
|
|
#include "DataFormats/JetReco/interface/CaloJet.h"
|
69 |
|
|
#include "DataFormats/JetReco/interface/GenJetCollection.h"
|
70 |
|
|
#include "DataFormats/JetReco/interface/GenJet.h"
|
71 |
|
|
#include "JetMETCorrections/Objects/interface/JetCorrector.h"
|
72 |
|
|
//#include "RecoJets/JetAlgorithms/interface/JetIDHelper.h"
|
73 |
|
|
#include "RecoJets/JetProducers/interface/JetIDHelper.h"
|
74 |
|
|
// MET
|
75 |
|
|
#include "DataFormats/METReco/interface/CaloMET.h"
|
76 |
|
|
#include "DataFormats/METReco/interface/CaloMETFwd.h"
|
77 |
|
|
#include "DataFormats/METReco/interface/MET.h"
|
78 |
|
|
#include "DataFormats/METReco/interface/METFwd.h"
|
79 |
|
|
#include "DataFormats/METReco/interface/PFMET.h"
|
80 |
|
|
#include "DataFormats/METReco/interface/PFMETFwd.h"
|
81 |
|
|
//electron isolation
|
82 |
|
|
#include "FWCore/Utilities/interface/InputTag.h"
|
83 |
|
|
//#include "SHarper/EgIsolExample/interface/EgIsolExample.h"
|
84 |
|
|
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
|
85 |
|
|
#include "DataFormats/Common/interface/Handle.h"
|
86 |
|
|
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
|
87 |
|
|
#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
|
88 |
|
|
#include "DataFormats/Candidate/interface/CompositePtrCandidate.h"
|
89 |
|
|
//trigger
|
90 |
|
|
#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
|
91 |
|
|
#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h"
|
92 |
|
|
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
|
93 |
|
|
#include "DataFormats/L1GlobalTrigger/interface/L1GtPsbWord.h"
|
94 |
|
|
#include "FWCore/Common/interface/TriggerNames.h"
|
95 |
|
|
#include "DataFormats/Common/interface/TriggerResults.h"
|
96 |
|
|
#include "DataFormats/HLTReco/interface/TriggerObject.h"
|
97 |
|
|
#include "DataFormats/HLTReco/interface/TriggerEvent.h"
|
98 |
|
|
#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
|
99 |
|
|
#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
|
100 |
|
|
//jpt
|
101 |
|
|
#include "DataFormats/JetReco/interface/JPTJetCollection.h"
|
102 |
|
|
#include "DataFormats/JetReco/interface/JPTJet.h"
|
103 |
|
|
//pf
|
104 |
|
|
#include "DataFormats/JetReco/interface/PFJetCollection.h"
|
105 |
|
|
#include "DataFormats/JetReco/interface/PFJet.h"
|
106 |
|
|
//vtx
|
107 |
|
|
// not sure if all that includes are needed .....
|
108 |
|
|
#include "DataFormats/TrackReco/interface/Track.h"
|
109 |
|
|
#include "DataFormats/TrackReco/interface/TrackFwd.h"
|
110 |
|
|
#include "DataFormats/VertexReco/interface/Vertex.h"
|
111 |
|
|
#include "DataFormats/VertexReco/interface/VertexFwd.h"
|
112 |
|
|
#include "RecoVertex/VertexPrimitives/interface/TransientVertex.h"
|
113 |
|
|
#include "TrackingTools/TransientTrack/interface/TransientTrack.h"
|
114 |
|
|
#include "DataFormats/Math/interface/deltaR.h"
|
115 |
|
|
#include "TTree.h"
|
116 |
|
|
|
117 |
|
|
class TH1F;
|
118 |
|
|
class TH2F;
|
119 |
|
|
class TStyle;
|
120 |
|
|
class TTree;
|
121 |
|
|
|
122 |
|
|
//
|
123 |
|
|
// class decleration
|
124 |
|
|
//
|
125 |
|
|
|
126 |
|
|
using namespace edm;
|
127 |
|
|
using namespace reco;
|
128 |
|
|
using namespace std;
|
129 |
|
|
using namespace ROOT::Math::VectorUtil;
|
130 |
|
|
using namespace HepMC;
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
class AFB : public edm::EDAnalyzer {
|
134 |
|
|
public:
|
135 |
|
|
explicit AFB(const edm::ParameterSet&);
|
136 |
|
|
~AFB();
|
137 |
|
|
|
138 |
|
|
const edm::ValueMap<double>& getValueMap(const edm::Event& iEvent,edm::InputTag& inputTag);
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
private:
|
142 |
|
|
// virtual void beginJob(const edm::EventSetup&) ;
|
143 |
|
|
virtual void beginJob();
|
144 |
|
|
virtual void analyze(const edm::Event&, const edm::EventSetup&);
|
145 |
|
|
virtual void endJob() ;
|
146 |
|
|
|
147 |
|
|
bool IsMuMatchedToHLTMu ( const reco::Muon & , std::vector<reco::Particle> ,double ,double );
|
148 |
|
|
|
149 |
|
|
// ----------member data ---------------------------
|
150 |
|
|
|
151 |
|
|
float DeltaPhi(float phi1, float phi2);
|
152 |
|
|
float DeltaR(float eta1, float eta2, float phi1, float phi2);
|
153 |
|
|
edm::InputTag muonTag_;
|
154 |
|
|
string CaloJetAlg;
|
155 |
|
|
edm::InputTag JPTAlg, JPTAlgL2L3;
|
156 |
|
|
edm::InputTag trigTag_, triggerSummaryLabel_, hltTag_;
|
157 |
|
|
string muonTrig_;
|
158 |
|
|
string L3FilterName_;
|
159 |
|
|
edm::Service<TFileService> fs;
|
160 |
|
|
TTree * myTree;
|
161 |
|
|
int event, run,lumi,bxnumber,realdata;
|
162 |
|
|
int hlt_trigger_fired;
|
163 |
|
|
int sort_index_for_mu_tree;
|
164 |
|
|
float RecMuonPt[50], RecMuonEta[50], RecMuonPhi[50],RecMuonPx[50], RecMuonPy[50], RecMuonPz[50], RecMuonE[50], RecMuonM[50], RecMuonGlobalType[50], RecMuonTrackerType[50], RecMuonStandAloneType[50], RecMuonIsoSumPt[50],RecMuonIsoRelative[50], RecMuonIsoCalComb[50], RecMuonglmuon_dxy[50], RecMuonglmuon_dz[50], RecMuonglmuon_normalizedChi2[50],RecMuonVx[50],RecMuonVy[50],RecMuonVz[50];
|
165 |
|
|
int RecMuonglmuon_trackerHits[50],RecMuontkmuon_pixelhits[50],RecMuonglmuon_muonHits[50],RecNumberOfUsedStations[50],hltmatchedmuon[50];
|
166 |
|
|
//particle information
|
167 |
|
|
int par_index, mom[50], daug[50];
|
168 |
|
|
float ParticlePt[50], ParticleEta[50], ParticlePhi[50], ParticlePx[50], ParticlePy[50], ParticlePz[50], ParticleE[50], ParticleM[50];
|
169 |
|
|
int ParticleId[50], ParticleStatus[50], ParticleMother[50][10], ParticleDaughter[50][10];
|
170 |
|
|
int id_tmp[20];
|
171 |
|
|
// int id_muon[20];
|
172 |
|
|
int RecMuonglmuon_charge[50];
|
173 |
|
|
//reco jets
|
174 |
|
|
int reco_jet;
|
175 |
|
|
//int jpt_c,cjpt_c
|
176 |
|
|
int pfNjets,pfNtracks;
|
177 |
|
|
float RecJetPt[50], RecJetEta[50], RecJetPhi[50], RecJetPx[50], RecJetPy[50], RecJetPz[50], RecJetE[50];
|
178 |
|
|
float RecCorrJetPt[50];
|
179 |
|
|
float JetEMF[50],JetN90[50],JetFHPD[50],JetFRBX[50];
|
180 |
|
|
float JPTPt[50], JPTEta[50], JPTPhi[50], JPTPx[50], JPTPy[50], JPTPz[50], JPTE[50];
|
181 |
|
|
float cJPTPt[50], cJPTEta[50], cJPTPhi[50], cJPTPx[50], cJPTPy[50], cJPTPz[50], cJPTE[50];
|
182 |
|
|
float PFjetEta[30], PFjetPhi[30],PFjetPt[30],PFCorrjetPt[30],PFjetCEMF[30],PFjetNEMF[30];
|
183 |
|
|
float PFjetTrkVZ[50][30],PFjetTrkPT[50][30];
|
184 |
|
|
float vtxZ[50],vtxZerr[50];
|
185 |
|
|
float vtxY[50],vtxYerr[50];
|
186 |
|
|
float vtxX[50],vtxXerr[50];
|
187 |
|
|
int vtxisValid[50],vtxisFake[50];
|
188 |
|
|
int nVertices,nGoodVertices;
|
189 |
|
|
int techTrigger[44];
|
190 |
|
|
//met
|
191 |
|
|
float caloMET, caloSET, pfMET, pfSET;
|
192 |
|
|
float caloMETX, pfMETX;
|
193 |
|
|
float caloMETY, pfMETY;
|
194 |
|
|
float muCorrMET, muCorrSET;
|
195 |
|
|
|
196 |
|
|
reco::helper::JetIDHelper *jetID;
|
197 |
|
|
|
198 |
|
|
};
|
199 |
|
|
|
200 |
|
|
|
201 |
|
|
|
202 |
|
|
AFB::AFB(const edm::ParameterSet& iConfig)
|
203 |
|
|
{
|
204 |
|
|
muonTag_ = iConfig.getParameter<edm::InputTag>("muonTag");
|
205 |
|
|
CaloJetAlg = iConfig.getParameter<string>("CaloJetAlg");
|
206 |
|
|
// JPTAlg = iConfig.getParameter<edm::InputTag>("JPTjets");
|
207 |
|
|
trigTag_ = iConfig.getParameter<edm::InputTag>("trigTag");
|
208 |
|
|
jetID = new reco::helper::JetIDHelper(iConfig.getParameter<ParameterSet>("JetIDParams"));
|
209 |
|
|
triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
|
210 |
|
|
hltTag_ = iConfig.getParameter<edm::InputTag>("hltTag");
|
211 |
|
|
L3FilterName_ = iConfig.getParameter<std::string>("L3FilterName");
|
212 |
|
|
}
|
213 |
|
|
|
214 |
|
|
AFB::~AFB()
|
215 |
|
|
{
|
216 |
|
|
}
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
// ------------ method called to for each event ------------
|
220 |
|
|
void
|
221 |
|
|
AFB::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
|
222 |
|
|
{
|
223 |
|
|
|
224 |
|
|
bool singleTrigFlag1 = false;
|
225 |
|
|
|
226 |
|
|
Handle<GenParticleCollection> genParticles_h;
|
227 |
|
|
iEvent.getByLabel("genParticles", genParticles_h);
|
228 |
|
|
const GenParticleCollection* genParticles = genParticles_h.failedToGet () ? 0 : &*genParticles_h;
|
229 |
|
|
|
230 |
|
|
Handle<MuonCollection> muons;
|
231 |
|
|
iEvent.getByLabel(muonTag_,muons);
|
232 |
|
|
|
233 |
|
|
Handle<CaloJetCollection> caloJets;
|
234 |
|
|
iEvent.getByLabel(CaloJetAlg,caloJets);
|
235 |
|
|
CaloJetCollection::const_iterator c_jet;
|
236 |
|
|
// const JetCorrector* jCorrector = JetCorrector::getJetCorrector("L2L3JetCorrectorAK5Calo",iSetup);
|
237 |
|
|
const JetCorrector* jCorrector = JetCorrector::getJetCorrector("ak5CaloL2L3",iSetup);
|
238 |
|
|
const JetCorrector* PFjCorrector = JetCorrector::getJetCorrector("ak5PFL2L3",iSetup);
|
239 |
|
|
|
240 |
|
|
/*
|
241 |
|
|
Handle<JPTJetCollection> jptJets;
|
242 |
|
|
iEvent.getByLabel(JPTAlg,jptJets);
|
243 |
|
|
*/
|
244 |
|
|
/*
|
245 |
|
|
Handle<JPTJetCollection> corjptJets;
|
246 |
|
|
iEvent.getByLabel(JPTAlgL2L3,corjptJets);
|
247 |
|
|
*/
|
248 |
|
|
|
249 |
|
|
Handle< edm::View<reco::CaloMET> > caloMEThandle;
|
250 |
|
|
iEvent.getByLabel("met", caloMEThandle);
|
251 |
|
|
|
252 |
|
|
Handle< edm::View<reco::PFMET> > pfMEThandle;
|
253 |
|
|
iEvent.getByLabel("pfMet", pfMEThandle);
|
254 |
|
|
|
255 |
|
|
Handle< edm::View<reco::CaloMET> > muCorrMEThandle;
|
256 |
|
|
iEvent.getByLabel("corMetGlobalMuons", muCorrMEThandle);
|
257 |
|
|
|
258 |
|
|
Handle<PFJetCollection> PFjets;
|
259 |
|
|
iEvent.getByLabel("ak5PFJets","",PFjets);
|
260 |
|
|
PFJetCollection::const_iterator i_jet;
|
261 |
|
|
|
262 |
|
|
|
263 |
|
|
Handle<BeamSpot> beamSpotHandle;
|
264 |
|
|
if (!iEvent.getByLabel(InputTag("offlineBeamSpot"), beamSpotHandle)) {
|
265 |
|
|
cout<< ">>> No beam spot found !!!" <<endl;
|
266 |
|
|
return;
|
267 |
|
|
}
|
268 |
|
|
|
269 |
|
|
Handle<VertexCollection> pvHandle;
|
270 |
|
|
iEvent.getByLabel("offlinePrimaryVertices", pvHandle);
|
271 |
|
|
|
272 |
|
|
nVertices = pvHandle->size();
|
273 |
|
|
|
274 |
|
|
const VertexCollection vertexColl = *(pvHandle.product());
|
275 |
|
|
|
276 |
|
|
nGoodVertices = 0;
|
277 |
|
|
for (VertexCollection::const_iterator vtx = vertexColl.begin(); vtx!= vertexColl.end(); ++vtx){
|
278 |
|
|
if (vtx->isValid() && !vtx->isFake()) ++nGoodVertices;
|
279 |
|
|
}
|
280 |
|
|
|
281 |
|
|
// if (nVertices != nGoodVertices) cout<<"@@@@@@@@@@@@@ ------> "<<nVertices<<" "<<nGoodVertices<<endl;
|
282 |
|
|
|
283 |
|
|
reco::VertexCollection vtxs = *pvHandle;
|
284 |
|
|
for (int iv = 0;iv<nVertices;iv++){
|
285 |
|
|
vtxX[iv] = vtxs[iv].x();
|
286 |
|
|
vtxY[iv] = vtxs[iv].y();
|
287 |
|
|
vtxZ[iv] = vtxs[iv].z();
|
288 |
|
|
vtxXerr[iv] = vtxs[iv].xError();
|
289 |
|
|
vtxYerr[iv] = vtxs[iv].yError();
|
290 |
|
|
vtxZerr[iv] = vtxs[iv].zError();
|
291 |
|
|
vtxisValid[iv] = vtxs[iv].isValid();
|
292 |
|
|
vtxisFake[iv] = vtxs[iv].isFake();
|
293 |
|
|
}
|
294 |
|
|
|
295 |
|
|
Handle< L1GlobalTriggerReadoutRecord > gtRecord;
|
296 |
|
|
iEvent.getByLabel( "gtDigis", gtRecord);
|
297 |
|
|
const TechnicalTriggerWord tWord = gtRecord->technicalTriggerWord();
|
298 |
|
|
|
299 |
|
|
Handle<TriggerResults> triggerResults;
|
300 |
|
|
if (!iEvent.getByLabel(trigTag_, triggerResults)){
|
301 |
|
|
cout<<" Hoooop"<<endl;
|
302 |
|
|
LogError("") << ">>> TRIGGER collection does not exist !!!";
|
303 |
|
|
};
|
304 |
|
|
// const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
|
305 |
|
|
// int hlt_trigger_fired = 0;
|
306 |
|
|
// int itrig1 = triggerNames.triggerIndex(muonTrig_);
|
307 |
|
|
// if (triggerResults->accept(itrig1)) hlt_trigger_fired = 1;
|
308 |
|
|
|
309 |
|
|
//---------------------For trigger matching-----------------------------------
|
310 |
|
|
|
311 |
|
|
Handle<trigger::TriggerEvent> triggerObj;
|
312 |
|
|
iEvent.getByLabel(triggerSummaryLabel_,triggerObj);
|
313 |
|
|
const trigger::TriggerObjectCollection & toc(triggerObj->getObjects());
|
314 |
|
|
size_t nMuHLT =0;
|
315 |
|
|
std::vector<reco::Particle> HLTMuMatched;
|
316 |
|
|
for ( size_t ia = 0; ia < triggerObj->sizeFilters(); ++ ia) {
|
317 |
|
|
std::string fullname = triggerObj->filterTag(ia).encode();
|
318 |
|
|
std::string name;
|
319 |
|
|
size_t p = fullname.find_first_of(':');
|
320 |
|
|
if ( p != std::string::npos) {
|
321 |
|
|
name = fullname.substr(0, p);
|
322 |
|
|
}
|
323 |
|
|
else {
|
324 |
|
|
name = fullname;
|
325 |
|
|
}
|
326 |
|
|
if ( &toc !=0 ) {
|
327 |
|
|
const trigger::Keys & k = triggerObj->filterKeys(ia);
|
328 |
|
|
for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
|
329 |
|
|
if (name == L3FilterName_ ) {
|
330 |
|
|
HLTMuMatched.push_back(toc[*ki].particle());
|
331 |
|
|
nMuHLT++;
|
332 |
|
|
}
|
333 |
|
|
}
|
334 |
|
|
}
|
335 |
|
|
}
|
336 |
|
|
|
337 |
|
|
//----------------------------------------------------------------------------
|
338 |
|
|
for (int ee = 0;ee<44;ee++){
|
339 |
|
|
techTrigger[ee] = tWord.at(ee);
|
340 |
|
|
}
|
341 |
|
|
|
342 |
|
|
event = iEvent.id().event();
|
343 |
|
|
run = iEvent.id().run();
|
344 |
|
|
lumi = iEvent.luminosityBlock();
|
345 |
|
|
bxnumber = iEvent.bunchCrossing();
|
346 |
|
|
realdata = iEvent.isRealData();
|
347 |
|
|
//--------------------met-------------------------------------------------
|
348 |
|
|
caloMET = (caloMEThandle->front()).et();
|
349 |
|
|
caloSET = (caloMEThandle->front()).sumEt();
|
350 |
|
|
pfMET = (pfMEThandle->front()).et();
|
351 |
|
|
pfSET = (pfMEThandle->front()).sumEt();
|
352 |
|
|
|
353 |
|
|
caloMETX = (caloMEThandle->front()).px();
|
354 |
|
|
caloMETY = (caloMEThandle->front()).py();
|
355 |
|
|
|
356 |
|
|
pfMETX = (pfMEThandle->front()).px();
|
357 |
|
|
pfMETY = (pfMEThandle->front()).py();
|
358 |
|
|
|
359 |
|
|
muCorrMET = (muCorrMEThandle->front()).et();
|
360 |
|
|
muCorrSET = (muCorrMEThandle->front()).sumEt();
|
361 |
|
|
//------------------------------------------------------------------------
|
362 |
|
|
|
363 |
|
|
par_index = 0;
|
364 |
|
|
for (int i=0;i<50;i++){
|
365 |
|
|
ParticlePt[i] = -999;
|
366 |
|
|
ParticleEta[i] = -999;
|
367 |
|
|
ParticlePhi[i] = -999;
|
368 |
|
|
ParticlePx[i] = -999;
|
369 |
|
|
ParticlePy[i] = -999;
|
370 |
|
|
ParticlePz[i] = -999;
|
371 |
|
|
ParticleE[i] = -999;
|
372 |
|
|
ParticleM[i] = -999;
|
373 |
|
|
ParticleId[i] = -999;
|
374 |
|
|
ParticleStatus[i] = -999;
|
375 |
|
|
for (int j=0;j<10;j++){
|
376 |
|
|
ParticleMother[i][j] = -999;
|
377 |
|
|
ParticleDaughter[i][j] = -999;
|
378 |
|
|
}
|
379 |
|
|
}
|
380 |
|
|
|
381 |
|
|
//--------------------particles-------------------------------------------
|
382 |
|
|
|
383 |
|
|
if (!realdata && genParticles){
|
384 |
|
|
par_index = 0;
|
385 |
|
|
for (size_t i=0; i<genParticles->size(); ++i){
|
386 |
|
|
//const GenParticle & p = (*genParticles)[i];
|
387 |
|
|
const Candidate & p = (*genParticles)[i];
|
388 |
|
|
int id = p.pdgId();
|
389 |
|
|
int st = p.status();
|
390 |
|
|
if (st!=3) continue;
|
391 |
|
|
ParticlePt[par_index] = p.pt();
|
392 |
|
|
ParticleEta[par_index] = p.eta();
|
393 |
|
|
ParticlePhi[par_index] = p.phi();
|
394 |
|
|
ParticlePx[par_index] = p.px();
|
395 |
|
|
ParticlePy[par_index] = p.py();
|
396 |
|
|
ParticlePz[par_index] = p.pz();
|
397 |
|
|
ParticleE[par_index] =p.energy();
|
398 |
|
|
ParticleM[par_index] =p.mass();
|
399 |
|
|
ParticleId[par_index] = id;
|
400 |
|
|
ParticleStatus[par_index] = st;
|
401 |
|
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
402 |
|
|
|
403 |
|
|
//cout<<i+1<<" "<<st<<" "<<id<<" "<<endl;
|
404 |
|
|
mom[par_index] = p.numberOfMothers();
|
405 |
|
|
for (uint d=0; d<p.numberOfMothers(); d++) {
|
406 |
|
|
// cout << " mother id: " << p.mother(d)->pdgId() << " ";
|
407 |
|
|
// mom = d;
|
408 |
|
|
ParticleMother[par_index][d] = p.mother(d)->pdgId();
|
409 |
|
|
}
|
410 |
|
|
daug[par_index] = p.numberOfDaughters();
|
411 |
|
|
for (uint d=0; d<p.numberOfDaughters(); d++) {
|
412 |
|
|
if (p.daughter(d)->status() == 3){
|
413 |
|
|
// cout << " daughter id: " << p.daughter(d)->pdgId() << " ";
|
414 |
|
|
// daug = d;
|
415 |
|
|
ParticleDaughter[par_index][d] = p.daughter(d)->pdgId();
|
416 |
|
|
}
|
417 |
|
|
}
|
418 |
|
|
// cout<<" "<<endl;
|
419 |
|
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
420 |
|
|
++par_index;
|
421 |
|
|
// cout<< p.pdgId() << " "<< p.mass() << ", "<< p.status() << endl;
|
422 |
|
|
// cout<<i<<" "<<st<<" "<<id<<" "<<p.eta()<<" "<<p.mass()<<endl;
|
423 |
|
|
}
|
424 |
|
|
}
|
425 |
|
|
|
426 |
|
|
//------------------------------------------------------------------------
|
427 |
|
|
|
428 |
|
|
//--------------------------MUONS---------------------------------------------------------------------------------------------------------------------
|
429 |
|
|
|
430 |
|
|
int reco_muon = 0;
|
431 |
|
|
float rec_eta_muon[50] = {};
|
432 |
|
|
float rec_phi_muon[50] = {};
|
433 |
|
|
float rec_pt_muon[50] = {};
|
434 |
|
|
float rec_px_muon[50] = {};
|
435 |
|
|
float rec_py_muon[50] = {};
|
436 |
|
|
float rec_pz_muon[50] = {};
|
437 |
|
|
float rec_vx_muon[50] = {};
|
438 |
|
|
float rec_vy_muon[50] = {};
|
439 |
|
|
float rec_vz_muon[50] = {};
|
440 |
|
|
float rec_e_muon[50] = {};
|
441 |
|
|
float rec_m_muon[50] = {};
|
442 |
|
|
int rec_n_used_sta[50] = {};
|
443 |
|
|
float rec_typeGlobal_muon[50] = {};
|
444 |
|
|
float rec_typeTracker_muon[50] = {};
|
445 |
|
|
float rec_typeStandAlone_muon[50] = {};
|
446 |
|
|
float rec_iso_sumpt[50] = {};
|
447 |
|
|
float rec_iso_relative[50] = {};
|
448 |
|
|
float rec_iso_CalComb[50] = {};
|
449 |
|
|
float glmuon_dxy[50] = {};
|
450 |
|
|
float glmuon_dz[50] = {};
|
451 |
|
|
float glmuon_normalizedChi2[50] = {};
|
452 |
|
|
int glmuon_trackerHits[50] = {};
|
453 |
|
|
int tkmuon_pixelhits[50] = {};
|
454 |
|
|
int glmuon_muonHits[50] = {};
|
455 |
|
|
int glmuon_charge[50] = {};
|
456 |
|
|
int hlt_tmp[50] = {};
|
457 |
|
|
MuonCollection::const_iterator muon;
|
458 |
|
|
std::vector<reco::Muon> highPtGlbMuons;
|
459 |
|
|
for (unsigned int i=0; i<muons->size(); i++ ){
|
460 |
|
|
const reco::Muon & mu = muons->at(i);
|
461 |
|
|
// if (mu.isGlobalMuon()) highPtGlbMuons.push_back(mu);
|
462 |
|
|
if (mu.isGlobalMuon() && mu.isTrackerMuon()){
|
463 |
|
|
highPtGlbMuons.push_back(mu);
|
464 |
|
|
rec_typeGlobal_muon[reco_muon] = mu.isGlobalMuon();
|
465 |
|
|
rec_typeTracker_muon[reco_muon] = mu.isTrackerMuon();
|
466 |
|
|
if (mu.isStandAloneMuon()) rec_typeStandAlone_muon[reco_muon] = mu.isStandAloneMuon();
|
467 |
|
|
reco::TrackRef glmuon = mu.globalTrack();//OK
|
468 |
|
|
reco::TrackRef tkmuon = mu.innerTrack();//OK
|
469 |
|
|
glmuon_dxy[reco_muon] = glmuon->dxy(beamSpotHandle->position());//OK
|
470 |
|
|
glmuon_dz[reco_muon] = glmuon->dz(beamSpotHandle->position());//probably OK but not used anyway.
|
471 |
|
|
glmuon_normalizedChi2[reco_muon] = glmuon->normalizedChi2();//OK
|
472 |
|
|
glmuon_trackerHits[reco_muon] = tkmuon->hitPattern().numberOfValidTrackerHits();//OK
|
473 |
|
|
tkmuon_pixelhits[reco_muon] = tkmuon->hitPattern().numberOfValidPixelHits();//OK
|
474 |
|
|
glmuon_muonHits[reco_muon] = glmuon->hitPattern().numberOfValidMuonHits();//OK
|
475 |
|
|
glmuon_charge[reco_muon] = glmuon->charge();
|
476 |
|
|
rec_eta_muon[reco_muon] = mu.eta();
|
477 |
|
|
rec_phi_muon[reco_muon] = mu.phi();
|
478 |
|
|
rec_pt_muon[reco_muon] = mu.pt();
|
479 |
|
|
rec_px_muon[reco_muon] = mu.px();
|
480 |
|
|
rec_py_muon[reco_muon] = mu.py();
|
481 |
|
|
rec_pz_muon[reco_muon] = mu.pz();
|
482 |
|
|
rec_vx_muon[reco_muon] = mu.vx();
|
483 |
|
|
rec_vy_muon[reco_muon] = mu.vy();
|
484 |
|
|
rec_vz_muon[reco_muon] = mu.vz();
|
485 |
|
|
rec_e_muon[reco_muon] = mu.energy();
|
486 |
|
|
rec_m_muon[reco_muon] = mu.mass();
|
487 |
|
|
rec_n_used_sta[reco_muon] = mu.numberOfMatches();
|
488 |
|
|
// id_tmp[reco_muon] = muon::isGoodMuon(*muon,muon::GlobalMuonPromptTight);//id
|
489 |
|
|
rec_iso_sumpt[reco_muon] = mu.isolationR03().sumPt;
|
490 |
|
|
rec_iso_relative[reco_muon] = rec_iso_sumpt[reco_muon]/mu.pt();//OK
|
491 |
|
|
rec_iso_CalComb[reco_muon] = mu.isolationR03().emEt + mu.isolationR03().hadEt;
|
492 |
|
|
/*
|
493 |
|
|
reco::Muon muon1 = highPtGlbMuons[i];//PROBLEM IS HERE!!!!!!!!!!!!!!!!!!!!!!!
|
494 |
|
|
math::XYZTLorentzVector mu1(muon1.p4());
|
495 |
|
|
singleTrigFlag1 = IsMuMatchedToHLTMu ( muon1, HLTMuMatched , 0.2, 1.0 );
|
496 |
|
|
hlt_tmp[reco_muon] = int(singleTrigFlag1);
|
497 |
|
|
*/
|
498 |
|
|
++reco_muon;
|
499 |
|
|
}
|
500 |
|
|
}
|
501 |
|
|
|
502 |
|
|
//==============================================================
|
503 |
|
|
unsigned int nHighPtGlbMu = highPtGlbMuons.size();
|
504 |
|
|
if (nHighPtGlbMu > 0){
|
505 |
|
|
for(unsigned int i =0 ; i < nHighPtGlbMu ; i++) {
|
506 |
|
|
reco::Muon muon1 = highPtGlbMuons[i];
|
507 |
|
|
singleTrigFlag1 = IsMuMatchedToHLTMu ( muon1, HLTMuMatched , 0.2, 1.0 );
|
508 |
|
|
hlt_tmp[i] = int(singleTrigFlag1);
|
509 |
|
|
}
|
510 |
|
|
}
|
511 |
|
|
//==============================================================
|
512 |
|
|
|
513 |
|
|
// cout<<"Number of Muons: "<<muons->size()<<endl;
|
514 |
|
|
/*
|
515 |
|
|
//----old one---------
|
516 |
|
|
for(muon = muons->begin(); muon != muons->end(); ++muon){
|
517 |
|
|
if (muon->isGlobalMuon()) rec_typeGlobal_muon[reco_muon] = muon->isGlobalMuon();
|
518 |
|
|
if (muon->isTrackerMuon()) rec_typeTracker_muon[reco_muon] = muon->isTrackerMuon();
|
519 |
|
|
if (muon->isStandAloneMuon()) rec_typeStandAlone_muon[reco_muon] = muon->isStandAloneMuon();
|
520 |
|
|
if (muon->isGlobalMuon() && muon->isTrackerMuon()){
|
521 |
|
|
reco::TrackRef glmuon = muon->globalTrack();//OK
|
522 |
|
|
reco::TrackRef tkmuon = muon->innerTrack();//OK
|
523 |
|
|
glmuon_dxy[reco_muon] = glmuon->dxy(beamSpotHandle->position());//OK
|
524 |
|
|
glmuon_dz[reco_muon] = glmuon->dz(beamSpotHandle->position());//probably OK but not used anyway.
|
525 |
|
|
glmuon_normalizedChi2[reco_muon] = glmuon->normalizedChi2();//OK
|
526 |
|
|
glmuon_trackerHits[reco_muon] = tkmuon->hitPattern().numberOfValidTrackerHits();//OK
|
527 |
|
|
tkmuon_pixelhits[reco_muon] = tkmuon->hitPattern().numberOfValidPixelHits();//OK
|
528 |
|
|
glmuon_muonHits[reco_muon] = glmuon->hitPattern().numberOfValidMuonHits();//OK
|
529 |
|
|
glmuon_charge[reco_muon] = glmuon->charge();
|
530 |
|
|
rec_eta_muon[reco_muon] = muon->eta();
|
531 |
|
|
rec_phi_muon[reco_muon] = muon->phi();
|
532 |
|
|
rec_pt_muon[reco_muon] = muon->pt();
|
533 |
|
|
rec_px_muon[reco_muon] = muon->px();
|
534 |
|
|
rec_py_muon[reco_muon] = muon->py();
|
535 |
|
|
rec_pz_muon[reco_muon] = muon->pz();
|
536 |
|
|
rec_e_muon[reco_muon] = muon->energy();
|
537 |
|
|
rec_m_muon[reco_muon] = muon->mass();
|
538 |
|
|
rec_n_used_sta[reco_muon] = muon->numberOfMatches();
|
539 |
|
|
id_tmp[reco_muon] = muon::isGoodMuon(*muon,muon::GlobalMuonPromptTight);//id
|
540 |
|
|
rec_iso_sumpt[reco_muon] = muon->isolationR03().sumPt;
|
541 |
|
|
rec_iso_relative[reco_muon] = rec_iso_sumpt[reco_muon]/muon->pt();//OK
|
542 |
|
|
rec_iso_CalComb[reco_muon] = muon->isolationR03().emEt + muon->isolationR03().hadEt;
|
543 |
|
|
++reco_muon;
|
544 |
|
|
}
|
545 |
|
|
}
|
546 |
|
|
*/
|
547 |
|
|
//-------------
|
548 |
|
|
|
549 |
|
|
for (int mm=0;mm<reco_muon;++mm){
|
550 |
|
|
RecMuonPt[mm] = 0;
|
551 |
|
|
RecMuonEta[mm] = 0;
|
552 |
|
|
RecMuonPhi[mm] = 0;
|
553 |
|
|
RecMuonPx[mm] = 0;
|
554 |
|
|
RecMuonPy[mm] = 0;
|
555 |
|
|
RecMuonPz[mm] = 0;
|
556 |
|
|
RecMuonVx[mm] = 0;
|
557 |
|
|
RecMuonVy[mm] = 0;
|
558 |
|
|
RecMuonVz[mm] = 0;
|
559 |
|
|
RecMuonE[mm] = 0;
|
560 |
|
|
RecMuonM[mm] = 0;
|
561 |
|
|
RecMuonGlobalType[mm] = 0;
|
562 |
|
|
RecMuonStandAloneType[mm] = 0;
|
563 |
|
|
RecMuonTrackerType[mm] = 0;
|
564 |
|
|
RecMuonIsoSumPt[mm] = 0;
|
565 |
|
|
RecNumberOfUsedStations[mm] = 0;
|
566 |
|
|
RecMuonIsoRelative[mm] = 0;
|
567 |
|
|
RecMuonIsoCalComb[mm] = 0;
|
568 |
|
|
RecMuonglmuon_dxy[mm] = 0;
|
569 |
|
|
RecMuonglmuon_dz[mm] = 0;
|
570 |
|
|
RecMuonglmuon_normalizedChi2[mm] = 0;
|
571 |
|
|
RecMuonglmuon_trackerHits[mm] = 0;
|
572 |
|
|
RecMuontkmuon_pixelhits[mm] = 0;
|
573 |
|
|
RecMuonglmuon_muonHits[mm] = 0;
|
574 |
|
|
RecMuonglmuon_charge[mm] = 0;
|
575 |
|
|
// id_muon[mm] = 0;
|
576 |
|
|
}
|
577 |
|
|
|
578 |
|
|
int sorted_muon_index[10]={};
|
579 |
|
|
int sort_reco_muon = 0;
|
580 |
|
|
sort_index_for_mu_tree = 0;
|
581 |
|
|
TMath::Sort(reco_muon,rec_pt_muon,sorted_muon_index);
|
582 |
|
|
for (int i=0;i<reco_muon;++i){
|
583 |
|
|
sort_reco_muon = sorted_muon_index[sort_index_for_mu_tree];
|
584 |
|
|
RecMuonPt[sort_index_for_mu_tree] = rec_pt_muon[sort_reco_muon];
|
585 |
|
|
RecMuonEta[sort_index_for_mu_tree] = rec_eta_muon[sort_reco_muon];
|
586 |
|
|
RecMuonPhi[sort_index_for_mu_tree] = rec_phi_muon[sort_reco_muon];
|
587 |
|
|
RecMuonPx[sort_index_for_mu_tree] = rec_px_muon[sort_reco_muon];
|
588 |
|
|
RecMuonPy[sort_index_for_mu_tree] = rec_py_muon[sort_reco_muon];
|
589 |
|
|
RecMuonPz[sort_index_for_mu_tree] = rec_pz_muon[sort_reco_muon];
|
590 |
|
|
RecMuonVx[sort_index_for_mu_tree] = rec_vx_muon[sort_reco_muon];
|
591 |
|
|
RecMuonVy[sort_index_for_mu_tree] = rec_vy_muon[sort_reco_muon];
|
592 |
|
|
RecMuonVz[sort_index_for_mu_tree] = rec_vz_muon[sort_reco_muon];
|
593 |
|
|
RecMuonE[sort_index_for_mu_tree] = rec_e_muon[sort_reco_muon];
|
594 |
|
|
RecMuonM[sort_index_for_mu_tree] = rec_m_muon[sort_reco_muon];
|
595 |
|
|
RecMuonGlobalType[sort_index_for_mu_tree] = rec_typeGlobal_muon[sort_reco_muon];
|
596 |
|
|
RecMuonTrackerType[sort_index_for_mu_tree] = rec_typeTracker_muon[sort_reco_muon];
|
597 |
|
|
RecMuonStandAloneType[sort_index_for_mu_tree] = rec_typeStandAlone_muon[sort_reco_muon];
|
598 |
|
|
RecMuonIsoSumPt[sort_index_for_mu_tree] = rec_iso_sumpt[sort_reco_muon];
|
599 |
|
|
RecNumberOfUsedStations[sort_index_for_mu_tree] = rec_n_used_sta[sort_reco_muon];
|
600 |
|
|
RecMuonIsoRelative[sort_index_for_mu_tree] = rec_iso_relative[reco_muon];
|
601 |
|
|
RecMuonIsoCalComb[sort_index_for_mu_tree] = rec_iso_CalComb[sort_reco_muon];
|
602 |
|
|
RecMuonglmuon_dxy[sort_index_for_mu_tree] = glmuon_dxy[sort_reco_muon];
|
603 |
|
|
RecMuonglmuon_dz[sort_index_for_mu_tree] = glmuon_dz[sort_reco_muon];
|
604 |
|
|
RecMuonglmuon_normalizedChi2[sort_index_for_mu_tree] = glmuon_normalizedChi2[sort_reco_muon];
|
605 |
|
|
RecMuonglmuon_trackerHits[sort_index_for_mu_tree] = glmuon_trackerHits[sort_reco_muon];
|
606 |
|
|
RecMuontkmuon_pixelhits[sort_index_for_mu_tree] = tkmuon_pixelhits[sort_reco_muon];
|
607 |
|
|
RecMuonglmuon_muonHits[sort_index_for_mu_tree] = glmuon_muonHits[sort_reco_muon];
|
608 |
|
|
RecMuonglmuon_charge[sort_index_for_mu_tree] = glmuon_charge[sort_reco_muon];
|
609 |
|
|
hltmatchedmuon[sort_index_for_mu_tree] = hlt_tmp[sort_reco_muon];
|
610 |
|
|
/*
|
611 |
|
|
cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@"<<endl;
|
612 |
|
|
cout<<"Written pt: "<<RecMuonPt[sort_index_for_mu_tree]<<endl;
|
613 |
|
|
cout<<"matched ?: "<<hltmatchedmuon[sort_index_for_mu_tree]<<endl;
|
614 |
|
|
cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@"<<endl;
|
615 |
|
|
*/
|
616 |
|
|
// id_muon[sort_index_for_mu_tree] = id_tmp[sort_reco_muon];
|
617 |
|
|
++sort_index_for_mu_tree;
|
618 |
|
|
}
|
619 |
|
|
|
620 |
|
|
//-----------------------END MUONS--------------------------------------------------------------------------------------------------------------------
|
621 |
|
|
|
622 |
|
|
|
623 |
|
|
//-----------------------RECO JETS--------------------------------------------------------------------------------------------------------------------
|
624 |
|
|
reco_jet = 0;
|
625 |
|
|
for( CaloJetCollection::const_iterator jet = caloJets->begin(); jet != caloJets->end(); ++ jet ) {
|
626 |
|
|
const math::XYZTLorentzVector theJet = jet->p4();
|
627 |
|
|
RecJetPt[reco_jet] = jet->pt();
|
628 |
|
|
RecCorrJetPt[reco_jet] = jCorrector->correction(theJet)*jet->pt();
|
629 |
|
|
RecJetEta[reco_jet] = jet->eta();
|
630 |
|
|
RecJetPhi[reco_jet] = jet->phi();
|
631 |
|
|
RecJetPx[reco_jet] = jet->px();
|
632 |
|
|
RecJetPy[reco_jet] = jet->py();
|
633 |
|
|
RecJetPz[reco_jet] = jet->pz();
|
634 |
|
|
RecJetE[reco_jet] = jet->energy();
|
635 |
|
|
JetEMF[reco_jet] = jet->emEnergyFraction();
|
636 |
|
|
|
637 |
|
|
jetID->calculate(iEvent,*jet);
|
638 |
|
|
JetN90[reco_jet] = jetID->n90Hits();
|
639 |
|
|
JetFHPD[reco_jet] = jetID->fHPD();
|
640 |
|
|
JetFRBX[reco_jet] = jetID->fRBX();
|
641 |
|
|
|
642 |
|
|
++reco_jet;
|
643 |
|
|
}
|
644 |
|
|
|
645 |
|
|
//-----------------------END RECOJETS-----------------------------------------------------------------------------------------------------------------
|
646 |
|
|
|
647 |
|
|
//----------------------JPT JETS-----------------------------------------------------------------------------------------------------------------
|
648 |
|
|
/*
|
649 |
|
|
jpt_c = 0;
|
650 |
|
|
for (int i=0;i<50;i++){
|
651 |
|
|
JPTPt[i] = -9999;
|
652 |
|
|
JPTEta[i] = -9999;
|
653 |
|
|
JPTPhi[i] = -9999;
|
654 |
|
|
JPTPx[i] = -9999;
|
655 |
|
|
JPTPy[i] = -9999;
|
656 |
|
|
JPTPz[i] = -9999;
|
657 |
|
|
JPTE[i] = -9999;
|
658 |
|
|
cJPTPt[i] = -9999;
|
659 |
|
|
cJPTEta[i] = -9999;
|
660 |
|
|
cJPTPhi[i] = -9999;
|
661 |
|
|
cJPTPx[i] = -9999;
|
662 |
|
|
cJPTPy[i] = -9999;
|
663 |
|
|
cJPTPz[i] = -9999;
|
664 |
|
|
cJPTE[i] = -9999;
|
665 |
|
|
}
|
666 |
|
|
for( JPTJetCollection::const_iterator jjet = jptJets->begin(); jjet != jptJets->end(); ++ jjet ) {
|
667 |
|
|
JPTPt[jpt_c] = jjet->pt();
|
668 |
|
|
JPTEta[jpt_c] = jjet->eta();
|
669 |
|
|
JPTPhi[jpt_c] = jjet->phi();
|
670 |
|
|
JPTPx[jpt_c] = jjet->px();
|
671 |
|
|
JPTPy[jpt_c] = jjet->py();
|
672 |
|
|
JPTPz[jpt_c] = jjet->pz();
|
673 |
|
|
JPTE[jpt_c] = jjet->energy();
|
674 |
|
|
++jpt_c;
|
675 |
|
|
}
|
676 |
|
|
*/
|
677 |
|
|
/*
|
678 |
|
|
cjpt_c = 0;
|
679 |
|
|
for( CaloJetCollection::const_iterator cjjet = corjptJets->begin(); cjjet != corjptJets->end(); ++ cjjet ) {//L2L3 corr JPT
|
680 |
|
|
cJPTPt[cjpt_c] = cjjet->pt();
|
681 |
|
|
cJPTEta[cjpt_c] = cjjet->eta();
|
682 |
|
|
cJPTPhi[cjpt_c] = cjjet->phi();
|
683 |
|
|
cJPTPx[cjpt_c] = cjjet->px();
|
684 |
|
|
cJPTPy[cjpt_c] = cjjet->py();
|
685 |
|
|
cJPTPz[cjpt_c] = cjjet->pz();
|
686 |
|
|
cJPTE[cjpt_c] = cjjet->energy();
|
687 |
|
|
++cjpt_c;
|
688 |
|
|
}
|
689 |
|
|
*/
|
690 |
|
|
|
691 |
|
|
|
692 |
|
|
//----------------------END JPT JETS-----------------------------------------------------------------------------------------------------------------
|
693 |
|
|
|
694 |
|
|
|
695 |
|
|
|
696 |
|
|
int NJets = 20;
|
697 |
|
|
//----------------------------PF jets-------------------------------------------------------------------------------------
|
698 |
|
|
for (int kkk = 0;kkk<50;kkk++){
|
699 |
|
|
for (int jjj = 0;jjj<30;jjj++){
|
700 |
|
|
PFjetTrkVZ[kkk][jjj] = -99;
|
701 |
|
|
PFjetTrkPT[kkk][jjj] = -99;
|
702 |
|
|
}
|
703 |
|
|
}
|
704 |
|
|
pfNjets=0;
|
705 |
|
|
for(i_jet = PFjets->begin(); i_jet != PFjets->end() && pfNjets < NJets; i_jet++){
|
706 |
|
|
const math::XYZTLorentzVector theJet = i_jet->p4();
|
707 |
|
|
PFjetEta[pfNjets]=i_jet->eta();
|
708 |
|
|
PFjetPhi[pfNjets]=i_jet->phi();
|
709 |
|
|
PFjetPt[pfNjets]=i_jet->pt();
|
710 |
|
|
PFCorrjetPt[pfNjets] = PFjCorrector->correction(theJet)*i_jet->pt();
|
711 |
|
|
PFjetCEMF[pfNjets]=i_jet->chargedEmEnergyFraction();
|
712 |
|
|
PFjetNEMF[pfNjets]=i_jet->neutralEmEnergyFraction();
|
713 |
|
|
// cout<<PFjetEta[pfNjets]<<" "<<PFjetPt[pfNjets]<<" "<<PFCorrjetPt[pfNjets]<<endl;
|
714 |
|
|
// ---- This accesses to the vertex Z of the track-base constituents of pfjets
|
715 |
|
|
pfNtracks=0;
|
716 |
|
|
const reco::TrackRefVector &tracks = i_jet->getTrackRefs();
|
717 |
|
|
for (reco::TrackRefVector::const_iterator iTrack = tracks.begin();iTrack != tracks.end(); ++iTrack) {
|
718 |
|
|
PFjetTrkVZ[pfNjets][pfNtracks] = (**iTrack).vz();
|
719 |
|
|
PFjetTrkPT[pfNjets][pfNtracks] = (**iTrack).pt();
|
720 |
|
|
pfNtracks++;
|
721 |
|
|
}
|
722 |
|
|
pfNjets++;
|
723 |
|
|
}
|
724 |
|
|
//-----------------------------end of pf jets--------------------------------------------------------------------------
|
725 |
|
|
|
726 |
|
|
|
727 |
|
|
|
728 |
|
|
myTree->Fill();//!!!!!!
|
729 |
|
|
|
730 |
|
|
}
|
731 |
|
|
|
732 |
|
|
|
733 |
|
|
// ------------ method called once each job just before starting event loop ------------
|
734 |
|
|
//void AFB::beginJob(const edm::EventSetup&)
|
735 |
|
|
void AFB::beginJob()
|
736 |
|
|
{
|
737 |
|
|
TFileDirectory TestDir = fs->mkdir("test");
|
738 |
|
|
myTree = new TTree("MuonTree","MuonTree");
|
739 |
|
|
myTree->Branch("event", &event, "event/I");
|
740 |
|
|
myTree->Branch("run", &run, "run/I");
|
741 |
|
|
myTree->Branch("lumi", &lumi, "lumi/I");
|
742 |
|
|
myTree->Branch("bxnumber", &bxnumber, "bxnumber/I");
|
743 |
|
|
myTree->Branch("realdata", &realdata, "realdata/I");
|
744 |
|
|
|
745 |
|
|
//muon
|
746 |
|
|
myTree->Branch("hlt_trigger_fired",&hlt_trigger_fired,"hlt_trigger_fired/I");
|
747 |
|
|
myTree->Branch("sort_index_for_mu_tree",&sort_index_for_mu_tree,"sort_index_for_mu_tree/I");
|
748 |
|
|
myTree->Branch("RecMuonPt",RecMuonPt,"RecMuonPt[sort_index_for_mu_tree]/F");
|
749 |
|
|
myTree->Branch("RecMuonEta",RecMuonEta,"RecMuonEta[sort_index_for_mu_tree]/F");
|
750 |
|
|
myTree->Branch("RecMuonPhi",RecMuonPhi,"RecMuonPhi[sort_index_for_mu_tree]/F");
|
751 |
|
|
myTree->Branch("RecMuonPx",RecMuonPx,"RecMuonPx[sort_index_for_mu_tree]/F");
|
752 |
|
|
myTree->Branch("RecMuonPy",RecMuonPy,"RecMuonPy[sort_index_for_mu_tree]/F");
|
753 |
|
|
myTree->Branch("RecMuonPz",RecMuonPz,"RecMuonPz[sort_index_for_mu_tree]/F");
|
754 |
|
|
myTree->Branch("RecMuonVx",RecMuonVx,"RecMuonVx[sort_index_for_mu_tree]/F");
|
755 |
|
|
myTree->Branch("RecMuonVy",RecMuonVy,"RecMuonVy[sort_index_for_mu_tree]/F");
|
756 |
|
|
myTree->Branch("RecMuonVz",RecMuonVz,"RecMuonVz[sort_index_for_mu_tree]/F");
|
757 |
|
|
myTree->Branch("RecMuonE",RecMuonE,"RecMuonE[sort_index_for_mu_tree]/F");
|
758 |
|
|
myTree->Branch("RecMuonM",RecMuonM,"RecMuonM[sort_index_for_mu_tree]/F");
|
759 |
|
|
myTree->Branch("RecMuonGlobalType",RecMuonGlobalType,"RecMuonGlobalType[sort_index_for_mu_tree]/F");
|
760 |
|
|
myTree->Branch("RecMuonTrackerType",RecMuonTrackerType,"RecMuonTrackerType[sort_index_for_mu_tree]/F");
|
761 |
|
|
myTree->Branch("RecMuonStandAloneType",RecMuonStandAloneType,"RecMuonStandAloneType[sort_index_for_mu_tree]/F");
|
762 |
|
|
myTree->Branch("RecMuonIsoSumPt",RecMuonIsoSumPt,"RecMuonIsoSumPt[sort_index_for_mu_tree]/F");
|
763 |
|
|
myTree->Branch("RecNumberOfUsedStations",RecNumberOfUsedStations,"RecNumberOfUsedStations[sort_index_for_mu_tree]/I");
|
764 |
|
|
myTree->Branch("RecMuonIsoRelative",RecMuonIsoRelative,"RecMuonIsoRelative[sort_index_for_mu_tree]/F");
|
765 |
|
|
myTree->Branch("RecMuonIsoCalComb",RecMuonIsoCalComb,"RecMuonIsoCalComb[sort_index_for_mu_tree]/F");
|
766 |
|
|
myTree->Branch("RecMuonglmuon_dxy",RecMuonglmuon_dxy,"RecMuonglmuon_dxy[sort_index_for_mu_tree]/F");
|
767 |
|
|
myTree->Branch("RecMuonglmuon_dz",RecMuonglmuon_dz,"RecMuonglmuon_dz[sort_index_for_mu_tree]/F");
|
768 |
|
|
myTree->Branch("RecMuonglmuon_normalizedChi2",RecMuonglmuon_normalizedChi2,"RecMuonglmuon_normalizedChi2[sort_index_for_mu_tree]/F");
|
769 |
|
|
myTree->Branch("RecMuonglmuon_trackerHits",RecMuonglmuon_trackerHits,"RecMuonglmuon_trackerHits[sort_index_for_mu_tree]/I");
|
770 |
|
|
myTree->Branch("RecMuontkmuon_pixelhits",RecMuontkmuon_pixelhits,"RecMuontkmuon_pixelhits[sort_index_for_mu_tree]/I");
|
771 |
|
|
myTree->Branch("RecMuonglmuon_muonHits",RecMuonglmuon_muonHits,"RecMuonglmuon_muonHits[sort_index_for_mu_tree]/I");
|
772 |
|
|
|
773 |
|
|
myTree->Branch("RecMuonglmuon_charge",RecMuonglmuon_charge,"RecMuonglmuon_charge[sort_index_for_mu_tree]/I");
|
774 |
|
|
myTree->Branch("hltmatchedmuon",hltmatchedmuon,"hltmatchedmuon[sort_index_for_mu_tree]/I");
|
775 |
|
|
|
776 |
|
|
// myTree->Branch("id_muon",id_muon,"id_muon[sort_index_for_mu_tree]/I");
|
777 |
|
|
myTree->Branch("techTrigger",techTrigger, "techTrigger[44]/I");
|
778 |
|
|
|
779 |
|
|
//particles
|
780 |
|
|
|
781 |
|
|
myTree->Branch("par_index", &par_index, "par_index/I");
|
782 |
|
|
myTree->Branch("ParticlePt", ParticlePt, "ParticlePt[par_index]/F");
|
783 |
|
|
myTree->Branch("ParticleEta", ParticleEta, "ParticleEta[par_index]/F");
|
784 |
|
|
myTree->Branch("ParticlePhi", ParticlePhi, "ParticlePhi[par_index]/F");
|
785 |
|
|
myTree->Branch("ParticlePx", ParticlePx, "ParticlePx[par_index]/F");
|
786 |
|
|
myTree->Branch("ParticlePy", ParticlePy, "ParticlePy[par_index]/F");
|
787 |
|
|
myTree->Branch("ParticlePz", ParticlePz, "ParticlePz[par_index]/F");
|
788 |
|
|
myTree->Branch("ParticleE", ParticleE, "ParticleE[par_index]/F");
|
789 |
|
|
myTree->Branch("ParticleM", ParticleM, "ParticleM[par_index]/F");
|
790 |
|
|
myTree->Branch("ParticleId", ParticleId, "ParticleId[par_index]/I");
|
791 |
|
|
myTree->Branch("mom", mom, "mom[par_index]/I");
|
792 |
|
|
myTree->Branch("daug", daug, "daug[par_index]/I");
|
793 |
|
|
myTree->Branch("ParticleStatus", ParticleStatus, "ParticleStatus[par_index]/I");
|
794 |
|
|
myTree->Branch("ParticleMother", ParticleMother, "ParticleMother[par_index][5]/I");
|
795 |
|
|
myTree->Branch("ParticleDaughter", ParticleDaughter, "ParticleDaughter[par_index][5]/I");
|
796 |
|
|
|
797 |
|
|
//recojets
|
798 |
|
|
myTree->Branch("reco_jet",&reco_jet,"reco_jet/I");
|
799 |
|
|
|
800 |
|
|
myTree->Branch("RecCorrJetPt",RecCorrJetPt,"RecCorrJetPt[reco_jet]/F");
|
801 |
|
|
myTree->Branch("JetEMF",JetEMF,"JetEMF[reco_jet]/F");
|
802 |
|
|
myTree->Branch("JetN90",JetN90,"JetN90[reco_jet]/F");
|
803 |
|
|
myTree->Branch("JetFHPD",JetFHPD,"JetFHPD[reco_jet]/F");
|
804 |
|
|
myTree->Branch("JetFRBX",JetFRBX,"JetFRBX[reco_jet]/F");
|
805 |
|
|
|
806 |
|
|
myTree->Branch("RecJetPt",RecJetPt,"RecJetPt[reco_jet]/F");
|
807 |
|
|
myTree->Branch("RecJetEta",RecJetEta,"RecJetEta[reco_jet]/F");
|
808 |
|
|
myTree->Branch("RecJetPhi",RecJetPhi,"RecJetPhi[reco_jet]/F");
|
809 |
|
|
myTree->Branch("RecJetPx",RecJetPx,"RecJetPx[reco_jet]/F");
|
810 |
|
|
myTree->Branch("RecJetPy",RecJetPy,"RecJetPy[reco_jet]/F");
|
811 |
|
|
myTree->Branch("RecJetPz",RecJetPz,"RecJetPz[reco_jet]/F");
|
812 |
|
|
myTree->Branch("RecJetE",RecJetE,"RecJetE[reco_jet]/F");
|
813 |
|
|
myTree->Branch("caloMET", &caloMET, "caloMET/F");
|
814 |
|
|
myTree->Branch("caloSET", &caloSET, "caloSET/F");
|
815 |
|
|
myTree->Branch("pfMET", &pfMET, "pfMET/F");
|
816 |
|
|
myTree->Branch("pfSET", &pfSET, "pfSET/F");
|
817 |
|
|
myTree->Branch("caloMETX", &caloMETX, "caloMETX/F");
|
818 |
|
|
myTree->Branch("pfMETX", &pfMETX, "pfMETX/F");
|
819 |
|
|
myTree->Branch("caloMETY", &caloMETY, "caloMETY/F");
|
820 |
|
|
myTree->Branch("pfMETY", &pfMETY, "pfMETY/F");
|
821 |
|
|
myTree->Branch("muCorrMET", &muCorrMET, "muCorrMET/F");
|
822 |
|
|
myTree->Branch("muCorrSET", &muCorrSET, "muCorrSET/F");
|
823 |
|
|
|
824 |
|
|
/*
|
825 |
|
|
myTree->Branch("jpt_c",&jpt_c,"jpt_c/I");
|
826 |
|
|
myTree->Branch("JPTPt",JPTPt,"JPTPt[jpt_c]/F");
|
827 |
|
|
myTree->Branch("JPTEta",JPTEta,"JPTEta[jpt_c]/F");
|
828 |
|
|
myTree->Branch("JPTPhi",JPTPhi,"JPTPhi[jpt_c]/F");
|
829 |
|
|
myTree->Branch("JPTPx",JPTPx,"JPTPx[jpt_c]/F");
|
830 |
|
|
myTree->Branch("JPTPy",JPTPy,"JPTPy[jpt_c]/F");
|
831 |
|
|
myTree->Branch("JPTPz",JPTPz,"JPTPz[jpt_c]/F");
|
832 |
|
|
myTree->Branch("JPTE",JPTE,"JPTE[jpt_c]/F");
|
833 |
|
|
*/
|
834 |
|
|
/*
|
835 |
|
|
myTree->Branch("cjpt_c",&cjpt_c,"cjpt_c/I");
|
836 |
|
|
myTree->Branch("cJPTPt",cJPTPt,"cJPTPt[cjpt_c]/F");
|
837 |
|
|
myTree->Branch("cJPTEta",cJPTEta,"cJPTEta[cjpt_c]/F");
|
838 |
|
|
myTree->Branch("cJPTPhi",cJPTPhi,"cJPTPhi[cjpt_c]/F");
|
839 |
|
|
myTree->Branch("cJPTPx",cJPTPx,"cJPTPx[cjpt_c]/F");
|
840 |
|
|
myTree->Branch("cJPTPy",cJPTPy,"cJPTPy[cjpt_c]/F");
|
841 |
|
|
myTree->Branch("cJPTPz",cJPTPz,"cJPTPz[cjpt_c]/F");
|
842 |
|
|
myTree->Branch("cJPTE",cJPTE,"cJPTE[cjpt_c]/F");
|
843 |
|
|
*/
|
844 |
|
|
|
845 |
|
|
myTree->Branch("pfNjets",&pfNjets,"pfNjets/I");
|
846 |
|
|
myTree->Branch("PFjetEta",PFjetEta,"PFjetEta[pfNjets]/F");
|
847 |
|
|
myTree->Branch("PFjetPhi",PFjetPhi,"PFjetPhi[pfNjets]/F");
|
848 |
|
|
myTree->Branch("PFjetPt",PFjetPt,"PFjetPt[pfNjets]/F");
|
849 |
|
|
myTree->Branch("PFCorrjetPt",PFCorrjetPt,"PFCorrjetPt[pfNjets]/F");
|
850 |
|
|
myTree->Branch("PFjetCEMF",PFjetCEMF,"PFjetCEMF[pfNjets]/F");
|
851 |
|
|
myTree->Branch("PFjetNEMF",PFjetNEMF,"PFjetNEMF[pfNjets]/F");
|
852 |
|
|
|
853 |
|
|
myTree->Branch("pfNtracks",&pfNtracks,"pfNtracks/I");
|
854 |
|
|
myTree->Branch("PFjetTrkVZ",PFjetTrkVZ,"PFjetTrkVZ[pfNjets][30]/F");
|
855 |
|
|
myTree->Branch("PFjetTrkPT",PFjetTrkPT,"PFjetTrkPT[pfNjets][30]/F");
|
856 |
|
|
|
857 |
|
|
|
858 |
|
|
myTree->Branch("nVertices",&nVertices,"nVertices/I");
|
859 |
|
|
myTree->Branch("nGoodVertices",&nGoodVertices,"nGoodVertices/I");
|
860 |
|
|
myTree->Branch("vtxX",vtxX,"vtxX[nVertices]/F");
|
861 |
|
|
myTree->Branch("vtxY",vtxY,"vtxY[nVertices]/F");
|
862 |
|
|
myTree->Branch("vtxZ",vtxZ,"vtxZ[nVertices]/F");
|
863 |
|
|
myTree->Branch("vtxXerr",vtxXerr,"vtxXerr[nVertices]/F");
|
864 |
|
|
myTree->Branch("vtxYerr",vtxYerr,"vtxYerr[nVertices]/F");
|
865 |
|
|
myTree->Branch("vtxZerr",vtxZerr,"vtxZerr[nVertices]/F");
|
866 |
|
|
myTree->Branch("vtxisValid",vtxisValid,"vtxisValid[nVertices]/I");
|
867 |
|
|
myTree->Branch("vtxisFake",vtxisFake,"vtxisFake[nVertices]/I");
|
868 |
|
|
|
869 |
|
|
|
870 |
|
|
}
|
871 |
|
|
|
872 |
|
|
// ------------ method called once each job just after ending the event loop ------------
|
873 |
|
|
void
|
874 |
|
|
AFB::endJob() {
|
875 |
|
|
myTree->Print();//!!!
|
876 |
|
|
// f->Write();
|
877 |
|
|
// f->Close();
|
878 |
|
|
}
|
879 |
|
|
|
880 |
|
|
|
881 |
|
|
|
882 |
|
|
|
883 |
|
|
float AFB::DeltaPhi(float phi1, float phi2)
|
884 |
|
|
{
|
885 |
|
|
float dphi = phi2 - phi1;
|
886 |
|
|
if (fabs(dphi) > 3.14) dphi = 6.28 - fabs(dphi);
|
887 |
|
|
return dphi;
|
888 |
|
|
}
|
889 |
|
|
|
890 |
|
|
float AFB::DeltaR(float eta1, float eta2, float phi1, float phi2)
|
891 |
|
|
{
|
892 |
|
|
float deta = eta2 - eta1;
|
893 |
|
|
float dphi = phi2 - phi1;
|
894 |
|
|
if (fabs(dphi) > 3.14) dphi = 6.28 - fabs(dphi);
|
895 |
|
|
float DELTAR = sqrt(pow(dphi,2)+pow(deta,2))*1.0;
|
896 |
|
|
return DELTAR;
|
897 |
|
|
}
|
898 |
|
|
|
899 |
|
|
|
900 |
|
|
bool AFB::IsMuMatchedToHLTMu ( const reco::Muon & mu, std::vector<reco::Particle> HLTMu , double DR, double DPtRel ) {
|
901 |
|
|
size_t dim = HLTMu.size();
|
902 |
|
|
size_t nPass=0;
|
903 |
|
|
|
904 |
|
|
// filling the denumerator;
|
905 |
|
|
double muRecoPt= mu.pt();
|
906 |
|
|
//hTrigMuonPtDenS_-> Fill(muRecoPt);
|
907 |
|
|
|
908 |
|
|
if (dim==0) return false;
|
909 |
|
|
for (size_t k =0; k< dim; k++ ) {
|
910 |
|
|
if ( (deltaR(HLTMu[k], mu) < DR) && (fabs(HLTMu[k].pt() - mu.pt())/ HLTMu[k].pt()<DPtRel)){
|
911 |
|
|
nPass++ ;
|
912 |
|
|
std::cout<< " matching a muon " << std::endl;
|
913 |
|
|
std::cout << "muon reco pt : " << muRecoPt<< std::endl;
|
914 |
|
|
std::cout << "muon reco eta " << mu.eta() << std::endl;
|
915 |
|
|
std::cout << "muon trigger pt "<< HLTMu[k].pt() << std::endl;
|
916 |
|
|
std::cout << "muon trigger eta : "<< HLTMu[k].eta() << std::endl;
|
917 |
|
|
std::cout <<"deltaR((HLTMu[k], mu)): "<< deltaR(HLTMu[k], mu) << std::endl;
|
918 |
|
|
std::cout <<"deltaPtOverPt: "<< fabs(HLTMu[k].pt() - mu.pt())/ HLTMu[k].pt() << std::endl;
|
919 |
|
|
}
|
920 |
|
|
}
|
921 |
|
|
|
922 |
|
|
return (nPass>0);
|
923 |
|
|
}
|
924 |
|
|
|
925 |
|
|
|
926 |
|
|
|
927 |
|
|
//define this as a plug-in
|
928 |
|
|
DEFINE_FWK_MODULE(AFB);
|