ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/LJMet/MultivariateAnalysis/interface/TtLJetsAnalyzer.h
Revision: 1.18
Committed: Tue Nov 24 08:02:35 2009 UTC (15 years, 5 months ago) by kukartse
Content type: text/plain
Branch: MAIN
CVS Tags: gak010310, ejterm2010_25nov2009, V00-02-01, V00-02-00, gak112409
Changes since 1.17: +2 -2 lines
Log Message:
first collisions data

File Contents

# Content
1 // -*- C++ -*-
2 //
3 // Package: TtLJetsAnalyzer
4 // Class: TtLJetsAnalyzer
5 //
6 /**\class TtLJetsAnalyzer TtLJetsAnalyzer.cc RecoBTag/TtLJetsAnalyzer/src/TtLJetsAnalyzer.cc
7
8 Description: Likelihood variables for ttbar events
9
10 Implementation:
11 Ttbar cross section without b tagging. Likelihood quantities.
12 */
13 //
14 // Original Author: Gena Kukartsev, kukarzev@fnal.gov
15 // Created: Fri Jun 20 06:19:59 CDT 2008
16 // $Id: TtLJetsAnalyzer.h,v 1.17 2009/11/18 00:58:13 kukartse Exp $
17 //
18 //
19
20 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
21
22 #include "LJMet/MultivariateAnalysis/interface/RooGKCounter.h"
23
24 #include <memory>
25 #include <string>
26 //#include "TFile.h"
27 #include "TTree.h"
28 #include "Rtypes.h"
29 #include "FWCore/Framework/interface/Frameworkfwd.h"
30 #include "FWCore/Framework/interface/EDAnalyzer.h"
31 #include "FWCore/Framework/interface/Event.h"
32 #include "FWCore/Framework/interface/MakerMacros.h"
33 #include "FWCore/ParameterSet/interface/ParameterSet.h"
34
35 #include "DataFormats/Math/interface/LorentzVector.h"
36 #include "DataFormats/Common/interface/View.h"
37 #include "DataFormats/PatCandidates/interface/Electron.h"
38 #include "DataFormats/TrackReco/interface/Track.h"
39
40 class TtLJetsAnalyzer : public edm::EDAnalyzer {
41 public:
42 explicit TtLJetsAnalyzer(const edm::ParameterSet&);
43 ~TtLJetsAnalyzer();
44
45
46 private:
47
48 virtual void beginJob(const edm::EventSetup&);
49 virtual void analyze(const edm::Event&, const edm::EventSetup&);
50 virtual void endJob(void);
51
52 // returns pair<dist,dcot>
53 pair<float, float> getConversionInfo(const pat::Electron & el,
54 const reco::Track & track,
55 const reco::BeamSpot::Point _bs,
56 float bField);
57
58 bool ConversionAlgo(const pat::Electron& e, edm::Handle<edm::View<reco::Track> > track_h);
59 double DelRTrackEle(const pat::Electron& e,const reco::Track& tk);
60
61 bool first_event;
62
63 // _____ quantities read from the config file _________________________
64 std::string _jetSource, _electronSource, _muonSource, _METSource,
65 _beamSpotSource, _trigger_source, _track_source;
66 std::string pdfWeightTag_;
67 bool _lepton_flavor_is_muon;
68 std::string _outFile;
69 bool _is_mc;
70 int nCaloJets_min;
71 int nLepton_min;
72 double jet_pt_min ;
73 double jet_eta_max ;
74 double muon_pt_min ;
75 double muon_eta_max ;
76 double muon_trackIso_max ;
77 double muon_caloIso_max ;
78 double electron_pt_min ;
79 double electron_eta_max ;
80 double electron_trackIso_max ;
81 double electron_caloIso_max ;
82 double met_et_min ;
83 double min_dr_jet_lepton ;
84 double _bfield;
85 double _dist_min;
86 double _dist_max;
87 double _abs_dcot_max;
88 double _e_track_dr;
89
90 RooGKCounter eventCounter;
91 RooGKCounter selectedEvents;
92
93 TTree * _tree;
94
95 //
96 // _____ output tree variables ________________________________________
97 //
98 Int_t _event, ilumi, irun;
99 Int_t _process_id;
100 Int_t _n_jets;
101 Int_t _n_removed_jets;
102 Int_t _n_met;
103 Int_t _n_muons;
104 Int_t _n_electrons;
105 Int_t _lepton_is_muon;
106 //
107 //_____ photon conversion _____________________________________________
108 //
109 vector<double> * _e_dist;
110 vector<double> * _e_dcot;
111 bool _is_conv;
112 //
113 //_____ PDF weights ___________________________________________________
114 //
115 vector<double> * _pdf_weights;
116 Double_t _weight_pdf_pos;
117 Double_t _weight_pdf_neg;
118 //
119 //_____ trigger _______________________________________________________
120 //
121 std::map<std::string,bool> _hlt;
122 //vector<TBranch> b_hlt;
123 //
124 Double_t _event_weight;
125 Double_t _lepton_et;
126 Double_t _lepton_pt;
127 Double_t _lepton_eta;
128 Double_t _lepton_phi;
129 Double_t _lepton_jet_min_dr;
130 Double_t _lepton_ptrel; // relative to the nearest jet
131 Double_t _lepton_d0; // relative to the beam spot
132 Double_t _lepton_d0_err; // relative to the beam spot
133 Double_t _lepton_d0_significance; // relative to the beam spot
134 Double_t _lepton_energy;
135 Double_t _lepton_track_iso;
136 Double_t _lepton_calo_iso;
137 Double_t _lepton_ecal_iso;
138 Double_t _lepton_hcal_iso;
139 Double_t _lepton_user_iso;
140 Double_t _lepton_IsoDeposit_em;
141 Double_t _lepton_IsoDeposit_had;
142 Int_t _muon_track_nhits;
143 Double_t _muon_track_chi2;
144 Double_t _muon_track_ndof;
145 Double_t _muon_track_nChi2;
146 Double_t _muon_outerTrack_chi2;
147 Double_t _muon_outerTrack_ndof;
148 Double_t _muon_outerTrack_nChi2;
149 Double_t _muon_globalTrack_chi2;
150 Double_t _muon_globalTrack_ndof;
151 Double_t _muon_globalTrack_nChi2;
152 Double_t _met_et;
153 Double_t _met_pt;
154 Double_t _met_eta;
155 Double_t _met_phi;
156 Double_t _met_energy;
157 Double_t _jet1_et;
158 Double_t _jet1_pt;
159 Double_t _jet1_eta;
160 Double_t _jet1_phi;
161 Double_t _jet1_energy;
162 Double_t _jet2_et;
163 Double_t _jet2_pt;
164 Double_t _jet2_eta;
165 Double_t _jet2_phi;
166 Double_t _jet2_energy;
167 Double_t _jet3_et;
168 Double_t _jet3_pt;
169 Double_t _jet3_eta;
170 Double_t _jet3_phi;
171 Double_t _jet3_energy;
172 Double_t _jet4_et;
173 Double_t _jet4_pt;
174 Double_t _jet4_eta;
175 Double_t _jet4_phi;
176 Double_t _jet4_energy;
177 Double_t _aplanarity ;
178 Double_t _centrality ;
179 Double_t _sphericity ;
180 Double_t _ht ;
181 Double_t _htPlusLepton ;
182 Double_t _metHtPlusLepton ;
183 Double_t _h ;
184 Double_t _ktMinPrime ;
185 Double_t _dPhiLMet ;
186 Double_t _minDijetMass ;
187 Double_t _maxJetEta ;
188 Double_t _et3 ;
189 Double_t _minDiJetDeltaR ;
190 Double_t _leptonJetDeltaR ;
191 Double_t _ht2p ;
192 Double_t _jet1Jet2DeltaR ;
193 Double_t _jet1Jet2DeltaPhi ;
194 Double_t _jet1Jet2_M ;
195 Double_t _jet1Jet2_Pt ;
196 Double_t _jet1Jet2W_M ;
197 Double_t _jet1Jet2W_Pt ;
198 Double_t _hz ;
199 Double_t _HT2 ;
200 Double_t _HT2prime ;
201 Double_t _W_MT ;
202 Double_t _W_M ;
203 Double_t _W_Pt ;
204 Double_t _DphiJMET ;
205 // Ht
206 Double_t _getHt ;
207 Double_t _getHtp ;
208 Double_t _getHtpp ;
209 Double_t _getHt2 ;
210 Double_t _getHt2p ;
211 Double_t _getHt2pp ;
212 Double_t _getHt3 ;
213 Double_t _getHt3p ;
214 Double_t _getHt3pp ;
215 Double_t _getCen ;
216 Double_t _getNJW ;
217 Double_t _getJetEtaMax ;
218 Double_t _getMdijetMin ;
219 Double_t _getMtjets ;
220 Double_t _getSqrtsT ;
221 Double_t _getMtAurelio ;
222 Double_t _getPzOverHT ;
223 Double_t _getMevent ;
224 Double_t _getM123inv ;
225 Double_t _getEta2Sum ;
226 Double_t _getMwRec ;
227 Double_t _getH ;
228 // event topo
229 Double_t _getSph ;
230 Double_t _getApl ;
231 Double_t _getAplMu ;
232 // Kt
233 Double_t _getKtminp ;
234 Double_t _getKtminpReduced ;
235 Double_t _getDrMinJetJet ;
236 // mT
237 Double_t _getDphiMuMet ;
238 Double_t _getMt ;
239 //
240 //
241 //_____ b tagging ______________________________________________
242 vector<double> * _jet_pt;
243 vector<double> * _jet_pz;
244 vector<double> * _jet_eta;
245 vector<double> * _jet_phi;
246 vector<double> * _jet_et;
247 vector<double> * _jet_energy;
248 vector<int> * _jet_flavor;
249 //
250 vector<double> * _muon_pt;
251 vector<double> * _muon_pz;
252 vector<double> * _muon_eta;
253 vector<double> * _muon_phi;
254 vector<double> * _muon_et;
255 vector<double> * _muon_energy;
256 vector<int> * _muon_flavor;
257 //
258 vector<double> * _electron_pt;
259 vector<double> * _electron_pz;
260 vector<double> * _electron_eta;
261 vector<double> * _electron_phi;
262 vector<double> * _electron_et;
263 vector<double> * _electron_energy;
264 vector<int> * _electron_flavor;
265 /* FIXME: add vectors of these:
266 Double_t _lepton_track_iso;
267 Double_t _lepton_calo_iso;
268 Double_t _lepton_ecal_iso;
269 Double_t _lepton_hcal_iso;
270 Double_t _lepton_user_iso;
271 Double_t _lepton_IsoDeposit_em;
272 Double_t _lepton_IsoDeposit_had;
273 */
274 TBranch * b_jet_pt;
275 TBranch * b_jet_pz;
276 TBranch * b_jet_eta;
277 TBranch * b_jet_phi;
278 TBranch * b_jet_et;
279 TBranch * b_jet_energy;
280 TBranch * b_jet_flavor;
281 //
282 TBranch * b_lepton_pt;
283 TBranch * b_lepton_pz;
284 TBranch * b_lepton_eta;
285 TBranch * b_lepton_phi;
286 TBranch * b_lepton_et;
287 TBranch * b_lepton_energy;
288 TBranch * b_lepton_flavor;
289 TBranch * b_lepton_jet_min_dr;
290 TBranch * b_lepton_ptrel;
291 TBranch * b_lepton_d0;
292 TBranch * b_lepton_d0_err;
293 TBranch * b_lepton_d0_significance;
294 //
295 vector<string> * _b_tagger_label;
296 vector<float> * _b_tagger_discr;
297 TBranch * b_b_tagger_label;
298 TBranch * b_b_tagger_discr;
299 Int_t _n_tagged_jets_trackCounting_loose;
300 Int_t _n_tagged_jets_trackCounting_medium;
301 Int_t _n_tagged_jets_trackCounting_tight;
302 Int_t _n_tagged_jets_jetProb_loose;
303 Int_t _n_tagged_jets_jetProb_medium;
304 Int_t _n_tagged_jets_jetProb_tight;
305
306 //
307 //
308 //_____ electron quality _______________________________________
309 Float_t _eidLoose;
310 Float_t _eidRobustHighEnergy;
311 Float_t _eidRobustLoose;
312 Float_t _eidRobustTight;
313 Float_t _eidTight;
314 Int_t _GsfElectron_classification;
315 Double_t _GsfElectron_hadronicOverEm;
316 Double_t _GsfElectron_caloEnergyError;
317 Double_t _GsfElectron_trackMomentumError;
318 Int_t _GsfElectron_numberOfClusters;
319 Double_t _GsfElectron_caloEnergy; // the super cluster energy corrected by EnergyScaleFactor
320 Double_t _GsfElectron_eSuperClusterOverP; // the supercluster energy / track momentum at impact point
321 Double_t _GsfElectron_eSeedClusterOverPout; // the seed cluster energy / track momentum at calo from outermost state
322 Double_t _GsfElectron_deltaEtaSuperClusterTrackAtVtx; // the supercluster eta - track eta from helix extrapolation from impact point
323 Double_t _GsfElectron_deltaEtaSeedClusterTrackAtCalo; // the seed cluster eta - track eta at calo from outermost state
324 Double_t _GsfElectron_deltaPhiSuperClusterTrackAtVtx; // the supercluster phi - track phi from helix extrapolation from impact point
325 Double_t _GsfElectron_deltaPhiSeedClusterTrackAtCalo; // the seed cluster phi - track phi at calo from outermost state
326 // ____ branches
327 TBranch * b_eidLoose;
328 TBranch * b_eidRobustHighEnergy;
329 TBranch * b_eidRobustLoose;
330 TBranch * b_eidRobustTight;
331 TBranch * b_eidTight;
332 TBranch * b_GsfElectron_classification;
333 TBranch * b_GsfElectron_hadronicOverEm;
334 TBranch * b_GsfElectron_caloEnergyError;
335 TBranch * b_GsfElectron_trackMomentumError;
336 TBranch * b_GsfElectron_numberOfClusters;
337 TBranch * b_GsfElectron_caloEnergy; // the super cluster energy corrected by EnergyScaleFactor
338 TBranch * b_GsfElectron_eSuperClusterOverP; // the supercluster energy / track momentum at impact point
339 TBranch * b_GsfElectron_eSeedClusterOverPout; // the seed cluster energy / track momentum at calo from outermost state
340 TBranch * b_GsfElectron_deltaEtaSuperClusterTrackAtVtx; // the supercluster eta - track eta from helix extrapolation from impact point
341 TBranch * b_GsfElectron_deltaEtaSeedClusterTrackAtCalo; // the seed cluster eta - track eta at calo from outermost state
342 TBranch * b_GsfElectron_deltaPhiSuperClusterTrackAtVtx; // the supercluster phi - track phi from helix extrapolation from impact point
343 TBranch * b_GsfElectron_deltaPhiSeedClusterTrackAtCalo; // the seed cluster phi - track phi at calo from outermost state
344 //
345 //
346 //_____ muon quality _______________________________________
347 bool _muon_isGood_All; // dummy options - always true
348 bool _muon_isGood_AllGlobalMuons; // checks isGlobalMuon flag
349 bool _muon_isGood_AllStandAloneMuons; // checks isStandAloneMuon flag
350 bool _muon_isGood_AllTrackerMuons; // checks isTrackerMuon flag
351 bool _muon_isGood_TrackerMuonArbitrated; // resolve ambiguity of sharing segments
352 bool _muon_isGood_AllArbitrated; // all muons with the tracker muon arbitrated
353 bool _muon_isGood_GlobalMuonPromptTight; // global muons with tighter fit requirements
354 bool _muon_isGood_TMLastStationLoose; // penetration depth loose selector
355 bool _muon_isGood_TMLastStationTight; // penetration depth tight selector
356 bool _muon_isGood_TM2DCompatibilityLoose; // likelihood based loose selector
357 bool _muon_isGood_TM2DCompatibilityTight; // likelihood based tight selector
358 bool _muon_isGood_TMOneStationLoose; // require one well matched segment
359 bool _muon_isGood_TMOneStationTight; // require one well matched segment
360 bool _muon_isGood_TMLastStationOptimizedLowPtLoose; // combination of TMLastStation and TMOneStation
361 bool _muon_isGood_TMLastStationOptimizedLowPtTight; // combination of TMLastStation and TMOneStation
362 //____ branches
363 TBranch * b_muon_isGood_All; // dummy options - always true
364 TBranch * b_muon_isGood_AllGlobalMuons; // checks isGlobalMuon flag
365 TBranch * b_muon_isGood_AllStandAloneMuons; // checks isStandAloneMuon flag
366 TBranch * b_muon_isGood_AllTrackerMuons; // checks isTrackerMuon flag
367 TBranch * b_muon_isGood_TrackerMuonArbitrated; // resolve ambiguity of sharing segments
368 TBranch * b_muon_isGood_AllArbitrated; // all muons with the tracker muon arbitrated
369 TBranch * b_muon_isGood_GlobalMuonPromptTight; // global muons with tighter fit requirements
370 TBranch * b_muon_isGood_TMLastStationLoose; // penetration depth loose selector
371 TBranch * b_muon_isGood_TMLastStationTight; // penetration depth tight selector
372 TBranch * b_muon_isGood_TM2DCompatibilityLoose; // likelihood based loose selector
373 TBranch * b_muon_isGood_TM2DCompatibilityTight; // likelihood based tight selector
374 TBranch * b_muon_isGood_TMOneStationLoose; // require one well matched segment
375 TBranch * b_muon_isGood_TMOneStationTight; // require one well matched segment
376 TBranch * b_muon_isGood_TMLastStationOptimizedLowPtLoose; // combination of TMLastStation and TMOneStation
377 TBranch * b_muon_isGood_TMLastStationOptimizedLowPtTight; // combination of TMLastStation and TMOneStation
378 //____ output tree variables
379 TBranch * b_event;
380 TBranch * b_process_id;
381 TBranch * b_n_jets;
382 TBranch * b_n_removed_jets;
383 TBranch * b_n_met;
384 TBranch * b_n_muons;
385 TBranch * b_n_electrons;
386 TBranch * b_lepton_is_muon;
387 TBranch * b_event_weight;
388 //
389 TBranch * b_muon_et;
390 TBranch * b_muon_pt;
391 TBranch * b_muon_pz;
392 TBranch * b_muon_eta;
393 TBranch * b_muon_phi;
394 TBranch * b_muon_energy;
395 TBranch * b_muon_flavor;
396 //
397 TBranch * b_electron_et;
398 TBranch * b_electron_pt;
399 TBranch * b_electron_pz;
400 TBranch * b_electron_eta;
401 TBranch * b_electron_phi;
402 TBranch * b_electron_energy;
403 TBranch * b_electron_flavor;
404 //
405 TBranch * b_muon_track_chi2;
406 TBranch * b_muon_track_ndof;
407 TBranch * b_muon_track_nChi2;
408 TBranch * b_muon_outerTrack_chi2;
409 TBranch * b_muon_outerTrack_ndof;
410 TBranch * b_muon_outerTrack_nChi2;
411 TBranch * b_muon_globalTrack_chi2;
412 TBranch * b_muon_globalTrack_ndof;
413 TBranch * b_muon_globalTrack_nChi2;
414 TBranch * b_lepton_track_iso;
415 TBranch * b_lepton_calo_iso;
416 TBranch * b_lepton_ecal_iso;
417 TBranch * b_lepton_hcal_iso;
418 TBranch * b_lepton_user_iso;
419 TBranch * b_lepton_IsoDeposit_em;
420 TBranch * b_lepton_IsoDeposit_had;
421 TBranch * b_met_et;
422 TBranch * b_met_pt;
423 TBranch * b_met_eta;
424 TBranch * b_met_phi;
425 TBranch * b_met_energy;
426 TBranch * b_jet1_et;
427 TBranch * b_jet1_pt;
428 TBranch * b_jet1_eta;
429 TBranch * b_jet1_phi;
430 TBranch * b_jet1_energy;
431 TBranch * b_jet2_et;
432 TBranch * b_jet2_pt;
433 TBranch * b_jet2_eta;
434 TBranch * b_jet2_phi;
435 TBranch * b_jet2_energy;
436 TBranch * b_jet3_et;
437 TBranch * b_jet3_pt;
438 TBranch * b_jet3_eta;
439 TBranch * b_jet3_phi;
440 TBranch * b_jet3_energy;
441 TBranch * b_jet4_et;
442 TBranch * b_jet4_pt;
443 TBranch * b_jet4_eta;
444 TBranch * b_jet4_phi;
445 TBranch * b_jet4_energy;
446 TBranch * b_n_tagged_jets_trackCounting_loose;
447 TBranch * b_n_tagged_jets_trackCounting_medium;
448 TBranch * b_n_tagged_jets_trackCounting_tight;
449 TBranch * b_n_tagged_jets_jetProb_loose;
450 TBranch * b_n_tagged_jets_jetProb_medium;
451 TBranch * b_n_tagged_jets_jetProb_tight;
452 // ____
453 TBranch * b_aplanarity ;
454 TBranch * b_centrality ;
455 TBranch * b_sphericity ;
456 TBranch * b_ht ;
457 TBranch * b_htPlusLepton ;
458 TBranch * b_metHtPlusLepton ;
459 TBranch * b_h ;
460 TBranch * b_ktMinPrime ;
461 TBranch * b_dPhiLMet ;
462 TBranch * b_minDijetMass ;
463 TBranch * b_maxJetEta ;
464 TBranch * b_et3 ;
465 TBranch * b_minDiJetDeltaR ;
466 TBranch * b_leptonJetDeltaR ;
467 TBranch * b_ht2p ;
468 TBranch * b_jet1Jet2DeltaR ;
469 TBranch * b_jet1Jet2DeltaPhi ;
470 TBranch * b_jet1Jet2_M ;
471 TBranch * b_jet1Jet2_Pt ;
472 TBranch * b_jet1Jet2W_M ;
473 TBranch * b_jet1Jet2W_Pt ;
474 TBranch * b_hz ;
475 TBranch * b_HT2;
476 TBranch * b_HT2prime;
477 TBranch * b_W_MT;
478 TBranch * b_W_M ;
479 TBranch * b_W_Pt ;
480 TBranch * b_DphiJMET ;
481 // Ht
482 TBranch * b_getHt ;
483 TBranch * b_getHtp ;
484 TBranch * b_getHtpp ;
485 TBranch * b_getHt2 ;
486 TBranch * b_getHt2p ;
487 TBranch * b_getHt2pp ;
488 TBranch * b_getHt3 ;
489 TBranch * b_getHt3p ;
490 TBranch * b_getHt3pp ;
491 TBranch * b_getCen ;
492 TBranch * b_getNJW ;
493 TBranch * b_getJetEtaMax ;
494 TBranch * b_getMdijetMin ;
495 TBranch * b_getMtjets ;
496 TBranch * b_getSqrtsT ;
497 TBranch * b_getMtAurelio ;
498 TBranch * b_getPzOverHT ;
499 TBranch * b_getMevent ;
500 TBranch * b_getM123inv ;
501 TBranch * b_getEta2Sum ;
502 TBranch * b_getMwRec ;
503 TBranch * b_getH ;
504 // event topo
505 TBranch * b_getSph ;
506 TBranch * b_getApl ;
507 TBranch * b_getAplMu ;
508 // Kt
509 TBranch * b_getKtminp ;
510 TBranch * b_getKtminpReduced ;
511 TBranch * b_getDrMinJetJet ;
512 // mT
513 TBranch * b_getDphiMuMet ;
514 TBranch * b_getMt ;
515
516
517 };