]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZERODataDCS.cxx
Correct assocation of tracks to clusters (G. Conesa)
[u/mrichter/AliRoot.git] / VZERO / AliVZERODataDCS.cxx
CommitLineData
76b6018a 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#include "AliVZERODataDCS.h"
18
19#include "AliDCSValue.h"
20#include "AliLog.h"
21
22#include "TGraph.h"
23#include "TAxis.h"
24#include "TCanvas.h"
25#include "TTimeStamp.h"
26#include "TMap.h"
27
28class TH2;
29class AliCDBMetaData;
30class TDatime;
31
32// AliVZERODataDCS class
33// main aim to introduce the aliases for the VZERO DCS
34// data points to be then
35// stored in the OCDB, and to process them.
36// ProcessData() method called by VZEROPreprocessor
37
38ClassImp(AliVZERODataDCS)
39
40//_____________________________________________________________________________
41AliVZERODataDCS::AliVZERODataDCS():
42 TObject(),
43 fRun(0),
44 fStartTime(0),
45 fEndTime(0),
46 fGraphs("TGraph",kNGraphs),
47 fIsProcessed(kFALSE)
48{
49 // Default constructor
50}
51
52//_____________________________________________________________________________
53AliVZERODataDCS::AliVZERODataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime):
54 TObject(),
55 fRun(nRun),
56 fStartTime(startTime),
57 fEndTime(endTime),
58 fGraphs("TGraph",kNGraphs),
59 fIsProcessed(kFALSE)
60{
61
62 // constructor with arguments
63
64 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", nRun,
65 TTimeStamp(startTime).AsString(),
66 TTimeStamp(endTime).AsString()));
67
68 Init();
69
70}
71
72//_____________________________________________________________________________
73AliVZERODataDCS::~AliVZERODataDCS() {
74
75 // destructor
76 fGraphs.Clear("C");
77
78}
79
80//_____________________________________________________________________________
81void AliVZERODataDCS::ProcessData(TMap& aliasMap){
82
83 // method to process the data
84
85 if(!(fAliasNames[0])) Init();
86
87 TObjArray *aliasArr;
88 AliDCSValue* aValue;
89
90 // starting loop on aliases
91 for(int iAlias=0; iAlias<kNAliases; iAlias++){
92
93 aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[iAlias].Data());
94 if(!aliasArr){
95 AliError(Form("Alias %s not found!", fAliasNames[iAlias].Data()));
96 return;
97 }
98
99 Introduce(iAlias, aliasArr);
100
101 if(aliasArr->GetEntries()<2){
102 AliError(Form("Alias %s has just %d entries!",
103 fAliasNames[iAlias].Data(),aliasArr->GetEntries()));
104 continue;
105 }
106
107 TIter iterarray(aliasArr);
108
109 Int_t nentries = aliasArr->GetEntries();
110
111 Double_t *Times = new Double_t[nentries];
112 Double_t *Values = new Double_t[nentries];
113
114 UInt_t iValue=0;
115 while((aValue = (AliDCSValue*) iterarray.Next())) {
116 Values[iValue] = aValue->GetFloat();
117 Times[iValue] = (Double_t) (aValue->GetTimeStamp());
118 fHv[iAlias]->Fill(Values[iValue]);
119 iValue++;
120 }
121 CreateGraph(iAlias, aliasArr->GetEntries(), Times, Values); // fill graphs
122
123 delete[] Values;
124 delete[] Times;
125 }
126
127 // calculate mean and rms of the first two histos
128 for(int i=0;i<kNAliases;i++){
129 fMeanHV[i] = fHv[i]->GetMean();
130 fWidthHV[i] = fHv[i]->GetRMS();
131 }
132
133
134 fIsProcessed=kTRUE;
135}
136
137//_____________________________________________________________________________
138void AliVZERODataDCS::Init(){
139
140 // initialization of aliases and DCS data
141
142 TString sindex;
143 int iAlias = 0;
144
145 for(int iSide = 0; iSide<2 ; iSide++){
146 for(int iRing = 0; iRing<4 ; iRing++){
147 for(int iSector = 0; iSector<8 ; iSector++){
148 if(iSide == 0) fAliasNames[iAlias] = "V00/HV/V0A/SECTOR";
149 else fAliasNames[iAlias] = "V00/HV/V0C/SECTOR";
150 sindex.Form("%d/RING%d",iSector,iRing);
151 fAliasNames[iAlias] += sindex;
152
153 fHv[iAlias] = new TH1F(fAliasNames[iAlias].Data(),fAliasNames[iAlias].Data(), 2000, kHvMin, kHvMax);
154 fHv[iAlias]->GetXaxis()->SetTitle("Hv");
155 iAlias++;
156 }
157 }
158 }
159 if(iAlias!=kNAliases)
160 AliError(Form("Number of DCS Aliases defined not correct"));
161
162}
163
164//_____________________________________________________________________________
165void AliVZERODataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)const
166{
167
168 // method to introduce new aliases
169
c61a7285 170 int entries=aliasArr->GetEntries();
76b6018a 171 AliInfo(Form("************ Alias: %s **********",fAliasNames[numAlias].Data()));
172 AliInfo(Form(" %d DP values collected",entries));
173
174}
175
176//_____________________________________________________________________________
177void AliVZERODataDCS::CreateGraph(int i, int dim, const Double_t *x, const Double_t *y)
178{
179
180 // Create graphics
181
182 TGraph *gr = new(fGraphs[fGraphs.GetEntriesFast()]) TGraph(dim, x, y);
183
184 gr->GetXaxis()->SetTimeDisplay(1);
185 gr->SetTitle(fAliasNames[i].Data());
186
187 AliInfo(Form("Array entries: %d",fGraphs.GetEntriesFast()));
188
189}
190
191
192//_____________________________________________________________________________
193void AliVZERODataDCS::Draw(const Option_t* /*option*/)
194{
195// Draw all histos and graphs
196
197 if(!fIsProcessed) return;
198
199 if(fGraphs.GetEntries()==0) return;
200
201 TString CanvasName;
202 TCanvas *cHV[8];
203
204 for(int iSide = 0 ;iSide<2;iSide++){
205 for(int iRing=0;iRing<4;iRing++){
206 if(iSide == 0) CanvasName = "V0A_Ring";
207 else CanvasName = "V0C_Ring";
208 CanvasName += iRing;
209 int iCanvas = iSide*4 + iRing;
210 cHV[iCanvas] = new TCanvas(CanvasName,CanvasName);
211 cHV[iCanvas]->Divide(3,3);
212 for(int iSector=0;iSector<8;iSector++){
213 cHV[iCanvas]->cd(iSector+1);
214 int iChannel = iSide*32 + iRing*8 + iSector;
215 ((TGraph*) fGraphs.UncheckedAt(iChannel))->SetMarkerStyle(20);
216 ((TGraph*) fGraphs.UncheckedAt(iChannel))->Draw("ALP");
217
218 }
219
220 }
221 }
222
223}
224