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