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