2 makeInput(Int_t n, TArrayI& vals, TF1* f)
5 TGraph* data = new TGraph(n);
6 data->SetName("input");
7 data->SetTitle("Input");
8 data->SetMarkerColor(kRed);
9 data->SetLineColor(kRed);
10 data->SetMarkerStyle(20);
12 for (Int_t i = 0; i < data->GetN(); i++) {
13 Double_t v = f->Eval(i);
14 data->SetPoint(i, i, v);
20 TGraph* makeFlat(const char* name, Int_t n, Float_t val, TArrayF& vals)
24 TGraph* g = new TGraph(n);
27 g->SetMarkerStyle(21);
29 for (Int_t i = 0; i < g->GetN(); i++)
30 g->SetPoint(i, i, val);
35 runTest(TF1* f, AliFMDRawWriter* w, Float_t pv, Float_t nv)
39 Int_t n = Int_t(f->GetXmax());
40 UShort_t threshold = 1;
45 TGraph* input = makeInput(n, vals, f);
46 TGraph* gPeds = makeFlat("peds", n, pv, peds);
47 TGraph* gNoise = makeFlat("noise", n, nv, noise);
48 TGraph* gThreshold = makeFlat("threshold", n, threshold, dummy);
49 gThreshold->SetLineStyle(2);
50 gPeds->SetLineColor(kGreen);
51 gNoise->SetLineColor(kMagenta);
53 w->ZeroSuppress(vals.fArray, n, peds.fArray, noise.fArray, threshold);
55 TGraph* output = new TGraph(n);
56 output->SetName("output");
57 output->SetLineColor(kBlue);
58 output->SetMarkerColor(kBlue);
59 output->SetMarkerStyle(21);
60 for (Int_t i = 0; i < output->GetN(); i++)
61 output->SetPoint(i, i, vals[i]);
63 TCanvas* c = new TCanvas(Form("c%02d", num),
64 Form("Zero suppression test %d", num));
65 c->SetFillColor(kWhite);
67 input->GetHistogram()->SetMinimum(0);
68 gPeds->Draw("L same");
69 gThreshold->Draw("L same");
70 output->Draw("PL same");
81 AliLog::SetModuleDebugLevel("FMD", 1);
82 AliFMDRawWriter* w = new AliFMDRawWriter(0);
84 TF1* simple = new TF1("simple", "[0] + [1] * (x >= [2] && x <= [3])", 0, 16);
85 simple->SetParameters(4, 10, 2.5, 6.5);
87 runTest(simple, w, 3.5, 0);
90 runTest(simple, w, 3.5, 0);
92 w.SetPedSubtract(kFALSE);
93 simple->SetParameters(4, 10, 3.5, 4.5);
94 runTest(simple, w, 3.5, 0);
96 TF1* two = new TF1("two",
97 "[0]+[1]*((x>=[2]&&x<=[3])||(x>=[4]&&x<=[5]))", 0, 16);
98 two->SetParameters(4, 10, 2.5, 4.5, 9.5, 12.5);
99 runTest(two, w, 3.5, 0);