Added option to write non-std jet branch and jet background to a separate file, added...
[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),
5a8e8156 30 fIsProcessed(kFALSE)
31{
32 // Default constructor
e83c8d88 33 for(Int_t i=0; i<kNAliases; i++){
34 fAliasNames[i] = "";
35 fCalibData[i] = 0.;
36 fTimeStamp[i] = 0.;
37 }
5a8e8156 38}
64a7c78d 39
40//---------------------------------------------------------------
e83c8d88 41AliZDCDataDCS::AliZDCDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime,
42 UInt_t startTimeDCSQuery, UInt_t endTimeDCSQuery):
5a8e8156 43 TObject(),
44 fRun(nRun),
45 fStartTime(startTime),
46 fEndTime(endTime),
e83c8d88 47 fStartTimeDCSQuery(startTimeDCSQuery),
48 fEndTimeDCSQuery(endTimeDCSQuery),
5a8e8156 49 fIsProcessed(kFALSE)
64a7c78d 50{
5a8e8156 51 // Standard constructor
52
e83c8d88 53 AliDebug(2,Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s \n\tStartTime DCS Query %s \n\tEndTime DCS Query %s", nRun,
5a8e8156 54 TTimeStamp(startTime).AsString(),
e83c8d88 55 TTimeStamp(endTime).AsString(),
56 TTimeStamp(startTimeDCSQuery).AsString(),
57 TTimeStamp(endTimeDCSQuery).AsString()));
64a7c78d 58
5a8e8156 59 Init();
64a7c78d 60
61}
62
63//---------------------------------------------------------------
e83c8d88 64AliZDCDataDCS::AliZDCDataDCS(const AliZDCDataDCS & data):
65 TObject(data),
66 fRun(data.fRun),
67 fStartTime(data.fStartTime),
68 fEndTime(data.fEndTime),
69 fStartTimeDCSQuery(data.fStartTimeDCSQuery),
70 fEndTimeDCSQuery(data.fEndTimeDCSQuery),
e83c8d88 71 fIsProcessed(data.fIsProcessed)
72{
73
74 // copy constructor
75
76 for(int i=0;i<kNAliases;i++) {
77 fAliasNames[i]=data.fAliasNames[i];
78 }
79
80
81}
82
83//---------------------------------------------------------------
84AliZDCDataDCS& AliZDCDataDCS:: operator=(const AliZDCDataDCS & data) {
85
86 // assignment operator
87
88 if (this == &data)
89 return *this;
90
91 TObject::operator=(data);
92 fRun = data.GetRun();
93 fStartTime = data.GetStartTime();
94 fEndTime = data.GetEndTime();
95 fStartTimeDCSQuery = data.GetStartTimeDCSQuery();
96 fEndTimeDCSQuery = data.GetEndTimeDCSQuery();
97
98 for(int i=0;i<kNAliases;i++) {
99 fAliasNames[i]=data.GetAliasName(i);
100 fCalibData[i]=data.GetCalibData(i);
101 fTimeStamp[i]=data.GetTimeStamp(i);
102 }
103
104 return *this;
105}
106
107//---------------------------------------------------------------
5a8e8156 108AliZDCDataDCS::~AliZDCDataDCS()
109{
110 // Destructor
64a7c78d 111}
112
113//---------------------------------------------------------------
e83c8d88 114Bool_t AliZDCDataDCS::ProcessData(TMap& aliasMap)
5a8e8156 115{
116 // Data processing
e83c8d88 117
bf867209 118 if(!(fAliasNames[0])) Init();
e83c8d88 119
120 AliInfo(Form(" Start Time = %i",fStartTime));
121 AliInfo(Form(" End Time = %i",fEndTime));
122 AliInfo(Form(" Start Time DCS Query= %i",fStartTimeDCSQuery));
123 AliInfo(Form(" End Time DCS Query= %i",fEndTimeDCSQuery));
bf867209 124
125 if (fEndTime==fStartTime){
126 AliError(Form(" Run with null time length: start time = %i = end time = %i",fStartTime,fEndTime));
127 return kFALSE;
128 }
5a8e8156 129
bf867209 130 TObjArray *aliasArr;
131 AliDCSValue *aValue;
e83c8d88 132
5a8e8156 133 for(int j=0; j<kNAliases; j++){
bf867209 134 aliasArr = dynamic_cast<TObjArray*> (aliasMap.GetValue(fAliasNames[j].Data()));
5a8e8156 135 if(!aliasArr){
fea9b334 136 AliWarning(Form("Alias %s not found!", fAliasNames[j].Data()));
e83c8d88 137 return kFALSE;
5a8e8156 138 }
139 Introduce(j, aliasArr);
140
bf867209 141 TIter iterarray(aliasArr);
142 Int_t nentries = aliasArr->GetEntries();
143 if(nentries<=2){
fea9b334 144 AliWarning(Form("Alias %s has just %d entries!",
bf867209 145 fAliasNames[j].Data(), nentries));
5a8e8156 146 continue;
147 }
148
bf867209 149 Float_t *time = new Float_t[nentries];
150 Float_t *val = new Float_t[nentries];
5a8e8156 151
152 UInt_t ne=0;
153 while((aValue = (AliDCSValue*) iterarray.Next())) {
154 val[ne] = aValue->GetFloat();
e83c8d88 155 time[ne] = (Float_t) (aValue->GetTimeStamp());
c43818e0 156 fCalibData[ne] = val[ne];
157 fTimeStamp[ne] = time[ne];
5a8e8156 158 ne++;
159 }
5a8e8156 160
5a8e8156 161 delete[] val;
162 delete[] time;
163 }
164 //
165 fIsProcessed=kTRUE;
e83c8d88 166
167 return kTRUE;
64a7c78d 168}
169
170//---------------------------------------------------------------
5a8e8156 171void AliZDCDataDCS::Init()
172{
173 // Initialization
c43e6d35 174 fAliasNames[0] = "ZDC_ZNA_POS.actual.position";
175 fAliasNames[1] = "ZDC_ZPA_POS.actual.position";
176 fAliasNames[2] = "ZDC_ZNC_POS.actual.position";
177 fAliasNames[3] = "ZDC_ZPC_POS.actual.position";
b39b8493 178 //
c43e6d35 179 fAliasNames[4] = "ZDC_ZNA_HV0.actual.vMon";
180 fAliasNames[5] = "ZDC_ZNA_HV1.actual.vMon";
181 fAliasNames[6] = "ZDC_ZNA_HV2.actual.vMon";
182 fAliasNames[7] = "ZDC_ZNA_HV3.actual.vMon";
183 fAliasNames[8] = "ZDC_ZNA_HV4.actual.vMon";
b39b8493 184 //
c43e6d35 185 fAliasNames[9] = "ZDC_ZPA_HV0.actual.vMon";
186 fAliasNames[10] = "ZDC_ZPA_HV1.actual.vMon";
187 fAliasNames[11] = "ZDC_ZPA_HV2.actual.vMon";
188 fAliasNames[12] = "ZDC_ZPA_HV3.actual.vMon";
189 fAliasNames[13] = "ZDC_ZPA_HV4.actual.vMon";
b39b8493 190 //
c43e6d35 191 fAliasNames[14] = "ZDC_ZNC_HV0.actual.vMon";
192 fAliasNames[15] = "ZDC_ZNC_HV1.actual.vMon";
193 fAliasNames[16] = "ZDC_ZNC_HV2.actual.vMon";
194 fAliasNames[17] = "ZDC_ZNC_HV3.actual.vMon";
195 fAliasNames[18] = "ZDC_ZNC_HV4.actual.vMon";
b39b8493 196 //
c43e6d35 197 fAliasNames[19] = "ZDC_ZPC_HV0.actual.vMon";
198 fAliasNames[20] = "ZDC_ZPC_HV1.actual.vMon";
199 fAliasNames[21] = "ZDC_ZPC_HV2.actual.vMon";
200 fAliasNames[22] = "ZDC_ZPC_HV3.actual.vMon";
201 fAliasNames[23] = "ZDC_ZPC_HV4.actual.vMon";
b39b8493 202 //
c43e6d35 203 fAliasNames[24] = "ZDC_ZEM_HV0.actual.vMon";
204 fAliasNames[25] = "ZDC_ZEM_HV1.actual.vMon";
c0aec6f6 205 //
20a3b76c 206 fAliasNames[26] = "ZDC_REFA_HV.actual.vMon";
207 fAliasNames[27] = "ZDC_REFC_HV.actual.vMon";
b39b8493 208
64a7c78d 209}
210
211//---------------------------------------------------------------
5a8e8156 212void AliZDCDataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)
213{
214 // Getting array of DCS aliases
215
457a440d 216 int entries = aliasArr->GetEntries();
bf867209 217 AliDebug(2,Form("************ Alias: %s has %d DP values collected\n",
218 fAliasNames[numAlias].Data(),entries));
64a7c78d 219
220}