ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MuJetAnalysis/AnalysisTools/IsolationStudyNtuple/src/IsolationStudyNtuple.cc
Revision: 1.5
Committed: Thu Nov 18 18:47:22 2010 UTC (14 years, 5 months ago) by pivarski
Content type: text/plain
Branch: MAIN
CVS Tags: YP_2012-12-04_2011Data, V_2012_01_29_01, JP-2011-02-03, JP-2011-01-16-a, JP-2011-01-15-a, JP-2011-01-11-a, JP-2011-01-10-c, JP-2011-01-10-b, JP-2011-01-10-a, JP-2011-01-04-a, JP-2010-12-20-a, JP-2010-12-15-b, JP-2010-12-15-a, JP-2010-12-11-a, JP-2010-12-09-a, JP-2010-12-08-a, JP-2010-12-06-a, JP-2010-12-05-b, JP-2010-12-05-a, JP-2010-12-01-a, JP-2010-11-30-a, JP-2010-11-29-a, JP-2010-11-25-a, JP-2010-11-22-a, JP-2010-11-20-c, JP-2010-11-20-a, JP-2010-11-19-b, JP-2010-11-19-a, JP-2010-11-18-a, HEAD
Changes since 1.4: +76 -73 lines
Log Message:
isolation excludes all muons, not just those in one mu-jet (signal mu-jets might overlap)

File Contents

