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