]>
Commit | Line | Data |
---|---|---|
5a8e8156 | 1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // // | |
3 | // Class for ZDC DCS data // | |
4 | // // | |
5 | /////////////////////////////////////////////////////////////////////////////// | |
6 | ||
64a7c78d | 7 | #include "AliZDCDataDCS.h" |
8 | ||
9 | #include "AliCDBMetaData.h" | |
10 | #include "AliDCSValue.h" | |
11 | #include "AliLog.h" | |
12 | ||
a1e17193 | 13 | #include <TCanvas.h> |
64a7c78d | 14 | #include <TDatime.h> |
a1e17193 | 15 | #include <TGraph.h> |
16 | #include <TH1.h> | |
17 | #include <TObjString.h> | |
64a7c78d | 18 | #include <TStyle.h> |
a1e17193 | 19 | #include <TTimeStamp.h> |
64a7c78d | 20 | |
21 | ClassImp(AliZDCDataDCS) | |
22 | ||
23 | //--------------------------------------------------------------- | |
24 | AliZDCDataDCS::AliZDCDataDCS(): | |
5a8e8156 | 25 | TObject(), |
26 | fRun(0), | |
27 | fStartTime(0), | |
28 | fEndTime(0), | |
29 | fGraphs("TGraph",kNGraphs), | |
30 | fIsProcessed(kFALSE) | |
31 | { | |
32 | // Default constructor | |
33 | } | |
64a7c78d | 34 | |
35 | //--------------------------------------------------------------- | |
36 | AliZDCDataDCS::AliZDCDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime): | |
5a8e8156 | 37 | TObject(), |
38 | fRun(nRun), | |
39 | fStartTime(startTime), | |
40 | fEndTime(endTime), | |
41 | fGraphs("TGraph",kNGraphs), | |
42 | fIsProcessed(kFALSE) | |
64a7c78d | 43 | { |
5a8e8156 | 44 | // Standard constructor |
45 | ||
46 | AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", nRun, | |
47 | TTimeStamp(startTime).AsString(), | |
48 | TTimeStamp(endTime).AsString())); | |
64a7c78d | 49 | |
5a8e8156 | 50 | Init(); |
64a7c78d | 51 | |
52 | } | |
53 | ||
54 | //--------------------------------------------------------------- | |
5a8e8156 | 55 | AliZDCDataDCS::~AliZDCDataDCS() |
56 | { | |
57 | // Destructor | |
58 | fGraphs.Clear("C"); | |
64a7c78d | 59 | } |
60 | ||
61 | //--------------------------------------------------------------- | |
5a8e8156 | 62 | void AliZDCDataDCS::ProcessData(TMap& aliasMap, Float_t *fCalibData) |
63 | { | |
64 | // Data processing | |
65 | ||
66 | TObjArray *aliasArr; | |
67 | AliDCSValue* aValue; | |
68 | for(int j=0; j<kNAliases; j++){ | |
69 | aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data()); | |
70 | if(!aliasArr){ | |
71 | AliError(Form("Alias %s not found!", fAliasNames[j].Data())); | |
72 | continue; | |
73 | } | |
74 | Introduce(j, aliasArr); | |
75 | ||
76 | if(aliasArr->GetEntries()<2){ | |
77 | AliError(Form("Alias %s has just %d entries!", | |
78 | fAliasNames[j].Data(),aliasArr->GetEntries())); | |
79 | continue; | |
80 | } | |
81 | ||
82 | TIter iterarray(aliasArr); | |
83 | ||
84 | Double_t *time = new Double_t[aliasArr->GetEntries()]; | |
85 | Double_t *val = new Double_t[aliasArr->GetEntries()]; | |
86 | ||
87 | UInt_t ne=0; | |
88 | while((aValue = (AliDCSValue*) iterarray.Next())) { | |
89 | val[ne] = aValue->GetFloat(); | |
90 | time[ne] = (Double_t) (aValue->GetTimeStamp()); | |
91 | fCalibData[ne] = val[ne]; | |
92 | ne++; | |
93 | } | |
94 | // | |
95 | ||
96 | // | |
97 | if(j>=4) CreateGraph(j, aliasArr->GetEntries(), time, val); // fill graphs | |
98 | // | |
99 | delete[] val; | |
100 | delete[] time; | |
101 | } | |
102 | // | |
103 | fIsProcessed=kTRUE; | |
64a7c78d | 104 | |
105 | } | |
106 | ||
107 | //--------------------------------------------------------------- | |
5a8e8156 | 108 | void AliZDCDataDCS::Init() |
109 | { | |
110 | // Initialization | |
111 | ||
112 | TH1::AddDirectory(kFALSE); | |
113 | ||
114 | fGraphs.SetOwner(1); | |
115 | ||
116 | for(int i=0;i<kNAliases;i++){ | |
117 | if(i<4){ | |
118 | fAliasNames[i] = "ZDC.Position"; | |
119 | fAliasNames[i] += i; | |
120 | } | |
121 | else{ | |
122 | fAliasNames[i] = "ZDC.HVValue"; | |
123 | fAliasNames[i] += i-4; | |
124 | } | |
125 | } | |
64a7c78d | 126 | |
127 | } | |
128 | ||
129 | //--------------------------------------------------------------- | |
5a8e8156 | 130 | void AliZDCDataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr) |
131 | { | |
132 | // Getting array of DCS aliases | |
133 | ||
134 | int entries=aliasArr->GetEntries(); | |
135 | AliInfo(Form("************ Alias: %s **********",fAliasNames[numAlias].Data())); | |
136 | AliInfo(Form(" %d DP values collected",entries)); | |
64a7c78d | 137 | |
138 | } | |
139 | ||
140 | ||
141 | //--------------------------------------------------------------- | |
142 | void AliZDCDataDCS::CreateGraph(int i, int dim, const Double_t *x, const Double_t *y) | |
143 | { | |
144 | ||
5a8e8156 | 145 | // Create graphics |
146 | ||
147 | TGraph *gr = new(fGraphs[fGraphs.GetEntriesFast()]) TGraph(dim, x, y); | |
64a7c78d | 148 | |
5a8e8156 | 149 | gr->GetXaxis()->SetTimeDisplay(1); |
150 | gr->SetTitle(fAliasNames[i].Data()); | |
64a7c78d | 151 | |
5a8e8156 | 152 | AliInfo(Form("Array entries: %d",fGraphs.GetEntriesFast())); |
64a7c78d | 153 | |
154 | ||
155 | } | |
156 | ||
157 | //--------------------------------------------------------------- | |
158 | void AliZDCDataDCS::Draw(const Option_t* /*option*/) | |
159 | { | |
5a8e8156 | 160 | // Draw graphics |
64a7c78d | 161 | |
162 | fIsProcessed=1; | |
163 | if(!fIsProcessed) return; | |
164 | ||
165 | if(fGraphs.GetEntries()==0) return; | |
166 | ||
167 | TCanvas *cg1; | |
730c9d5b | 168 | TString canvas1Name="ZN1_HVs"; |
64a7c78d | 169 | cg1=new TCanvas(canvas1Name,canvas1Name,40,40,600,600); |
170 | cg1->Divide(2,2); | |
171 | cg1->cd(1); | |
730c9d5b | 172 | ((TGraph*) fGraphs.UncheckedAt(0))->SetMarkerStyle(20); |
173 | ((TGraph*) fGraphs.UncheckedAt(0))->Draw("ALP"); | |
64a7c78d | 174 | cg1->cd(2); |
730c9d5b | 175 | ((TGraph*) fGraphs.UncheckedAt(1))->SetMarkerStyle(20); |
176 | ((TGraph*) fGraphs.UncheckedAt(1))->Draw("ALP"); | |
64a7c78d | 177 | cg1->cd(3); |
730c9d5b | 178 | ((TGraph*) fGraphs.UncheckedAt(2))->SetMarkerStyle(20); |
179 | ((TGraph*) fGraphs.UncheckedAt(2))->Draw("ALP"); | |
64a7c78d | 180 | cg1->cd(4); |
730c9d5b | 181 | ((TGraph*) fGraphs.UncheckedAt(3))->SetMarkerStyle(20); |
182 | ((TGraph*) fGraphs.UncheckedAt(3))->Draw("ALP"); | |
183 | ||
184 | TCanvas *cg2; | |
185 | TString canvas2Name="ZP1_HVs"; | |
186 | cg2=new TCanvas(canvas2Name,canvas2Name,80,80,600,600); | |
187 | cg2->Divide(2,2); | |
188 | cg2->cd(1); | |
189 | ((TGraph*) fGraphs.UncheckedAt(5))->SetMarkerStyle(20); | |
190 | ((TGraph*) fGraphs.UncheckedAt(5))->Draw("ALP"); | |
191 | cg2->cd(2); | |
192 | ((TGraph*) fGraphs.UncheckedAt(6))->SetMarkerStyle(20); | |
193 | ((TGraph*) fGraphs.UncheckedAt(6))->Draw("ALP"); | |
194 | cg2->cd(3); | |
195 | ((TGraph*) fGraphs.UncheckedAt(7))->SetMarkerStyle(20); | |
196 | ((TGraph*) fGraphs.UncheckedAt(7))->Draw("ALP"); | |
197 | cg2->cd(4); | |
198 | ((TGraph*) fGraphs.UncheckedAt(8))->SetMarkerStyle(20); | |
199 | ((TGraph*) fGraphs.UncheckedAt(8))->Draw("ALP"); | |
64a7c78d | 200 | |
201 | } | |
202 |