# Content
1 // -*- C++ -*-
2 //
3 // Package: IsolationStudyNtuple
4 // Class: IsolationStudyNtuple
5 //
6 /**\class IsolationStudyNtuple IsolationStudyNtuple.cc AnalysisTools/IsolationStudyNtuple/src/IsolationStudyNtuple.cc
7
8 Description: [one line class summary]
9
10 Implementation:
11 [Notes on implementation]
12 */
13 //
14 // Original Author: James Pivarski
15 // Created: Tue Nov 9 13:34:12 CST 2010
16 // $Id: IsolationStudyNtuple.cc,v 1.4 2010/11/11 00:04:01 pivarski Exp $
17 //
18 //
19
20
21 // system include files
22 #include <memory>
23
24 // user include files
25 #include "FWCore/Framework/interface/Frameworkfwd.h"
26 #include "FWCore/Framework/interface/EDAnalyzer.h"
27 #include "FWCore/Framework/interface/Event.h"
28 #include "FWCore/Framework/interface/MakerMacros.h"
29 #include "FWCore/ParameterSet/interface/ParameterSet.h"
30
31 #include "AnalysisDataFormats/MuJetAnalysis/interface/MultiMuon.h"
32 #include "CommonTools/UtilAlgos/interface/TFileService.h"
33 #include "DataFormats/MuonReco/interface/Muon.h"
34 #include "DataFormats/PatCandidates/interface/Muon.h"
35 #include "DataFormats/TrackReco/interface/TrackFwd.h"
36 #include "DataFormats/PatCandidates/interface/TriggerEvent.h"
37 #include "DataFormats/PatCandidates/interface/TriggerPath.h"
38 #include "FWCore/ServiceRegistry/interface/Service.h"
39 #include "DataFormats/Candidate/interface/Candidate.h"
40 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
41 #include "TTree.h"
42
43 //
44 // class declaration
45 //
46
47 class IsolationStudyNtuple : public edm::EDAnalyzer {
48 public:
49 explicit IsolationStudyNtuple(const edm::ParameterSet&);
50 ~IsolationStudyNtuple();
51
52
53 private:
54 virtual void beginJob() ;
55 virtual void analyze(const edm::Event&, const edm::EventSetup&);
56 virtual void endJob() ;
57
58 // ----------member data ---------------------------
59 bool m_getQscale;
60 bool m_getAlternating;
61
62 TTree *m_ttree;
63
64 void littlefunction(const reco::TrackCollection *tracks, const pat::MuonCollection *muons, const pat::MultiMuon *muJet, double centralCone, double centralThreshold, Float_t &iso, Int_t &num) {
65 pat::MultiMuon mJ(*muJet);
66 mJ.calculateTrackIsolation(tracks, muons, centralCone, 0., centralThreshold, 0.);
67 mJ.calculateNumberAboveThresholdIsolation(tracks, muons, centralCone, 0., centralThreshold, 0.);
68 iso = mJ.centralTrackIsolation();
69 num = mJ.centralNumberAboveThreshold();
70 };
71
72 Float_t m_qscale;
73 Int_t m_daughters;
74 Float_t m_mass;
75 Float_t m_dRmax;
76 Float_t m_dphimax;
77 Float_t m_detamax;
78 Float_t m_vertexProb;
79 Float_t m_pt;
80 Float_t m_phi;
81 Float_t m_eta;
82 Float_t m_pt1;
83 Float_t m_pt2;
84
85 Float_t m_iso01th00, m_iso02th00, m_iso03th00, m_iso04th00, m_iso05th00;
86 Float_t m_iso01th05, m_iso02th05, m_iso03th05, m_iso04th05, m_iso05th05;
87 Float_t m_iso01th10, m_iso02th10, m_iso03th10, m_iso04th10, m_iso05th10;
88 Float_t m_iso01th15, m_iso02th15, m_iso03th15, m_iso04th15, m_iso05th15;
89 Float_t m_iso01th20, m_iso02th20, m_iso03th20, m_iso04th20, m_iso05th20;
90 Float_t m_iso01th25, m_iso02th25, m_iso03th25, m_iso04th25, m_iso05th25;
91
92 Int_t m_num01th00, m_num02th00, m_num03th00, m_num04th00, m_num05th00;
93 Int_t m_num01th05, m_num02th05, m_num03th05, m_num04th05, m_num05th05;
94 Int_t m_num01th10, m_num02th10, m_num03th10, m_num04th10, m_num05th10;
95 Int_t m_num01th15, m_num02th15, m_num03th15, m_num04th15, m_num05th15;
96 Int_t m_num01th20, m_num02th20, m_num03th20, m_num04th20, m_num05th20;
97 Int_t m_num01th25, m_num02th25, m_num03th25, m_num04th25, m_num05th25;
98
99 Float_t m_closestOtherdR;
100 Float_t m_closestOtherdphi;
101 Float_t m_closestOtherdeta;
102 Float_t m_other_pt;
103 Float_t m_other_eta;
104 Float_t m_other_trackiso;
105
106 Float_t m_other_iso01th00, m_other_iso02th00, m_other_iso03th00, m_other_iso04th00, m_other_iso05th00;
107 Float_t m_other_iso01th05, m_other_iso02th05, m_other_iso03th05, m_other_iso04th05, m_other_iso05th05;
108 Float_t m_other_iso01th10, m_other_iso02th10, m_other_iso03th10, m_other_iso04th10, m_other_iso05th10;
109 Float_t m_other_iso01th15, m_other_iso02th15, m_other_iso03th15, m_other_iso04th15, m_other_iso05th15;
110 Float_t m_other_iso01th20, m_other_iso02th20, m_other_iso03th20, m_other_iso04th20, m_other_iso05th20;
111 Float_t m_other_iso01th25, m_other_iso02th25, m_other_iso03th25, m_other_iso04th25, m_other_iso05th25;
112
113 Int_t m_other_num01th00, m_other_num02th00, m_other_num03th00, m_other_num04th00, m_other_num05th00;
114 Int_t m_other_num01th05, m_other_num02th05, m_other_num03th05, m_other_num04th05, m_other_num05th05;
115 Int_t m_other_num01th10, m_other_num02th10, m_other_num03th10, m_other_num04th10, m_other_num05th10;
116 Int_t m_other_num01th15, m_other_num02th15, m_other_num03th15, m_other_num04th15, m_other_num05th15;
117 Int_t m_other_num01th20, m_other_num02th20, m_other_num03th20, m_other_num04th20, m_other_num05th20;
118 Int_t m_other_num01th25, m_other_num02th25, m_other_num03th25, m_other_num04th25, m_other_num05th25;
119
120 TTree *m_tracks;
121 Float_t m_trackdR;
122 Float_t m_trackpT;
123 };
124
125 //
126 // constants, enums and typedefs
127 //
128
129 //
130 // static data member definitions
131 //
132
133 //
134 // constructors and destructor
135 //
136 IsolationStudyNtuple::IsolationStudyNtuple(const edm::ParameterSet& iConfig)
137 : m_getQscale(iConfig.getParameter<bool>("getQscale"))
138 , m_getAlternating(iConfig.getParameter<bool>("getAlternating"))
139 {
140 //now do what ever initialization is needed
141 edm::Service<TFileService> tFile;
142 m_ttree = tFile->make<TTree>("ttree", "ttree");
143
144 m_ttree->Branch("qscale", &m_qscale, "qscale/F");
145 m_ttree->Branch("daughters", &m_daughters, "daughters/I");
146 m_ttree->Branch("mass", &m_mass, "mass/F");
147 m_ttree->Branch("dRmax", &m_dRmax, "dRmax/F");
148 m_ttree->Branch("dphimax", &m_dphimax, "dphimax/F");
149 m_ttree->Branch("detamax", &m_detamax, "detamax/F");
150 m_ttree->Branch("vertexProb", &m_vertexProb, "vertexProb/F");
151 m_ttree->Branch("pt", &m_pt, "pt/F");
152 m_ttree->Branch("phi", &m_phi, "phi/F");
153 m_ttree->Branch("eta", &m_eta, "eta/F");
154 m_ttree->Branch("pt1", &m_pt1, "pt1/F");
155 m_ttree->Branch("pt2", &m_pt2, "pt2/F");
156
157 m_ttree->Branch("iso01th00", &m_iso01th00, "iso01th00/F"); m_ttree->Branch("iso02th00", &m_iso02th00, "iso02th00/F"); m_ttree->Branch("iso03th00", &m_iso03th00, "iso03th00/F"); m_ttree->Branch("iso04th00", &m_iso04th00, "iso04th00/F"); m_ttree->Branch("iso05th00", &m_iso05th00, "iso05th00/F");
158 m_ttree->Branch("iso01th05", &m_iso01th05, "iso01th05/F"); m_ttree->Branch("iso02th05", &m_iso02th05, "iso02th05/F"); m_ttree->Branch("iso03th05", &m_iso03th05, "iso03th05/F"); m_ttree->Branch("iso04th05", &m_iso04th05, "iso04th05/F"); m_ttree->Branch("iso05th05", &m_iso05th05, "iso05th05/F");
159 m_ttree->Branch("iso01th10", &m_iso01th10, "iso01th10/F"); m_ttree->Branch("iso02th10", &m_iso02th10, "iso02th10/F"); m_ttree->Branch("iso03th10", &m_iso03th10, "iso03th10/F"); m_ttree->Branch("iso04th10", &m_iso04th10, "iso04th10/F"); m_ttree->Branch("iso05th10", &m_iso05th10, "iso05th10/F");
160 m_ttree->Branch("iso01th15", &m_iso01th15, "iso01th15/F"); m_ttree->Branch("iso02th15", &m_iso02th15, "iso02th15/F"); m_ttree->Branch("iso03th15", &m_iso03th15, "iso03th15/F"); m_ttree->Branch("iso04th15", &m_iso04th15, "iso04th15/F"); m_ttree->Branch("iso05th15", &m_iso05th15, "iso05th15/F");
161 m_ttree->Branch("iso01th20", &m_iso01th20, "iso01th20/F"); m_ttree->Branch("iso02th20", &m_iso02th20, "iso02th20/F"); m_ttree->Branch("iso03th20", &m_iso03th20, "iso03th20/F"); m_ttree->Branch("iso04th20", &m_iso04th20, "iso04th20/F"); m_ttree->Branch("iso05th20", &m_iso05th20, "iso05th20/F");
162 m_ttree->Branch("iso01th25", &m_iso01th25, "iso01th25/F"); m_ttree->Branch("iso02th25", &m_iso02th25, "iso02th25/F"); m_ttree->Branch("iso03th25", &m_iso03th25, "iso03th25/F"); m_ttree->Branch("iso04th25", &m_iso04th25, "iso04th25/F"); m_ttree->Branch("iso05th25", &m_iso05th25, "iso05th25/F");
163
164 m_ttree->Branch("num01th00", &m_num01th00, "num01th00/I"); m_ttree->Branch("num02th00", &m_num02th00, "num02th00/I"); m_ttree->Branch("num03th00", &m_num03th00, "num03th00/I"); m_ttree->Branch("num04th00", &m_num04th00, "num04th00/I"); m_ttree->Branch("num05th00", &m_num05th00, "num05th00/I");
165 m_ttree->Branch("num01th05", &m_num01th05, "num01th05/I"); m_ttree->Branch("num02th05", &m_num02th05, "num02th05/I"); m_ttree->Branch("num03th05", &m_num03th05, "num03th05/I"); m_ttree->Branch("num04th05", &m_num04th05, "num04th05/I"); m_ttree->Branch("num05th05", &m_num05th05, "num05th05/I");
166 m_ttree->Branch("num01th10", &m_num01th10, "num01th10/I"); m_ttree->Branch("num02th10", &m_num02th10, "num02th10/I"); m_ttree->Branch("num03th10", &m_num03th10, "num03th10/I"); m_ttree->Branch("num04th10", &m_num04th10, "num04th10/I"); m_ttree->Branch("num05th10", &m_num05th10, "num05th10/I");
167 m_ttree->Branch("num01th15", &m_num01th15, "num01th15/I"); m_ttree->Branch("num02th15", &m_num02th15, "num02th15/I"); m_ttree->Branch("num03th15", &m_num03th15, "num03th15/I"); m_ttree->Branch("num04th15", &m_num04th15, "num04th15/I"); m_ttree->Branch("num05th15", &m_num05th15, "num05th15/I");
168 m_ttree->Branch("num01th20", &m_num01th20, "num01th20/I"); m_ttree->Branch("num02th20", &m_num02th20, "num02th20/I"); m_ttree->Branch("num03th20", &m_num03th20, "num03th20/I"); m_ttree->Branch("num04th20", &m_num04th20, "num04th20/I"); m_ttree->Branch("num05th20", &m_num05th20, "num05th20/I");
169 m_ttree->Branch("num01th25", &m_num01th25, "num01th25/I"); m_ttree->Branch("num02th25", &m_num02th25, "num02th25/I"); m_ttree->Branch("num03th25", &m_num03th25, "num03th25/I"); m_ttree->Branch("num04th25", &m_num04th25, "num04th25/I"); m_ttree->Branch("num05th25", &m_num05th25, "num05th25/I");
170
171 m_ttree->Branch("closestOtherdR", &m_closestOtherdR, "closestOtherdR/F");
172 m_ttree->Branch("closestOtherdphi", &m_closestOtherdphi, "closestOtherdphi/F");
173 m_ttree->Branch("closestOtherdeta", &m_closestOtherdeta, "closestOtherdeta/F");
174 m_ttree->Branch("other_pt", &m_other_pt, "other_pt/F");
175 m_ttree->Branch("other_eta", &m_other_eta, "other_eta/F");
176
177 m_ttree->Branch("other_iso01th00", &m_other_iso01th00, "other_iso01th00/F"); m_ttree->Branch("other_iso02th00", &m_other_iso02th00, "other_iso02th00/F"); m_ttree->Branch("other_iso03th00", &m_other_iso03th00, "other_iso03th00/F"); m_ttree->Branch("other_iso04th00", &m_other_iso04th00, "other_iso04th00/F"); m_ttree->Branch("other_iso05th00", &m_other_iso05th00, "other_iso05th00/F");
178 m_ttree->Branch("other_iso01th05", &m_other_iso01th05, "other_iso01th05/F"); m_ttree->Branch("other_iso02th05", &m_other_iso02th05, "other_iso02th05/F"); m_ttree->Branch("other_iso03th05", &m_other_iso03th05, "other_iso03th05/F"); m_ttree->Branch("other_iso04th05", &m_other_iso04th05, "other_iso04th05/F"); m_ttree->Branch("other_iso05th05", &m_other_iso05th05, "other_iso05th05/F");
179 m_ttree->Branch("other_iso01th10", &m_other_iso01th10, "other_iso01th10/F"); m_ttree->Branch("other_iso02th10", &m_other_iso02th10, "other_iso02th10/F"); m_ttree->Branch("other_iso03th10", &m_other_iso03th10, "other_iso03th10/F"); m_ttree->Branch("other_iso04th10", &m_other_iso04th10, "other_iso04th10/F"); m_ttree->Branch("other_iso05th10", &m_other_iso05th10, "other_iso05th10/F");
180 m_ttree->Branch("other_iso01th15", &m_other_iso01th15, "other_iso01th15/F"); m_ttree->Branch("other_iso02th15", &m_other_iso02th15, "other_iso02th15/F"); m_ttree->Branch("other_iso03th15", &m_other_iso03th15, "other_iso03th15/F"); m_ttree->Branch("other_iso04th15", &m_other_iso04th15, "other_iso04th15/F"); m_ttree->Branch("other_iso05th15", &m_other_iso05th15, "other_iso05th15/F");
181 m_ttree->Branch("other_iso01th20", &m_other_iso01th20, "other_iso01th20/F"); m_ttree->Branch("other_iso02th20", &m_other_iso02th20, "other_iso02th20/F"); m_ttree->Branch("other_iso03th20", &m_other_iso03th20, "other_iso03th20/F"); m_ttree->Branch("other_iso04th20", &m_other_iso04th20, "other_iso04th20/F"); m_ttree->Branch("other_iso05th20", &m_other_iso05th20, "other_iso05th20/F");
182 m_ttree->Branch("other_iso01th25", &m_other_iso01th25, "other_iso01th25/F"); m_ttree->Branch("other_iso02th25", &m_other_iso02th25, "other_iso02th25/F"); m_ttree->Branch("other_iso03th25", &m_other_iso03th25, "other_iso03th25/F"); m_ttree->Branch("other_iso04th25", &m_other_iso04th25, "other_iso04th25/F"); m_ttree->Branch("other_iso05th25", &m_other_iso05th25, "other_iso05th25/F");
183
184 m_ttree->Branch("other_num01th00", &m_other_num01th00, "other_num01th00/I"); m_ttree->Branch("other_num02th00", &m_other_num02th00, "other_num02th00/I"); m_ttree->Branch("other_num03th00", &m_other_num03th00, "other_num03th00/I"); m_ttree->Branch("other_num04th00", &m_other_num04th00, "other_num04th00/I"); m_ttree->Branch("other_num05th00", &m_other_num05th00, "other_num05th00/I");
185 m_ttree->Branch("other_num01th05", &m_other_num01th05, "other_num01th05/I"); m_ttree->Branch("other_num02th05", &m_other_num02th05, "other_num02th05/I"); m_ttree->Branch("other_num03th05", &m_other_num03th05, "other_num03th05/I"); m_ttree->Branch("other_num04th05", &m_other_num04th05, "other_num04th05/I"); m_ttree->Branch("other_num05th05", &m_other_num05th05, "other_num05th05/I");
186 m_ttree->Branch("other_num01th10", &m_other_num01th10, "other_num01th10/I"); m_ttree->Branch("other_num02th10", &m_other_num02th10, "other_num02th10/I"); m_ttree->Branch("other_num03th10", &m_other_num03th10, "other_num03th10/I"); m_ttree->Branch("other_num04th10", &m_other_num04th10, "other_num04th10/I"); m_ttree->Branch("other_num05th10", &m_other_num05th10, "other_num05th10/I");
187 m_ttree->Branch("other_num01th15", &m_other_num01th15, "other_num01th15/I"); m_ttree->Branch("other_num02th15", &m_other_num02th15, "other_num02th15/I"); m_ttree->Branch("other_num03th15", &m_other_num03th15, "other_num03th15/I"); m_ttree->Branch("other_num04th15", &m_other_num04th15, "other_num04th15/I"); m_ttree->Branch("other_num05th15", &m_other_num05th15, "other_num05th15/I");
188 m_ttree->Branch("other_num01th20", &m_other_num01th20, "other_num01th20/I"); m_ttree->Branch("other_num02th20", &m_other_num02th20, "other_num02th20/I"); m_ttree->Branch("other_num03th20", &m_other_num03th20, "other_num03th20/I"); m_ttree->Branch("other_num04th20", &m_other_num04th20, "other_num04th20/I"); m_ttree->Branch("other_num05th20", &m_other_num05th20, "other_num05th20/I");
189 m_ttree->Branch("other_num01th25", &m_other_num01th25, "other_num01th25/I"); m_ttree->Branch("other_num02th25", &m_other_num02th25, "other_num02th25/I"); m_ttree->Branch("other_num03th25", &m_other_num03th25, "other_num03th25/I"); m_ttree->Branch("other_num04th25", &m_other_num04th25, "other_num04th25/I"); m_ttree->Branch("other_num05th25", &m_other_num05th25, "other_num05th25/I");
190
191 m_tracks = tFile->make<TTree>("tracks", "tracks");
192 m_tracks->Branch("jetmass", &m_mass, "jetmass/F");
193 m_tracks->Branch("jetpt", &m_pt, "jetpt/F");
194 m_tracks->Branch("jeteta", &m_eta, "jeteta/F");
195 m_tracks->Branch("mupt1", &m_pt1, "mupt1/F");
196 m_tracks->Branch("mupt2", &m_pt2, "mupt2/F");
197 m_tracks->Branch("dR", &m_trackdR, "dR/F");
198 m_tracks->Branch("pT", &m_trackpT, "pT/F");
199 }
200
201
202 IsolationStudyNtuple::~IsolationStudyNtuple()
203 {
204
205 // do anything here that needs to be done at desctruction time
206 // (e.g. close files, deallocate resources etc.)
207
208 }
209
210
211 //
212 // member functions
213 //
214
215 // ------------ method called to for each event ------------
216 void
217 IsolationStudyNtuple::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
218 {
219 edm::Handle<pat::MultiMuonCollection> muJets;
220 iEvent.getByLabel("MuJetProducer", muJets);
221
222 edm::Handle<reco::TrackCollection> tracks;
223 iEvent.getByLabel("generalTracks", tracks);
224
225 edm::Handle<pat::MuonCollection> muons;
226 iEvent.getByLabel("cleanPatMuons", muons);
227
228 m_qscale = 0.;
229 if (m_getQscale) {
230 edm::Handle<GenEventInfoProduct> genEventInfoProduct;
231 iEvent.getByLabel("generator", genEventInfoProduct);
232 m_qscale = genEventInfoProduct->qScale();
233 }
234
235 bool alternating = true;
236 if (m_getAlternating) {
237 edm::Handle<unsigned int> particleNumber;
238 iEvent.getByLabel("generator", "particleNumber", particleNumber);
239 alternating = (*particleNumber == 0);
240 }
241
242 if (!alternating) return;
243
244 for (pat::MultiMuonCollection::const_iterator muJet = muJets->begin(); muJet != muJets->end(); ++muJet) {
245 m_daughters = muJet->numberOfDaughters();
246 m_mass = muJet->mass();
247 m_dRmax = muJet->dRmax();
248 m_dphimax = 0.;
249 m_detamax = 0.;
250 m_pt1 = 0.;
251 m_pt2 = 0.;
252 for (int i = 0; i < m_daughters; i++) {
253 for (int j = i+1; j < m_daughters; j++) {
254 if (fabs(muJet->dphi(i, j)) > fabs(m_dphimax)) m_dphimax = muJet->dphi(i, j);
255 if (fabs(muJet->deta(i, j)) > fabs(m_detamax)) m_detamax = muJet->deta(i, j);
256 }
257
258 if (muJet->daughter(i)->pt() > m_pt1) {
259 m_pt2 = m_pt1;
260 m_pt1 = muJet->daughter(i)->pt();
261 }
262 else if (muJet->daughter(i)->pt() > m_pt2) {
263 m_pt2 = muJet->daughter(i)->pt();
264 }
265 }
266 if (muJet->vertexValid()) m_vertexProb = muJet->vertexProb();
267 else m_vertexProb = -1.;
268 m_pt = muJet->pt();
269 m_phi = muJet->phi();
270 m_eta = muJet->eta();
271
272 if (true) {
273 pat::MultiMuon mJ(*muJet);
274 mJ.calculateTrackIsolation(&*tracks, &*muons, 0., 0., 0., 0., m_tracks, &m_trackdR, &m_trackpT);
275 }
276
277 littlefunction(&*tracks, &*muons, &*muJet, 0.1, 0.0, m_iso01th00, m_num01th00);
278 littlefunction(&*tracks, &*muons, &*muJet, 0.1, 0.5, m_iso01th05, m_num01th05);
279 littlefunction(&*tracks, &*muons, &*muJet, 0.1, 1.0, m_iso01th10, m_num01th10);
280 littlefunction(&*tracks, &*muons, &*muJet, 0.1, 1.5, m_iso01th15, m_num01th15);
281 littlefunction(&*tracks, &*muons, &*muJet, 0.1, 2.0, m_iso01th20, m_num01th20);
282 littlefunction(&*tracks, &*muons, &*muJet, 0.1, 2.5, m_iso01th25, m_num01th25);
283
284 littlefunction(&*tracks, &*muons, &*muJet, 0.2, 0.0, m_iso02th00, m_num02th00);
285 littlefunction(&*tracks, &*muons, &*muJet, 0.2, 0.5, m_iso02th05, m_num02th05);
286 littlefunction(&*tracks, &*muons, &*muJet, 0.2, 1.0, m_iso02th10, m_num02th10);
287 littlefunction(&*tracks, &*muons, &*muJet, 0.2, 1.5, m_iso02th15, m_num02th15);
288 littlefunction(&*tracks, &*muons, &*muJet, 0.2, 2.0, m_iso02th20, m_num02th20);
289 littlefunction(&*tracks, &*muons, &*muJet, 0.2, 2.5, m_iso02th25, m_num02th25);
290
291 littlefunction(&*tracks, &*muons, &*muJet, 0.3, 0.0, m_iso03th00, m_num03th00);
292 littlefunction(&*tracks, &*muons, &*muJet, 0.3, 0.5, m_iso03th05, m_num03th05);
293 littlefunction(&*tracks, &*muons, &*muJet, 0.3, 1.0, m_iso03th10, m_num03th10);
294 littlefunction(&*tracks, &*muons, &*muJet, 0.3, 1.5, m_iso03th15, m_num03th15);
295 littlefunction(&*tracks, &*muons, &*muJet, 0.3, 2.0, m_iso03th20, m_num03th20);
296 littlefunction(&*tracks, &*muons, &*muJet, 0.3, 2.5, m_iso03th25, m_num03th25);
297
298 littlefunction(&*tracks, &*muons, &*muJet, 0.4, 0.0, m_iso04th00, m_num04th00);
299 littlefunction(&*tracks, &*muons, &*muJet, 0.4, 0.5, m_iso04th05, m_num04th05);
300 littlefunction(&*tracks, &*muons, &*muJet, 0.4, 1.0, m_iso04th10, m_num04th10);
301 littlefunction(&*tracks, &*muons, &*muJet, 0.4, 1.5, m_iso04th15, m_num04th15);
302 littlefunction(&*tracks, &*muons, &*muJet, 0.4, 2.0, m_iso04th20, m_num04th20);
303 littlefunction(&*tracks, &*muons, &*muJet, 0.4, 2.5, m_iso04th25, m_num04th25);
304
305 littlefunction(&*tracks, &*muons, &*muJet, 0.5, 0.0, m_iso05th00, m_num05th00);
306 littlefunction(&*tracks, &*muons, &*muJet, 0.5, 0.5, m_iso05th05, m_num05th05);
307 littlefunction(&*tracks, &*muons, &*muJet, 0.5, 1.0, m_iso05th10, m_num05th10);
308 littlefunction(&*tracks, &*muons, &*muJet, 0.5, 1.5, m_iso05th15, m_num05th15);
309 littlefunction(&*tracks, &*muons, &*muJet, 0.5, 2.0, m_iso05th20, m_num05th20);
310 littlefunction(&*tracks, &*muons, &*muJet, 0.5, 2.5, m_iso05th25, m_num05th25);
311
312 m_closestOtherdR = -1.;
313 m_closestOtherdphi = 0.;
314 m_closestOtherdeta = 0.;
315 m_other_pt = 0.;
316 m_other_eta = 0.;
317
318 m_other_iso01th00 = 0.; m_other_iso02th00 = 0.; m_other_iso03th00 = 0.; m_other_iso04th00 = 0.; m_other_iso05th00 = 0.;
319 m_other_iso01th05 = 0.; m_other_iso02th05 = 0.; m_other_iso03th05 = 0.; m_other_iso04th05 = 0.; m_other_iso05th05 = 0.;
320 m_other_iso01th10 = 0.; m_other_iso02th10 = 0.; m_other_iso03th10 = 0.; m_other_iso04th10 = 0.; m_other_iso05th10 = 0.;
321 m_other_iso01th15 = 0.; m_other_iso02th15 = 0.; m_other_iso03th15 = 0.; m_other_iso04th15 = 0.; m_other_iso05th15 = 0.;
322 m_other_iso01th20 = 0.; m_other_iso02th20 = 0.; m_other_iso03th20 = 0.; m_other_iso04th20 = 0.; m_other_iso05th20 = 0.;
323 m_other_iso01th25 = 0.; m_other_iso02th25 = 0.; m_other_iso03th25 = 0.; m_other_iso04th25 = 0.; m_other_iso05th25 = 0.;
324
325 m_other_num01th00 = 0; m_other_num02th00 = 0; m_other_num03th00 = 0; m_other_num04th00 = 0; m_other_num05th00 = 0;
326 m_other_num01th05 = 0; m_other_num02th05 = 0; m_other_num03th05 = 0; m_other_num04th05 = 0; m_other_num05th05 = 0;
327 m_other_num01th10 = 0; m_other_num02th10 = 0; m_other_num03th10 = 0; m_other_num04th10 = 0; m_other_num05th10 = 0;
328 m_other_num01th15 = 0; m_other_num02th15 = 0; m_other_num03th15 = 0; m_other_num04th15 = 0; m_other_num05th15 = 0;
329 m_other_num01th20 = 0; m_other_num02th20 = 0; m_other_num03th20 = 0; m_other_num04th20 = 0; m_other_num05th20 = 0;
330 m_other_num01th25 = 0; m_other_num02th25 = 0; m_other_num03th25 = 0; m_other_num04th25 = 0; m_other_num05th25 = 0;
331
332 pat::MultiMuonCollection::const_iterator closestOther = muJets->end();
333 for (pat::MultiMuonCollection::const_iterator other = muJet; other != muJets->end(); ++other) {
334 if (other != muJet) {
335 double dphi = muJet->phi() - other->phi();
336 while (dphi > M_PI) dphi -= 2.*M_PI;
337 while (dphi < -M_PI) dphi += 2.*M_PI;
338 double deta = muJet->eta() - other->eta();
339 double dR = sqrt(dphi*dphi + deta*deta);
340
341 if (closestOther == muJets->end() || m_closestOtherdR > dR) {
342 closestOther = other;
343 m_closestOtherdR = dR;
344 m_closestOtherdphi = dphi;
345 m_closestOtherdeta = deta;
346 m_other_pt = other->pt();
347 m_other_eta = other->eta();
348
349 littlefunction(&*tracks, &*muons, &*other, 0.1, 0.0, m_other_iso01th00, m_other_num01th00);
350 littlefunction(&*tracks, &*muons, &*other, 0.1, 0.5, m_other_iso01th05, m_other_num01th05);
351 littlefunction(&*tracks, &*muons, &*other, 0.1, 1.0, m_other_iso01th10, m_other_num01th10);
352 littlefunction(&*tracks, &*muons, &*other, 0.1, 1.5, m_other_iso01th15, m_other_num01th15);
353 littlefunction(&*tracks, &*muons, &*other, 0.1, 2.0, m_other_iso01th20, m_other_num01th20);
354 littlefunction(&*tracks, &*muons, &*other, 0.1, 2.5, m_other_iso01th25, m_other_num01th25);
355
356 littlefunction(&*tracks, &*muons, &*other, 0.2, 0.0, m_other_iso02th00, m_other_num02th00);
357 littlefunction(&*tracks, &*muons, &*other, 0.2, 0.5, m_other_iso02th05, m_other_num02th05);
358 littlefunction(&*tracks, &*muons, &*other, 0.2, 1.0, m_other_iso02th10, m_other_num02th10);
359 littlefunction(&*tracks, &*muons, &*other, 0.2, 1.5, m_other_iso02th15, m_other_num02th15);
360 littlefunction(&*tracks, &*muons, &*other, 0.2, 2.0, m_other_iso02th20, m_other_num02th20);
361 littlefunction(&*tracks, &*muons, &*other, 0.2, 2.5, m_other_iso02th25, m_other_num02th25);
362
363 littlefunction(&*tracks, &*muons, &*other, 0.3, 0.0, m_other_iso03th00, m_other_num03th00);
364 littlefunction(&*tracks, &*muons, &*other, 0.3, 0.5, m_other_iso03th05, m_other_num03th05);
365 littlefunction(&*tracks, &*muons, &*other, 0.3, 1.0, m_other_iso03th10, m_other_num03th10);
366 littlefunction(&*tracks, &*muons, &*other, 0.3, 1.5, m_other_iso03th15, m_other_num03th15);
367 littlefunction(&*tracks, &*muons, &*other, 0.3, 2.0, m_other_iso03th20, m_other_num03th20);
368 littlefunction(&*tracks, &*muons, &*other, 0.3, 2.5, m_other_iso03th25, m_other_num03th25);
369
370 littlefunction(&*tracks, &*muons, &*other, 0.4, 0.0, m_other_iso04th00, m_other_num04th00);
371 littlefunction(&*tracks, &*muons, &*other, 0.4, 0.5, m_other_iso04th05, m_other_num04th05);
372 littlefunction(&*tracks, &*muons, &*other, 0.4, 1.0, m_other_iso04th10, m_other_num04th10);
373 littlefunction(&*tracks, &*muons, &*other, 0.4, 1.5, m_other_iso04th15, m_other_num04th15);
374 littlefunction(&*tracks, &*muons, &*other, 0.4, 2.0, m_other_iso04th20, m_other_num04th20);
375 littlefunction(&*tracks, &*muons, &*other, 0.4, 2.5, m_other_iso04th25, m_other_num04th25);
376
377 littlefunction(&*tracks, &*muons, &*other, 0.5, 0.0, m_other_iso05th00, m_other_num05th00);
378 littlefunction(&*tracks, &*muons, &*other, 0.5, 0.5, m_other_iso05th05, m_other_num05th05);
379 littlefunction(&*tracks, &*muons, &*other, 0.5, 1.0, m_other_iso05th10, m_other_num05th10);
380 littlefunction(&*tracks, &*muons, &*other, 0.5, 1.5, m_other_iso05th15, m_other_num05th15);
381 littlefunction(&*tracks, &*muons, &*other, 0.5, 2.0, m_other_iso05th20, m_other_num05th20);
382 littlefunction(&*tracks, &*muons, &*other, 0.5, 2.5, m_other_iso05th25, m_other_num05th25);
383 }
384 }
385 }
386
387 m_ttree->Fill();
388 }
389 }
390
391
392 // ------------ method called once each job just before starting event loop ------------
393 void
394 IsolationStudyNtuple::beginJob()
395 {
396 }
397
398 // ------------ method called once each job just after ending the event loop ------------
399 void
400 IsolationStudyNtuple::endJob() {
401 }
402
403 //define this as a plug-in
404 DEFINE_FWK_MODULE(IsolationStudyNtuple);