1 ///////////////////////////////////////////////////////////////////////////////
3 // Class for ZDC DCS data //
5 ///////////////////////////////////////////////////////////////////////////////
7 #include "AliZDCDataDCS.h"
9 #include "AliCDBMetaData.h"
10 #include "AliDCSValue.h"
13 #include <TTimeStamp.h>
14 #include <TObjString.h>
20 ClassImp(AliZDCDataDCS)
22 //---------------------------------------------------------------
23 AliZDCDataDCS::AliZDCDataDCS():
28 fGraphs("TGraph",kNGraphs),
31 // Default constructor
34 //---------------------------------------------------------------
35 AliZDCDataDCS::AliZDCDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime):
38 fStartTime(startTime),
40 fGraphs("TGraph",kNGraphs),
43 // Standard constructor
45 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", nRun,
46 TTimeStamp(startTime).AsString(),
47 TTimeStamp(endTime).AsString()));
53 //---------------------------------------------------------------
54 AliZDCDataDCS::~AliZDCDataDCS()
60 //---------------------------------------------------------------
61 void AliZDCDataDCS::ProcessData(TMap& aliasMap, Float_t *fCalibData)
67 for(int j=0; j<kNAliases; j++){
68 aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data());
70 AliError(Form("Alias %s not found!", fAliasNames[j].Data()));
73 Introduce(j, aliasArr);
75 if(aliasArr->GetEntries()<2){
76 AliError(Form("Alias %s has just %d entries!",
77 fAliasNames[j].Data(),aliasArr->GetEntries()));
81 TIter iterarray(aliasArr);
83 Double_t *time = new Double_t[aliasArr->GetEntries()];
84 Double_t *val = new Double_t[aliasArr->GetEntries()];
87 while((aValue = (AliDCSValue*) iterarray.Next())) {
88 val[ne] = aValue->GetFloat();
89 time[ne] = (Double_t) (aValue->GetTimeStamp());
90 fCalibData[ne] = val[ne];
96 if(j>=4) CreateGraph(j, aliasArr->GetEntries(), time, val); // fill graphs
106 //---------------------------------------------------------------
107 void AliZDCDataDCS::Init()
111 TH1::AddDirectory(kFALSE);
115 for(int i=0;i<kNAliases;i++){
117 fAliasNames[i] = "ZDC.Position";
121 fAliasNames[i] = "ZDC.HVValue";
122 fAliasNames[i] += i-4;
128 //---------------------------------------------------------------
129 void AliZDCDataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)
131 // Getting array of DCS aliases
133 int entries=aliasArr->GetEntries();
134 AliInfo(Form("************ Alias: %s **********",fAliasNames[numAlias].Data()));
135 AliInfo(Form(" %d DP values collected",entries));
140 //---------------------------------------------------------------
141 void AliZDCDataDCS::CreateGraph(int i, int dim, const Double_t *x, const Double_t *y)
146 TGraph *gr = new(fGraphs[fGraphs.GetEntriesFast()]) TGraph(dim, x, y);
148 gr->GetXaxis()->SetTimeDisplay(1);
149 gr->SetTitle(fAliasNames[i].Data());
151 AliInfo(Form("Array entries: %d",fGraphs.GetEntriesFast()));
156 //---------------------------------------------------------------
157 void AliZDCDataDCS::Draw(const Option_t* /*option*/)
162 if(!fIsProcessed) return;
164 if(fGraphs.GetEntries()==0) return;
167 TString canvas1Name="ZN1_HVs";
168 cg1=new TCanvas(canvas1Name,canvas1Name,40,40,600,600);
171 ((TGraph*) fGraphs.UncheckedAt(0))->SetMarkerStyle(20);
172 ((TGraph*) fGraphs.UncheckedAt(0))->Draw("ALP");
174 ((TGraph*) fGraphs.UncheckedAt(1))->SetMarkerStyle(20);
175 ((TGraph*) fGraphs.UncheckedAt(1))->Draw("ALP");
177 ((TGraph*) fGraphs.UncheckedAt(2))->SetMarkerStyle(20);
178 ((TGraph*) fGraphs.UncheckedAt(2))->Draw("ALP");
180 ((TGraph*) fGraphs.UncheckedAt(3))->SetMarkerStyle(20);
181 ((TGraph*) fGraphs.UncheckedAt(3))->Draw("ALP");
184 TString canvas2Name="ZP1_HVs";
185 cg2=new TCanvas(canvas2Name,canvas2Name,80,80,600,600);
188 ((TGraph*) fGraphs.UncheckedAt(5))->SetMarkerStyle(20);
189 ((TGraph*) fGraphs.UncheckedAt(5))->Draw("ALP");
191 ((TGraph*) fGraphs.UncheckedAt(6))->SetMarkerStyle(20);
192 ((TGraph*) fGraphs.UncheckedAt(6))->Draw("ALP");
194 ((TGraph*) fGraphs.UncheckedAt(7))->SetMarkerStyle(20);
195 ((TGraph*) fGraphs.UncheckedAt(7))->Draw("ALP");
197 ((TGraph*) fGraphs.UncheckedAt(8))->SetMarkerStyle(20);
198 ((TGraph*) fGraphs.UncheckedAt(8))->Draw("ALP");