Raw data update: to read the TOF raw data defined in UNPACKED mode
[u/mrichter/AliRoot.git] / TOF / AliTOFDataDCS.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$
18 Revision 1.4  2007/02/19 15:41:55  decaro
19 Coding convention: few corrections
20
21 Revision 1.3  2007/01/24 11:19:58  arcelli
22 Modify ProcessData to return a logical (CZ)
23
24 Revision 1.2  2006/12/18 18:17:38  arcelli
25 Updated Aliases for DCS TOF datapoints (C.Zampolli)
26
27 Revision 1.1  2006/10/26 09:10:52  arcelli
28 Class for handling the TOF DCS data in the Shuttle (C.Zampolli)
29
30 */  
31
32 #include "AliTOFDataDCS.h"
33
34 #include "AliDCSValue.h"
35 #include "AliLog.h"
36
37 //#include "TString.h"
38 #include "AliTOFFormatDCS.h"
39 #include "TF1.h"
40 #include "TCanvas.h"
41 #include "TH1F.h"
42 #include "TTimeStamp.h"
43 #include "TMap.h"
44
45 class TH2;
46 class AliCDBMetaData;
47 class TDatime;
48
49 // AliTOFDataDCS class
50 // main aim to introduce the aliases for the TOF DCS
51 // data points to be then
52 // stored in the OCDB, and to process them. 
53 // Process() method called by TOFPrepr
54
55 ClassImp(AliTOFDataDCS)
56
57 //---------------------------------------------------------------
58 AliTOFDataDCS::AliTOFDataDCS():
59         TObject(),
60         fRun(0),
61         fStartTime(0),
62         fEndTime(0),
63         fIsProcessed(kFALSE)
64 {
65
66   // main constructor 
67
68   for(int i=0;i<kNHV;i++) {
69     fHVvp[i]=0x0;
70     fHVvn[i]=0x0;
71     fHVip[i]=0x0;
72     fHVin[i]=0x0;
73   }
74   
75   for(int i=0;i<kNLV;i++) {
76     fLVv[i]=0x0;
77     fLVi[i]=0x0;
78   }
79   
80   for(int i=0;i<kNLV33;i++) {
81     fLVv33[i]=0x0;
82     fLVi33[i]=0x0;
83   }
84   
85   for(int i=0;i<kNLV50;i++) {
86     fLVv50[i]=0x0;
87     fLVi50[i]=0x0;
88   }
89   
90   for(int i=0;i<kNLV48;i++) {
91     fLVv48[i]=0x0;
92     fLVi48[i]=0x0;
93   }
94   
95   for(int i=0;i<kNFEEthr;i++) {
96     fFEEthr[i]=0x0;
97   }
98   
99   for(int i=0;i<kNFEEtfeac;i++) {
100     fFEEtfeac[i]=0x0;
101   }
102   
103   for(int i=0;i<kNFEEttrm;i++) {
104     fFEEttrm[i]=0x0;
105   }
106   
107   for(int i=0;i<3;i++) {
108     fT[i]=0;
109     fP[i]=0;
110   }
111   
112 }
113
114 //---------------------------------------------------------------
115 AliTOFDataDCS::AliTOFDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime):
116         TObject(),
117         fRun(nRun),
118         fStartTime(startTime),
119         fEndTime(endTime),
120         fIsProcessed(kFALSE)
121 {
122
123   // constructor with arguments
124
125         AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", nRun,
126         TTimeStamp(startTime).AsString(),
127         TTimeStamp(endTime).AsString()));
128
129         Init();
130
131 }
132
133 //---------------------------------------------------------------
134
135 AliTOFDataDCS::AliTOFDataDCS(const AliTOFDataDCS & data):
136   TObject(), 
137   fRun(0),
138   fStartTime(0),
139   fEndTime(0),
140   fIsProcessed(kFALSE)
141
142 {
143
144 // copy constructor
145
146   fRun=data.fRun;
147   fStartTime=data.fStartTime;
148   fEndTime=data.fEndTime;
149   fIsProcessed=data.fIsProcessed;
150
151   for(int i=0;i<kNAliases;i++) {
152     fAliasNames[i]=data.fAliasNames[i];
153   }
154  
155   for(int i=0;i<kNHV;i++) {
156     fHVvp[i]=data.fHVvp[i];
157     fHVvn[i]=data.fHVvn[i];
158     fHVip[i]=data.fHVip[i];
159     fHVin[i]=data.fHVin[i];
160   }
161   
162   for(int i=0;i<kNLV;i++) {
163     fLVv[i]=data.fLVv[i];
164     fLVi[i]=data.fLVi[i];
165   }
166
167   for(int i=0;i<kNLV33;i++) {
168     fLVv33[i]=data.fLVv33[i];
169     fLVi33[i]=data.fLVi33[i];
170   }
171
172   for(int i=0;i<kNLV50;i++) {
173     fLVv50[i]=data.fLVv50[i];
174     fLVi50[i]=data.fLVi50[i];
175   }
176
177   for(int i=0;i<kNLV48;i++) {
178     fLVv48[i]=data.fLVv48[i];
179     fLVi48[i]=data.fLVi48[i];
180   }
181
182   for(int i=0;i<kNFEEthr;i++) {
183     fFEEthr[i]=data.fFEEthr[i];
184   }
185
186   for(int i=0;i<kNFEEtfeac;i++) {
187     fFEEtfeac[i]=data.fFEEtfeac[i];
188   }
189
190   for(int i=0;i<kNFEEttrm;i++) {
191     fFEEttrm[i]=data.fFEEttrm[i];
192   }
193   
194   for(int i=0;i<3;i++) {
195     fT[i]=data.fT[i];
196     fP[i]=data.fP[i];
197   }
198   
199 }
200 //---------------------------------------------------------------
201
202 AliTOFDataDCS& AliTOFDataDCS:: operator=(const AliTOFDataDCS & data) { 
203
204 // assignment operator
205
206   this->fRun=data.GetRun();
207   this->fStartTime=data.GetStartTime();
208   this->fEndTime=data.GetEndTime();
209
210   for(int i=0;i<kNAliases;i++) {
211     this->fAliasNames[i]=data.GetAliasName(i);
212   }
213
214   for(int i=0;i<3;i++) {
215     this->fT[i]=data.GetT(i);
216     this->fP[i]=data.GetP(i);
217   }
218
219
220   for(int i=0;i<kNHV;i++) {
221     this->fHVvp[i]=data.GetHVvp(i);
222     this->fHVvn[i]=data.GetHVvn(i);
223     this->fHVip[i]=data.GetHVip(i);
224     this->fHVin[i]=data.GetHVin(i);
225   }
226
227   for(int i=0;i<kNLV;i++) {
228     this->fLVv[i]=data.GetLVv(i);
229     this->fLVi[i]=data.GetLVi(i);
230   }
231
232   for(int i=0;i<kNLV33;i++) {
233     this->fLVv33[i]=data.GetLVv33(i);
234     this->fLVi33[i]=data.GetLVi33(i);
235   }
236
237   for(int i=0;i<kNLV50;i++) {
238     this->fLVv50[i]=data.GetLVv50(i);
239     this->fLVi50[i]=data.GetLVi50(i);
240   }
241
242   for(int i=0;i<kNLV48;i++) {
243     this->fLVv48[i]=data.GetLVv48(i);
244     this->fLVi48[i]=data.GetLVi48(i);
245   }
246
247   for(int i=0;i<kNFEEthr;i++) {
248     this->fFEEthr[i]=data.GetFEEthr(i);
249   }
250
251   for(int i=0;i<kNFEEtfeac;i++) {
252     this->fFEEtfeac[i]=data.GetFEEtfeac(i);
253   }
254
255   for(int i=0;i<kNFEEttrm;i++) {
256     this->fFEEttrm[i]=data.GetFEEttrm(i);
257   }
258
259   this->fIsProcessed=data.fIsProcessed;
260
261   return *this;
262 }
263 //---------------------------------------------------------------
264 AliTOFDataDCS::~AliTOFDataDCS() {
265
266   // destructor
267
268   for(int i=0;i<kNHV;i++) {
269     delete fHVvp[i];
270     fHVvp[i]=0;
271     delete fHVvn[i];
272     fHVvn[i]=0;
273     delete fHVip[i];
274     fHVip[i]=0;
275     delete fHVin[i];
276     fHVin[i]=0;
277   }
278   
279   for(int i=0;i<kNLV;i++) {
280     delete fLVv[i];
281     fLVv[i]=0;
282     delete fLVi[i];
283     fLVi[i]=0;
284   }
285   
286   for(int i=0;i<kNLV33;i++) {
287     delete fLVv33[i];
288     fLVv33[i]=0;
289     delete fLVi33[i];
290     fLVi33[i]=0;
291   }
292   
293   for(int i=0;i<kNLV50;i++) {
294     delete fLVv50[i];
295     fLVv50[i]=0;
296     delete fLVi50[i];
297     fLVi50[i]=0;
298   }
299   
300   for(int i=0;i<kNLV48;i++) {
301     delete fLVv48[i];
302     fLVv48[i]=0;
303     delete fLVi48[i];
304     fLVi48[i]=0;
305   }
306   
307   for(int i=0;i<kNFEEthr;i++) {
308     delete fFEEthr[i];
309     fFEEthr[i]=0;
310   }
311   
312   for(int i=0;i<kNFEEtfeac;i++) {
313     delete fFEEtfeac[i];
314     fFEEtfeac[i]=0;
315   }
316   
317   for(int i=0;i<kNFEEttrm;i++) {
318     delete fFEEttrm[i];
319     fFEEttrm[i]=0;
320   }
321 }
322
323 //-----------------------------------------------------------------------------
324 Float_t* AliTOFDataDCS::GetT()const {
325
326   // method to retrieve environment temperature info
327
328   Float_t* t=0;
329   for (Int_t i=0;i<3;i++){
330     t[i]=this->fT[i];
331   }
332   return t;
333 }
334 //-----------------------------------------------------------------------------
335 Float_t* AliTOFDataDCS::GetP() const{
336
337   // method to retrieve environment pressure info
338
339   Float_t* p=0;
340   for (Int_t i=0;i<3;i++){
341     p[i]=this->fP[i];
342   }
343   return p;
344 }
345
346 //---------------------------------------------------------------
347 Bool_t AliTOFDataDCS::ProcessData(TMap& aliasMap){
348
349   // method to process the data
350
351   if(!(fAliasNames[0])) Init();
352
353   Float_t timeMin = (Float_t)fStartTime;
354   Float_t timeMax = (Float_t)fEndTime;
355   Float_t val=0;
356   Float_t val1=0;
357   Float_t time=0; 
358   Float_t delta[2];
359   Float_t timedelta[2];
360
361   TObjArray *aliasArr;
362   AliDCSValue* aValue;
363   AliDCSValue* aValue1;
364   TH1F * histoT=0x0;
365   TH1F * histoP=0x0;
366
367   // starting loop on aliases
368   for(int j=0; j<kNAliases; j++){
369     for (Int_t k=0;k<2;k++) {
370       delta[k]=0;
371       timedelta[k]=0;
372     }
373     //AliInfo(Form("j = %i, with alias = %s",j,fAliasNames[j].Data()));
374     aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data());
375     if(!aliasArr){
376       AliError(Form("Alias %s not found!", fAliasNames[j].Data()));
377       return kFALSE;
378     }
379
380     Introduce(j, aliasArr);
381     
382     if(aliasArr->GetEntries()<3){
383       AliError(Form("Alias %s has just %d entries!",
384                     fAliasNames[j].Data(),aliasArr->GetEntries()));
385       continue;
386     }
387     
388     TIter iterarray(aliasArr);
389     
390     Int_t nentries = aliasArr->GetEntries();
391     Int_t deltaTimeStamp = (Int_t) nentries/3;
392     Int_t deltaTimeStamp1 = (Int_t) nentries/2;
393     AliDCSValue *lastDCSvalue = (AliDCSValue*) aliasArr->At(nentries-1);
394     Float_t maxTimeStamp = (Float_t) (lastDCSvalue->GetTimeStamp());
395     Float_t minTimeStamp = 0;
396
397     // filling aliases with 10 floats+1 Usign
398     if (j < kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm){
399       Int_t index = 0;
400       for (Int_t k=0;k<3;k++){
401         index = deltaTimeStamp*k;
402         if (k==0) {
403           index=0;
404         }
405         else if (k==1) {
406           index=deltaTimeStamp1;
407         } 
408         else if (k==2) {
409           index=nentries-1; 
410         }
411         aValue = (AliDCSValue*) aliasArr->At(index);
412         val = aValue->GetFloat();
413         time = (Float_t) (aValue->GetTimeStamp());
414         if (j<kNHV){
415           fHVvp[j]->SetFloat(k,val);
416           fHVvp[j]->SetTimeStampFloat(k,time);
417         }
418         else if (j<kNHV*2){
419           fHVvn[j-kNHV]->SetFloat(k,val);
420           fHVvn[j-kNHV]->SetTimeStampFloat(k,time);
421         }
422         else if (j<kNHV*3){
423           fHVip[j-2*kNHV]->SetFloat(k,val);
424           fHVip[j-2*kNHV]->SetTimeStampFloat(k,time);
425         }
426         else if (j<kNHV*4){
427           fHVin[j-3*kNHV]->SetFloat(k,val);
428           fHVin[j-3*kNHV]->SetTimeStampFloat(k,time);
429         }
430         else if (j<kNHV*4+kNLV){
431           fLVv[j-4*kNHV]->SetFloat(k,val);
432           fLVv[j-4*kNHV]->SetTimeStampFloat(k,time);
433         }
434         else if (j<kNHV*4+kNLV*2){
435           fLVi[j-4*kNHV-kNLV]->SetFloat(k,val);
436           fLVi[j-4*kNHV-kNLV]->SetTimeStampFloat(k,time);
437         }
438         else if (j<kNHV*4+kNLV*2+kNLV33){
439           fLVv33[j-4*kNHV-2*kNLV]->SetFloat(k,val);
440           fLVv33[j-4*kNHV-2*kNLV]->SetTimeStampFloat(k,time);
441         }
442         else if (j<kNHV*4+kNLV*2+kNLV33*2){
443           fLVi33[j-4*kNHV-2*kNLV-kNLV33]->SetFloat(k,val);
444           fLVi33[j-4*kNHV-2*kNLV-kNLV33]->SetTimeStampFloat(k,time);
445         }
446         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50){
447           fLVv50[j-4*kNHV-2*kNLV-2*kNLV33]->SetFloat(k,val);
448           fLVv50[j-4*kNHV-2*kNLV-2*kNLV33]->SetTimeStampFloat(k,time);
449         }
450         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2){
451           fLVi50[j-4*kNHV-2*kNLV-2*kNLV33-kNLV50]->SetFloat(k,val);
452           fLVi50[j-4*kNHV-2*kNLV-2*kNLV33-kNLV50]->SetTimeStampFloat(k,time);
453         }
454         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48){
455           fLVv48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50]->SetFloat(k,val);
456           fLVv48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50]->SetTimeStampFloat(k,time);
457         }
458         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2){
459           fLVi48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-kNLV48]->SetFloat(k,val);
460           fLVi48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-kNLV48]->SetTimeStampFloat(k,time);
461         }
462         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr){
463           fFEEthr[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48]->SetFloat(k,val);
464           fFEEthr[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48]->SetTimeStampFloat(k,time);
465         }
466         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac){
467           fFEEtfeac[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr]->SetFloat(k,val);
468           fFEEtfeac[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr]->SetTimeStampFloat(k,time);
469         }
470         else {
471           fFEEttrm[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac]->SetFloat(k,val);
472           fFEEttrm[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac]->SetTimeStampFloat(k,time);
473         }
474       }
475     }
476   
477     //filling Temperature and Pressure aliases
478     
479     else {
480       Int_t entriesT=0;
481       Int_t entriesP=0;
482       if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm+1){
483         histoT=new TH1F("histoT","histoT",nentries,minTimeStamp,maxTimeStamp);
484       }
485       else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm+2) {
486         histoP=new TH1F("histoP","histoP",nentries,minTimeStamp,maxTimeStamp);
487       }
488       while ((aValue = (AliDCSValue*) iterarray.Next())) {
489         val = aValue->GetFloat();
490         time = (Float_t) (aValue->GetTimeStamp());
491         if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm+1){
492           histoT->Fill(time,val);
493           entriesT = (Int_t)(histoT->GetEntries());
494         }
495         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm+2){
496           histoP->Fill(time,val);
497           entriesP = (Int_t)(histoP->GetEntries());
498         }
499       }
500     
501       if (j==kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm+1){
502         entriesT = (Int_t)(histoT->GetEntries());
503         histoT->Fit("pol1","Q","");
504         histoP->Fit("pol1","Q","");
505       
506         TF1 *tempFunc = histoT->GetFunction("pol1");
507         TF1 *pressFunc = histoP->GetFunction("pol1");
508       
509         SetInterceptT((Float_t)tempFunc->GetParameter(0));
510         SetSlopeT((Float_t)tempFunc->GetParameter(1));
511         SetMaxT((Float_t)histoT->GetMaximum());
512         SetInterceptP((Float_t)pressFunc->GetParameter(0));
513         SetSlopeP((Float_t)pressFunc->GetParameter(1));
514         SetMaxP((Float_t)histoP->GetMaximum());
515       
516         TCanvas *chT;
517         TString canvasHistoNameT="HistosT";
518         chT=new TCanvas(canvasHistoNameT,canvasHistoNameT,20,20,600,600);
519         chT->cd();
520         histoT->Draw();
521         TCanvas *chP;
522         TString canvasHistoNameP="HistosP";
523         chP=new TCanvas(canvasHistoNameP,canvasHistoNameP,20,20,600,600);
524         chP->cd();
525         histoP->Draw();
526       }
527     }
528  
529     //computing the most significant variations
530
531     Int_t deltamin = (Int_t)(60/(timeMax-timeMin)*nentries);
532     Int_t klast = nentries-deltamin;
533     
534     for (Int_t k=0;k<klast;k++){
535       aValue = (AliDCSValue*) aliasArr->At(k);
536       aValue1 = (AliDCSValue*) aliasArr->At(k+deltamin);
537       val = aValue->GetFloat();
538       val1 = aValue1->GetFloat();
539       if (delta[0]<=TMath::Abs(val1-val)) {
540         delta[0]=TMath::Abs(val1-val);
541         timedelta[0] = (Float_t)k;
542       }
543       if (delta[1]<=delta[0]) {
544         Float_t temp = delta[1];
545         Float_t timetemp = timedelta[1];
546         delta[1]=delta[0];
547         delta[0]=temp;
548         timedelta[1]=timedelta[0];
549         timedelta[0]=timetemp;
550       }
551     }
552     
553     for (Int_t kk=0;kk<2;kk++){
554       if (j < kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac){
555         if (j<kNHV){
556           fHVvp[j]->SetDelta(kk,delta[kk]);
557           fHVvp[j]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
558         }
559         else if (j<kNHV*2){
560           fHVvn[j-kNHV]->SetDelta(kk,delta[kk]);
561           fHVvn[j-kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
562         }
563         else if (j<kNHV*3){
564           fHVip[j-2*kNHV]->SetDelta(kk,delta[kk]);
565           fHVip[j-2*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
566         }
567         else if (j<kNHV*4){
568           fHVin[j-3*kNHV]->SetDelta(kk,delta[kk]);
569           fHVin[j-3*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
570         }
571         else if (j<kNHV*4+kNLV){
572           fLVv[j-4*kNHV]->SetDelta(kk,delta[kk]);
573           fLVv[j-4*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
574         }
575         else if (j<kNHV*4+kNLV*2){
576           fLVi[j-4*kNHV-kNLV]->SetDelta(kk,delta[kk]);
577           fLVi[j-4*kNHV-kNLV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
578         }
579         else if (j<kNHV*4+kNLV*2+kNLV33){
580           fLVv33[j-4*kNHV-2*kNLV]->SetDelta(kk,delta[kk]);
581           fLVv33[j-4*kNHV-2*kNLV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
582         }
583         else if (j<kNHV*4+kNLV*2+kNLV33*2){
584           fLVi33[j-4*kNHV-2*kNLV-kNLV33]->SetDelta(kk,delta[kk]);
585           fLVi33[j-4*kNHV-2*kNLV-kNLV33]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
586         }
587         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50){
588           fLVv50[j-4*kNHV-2*kNLV-2*kNLV33]->SetDelta(kk,delta[kk]);
589           fLVv50[j-4*kNHV-2*kNLV-2*kNLV33]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
590         }
591         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2){
592           fLVi50[j-4*kNHV-2*kNLV-2*kNLV33-kNLV50]->SetDelta(kk,delta[kk]);
593           fLVi50[j-4*kNHV-2*kNLV-2*kNLV33-kNLV50]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
594         }
595         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48){
596           fLVv48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50]->SetDelta(kk,delta[kk]);
597           fLVv48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
598         }
599         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2){
600           fLVi48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-kNLV48]->SetDelta(kk,delta[kk]);
601           fLVi48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-kNLV48]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
602         }
603         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr){
604           fFEEthr[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48]->SetDelta(kk,delta[kk]);
605           fFEEthr[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
606         }
607         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac){
608           fFEEtfeac[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr]->SetDelta(kk,delta[kk]);
609           fFEEtfeac[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
610         }
611         else if (j<kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm){
612           fFEEttrm[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac]->SetDelta(kk,delta[kk]);
613           fFEEttrm[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
614         }
615       }
616        
617       
618     //filling for temperature and pressure
619     
620       else if (j==kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm){
621         fT[2]=delta[1];
622       }
623       else if (j==kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm+1){
624         fP[2]=delta[1];
625       }
626       
627     }
628   }
629     
630   fIsProcessed=kTRUE;
631
632   return kTRUE;
633 }
634
635 //---------------------------------------------------------------
636 void AliTOFDataDCS::Init(){
637
638   // initialization of aliases and DCS data
639
640   TString sindex;
641   for(int i=0;i<kNAliases;i++){
642     //HV, v
643     if (i<kNHV){
644         fAliasNames[i] = "tof_hv_vp_";
645         sindex.Form("%02i",i);
646         fAliasNames[i] += sindex;
647         fHVvp[i] = new AliTOFFormatDCS();
648     }
649     else if (i<kNHV*2){
650         fAliasNames[i] = "tof_hv_vn_";
651         sindex.Form("%02i",i-kNHV);
652         fAliasNames[i] += sindex;
653         fHVvn[i-kNHV] = new AliTOFFormatDCS();
654     }
655     //HV, i
656     else if (i<kNHV*3){
657         fAliasNames[i] = "tof_hv_ip_";
658         sindex.Form("%02i",i-2*kNHV);
659         fAliasNames[i] += sindex;
660         fHVip[i-2*kNHV] = new AliTOFFormatDCS();
661     }
662     else if (i<kNHV*4){
663         fAliasNames[i] = "tof_hv_in_";
664         sindex.Form("%02i",i-3*kNHV);
665         fAliasNames[i] += sindex;
666         fHVin[i-3*kNHV] = new AliTOFFormatDCS();
667     }
668     //LV, v
669     else if (i<(kNHV*4+kNLV)){
670         fAliasNames[i] = "tof_lv_vfea_";
671         sindex.Form("%03i",i-4*kNHV);
672         fAliasNames[i] += sindex;
673         fLVv[i-4*kNHV] = new AliTOFFormatDCS();
674     }
675     //LV, i
676     else if (i<(kNHV*4+kNLV*2)){
677         fAliasNames[i] = "tof_lv_ifea_";
678         sindex.Form("%03i",i-4*kNHV-kNLV);
679         fAliasNames[i] += sindex;
680         fLVi[i-4*kNHV-kNLV] = new AliTOFFormatDCS();
681     }
682     //LV 3.3, v
683     else if (i<(kNHV*4+kNLV*2+kNLV33)){
684         fAliasNames[i] = "tof_lv_v33_";
685         sindex.Form("%02i",i-4*kNHV-2*kNLV);
686         fAliasNames[i] += sindex;
687         fLVv33[i-4*kNHV-2*kNLV] = new AliTOFFormatDCS();
688     }
689     //LV 3.3, i
690     else if (i<(kNHV*4+kNLV*2+kNLV33*2)){
691         fAliasNames[i] = "tof_lv_i33_";
692         sindex.Form("%02i",i-4*kNHV-2*kNLV-kNLV33);
693         fAliasNames[i] += sindex;
694         fLVi33[i-4*kNHV-2*kNLV-kNLV33] = new AliTOFFormatDCS();
695     }
696     //LV 5.0, v
697     else if (i<(kNHV*4+kNLV*2+kNLV33*2+kNLV50)){
698         fAliasNames[i] = "tof_lv_v50_";
699         sindex.Form("%02i",i-4*kNHV-2*kNLV-2*kNLV33);
700         fAliasNames[i] += sindex;
701         fLVv50[i-4*kNHV-2*kNLV-2*kNLV33] = new AliTOFFormatDCS();
702     }
703     //LV 5.0, i
704     else if (i<(kNHV*4+kNLV*2+kNLV33*2+kNLV50*2)){
705         fAliasNames[i] = "tof_lv_i50_";
706         sindex.Form("%02i",i-4*kNHV-2*kNLV-2*kNLV33-kNLV50);
707         fAliasNames[i] += sindex;
708         fLVi50[i-4*kNHV-2*kNLV-2*kNLV33-kNLV50] = new AliTOFFormatDCS();
709     }
710     //LV 48, v
711     else if (i<(kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48)){
712         fAliasNames[i] = "tof_lv_v48_";
713         sindex.Form("%02i",i-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50);
714         fAliasNames[i] += sindex;
715         fLVv48[i-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50] = new AliTOFFormatDCS();
716     }
717     //LV 48, i
718     else if (i<(kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2)){
719         fAliasNames[i] = "tof_lv_i48_";
720         sindex.Form("%02i",i-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-kNLV48);
721         fAliasNames[i] += sindex;
722         fLVi48[i-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-kNLV48] = new AliTOFFormatDCS();
723     }
724     //FEE thresholds
725     else if (i<(kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr)){
726         fAliasNames[i] = "tof_fee_th_";
727         sindex.Form("%04i",i-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48);
728         fAliasNames[i] += sindex;
729         fFEEthr[i-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48] = new AliTOFFormatDCS();
730     }
731     //FEE FEAC temperatures
732     else if (i<(kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac)){
733         fAliasNames[i] = "tof_fee_tfeac_";
734         sindex.Form("%03i",i-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr);
735         fAliasNames[i] += sindex;
736         fFEEtfeac[i-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr] = new AliTOFFormatDCS();
737     }
738     //FEE trms temperatures
739     else if (i<(kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm)){
740       AliInfo(Form("**before temperature "));
741         fAliasNames[i] = "tof_fee_ttrm_";
742         sindex.Form("%04i",i-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac);
743         fAliasNames[i] += sindex;
744         fFEEttrm[i-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac] = new AliTOFFormatDCS();
745     }
746     //environment temperature
747     else if (i<(kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm+1)){
748       AliInfo(Form("**temperature "));
749
750         fAliasNames[i] = "temperature";
751     }
752     //environment pressure
753     else if (i<(kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm+2)){
754         fAliasNames[i] = "pressure";
755     }
756   }
757 }
758
759
760 //---------------------------------------------------------------
761 void AliTOFDataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)const
762 {
763
764   // method to introduce new aliases
765
766   int entries=0;
767   entries = aliasArr->GetEntries();
768   int nal=0;
769   nal=numAlias;
770   AliInfo(Form("************ Alias: %s **********",fAliasNames[numAlias].Data()));
771   AliInfo(Form("        %d DP values collected",entries));
772
773 }
774
775 //---------------------------------------------------------------
776 void AliTOFDataDCS::Draw(const Option_t* /*option*/) /*const*/
777 {
778 // Draw all histos and graphs
779
780   if(!fIsProcessed) return;
781
782   TCanvas *ch;
783   TString canvasHistoName="Histos";
784   ch=new TCanvas(canvasHistoName,canvasHistoName,20,20,600,600);
785   ch->cd();
786
787   // to be implemented
788
789 }
790