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):
127 fStartTimeDCSQuery(0),
129 fIsProcessed(kFALSE),
137 fStartTime=data.fStartTime;
138 fEndTime=data.fEndTime;
139 fStartTimeDCSQuery=data.fStartTimeDCSQuery;
140 fEndTimeDCSQuery=data.fEndTimeDCSQuery;
141 fIsProcessed=data.fIsProcessed;
144 for(int i=0;i<kNAliases;i++) {
145 fAliasNames[i]=data.fAliasNames[i];
148 for(int i=0;i<kNHV;i++) {
149 fHVvp[i]=data.fHVvp[i];
150 fHVvn[i]=data.fHVvn[i];
151 fHVip[i]=data.fHVip[i];
152 fHVin[i]=data.fHVin[i];
157 //---------------------------------------------------------------
159 AliTOFDataDCS& AliTOFDataDCS:: operator=(const AliTOFDataDCS & data) {
161 // assignment operator
163 this->fRun=data.GetRun();
164 this->fStartTime=data.GetStartTime();
165 this->fEndTime=data.GetEndTime();
166 this->fStartTimeDCSQuery=data.GetStartTimeDCSQuery();
167 this->fEndTimeDCSQuery=data.GetEndTimeDCSQuery();
169 for(int i=0;i<kNAliases;i++) {
170 this->fAliasNames[i]=data.GetAliasName(i);
173 for(int i=0;i<kNHV;i++) {
174 this->fHVvp[i]=data.GetHVvp(i);
175 this->fHVvn[i]=data.GetHVvn(i);
176 this->fHVip[i]=data.GetHVip(i);
177 this->fHVin[i]=data.GetHVin(i);
183 //---------------------------------------------------------------
184 AliTOFDataDCS::~AliTOFDataDCS() {
188 for(int i=0;i<kNHV;i++) {
201 //---------------------------------------------------------------
202 Bool_t AliTOFDataDCS::ProcessData(TMap& aliasMap){
204 // method to process the data
206 if(!(fAliasNames[0])) Init();
212 Float_t timedelta[2];
214 AliInfo(Form(" Start Time = %i",fStartTime));
215 AliInfo(Form(" End Time = %i",fEndTime));
216 AliInfo(Form(" Start Time DCS Query= %i",fStartTimeDCSQuery));
217 AliInfo(Form(" End Time DCS Query= %i",fEndTimeDCSQuery));
219 if (fEndTime==fStartTime){
220 AliError(Form(" Run with null time length: start time = %i = end time = %i",fStartTime,fEndTime));
226 AliDCSValue* aValue1;
228 // starting loop on aliases
229 for(int j=0; j<kNAliases; j++){
230 for (Int_t k=0;k<2;k++) {
234 //AliInfo(Form("j = %i, with alias = %s",j,fAliasNames[j].Data()));
235 aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data());
237 AliError(Form("Alias %s not found!", fAliasNames[j].Data()));
239 return kFALSE; // returning only in case we are not in a FDR run
246 Introduce(j, aliasArr);
248 if(aliasArr->GetEntries()<3){
249 AliError(Form("Alias %s has just %d entries!",
250 fAliasNames[j].Data(),aliasArr->GetEntries()));
254 TIter iterarray(aliasArr);
256 Int_t nentries = aliasArr->GetEntries();
257 Int_t deltaTimeStamp = (Int_t) nentries/3;
258 Int_t deltaTimeStamp1 = (Int_t) nentries/2;
260 // filling aliases with 10 floats+1 Usign
262 for (Int_t k=0;k<3;k++){
263 index = deltaTimeStamp*k;
268 index=deltaTimeStamp1;
273 aValue = (AliDCSValue*) aliasArr->At(index);
274 val = aValue->GetFloat();
275 time = (Float_t) (aValue->GetTimeStamp());
277 fHVvp[j]->SetFloat(k,val);
278 fHVvp[j]->SetTimeStampFloat(k,time);
281 fHVvn[j-kNHV]->SetFloat(k,val);
282 fHVvn[j-kNHV]->SetTimeStampFloat(k,time);
285 fHVip[j-2*kNHV]->SetFloat(k,val);
286 fHVip[j-2*kNHV]->SetTimeStampFloat(k,time);
289 fHVin[j-3*kNHV]->SetFloat(k,val);
290 fHVin[j-3*kNHV]->SetTimeStampFloat(k,time);
294 //computing the most significant variations
296 //Float_t timeDiff = (Float_t)(fEndTime-fStartTime);
297 Float_t timeDiff = (Float_t)(fEndTimeDCSQuery-fStartTimeDCSQuery);
298 Int_t deltamin = (Int_t)(60/timeDiff*nentries); //sampling every minute
299 Int_t klast = nentries-deltamin;
301 for (Int_t k=0;k<klast;k++){
302 aValue = (AliDCSValue*) aliasArr->At(k);
303 aValue1 = (AliDCSValue*) aliasArr->At(k+deltamin);
304 val = aValue->GetFloat();
305 val1 = aValue1->GetFloat();
306 if (delta[0]<=TMath::Abs(val1-val)) {
307 delta[0]=TMath::Abs(val1-val);
308 timedelta[0] = (Float_t)k;
310 if (delta[1]<=delta[0]) {
311 Float_t temp = delta[1];
312 Float_t timetemp = timedelta[1];
315 timedelta[1]=timedelta[0];
316 timedelta[0]=timetemp;
320 for (Int_t kk=0;kk<2;kk++){
322 fHVvp[j]->SetDelta(kk,delta[kk]);
323 fHVvp[j]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
326 fHVvn[j-kNHV]->SetDelta(kk,delta[kk]);
327 fHVvn[j-kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
330 fHVip[j-2*kNHV]->SetDelta(kk,delta[kk]);
331 fHVip[j-2*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
334 fHVin[j-3*kNHV]->SetDelta(kk,delta[kk]);
335 fHVin[j-3*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
345 //---------------------------------------------------------------
346 void AliTOFDataDCS::Init(){
348 // initialization of aliases and DCS data
351 for(int i=0;i<kNAliases;i++){
354 fAliasNames[i] = "tof_hv_vp_";
355 sindex.Form("%02i",i);
356 fAliasNames[i] += sindex;
357 fHVvp[i] = new AliTOFFormatDCS();
360 fAliasNames[i] = "tof_hv_vn_";
361 sindex.Form("%02i",i-kNHV);
362 fAliasNames[i] += sindex;
363 fHVvn[i-kNHV] = new AliTOFFormatDCS();
367 fAliasNames[i] = "tof_hv_ip_";
368 sindex.Form("%02i",i-2*kNHV);
369 fAliasNames[i] += sindex;
370 fHVip[i-2*kNHV] = new AliTOFFormatDCS();
373 fAliasNames[i] = "tof_hv_in_";
374 sindex.Form("%02i",i-3*kNHV);
375 fAliasNames[i] += sindex;
376 fHVin[i-3*kNHV] = new AliTOFFormatDCS();
382 //---------------------------------------------------------------
383 void AliTOFDataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)const
386 // method to introduce new aliases
389 entries = aliasArr->GetEntries();
392 AliDebug(2,Form("************ Alias: %s **********",fAliasNames[numAlias].Data()));
393 AliDebug(2,Form(" %d DP values collected",entries));
397 //---------------------------------------------------------------
398 void AliTOFDataDCS::Draw(const Option_t* /*option*/)
400 // Draw all histos and graphs
402 if(!fIsProcessed) return;
405 TString canvasHistoName="Histos";
406 ch=new TCanvas(canvasHistoName,canvasHistoName,20,20,600,600);