warning fixed
[u/mrichter/AliRoot.git] / T0 / AliT0DataDCS.cxx
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 $Log: AliT0DataDCS.cxx,v $
18  Revision   2008/01/30 
19 Fetching data points from DCS, calculating mean and storing data to Reference DB 
20  
21  Version 1.1  2006/10
22 Preliminary test version (T.Malkiewicz)
23 */
24
25 #include "AliT0DataDCS.h"
26
27 #include "AliCDBMetaData.h"
28 #include "AliDCSValue.h"
29 #include "AliLog.h"
30
31 #include <TTimeStamp.h>
32 #include <TObjString.h>
33
34 // AliT0DataDCS class
35 // declaring DCS aliases for T0
36 // fetching T0 data points from DCS, 
37 // calculating mean values for the entire run
38 // and storing the result to Reference DB
39
40 ClassImp(AliT0DataDCS)
41
42 //---------------------------------------------------------------
43 AliT0DataDCS::AliT0DataDCS():
44         TObject(),
45         fRun(0),        
46         fStartTime(0),
47         fEndTime(0),
48         fStartTimeDCSQuery(0),
49         fEndTimeDCSQuery(0),
50         fAtten(0.),
51         fMPDcentA(0),
52         fMPDcentC(0),
53         fMPDsemiCentA(0),
54         fMPDsemiCentC(0),
55         fTVDCtop(0),
56         fTVDCbottom(0),
57         fMPDmode(0),
58         fIsProcessed(kFALSE)
59 {
60   // default constructor
61   //
62   for(Int_t i=0;i<kScalers;i++) 
63   {
64     fScalerMean[i]=0;
65     fScalerSecMean[i]=0;
66   }
67   for(Int_t i=0;i<kHV;i++)
68   {
69     fHViA[i]=0.;
70     fHVvA[i]=0.;
71     fHViC[i]=0.;
72     fHVvC[i]=0.;
73   }
74   for(Int_t i=0;i<kLV;i++)
75   {
76     fLViA[i]=0.;
77     fLVvA[i]=0.;
78     fLViC[i]=0.;
79     fLVvC[i]=0.;
80   }
81   for(Int_t i=0;i<kTRM;i++)
82   {
83     fTRM[i]=0.;
84   }
85   for(Int_t i=0;i<kDRM;i++)
86   {
87     fDRM[i]=0.;
88   }
89
90 }
91 //---------------------------------------------------------------
92 AliT0DataDCS::AliT0DataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime, UInt_t startTimeDCSQuery, UInt_t endTimeDCSQuery):
93         TObject(),
94         fRun(nRun),
95         fStartTime(startTime),
96         fEndTime(endTime),
97         fStartTimeDCSQuery(startTimeDCSQuery),
98         fEndTimeDCSQuery(endTimeDCSQuery),
99         fAtten(0.),
100         fMPDcentA(0),
101         fMPDcentC(0),
102         fMPDsemiCentA(0),
103         fMPDsemiCentC(0),
104         fTVDCtop(0),
105         fTVDCbottom(0),
106         fMPDmode(0),
107         fIsProcessed(kFALSE)
108 {
109   // constructor
110
111   for(Int_t i=0;i<kScalers;i++)
112   {
113     fScalerMean[i]=0;
114     fScalerSecMean[i]=0;
115   }
116   for(Int_t i=0;i<kHV;i++)
117   {
118     fHViA[i]=0.;
119     fHVvA[i]=0.;
120     fHViC[i]=0.;
121     fHVvC[i]=0.;
122   }
123   for(Int_t i=0;i<kLV;i++)
124   {
125     fLViA[i]=0.;
126     fLVvA[i]=0.;
127     fLViC[i]=0.;
128     fLVvC[i]=0.;
129   }
130   for(Int_t i=0;i<kTRM;i++)
131   {
132     fTRM[i]=0.;
133   }
134   for(Int_t i=0;i<kDRM;i++)
135   {
136     fDRM[i]=0.;
137   }
138
139         AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s \n\tStartTime DCS Query %s \n\tEndTime DCS Query %s", nRun,
140         TTimeStamp(startTime).AsString(),
141         TTimeStamp(endTime).AsString(),
142         TTimeStamp(startTimeDCSQuery).AsString(), 
143         TTimeStamp(endTimeDCSQuery).AsString()));
144
145         Init();
146
147 }
148 //---------------------------------------------------------------
149
150 AliT0DataDCS::AliT0DataDCS(const AliT0DataDCS & data):
151   TObject(), 
152   fRun(0),
153   fStartTime(0),
154   fEndTime(0),
155   fStartTimeDCSQuery(0),
156   fEndTimeDCSQuery(0),
157   fAtten(0.),
158   fMPDcentA(0),
159   fMPDcentC(0),
160   fMPDsemiCentA(0),
161   fMPDsemiCentC(0),
162   fTVDCtop(0),
163   fTVDCbottom(0),
164   fMPDmode(0),
165   fIsProcessed(kFALSE)
166 {
167
168 // copy constructor
169
170   fRun=data.fRun;
171   fStartTime=data.fStartTime;
172   fEndTime=data.fEndTime;
173   fStartTimeDCSQuery=data.fStartTimeDCSQuery;
174   fEndTimeDCSQuery=data.fEndTimeDCSQuery;
175   fIsProcessed=data.fIsProcessed;
176   fAtten=data.fAtten;
177   fMPDcentA=data.fMPDcentA;
178   fMPDcentC=data.fMPDcentC;
179   fMPDsemiCentA=data.fMPDsemiCentA;
180   fMPDsemiCentC=data.fMPDsemiCentC;
181   fTVDCtop=data.fTVDCtop;
182   fTVDCbottom=data.fTVDCbottom;
183   fMPDmode=data.fMPDmode;
184   for(int i=0;i<kNAliases;i++) 
185   {
186     fAliasNames[i]=data.fAliasNames[i];
187   }
188   
189   for(Int_t i=0;i<kScalers;i++)
190   {
191     fScalerMean[i]=data.fScalerMean[i];
192     fScalerSecMean[i]=data.fScalerSecMean[i];
193   }
194   for(Int_t i=0;i<kHV;i++)
195   {
196     fHViA[i]=data.fHViA[i];
197     fHVvA[i]=data.fHVvA[i];
198     fHViC[i]=data.fHViC[i];
199     fHVvC[i]=data.fHVvC[i];
200   }
201   for(Int_t i=0;i<kLV;i++)
202   {
203     fLViA[i]=data.fLViA[i];
204     fLVvA[i]=data.fLVvA[i];
205     fLViC[i]=data.fLViC[i];
206     fLVvC[i]=data.fLVvC[i];
207   }
208   for(Int_t i=0;i<kTRM;i++)
209   {
210     fTRM[i]=data.fTRM[i];
211   }
212   for(Int_t i=0;i<kDRM;i++)
213   {
214     fDRM[i]=data.fDRM[i];
215   }
216 }
217 //---------------------------------------------------------------
218
219 AliT0DataDCS& AliT0DataDCS:: operator=(const AliT0DataDCS & data) { 
220
221 // assignment operator
222
223   this->fRun=data.fRun;
224   this->fStartTime=data.fStartTime;
225   this->fEndTime=data.fEndTime;
226   this->fStartTimeDCSQuery=data.fStartTimeDCSQuery;
227   this->fEndTimeDCSQuery=data.fEndTimeDCSQuery;
228
229   for(int i=0;i<kNAliases;i++)
230   {
231     this->fAliasNames[i]=data.fAliasNames[i];
232   }
233
234   return *this;
235 }
236
237 //---------------------------------------------------------------
238 AliT0DataDCS::~AliT0DataDCS() 
239 {
240 }
241
242 //---------------------------------------------------------------
243 Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
244 {
245   //process DCS data
246
247                 UInt_t t0Scaler[kScalers];
248                 UInt_t t0ScalerSec[kScalers];
249                 Int_t aliasEntr[kNAliases];
250                 Float_t t0AhvImon[kHV];
251                 Float_t t0AHVvmon[kHV];
252                 Float_t t0AlvImon[kLV];
253                 Float_t t0AlvVmon[kLV];
254                 Float_t t0ChvImon[kHV];
255                 Float_t t0ChvVmon[kHV];
256                 Float_t t0ClvImon[kLV];
257                 Float_t t0ClvVmon[kLV];
258                 Float_t t0AcfdThre[kCFD];
259                 Float_t t0AcfdWalk[kCFD];
260                 Float_t t0CcfdThre[kCFD];
261                 Float_t t0CcfdWalk[kCFD];
262                 Float_t t0ACtrm[kTRM];
263                 Float_t t0ACdrm[kDRM];
264                 Float_t t0atten=0.;
265                 Int_t t0MPDcentA=0;
266                 Int_t t0MPDcentC=0;
267                 Int_t t0MPDsemiCentA=0;
268                 Int_t t0MPDsemiCentC=0;
269                 Int_t t0TVDCtop=0;
270                 Int_t t0TVDCbottom=0;           
271                 Int_t t0MPDmode=0;
272         
273                 TObjArray *aliasArr;
274                 for(Int_t k=0; k<kScalers; k++)
275                 {
276                    t0Scaler[k]=0;
277                    t0ScalerSec[k]=0;
278                 }
279
280                 for(Int_t k=0; k<kHV; k++)
281                 {
282                    t0AhvImon[k]=0.;
283                    t0AHVvmon[k]=0.;
284                    t0ChvImon[k]=0.;
285                    t0ChvVmon[k]=0.;
286                 }
287                 for(Int_t k=0; k<kLV; k++)
288                 {
289                    t0AlvImon[k]=0.;
290                    t0AlvVmon[k]=0.;
291                    t0ClvImon[k]=0.;
292                    t0ClvVmon[k]=0.;
293                 }
294                 for(Int_t k=0; k<kCFD; k++)
295                 {
296                    t0AcfdThre[k]=0.;
297                    t0AcfdWalk[k]=0.;
298                    t0CcfdThre[k]=0.;
299                    t0CcfdWalk[k]=0.;
300                 }
301                 for(Int_t k=0; k<kTRM; k++)
302                 {
303                    t0ACtrm[k]=0.;
304                 }
305                 for(Int_t k=0; k<kDRM; k++)
306                 {
307                    t0ACdrm[k]=0.;
308                 }
309
310             // here starts the main loop
311                 for(Int_t j=0; j<kNAliases; j++)
312                 {
313                   aliasEntr[j]=0;
314                   for (Int_t k=0;k<32;k++) 
315                   {
316                     t0Scaler[k]=0;
317                     t0ScalerSec[k]=0;   
318                     
319                   }
320                   aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data());
321
322                   if(!aliasArr)
323                   {
324                         AliError(Form("Alias %s not found!", fAliasNames[j].Data()));
325                         continue;
326                   }
327                   Introduce(j, aliasArr);
328                   if(aliasArr->GetEntries()<2)
329                   {
330                         AliError(Form("Alias %s has just %d entries!",
331                                         fAliasNames[j].Data(),aliasArr->GetEntries()));
332                         continue;
333                   }
334                   if (j < kScalers)
335                   { 
336                     aliasEntr[j] = aliasArr->GetEntries();
337                     for(Int_t l=0; l<aliasEntr[j]; l++)
338                     {
339                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
340                       t0Scaler[j]+= (UInt_t)  aValue->GetFloat(); 
341                     }
342                     fScalerMean[j] = ((UInt_t) t0Scaler[j])/((UInt_t) aliasEntr[j]);
343                   }
344                   else if (j < 2*kScalers)
345                   {
346                     aliasEntr[j] = aliasArr->GetEntries();              
347                     for(Int_t l=0; l<aliasEntr[j]; l++)
348                     {
349                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
350                       t0ScalerSec[j-kScalers]+= (UInt_t)  aValue->GetFloat();  
351                     }
352                     fScalerSecMean[j-kScalers] = ((UInt_t) t0ScalerSec[j-kScalers])/((UInt_t) aliasEntr[j]);
353                   }
354                   else if (j < 2*kScalers+kHV)
355                   {
356                     aliasEntr[j] = aliasArr->GetEntries();
357                     for(Int_t l=0; l<aliasEntr[j]; l++)
358                     {
359                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
360                       t0AhvImon[j-2*kScalers]+= aValue->GetFloat();
361                     }
362                     fHViA[j-2*kScalers] = t0AhvImon[j-2*kScalers] / aliasEntr[j];
363                   }
364                   else if (j < 2*kScalers+2*kHV)
365                   {
366                     aliasEntr[j] = aliasArr->GetEntries();
367                     for(Int_t l=0; l<aliasEntr[j]; l++)
368                     {
369                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
370                       t0AHVvmon[j-(2*kScalers+kHV)]+= aValue->GetFloat();
371                     }
372                     fHVvA[j-(2*kScalers+kHV)] = t0AHVvmon[j-(2*kScalers+kHV)] / aliasEntr[j];
373                   }
374                   else if (j < 2*kScalers+2*kHV+kLV)
375                   {
376                     aliasEntr[j] = aliasArr->GetEntries();
377                     for(Int_t l=0; l<aliasEntr[j]; l++)
378                     {
379                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
380                       t0AlvImon[j-(2*kScalers+2*kHV)]+= aValue->GetFloat();
381                     }
382                     fLViA[j-(2*kScalers+2*kHV)] = t0AlvImon[j-(2*kScalers+2*kHV)] / aliasEntr[j];
383                   }
384                   else if (j < 2*kScalers+2*kHV+2*kLV)
385                   {
386                     aliasEntr[j] = aliasArr->GetEntries();
387                     for(Int_t l=0; l<aliasEntr[j]; l++)
388                     {
389                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
390                       t0AlvVmon[j-(2*kScalers+2*kHV+kLV)]+= aValue->GetFloat();
391                     }
392                     fLVvA[j-(2*kScalers+2*kHV+kLV)] = t0AlvVmon[j-(2*kScalers+2*kHV+kLV)] / aliasEntr[j];
393                   }
394                   else if (j < 2*kScalers+3*kHV+2*kLV)
395                   {
396                     aliasEntr[j] = aliasArr->GetEntries();
397                     for(Int_t l=0; l<aliasEntr[j]; l++)
398                     {
399                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
400                       t0ChvImon[j-(2*kScalers+2*kHV+2*kLV)]+= aValue->GetFloat();
401                     }
402                     fHViC[j-(2*kScalers+2*kHV+2*kLV)] = t0ChvImon[j-(2*kScalers+2*kHV+2*kLV)] / aliasEntr[j];
403                   }
404                   else if (j < 2*kScalers+4*kHV+2*kLV)
405                   {
406                     aliasEntr[j] = aliasArr->GetEntries();
407                     for(Int_t l=0; l<aliasEntr[j]; l++)
408                     {
409                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
410                       t0ChvVmon[j-(2*kScalers+3*kHV+2*kLV)]+= aValue->GetFloat();
411                     }
412                     fHVvC[j-(2*kScalers+3*kHV+2*kLV)] = t0ChvVmon[j-(2*kScalers+3*kHV+2*kLV)] / aliasEntr[j];
413                   }
414                   else if (j < 2*kScalers+4*kHV+3*kLV)
415                   {
416                     aliasEntr[j] = aliasArr->GetEntries();
417                     for(Int_t l=0; l<aliasEntr[j]; l++)
418                     {
419                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
420                       t0ClvImon[j-(2*kScalers+4*kHV+2*kLV)]+= aValue->GetFloat();
421                     }
422                     fLViC[j-(2*kScalers+4*kHV+2*kLV)] = t0ClvImon[j-(2*kScalers+4*kHV+2*kLV)] / aliasEntr[j];
423                   }
424                   else if (j < 2*kScalers+4*kHV+4*kLV)
425                   {
426                     aliasEntr[j] = aliasArr->GetEntries();
427                     for(Int_t l=0; l<aliasEntr[j]; l++)
428                     {
429                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
430                       t0ClvVmon[j-(2*kScalers+4*kHV+3*kLV)]+= aValue->GetFloat();
431                     }
432                     fLVvC[j-(2*kScalers+4*kHV+3*kLV)] = t0ClvVmon[j-(2*kScalers+4*kHV+3*kLV)] / aliasEntr[j];
433                   }
434                   else if (j < 2*kScalers+4*kHV+4*kLV+kCFD)
435                   {
436                     aliasEntr[j] = aliasArr->GetEntries();
437                     for(Int_t l=0; l<aliasEntr[j]; l++)
438                     {
439                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
440                       t0AcfdThre[j-(2*kScalers+4*kHV+4*kLV)]+= aValue->GetFloat();
441                     }
442                     fCFDtA[j-(2*kScalers+4*kHV+4*kLV)] = t0AcfdThre[j-(2*kScalers+4*kHV+4*kLV)] / aliasEntr[j];
443                   }
444                   else if (j < 2*kScalers+4*kHV+4*kLV+2*kCFD)
445                   {
446                     aliasEntr[j] = aliasArr->GetEntries();
447                     for(Int_t l=0; l<aliasEntr[j]; l++)
448                     {
449                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
450                       t0AcfdWalk[j-(2*kScalers+4*kHV+4*kLV+kCFD)]+= aValue->GetFloat();
451                     }
452                     fCFDwA[j-(2*kScalers+4*kHV+4*kLV+kCFD)] = t0AcfdWalk[j-(2*kScalers+4*kHV+4*kLV+kCFD)] / aliasEntr[j];
453                   }
454                   else if (j < 2*kScalers+4*kHV+4*kLV+3*kCFD)
455                   {
456                     aliasEntr[j] = aliasArr->GetEntries();
457                     for(Int_t l=0; l<aliasEntr[j]; l++)
458                     {
459                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
460                       t0CcfdThre[j-(2*kScalers+4*kHV+4*kLV+2*kCFD)]+= aValue->GetFloat();
461                     }
462                     fCFDtC[j-(2*kScalers+4*kHV+4*kLV+2*kCFD)] = t0CcfdThre[j-(2*kScalers+4*kHV+4*kLV+2*kCFD)] / aliasEntr[j];
463                   }
464                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD)
465                   {
466                     aliasEntr[j] = aliasArr->GetEntries();
467                     for(Int_t l=0; l<aliasEntr[j]; l++)
468                     {
469                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
470                       t0CcfdWalk[j-(2*kScalers+4*kHV+4*kLV+3*kCFD)]+= aValue->GetFloat();
471                     }
472                     fCFDwC[j-(2*kScalers+4*kHV+4*kLV+3*kCFD)] = t0CcfdWalk[j-(2*kScalers+4*kHV+4*kLV+3*kCFD)] / aliasEntr[j];
473                   }
474                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM)
475                   {
476                     aliasEntr[j] = aliasArr->GetEntries();
477                     for(Int_t l=0; l<aliasEntr[j]; l++)
478                     {
479                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
480                       t0ACtrm[j-(2*kScalers+4*kHV+4*kLV+4*kCFD)]+= aValue->GetFloat();
481                     }
482                     fTRM[j-(2*kScalers+4*kHV+4*kLV+4*kCFD)] = t0ACtrm[j-(2*kScalers+4*kHV+4*kLV+4*kCFD)] / aliasEntr[j];
483                   }
484                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM)
485                   {
486                     aliasEntr[j] = aliasArr->GetEntries();
487                     for(Int_t l=0; l<aliasEntr[j]; l++)
488                     {
489                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
490                       t0ACdrm[j-(2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM)]+= aValue->GetFloat();
491                     }
492                     fDRM[j-(2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM)] = t0ACdrm[j-(2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM)] / aliasEntr[j];
493                   }
494                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+kAtten)
495                   {
496                     aliasEntr[j] = aliasArr->GetEntries();
497                     for(Int_t l=0; l<aliasEntr[j]; l++)
498                     {           
499                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
500                       t0atten += aValue->GetFloat();  
501                     }
502                     fAtten = t0atten /((Float_t) aliasEntr[j]);
503                   }
504                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+2*kAtten)
505                   {
506                     aliasEntr[j] = aliasArr->GetEntries();
507                     for(Int_t l=0; l<aliasEntr[j]; l++)
508                     {
509                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
510                       t0MPDcentA +=  aValue->GetFloat();
511                     }
512                     fMPDcentA = t0MPDcentA /((Float_t) aliasEntr[j]);
513                   }
514                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+3*kAtten)
515                   {
516                     aliasEntr[j] = aliasArr->GetEntries();
517                     for(Int_t l=0; l<aliasEntr[j]; l++)
518                     {
519                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
520                       t0MPDcentC += (Int_t) aValue->GetFloat();
521                     }
522                     fMPDcentC = ((Int_t) t0MPDcentC) /((Int_t) aliasEntr[j]);
523                   }
524                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+4*kAtten)
525                   {
526                     aliasEntr[j] = aliasArr->GetEntries();
527                     for(Int_t l=0; l<aliasEntr[j]; l++)
528                     {
529                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
530                       t0MPDsemiCentA += (Int_t) aValue->GetFloat();
531                     }
532                     fMPDsemiCentA =  ((Int_t) t0MPDsemiCentA) /((Int_t) aliasEntr[j]);
533                   }
534                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+5*kAtten)
535                   {
536                     aliasEntr[j] = aliasArr->GetEntries();
537                     for(Int_t l=0; l<aliasEntr[j]; l++)
538                     {
539                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
540                       t0MPDsemiCentC += (Int_t) aValue->GetFloat();
541                     }
542                     fMPDsemiCentC =  ((Int_t) t0MPDsemiCentC)/ ((Int_t) aliasEntr[j]);
543                   }
544                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+6*kAtten)
545                   {
546                     aliasEntr[j] = aliasArr->GetEntries();
547                     for(Int_t l=0; l<aliasEntr[j]; l++)
548                     {
549                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
550                       t0TVDCtop += (Int_t)  aValue->GetFloat();
551                     }
552                     fTVDCtop =  ((Int_t) t0TVDCtop)/((Int_t) aliasEntr[j]);
553                   }
554                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+7*kAtten)
555                   {
556                     aliasEntr[j] = aliasArr->GetEntries();
557                     for(Int_t l=0; l<aliasEntr[j]; l++)
558                     {
559                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
560                       t0TVDCbottom += (Int_t) aValue->GetFloat();
561                     }
562                     fTVDCbottom = ((Int_t) t0TVDCbottom) /((Int_t) aliasEntr[j]);
563                   }
564                   else
565                   {
566                     aliasEntr[j] = aliasArr->GetEntries();
567                     for(Int_t l=0; l<aliasEntr[j]; l++)
568                     {
569                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
570                       t0MPDmode += (Int_t) aValue->GetFloat();
571                     }
572                     fMPDmode = ((Int_t) t0MPDmode)/((Int_t) aliasEntr[j]);
573                   }
574                 }
575         fIsProcessed=kTRUE;
576         return kTRUE;
577 }
578
579 //---------------------------------------------------------------
580 void AliT0DataDCS::Init()
581 {
582   // initialize all DP aliases
583
584   TString sindex;
585   for(int i=0;i<kNAliases;i++)
586     {   
587       if (i<kScalers)
588         {
589           fAliasNames[i] = "t00_ac_scaler_";
590           sindex.Form("%02d",i);
591           fAliasNames[i] += sindex;
592         }
593       else if (i < 2*kScalers)
594         {
595           fAliasNames[i] = "t00_ac_scaler_sec_";
596           sindex.Form("%02d",i-kScalers);
597           fAliasNames[i] += sindex;
598         }
599       else if (i < 2*kScalers+kHV)
600         {
601           fAliasNames[i] = "t00_a_hv_imon_";
602           sindex.Form("%02d",i-2*kScalers);
603           fAliasNames[i] += sindex;
604         }
605       else if (i < 2*kScalers+2*kHV)
606         {
607           fAliasNames[i] = "t00_a_hv_vmon_";
608           sindex.Form("%02d",i-(2*kScalers+kHV));
609           fAliasNames[i] += sindex;
610         }
611       else if (i < 2*kScalers+2*kHV+kLV)
612         {
613           fAliasNames[i] = "t00_a_lv_imon_";
614           sindex.Form("%01d",i-(2*kScalers+2*kHV));
615           fAliasNames[i] += sindex;
616         }
617       else if (i < 2*kScalers+2*kHV+2*kLV)
618         {
619           fAliasNames[i] = "t00_a_lv_vmon_";
620           sindex.Form("%01d",i-(2*kScalers+2*kHV+kLV));
621           fAliasNames[i] += sindex;
622         }
623       else if (i < 2*kScalers+3*kHV+2*kLV)
624         {
625           fAliasNames[i] = "t00_c_hv_imon_";
626           sindex.Form("%02d",i-(2*kScalers+2*kHV+2*kLV));
627           fAliasNames[i] += sindex;
628         }
629       else if (i < 2*kScalers+4*kHV+2*kLV)
630         {
631           fAliasNames[i] = "t00_c_hv_vmon_";
632           sindex.Form("%02d",i-(2*kScalers+3*kHV+2*kLV));
633           fAliasNames[i] += sindex;
634         }
635       else if (i < 2*kScalers+4*kHV+3*kLV)
636         {
637           fAliasNames[i] = "t00_c_lv_imon_";
638           sindex.Form("%01d",i-(2*kScalers+4*kHV+2*kLV));
639           fAliasNames[i] += sindex;
640         }
641       else if (i < 2*kScalers+4*kHV+4*kLV)
642         {
643           fAliasNames[i] = "t00_c_lv_vmon_";
644           sindex.Form("%01d",i-(2*kScalers+4*kHV+3*kLV));
645           fAliasNames[i] += sindex;
646         }
647       else if (i < 2*kScalers+4*kHV+4*kLV+kCFD)
648         {
649           fAliasNames[i] = "t00_a_cfd_thre_";
650           sindex.Form("%02d",i-(2*kScalers+4*kHV+4*kLV));
651           fAliasNames[i] += sindex;
652         }
653       else if (i < 2*kScalers+4*kHV+4*kLV+2*kCFD)
654         {
655           fAliasNames[i] = "t00_a_cfd_walk_";
656           sindex.Form("%02d",i-(2*kScalers+4*kHV+4*kLV+kCFD));
657           fAliasNames[i] += sindex;
658         }
659       else if (i < 2*kScalers+4*kHV+4*kLV+3*kCFD)
660         {
661           fAliasNames[i] = "t00_c_cfd_thre_";
662                   sindex.Form("%02d",i-(2*kScalers+4*kHV+4*kLV+2*kCFD));
663                   fAliasNames[i] += sindex;
664         }
665       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD)
666                 {
667                   fAliasNames[i] = "t00_c_cfd_walk_";
668                   sindex.Form("%02d",i-(2*kScalers+4*kHV+4*kLV+3*kCFD));
669                   fAliasNames[i] += sindex;
670                 }
671       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM)
672         {
673           fAliasNames[i] = "t00_ac_trm_";
674           sindex.Form("%02d",i-(2*kScalers+4*kHV+4*kLV+4*kCFD));
675           fAliasNames[i] += sindex;
676         }
677       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM)
678         {
679           fAliasNames[i] = "t00_ac_drm_";
680           sindex.Form("%02d",i-(2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM));
681           fAliasNames[i] += sindex;
682         }
683       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+kAtten)
684         {
685           fAliasNames[i] = "t00_ac_atten";
686         }
687       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+2*kAtten)
688         {
689           fAliasNames[i] = "t00_a_mpd_cent";
690         }
691       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+3*kAtten)
692         {
693           fAliasNames[i] = "t00_c_mpd_cent";
694         }
695       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+4*kAtten)
696         {
697           fAliasNames[i] = "t00_a_mpd_scent";
698                 }
699       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+5*kAtten)
700         {
701           fAliasNames[i] = "t00_c_mpd_scent";
702         }
703       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+6*kAtten)
704         {
705           fAliasNames[i] = "t00_ac_tvdc_top";
706         }
707       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+7*kAtten)
708         {
709           fAliasNames[i] = "t00_ac_tvdc_bottom";
710         }
711       else
712         {
713           fAliasNames[i] = "t00_ac_mpd_mode";
714         }
715     }
716
717 }
718
719 //---------------------------------------------------------------
720 void AliT0DataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)const
721 {
722
723         int entries=aliasArr->GetEntries();
724         AliInfo(Form("************ Alias: %s **********",fAliasNames[numAlias].Data()));
725         AliInfo(Form("          %d DP values collected",entries));
726
727 }
728
729
730 //---------------------------------------------------------------
731 void  AliT0DataDCS::PrintfArray(const char *label,  const Float_t *array, Int_t numElements) const
732 {
733   //print all elements of array
734   printf("%s: \n",label);
735   for(Int_t i=0;i<numElements;i++){
736     printf("  %.2f", array[i]);
737   }
738   printf("\n");
739 }
740 //---------------------------------------------------------------
741
742 void AliT0DataDCS::PrintT0Data() const
743 {
744   //print DP values
745
746   printf("AliT0DataDCS::Print()\n");
747   printf("RUN:                %d\n", fRun);           
748   printf("START TIME:         %d\n", fStartTime);  
749   printf("END TIME:           %d\n", fEndTime); 
750   printf("StartTimeDCSQuery:  %d\n", fStartTimeDCSQuery);
751   printf("EndTimeDCSQuery:    %d\n", fEndTimeDCSQuery);
752
753   PrintfArray("HV A side current", fHViA, kHV);
754   PrintfArray("HV A side voltage", fHVvA, kHV);
755   PrintfArray("LV A side current", fLViA, kLV);
756   PrintfArray("LV A side voltage", fLVvA, kLV);
757   PrintfArray("HV C side current", fHViC, kHV);
758   PrintfArray("HV C side voltage", fHVvC, kHV);
759   PrintfArray("LV C side current", fLViC, kLV);
760   PrintfArray("LV C side voltage", fLVvC, kLV);
761
762   PrintfArray("CFD threshold A side", fCFDtA, kCFD);        
763   PrintfArray("CFD walk A side", fCFDwA, kCFD);              
764   PrintfArray("CFD threshold C side", fCFDtC, kCFD);          
765   PrintfArray("CFD walk C side", fCFDwC, kCFD);                
766
767   //PrintfArray("SCALERS", (Float_t*) fScalerMean, kScalers); 
768   printf("SCALERS: \n");
769   for(Int_t i=0;i<kScalers;i++){
770     printf("  %d", fScalerMean[i]);
771   }
772   printf("\n");
773
774   
775  // PrintfArray("SCALERS per second",(Float_t*) fScalerSecMean, kScalers);  
776   printf("SCALERS per second: \n");
777   for(Int_t i=0;i<kScalers;i++){
778     printf("  %d", fScalerSecMean[i]);
779   }
780   printf("\n");
781
782
783
784
785   PrintfArray("TRM", fTRM, kTRM);                 
786   PrintfArray("DRM", fDRM, kDRM);                  
787
788   printf("Laser Amplitude: %f\n", fAtten);                    
789   printf("mult. discrim. central A side: %d\n", fMPDcentA);                     
790   printf("mult. discrim. central C side: %d\n", fMPDcentC);                     
791   printf("mult. discrim. semi-central A side: %d\n", fMPDsemiCentA);                     
792   printf("mult. discrim. semi-central C side: %d\n", fMPDsemiCentC);                    
793
794   printf("TVDC top:     %d\n", fTVDCtop);   
795   printf("TVDC bottom:  %d\n", fTVDCbottom);   
796   printf("MPDmode:      %d\n", fMPDmode);   
797 }
798
799