]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ZDC/AliZDCDataDCS.cxx
Fixed compilation warnings
[u/mrichter/AliRoot.git] / ZDC / AliZDCDataDCS.cxx
CommitLineData
5a8e8156 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Class for ZDC DCS data //
4// //
5///////////////////////////////////////////////////////////////////////////////
6
64a7c78d 7#include "AliZDCDataDCS.h"
8
9#include "AliCDBMetaData.h"
10#include "AliDCSValue.h"
11#include "AliLog.h"
12
a1e17193 13#include <TCanvas.h>
64a7c78d 14#include <TDatime.h>
bf867209 15#include <TString.h>
a1e17193 16#include <TObjString.h>
64a7c78d 17#include <TStyle.h>
a1e17193 18#include <TTimeStamp.h>
64a7c78d 19
20ClassImp(AliZDCDataDCS)
21
22//---------------------------------------------------------------
23AliZDCDataDCS::AliZDCDataDCS():
5a8e8156 24 TObject(),
25 fRun(0),
26 fStartTime(0),
27 fEndTime(0),
e83c8d88 28 fStartTimeDCSQuery(0),
29 fEndTimeDCSQuery(0),
57c85e6e 30// fTimeStamp(0x0),
31// fHVData(0x0),
5a8e8156 32 fIsProcessed(kFALSE)
33{
34 // Default constructor
57c85e6e 35 for(Int_t i=0; i<kNAliases; i++) fAliasNames[i] = "";
36 for(Int_t i=0; i<kNAlignDet; i++) fAlignData[i] = 0.;
5a8e8156 37}
64a7c78d 38
39//---------------------------------------------------------------
e83c8d88 40AliZDCDataDCS::AliZDCDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime,
41 UInt_t startTimeDCSQuery, UInt_t endTimeDCSQuery):
5a8e8156 42 TObject(),
43 fRun(nRun),
44 fStartTime(startTime),
45 fEndTime(endTime),
e83c8d88 46 fStartTimeDCSQuery(startTimeDCSQuery),
47 fEndTimeDCSQuery(endTimeDCSQuery),
57c85e6e 48// fTimeStamp(0x0),
49// fHVData(0x0),
5a8e8156 50 fIsProcessed(kFALSE)
64a7c78d 51{
5a8e8156 52 // Standard constructor
53
e83c8d88 54 AliDebug(2,Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s \n\tStartTime DCS Query %s \n\tEndTime DCS Query %s", nRun,
5a8e8156 55 TTimeStamp(startTime).AsString(),
e83c8d88 56 TTimeStamp(endTime).AsString(),
57 TTimeStamp(startTimeDCSQuery).AsString(),
58 TTimeStamp(endTimeDCSQuery).AsString()));
64a7c78d 59
5a8e8156 60 Init();
64a7c78d 61
62}
63
e83c8d88 64//---------------------------------------------------------------
65AliZDCDataDCS::AliZDCDataDCS(const AliZDCDataDCS & data):
66 TObject(data),
67 fRun(data.fRun),
68 fStartTime(data.fStartTime),
69 fEndTime(data.fEndTime),
70 fStartTimeDCSQuery(data.fStartTimeDCSQuery),
71 fEndTimeDCSQuery(data.fEndTimeDCSQuery),
57c85e6e 72// fTimeStamp(data.fTimeStamp),
73// fHVData(data.fHVData),
e83c8d88 74 fIsProcessed(data.fIsProcessed)
75{
76
77 // copy constructor
78
57c85e6e 79 for(int i=0;i<kNAliases;i++) fAliasNames[i] = data.fAliasNames[i];
80 for(int i=0;i<kNAlignDet;i++) fAlignData[i] = data.fAlignData[i];
e83c8d88 81
82}
83
84//---------------------------------------------------------------
85AliZDCDataDCS& AliZDCDataDCS:: operator=(const AliZDCDataDCS & data) {
86
87 // assignment operator
88
89 if (this == &data)
90 return *this;
91
92 TObject::operator=(data);
93 fRun = data.GetRun();
94 fStartTime = data.GetStartTime();
95 fEndTime = data.GetEndTime();
96 fStartTimeDCSQuery = data.GetStartTimeDCSQuery();
97 fEndTimeDCSQuery = data.GetEndTimeDCSQuery();
57c85e6e 98// fTimeStamp = data.GetTimeStamp();
99// fHVData = data.GetHVData();
100 fIsProcessed = data.fIsProcessed;
e83c8d88 101
57c85e6e 102 for(int i=0;i<kNAliases;i++) fAliasNames[i] = data.GetAliasName(i);
103 for(int i=0;i<kNAlignDet;i++) fAlignData[i] = data.GetAlignData(i);
e83c8d88 104
105 return *this;
106}
107
64a7c78d 108//---------------------------------------------------------------
5a8e8156 109AliZDCDataDCS::~AliZDCDataDCS()
110{
111 // Destructor
64a7c78d 112}
113
114//---------------------------------------------------------------
e83c8d88 115Bool_t AliZDCDataDCS::ProcessData(TMap& aliasMap)
5a8e8156 116{
117 // Data processing
e83c8d88 118
bf867209 119 if(!(fAliasNames[0])) Init();
e83c8d88 120
121 AliInfo(Form(" Start Time = %i",fStartTime));
122 AliInfo(Form(" End Time = %i",fEndTime));
123 AliInfo(Form(" Start Time DCS Query= %i",fStartTimeDCSQuery));
124 AliInfo(Form(" End Time DCS Query= %i",fEndTimeDCSQuery));
bf867209 125
126 if (fEndTime==fStartTime){
127 AliError(Form(" Run with null time length: start time = %i = end time = %i",fStartTime,fEndTime));
128 return kFALSE;
129 }
5a8e8156 130
bf867209 131 TObjArray *aliasArr;
132 AliDCSValue *aValue;
e83c8d88 133
1a1c78d4 134 // *** ATTENTION!!! Change introduced 26/09/09 ***************
135 // In order not to process HV, only data from table position *
136 // (namely 1st four values) are processed ********************
137 //for(int j=0; j<kNAliases; j++){
138 for(int j=0; j<kNAlignDet; j++){
57c85e6e 139 //printf(" Processing alias %d aliasName %s \n", j, fAliasNames[j].Data());
140
141 aliasArr = (TObjArray*) (aliasMap.GetValue(fAliasNames[j].Data()));
5a8e8156 142 if(!aliasArr){
fea9b334 143 AliWarning(Form("Alias %s not found!", fAliasNames[j].Data()));
57c85e6e 144 //printf(" AliZDCDataDCS: Alias %s not found!\n", fAliasNames[j].Data());
145 continue;
5a8e8156 146 }
57c85e6e 147
5a8e8156 148 Introduce(j, aliasArr);
149
bf867209 150 Int_t nentries = aliasArr->GetEntries();
151 if(nentries<=2){
57c85e6e 152 AliWarning(Form("Alias %s has just %d entries!", fAliasNames[j].Data(), nentries));
153// continue;
5a8e8156 154 }
155
bf867209 156 Float_t *time = new Float_t[nentries];
157 Float_t *val = new Float_t[nentries];
5a8e8156 158
57c85e6e 159 TIter iterarray(aliasArr);
160
5a8e8156 161 UInt_t ne=0;
57c85e6e 162 Float_t sum=0.;
163 Int_t nMeasures=0;
164 while((aValue = (AliDCSValue*) iterarray.Next())){
165 val[ne] = aValue->GetFloat();
166 time[ne] = (Float_t) (aValue->GetTimeStamp());
167 if(j<4){
168 sum += val[ne];
169 nMeasures++;
170 }
171 else{
172 //fHVData[ne] = val[ne];
173 //fTimeStamp[ne] = time[ne];
174 }
175 ne++;
5a8e8156 176 }
57c85e6e 177 //
178 if(j<4 && nMeasures!=0) fAlignData[j] = sum/nMeasures;
5a8e8156 179
5a8e8156 180 delete[] val;
57c85e6e 181 delete[] time;
5a8e8156 182 }
57c85e6e 183
5a8e8156 184 fIsProcessed=kTRUE;
e83c8d88 185 return kTRUE;
57c85e6e 186
64a7c78d 187}
188
189//---------------------------------------------------------------
5a8e8156 190void AliZDCDataDCS::Init()
191{
192 // Initialization
57c85e6e 193
c43e6d35 194 fAliasNames[0] = "ZDC_ZNA_POS.actual.position";
195 fAliasNames[1] = "ZDC_ZPA_POS.actual.position";
196 fAliasNames[2] = "ZDC_ZNC_POS.actual.position";
197 fAliasNames[3] = "ZDC_ZPC_POS.actual.position";
b39b8493 198 //
c43e6d35 199 fAliasNames[4] = "ZDC_ZNA_HV0.actual.vMon";
200 fAliasNames[5] = "ZDC_ZNA_HV1.actual.vMon";
201 fAliasNames[6] = "ZDC_ZNA_HV2.actual.vMon";
202 fAliasNames[7] = "ZDC_ZNA_HV3.actual.vMon";
203 fAliasNames[8] = "ZDC_ZNA_HV4.actual.vMon";
b39b8493 204 //
c43e6d35 205 fAliasNames[9] = "ZDC_ZPA_HV0.actual.vMon";
206 fAliasNames[10] = "ZDC_ZPA_HV1.actual.vMon";
207 fAliasNames[11] = "ZDC_ZPA_HV2.actual.vMon";
208 fAliasNames[12] = "ZDC_ZPA_HV3.actual.vMon";
209 fAliasNames[13] = "ZDC_ZPA_HV4.actual.vMon";
b39b8493 210 //
c43e6d35 211 fAliasNames[14] = "ZDC_ZNC_HV0.actual.vMon";
212 fAliasNames[15] = "ZDC_ZNC_HV1.actual.vMon";
213 fAliasNames[16] = "ZDC_ZNC_HV2.actual.vMon";
214 fAliasNames[17] = "ZDC_ZNC_HV3.actual.vMon";
215 fAliasNames[18] = "ZDC_ZNC_HV4.actual.vMon";
b39b8493 216 //
c43e6d35 217 fAliasNames[19] = "ZDC_ZPC_HV0.actual.vMon";
218 fAliasNames[20] = "ZDC_ZPC_HV1.actual.vMon";
219 fAliasNames[21] = "ZDC_ZPC_HV2.actual.vMon";
220 fAliasNames[22] = "ZDC_ZPC_HV3.actual.vMon";
221 fAliasNames[23] = "ZDC_ZPC_HV4.actual.vMon";
b39b8493 222 //
c43e6d35 223 fAliasNames[24] = "ZDC_ZEM_HV0.actual.vMon";
224 fAliasNames[25] = "ZDC_ZEM_HV1.actual.vMon";
c0aec6f6 225 //
20a3b76c 226 fAliasNames[26] = "ZDC_REFA_HV.actual.vMon";
227 fAliasNames[27] = "ZDC_REFC_HV.actual.vMon";
b39b8493 228
64a7c78d 229}
230
231//---------------------------------------------------------------
5a8e8156 232void AliZDCDataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)
233{
234 // Getting array of DCS aliases
235
457a440d 236 int entries = aliasArr->GetEntries();
57c85e6e 237 printf("************ Alias: %s has %d DP values collected\n",
238 fAliasNames[numAlias].Data(),entries);
64a7c78d 239
240}