]>
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), | |
e83c8d88 | 29 | fStartTimeDCSQuery(0), |
30 | fEndTimeDCSQuery(0), | |
5a8e8156 | 31 | fGraphs("TGraph",kNGraphs), |
32 | fIsProcessed(kFALSE) | |
33 | { | |
34 | // Default constructor | |
e83c8d88 | 35 | for(Int_t i=0; i<kNAliases; i++){ |
36 | fAliasNames[i] = ""; | |
37 | fCalibData[i] = 0.; | |
38 | fTimeStamp[i] = 0.; | |
39 | } | |
5a8e8156 | 40 | } |
64a7c78d | 41 | |
42 | //--------------------------------------------------------------- | |
e83c8d88 | 43 | AliZDCDataDCS::AliZDCDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime, |
44 | UInt_t startTimeDCSQuery, UInt_t endTimeDCSQuery): | |
5a8e8156 | 45 | TObject(), |
46 | fRun(nRun), | |
47 | fStartTime(startTime), | |
48 | fEndTime(endTime), | |
e83c8d88 | 49 | fStartTimeDCSQuery(startTimeDCSQuery), |
50 | fEndTimeDCSQuery(endTimeDCSQuery), | |
5a8e8156 | 51 | fGraphs("TGraph",kNGraphs), |
52 | fIsProcessed(kFALSE) | |
64a7c78d | 53 | { |
5a8e8156 | 54 | // Standard constructor |
55 | ||
e83c8d88 | 56 | AliDebug(2,Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s \n\tStartTime DCS Query %s \n\tEndTime DCS Query %s", nRun, |
5a8e8156 | 57 | TTimeStamp(startTime).AsString(), |
e83c8d88 | 58 | TTimeStamp(endTime).AsString(), |
59 | TTimeStamp(startTimeDCSQuery).AsString(), | |
60 | TTimeStamp(endTimeDCSQuery).AsString())); | |
64a7c78d | 61 | |
5a8e8156 | 62 | Init(); |
64a7c78d | 63 | |
64 | } | |
65 | ||
e83c8d88 | 66 | //--------------------------------------------------------------- |
67 | AliZDCDataDCS::AliZDCDataDCS(const AliZDCDataDCS & data): | |
68 | TObject(data), | |
69 | fRun(data.fRun), | |
70 | fStartTime(data.fStartTime), | |
71 | fEndTime(data.fEndTime), | |
72 | fStartTimeDCSQuery(data.fStartTimeDCSQuery), | |
73 | fEndTimeDCSQuery(data.fEndTimeDCSQuery), | |
74 | fGraphs(data.fGraphs), | |
75 | fIsProcessed(data.fIsProcessed) | |
76 | { | |
77 | ||
78 | // copy constructor | |
79 | ||
80 | for(int i=0;i<kNAliases;i++) { | |
81 | fAliasNames[i]=data.fAliasNames[i]; | |
82 | } | |
83 | ||
84 | ||
85 | } | |
86 | ||
87 | //--------------------------------------------------------------- | |
88 | AliZDCDataDCS& AliZDCDataDCS:: operator=(const AliZDCDataDCS & data) { | |
89 | ||
90 | // assignment operator | |
91 | ||
92 | if (this == &data) | |
93 | return *this; | |
94 | ||
95 | TObject::operator=(data); | |
96 | fRun = data.GetRun(); | |
97 | fStartTime = data.GetStartTime(); | |
98 | fEndTime = data.GetEndTime(); | |
99 | fStartTimeDCSQuery = data.GetStartTimeDCSQuery(); | |
100 | fEndTimeDCSQuery = data.GetEndTimeDCSQuery(); | |
101 | ||
102 | for(int i=0;i<kNAliases;i++) { | |
103 | fAliasNames[i]=data.GetAliasName(i); | |
104 | fCalibData[i]=data.GetCalibData(i); | |
105 | fTimeStamp[i]=data.GetTimeStamp(i); | |
106 | } | |
107 | ||
108 | return *this; | |
109 | } | |
110 | ||
64a7c78d | 111 | //--------------------------------------------------------------- |
5a8e8156 | 112 | AliZDCDataDCS::~AliZDCDataDCS() |
113 | { | |
114 | // Destructor | |
115 | fGraphs.Clear("C"); | |
64a7c78d | 116 | } |
117 | ||
118 | //--------------------------------------------------------------- | |
e83c8d88 | 119 | Bool_t AliZDCDataDCS::ProcessData(TMap& aliasMap) |
5a8e8156 | 120 | { |
121 | // Data processing | |
e83c8d88 | 122 | |
123 | if (fEndTime==fStartTime){ | |
124 | AliError(Form(" Run with null time length: start time = %i = end time = %i",fStartTime,fEndTime)); | |
125 | return kFALSE; | |
126 | } | |
127 | ||
128 | AliInfo(Form(" Start Time = %i",fStartTime)); | |
129 | AliInfo(Form(" End Time = %i",fEndTime)); | |
130 | AliInfo(Form(" Start Time DCS Query= %i",fStartTimeDCSQuery)); | |
131 | AliInfo(Form(" End Time DCS Query= %i",fEndTimeDCSQuery)); | |
5a8e8156 | 132 | |
133 | TObjArray *aliasArr; | |
134 | AliDCSValue* aValue; | |
e83c8d88 | 135 | |
5a8e8156 | 136 | for(int j=0; j<kNAliases; j++){ |
137 | aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data()); | |
138 | if(!aliasArr){ | |
fea9b334 | 139 | AliWarning(Form("Alias %s not found!", fAliasNames[j].Data())); |
e83c8d88 | 140 | return kFALSE; |
5a8e8156 | 141 | } |
142 | Introduce(j, aliasArr); | |
143 | ||
c630de47 | 144 | if(aliasArr->GetEntries()<=2){ |
fea9b334 | 145 | AliWarning(Form("Alias %s has just %d entries!", |
5a8e8156 | 146 | fAliasNames[j].Data(),aliasArr->GetEntries())); |
147 | continue; | |
148 | } | |
149 | ||
150 | TIter iterarray(aliasArr); | |
151 | ||
152 | Double_t *time = new Double_t[aliasArr->GetEntries()]; | |
153 | Double_t *val = new Double_t[aliasArr->GetEntries()]; | |
154 | ||
155 | UInt_t ne=0; | |
156 | while((aValue = (AliDCSValue*) iterarray.Next())) { | |
157 | val[ne] = aValue->GetFloat(); | |
e83c8d88 | 158 | time[ne] = (Float_t) (aValue->GetTimeStamp()); |
c43818e0 | 159 | fCalibData[ne] = val[ne]; |
160 | fTimeStamp[ne] = time[ne]; | |
5a8e8156 | 161 | ne++; |
162 | } | |
5a8e8156 | 163 | |
ea628de7 | 164 | // if(j>=4) CreateGraph(j, aliasArr->GetEntries(), time, val); // fill graphs |
5a8e8156 | 165 | // |
166 | delete[] val; | |
167 | delete[] time; | |
168 | } | |
169 | // | |
170 | fIsProcessed=kTRUE; | |
e83c8d88 | 171 | |
172 | return kTRUE; | |
64a7c78d | 173 | } |
174 | ||
175 | //--------------------------------------------------------------- | |
5a8e8156 | 176 | void AliZDCDataDCS::Init() |
177 | { | |
178 | // Initialization | |
179 | ||
180 | TH1::AddDirectory(kFALSE); | |
181 | ||
182 | fGraphs.SetOwner(1); | |
183 | ||
c43e6d35 | 184 | fAliasNames[0] = "ZDC_ZNA_POS.actual.position"; |
185 | fAliasNames[1] = "ZDC_ZPA_POS.actual.position"; | |
186 | fAliasNames[2] = "ZDC_ZNC_POS.actual.position"; | |
187 | fAliasNames[3] = "ZDC_ZPC_POS.actual.position"; | |
b39b8493 | 188 | // |
c43e6d35 | 189 | fAliasNames[4] = "ZDC_ZNA_HV0.actual.vMon"; |
190 | fAliasNames[5] = "ZDC_ZNA_HV1.actual.vMon"; | |
191 | fAliasNames[6] = "ZDC_ZNA_HV2.actual.vMon"; | |
192 | fAliasNames[7] = "ZDC_ZNA_HV3.actual.vMon"; | |
193 | fAliasNames[8] = "ZDC_ZNA_HV4.actual.vMon"; | |
b39b8493 | 194 | // |
c43e6d35 | 195 | fAliasNames[9] = "ZDC_ZPA_HV0.actual.vMon"; |
196 | fAliasNames[10] = "ZDC_ZPA_HV1.actual.vMon"; | |
197 | fAliasNames[11] = "ZDC_ZPA_HV2.actual.vMon"; | |
198 | fAliasNames[12] = "ZDC_ZPA_HV3.actual.vMon"; | |
199 | fAliasNames[13] = "ZDC_ZPA_HV4.actual.vMon"; | |
b39b8493 | 200 | // |
c43e6d35 | 201 | fAliasNames[14] = "ZDC_ZNC_HV0.actual.vMon"; |
202 | fAliasNames[15] = "ZDC_ZNC_HV1.actual.vMon"; | |
203 | fAliasNames[16] = "ZDC_ZNC_HV2.actual.vMon"; | |
204 | fAliasNames[17] = "ZDC_ZNC_HV3.actual.vMon"; | |
205 | fAliasNames[18] = "ZDC_ZNC_HV4.actual.vMon"; | |
b39b8493 | 206 | // |
c43e6d35 | 207 | fAliasNames[19] = "ZDC_ZPC_HV0.actual.vMon"; |
208 | fAliasNames[20] = "ZDC_ZPC_HV1.actual.vMon"; | |
209 | fAliasNames[21] = "ZDC_ZPC_HV2.actual.vMon"; | |
210 | fAliasNames[22] = "ZDC_ZPC_HV3.actual.vMon"; | |
211 | fAliasNames[23] = "ZDC_ZPC_HV4.actual.vMon"; | |
b39b8493 | 212 | // |
c43e6d35 | 213 | fAliasNames[24] = "ZDC_ZEM_HV0.actual.vMon"; |
214 | fAliasNames[25] = "ZDC_ZEM_HV1.actual.vMon"; | |
c0aec6f6 | 215 | // |
20a3b76c | 216 | fAliasNames[26] = "ZDC_REFA_HV.actual.vMon"; |
217 | fAliasNames[27] = "ZDC_REFC_HV.actual.vMon"; | |
b39b8493 | 218 | |
64a7c78d | 219 | } |
220 | ||
221 | //--------------------------------------------------------------- | |
5a8e8156 | 222 | void AliZDCDataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr) |
223 | { | |
224 | // Getting array of DCS aliases | |
225 | ||
457a440d | 226 | int entries = aliasArr->GetEntries(); |
fea9b334 | 227 | AliDebug(2,Form("************ Alias: %s **********",fAliasNames[numAlias].Data())); |
228 | AliDebug(2,Form(" %d DP values collected",entries)); | |
64a7c78d | 229 | |
230 | } | |
231 | ||
232 | ||
233 | //--------------------------------------------------------------- | |
234 | void AliZDCDataDCS::CreateGraph(int i, int dim, const Double_t *x, const Double_t *y) | |
235 | { | |
236 | ||
5a8e8156 | 237 | // Create graphics |
238 | ||
239 | TGraph *gr = new(fGraphs[fGraphs.GetEntriesFast()]) TGraph(dim, x, y); | |
64a7c78d | 240 | |
5a8e8156 | 241 | gr->GetXaxis()->SetTimeDisplay(1); |
242 | gr->SetTitle(fAliasNames[i].Data()); | |
fea9b334 | 243 | // AliDebug(2,Form("Array entries: %d",fGraphs.GetEntriesFast())); |
64a7c78d | 244 | |
245 | ||
246 | } | |
247 | ||
248 | //--------------------------------------------------------------- | |
249 | void AliZDCDataDCS::Draw(const Option_t* /*option*/) | |
250 | { | |
5a8e8156 | 251 | // Draw graphics |
64a7c78d | 252 | |
253 | fIsProcessed=1; | |
254 | if(!fIsProcessed) return; | |
255 | ||
256 | if(fGraphs.GetEntries()==0) return; | |
257 | ||
258 | TCanvas *cg1; | |
730c9d5b | 259 | TString canvas1Name="ZN1_HVs"; |
64a7c78d | 260 | cg1=new TCanvas(canvas1Name,canvas1Name,40,40,600,600); |
261 | cg1->Divide(2,2); | |
262 | cg1->cd(1); | |
730c9d5b | 263 | ((TGraph*) fGraphs.UncheckedAt(0))->SetMarkerStyle(20); |
264 | ((TGraph*) fGraphs.UncheckedAt(0))->Draw("ALP"); | |
64a7c78d | 265 | cg1->cd(2); |
730c9d5b | 266 | ((TGraph*) fGraphs.UncheckedAt(1))->SetMarkerStyle(20); |
267 | ((TGraph*) fGraphs.UncheckedAt(1))->Draw("ALP"); | |
64a7c78d | 268 | cg1->cd(3); |
730c9d5b | 269 | ((TGraph*) fGraphs.UncheckedAt(2))->SetMarkerStyle(20); |
270 | ((TGraph*) fGraphs.UncheckedAt(2))->Draw("ALP"); | |
64a7c78d | 271 | cg1->cd(4); |
730c9d5b | 272 | ((TGraph*) fGraphs.UncheckedAt(3))->SetMarkerStyle(20); |
273 | ((TGraph*) fGraphs.UncheckedAt(3))->Draw("ALP"); | |
274 | ||
275 | TCanvas *cg2; | |
276 | TString canvas2Name="ZP1_HVs"; | |
277 | cg2=new TCanvas(canvas2Name,canvas2Name,80,80,600,600); | |
278 | cg2->Divide(2,2); | |
279 | cg2->cd(1); | |
280 | ((TGraph*) fGraphs.UncheckedAt(5))->SetMarkerStyle(20); | |
281 | ((TGraph*) fGraphs.UncheckedAt(5))->Draw("ALP"); | |
282 | cg2->cd(2); | |
283 | ((TGraph*) fGraphs.UncheckedAt(6))->SetMarkerStyle(20); | |
284 | ((TGraph*) fGraphs.UncheckedAt(6))->Draw("ALP"); | |
285 | cg2->cd(3); | |
286 | ((TGraph*) fGraphs.UncheckedAt(7))->SetMarkerStyle(20); | |
287 | ((TGraph*) fGraphs.UncheckedAt(7))->Draw("ALP"); | |
288 | cg2->cd(4); | |
289 | ((TGraph*) fGraphs.UncheckedAt(8))->SetMarkerStyle(20); | |
290 | ((TGraph*) fGraphs.UncheckedAt(8))->Draw("ALP"); | |
64a7c78d | 291 | |
292 | } | |
293 |