AliPhysics  d497547 (d497547)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TestAxis.C
Go to the documentation of this file.
1 void testAxis()
2 {
3  const Int_t nCenter = 56;
4  const Int_t nSat = 10;
5  const Int_t nBins = 2*nSat + nCenter;
6  Float_t bins[nBins+1];
7 
8  for (Int_t i = 0; i < nSat;i++) {
9  bins[i] = (i-nSat-.5) * 37.5;
10  printf("bins[%2d]=%+6.2f\n", i, bins[i]);
11  }
12  for (Int_t i = nSat; i < nSat+nCenter+1; i++) {
13  bins[i] = -nCenter + (i-nSat) * 2;
14  printf("bins[%2d]=%+6.2f\n", i, bins[i]);
15  }
16  for (Int_t i = nSat+nCenter+1; i < 2*nSat+nCenter; i++) {
17  bins[i] = (i-nSat-nCenter +.5) * 37.5;
18  printf("bins[%2d]=%+6.2f\n", i, bins[i]);
19  }
20  bins[nBins] = (nSat + .5) * 37.5;
21 
22  // printf("\n");
23 
24  TH1* h = new TH1F("h", "h", nBins, bins);
25  h->SetFillColor(kRed+1);
26  h->SetFillStyle(3001);
27 
28  TAxis* a = h->GetXaxis();
29  for (Int_t i = 1; i <= nBins; i++)
30  printf("%2d/%2d: %+6.2f - %+6.2f: %+6.2f\n",
31  i,nBins,
32  a->GetBinLowEdge(i),
33  a->GetBinUpEdge(i),
34  a->GetBinCenter(i));
35 
36  for (Int_t i = 1; i <= nSat; i++)
37  h->SetBinContent(i, i);
38  for (Int_t i = nSat+1; i <= nSat+nCenter; i++)
39  h->SetBinContent(i, nSat+nCenter/2 - TMath::Abs(i-nCenter/2-nSat));
40  for (Int_t i = nSat+nCenter+1; i <= 2*nSat+nCenter; i++)
41  h->SetBinContent(i, (2*nSat+nCenter+1)-i);
42 
43 
44  h->Draw();
45 }
46 
47 
48 
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
void testAxis()
Definition: TestAxis.C:1
Definition: External.C:196