ALIROOT-5769: Better handling of the error (R. Preghenella)
[u/mrichter/AliRoot.git] / ZDC / CheckZDCDCSMap.C
CommitLineData
5bd7d2de 1#if !defined(__CINT__) || defined(__MAKECINT__)
2
3#include <Riostream.h>
4#include <TSystem.h>
5#include <TMap.h>
6#include <TString.h>
7#include <TObjArray.h>
8#include <TFile.h>
9#include <TGrid.h>
10#include "STEER/AliDCSValue.h"
11#include "STEER/AliCDBEntry.h"
12#include "ZDC/AliZDCDataDCS.h"
13
14#endif
15
16void CheckZDCDCSMap(Int_t nRun=0)
17{
18 if(nRun==0){
19 printf("\n\n YOU MUST PROVIDE A RUN NUMBER != 0!!! \n\n");
20 return;
21 }
22
23 TGrid::Connect("alien:",0,0,"t");
24
25 char fName[150];
26 sprintf(fName,"alien:///alice/data/2010/Reference/ZDC/DCS/Data/Run%d_%d_v1_s0.root",nRun,nRun);
27
28 TString aliasNames[28];
29 aliasNames[0] = "ZDC_ZNA_POS.actual.position";
30 aliasNames[1] = "ZDC_ZPA_POS.actual.position";
31 aliasNames[2] = "ZDC_ZNC_POS.actual.position";
32 aliasNames[3] = "ZDC_ZPC_POS.actual.position";
33 aliasNames[4] = "ZDC_ZNA_HV0.actual.vMon";
34 aliasNames[5] = "ZDC_ZNA_HV1.actual.vMon";
35 aliasNames[6] = "ZDC_ZNA_HV2.actual.vMon";
36 aliasNames[7] = "ZDC_ZNA_HV3.actual.vMon";
37 aliasNames[8] = "ZDC_ZNA_HV4.actual.vMon";
38 aliasNames[9] = "ZDC_ZPA_HV0.actual.vMon";
39 aliasNames[10] = "ZDC_ZPA_HV1.actual.vMon";
40 aliasNames[11] = "ZDC_ZPA_HV2.actual.vMon";
41 aliasNames[12] = "ZDC_ZPA_HV3.actual.vMon";
42 aliasNames[13] = "ZDC_ZPA_HV4.actual.vMon";
43 aliasNames[14] = "ZDC_ZNC_HV0.actual.vMon";
44 aliasNames[15] = "ZDC_ZNC_HV1.actual.vMon";
45 aliasNames[16] = "ZDC_ZNC_HV2.actual.vMon";
46 aliasNames[17] = "ZDC_ZNC_HV3.actual.vMon";
47 aliasNames[18] = "ZDC_ZNC_HV4.actual.vMon";
48 aliasNames[19] = "ZDC_ZPC_HV0.actual.vMon";
49 aliasNames[20] = "ZDC_ZPC_HV1.actual.vMon";
50 aliasNames[21] = "ZDC_ZPC_HV2.actual.vMon";
51 aliasNames[22] = "ZDC_ZPC_HV3.actual.vMon";
52 aliasNames[23] = "ZDC_ZPC_HV4.actual.vMon";
53 aliasNames[24] = "ZDC_ZEM_HV0.actual.vMon";
54 aliasNames[25] = "ZDC_ZEM_HV1.actual.vMon";
55 aliasNames[26] = "ZDC_REFA_HV.actual.vMon";
56 aliasNames[27] = "ZDC_REFC_HV.actual.vMon";
57
58 TFile *file = TFile::Open(fName);
59 //file->ls();
60
61 AliCDBEntry *entry = (AliCDBEntry*)file->Get("AliCDBEntry");
62 TMap *dcsAliasMap = dynamic_cast<TMap*> (entry->GetObject());
63 dcsAliasMap->SetOwner(1);
64 //dcsAliasMap->Print("");
65 TObjArray *aliasArr;
66 AliDCSValue *value;
67
68 for(int j=0; j<28; j++){
69
70 aliasArr = (TObjArray*) (dcsAliasMap->GetValue(aliasNames[j].Data()));
71 if(!aliasArr){
72 printf("Alias %s has no DP value stored!\n", aliasNames[j].Data());
73 continue;
74 }
75
76 Int_t nentries = aliasArr->GetEntries();
77 printf("************ Alias: %s has %d DP values collected\n",
78 aliasNames[j].Data(), nentries);
79
80 TIter iterarray(aliasArr);
81
82 UInt_t *time = new UInt_t[nentries];
83 Float_t *val = new Float_t[nentries];
84
85 UInt_t ne=0;
86 while((value = (AliDCSValue*) iterarray.Next())) {
87 time[ne] = value->GetTimeStamp();
88 val[ne] = value->GetFloat();
89 //printf(" %d - time %d value %1.4f\n",ne,
90 // value->GetTimeStamp(),value->GetFloat());
91 printf(" %s\n", value->ToString());
92 ne++;
93 }
94 }
95
96
97}