]>
Commit | Line | Data |
---|---|---|
345932e4 | 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 | /* | |
7fffa85b | 17 | $Log: AliTOFDataDCS.cxx,v $ |
18 | Revision 1.9 2007/05/04 14:02:45 decaro | |
19 | AliTOFDataDCS::Draw(Option_t *) method declared const: compiling warning suppression | |
20 | ||
b52b97c2 | 21 | Revision 1.8 2007/05/03 09:45:09 decaro |
22 | Coding convention: RN11 violation -> suppression | |
23 | ||
9d5fd6fe | 24 | Revision 1.7 2007/05/02 14:09:39 arcelli |
25 | Retrieval of Env. Temperature removed (will get it from the GRP) | |
26 | ||
38e3bbf1 | 27 | Revision 1.6 2007/04/04 17:19:19 arcelli |
28 | Moved some printout to debug level | |
29 | ||
72bf252d | 30 | Revision 1.5 2007/02/20 15:57:00 decaro |
31 | Raw data update: to read the TOF raw data defined in UNPACKED mode | |
32 | ||
15ec34b9 | 33 | Revision 1.4 2007/02/19 15:41:55 decaro |
34 | Coding convention: few corrections | |
35 | ||
3a3ece53 | 36 | Revision 1.3 2007/01/24 11:19:58 arcelli |
37 | Modify ProcessData to return a logical (CZ) | |
38 | ||
ebab534a | 39 | Revision 1.2 2006/12/18 18:17:38 arcelli |
40 | Updated Aliases for DCS TOF datapoints (C.Zampolli) | |
41 | ||
8259e6f8 | 42 | Revision 1.1 2006/10/26 09:10:52 arcelli |
43 | Class for handling the TOF DCS data in the Shuttle (C.Zampolli) | |
44 | ||
345932e4 | 45 | */ |
46 | ||
5c7c93fa | 47 | #include "TString.h" |
48 | //#include "TF1.h" | |
49 | //#include "TH1F.h" | |
50 | #include "TTimeStamp.h" | |
51 | #include "TMap.h" | |
52 | #include "TCanvas.h" | |
345932e4 | 53 | |
54 | #include "AliDCSValue.h" | |
55 | #include "AliLog.h" | |
56 | ||
5c7c93fa | 57 | #include "AliTOFDataDCS.h" |
345932e4 | 58 | #include "AliTOFFormatDCS.h" |
345932e4 | 59 | |
60 | class TH2; | |
61 | class AliCDBMetaData; | |
62 | class TDatime; | |
63 | ||
64 | // AliTOFDataDCS class | |
65 | // main aim to introduce the aliases for the TOF DCS | |
66 | // data points to be then | |
67 | // stored in the OCDB, and to process them. | |
68 | // Process() method called by TOFPrepr | |
69 | ||
70 | ClassImp(AliTOFDataDCS) | |
71 | ||
72 | //--------------------------------------------------------------- | |
73 | AliTOFDataDCS::AliTOFDataDCS(): | |
74 | TObject(), | |
75 | fRun(0), | |
76 | fStartTime(0), | |
77 | fEndTime(0), | |
ff326f84 | 78 | fStartTimeDCSQuery(0), |
79 | fEndTimeDCSQuery(0), | |
7fffa85b | 80 | fIsProcessed(kFALSE), |
81 | fFDR(kFALSE) | |
345932e4 | 82 | { |
83 | ||
84 | // main constructor | |
85 | ||
8259e6f8 | 86 | for(int i=0;i<kNHV;i++) { |
87 | fHVvp[i]=0x0; | |
88 | fHVvn[i]=0x0; | |
89 | fHVip[i]=0x0; | |
90 | fHVin[i]=0x0; | |
91 | } | |
d202b31a | 92 | |
8259e6f8 | 93 | |
345932e4 | 94 | } |
95 | ||
96 | //--------------------------------------------------------------- | |
ff326f84 | 97 | AliTOFDataDCS::AliTOFDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime, UInt_t startTimeDCSQuery, UInt_t endTimeDCSQuery): |
345932e4 | 98 | TObject(), |
99 | fRun(nRun), | |
100 | fStartTime(startTime), | |
101 | fEndTime(endTime), | |
ff326f84 | 102 | fStartTimeDCSQuery(startTimeDCSQuery), |
103 | fEndTimeDCSQuery(endTimeDCSQuery), | |
7fffa85b | 104 | fIsProcessed(kFALSE), |
105 | fFDR(kFALSE) | |
345932e4 | 106 | { |
107 | ||
108 | // constructor with arguments | |
109 | ||
ff326f84 | 110 | AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s \n\tStartTime DCS Query %s \n\tEndTime DCS Query %s", nRun, |
345932e4 | 111 | TTimeStamp(startTime).AsString(), |
ff326f84 | 112 | TTimeStamp(endTime).AsString(), |
113 | TTimeStamp(startTimeDCSQuery).AsString(), | |
114 | TTimeStamp(endTimeDCSQuery).AsString())); | |
345932e4 | 115 | |
116 | Init(); | |
117 | ||
118 | } | |
119 | ||
120 | //--------------------------------------------------------------- | |
121 | ||
122 | AliTOFDataDCS::AliTOFDataDCS(const AliTOFDataDCS & data): | |
8a190ba2 | 123 | TObject(data), |
124 | fRun(data.fRun), | |
125 | fStartTime(data.fStartTime), | |
126 | fEndTime(data.fEndTime), | |
127 | fStartTimeDCSQuery(data.fStartTimeDCSQuery), | |
128 | fEndTimeDCSQuery(data.fEndTimeDCSQuery), | |
129 | fIsProcessed(data.fIsProcessed), | |
130 | fFDR(data.fFDR) | |
345932e4 | 131 | |
132 | { | |
133 | ||
134 | // copy constructor | |
135 | ||
345932e4 | 136 | for(int i=0;i<kNAliases;i++) { |
137 | fAliasNames[i]=data.fAliasNames[i]; | |
138 | } | |
139 | ||
140 | for(int i=0;i<kNHV;i++) { | |
8259e6f8 | 141 | fHVvp[i]=data.fHVvp[i]; |
142 | fHVvn[i]=data.fHVvn[i]; | |
143 | fHVip[i]=data.fHVip[i]; | |
144 | fHVin[i]=data.fHVin[i]; | |
345932e4 | 145 | } |
146 | ||
38e3bbf1 | 147 | |
345932e4 | 148 | } |
149 | //--------------------------------------------------------------- | |
150 | ||
151 | AliTOFDataDCS& AliTOFDataDCS:: operator=(const AliTOFDataDCS & data) { | |
152 | ||
153 | // assignment operator | |
154 | ||
8a190ba2 | 155 | if (this == &data) |
156 | return *this; | |
157 | ||
158 | TObject::operator=(data); | |
159 | fRun=data.GetRun(); | |
160 | fStartTime=data.GetStartTime(); | |
161 | fEndTime=data.GetEndTime(); | |
162 | fStartTimeDCSQuery=data.GetStartTimeDCSQuery(); | |
163 | fEndTimeDCSQuery=data.GetEndTimeDCSQuery(); | |
345932e4 | 164 | |
165 | for(int i=0;i<kNAliases;i++) { | |
8a190ba2 | 166 | fAliasNames[i]=data.GetAliasName(i); |
345932e4 | 167 | } |
168 | ||
345932e4 | 169 | for(int i=0;i<kNHV;i++) { |
8a190ba2 | 170 | fHVvp[i]=data.GetHVvp(i); |
171 | fHVvn[i]=data.GetHVvn(i); | |
172 | fHVip[i]=data.GetHVip(i); | |
173 | fHVin[i]=data.GetHVin(i); | |
345932e4 | 174 | } |
175 | ||
345932e4 | 176 | |
177 | return *this; | |
178 | } | |
179 | //--------------------------------------------------------------- | |
180 | AliTOFDataDCS::~AliTOFDataDCS() { | |
181 | ||
182 | // destructor | |
183 | ||
8259e6f8 | 184 | for(int i=0;i<kNHV;i++) { |
185 | delete fHVvp[i]; | |
186 | fHVvp[i]=0; | |
187 | delete fHVvn[i]; | |
188 | fHVvn[i]=0; | |
189 | delete fHVip[i]; | |
190 | fHVip[i]=0; | |
191 | delete fHVin[i]; | |
192 | fHVin[i]=0; | |
193 | } | |
194 | ||
345932e4 | 195 | } |
196 | ||
345932e4 | 197 | //--------------------------------------------------------------- |
ebab534a | 198 | Bool_t AliTOFDataDCS::ProcessData(TMap& aliasMap){ |
345932e4 | 199 | |
3a3ece53 | 200 | // method to process the data |
201 | ||
345932e4 | 202 | if(!(fAliasNames[0])) Init(); |
203 | ||
345932e4 | 204 | Float_t val=0; |
205 | Float_t val1=0; | |
206 | Float_t time=0; | |
207 | Float_t delta[2]; | |
208 | Float_t timedelta[2]; | |
209 | ||
e83a0dd0 | 210 | AliInfo(Form(" Start Time = %i",fStartTime)); |
211 | AliInfo(Form(" End Time = %i",fEndTime)); | |
ff326f84 | 212 | AliInfo(Form(" Start Time DCS Query= %i",fStartTimeDCSQuery)); |
213 | AliInfo(Form(" End Time DCS Query= %i",fEndTimeDCSQuery)); | |
e83a0dd0 | 214 | |
215 | if (fEndTime==fStartTime){ | |
216 | AliError(Form(" Run with null time length: start time = %i = end time = %i",fStartTime,fEndTime)); | |
217 | return kFALSE; | |
96fec15b | 218 | } |
219 | ||
345932e4 | 220 | TObjArray *aliasArr; |
221 | AliDCSValue* aValue; | |
222 | AliDCSValue* aValue1; | |
345932e4 | 223 | |
224 | // starting loop on aliases | |
225 | for(int j=0; j<kNAliases; j++){ | |
226 | for (Int_t k=0;k<2;k++) { | |
227 | delta[k]=0; | |
228 | timedelta[k]=0; | |
229 | } | |
230 | //AliInfo(Form("j = %i, with alias = %s",j,fAliasNames[j].Data())); | |
231 | aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data()); | |
232 | if(!aliasArr){ | |
233 | AliError(Form("Alias %s not found!", fAliasNames[j].Data())); | |
7fffa85b | 234 | if (!fFDR){ |
235 | return kFALSE; // returning only in case we are not in a FDR run | |
236 | } | |
237 | else { | |
238 | continue; | |
239 | } | |
345932e4 | 240 | } |
241 | ||
242 | Introduce(j, aliasArr); | |
243 | ||
244 | if(aliasArr->GetEntries()<3){ | |
245 | AliError(Form("Alias %s has just %d entries!", | |
246 | fAliasNames[j].Data(),aliasArr->GetEntries())); | |
247 | continue; | |
248 | } | |
249 | ||
250 | TIter iterarray(aliasArr); | |
251 | ||
252 | Int_t nentries = aliasArr->GetEntries(); | |
345932e4 | 253 | Int_t deltaTimeStamp = (Int_t) nentries/3; |
254 | Int_t deltaTimeStamp1 = (Int_t) nentries/2; | |
345932e4 | 255 | |
256 | // filling aliases with 10 floats+1 Usign | |
38e3bbf1 | 257 | Int_t index = 0; |
258 | for (Int_t k=0;k<3;k++){ | |
259 | index = deltaTimeStamp*k; | |
260 | if (k==0) { | |
261 | index=0; | |
345932e4 | 262 | } |
38e3bbf1 | 263 | else if (k==1) { |
264 | index=deltaTimeStamp1; | |
265 | } | |
266 | else if (k==2) { | |
267 | index=nentries-1; | |
345932e4 | 268 | } |
38e3bbf1 | 269 | aValue = (AliDCSValue*) aliasArr->At(index); |
270 | val = aValue->GetFloat(); | |
271 | time = (Float_t) (aValue->GetTimeStamp()); | |
272 | if (j<kNHV){ | |
273 | fHVvp[j]->SetFloat(k,val); | |
274 | fHVvp[j]->SetTimeStampFloat(k,time); | |
275 | } | |
276 | else if (j<kNHV*2){ | |
277 | fHVvn[j-kNHV]->SetFloat(k,val); | |
278 | fHVvn[j-kNHV]->SetTimeStampFloat(k,time); | |
279 | } | |
280 | else if (j<kNHV*3){ | |
281 | fHVip[j-2*kNHV]->SetFloat(k,val); | |
282 | fHVip[j-2*kNHV]->SetTimeStampFloat(k,time); | |
283 | } | |
284 | else if (j<kNHV*4){ | |
285 | fHVin[j-3*kNHV]->SetFloat(k,val); | |
286 | fHVin[j-3*kNHV]->SetTimeStampFloat(k,time); | |
287 | } | |
345932e4 | 288 | } |
38e3bbf1 | 289 | |
345932e4 | 290 | //computing the most significant variations |
291 | ||
ff326f84 | 292 | //Float_t timeDiff = (Float_t)(fEndTime-fStartTime); |
293 | Float_t timeDiff = (Float_t)(fEndTimeDCSQuery-fStartTimeDCSQuery); | |
e83a0dd0 | 294 | Int_t deltamin = (Int_t)(60/timeDiff*nentries); //sampling every minute |
345932e4 | 295 | Int_t klast = nentries-deltamin; |
38e3bbf1 | 296 | |
345932e4 | 297 | for (Int_t k=0;k<klast;k++){ |
298 | aValue = (AliDCSValue*) aliasArr->At(k); | |
299 | aValue1 = (AliDCSValue*) aliasArr->At(k+deltamin); | |
300 | val = aValue->GetFloat(); | |
301 | val1 = aValue1->GetFloat(); | |
302 | if (delta[0]<=TMath::Abs(val1-val)) { | |
303 | delta[0]=TMath::Abs(val1-val); | |
304 | timedelta[0] = (Float_t)k; | |
305 | } | |
306 | if (delta[1]<=delta[0]) { | |
307 | Float_t temp = delta[1]; | |
308 | Float_t timetemp = timedelta[1]; | |
309 | delta[1]=delta[0]; | |
310 | delta[0]=temp; | |
311 | timedelta[1]=timedelta[0]; | |
312 | timedelta[0]=timetemp; | |
313 | } | |
314 | } | |
315 | ||
316 | for (Int_t kk=0;kk<2;kk++){ | |
38e3bbf1 | 317 | if (j<kNHV){ |
318 | fHVvp[j]->SetDelta(kk,delta[kk]); | |
319 | fHVvp[j]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]); | |
345932e4 | 320 | } |
38e3bbf1 | 321 | else if (j<kNHV*2){ |
322 | fHVvn[j-kNHV]->SetDelta(kk,delta[kk]); | |
323 | fHVvn[j-kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]); | |
324 | } | |
325 | else if (j<kNHV*3){ | |
326 | fHVip[j-2*kNHV]->SetDelta(kk,delta[kk]); | |
327 | fHVip[j-2*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]); | |
328 | } | |
329 | else if (j<kNHV*4){ | |
330 | fHVin[j-3*kNHV]->SetDelta(kk,delta[kk]); | |
331 | fHVin[j-3*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]); | |
332 | } | |
8259e6f8 | 333 | } |
345932e4 | 334 | } |
38e3bbf1 | 335 | |
345932e4 | 336 | fIsProcessed=kTRUE; |
337 | ||
ebab534a | 338 | return kTRUE; |
345932e4 | 339 | } |
340 | ||
341 | //--------------------------------------------------------------- | |
342 | void AliTOFDataDCS::Init(){ | |
343 | ||
344 | // initialization of aliases and DCS data | |
345 | ||
8259e6f8 | 346 | TString sindex; |
345932e4 | 347 | for(int i=0;i<kNAliases;i++){ |
8259e6f8 | 348 | //HV, v |
345932e4 | 349 | if (i<kNHV){ |
8259e6f8 | 350 | fAliasNames[i] = "tof_hv_vp_"; |
351 | sindex.Form("%02i",i); | |
352 | fAliasNames[i] += sindex; | |
353 | fHVvp[i] = new AliTOFFormatDCS(); | |
345932e4 | 354 | } |
355 | else if (i<kNHV*2){ | |
8259e6f8 | 356 | fAliasNames[i] = "tof_hv_vn_"; |
357 | sindex.Form("%02i",i-kNHV); | |
358 | fAliasNames[i] += sindex; | |
359 | fHVvn[i-kNHV] = new AliTOFFormatDCS(); | |
345932e4 | 360 | } |
8259e6f8 | 361 | //HV, i |
345932e4 | 362 | else if (i<kNHV*3){ |
8259e6f8 | 363 | fAliasNames[i] = "tof_hv_ip_"; |
364 | sindex.Form("%02i",i-2*kNHV); | |
365 | fAliasNames[i] += sindex; | |
366 | fHVip[i-2*kNHV] = new AliTOFFormatDCS(); | |
345932e4 | 367 | } |
368 | else if (i<kNHV*4){ | |
8259e6f8 | 369 | fAliasNames[i] = "tof_hv_in_"; |
370 | sindex.Form("%02i",i-3*kNHV); | |
371 | fAliasNames[i] += sindex; | |
372 | fHVin[i-3*kNHV] = new AliTOFFormatDCS(); | |
345932e4 | 373 | } |
345932e4 | 374 | } |
375 | } | |
376 | ||
377 | ||
378 | //--------------------------------------------------------------- | |
379 | void AliTOFDataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)const | |
380 | { | |
381 | ||
382 | // method to introduce new aliases | |
383 | ||
384 | int entries=0; | |
385 | entries = aliasArr->GetEntries(); | |
386 | int nal=0; | |
387 | nal=numAlias; | |
72bf252d | 388 | AliDebug(2,Form("************ Alias: %s **********",fAliasNames[numAlias].Data())); |
389 | AliDebug(2,Form(" %d DP values collected",entries)); | |
345932e4 | 390 | |
391 | } | |
392 | ||
393 | //--------------------------------------------------------------- | |
b52b97c2 | 394 | void AliTOFDataDCS::Draw(const Option_t* /*option*/) |
345932e4 | 395 | { |
396 | // Draw all histos and graphs | |
397 | ||
398 | if(!fIsProcessed) return; | |
399 | ||
400 | TCanvas *ch; | |
401 | TString canvasHistoName="Histos"; | |
402 | ch=new TCanvas(canvasHistoName,canvasHistoName,20,20,600,600); | |
403 | ch->cd(); | |
404 | ||
405 | // to be implemented | |
406 | ||
407 | } | |
408 |