]>
Commit | Line | Data |
---|---|---|
a65a7e70 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | // | |
17 | // Class AliVZEROTrending | |
18 | // --------------------------- | |
19 | // | |
20 | // class used in QA to publish variables evolution versus time in AMORE. | |
21 | // These histo are the one which will be looked at by QA Shifter | |
22 | // | |
23 | #include "TGraph.h" | |
24 | #include "TMultiGraph.h" | |
25 | #include "TLegend.h" | |
26 | #include "TString.h" | |
27 | ||
28 | #include "AliLog.h" | |
29 | #include "AliVZEROTrending.h" | |
30 | ||
31 | ClassImp(AliVZEROTrending) | |
32 | ||
33 | //_____________________________________________________________________________ | |
34 | AliVZEROTrending::AliVZEROTrending() : TH1(), fNEntries(0), fMultiGraphs(NULL) | |
35 | { | |
36 | // Default constructor | |
37 | for(int i=0; i<8;i++) fGraphs[i] = NULL; | |
38 | for (int i = 0; i < kDataSize; i++) { | |
39 | fTime[i] = 0; | |
40 | for (int j = 0; j < 8; j++) { | |
41 | fData[j][i] = 0; | |
42 | } | |
43 | } | |
44 | } | |
45 | //_____________________________________________________________________________ | |
46 | AliVZEROTrending::AliVZEROTrending(const char* name, const char* title) : TH1(), fNEntries(0), fMultiGraphs(NULL) | |
47 | { | |
48 | SetName(name); | |
49 | SetTitle(title); | |
50 | for(int i=0; i<8;i++) fGraphs[i] = NULL; | |
51 | for (int i = 0; i < kDataSize; i++) { | |
52 | fTime[i] = 0; | |
53 | for (int j = 0; j < 8; j++) { | |
54 | fData[j][i] = 0; | |
55 | } | |
56 | } | |
57 | } | |
58 | //_____________________________________________________________________________ | |
59 | AliVZEROTrending::AliVZEROTrending(const AliVZEROTrending &trend) : | |
60 | TH1(), fNEntries(trend.fNEntries), fMultiGraphs(NULL) | |
61 | { | |
62 | // Copy constructor | |
63 | for(int i=0; i<8;i++) fGraphs[i] = NULL; | |
64 | SetName(trend.GetName()); | |
65 | SetTitle(trend.GetTitle()); | |
66 | for (int i = 0; i < kDataSize; i++) { | |
67 | fTime[i] = trend.fTime[i]; | |
68 | for (int j = 0; j < 8; j++) { | |
69 | fData[j][i] = trend.fData[j][i]; | |
70 | } | |
71 | } | |
72 | } | |
73 | ||
74 | //_____________________________________________________________________________ | |
75 | AliVZEROTrending::~AliVZEROTrending(){ | |
76 | for (Int_t i=0; i<8; ++i) delete fGraphs[i]; | |
77 | delete fMultiGraphs; | |
78 | } | |
79 | // ----------------------------------------------------------------- | |
80 | void AliVZEROTrending::AddEntry(Double_t * data, UInt_t time) | |
81 | { | |
82 | ||
83 | if(fNEntries<kDataSize){ | |
84 | for (int i = 0; i < 8; i++) | |
85 | { | |
86 | fData[i][fNEntries] = data[i]; | |
87 | fTime[fNEntries] = (double) time; | |
88 | } | |
89 | fNEntries++; | |
90 | }else{ | |
91 | ||
92 | for (int i = 0; i < kDataSize-1; i++){ | |
93 | fTime[i] = fTime[i+1]; | |
94 | for (int ich = 0; ich < 8; ich++){ | |
95 | fData[ich][i] = fData[ich][i+1]; | |
96 | } | |
97 | } | |
98 | for (int i = 0; i < 8; i++) | |
99 | { | |
100 | fData[i][fNEntries-1] = data[i]; | |
101 | fTime[fNEntries-1] = (double) time; | |
102 | } | |
103 | ||
104 | } | |
105 | // printf("sizeof UInt_t Double_t %d %d\n",sizeof(UInt_t),sizeof(Double_t)); | |
106 | // printf("Add Entry %d @ %f : %f %f %f %f %f %f %f %f \n",fNEntries,fTime[fNEntries-1], | |
107 | // data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7]); | |
108 | } | |
109 | // ----------------------------------------------------------------- | |
110 | void AliVZEROTrending::PrintEntry(UInt_t entry) | |
111 | { | |
112 | ||
113 | if(entry>=fNEntries){ | |
114 | AliError(Form("maximum entry is %d\n",fNEntries-1)); | |
115 | }else{ | |
116 | AliInfo(Form("Entry %d @ %f : %f %f %f %f %f %f %f %f \n",entry, fTime[entry], | |
117 | fData[0][entry],fData[1][entry],fData[2][entry],fData[3][entry],fData[4][entry],fData[5][entry],fData[6][entry],fData[7][entry])); | |
118 | ||
119 | } | |
120 | } | |
121 | ||
122 | // ----------------------------------------------------------------- | |
123 | void AliVZEROTrending::Draw(Option_t *option){ | |
124 | TString opt = option; | |
125 | fMultiGraphs = new TMultiGraph(); | |
126 | fMultiGraphs->SetTitle(GetTitle()); | |
127 | ||
128 | for(int i=0;i<8;i++) { | |
129 | fGraphs[i] = new TGraph(GetNEntries(), GetTime(), GetChannel(i)); | |
130 | fGraphs[i]->SetLineWidth(2); | |
131 | fGraphs[i]->SetLineColor(i<4 ? i+1 : i -3); | |
132 | fGraphs[i]->SetLineStyle(i<4 ? 1 : 2); | |
133 | fMultiGraphs->Add(fGraphs[i]); | |
134 | } | |
135 | ||
136 | fMultiGraphs->Draw("AL"); | |
137 | fMultiGraphs->GetXaxis()->SetTimeDisplay(1); | |
138 | fMultiGraphs->GetXaxis()->SetNdivisions(505,kFALSE); | |
139 | fMultiGraphs->Draw("AL"); | |
140 | TLegend * legend = new TLegend(0.7,0.65,0.86,0.88); | |
141 | legend->AddEntry(fGraphs[4],"V0A - Ring0","l"); | |
142 | legend->AddEntry(fGraphs[5],"V0A - Ring1","l"); | |
143 | legend->AddEntry(fGraphs[6],"V0A - Ring2","l"); | |
144 | legend->AddEntry(fGraphs[7],"V0A - Ring3","l"); | |
145 | legend->AddEntry(fGraphs[0],"V0C - Ring0","l"); | |
146 | legend->AddEntry(fGraphs[1],"V0C - Ring1","l"); | |
147 | legend->AddEntry(fGraphs[2],"V0C - Ring2","l"); | |
148 | legend->AddEntry(fGraphs[3],"V0C - Ring3","l"); | |
149 | legend->Draw(); | |
150 | } |