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 $Log: AliTOFDataDCS.cxx,v $
18 Revision 1.9 2007/05/04 14:02:45 decaro
19 AliTOFDataDCS::Draw(Option_t *) method declared const: compiling warning suppression
21 Revision 1.8 2007/05/03 09:45:09 decaro
22 Coding convention: RN11 violation -> suppression
24 Revision 1.7 2007/05/02 14:09:39 arcelli
25 Retrieval of Env. Temperature removed (will get it from the GRP)
27 Revision 1.6 2007/04/04 17:19:19 arcelli
28 Moved some printout to debug level
30 Revision 1.5 2007/02/20 15:57:00 decaro
31 Raw data update: to read the TOF raw data defined in UNPACKED mode
33 Revision 1.4 2007/02/19 15:41:55 decaro
34 Coding convention: few corrections
36 Revision 1.3 2007/01/24 11:19:58 arcelli
37 Modify ProcessData to return a logical (CZ)
39 Revision 1.2 2006/12/18 18:17:38 arcelli
40 Updated Aliases for DCS TOF datapoints (C.Zampolli)
42 Revision 1.1 2006/10/26 09:10:52 arcelli
43 Class for handling the TOF DCS data in the Shuttle (C.Zampolli)
50 #include "TTimeStamp.h"
54 #include "AliDCSValue.h"
57 #include "AliTOFDataDCS.h"
58 #include "AliTOFFormatDCS.h"
64 // AliTOFDataDCS class
65 // main aim to introduce the aliases for the TOF DCS
66 // data points to be then
67 // stored in the OCDB, and to process them.
68 // Process() method called by TOFPrepr
70 ClassImp(AliTOFDataDCS)
72 //---------------------------------------------------------------
73 AliTOFDataDCS::AliTOFDataDCS():
84 for(int i=0;i<kNHV;i++) {
94 //---------------------------------------------------------------
95 AliTOFDataDCS::AliTOFDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime):
98 fStartTime(startTime),
100 fIsProcessed(kFALSE),
104 // constructor with arguments
106 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", nRun,
107 TTimeStamp(startTime).AsString(),
108 TTimeStamp(endTime).AsString()));
114 //---------------------------------------------------------------
116 AliTOFDataDCS::AliTOFDataDCS(const AliTOFDataDCS & data):
121 fIsProcessed(kFALSE),
129 fStartTime=data.fStartTime;
130 fEndTime=data.fEndTime;
131 fIsProcessed=data.fIsProcessed;
134 for(int i=0;i<kNAliases;i++) {
135 fAliasNames[i]=data.fAliasNames[i];
138 for(int i=0;i<kNHV;i++) {
139 fHVvp[i]=data.fHVvp[i];
140 fHVvn[i]=data.fHVvn[i];
141 fHVip[i]=data.fHVip[i];
142 fHVin[i]=data.fHVin[i];
147 //---------------------------------------------------------------
149 AliTOFDataDCS& AliTOFDataDCS:: operator=(const AliTOFDataDCS & data) {
151 // assignment operator
153 this->fRun=data.GetRun();
154 this->fStartTime=data.GetStartTime();
155 this->fEndTime=data.GetEndTime();
157 for(int i=0;i<kNAliases;i++) {
158 this->fAliasNames[i]=data.GetAliasName(i);
161 for(int i=0;i<kNHV;i++) {
162 this->fHVvp[i]=data.GetHVvp(i);
163 this->fHVvn[i]=data.GetHVvn(i);
164 this->fHVip[i]=data.GetHVip(i);
165 this->fHVin[i]=data.GetHVin(i);
171 //---------------------------------------------------------------
172 AliTOFDataDCS::~AliTOFDataDCS() {
176 for(int i=0;i<kNHV;i++) {
189 //---------------------------------------------------------------
190 Bool_t AliTOFDataDCS::ProcessData(TMap& aliasMap){
192 // method to process the data
194 if(!(fAliasNames[0])) Init();
200 Float_t timedelta[2];
202 AliInfo(Form(" Start Time = %i",fStartTime));
203 AliInfo(Form(" End Time = %i",fEndTime));
205 if (fEndTime==fStartTime){
206 AliError(Form(" Run with null time length: start time = %i = end time = %i",fStartTime,fEndTime));
212 AliDCSValue* aValue1;
214 // starting loop on aliases
215 for(int j=0; j<kNAliases; j++){
216 for (Int_t k=0;k<2;k++) {
220 //AliInfo(Form("j = %i, with alias = %s",j,fAliasNames[j].Data()));
221 aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data());
223 AliError(Form("Alias %s not found!", fAliasNames[j].Data()));
225 return kFALSE; // returning only in case we are not in a FDR run
232 Introduce(j, aliasArr);
234 if(aliasArr->GetEntries()<3){
235 AliError(Form("Alias %s has just %d entries!",
236 fAliasNames[j].Data(),aliasArr->GetEntries()));
240 TIter iterarray(aliasArr);
242 Int_t nentries = aliasArr->GetEntries();
243 Int_t deltaTimeStamp = (Int_t) nentries/3;
244 Int_t deltaTimeStamp1 = (Int_t) nentries/2;
246 // filling aliases with 10 floats+1 Usign
248 for (Int_t k=0;k<3;k++){
249 index = deltaTimeStamp*k;
254 index=deltaTimeStamp1;
259 aValue = (AliDCSValue*) aliasArr->At(index);
260 val = aValue->GetFloat();
261 time = (Float_t) (aValue->GetTimeStamp());
263 fHVvp[j]->SetFloat(k,val);
264 fHVvp[j]->SetTimeStampFloat(k,time);
267 fHVvn[j-kNHV]->SetFloat(k,val);
268 fHVvn[j-kNHV]->SetTimeStampFloat(k,time);
271 fHVip[j-2*kNHV]->SetFloat(k,val);
272 fHVip[j-2*kNHV]->SetTimeStampFloat(k,time);
275 fHVin[j-3*kNHV]->SetFloat(k,val);
276 fHVin[j-3*kNHV]->SetTimeStampFloat(k,time);
280 //computing the most significant variations
282 Float_t timeDiff = (Float_t)(fEndTime-fStartTime);
283 Int_t deltamin = (Int_t)(60/timeDiff*nentries); //sampling every minute
284 Int_t klast = nentries-deltamin;
286 for (Int_t k=0;k<klast;k++){
287 aValue = (AliDCSValue*) aliasArr->At(k);
288 aValue1 = (AliDCSValue*) aliasArr->At(k+deltamin);
289 val = aValue->GetFloat();
290 val1 = aValue1->GetFloat();
291 if (delta[0]<=TMath::Abs(val1-val)) {
292 delta[0]=TMath::Abs(val1-val);
293 timedelta[0] = (Float_t)k;
295 if (delta[1]<=delta[0]) {
296 Float_t temp = delta[1];
297 Float_t timetemp = timedelta[1];
300 timedelta[1]=timedelta[0];
301 timedelta[0]=timetemp;
305 for (Int_t kk=0;kk<2;kk++){
307 fHVvp[j]->SetDelta(kk,delta[kk]);
308 fHVvp[j]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
311 fHVvn[j-kNHV]->SetDelta(kk,delta[kk]);
312 fHVvn[j-kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
315 fHVip[j-2*kNHV]->SetDelta(kk,delta[kk]);
316 fHVip[j-2*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
319 fHVin[j-3*kNHV]->SetDelta(kk,delta[kk]);
320 fHVin[j-3*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
330 //---------------------------------------------------------------
331 void AliTOFDataDCS::Init(){
333 // initialization of aliases and DCS data
336 for(int i=0;i<kNAliases;i++){
339 fAliasNames[i] = "tof_hv_vp_";
340 sindex.Form("%02i",i);
341 fAliasNames[i] += sindex;
342 fHVvp[i] = new AliTOFFormatDCS();
345 fAliasNames[i] = "tof_hv_vn_";
346 sindex.Form("%02i",i-kNHV);
347 fAliasNames[i] += sindex;
348 fHVvn[i-kNHV] = new AliTOFFormatDCS();
352 fAliasNames[i] = "tof_hv_ip_";
353 sindex.Form("%02i",i-2*kNHV);
354 fAliasNames[i] += sindex;
355 fHVip[i-2*kNHV] = new AliTOFFormatDCS();
358 fAliasNames[i] = "tof_hv_in_";
359 sindex.Form("%02i",i-3*kNHV);
360 fAliasNames[i] += sindex;
361 fHVin[i-3*kNHV] = new AliTOFFormatDCS();
367 //---------------------------------------------------------------
368 void AliTOFDataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)const
371 // method to introduce new aliases
374 entries = aliasArr->GetEntries();
377 AliDebug(2,Form("************ Alias: %s **********",fAliasNames[numAlias].Data()));
378 AliDebug(2,Form(" %d DP values collected",entries));
382 //---------------------------------------------------------------
383 void AliTOFDataDCS::Draw(const Option_t* /*option*/)
385 // Draw all histos and graphs
387 if(!fIsProcessed) return;
390 TString canvasHistoName="Histos";
391 ch=new TCanvas(canvasHistoName,canvasHistoName,20,20,600,600);