Migrated to a geometry implemented via AliFMDGeometry (derives from
[u/mrichter/AliRoot.git] / FMD / scripts / VA1Train.C
CommitLineData
d389af40 1//
2// Small script that shows a signal train from a VA1 pre-amp.
3//
4void
5VA1Train()
6{
7 gStyle->SetOptTitle(0);
8 gStyle->SetOptFit(0);
9 gStyle->SetOptStat(0);
10
11 TCanvas* c = new TCanvas("c", "C", 800, 400);
12 c->SetFillColor(0);
13 c->SetBorderMode(0);
14 c->SetBorderSize(0);
15
16
17 TArrayF measurements(6);
18 std::cout << "Measurements are: " << std::flush;
19 for (Int_t i = 0; i < measurements.fN; i++) {
20 measurements[i] = gRandom->Uniform(0,1);
21 std::cout << measurements[i] << " " << std::flush;
22 }
23 std::cout << std::endl;
24
25 Float_t last = 0;
26 Float_t B = 5;
27 TH2* frame = new TH2F("frame", "Frame", measurements.fN, 0,
28 measurements.fN, 10, 0, 1.1);
29 frame->Draw();
30 for (Int_t i = 0; i < measurements.fN; i++) {
31 TF1* f = new TF1("f", "[2] + exp(-[1] * (x - [3])) * ([0] - [2])",
32 i, i + 1);
33 f->SetParameter(3, i);
34 f->SetParameter(1, B);
35 f->SetParameter(2, measurements[i]);
36 f->SetParameter(0, last);
37
38 if (measurements[i] > last) {
39 // f = new TF1("f", "[0] * (1 - exp(-[1] * (x - [2]))) + [3]", i, i+1);
40 // f->SetParameters(measurements[i] - last, B, i, last);
41 // f->SetParameter(0, measurements[i]);
42 // f->SetParameter(2, last);
43 }
44 else {
45 // f->SetParameter(2, measurements[i]);
46 // f->SetParameter(0, last);
47 // f = new TF1("f", "[0] * (exp(-[1] * (x - [2]))) + [3]", i, i+1);
48 // f->SetParameters(last - measurements[i], B, i, measurements[i]);
49 }
50 f->Draw("same");
51 last = measurements[i];
52 }
53}
54
55
56