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