14 for(
int i=0;(unsigned)
i<v.size();
i++)
22 gStyle->SetOptStat(0);
24 unsigned col1 = kOrange+7;
25 unsigned col2 = kBlue+2;
28 string type[4] = {
"3pion",
"SM",
"DIScharged",
"DISneutral"};
29 string seed[10] = {
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10"};
33 TChain chain(
"event");
34 TChain chain_tau(
"event");
39 string filename =
"./data/Event_topology.csv";
40 myfile.open(filename.c_str());
43 for (
int b = 0;
b<2;
b++){
44 for (
int g = 0;
g<10;
g++){
46 if(
b == 1 &&
g==0)
continue;
47 string file =
"/gpfs/mnt/gpfs02/phenix/scratch/spjeffas/data/LeptoAna_p250_e20_1000events_"+seed[
g]+
"seed_"+type[
b]+
"_r0"+R_max+
".root";
49 if(
b==0) chain_tau.Add(file.c_str());
50 else chain.Add(file.c_str());
54 for(
int b = 1;
b<2;
b++){
55 for(
int g=0;
g<1;
g++){
57 string inputFile =
"/gpfs/mnt/gpfs02/phenix/scratch/spjeffas/data/LeptoAna_p250_e20_1000events_"+seed[
g]+
"seed_"+type[
b]+
"_r05.root";
59 t.Add(inputFile.c_str());
66 TCanvas* ctemp =
new TCanvas();
68 vector< TString > observables;
69 vector< TString > observables_name;
71 vector< float > plots_ymax;
72 vector< float > plots_xmin;
73 vector< float > plots_xmax;
76 observables.push_back(
"tracks_rmax_r04" );
77 observables_name.push_back(
"R_{track}^{max}" );
78 plots_ymax.push_back(0.06);
79 plots_xmin.push_back(0);
80 plots_xmax.push_back(0.4);
83 observables.push_back(
"tracks_count_r04" );
84 observables_name.push_back(
"N_{tracks}" );
85 plots_ymax.push_back(0.9);
86 plots_xmin.push_back(0);
87 plots_xmax.push_back(10);
90 observables.push_back(
"tracks_chargesum_r04" );
91 observables_name.push_back(
"#Sigma q_{tracks}" );
92 plots_ymax.push_back(0.9);
93 plots_xmin.push_back(-5);
94 plots_xmax.push_back(5);
97 observables.push_back(
"jetshape_radius" );
98 observables_name.push_back(
"R_{jet}" );
99 plots_ymax.push_back(0.08);
100 plots_xmin.push_back(0);
101 plots_xmax.push_back(0.5);
104 observables.push_back(
"jetshape_econe_r01 / jetshape_econe_r05" );
105 observables_name.push_back(
"E_{cone}^{R<0.1} / E_{cone}^{R<0.5}" );
106 plots_ymax.push_back(0.08);
107 plots_xmin.push_back(0);
108 plots_xmax.push_back(1);
111 observables.push_back(
"jetshape_econe_r02 / jetshape_econe_r05" );
112 observables_name.push_back(
"E_{cone}^{R<0.2} / E_{cone}^{R<0.5}" );
113 plots_ymax.push_back(0.08);
114 plots_xmin.push_back(0);
115 plots_xmax.push_back(1);
118 observables.push_back(
"jet_eta" );
119 observables_name.push_back(
"#eta_{jet}" );
120 plots_ymax.push_back(0.1);
121 plots_xmin.push_back(-1);
122 plots_xmax.push_back(3);
125 observables.push_back(
"jet_minv" );
126 observables_name.push_back(
"Mass_{jet} (GeV)" );
127 plots_ymax.push_back(0.1);
128 plots_xmin.push_back(0);
129 plots_xmax.push_back(10);
132 observables.push_back(
"jet_etotal" );
133 observables_name.push_back(
"E_{jet} (GeV)" );
134 plots_ymax.push_back(0.08);
135 plots_xmin.push_back(0);
136 plots_xmax.push_back(70);
139 observables.push_back(
"tracks_vertex" );
140 observables_name.push_back(
"vertex distance (cm)" );
141 plots_ymax.push_back(0.6);
142 plots_xmin.push_back(0);
143 plots_xmax.push_back(1);
147 TString name_uds_base(
"h_uds_");
148 TString name_tau_base(
"h_tau_");
150 const int nvar = observables.size();
155 TString name_uds_i = name_uds_base;
156 TString name_tau_i = name_tau_base;
159 for (
unsigned j = 0;
j < observables.size();
j++ ){
160 name_uds_i = name_uds_base;
161 name_tau_i = name_tau_base;
163 name_uds_i.Append(
j);
164 name_tau_i.Append(
j);
166 h_uds[
j] =
new TH1F( name_uds_i,
"", 100, plots_xmin.at(
j), plots_xmax.at(
j));
167 h_tau[
j] =
new TH1F( name_tau_i,
"", 100, plots_xmin.at(
j), plots_xmax.at(
j));
171 for (
unsigned i = 0;
i < observables.size();
i++ )
177 name_uds_i = name_uds_base;
178 name_tau_i = name_tau_base;
180 name_uds_i.Append(
i);
181 name_tau_i.Append(
i);
185 h_uds[
i]->Scale(1./h_uds[
i]->Integral());
186 h_uds[
i]->GetXaxis()->SetTitle( observables_name.at(
i) );
187 h_uds[
i]->GetYaxis()->SetRangeUser(0, plots_ymax.at(
i) );
188 h_uds[
i]->SetLineColor(col1);
189 h_uds[
i]->SetFillColor(col1);
190 h_uds[
i]->SetFillStyle(1001);
191 h_uds[
i]->GetYaxis()->SetTitle(
"# entries / #Sigma entries");
192 h_uds[
i]->GetYaxis()->SetTitleOffset(1.5);
196 h_tau[
i]->Scale(1./h_tau[
i]->Integral());
197 h_tau[
i]->SetLineColor(col2);
198 h_tau[
i]->SetFillColor(col2);
199 h_tau[
i]->SetFillStyle(0);
203 TCanvas *c1 =
new TCanvas();
205 h_uds[
i]->DrawClone(
"");
206 h_tau[
i]->DrawClone(
"sames");
209 TLegend *legend =
new TLegend(0.4,0.6,0.7,0.89);
210 legend->AddEntry(h_uds[
i],
"SM parton jet",
"l");
211 legend->AddEntry(h_tau[i],
"LQ #tau jet",
"l");
219 vector<float> * tracks_rmax;
220 vector<float> * tracks_count;
221 vector<float> * tracks_chargesum;
222 vector<float> * tracks_vertex;
223 vector<float> * jetshape_radius;
224 vector<float> * jetshape_econe_1;
225 vector<float> * jetshape_econe_2;
226 vector<float> * jetshape_econe_5;
227 vector<float> * jet_eta;
228 vector<float> * jet_phi;
229 vector<float> * jet_minv;
230 vector<float> * jet_etotal;
231 vector<float> * jet_ptrans;
232 vector<float> * evtgen_pid;
240 t.SetBranchAddress(
"tracks_rmax_R",&tracks_rmax);
241 t.SetBranchAddress(
"tracks_count_R",&tracks_count);
242 t.SetBranchAddress(
"tracks_chargesum_R",&tracks_chargesum);
243 t.SetBranchAddress(
"tracks_vertex",&tracks_vertex);
244 t.SetBranchAddress(
"jetshape_radius",&jetshape_radius);
245 t.SetBranchAddress(
"jetshape_econe_r01",&jetshape_econe_1);
246 t.SetBranchAddress(
"jetshape_econe_r02",&jetshape_econe_2);
247 t.SetBranchAddress(
"jetshape_econe_r05",&jetshape_econe_5);
248 t.SetBranchAddress(
"jet_eta",&jet_eta);
249 t.SetBranchAddress(
"jet_phi",&jet_phi);
250 t.SetBranchAddress(
"jet_minv",&jet_minv);
251 t.SetBranchAddress(
"jet_etotal",&jet_etotal);
252 t.SetBranchAddress(
"evtgen_pid",&evtgen_pid);
253 t.SetBranchAddress(
"jet_ptrans",&jet_ptrans);
254 t.SetBranchAddress(
"Et_miss",&ptmiss);
255 t.SetBranchAddress(
"Et_miss_phi",&miss_phi);
256 t.SetBranchAddress(
"is_lq_event",&is_lq);
268 double lik_cut = 0.71;
270 int n_tot = t.GetEntries();
273 for(
int k = 0;
k < n_tot;
k++){
279 bool is_miss =
false;
280 vector<double> jet_lik;
281 vector<double> jet_id;
282 vector<double> miss_jet_phi;
285 for(
int l = 0; l < tracks_rmax->size(); l++){
286 int count = (*tracks_count)[l];
287 double rmax = (*tracks_rmax)[l];
288 int chargesum = (*tracks_chargesum)[l];
289 double radius = (*jetshape_radius)[l];
290 double eta = (*jet_eta)[l];
291 double phi = (*jet_phi)[l];
292 double etotal = (*jet_etotal)[l];
293 double vertex = (*tracks_vertex)[l];
294 double ptrans = (*jet_ptrans)[l];
295 int pid = (*evtgen_pid)[l];
298 if(count == 1 && chargesum == -1 && ptrans > 5 && vertex < 0.03 && radius < 0.05) is_e =
true;
303 for(
int l = 0; l < tracks_rmax->size(); l++){
309 double rmax = (*tracks_rmax)[l];
310 int count = (*tracks_count)[l];
311 int chargesum = (*tracks_chargesum)[l];
312 double vertex = (*tracks_vertex)[l];
313 double radius = (*jetshape_radius)[l];
314 double econe_1 = (*jetshape_econe_1)[l];
315 double econe_2 = (*jetshape_econe_2)[l];
316 double econe_5 = (*jetshape_econe_5)[l];
317 double eta = (*jet_eta)[l];
318 double phi = (*jet_phi)[l];
319 double minv = (*jet_minv)[l];
320 double etotal = (*jet_etotal)[l];
321 double ptrans = (*jet_ptrans)[l];
322 int pid = (*evtgen_pid)[l];
326 if(is_e && pid == 15) tau_as_DIS++;
327 if(is_e && pid != 15) DIS_as_DIS++;
340 x_bin = h_tau[1]->GetXaxis()->FindBin(count);
341 likelihood.push_back( h_tau[1]->GetBinContent(x_bin) / (h_tau[1]->GetBinContent(x_bin) + h_uds[1]->GetBinContent(x_bin)));
343 x_bin = h_tau[2]->GetXaxis()->FindBin(chargesum);
344 likelihood.push_back( h_tau[2]->GetBinContent(x_bin) / (h_tau[2]->GetBinContent(x_bin) + h_uds[2]->GetBinContent(x_bin)));
356 x_bin = h_tau[6]->GetXaxis()->FindBin(eta);
357 likelihood.push_back( h_tau[6]->GetBinContent(x_bin) / (h_tau[6]->GetBinContent(x_bin) + h_uds[6]->GetBinContent(x_bin)));
366 x_bin = h_tau[9]->GetXaxis()->FindBin(vertex);
367 if(vertex == vertex) likelihood.push_back( h_tau[9]->GetBinContent(x_bin) / (h_tau[9]->GetBinContent(x_bin) + h_uds[9]->GetBinContent(x_bin)));
371 double avg =
Average(likelihood);
374 if(avg != avg)
continue;
378 if(ptrans < 5) avg = 0;
380 jet_lik.push_back(avg);
381 jet_id.push_back(pid);
382 miss_jet_phi.push_back(phi);
386 if(ptrans < 5 && pid == 15) tau_as_DIS++;
387 if(ptrans < 5 && pid != 15) DIS_as_DIS++;
415 if(jet_lik.size() == 0)
continue;
418 for(
int m = 0;
m < jet_lik.size();
m++){
420 if(jet_id[
m] == 15) is_tau =
true;
422 if(jet_lik[
m] > max_lik) {
423 max_lik = jet_lik[
m];
429 for(
int n = 0;
n < jet_lik.size();
n++){
431 if(
m!=
n && jet_lik[
m]==jet_lik[
n]) {
435 if(jet_id[
m] == 15 || jet_id[n] 15) {
450 if(jet_lik[max_lik_i] > lik_cut){
452 if(jet_id[max_lik_i] == 15) tau_as_tau++;
456 DIS_as_DIS = DIS_as_DIS + jet_lik.size() - 1;
463 if(is_tau) tau_as_DIS++;
464 if(is_tau) DIS_as_DIS = DIS_as_DIS + jet_lik.size() - 1;
466 if(!is_tau) DIS_as_DIS = DIS_as_DIS + jet_lik.size();
470 if(a > -1 && b > -1){
471 if(jet_id[a] == 15 && jet_lik[max_lik_i] > lik_cut) DIS_as_tau--;
472 if(jet_id[a] != 15 && jet_lik[max_lik_i] < lik_cut) DIS_as_DIS--;
477 delta_phi = fabs(miss_phi - miss_jet_phi[max_lik_i]) * 180 / TMath::Pi();
478 if(delta_phi > 180) delta_phi = 360 -
delta_phi;
480 myfile<<ptmiss<<
","<<delta_phi<<
","<<is_lq<<endl;
485 double efficiency = tau_as_tau*1.0/(n_tot*1.0);
488 if(tau_as_tau == 0 && DIS_as_tau == 0) FP = 0;
489 else FP = DIS_as_tau*1.0/((tau_as_tau+DIS_as_tau)*1.0);
493 cout<<
" | Act Tau Act Parton"<<endl;
494 cout<<
"------------------------------"<<endl;
495 cout<<
"ID Tau | "<<tau_as_tau<<
" "<<DIS_as_tau<<endl;
496 cout<<
"ID Parton| "<<tau_as_DIS<<
" "<<DIS_as_DIS<<endl;
501 cout<<
"Tau Recovery Rate: "<<efficiency<<endl;
502 cout<<
"False Positive Rate: "<<FP<<endl;
503 cout<<
"Identified Electron Events : "<<id_e<<endl;
504 cout<<
"Total Jets: "<<tot_jets<<endl;