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 **************************************************************************/
18 Revision 1.7 2007/12/06 16:35:24 alla
19 new bugs fixed by Tomek
21 Revision 1.5 2007/11/23 19:28:52 alla
24 Version 2.1 2007/11/21
25 Preprocessor storing data to OCDB (T.Malkiewicz)
28 Preliminary test version (T.Malkiewicz)
32 // 1) takes data from DCS and passes it to the class AliTOFDataDCS for processing and writes the result to the Reference DB.
33 // 2) takes data form DAQ (both from Laser Calibration and Physics runs), processes it, and stores either to OCDB or to Reference DB.
35 #include "AliT0Preprocessor.h"
36 #include "AliT0DataDCS.h"
37 #include "AliT0CalibWalk.h"
38 #include "AliT0CalibTimeEq.h"
40 #include "AliCDBMetaData.h"
41 #include "AliDCSValue.h"
44 #include <TTimeStamp.h>
46 #include <TObjString.h>
48 #include "AliT0Dqclass.h"
51 ClassImp(AliT0Preprocessor)
53 //____________________________________________________
54 AliT0Preprocessor::AliT0Preprocessor(AliShuttleInterface* shuttle) : AliPreprocessor("T00", shuttle), fData(0)
58 //____________________________________________________
60 AliT0Preprocessor::~AliT0Preprocessor()
65 //____________________________________________________
67 void AliT0Preprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
69 AliPreprocessor::Initialize(run, startTime, endTime);
70 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString()));
71 fData = new AliT0DataDCS(fRun, fStartTime, fEndTime);
73 //____________________________________________________
75 UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap )
77 // T0 preprocessor return codes:
79 // return=1 : no DCS input data
80 // return=2 : failed to store DCS data
81 // return=3 : no Laser data (Walk correction)
82 // return=4 : failed to store OCDB time equalized data
83 // return=5 : no DAQ input for OCDB
84 // return=6 : failed to retrieve DAQ data from OCDB
85 // return=7 : failed to store T0 OCDB data
87 Bool_t resultDCSMap=kFALSE;
88 Bool_t resultDCSStore=kFALSE;
89 Bool_t resultLaser=kFALSE;
90 Bool_t resultOnline=kFALSE;
94 Log("No DCS input data");
100 resultDCSMap=fData->ProcessData(*dcsAliasMap);
103 Log("Error when processing DCS data");
104 return 2;// return error Code for processed DCS data not stored
108 Float_t *meanScaler[24] = fData->GetScalerMean();
110 AliCDBMetaData metaDataDCS;
111 metaDataDCS.SetBeamPeriod(0);
112 metaDataDCS.SetResponsible("Tomasz Malkiewicz");
113 metaDataDCS.SetComment("This preprocessor fills an AliTODataDCS object.");
114 AliInfo("Storing DCS Data");
115 resultDCSStore = Store("Calib","DCSData",meanScaler, &metaDataDCS);
118 Log("Some problems occurred while storing DCS data results in ReferenceDB");
119 return 2;// return error Code for processed DCS data not stored
128 TString runType = GetRunType();
130 if(runType == "T0_STANDALONE_LASER")
132 TList* list = GetFileSources(kDAQ, "LASER");
137 while ((source = dynamic_cast<TObjString *> (iter.Next())))
139 const char *laserFile = GetFile(kDAQ, "LASER", source->GetName());
142 Log(Form("File with Id LASER found in source %s!", source->GetName()));
143 AliT0CalibWalk *laser = new AliT0CalibWalk();
144 laser->MakeWalkCorrGraph(laserFile);
145 AliCDBMetaData metaData;
146 metaData.SetBeamPeriod(0);
147 metaData.SetResponsible("Tomek&Michal");
148 metaData.SetComment("Walk correction from laser runs.");
149 //TObjArray* arrLaser = laser->GetfWalk();
150 resultLaser=Store("Calib","Slewing_Walk", laser, &metaData, 0, 1);
155 Log(Form("Could not find file with Id LASER in source %s!", source->GetName()));
161 Log("No Laser Data stored");
162 return 3;//return error code for failure in storing Laser Data
165 Log("No sources found for id LASER!");
169 else if(runType == "PHYSICS")
171 TList* listPhys = GetFileSources(kDAQ, "PHYSICS");
174 TIter iter(listPhys);
175 TObjString *sourcePhys;
176 while ((sourcePhys = dynamic_cast<TObjString *> (iter.Next())))
178 const char *filePhys = GetFile(kDAQ, "PHYSICS", sourcePhys->GetName());
181 AliT0CalibTimeEq *online = new AliT0CalibTimeEq();
183 online->ComputeOnlineParams("CFD", 20, 4., filePhys);
184 AliCDBMetaData metaData;
185 metaData.SetBeamPeriod(0);
186 metaData.SetResponsible("Tomek&Michal");
187 metaData.SetComment("Time equalizing result.");
188 resultOnline = Store("Calib","TimeDelay", online, &metaData, 0, 1);
193 Log(Form("Could not find file with Id PHYSICS in source %s!", sourcePhys->GetName()));
199 Log("No Laser Data stored");
200 return 4;//return error code for failure in storing OCDB Data
203 Log("No sources found for id PHYSICS!");