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.5 2007/11/23 19:28:52 alla
21 Version 2.1 2007/11/21
22 Preprocessor storing data to OCDB (T.Malkiewicz)
25 Preliminary test version (T.Malkiewicz)
29 // 1) takes data from DCS and passes it to the class AliTOFDataDCS for processing and writes the result to the Reference DB.
30 // 2) takes data form DAQ (both from Laser Calibration and Physics runs), processes it, and stores either to OCDB or to Reference DB.
32 #include "AliT0Preprocessor.h"
33 #include "AliT0DataDCS.h"
34 #include "AliT0CalibWalk.h"
35 #include "AliT0CalibTimeEq.h"
37 #include "AliCDBMetaData.h"
38 #include "AliDCSValue.h"
41 #include <TTimeStamp.h>
43 #include <TObjString.h>
45 #include "AliT0Dqclass.h"
48 ClassImp(AliT0Preprocessor)
50 //____________________________________________________
51 AliT0Preprocessor::AliT0Preprocessor(AliShuttleInterface* shuttle) : AliPreprocessor("T00", shuttle), fData(0)
55 //____________________________________________________
57 AliT0Preprocessor::~AliT0Preprocessor()
62 //____________________________________________________
64 void AliT0Preprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
66 AliPreprocessor::Initialize(run, startTime, endTime);
67 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString()));
68 fData = new AliT0DataDCS(fRun, fStartTime, fEndTime);
70 //____________________________________________________
72 UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap )
74 // T0 preprocessor return codes:
76 // return=1 : no DCS input data
77 // return=2 : failed to store DCS data
78 // return=3 : no Laser data (Walk correction)
79 // return=4 : failed to store OCDB time equalized data
80 // return=5 : no DAQ input for OCDB
81 // return=6 : failed to retrieve DAQ data from OCDB
82 // return=7 : failed to store T0 OCDB data
84 Bool_t resultDCSMap=kFALSE;
85 Bool_t resultDCSStore=kFALSE;
86 Bool_t resultLaser=kFALSE;
87 Bool_t resultOnline=kFALSE;
91 Log("No DCS input data");
97 resultDCSMap=fData->ProcessData(*dcsAliasMap);
100 Log("Error when processing DCS data");
101 return 2;// return error Code for processed DCS data not stored
105 Float_t *meanScaler[24] = fData->GetScalerMean();
107 AliCDBMetaData metaDataDCS;
108 metaDataDCS.SetBeamPeriod(0);
109 metaDataDCS.SetResponsible("Tomasz Malkiewicz");
110 metaDataDCS.SetComment("This preprocessor fills an AliTODataDCS object.");
111 AliInfo("Storing DCS Data");
112 resultDCSStore = Store("Calib","DCSData",meanScaler, &metaDataDCS);
115 Log("Some problems occurred while storing DCS data results in ReferenceDB");
116 return 2;// return error Code for processed DCS data not stored
125 TString runType = GetRunType();
127 if(runType == "T0_STANDALONE_LASER")
129 TList* list = GetFileSources(kDAQ, "LASER");
134 while ((source = dynamic_cast<TObjString *> (iter.Next())))
136 const char *laserFile = GetFile(kDAQ, "LASER", source->GetName());
139 Log(Form("File with Id LASER found in source %s!", source->GetName()));
140 AliT0CalibWalk *laser = new AliT0CalibWalk();
141 laser->MakeWalkCorrGraph(laserFile);
142 AliCDBMetaData metaData;
143 metaData.SetBeamPeriod(0);
144 metaData.SetResponsible("Tomek&Michal");
145 metaData.SetComment("Walk correction from laser runs.");
146 //TObjArray* arrLaser = laser->GetfWalk();
147 resultLaser=Store("Calib","Slewing_Walk", laser, &metaData, 0, 1);
152 Log(Form("Could not find file with Id LASER in source %s!", source->GetName()));
158 Log("No Laser Data stored");
159 return 3;//return error code for failure in storing Laser Data
163 else if(runType == "PHYSICS")
165 TList* listPhys = GetFileSources(kDAQ, "PHYSICS");
168 TIter iter(listPhys);
169 TObjString *sourcePhys;
170 while ((sourcePhys = dynamic_cast<TObjString *> (iter.Next())))
172 const char *filePhys = GetFile(kDAQ, "PHYSICS", sourcePhys->GetName());
175 AliT0CalibTimeEq *online = new AliT0CalibTimeEq();
177 online->ComputeOnlineParams("CFD", 20, 4., filePhys);
178 AliCDBMetaData metaData;
179 metaData.SetBeamPeriod(0);
180 metaData.SetResponsible("Tomek&Michal");
181 metaData.SetComment("Time equalizing result.");
182 resultOnline = Store("Calib","TimeDelay", online, &metaData, 0, 1);
187 Log(Form("Could not find file with Id PHYSICS in source %s!", sourcePhys->GetName()));
193 Log("No Laser Data stored");
194 return 4;//return error code for failure in storing OCDB Data