]>
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), | |
3b757990 | 49 | fDaqStartTime(0), |
50 | fDaqEndTime(0), | |
d5deaaa5 | 51 | fGraphs("TGraph",kNGraphs), |
52 | fFEEParameters(NULL), | |
76b6018a | 53 | fIsProcessed(kFALSE) |
d5deaaa5 | 54 | |
76b6018a | 55 | { |
56 | // Default constructor | |
33e193fc | 57 | for(int i=0;i<kNHvChannel;i++) { |
58 | fDeadChannel[i] = kFALSE; | |
59 | fMeanHV[i] = 100.0; | |
60 | fWidthHV[i] = 0.0; | |
61 | } | |
76b6018a | 62 | } |
63 | ||
64 | //_____________________________________________________________________________ | |
3b757990 | 65 | AliVZERODataDCS::AliVZERODataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime, UInt_t daqStartTime, UInt_t daqEndTime): |
76b6018a | 66 | TObject(), |
67 | fRun(nRun), | |
68 | fStartTime(startTime), | |
69 | fEndTime(endTime), | |
3b757990 | 70 | fDaqStartTime(daqStartTime), |
71 | fDaqEndTime(daqEndTime), | |
d5deaaa5 | 72 | fGraphs("TGraph",kNGraphs), |
73 | fFEEParameters(new TMap()), | |
76b6018a | 74 | fIsProcessed(kFALSE) |
d5deaaa5 | 75 | |
76b6018a | 76 | { |
77 | ||
78 | // constructor with arguments | |
33e193fc | 79 | for(int i=0;i<kNHvChannel;i++) { |
80 | fDeadChannel[i] = kFALSE; | |
81 | fMeanHV[i] = 100.0; | |
82 | fWidthHV[i] = 0.0; | |
83 | } | |
3b757990 | 84 | AliInfo(Form("\n\tRun %d \n\tTime Created %s \n\tTime Completed %s \n\tDAQ start %s \n\tDAQ end %s ", nRun, |
d5deaaa5 | 85 | TTimeStamp(startTime).AsString(), |
3b757990 | 86 | TTimeStamp(endTime).AsString(), |
87 | TTimeStamp(daqStartTime).AsString(), | |
88 | TTimeStamp(daqEndTime).AsString())); | |
d5deaaa5 | 89 | |
90 | fFEEParameters->SetOwnerValue(); | |
76b6018a | 91 | Init(); |
92 | ||
93 | } | |
94 | ||
95 | //_____________________________________________________________________________ | |
96 | AliVZERODataDCS::~AliVZERODataDCS() { | |
97 | ||
98 | // destructor | |
99 | fGraphs.Clear("C"); | |
d5deaaa5 | 100 | delete fFEEParameters; |
76b6018a | 101 | |
102 | } | |
103 | ||
104 | //_____________________________________________________________________________ | |
105 | void AliVZERODataDCS::ProcessData(TMap& aliasMap){ | |
106 | ||
107 | // method to process the data | |
108 | ||
109 | if(!(fAliasNames[0])) Init(); | |
110 | ||
111 | TObjArray *aliasArr; | |
112 | AliDCSValue* aValue; | |
113 | ||
114 | // starting loop on aliases | |
115 | for(int iAlias=0; iAlias<kNAliases; iAlias++){ | |
116 | ||
117 | aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[iAlias].Data()); | |
118 | if(!aliasArr){ | |
119 | AliError(Form("Alias %s not found!", fAliasNames[iAlias].Data())); | |
263a0103 | 120 | continue; |
76b6018a | 121 | } |
122 | ||
fad64858 | 123 | //Introduce(iAlias, aliasArr); |
76b6018a | 124 | |
125 | if(aliasArr->GetEntries()<2){ | |
d5deaaa5 | 126 | AliWarning(Form("Alias %s has just %d entries!", |
76b6018a | 127 | fAliasNames[iAlias].Data(),aliasArr->GetEntries())); |
76b6018a | 128 | } |
129 | ||
130 | TIter iterarray(aliasArr); | |
d5deaaa5 | 131 | |
132 | if(iAlias<kNHvChannel){ // Treating HV values | |
133 | Int_t nentries = aliasArr->GetEntries(); | |
134 | ||
135 | Double_t *times = new Double_t[nentries]; | |
136 | Double_t *values = new Double_t[nentries]; | |
137 | ||
138 | UInt_t iValue=0; | |
139 | Float_t variation = 0.0; | |
140 | ||
141 | while((aValue = (AliDCSValue*) iterarray.Next())) { | |
142 | values[iValue] = aValue->GetFloat(); | |
3b757990 | 143 | UInt_t currentTime = aValue->GetTimeStamp(); |
144 | times[iValue] = (Double_t) (currentTime); | |
145 | ||
d5deaaa5 | 146 | if(iValue>0) { |
147 | if(values[iValue-1]>0.) variation = TMath::Abs(values[iValue]-values[iValue-1])/values[iValue-1]; | |
3b757990 | 148 | if(currentTime>fDaqEndTime && variation>0.10) continue; |
d5deaaa5 | 149 | if(variation > 0.10) fDeadChannel[GetOfflineChannel(iAlias)] = kTRUE; |
150 | } | |
d5deaaa5 | 151 | fHv[iAlias]->Fill(values[iValue]); |
152 | printf("%s %f Dead=%d\n",fAliasNames[iAlias].Data(),values[iValue],fDeadChannel[GetOfflineChannel(iAlias)]); | |
153 | iValue++; | |
154 | } | |
155 | CreateGraph(iAlias, aliasArr->GetEntries(), times, values); // fill graphs | |
156 | ||
263a0103 | 157 | // calculate mean and rms of the first two histos |
158 | // and convert index to aliroot channel | |
159 | Int_t iChannel = GetOfflineChannel(iAlias); | |
160 | fMeanHV[iChannel] = fHv[iAlias]->GetMean(); | |
161 | fWidthHV[iChannel] = fHv[iAlias]->GetRMS(); | |
162 | ||
d5deaaa5 | 163 | delete[] values; |
164 | delete[] times; | |
165 | } else { // Treating FEE Parameters | |
166 | AliDCSValue * lastVal = NULL; | |
167 | while((aValue = (AliDCSValue*) iterarray.Next())) lastVal = aValue; // Take only the last value | |
168 | fFEEParameters->Add(new TObjString(fAliasNames[iAlias].Data()),lastVal); | |
169 | } | |
76b6018a | 170 | } |
171 | ||
76b6018a | 172 | fIsProcessed=kTRUE; |
173 | } | |
174 | ||
175 | //_____________________________________________________________________________ | |
176 | void AliVZERODataDCS::Init(){ | |
177 | ||
178 | // initialization of aliases and DCS data | |
179 | ||
180 | TString sindex; | |
181 | int iAlias = 0; | |
182 | ||
183 | for(int iSide = 0; iSide<2 ; iSide++){ | |
184 | for(int iRing = 0; iRing<4 ; iRing++){ | |
185 | for(int iSector = 0; iSector<8 ; iSector++){ | |
186 | if(iSide == 0) fAliasNames[iAlias] = "V00/HV/V0A/SECTOR"; | |
187 | else fAliasNames[iAlias] = "V00/HV/V0C/SECTOR"; | |
188 | sindex.Form("%d/RING%d",iSector,iRing); | |
189 | fAliasNames[iAlias] += sindex; | |
190 | ||
1646eccd | 191 | fHv[iAlias] = new TH1F(fAliasNames[iAlias].Data(),fAliasNames[iAlias].Data(), 3000, kHvMin, kHvMax); |
76b6018a | 192 | fHv[iAlias]->GetXaxis()->SetTitle("Hv"); |
193 | iAlias++; | |
194 | } | |
195 | } | |
196 | } | |
d5deaaa5 | 197 | |
198 | // Time Resolution Parameters | |
199 | ||
200 | for(int iCIU = 0; iCIU<8 ; iCIU++){ | |
201 | fAliasNames[iAlias++] = Form("V00/FEE/CIU%d/TimeResolution",iCIU); | |
202 | fAliasNames[iAlias++] = Form("V00/FEE/CIU%d/WidthResolution",iCIU); | |
203 | } | |
204 | ||
32cd3fdc | 205 | // HPTDC parameters |
206 | for(int iCIU = 0; iCIU<8 ; iCIU++){ | |
207 | fAliasNames[iAlias++] = Form("V00/FEE/CIU%d/MatchWindow",iCIU); | |
208 | fAliasNames[iAlias++] = Form("V00/FEE/CIU%d/SearchWindow",iCIU); | |
209 | fAliasNames[iAlias++] = Form("V00/FEE/CIU%d/TriggerCountOffset",iCIU); | |
210 | fAliasNames[iAlias++] = Form("V00/FEE/CIU%d/RollOver",iCIU); | |
211 | } | |
212 | ||
57c7500a | 213 | for(int iCIU = 0; iCIU<8 ; iCIU++){ |
214 | for(int iCh=1;iCh<=8;iCh++){ | |
215 | fAliasNames[iAlias++] = Form("V00/FEE/CIU%d/DelayHit%d",iCIU,iCh); | |
216 | } | |
217 | } | |
218 | ||
6e2c3e87 | 219 | for(int iCIU = 0; iCIU<8 ; iCIU++){ |
220 | for(int iCh=1;iCh<=8;iCh++){ | |
221 | fAliasNames[iAlias++] = Form("V00/FEE/CIU%d/DiscriThr%d",iCIU,iCh); | |
222 | } | |
223 | } | |
224 | ||
76b6018a | 225 | if(iAlias!=kNAliases) |
226 | AliError(Form("Number of DCS Aliases defined not correct")); | |
227 | ||
228 | } | |
229 | ||
230 | //_____________________________________________________________________________ | |
231 | void AliVZERODataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)const | |
232 | { | |
233 | ||
234 | // method to introduce new aliases | |
235 | ||
c61a7285 | 236 | int entries=aliasArr->GetEntries(); |
76b6018a | 237 | AliInfo(Form("************ Alias: %s **********",fAliasNames[numAlias].Data())); |
238 | AliInfo(Form(" %d DP values collected",entries)); | |
239 | ||
240 | } | |
241 | ||
242 | //_____________________________________________________________________________ | |
243 | void AliVZERODataDCS::CreateGraph(int i, int dim, const Double_t *x, const Double_t *y) | |
244 | { | |
245 | ||
246 | // Create graphics | |
247 | ||
248 | TGraph *gr = new(fGraphs[fGraphs.GetEntriesFast()]) TGraph(dim, x, y); | |
249 | ||
250 | gr->GetXaxis()->SetTimeDisplay(1); | |
251 | gr->SetTitle(fAliasNames[i].Data()); | |
252 | ||
253 | AliInfo(Form("Array entries: %d",fGraphs.GetEntriesFast())); | |
254 | ||
255 | } | |
256 | ||
257 | ||
258 | //_____________________________________________________________________________ | |
259 | void AliVZERODataDCS::Draw(const Option_t* /*option*/) | |
260 | { | |
261 | // Draw all histos and graphs | |
262 | ||
263 | if(!fIsProcessed) return; | |
264 | ||
265 | if(fGraphs.GetEntries()==0) return; | |
266 | ||
80663cb8 | 267 | TString canvasName; |
76b6018a | 268 | TCanvas *cHV[8]; |
269 | ||
270 | for(int iSide = 0 ;iSide<2;iSide++){ | |
271 | for(int iRing=0;iRing<4;iRing++){ | |
80663cb8 | 272 | if(iSide == 0) canvasName = "V0A_Ring"; |
273 | else canvasName = "V0C_Ring"; | |
274 | canvasName += iRing; | |
76b6018a | 275 | int iCanvas = iSide*4 + iRing; |
80663cb8 | 276 | cHV[iCanvas] = new TCanvas(canvasName,canvasName); |
76b6018a | 277 | cHV[iCanvas]->Divide(3,3); |
278 | for(int iSector=0;iSector<8;iSector++){ | |
279 | cHV[iCanvas]->cd(iSector+1); | |
280 | int iChannel = iSide*32 + iRing*8 + iSector; | |
281 | ((TGraph*) fGraphs.UncheckedAt(iChannel))->SetMarkerStyle(20); | |
282 | ((TGraph*) fGraphs.UncheckedAt(iChannel))->Draw("ALP"); | |
283 | ||
284 | } | |
285 | ||
286 | } | |
287 | } | |
288 | ||
289 | } | |
290 |