#include <iostream.h>
#include <algorithm>
#include <math.h>
Go to the source code of this file.
Definition at line 20 of file confusionMatrix.C.
References chisquared::c3, confusionMatrixTree::chosenlabel, om::cout, allTimeWatchdog::endl, MECModelEnuComparisons::i, calib::j, maxID(), nc, nevent, output, scale, plotROC::title, and confusionMatrixTree::truelabel.
23 TChain *ch=
new TChain(
"t");
25 ch->Add(input.c_str());
35 double idOut[5]={0.,0.,0.,0.,0.};
37 ch->SetBranchAddress(
"truelabel",&truelabel);
38 ch->SetBranchAddress(
"numu",&numu);
39 ch->SetBranchAddress(
"nue",&nue);
40 ch->SetBranchAddress(
"nutau",&nutau);
41 ch->SetBranchAddress(
"nc",&nc);
42 ch->SetBranchAddress(
"cosmic",&cosmic);
44 TH2D *heatmap=
new TH2D(
"heatmap",
"", 5,0,5,5,0,5);
46 char *interaction[5] =
47 {
"#nu_{#mu}",
"#nu_{e}",
"#nu_{#tau}",
"NC",
"Cosmic"};
50 Int_t
nevent =ch.GetEntries();
58 chosenlabel=
maxID(idOut);
60 heatmap->Fill(
double(truelabel),
double(chosenlabel));
64 for (
int i=1;
i<6;
i++){
66 for (
int j=1;
j<6;
j++){
67 scale=scale+heatmap->GetBinContent(
i,
j);
72 for (
int j=1;
j<6;
j++){
73 if(heatmap->GetBinContent(
i,
j)/scale>0.0001)
75 heatmap->SetBinContent(
i,
j,(heatmap->GetBinContent(
i,
j))/scale);
78 heatmap->SetBinContent(
i,
j,.0001);
85 string title=
"heatmap";
87 TCanvas
c3(
"c3",title.c_str(),900,900);
89 heatmap->SetTitle(
"");
90 heatmap->SetXTitle(
"True");
91 heatmap->SetYTitle(
"Selected");
93 heatmap->GetYaxis()->SetBinLabel(
i, interaction[
i-1]);
94 heatmap->GetXaxis()->SetBinLabel(
i, interaction[
i-1]);
96 heatmap->GetXaxis()->SetTickLength(0);
97 heatmap->GetYaxis()->SetTickLength(0);
98 heatmap->GetYaxis()->SetTitleSize(0.06);
99 heatmap->GetXaxis()->SetTitleSize(0.06);
100 heatmap->GetYaxis()->SetTitleOffset(1);
101 heatmap->GetXaxis()->SetTitleOffset(1);
102 heatmap->GetYaxis()->SetLabelSize(0.025);
103 heatmap->GetXaxis()->SetLabelSize(0.025);
104 heatmap->GetZaxis()->SetLabelSize(0.03);
106 heatmap->GetXaxis()->CenterTitle();
107 heatmap->GetYaxis()->CenterTitle();
109 gStyle->SetPalette(53);
110 heatmap->SetMaximum(1.0);
111 heatmap->Draw(
"colz");
113 string output =
"plots/"+title+
".gif";
114 c3.Print(output.c_str());
115 string output =
"plots/"+title+
".C";
116 c3.Print(output.c_str());
117 string output =
"plots/"+title+
".eps";
118 c3.Print(output.c_str());
int maxID(double arrayInput[])
Sum up livetimes from individual cosmic triggers.
int maxID |
( |
double |
arrayInput[] | ) |
|