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