00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "MyAnalysisExample/MyAnalysisExample.h"
00014
00015
00016
00017
00018
00019 using namespace std;
00020
00021
00022
00023
00024
00025
00026
00027 void MyAnalysisExample::init(void) {
00028
00029 filename = "testfile";
00030 return;
00031
00032 }
00033
00034
00035
00036
00037
00038
00039
00040 void MyAnalysisExample::destruct(void) {
00041
00042 return;
00043
00044 }
00045
00046
00047
00048
00049
00050
00051
00052 void MyAnalysisExample::initialize(void) {
00053
00055
00057
00058
00059 m_tfile = new TFile( filename.ReplaceAll(".aan",".selection") , "RECREATE");
00060
00061
00063
00065
00066 m_nb_electrons = new TH1F("nb_electrons",
00067 "NUMBER OF RECONSTRUCTED ELECTRONS / EVENT",
00068 11, -0.5, 10.5);
00069 m_e_energy = new TH1F("e_energy", "ELECTRON ENERGY (GeV)",
00070 201, -0.5, 200.5);
00071 m_e_pt = new TH1F("e_pt", "ELECTRON PT (GeV)",
00072 201, -0.5, 200.5);
00073 m_nb_muons = new TH1F("nb_muons",
00074 "NUMBER OF RECONSTRUCTED MUONS / EVENT",
00075 11, -0.5, 10.5);
00076 m_nb_jets = new TH1F("nb_jets",
00077 "NUMBER OF RECONSTRUCTED JETS / EVENT",
00078 11, -0.5, 10.5);
00079
00080 m_missinget_x = new TH1F("missinget_x",
00081 "MISSING ET IN X DIRECTION",
00082 1001, -500.5, 500.5);
00083
00084 h_nb_matchedjets = new TH1F("nb_matchedjets",
00085 "NUMBER OF MATCHED JETS / EVENT",
00086 11, -0.5, 10.5);
00087
00088 h_nb_fakedjets = new TH1F("nb_fakedjets",
00089 "NUMBER OF FAKED JETS / EVENT",
00090 11, -0.5, 10.5);
00091
00092
00093
00094 return;
00095
00096 }
00097
00098
00099
00100
00101
00102
00103
00104 void MyAnalysisExample::analyse_event(const MyEvent & event) {
00105
00107
00109
00110
00111 m_nb_electrons->Fill(event.reco_electrons().size(), 1.0);
00112 m_nb_muons->Fill(event.reco_muons().size(), 1.0);
00113 m_nb_jets->Fill(event.reco_jets().size(), 1.0);
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 for (unsigned int k=0; k<event.reco_electrons().size(); k++) {
00133 m_e_pt->Fill(event.reco_electrons()[k]->tlv().Pt(),1.0);
00134 }
00135
00136
00137
00138
00139 m_missinget_x->Fill(event.met_manager().get_missinget("MET_RefFinal").met_x(),1.0);
00140
00141
00142
00143 int nb_matchedjets = 0;
00144 int nb_fakedjets = 0;
00145
00146 std::vector<MyParticle*>
00147 selected_truthjets = select_jets( event.truth_jets() );
00148
00149 for (unsigned int k=0; k<event.reco_jets().size(); k++) {
00150
00151 MyParticle* tmp_jet = NULL;
00152
00153 tmp_jet =
00154 (MyParticle*)m_tools.find_matching_particle( event.reco_jets()[k],
00155 selected_truthjets
00156 );
00157
00158 if(tmp_jet!=NULL) nb_matchedjets++;
00159 else nb_fakedjets++;
00160
00161 }
00162
00163 h_nb_matchedjets->Fill(nb_matchedjets);
00164 h_nb_fakedjets->Fill(nb_fakedjets);
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174 return;
00175
00176 }
00177
00178
00179
00180
00181
00182
00183
00184 std::vector<MyParticle*>
00185 MyAnalysisExample::select_jets( std::vector<MyParticle*> jet_vector){
00186
00187 std::vector<MyParticle*> selected_jets(0);
00188
00189 for (unsigned int k=0; k<jet_vector.size(); k++) {
00190
00191
00192
00193 selected_jets.push_back( jet_vector[k] );
00194
00195
00196 }
00197
00198 return selected_jets;
00199
00200 }
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210 void MyAnalysisExample::end_of_analysis(void) {
00211
00212
00213
00214
00215
00216 Int_t multiplematches1 = m_tools.nb_multiple_matches();
00217 m_tools.clear_nb_multiple_matches();
00218 Int_t multiplematches2 = m_tools.nb_multiple_matches();
00219
00220 cout << "multiplematches1: " << multiplematches1 << endl;
00221 cout << "multiplematches2: " << multiplematches2 << endl;
00222
00223
00224
00225
00226
00227
00228 m_tfile->Write();
00229
00230 return;
00231
00232 }