-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRUNME.C
67 lines (55 loc) · 2.31 KB
/
RUNME.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "tofBarrel.C"
std::vector<PID*> Detectors;
std::vector<TH1*> Plots;
PID::type myType = PID::pi_k; // This means I want to plot the pi_K separation;
double numSigma = 3.0; // This means I want to plot teh contour for three sigma separation
void RUNME()
{
// Add as many detectors as your heart desires....
Detectors.push_back( new tofBarrel(150, -1, 1, 5) ); // 5 psec @ 150 cm
Detectors.push_back( new tofBarrel(100, -1, 1, 10) ); // 10 psec @ 100 cm
Detectors.push_back( new tofBarrel(100, -1, 1, 20) ); // 20 psec @ 100 cm
// Select the booking criterion for the performance plot.
TH1* Performance = new TH1D("Performance","Performance",100,-6,6); // Format for detector Performance.
//----------------------------------------------------------------------------------
// At least in the beginning, you might not want to change the lines below here...
//----------------------------------------------------------------------------------
// Now we call upon all detectors to present their descriptions and assumptions.
for (int i=0; i<Detectors.size(); i++)
{
Detectors[i]->description();
}
// Now we clone the original performance plot once for every known detector.
for (int i=0; i<Detectors.size(); i++)
{
Plots.push_back( (TH1*)Performance->Clone(Detectors[i]->name().c_str()) );
Plots[i]->SetLineColor(i+1); // Works well only for the first 9 colors...
Plots[i]->SetLineWidth(4);
}
// Now we fill all the performance plots:
for (int i=1; i<Plots[0]->GetNbinsX(); i++) // Remember root is weird...bin0 is the underflow bin
{
double eta = Plots[0]->GetBinCenter(i);
for (int j=0; j<Detectors.size(); j++)
{
if (Detectors[j]->valid(eta, 1.0))
{
Plots[j]->SetBinContent(i, Detectors[j]->maxP(eta, numSigma, myType) );
}
}
}
TCanvas *c1 = new TCanvas("c1","c1",1600,900);
// Now we display the performance plots
for (int i=0; i<Plots.size(); i++)
{
Plots[i]->Draw("same");
}
// Now we put colored names on top of the plot (too fancy?)...
TPaveText *pt = new TPaveText(0.15,0.7,0.4,0.90,"NDC");
for (int i=0; i<Detectors.size(); i++)
{
pt->AddText( Detectors[i]->name().c_str() );
((TText*)pt->GetListOfLines()->Last())->SetTextColor(i+1);
}
pt->Draw();
}