3 hisograms for online satellite monitoring added
[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=static_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=static_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=static_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=static_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=static_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=static_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=static_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=static_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=static_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=static_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=static_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=static_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=static_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=static_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=static_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=static_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=static_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=static_cast<AliDCSValue*> (aliasArr->At(l));
525                       t0MPDcentA +=  Int_t(aValue->GetFloat());
526                     }
527                     if(aliasEntr[j]!=0)
528                       fMPDcentA = t0MPDcentA / aliasEntr[j];
529                   }
530                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+3*kAtten)
531                   {
532                     aliasEntr[j] = aliasArr->GetEntries();
533                     for(Int_t l=0; l<aliasEntr[j]; l++)
534                     {
535                       AliDCSValue *aValue=static_cast<AliDCSValue*> (aliasArr->At(l));
536                       t0MPDcentC += (Int_t) aValue->GetFloat();
537                     }
538                     fMPDcentC = ((Int_t) t0MPDcentC) /((Int_t) aliasEntr[j]);
539                   }
540                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+4*kAtten)
541                   {
542                     aliasEntr[j] = aliasArr->GetEntries();
543                     for(Int_t l=0; l<aliasEntr[j]; l++)
544                     {
545                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
546                       t0MPDsemiCentA += (Int_t) aValue->GetFloat();
547                     }
548                     fMPDsemiCentA =  ((Int_t) t0MPDsemiCentA) /((Int_t) aliasEntr[j]);
549                   }
550                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+5*kAtten)
551                   {
552                     aliasEntr[j] = aliasArr->GetEntries();
553                     for(Int_t l=0; l<aliasEntr[j]; l++)
554                     {
555                       AliDCSValue *aValue=static_cast<AliDCSValue*> (aliasArr->At(l));
556                       t0MPDsemiCentC += (Int_t) aValue->GetFloat();
557                     }
558                     fMPDsemiCentC =  ((Int_t) t0MPDsemiCentC)/ ((Int_t) aliasEntr[j]);
559                   }
560                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+6*kAtten)
561                   {
562                     aliasEntr[j] = aliasArr->GetEntries();
563                     for(Int_t l=0; l<aliasEntr[j]; l++)
564                     {
565                       AliDCSValue *aValue=static_cast<AliDCSValue*> (aliasArr->At(l));
566                       t0TVDCtop += (Int_t)  aValue->GetFloat();
567                     }
568                     fTVDCtop =  ((Int_t) t0TVDCtop)/((Int_t) aliasEntr[j]);
569                   }
570                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+7*kAtten)
571                   {
572                     aliasEntr[j] = aliasArr->GetEntries();
573                     for(Int_t l=0; l<aliasEntr[j]; l++)
574                     {
575                       AliDCSValue *aValue=static_cast<AliDCSValue*> (aliasArr->At(l));
576                       t0TVDCbottom += (Int_t) aValue->GetFloat();
577                     }
578                     fTVDCbottom = ((Int_t) t0TVDCbottom) /((Int_t) aliasEntr[j]);
579                   }
580                   else
581                   {
582                     aliasEntr[j] = aliasArr->GetEntries();
583                     for(Int_t l=0; l<aliasEntr[j]; l++)
584                     {
585                       AliDCSValue *aValue=static_cast<AliDCSValue*> (aliasArr->At(l));
586                       t0MPDmode += (Int_t) aValue->GetFloat();
587                     }
588                     fMPDmode = ((Int_t) t0MPDmode)/((Int_t) aliasEntr[j]);
589                   }
590                 }
591         fIsProcessed=kTRUE;
592         return kTRUE;
593 }
594
595 //---------------------------------------------------------------
596 void AliT0DataDCS::Init()
597 {
598   // initialize all DP aliases
599
600   TString sindex;
601   for(int i=0;i<kNAliases;i++)
602     {   
603       if (i<kScalers)
604         {
605           fAliasNames[i] = "t00_ac_scaler_";
606           sindex.Form("%02d",i);
607           fAliasNames[i] += sindex;
608         }
609       else if (i < 2*kScalers)
610         {
611           fAliasNames[i] = "t00_ac_scaler_sec_";
612           sindex.Form("%02d",i-kScalers);
613           fAliasNames[i] += sindex;
614         }
615       else if (i < 2*kScalers+kHV)
616         {
617           fAliasNames[i] = "t00_a_hv_imon_";
618           sindex.Form("%02d",i-2*kScalers);
619           fAliasNames[i] += sindex;
620         }
621       else if (i < 2*kScalers+2*kHV)
622         {
623           fAliasNames[i] = "t00_a_hv_vmon_";
624           sindex.Form("%02d",i-(2*kScalers+kHV));
625           fAliasNames[i] += sindex;
626         }
627       else if (i < 2*kScalers+2*kHV+kLV)
628         {
629           fAliasNames[i] = "t00_a_lv_imon_";
630           sindex.Form("%01d",i-(2*kScalers+2*kHV));
631           fAliasNames[i] += sindex;
632         }
633       else if (i < 2*kScalers+2*kHV+2*kLV)
634         {
635           fAliasNames[i] = "t00_a_lv_vmon_";
636           sindex.Form("%01d",i-(2*kScalers+2*kHV+kLV));
637           fAliasNames[i] += sindex;
638         }
639       else if (i < 2*kScalers+3*kHV+2*kLV)
640         {
641           fAliasNames[i] = "t00_c_hv_imon_";
642           sindex.Form("%02d",i-(2*kScalers+2*kHV+2*kLV));
643           fAliasNames[i] += sindex;
644         }
645       else if (i < 2*kScalers+4*kHV+2*kLV)
646         {
647           fAliasNames[i] = "t00_c_hv_vmon_";
648           sindex.Form("%02d",i-(2*kScalers+3*kHV+2*kLV));
649           fAliasNames[i] += sindex;
650         }
651       else if (i < 2*kScalers+4*kHV+3*kLV)
652         {
653           fAliasNames[i] = "t00_c_lv_imon_";
654           sindex.Form("%01d",i-(2*kScalers+4*kHV+2*kLV));
655           fAliasNames[i] += sindex;
656         }
657       else if (i < 2*kScalers+4*kHV+4*kLV)
658         {
659           fAliasNames[i] = "t00_c_lv_vmon_";
660           sindex.Form("%01d",i-(2*kScalers+4*kHV+3*kLV));
661           fAliasNames[i] += sindex;
662         }
663       else if (i < 2*kScalers+4*kHV+4*kLV+kCFD)
664         {
665           fAliasNames[i] = "t00_a_cfd_thre_";
666           sindex.Form("%02d",i-(2*kScalers+4*kHV+4*kLV));
667           fAliasNames[i] += sindex;
668         }
669       else if (i < 2*kScalers+4*kHV+4*kLV+2*kCFD)
670         {
671           fAliasNames[i] = "t00_a_cfd_walk_";
672           sindex.Form("%02d",i-(2*kScalers+4*kHV+4*kLV+kCFD));
673           fAliasNames[i] += sindex;
674         }
675       else if (i < 2*kScalers+4*kHV+4*kLV+3*kCFD)
676         {
677           fAliasNames[i] = "t00_c_cfd_thre_";
678                   sindex.Form("%02d",i-(2*kScalers+4*kHV+4*kLV+2*kCFD));
679                   fAliasNames[i] += sindex;
680         }
681       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD)
682                 {
683                   fAliasNames[i] = "t00_c_cfd_walk_";
684                   sindex.Form("%02d",i-(2*kScalers+4*kHV+4*kLV+3*kCFD));
685                   fAliasNames[i] += sindex;
686                 }
687       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM)
688         {
689           fAliasNames[i] = "t00_ac_trm_";
690           sindex.Form("%02d",i-(2*kScalers+4*kHV+4*kLV+4*kCFD));
691           fAliasNames[i] += sindex;
692         }
693       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM)
694         {
695           fAliasNames[i] = "t00_ac_drm_";
696           sindex.Form("%02d",i-(2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM));
697           fAliasNames[i] += sindex;
698         }
699       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+kAtten)
700         {
701           fAliasNames[i] = "t00_ac_atten";
702         }
703       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+2*kAtten)
704         {
705           fAliasNames[i] = "t00_a_mpd_cent";
706         }
707       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+3*kAtten)
708         {
709           fAliasNames[i] = "t00_c_mpd_cent";
710         }
711       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+4*kAtten)
712         {
713           fAliasNames[i] = "t00_a_mpd_scent";
714                 }
715       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+5*kAtten)
716         {
717           fAliasNames[i] = "t00_c_mpd_scent";
718         }
719       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+6*kAtten)
720         {
721           fAliasNames[i] = "t00_ac_tvdc_top";
722         }
723       else if (i < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+7*kAtten)
724         {
725           fAliasNames[i] = "t00_ac_tvdc_bottom";
726         }
727       else
728         {
729           fAliasNames[i] = "t00_ac_mpd_mode";
730         }
731     }
732
733 }
734
735 //---------------------------------------------------------------
736 void AliT0DataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)const
737 {
738
739         int entries=aliasArr->GetEntries();
740         AliInfo(Form("************ Alias: %s **********",fAliasNames[numAlias].Data()));
741         AliInfo(Form("          %d DP values collected",entries));
742
743 }
744
745
746 //---------------------------------------------------------------
747 void  AliT0DataDCS::PrintfArray(const char *label,  const Float_t *array, Int_t numElements) const
748 {
749   //print all elements of array
750   printf("%s: \n",label);
751   for(Int_t i=0;i<numElements;i++){
752     printf("  %.2f", array[i]);
753   }
754   printf("\n");
755 }
756 //---------------------------------------------------------------
757
758 void AliT0DataDCS::PrintT0Data() const
759 {
760   //print DP values
761
762   printf("AliT0DataDCS::Print()\n");
763   printf("RUN:                %d\n", fRun);           
764   printf("START TIME:         %d\n", fStartTime);  
765   printf("END TIME:           %d\n", fEndTime); 
766   printf("StartTimeDCSQuery:  %d\n", fStartTimeDCSQuery);
767   printf("EndTimeDCSQuery:    %d\n", fEndTimeDCSQuery);
768
769   PrintfArray("HV A side current", fHViA, kHV);
770   PrintfArray("HV A side voltage", fHVvA, kHV);
771   PrintfArray("LV A side current", fLViA, kLV);
772   PrintfArray("LV A side voltage", fLVvA, kLV);
773   PrintfArray("HV C side current", fHViC, kHV);
774   PrintfArray("HV C side voltage", fHVvC, kHV);
775   PrintfArray("LV C side current", fLViC, kLV);
776   PrintfArray("LV C side voltage", fLVvC, kLV);
777
778   PrintfArray("CFD threshold A side", fCFDtA, kCFD);        
779   PrintfArray("CFD walk A side", fCFDwA, kCFD);              
780   PrintfArray("CFD threshold C side", fCFDtC, kCFD);          
781   PrintfArray("CFD walk C side", fCFDwC, kCFD);                
782
783   //PrintfArray("SCALERS", (Float_t*) fScalerMean, kScalers); 
784   printf("SCALERS: \n");
785   for(Int_t i=0;i<kScalers;i++){
786     printf("  %d", fScalerMean[i]);
787   }
788   printf("\n");
789
790   
791  // PrintfArray("SCALERS per second",(Float_t*) fScalerSecMean, kScalers);  
792   printf("SCALERS per second: \n");
793   for(Int_t i=0;i<kScalers;i++){
794     printf("  %d", fScalerSecMean[i]);
795   }
796   printf("\n");
797
798
799
800
801   PrintfArray("TRM", fTRM, kTRM);                 
802   PrintfArray("DRM", fDRM, kDRM);                  
803
804   printf("Laser Amplitude: %f\n", fAtten);                    
805   printf("mult. discrim. central A side: %d\n", fMPDcentA);                     
806   printf("mult. discrim. central C side: %d\n", fMPDcentC);                     
807   printf("mult. discrim. semi-central A side: %d\n", fMPDsemiCentA);                     
808   printf("mult. discrim. semi-central C side: %d\n", fMPDsemiCentC);                    
809
810   printf("TVDC top:     %d\n", fTVDCtop);   
811   printf("TVDC bottom:  %d\n", fTVDCbottom);   
812   printf("MPDmode:      %d\n", fMPDmode);   
813 }
814
815