-
Notifications
You must be signed in to change notification settings - Fork 0
/
acceptance.C
31 lines (29 loc) · 1.22 KB
/
acceptance.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
void acceptance(string recofilename = "RecoTest.root")
{
int nbins = 100;
float maxcos = 1;
TCanvas * c1 = new TCanvas("c1", "The 3d view",0,0,500,500);
TFile *_file0 = TFile::Open(recofilename.c_str());
TH1F * kcos = new TH1F("kcos","",nbins,0,maxcos);
TH1F * kgencos = new TH1F("kgencos",";|cos#theta|",nbins,0,maxcos);
makePretty(kcos,kBlue);
makePretty(kgencos,kGreen);
int ngenkaons = TaggedVertices->Draw("abs(costhetaOfParticles) >> kgencos","abs(trueTypeOfParticles) == 321 && tpcHitsOfParticles > 60 && abs(costhetaOfParticles) < 0.95 && generation ","");
int nkaons = TaggedVertices->Draw("abs(costhetaOfParticles) >> kcos","abs(pidTypeOfParticles) == 321 && generation ","same");
kgencos->Draw();
kcos->Draw("same");
cout << "Ratio: " << (float)nkaons / ngenkaons * 100 <<"%\n";
TLegend *legendMean = new TLegend(0.15,0.25,0.7,0.15,NULL,"brNDC");
legendMean->SetFillColor(kWhite);
legendMean->SetBorderSize(0);
legendMean->AddEntry(kgencos,"Generated kaons","l");
legendMean->AddEntry(kcos,"Reconstructed kaons","l");
legendMean->Draw();
}
void makePretty(TH1F * missed, int color)
{
missed->SetMinimum(0);
missed->SetStats(0);
missed->SetLineColor(color);
missed->SetLineWidth(2);
}