00001
00002
00003
00004
00005 #ifndef MyHtautauAnalysisH
00006 #define MyHtautauAnalysisH
00007
00008
00009
00010
00011
00027
00028
00029
00030
00031
00032
00033 #include "TFile.h"
00034 #include "TH1.h"
00035 #include "TH2.h"
00036 #include "TNtuple.h"
00037 #include "TProfile2D.h"
00038
00039 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,0)
00040 #include "TDirectoryFile.h"
00041 #else
00042 #include "TDirectory.h"
00043 #endif
00044
00045
00046 #include "NtupleReader/MyAnalysis.h"
00047 #include "NtupleReader/MyDatasetInfo.h"
00048 #include "NtupleReader/MyTrigger.h"
00049 #include "NtupleReader/MyTruthParticleManager.h"
00050 #include "NtupleReader/MyCollinearApproximation.h"
00051 #include "NtupleReader/MyParticlePair.h"
00052 #include "NtupleReader/MyTools.h"
00053 #include "NtupleReader/MyTextFileReader.h"
00054 #include "NtupleReader/MyVBFCandidate.h"
00055
00056
00057
00058 class MyHtautauAnalysis : public MyAnalysis {
00059
00060 public:
00061
00062 MyHtautauAnalysis(void) {
00063 init();
00064 }
00066
00067 ~MyHtautauAnalysis(void) {
00068 destruct();
00069 }
00071
00072
00073 void initialize(void);
00078 void analyse_event(const MyEvent & event);
00080 void end_of_analysis(void);
00083 TString settingsFilename;
00085 TString filename;
00088
00089 private:
00090
00091
00092 MyDatasetInfo *m_dataset_info;
00093
00094 TString met_ana_obj;
00095
00096
00097
00098
00099 std::vector<int> evt_nb_passed;
00100
00101 const MyEvent * m_event;
00102
00103
00104 int entry_nb;
00105
00106 double weight;
00107
00108 bool ev_has_fake_taus;
00109
00110 int nb_e25i_triggers;
00111 int nb_m20i_triggers;
00112 int nb_e25i_not_triggers;
00113 int nb_m20i_not_triggers;
00114 int nb_both_triggers;
00115
00116 int event_flavour;
00117
00118
00119
00120
00121 std::string generator;
00122
00123 static const double GeV=1.0;
00124
00125 TFile *m_tfile;
00126
00127 bool switch_truth_lepton_filter;
00128 int truth_lepton_filter_min_nb_leptons;
00129 bool switch_analyse_truth_decay;
00130 bool switch_truth_decay_mode_filter;
00131 bool truth_decay_mode_filter_only_higgs;
00132 bool truth_decay_mode_filter_analyse_ll;
00133 bool truth_decay_mode_filter_analyse_lh;
00134 bool truth_decay_mode_filter_analyse_hh;
00135
00136 double e_presel_pt_min;
00137 double e_presel_eta_max;
00138 double e_presel_eoverp_min;
00139 double e_presel_eoverp_max;
00140 bool e_presel_require_isem_0;
00141 bool e_presel_require_isem_0x3FF;
00142 bool e_presel_require_isem_mod16_0;
00143 double e_presel_min_NeuralNet;
00144 double e_presel_max_etCone02;
00145 double e_presel_max_etCone02_rel;
00146 bool e_presel_noisolation_eta14165;
00147 double e_truth_presel_min_pt;
00148 double e_truth_presel_max_eta;
00149
00150 std::string reco_muons_name;
00151 double mu_presel_pt_min;
00152 double mu_presel_eta_max;
00153 double mu_presel_max_etCone04;
00154 double mu_presel_max_etCone045;
00155 double mu_presel_max_etCone02_rel;
00156 bool mu_presel_use_combined;
00157 bool mu_presel_use_standalone;
00158 bool mu_presel_use_lowpt;
00159 bool mu_presel_require_hasCombinedMuonTrackParticle;
00160 double mu_presel_min_matchChi2;
00161 double mu_presel_max_matchChi2;
00162 double mu_presel_max_matchChi2OverDoF;
00163 double mu_presel_max_fitChi2OverDoF;
00164 double mu_truth_presel_min_pt;
00165 double mu_truth_presel_max_eta;
00166
00167
00168 bool switch_mu_delete_doubles;
00169 bool switch_mu_remove_overlap_e;
00170 double dr_mu_remove_overlap_e;
00171
00172 double taujet_truth_presel_min_pt;
00173 double taujet_truth_presel_max_eta;
00174
00175 bool apply_taujet_correction;
00176 double taujet_presel_min_pt;
00177 double taujet_presel_max_eta;
00178 double taujet_presel_min_llh;
00179 bool taujet_presel_require_charge_1;
00180 bool taujet_presel_require_nb_tracks_13;
00181 bool taujet_presel_require_TRTHitRatio;
00182 double taujet_presel_min_e_over_p;
00183 double taujet_presel_e_ethadoveret_min;
00184
00185 double jet_presel_min_pt;
00186 double jet_presel_max_eta;
00187
00188 double jet_truth_presel_min_pt;
00189 double jet_truth_presel_max_eta;
00190
00191 bool switch_taujet_reco_remove_overlap_e;
00192 bool switch_taujet_reco_remove_overlap_mu;
00193 double dr_taujet_reco_remove_overlap_e;
00194 double dr_taujet_reco_remove_overlap_mu;
00195
00196 bool switch_jet_reco_remove_overlap_e;
00197 double dr_jet_reco_remove_overlap_e;
00198 bool switch_jet_reco_remove_overlap_mu;
00199 double dr_jet_reco_remove_overlap_mu;
00200 bool switch_jet_reco_remove_overlap_taujet;
00201 double dr_jet_reco_remove_overlap_taujet;
00202
00203 bool switch_jet_truth_remove_overlap_e;
00204 double dr_jet_truth_remove_overlap_e;
00205 bool switch_jet_truth_remove_overlap_mu;
00206 double dr_jet_truth_remove_overlap_mu;
00207 bool switch_jet_truth_remove_overlap_taujet;
00208 double dr_jet_truth_remove_overlap_taujet;
00209
00210 std::string recalculate_met_muons;
00211 std::string met_option;
00212 std::string met_muon_contribution;
00213
00214
00215
00216 bool switch_ana_use_e_truth;
00217 bool switch_ana_use_mu_truth;
00218 bool switch_ana_use_taujet_truth;
00219 bool switch_ana_use_jet_truth;
00220
00221 bool switch_only_highpt_jetpair;
00222
00223 int ana_require_trigger_flavour;
00224
00225 int output_level_cand_ntuple;
00226
00227 unsigned int ana_e_nb_min;
00228 unsigned int ana_e_nb_max;
00229 unsigned int ana_mu_nb_min;
00230 unsigned int ana_mu_nb_max;
00231 unsigned int ana_emu_nb_min;
00232 unsigned int ana_emu_nb_max;
00233 unsigned int ana_taujet_nb_min;
00234 unsigned int ana_taujet_nb_max;
00235
00236
00237 double deltaR_jetmatching_cut;
00238 int cuts_total_nb;
00239 std::string cuts[20];
00240
00241 Double_t min_etmiss;
00242 Double_t min_e_pt;
00243 Double_t min_mu_pt;
00244 Double_t min_taujet_pt;
00245
00246 Double_t min_leptons_cosdphi;
00247 Double_t max_leptons_dr;
00248 Double_t min_lept_x;
00249 Double_t min_had_x;
00250 Double_t max_lept_x;
00251 Double_t max_had_x;
00252 Double_t max_x_squaresum;
00253 Double_t max_transverse_mass;
00254 Double_t min_jet1_pt;
00255 Double_t min_jet2_pt;
00256 Double_t min_jets_deta;
00257 Double_t max_jets_dphi;
00258 Double_t min_jets_mass;
00259 Double_t max_bjet_weight;
00260 Double_t min_cj_pt;
00261 Double_t max_cj_eta;
00262 Bool_t switch_cj_between_fwdjets;
00263 Double_t min_leptons_jets_deta;
00264 Double_t max_pt_balance;
00265 Double_t min_mass_window;
00266 Double_t max_mass_window;
00267
00268
00269 #include "HtautauHistos.h"
00270
00271 std::vector<MyParticle*> v_e_reco_aod;
00272 std::vector<MyParticle*> v_e_reco_presel;
00273
00274 std::vector<MyParticle*> v_mu_reco_aod;
00275 std::vector<MyParticle*> v_mu_reco_orm;
00276 std::vector<MyParticle*> v_mu_reco_presel;
00277 std::vector<MyParticle*> v_mu_reco_matched;
00278
00279 std::vector<MyParticle*> v_taujet_reco_aod;
00280 std::vector<MyParticle*> v_garbage;
00281 std::vector<MyParticle*> v_taujet_reco_orm;
00282 std::vector<MyParticle*> v_taujet_reco_presel;
00283 std::vector<MyParticle*> v_taujet_reco_fake;
00284
00285
00286 std::vector<MyParticle*> v_jet_reco_aod;
00287 std::vector<MyParticle*> v_jet_reco_orm;
00288 std::vector<MyParticle*> v_jet_reco_presel;
00289
00290 std::vector<MyParticle*> v_e_truth_aod;
00291 std::vector<MyParticle*> v_e_truth_presel;
00292
00293 std::vector<MyParticle*> v_mu_truth_aod;
00294 std::vector<MyParticle*> v_mu_truth_presel;
00295 std::vector<MyParticle*> v_mu_truth_matched;
00296
00297 std::vector<MyParticle*> v_tau_truth_aod;
00298
00299 std::vector<MyParticle*> v_jet_truth_aod;
00300 std::vector<MyParticle*> v_jet_truth_orm;
00301 std::vector<MyParticle*> v_jet_truth_presel;
00302
00303 std::vector<MyParticle*> v_taujet_truth;
00304
00305
00306 std::vector<MyParticle*> v_taujet_truth_all;
00307 std::vector<MyParticle*> v_taujet_truth_orm;
00308 std::vector<MyParticle*> v_taujet_truth_presel;
00309
00310
00311
00312
00313 std::vector<MyParticle*> v_e_ana;
00314 std::vector<MyParticle*> v_mu_ana;
00315 std::vector<MyParticle*> v_taujet_ana;
00316 std::vector<MyParticle*> v_jet_ana;
00317 MyMissingEtManager missinget_ana;
00318 std::vector<MyVBFCandidate*> v_candidates_ana;
00319 bool has_leptonpair;
00320 bool has_jetpair;
00321
00322
00323
00324 std::vector<MyCollinearApproximation> v_coll_app;
00325
00326
00327 MyTools m_tools;
00328
00329 MyTruthParticleManager m_truth_manager;
00330
00331 int primary_particle_mode;
00332
00333
00334
00335
00336 int primary_particle_decay_mode;
00337 int tau_0_decay_mode;
00338
00339
00340
00341
00342
00343
00344
00345
00346 int tau_1_decay_mode;
00347 int higgs_decay_mode;
00348
00349 TString decay_mode_string;
00350 int decay_mode;
00351
00352
00353
00354
00355
00356
00357 void init(void);
00358 void clear_event_data(void);
00359
00360
00361 void destruct(void);
00362
00363 void cut_based_anlysis(
00364 const MyMissingEtManager missinget_in);
00365 std::vector<MyVBFCandidate*>
00366 build_candidates( std::vector<MyParticle*> v_e_cand,
00367 std::vector<MyParticle*> v_mu_cand,
00368 std::vector<MyParticle*> v_tau_cand,
00369 std::vector<MyParticle*> v_jet_cand,
00370 MyMissingEt missing_et);
00372
00373 void cut_offline_trigger(MyVBFCandidate* candidate);
00374 void cut_online_trigger(MyVBFCandidate* candidate);
00375 void cut_number_emu(MyVBFCandidate* candidate);
00376 void cut_number_taujets(MyVBFCandidate* candidate);
00377 void cut_number_jets(MyVBFCandidate* candidate);
00378 void cut_etmiss(MyVBFCandidate* candidate);
00379 void cut_lepton_pt(MyVBFCandidate* candidate);
00380 void cut_leptons_charge(MyVBFCandidate* candidate);
00381 void cut_leptons_dphi(MyVBFCandidate* candidate);
00382 void cut_leptons_dr(MyVBFCandidate* candidate);
00383 void cut_collinear_approximation(MyVBFCandidate* candidate);
00384 void cut_transverse_mass(MyVBFCandidate* candidate);
00385 void cut_jets_pt(MyVBFCandidate* candidate);
00386 void cut_jets_hemisphere(MyVBFCandidate* candidate);
00387 void cut_jets_deta(MyVBFCandidate* candidate);
00388 void cut_jets_dphi(MyVBFCandidate* candidate);
00389 void cut_jets_mass(MyVBFCandidate* candidate);
00390 void cut_bjet_veto(MyVBFCandidate* candidate);
00391 void cut_central_jet_veto(MyVBFCandidate* candidate);
00392 void cut_leptons_jets_deta(MyVBFCandidate* candidate);
00393 void cut_pt_balance(MyVBFCandidate* candidate);
00394 void cut_mass_window(MyVBFCandidate* candidate);
00395 MyVBFCandidate* choose_candidate(std::vector<MyVBFCandidate*> v_candidates_tmp);
00396
00397 void fill_raw_aod_content_histos(void);
00398
00399
00400 std::vector<MyParticle*> preselect_electrons(
00401 const std::vector<MyParticle*> v_particle);
00402
00403
00404 std::vector<MyParticle*> preselect_truth_electrons(
00405 const std::vector<MyParticle*> v_particle);
00406
00407
00408 std::vector<MyParticle*> preselect_muons(
00409 const std::vector<MyParticle*> v_particle);
00410
00411
00412 std::vector<MyParticle*> preselect_truth_muons(
00413 const std::vector<MyParticle*> v_particle);
00414
00415
00416 std::vector<MyParticle*> preselect_taujets(
00417 const std::vector<MyParticle*> v_particle);
00418
00419
00420 std::vector<MyParticle*> preselect_truth_taujets(
00421 const std::vector<MyParticle*> v_particle);
00422
00423
00424 std::vector<MyParticle*> preselect_jets(
00425 const std::vector<MyParticle*> v_particle);
00426
00427
00428 std::vector<MyParticle*> preselect_truth_jets(
00429 const std::vector<MyParticle*> v_particle);
00430
00431
00432 MyParticle visible_part_of_decay_products(MyTruthParticle* part_in);
00433
00434 std::vector<MyParticle*> create_truth_taujets(std::vector<MyParticle*> v_particle);
00435
00436
00437
00438 std::vector<MyParticle*> create_corrected_taujets(std::vector<MyParticle*> v_particle);
00439
00440
00441 void delete_truth_taujets(void);
00442
00443 void match_electrons(
00444 std::vector<MyParticle*> v_e_reco, std::vector<MyParticle*> v_e_truth);
00445
00446 void match_muons(
00447 std::vector<MyParticle*> v_mu_reco, std::vector<MyParticle*> v_mu_truth);
00448
00449 void match_taujets(
00450 std::vector<MyParticle*> v_taujet_reco, std::vector<MyParticle*> v_taujet_truth);
00451
00452 void match_jets(
00453 std::vector<MyParticle*> v_jet_reco, std::vector<MyParticle*> v_jet_truth);
00454
00455 void match_fake_taujets(void);
00456
00457 void add_recalculated_missinget(MyMissingEtManager *orig_missing_et);
00458
00459 int n_pt_above(const std::vector<MyParticle*> v_particle, const double ptcut);
00460
00461 int tau_decay_mode(MyTruthParticle* truth_tau);
00462 void calculate_decay_mode(void);
00463 void fill_decay_mode_hists(bool print_info);
00464 void fill_lepton_hists(const std::vector<MyVBFCandidate*> v_candidates_tmp, const int cut_number);
00465 void fill_jet_hists(const std::vector<MyVBFCandidate*> v_candidates_tmp, const int cut_number);
00466
00467 int check_truth_lepton_filter(void);
00468 void analyse_truth_decay(void);
00469 void fill_all_ana_histos(const std::vector<MyVBFCandidate*> v_candidates_tmp, const int cut_number);
00470 void fill_candidate_ntuple(const std::vector<MyVBFCandidate*> v_candidates_tmp);
00471
00472 std::vector<MyParticlePair>
00473 get_tagjet_pairs(std::vector<MyVBFCandidate*> vec_candidates);
00475
00476 std::vector<MyParticlePair>
00477 get_lepton_pairs(std::vector<MyVBFCandidate*> vec_candidates);
00479
00480 std::vector<MyParticle*>
00481 get_tagjets(std::vector<MyParticlePair> vec_tagjet_pairs);
00483
00484 std::vector<MyParticle*>
00485 get_leptons(std::vector<MyParticlePair> vec_lepton_pairs);
00487 std::vector<MyParticle*>
00488 get_centraljet_candidates(std::vector<MyParticle*> vec_jets_tmp, MyVBFCandidate* candidate);
00490 double get_transverse_mass(MyVBFCandidate* candidate_tmp);
00491 double get_max_btag_weight(MyVBFCandidate* candidate_tmp, std::vector<MyParticle*> vec_jets_tmp);
00492 void check_bjet_performance(std::vector<MyParticle*> v_jet_reco_presel);
00493 MyTruthParticle* get_next_mother(MyTruthParticle* part);
00494 bool TTbarLeptonFilter();
00495
00496 TH1F* h_Wplus_Jetcharge;
00497 TH1F* h_Wminus_Jetcharge;
00498 TH1F* h_Wplus_JetpdgIds;
00499 TH1F* h_Wminus_JetpdgIds;
00500 void JetOriginInvest(std::vector<MyParticle*> jets_to_invest);
00501 };
00502
00503 #endif