1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 #include "AliVZERODataDCS.h"
19 #include "AliDCSValue.h"
25 #include "TTimeStamp.h"
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
38 ClassImp(AliVZERODataDCS)
40 //_____________________________________________________________________________
41 AliVZERODataDCS::AliVZERODataDCS():
46 fGraphs("TGraph",kNGraphs),
49 // Default constructor
52 //_____________________________________________________________________________
53 AliVZERODataDCS::AliVZERODataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime):
56 fStartTime(startTime),
58 fGraphs("TGraph",kNGraphs),
62 // constructor with arguments
64 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", nRun,
65 TTimeStamp(startTime).AsString(),
66 TTimeStamp(endTime).AsString()));
72 //_____________________________________________________________________________
73 AliVZERODataDCS::~AliVZERODataDCS() {
80 //_____________________________________________________________________________
81 void AliVZERODataDCS::ProcessData(TMap& aliasMap){
83 // method to process the data
85 if(!(fAliasNames[0])) Init();
90 // starting loop on aliases
91 for(int iAlias=0; iAlias<kNAliases; iAlias++){
93 aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[iAlias].Data());
95 AliError(Form("Alias %s not found!", fAliasNames[iAlias].Data()));
99 Introduce(iAlias, aliasArr);
101 if(aliasArr->GetEntries()<2){
102 AliError(Form("Alias %s has just %d entries!",
103 fAliasNames[iAlias].Data(),aliasArr->GetEntries()));
107 TIter iterarray(aliasArr);
109 Int_t nentries = aliasArr->GetEntries();
111 Double_t *Times = new Double_t[nentries];
112 Double_t *Values = new Double_t[nentries];
115 while((aValue = (AliDCSValue*) iterarray.Next())) {
116 Values[iValue] = aValue->GetFloat();
117 Times[iValue] = (Double_t) (aValue->GetTimeStamp());
118 fHv[iAlias]->Fill(Values[iValue]);
121 CreateGraph(iAlias, aliasArr->GetEntries(), Times, Values); // fill graphs
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();
137 //_____________________________________________________________________________
138 void AliVZERODataDCS::Init(){
140 // initialization of aliases and DCS data
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;
153 fHv[iAlias] = new TH1F(fAliasNames[iAlias].Data(),fAliasNames[iAlias].Data(), 2000, kHvMin, kHvMax);
154 fHv[iAlias]->GetXaxis()->SetTitle("Hv");
159 if(iAlias!=kNAliases)
160 AliError(Form("Number of DCS Aliases defined not correct"));
164 //_____________________________________________________________________________
165 void AliVZERODataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)const
168 // method to introduce new aliases
170 int entries=entries = aliasArr->GetEntries();
171 AliInfo(Form("************ Alias: %s **********",fAliasNames[numAlias].Data()));
172 AliInfo(Form(" %d DP values collected",entries));
176 //_____________________________________________________________________________
177 void AliVZERODataDCS::CreateGraph(int i, int dim, const Double_t *x, const Double_t *y)
182 TGraph *gr = new(fGraphs[fGraphs.GetEntriesFast()]) TGraph(dim, x, y);
184 gr->GetXaxis()->SetTimeDisplay(1);
185 gr->SetTitle(fAliasNames[i].Data());
187 AliInfo(Form("Array entries: %d",fGraphs.GetEntriesFast()));
192 //_____________________________________________________________________________
193 void AliVZERODataDCS::Draw(const Option_t* /*option*/)
195 // Draw all histos and graphs
197 if(!fIsProcessed) return;
199 if(fGraphs.GetEntries()==0) return;
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";
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");