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