00001 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00002 // 07.11.2006, AUTHOR: OLIVER KORTNER, STEFFEN KAISER 00003 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00004 00005 #ifndef NtupleReaderH 00006 #define NtupleReaderH 00007 00008 //:::::::::::::::::::::::: 00009 //:: CLASS NtupleReader :: 00010 //:::::::::::::::::::::::: 00011 00022 00023 //:::::::::::::::::: 00024 //:: HEADER FILES :: 00025 //:::::::::::::::::: 00026 00027 // STL // 00028 #include <string> 00029 #include <vector> 00030 #include <map> 00031 00032 // ROOT // 00033 #include "TChain.h" 00034 #include "TFile.h" 00035 #include "TTree.h" 00036 #include "TArrayF.h" 00037 #include "TArrayI.h" 00038 #include "MyTrigger.h" 00039 00040 // analysis and event classes// 00041 #include "MyAnalysis.h" 00042 #include "MyDatasetInfo.h" 00043 00044 class NtupleReader { 00045 00046 public: 00047 00048 // Constructors // 00049 NtupleReader(const std::vector<std::string> & file_name, 00050 const std::string & tree_name, 00051 MyAnalysis * analysis) { 00052 init(file_name, tree_name, analysis); 00053 } 00058 00059 ~NtupleReader(void) { 00060 destruct(); 00061 } 00063 00064 // Methods // 00065 void event_loop(Int_t nb_events = -1, Int_t first_event = 0); 00069 00070 private: 00071 00072 static const double m_gev = 0.001; 00073 00074 // The MyDatasetInfo object 00075 MyDatasetInfo *m_dataset_info; 00076 00077 // first data file, for getting dataset info 00078 // TFile* m_first_file; 00079 00080 // The MyTrigger object 00081 MyTrigger* m_trigger; 00082 // data file and data tree // 00083 TChain *m_chain; // chain containing the data trees 00084 00085 int m_release; 00086 int m_svnversion; 00087 00088 // tree variables // 00089 Int_t RunNumber; 00090 Int_t EventNumber; 00091 Char_t StreamATLFAST_ref; 00092 Char_t Stream1_ref[153]; 00093 Char_t Token[153]; 00094 Int_t Run; 00095 Int_t Event; 00096 Int_t Time; 00097 Double_t Weight; 00098 Int_t IEvent; 00099 00100 std::vector<std::string> *trigger_keys_l1; 00101 std::vector<int> *trigger_keys_status_l1; 00102 std::vector<std::string> *trigger_keys_l2; 00103 std::vector<int> *trigger_keys_status_l2; 00104 std::vector<std::string> *trigger_keys_ef; 00105 std::vector<int> *trigger_keys_status_ef; 00106 00107 Int_t nb_trigger_mu_lvl1; 00108 std::vector<double> *trigger_mu_lvl1_eta; 00109 std::vector<double> *trigger_mu_lvl1_phi; 00110 std::vector<int> *trigger_mu_lvl1_threshold_number; 00111 std::vector<double> *trigger_mu_lvl1_threshold_value; 00112 std::vector<std::string> *trigger_mu_lvl1_threshold_name; 00113 Int_t nb_trigger_mu_lvl2; 00114 std::vector<double> *trigger_mu_lvl2_eta; 00115 std::vector<double> *trigger_mu_lvl2_phi; 00116 std::vector<double> *trigger_mu_lvl2_pt; 00117 std::vector<double> *trigger_mu_lvl2_sigma_pt; 00118 Int_t nb_trigger_mu_ef; 00119 std::vector<double> *trigger_mu_ef_eta; 00120 std::vector<double> *trigger_mu_ef_phi; 00121 std::vector<double> *trigger_mu_ef_pt; 00122 std::vector<double> *trigger_mu_ef_charge1; 00123 std::vector<int> *trigger_mu_ef_code; 00124 Double_t trigger_met_ex; 00125 Double_t trigger_met_ey; 00126 Double_t trigger_met_et; 00127 Double_t trigger_met_sumEt; 00128 00129 Int_t nb_rec_tracks; 00130 std::vector<double> *track_p_x; 00131 std::vector<double> *track_p_y; 00132 std::vector<double> *track_p_z; 00133 std::vector<double> *track_E; 00134 std::vector<double> *track_charge; 00135 std::vector<int> *track_vertex_index; 00136 std::vector<int> *track_SCThit; 00137 std::vector<int> *track_Phit; 00138 std::vector<int> *track_BLayerhit; 00139 std::vector<int> *track_TRThit; 00140 std::vector<int> *track_MDThit; 00141 std::vector<int> *track_CSChit_eta; 00142 std::vector<int> *track_TGChit_eta; 00143 std::vector<int> *track_RPChit_eta; 00144 std::vector<int> *track_CSChit_phi; 00145 std::vector<int> *track_TGChit_phi; 00146 std::vector<int> *track_RPChit_phi; 00147 std::vector<double> *track_d0; 00148 std::vector<double> *track_z0; 00149 std::vector<double> *track_chi2; 00150 std::vector<double> *track_nDoF; 00151 std::vector<double> *track_trackIsolationEnergy_s; 00152 std::vector<double> *track_trackIsolationEnergy_0; 00153 std::vector<double> *track_trackIsolationEnergy_1; 00154 std::vector<double> *track_trackIsolationEnergy_2; 00155 std::vector<double> *track_trackIsolationEnergy_3; 00156 00157 Int_t nb_rec_electrons; 00158 std::vector<double> *e_p_x; 00159 std::vector<double> *e_p_y; 00160 std::vector<double> *e_p_z; 00161 std::vector<double> *e_E; 00162 std::vector<double> *e_calo_p_x; 00163 std::vector<double> *e_calo_p_y; 00164 std::vector<double> *e_calo_p_z; 00165 std::vector<double> *e_calo_E; 00166 std::vector<double> *e_charge; 00167 std::vector<double> *e_NeuralNet; 00168 std::vector<double> *e_isEM; 00169 std::vector<int> *e_id_flag; 00170 std::vector<int> *e_egamma_flag; 00171 std::vector<int> *e_softe_flag; 00172 std::vector<double> *e_E_over_p; 00173 std::vector<int> *e_TRTHighThresholdHits; 00174 std::vector<int> *e_TRTHits; 00175 std::vector<double> *e_ethad1; 00176 std::vector<double> *e_Et_in_cone_0; 00177 std::vector<double> *e_Et_in_cone_1; 00178 std::vector<double> *e_Et_in_cone_2; 00179 std::vector<double> *e_Et_in_cone_3; 00180 std::vector<int> *e_vertex_index; 00181 std::vector<double> *e_track_Et_in_cone_0; 00182 std::vector<double> *e_track_Et_in_cone_1; 00183 std::vector<double> *e_track_Et_in_cone_2; 00184 std::vector<double> *e_track_Et_in_cone_3; 00185 std::vector<double> *e_trackIsolationEnergy_0; 00186 std::vector<double> *e_trackIsolationEnergy_1; 00187 std::vector<double> *e_trackIsolationEnergy_2; 00188 std::vector<double> *e_trackIsolationEnergy_3; 00189 00190 Int_t nb_rec_photons; 00191 std::vector<double> *p_calo_p_x; 00192 std::vector<double> *p_calo_p_y; 00193 std::vector<double> *p_calo_p_z; 00194 std::vector<double> *p_calo_E; 00195 std::vector<double> *p_charge; 00196 std::vector<double> *p_NeuralNet; 00197 std::vector<double> *p_isEM; 00198 std::vector<int> *p_egamma_flag; 00199 std::vector<double> *p_Et_in_cone_0; 00200 std::vector<double> *p_Et_in_cone_1; 00201 std::vector<double> *p_Et_in_cone_2; 00202 std::vector<double> *p_Et_in_cone_3; 00203 00204 Int_t nb_rec_muons; 00205 std::vector<int> *mu_alg_flag; 00206 std::vector<double> *mu_p_x; 00207 std::vector<double> *mu_p_y; 00208 std::vector<double> *mu_p_z; 00209 std::vector<double> *mu_E; 00210 std::vector<double> *mu_charge; 00211 std::vector<int> *mu_rec_flag; 00212 std::vector<int> *mu_hasCombinedMuonTrackParticle; 00213 std::vector<double> *mu_Et_in_cone_0; 00214 std::vector<double> *mu_Et_in_cone_1; 00215 std::vector<double> *mu_Et_in_cone_2; 00216 std::vector<double> *mu_Et_in_cone_3; 00217 std::vector<double> *mu_Et_in_cone_4; 00218 std::vector<double> *mu_Et_in_cone_5; 00219 std::vector<double> *mu_Et_in_cone_6; 00220 std::vector<double> *mu_Et_in_cone_7; 00221 std::vector<int> *mu_nb_tracks_in_cone_0; 00222 std::vector<int> *mu_nb_tracks_in_cone_1; 00223 std::vector<int> *mu_nb_tracks_in_cone_2; 00224 std::vector<int> *mu_nb_tracks_in_cone_3; 00225 std::vector<int> *mu_nb_tracks_in_cone_4; 00226 std::vector<int> *mu_nb_tracks_in_cone_5; 00227 std::vector<int> *mu_nb_tracks_in_cone_6; 00228 std::vector<int> *mu_nb_tracks_in_cone_7; 00229 std::vector<double> *mu_fitChi2; 00230 std::vector<int> *mu_fitNumberDoF; 00231 std::vector<double> *mu_fitChi2OverDoF; 00232 std::vector<double> *mu_matchChi2; 00233 std::vector<int> *mu_matchNumberDoF; 00234 std::vector<double> *mu_matchChi2OverDoF; 00235 std::vector<int> *mu_vertex_index; 00236 std::vector<double> *mu_track_Et_in_cone_0; 00237 std::vector<double> *mu_track_Et_in_cone_1; 00238 std::vector<double> *mu_track_Et_in_cone_2; 00239 std::vector<double> *mu_track_Et_in_cone_3; 00240 std::vector<double> *mu_track_Et_in_cone_4; 00241 std::vector<double> *mu_track_Et_in_cone_5; 00242 std::vector<double> *mu_track_Et_in_cone_6; 00243 std::vector<double> *mu_track_Et_in_cone_7; 00244 std::vector<double> *mu_trackIsolationEnergy_0; 00245 std::vector<double> *mu_trackIsolationEnergy_1; 00246 std::vector<double> *mu_trackIsolationEnergy_2; 00247 std::vector<double> *mu_trackIsolationEnergy_3; 00248 std::vector<double> *mu_trackIsolationEnergy_4; 00249 std::vector<double> *mu_trackIsolationEnergy_5; 00250 std::vector<double> *mu_trackIsolationEnergy_6; 00251 std::vector<double> *mu_trackIsolationEnergy_7; 00252 00253 00254 Int_t nb_rec_jets; 00255 std::vector<double> *jet_p_x; 00256 std::vector<double> *jet_p_y; 00257 std::vector<double> *jet_p_z; 00258 std::vector<double> *jet_E; 00259 std::vector<int> *jet_flag; 00260 std::vector<double> *jet_btag_weight; 00261 std::vector<int> *jet_truthflavor; 00262 std::vector<int> *jet_nb_tracks; 00263 std::vector<double> *jet_tracks_charge; 00264 std::vector< std::vector <double> > v_jet_tracks_charge; 00265 std::vector<double> *jet_tracks_p_x; 00266 std::vector< std::vector <double> > v_jet_tracks_px; 00267 std::vector<double> *jet_tracks_p_y; 00268 std::vector< std::vector <double> > v_jet_tracks_py; 00269 std::vector<double> *jet_tracks_p_z; 00270 std::vector< std::vector <double> > v_jet_tracks_pz; 00271 std::vector<double> *jet_tracks_E; 00272 std::vector< std::vector <double> > v_jet_tracks_E; 00273 std::vector<int> *jet_tracks_vertex_index; 00274 std::vector< std::vector <int> > v_jet_tracks_vertex_index; 00275 std::vector< std::vector <TLorentzVector> > v_jet_tracks_tlv; 00276 00277 00278 00279 Int_t nb_tau_jets; 00280 std::vector<double> *taujet_p_x; 00281 std::vector<double> *taujet_p_y; 00282 std::vector<double> *taujet_p_z; 00283 std::vector<double> *taujet_E; 00284 std::vector<int> *taujet_flag; 00285 std::vector<double> *taujet_charge; 00286 std::vector<double> *taujet_emRadius; 00287 std::vector<double> *taujet_isolationFraction; 00288 std::vector<double> *taujet_centralityFraction; 00289 std::vector<double> *taujet_stripWidth2; 00290 std::vector<double> *taujet_nStripCells; 00291 std::vector<double> *taujet_llh; 00292 std::vector<double> *taujet_lowPtTauEleDiscriminant; 00293 std::vector<double> *taujet_tauENeuralNetwork; 00294 std::vector<double> *taujet_tauJetNeuralnetwork; 00295 std::vector<double> *taujet_etHadCalib; 00296 std::vector<double> *taujet_etEMCalib; 00297 std::vector<int> *taujet_nb_tracks; 00298 std::vector<double> *taujet_track_px_1; 00299 std::vector<double> *taujet_track_py_1; 00300 std::vector<double> *taujet_track_pz_1; 00301 std::vector<double> *taujet_track_e_1; 00302 std::vector<int> *taujet_track_TRTHighThresholdHits_1; 00303 std::vector<int> *taujet_track_TRTHits_1; 00304 std::vector<double> *taujet_track_px_2; 00305 std::vector<double> *taujet_track_py_2; 00306 std::vector<double> *taujet_track_pz_2; 00307 std::vector<double> *taujet_track_e_2; 00308 std::vector<int> *taujet_track_TRTHighThresholdHits_2; 00309 std::vector<int> *taujet_track_TRTHits_2; 00310 std::vector<double> *taujet_track_px_3; 00311 std::vector<double> *taujet_track_py_3; 00312 std::vector<double> *taujet_track_pz_3; 00313 std::vector<double> *taujet_track_e_3; 00314 std::vector<int> *taujet_track_TRTHighThresholdHits_3; 00315 std::vector<int> *taujet_track_TRTHits_3; 00316 00317 Int_t nb_truth_jets; 00318 std::vector<double> *truth_jet_p_x; 00319 std::vector<double> *truth_jet_p_y; 00320 std::vector<double> *truth_jet_p_z; 00321 std::vector<double> *truth_jet_E; 00322 std::vector<int> *truth_jet_flag; 00323 std::vector<double> *truth_jet_btag_weight; 00324 00325 Int_t nb_truth_particle_all; 00326 Int_t nb_truth_particle; 00327 std::vector<double> *truth_particle_pt; 00328 std::vector<int> *truth_particle_status; 00329 std::vector<int> *truth_particle_barcode; 00330 std::vector<int> *truth_particle_pdgId; 00331 std::vector<int> *truth_particle_nDaughters; 00332 std::vector<double> *truth_particle_p_x; 00333 std::vector<double> *truth_particle_p_y; 00334 std::vector<double> *truth_particle_p_z; 00335 std::vector<double> *truth_particle_E; 00336 std::vector<double> *truth_particle_charge; 00337 std::vector<int> *truth_particle_nParents; 00338 std::vector<int> *truth_particle_mother0_barcode; 00339 std::vector<int> *truth_particle_mother0_pdgId; 00340 std::vector<int> *truth_particle_vertex_index; 00341 std::vector<double> *truth_particle_Et_in_cone_0; 00342 std::vector<double> *truth_particle_Et_in_cone_1; 00343 std::vector<double> *truth_particle_Et_in_cone_2; 00344 std::vector<double> *truth_particle_Et_in_cone_3; 00345 std::vector<double> *truth_particle_Et_in_cone_4; 00346 00347 std::vector<std::string> *missing_Et_object; 00348 std::vector<double> *missing_Etx; 00349 std::vector<double> *missing_Ety; 00350 std::vector<double> *missing_Et; 00351 std::vector<double> *missing_Etsum; 00352 00353 00354 Int_t nb_vertices; 00355 std::vector<double> *vertex_position_x; 00356 std::vector<double> *vertex_position_y; 00357 std::vector<double> *vertex_position_z; 00358 std::vector<double> *vertex_pos_error_x; 00359 std::vector<double> *vertex_pos_error_y; 00360 std::vector<double> *vertex_pos_error_z; 00361 std::vector<double> *vertex_chi2; 00362 std::vector<int> *vertex_ndof; 00363 std::vector<double> *vertex_Et; 00364 std::vector<int> *vertex_nb_tracks; 00365 00366 Int_t nb_truth_vertices; 00367 std::vector<double> *truth_vertex_position_x; 00368 std::vector<double> *truth_vertex_position_y; 00369 std::vector<double> *truth_vertex_position_z; 00370 std::vector<double> *truth_vertex_Et; 00371 std::vector<int> *truth_vertex_nb_tracks; 00372 00373 00374 Int_t nb_track_jets; 00375 std::vector<double> *track_jet_p_x; 00376 std::vector<double> *track_jet_p_y; 00377 std::vector<double> *track_jet_p_z; 00378 std::vector<double> *track_jet_E; 00379 00380 Int_t nb_truth_track_jets; 00381 std::vector<double> *truth_track_jet_p_x; 00382 std::vector<double> *truth_track_jet_p_y; 00383 std::vector<double> *truth_track_jet_p_z; 00384 std::vector<double> *truth_track_jet_E; 00385 00386 00387 // analysis class // 00388 MyAnalysis *m_analysis; 00389 00390 // private methods // 00391 void init(const std::vector<std::string> & file_name, 00392 const std::string & tree_name, 00393 MyAnalysis * analysis); 00396 void destruct(void); 00397 // destruction method 00398 void delete_new_objects(std::vector<MyParticle*> tmp_vector); 00401 }; 00402 00403 #endif