ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/LJMet/MultivariateAnalysis/interface/TtLJetsAnalyzer.h
Revision: 1.23
Committed: Thu Apr 8 22:38:21 2010 UTC (15 years ago) by kukartse
Content type: text/plain
Branch: MAIN
CVS Tags: V00-03-01, HEAD
Changes since 1.22: +15 -126 lines
Log Message:
rolled back ZMorphing (dedicated branch), new production configs

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