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():
78 fStartTimeDCSQuery(0),
86 for(int i=0;i<kNHV;i++) {
96 //---------------------------------------------------------------
97 AliTOFDataDCS::AliTOFDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime, UInt_t startTimeDCSQuery, UInt_t endTimeDCSQuery):
100 fStartTime(startTime),
102 fStartTimeDCSQuery(startTimeDCSQuery),
103 fEndTimeDCSQuery(endTimeDCSQuery),
104 fIsProcessed(kFALSE),
108 // constructor with arguments
110 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s \n\tStartTime DCS Query %s \n\tEndTime DCS Query %s", nRun,
111 TTimeStamp(startTime).AsString(),
112 TTimeStamp(endTime).AsString(),
113 TTimeStamp(startTimeDCSQuery).AsString(),
114 TTimeStamp(endTimeDCSQuery).AsString()));
120 //---------------------------------------------------------------
122 AliTOFDataDCS::AliTOFDataDCS(const AliTOFDataDCS & data):
125 fStartTime(data.fStartTime),
126 fEndTime(data.fEndTime),
127 fStartTimeDCSQuery(data.fStartTimeDCSQuery),
128 fEndTimeDCSQuery(data.fEndTimeDCSQuery),
129 fIsProcessed(data.fIsProcessed),
136 for(int i=0;i<kNAliases;i++) {
137 fAliasNames[i]=data.fAliasNames[i];
140 for(int i=0;i<kNHV;i++) {
141 fHVvp[i]=data.fHVvp[i];
142 fHVvn[i]=data.fHVvn[i];
143 fHVip[i]=data.fHVip[i];
144 fHVin[i]=data.fHVin[i];
149 //---------------------------------------------------------------
151 AliTOFDataDCS& AliTOFDataDCS:: operator=(const AliTOFDataDCS & data) {
153 // assignment operator
158 TObject::operator=(data);
160 fStartTime=data.GetStartTime();
161 fEndTime=data.GetEndTime();
162 fStartTimeDCSQuery=data.GetStartTimeDCSQuery();
163 fEndTimeDCSQuery=data.GetEndTimeDCSQuery();
165 for(int i=0;i<kNAliases;i++) {
166 fAliasNames[i]=data.GetAliasName(i);
169 for(int i=0;i<kNHV;i++) {
170 fHVvp[i]=data.GetHVvp(i);
171 fHVvn[i]=data.GetHVvn(i);
172 fHVip[i]=data.GetHVip(i);
173 fHVin[i]=data.GetHVin(i);
179 //---------------------------------------------------------------
180 AliTOFDataDCS::~AliTOFDataDCS() {
184 for(int i=0;i<kNHV;i++) {
197 //---------------------------------------------------------------
198 Bool_t AliTOFDataDCS::ProcessData(TMap& aliasMap){
200 // method to process the data
202 if(!(fAliasNames[0])) Init();
208 Float_t timedelta[2];
210 AliInfo(Form(" Start Time = %i",fStartTime));
211 AliInfo(Form(" End Time = %i",fEndTime));
212 AliInfo(Form(" Start Time DCS Query= %i",fStartTimeDCSQuery));
213 AliInfo(Form(" End Time DCS Query= %i",fEndTimeDCSQuery));
215 if (fEndTime==fStartTime){
216 AliError(Form(" Run with null time length: start time = %i = end time = %i",fStartTime,fEndTime));
222 AliDCSValue* aValue1;
224 // starting loop on aliases
225 for(int j=0; j<kNAliases; j++){
226 for (Int_t k=0;k<2;k++) {
230 //AliInfo(Form("j = %i, with alias = %s",j,fAliasNames[j].Data()));
231 aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data());
233 AliError(Form("Alias %s not found!", fAliasNames[j].Data()));
235 return kFALSE; // returning only in case we are not in a FDR run
242 Introduce(j, aliasArr);
244 if(aliasArr->GetEntries()<3){
245 AliError(Form("Alias %s has just %d entries!",
246 fAliasNames[j].Data(),aliasArr->GetEntries()));
250 TIter iterarray(aliasArr);
252 Int_t nentries = aliasArr->GetEntries();
253 Int_t deltaTimeStamp = (Int_t) nentries/3;
254 Int_t deltaTimeStamp1 = (Int_t) nentries/2;
256 // filling aliases with 10 floats+1 Usign
258 for (Int_t k=0;k<3;k++){
259 index = deltaTimeStamp*k;
264 index=deltaTimeStamp1;
269 aValue = (AliDCSValue*) aliasArr->At(index);
270 val = aValue->GetFloat();
271 time = (Float_t) (aValue->GetTimeStamp());
273 fHVvp[j]->SetFloat(k,val);
274 fHVvp[j]->SetTimeStampFloat(k,time);
277 fHVvn[j-kNHV]->SetFloat(k,val);
278 fHVvn[j-kNHV]->SetTimeStampFloat(k,time);
281 fHVip[j-2*kNHV]->SetFloat(k,val);
282 fHVip[j-2*kNHV]->SetTimeStampFloat(k,time);
285 fHVin[j-3*kNHV]->SetFloat(k,val);
286 fHVin[j-3*kNHV]->SetTimeStampFloat(k,time);
290 //computing the most significant variations
292 //Float_t timeDiff = (Float_t)(fEndTime-fStartTime);
293 Float_t timeDiff = (Float_t)(fEndTimeDCSQuery-fStartTimeDCSQuery);
294 Int_t deltamin = (Int_t)(60/timeDiff*nentries); //sampling every minute
295 Int_t klast = nentries-deltamin;
297 for (Int_t k=0;k<klast;k++){
298 aValue = (AliDCSValue*) aliasArr->At(k);
299 aValue1 = (AliDCSValue*) aliasArr->At(k+deltamin);
300 val = aValue->GetFloat();
301 val1 = aValue1->GetFloat();
302 if (delta[0]<=TMath::Abs(val1-val)) {
303 delta[0]=TMath::Abs(val1-val);
304 timedelta[0] = (Float_t)k;
306 if (delta[1]<=delta[0]) {
307 Float_t temp = delta[1];
308 Float_t timetemp = timedelta[1];
311 timedelta[1]=timedelta[0];
312 timedelta[0]=timetemp;
316 for (Int_t kk=0;kk<2;kk++){
318 fHVvp[j]->SetDelta(kk,delta[kk]);
319 fHVvp[j]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
322 fHVvn[j-kNHV]->SetDelta(kk,delta[kk]);
323 fHVvn[j-kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
326 fHVip[j-2*kNHV]->SetDelta(kk,delta[kk]);
327 fHVip[j-2*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
330 fHVin[j-3*kNHV]->SetDelta(kk,delta[kk]);
331 fHVin[j-3*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
341 //---------------------------------------------------------------
342 void AliTOFDataDCS::Init(){
344 // initialization of aliases and DCS data
347 for(int i=0;i<kNAliases;i++){
350 fAliasNames[i] = "tof_hv_vp_";
351 sindex.Form("%02i",i);
352 fAliasNames[i] += sindex;
353 fHVvp[i] = new AliTOFFormatDCS();
356 fAliasNames[i] = "tof_hv_vn_";
357 sindex.Form("%02i",i-kNHV);
358 fAliasNames[i] += sindex;
359 fHVvn[i-kNHV] = new AliTOFFormatDCS();
363 fAliasNames[i] = "tof_hv_ip_";
364 sindex.Form("%02i",i-2*kNHV);
365 fAliasNames[i] += sindex;
366 fHVip[i-2*kNHV] = new AliTOFFormatDCS();
369 fAliasNames[i] = "tof_hv_in_";
370 sindex.Form("%02i",i-3*kNHV);
371 fAliasNames[i] += sindex;
372 fHVin[i-3*kNHV] = new AliTOFFormatDCS();
378 //---------------------------------------------------------------
379 void AliTOFDataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)const
382 // method to introduce new aliases
385 entries = aliasArr->GetEntries();
388 AliDebug(2,Form("************ Alias: %s **********",fAliasNames[numAlias].Data()));
389 AliDebug(2,Form(" %d DP values collected",entries));
393 //---------------------------------------------------------------
394 void AliTOFDataDCS::Draw(const Option_t* /*option*/)
396 // Draw all histos and graphs
398 if(!fIsProcessed) return;
401 TString canvasHistoName="Histos";
402 ch=new TCanvas(canvasHistoName,canvasHistoName,20,20,600,600);