]> git.uio.no Git - u/mrichter/AliRoot.git/blame - T0/AliT0Preprocessor.cxx
New Raw Data format implemented
[u/mrichter/AliRoot.git] / T0 / AliT0Preprocessor.cxx
CommitLineData
bc943889 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/*
50e28e1c 17$Log: AliT0Preprocessor.cxx,v $
18Revision 1.8 2007/12/07 15:22:51 alla
19bug fixed by Alberto
20
67b67126 21Revision 1.7 2007/12/06 16:35:24 alla
22new bugs fixed by Tomek
23
02cf5377 24Revision 1.5 2007/11/23 19:28:52 alla
25bug fixed
26
bc943889 27Version 2.1 2007/11/21
28Preprocessor storing data to OCDB (T.Malkiewicz)
29
30Version 1.1 2006/10
31Preliminary test version (T.Malkiewicz)
32*/
387638f7 33// T0 preprocessor:
34// 1) takes data from DCS and passes it to the class AliTOFDataDCS
35// for processing and writes the result to the Reference DB.
36// 2) takes data form DAQ (both from Laser Calibration and Physics runs),
37// processes it, and stores either to OCDB or to Reference DB.
38
bc943889 39
dc7ca31d 40#include "AliT0Preprocessor.h"
bc943889 41#include "AliT0DataDCS.h"
42#include "AliT0CalibWalk.h"
43#include "AliT0CalibTimeEq.h"
dc7ca31d 44
45#include "AliCDBMetaData.h"
46#include "AliDCSValue.h"
47#include "AliLog.h"
dc7ca31d 48
49#include <TTimeStamp.h>
50#include <TFile.h>
5221c818 51#include <TObjString.h>
dc7ca31d 52#include <TNamed.h>
53#include "AliT0Dqclass.h"
54
bc943889 55
dc7ca31d 56ClassImp(AliT0Preprocessor)
57
58//____________________________________________________
387638f7 59AliT0Preprocessor::AliT0Preprocessor(AliShuttleInterface* shuttle) :
60 AliPreprocessor("T00", shuttle),
61 fData(0)
dc7ca31d 62{
bc943889 63 //constructor
dc7ca31d 64}
bc943889 65//____________________________________________________
dc7ca31d 66
67AliT0Preprocessor::~AliT0Preprocessor()
68{
50e28e1c 69 //destructor
bc943889 70 delete fData;
71 fData = 0;
72}
73//____________________________________________________
dc7ca31d 74
bc943889 75void AliT0Preprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
76{
50e28e1c 77 // Creates AliT0DataDCS object
bc943889 78 AliPreprocessor::Initialize(run, startTime, endTime);
79 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString()));
80 fData = new AliT0DataDCS(fRun, fStartTime, fEndTime);
dc7ca31d 81}
bc943889 82//____________________________________________________
dc7ca31d 83
84UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap )
85{
bc943889 86 // T0 preprocessor return codes:
87 // return=0 : all ok
88 // return=1 : no DCS input data
89 // return=2 : failed to store DCS data
90 // return=3 : no Laser data (Walk correction)
91 // return=4 : failed to store OCDB time equalized data
92 // return=5 : no DAQ input for OCDB
93 // return=6 : failed to retrieve DAQ data from OCDB
94 // return=7 : failed to store T0 OCDB data
95
96 Bool_t resultDCSMap=kFALSE;
97 Bool_t resultDCSStore=kFALSE;
98 Bool_t resultLaser=kFALSE;
99 Bool_t resultOnline=kFALSE;
8bfd9a3e 100
101 if(!dcsAliasMap)
102 {
103 Log("No DCS input data");
104 return 1;
105 }
106 else
107 {
083f0bec 108 /*
8bfd9a3e 109 resultDCSMap=fData->ProcessData(*dcsAliasMap);
110 if(!resultDCSMap)
111 {
112 Log("Error when processing DCS data");
bc943889 113 return 2;// return error Code for processed DCS data not stored
114 }
115 else
116 {
117 AliCDBMetaData metaDataDCS;
118 metaDataDCS.SetBeamPeriod(0);
119 metaDataDCS.SetResponsible("Tomasz Malkiewicz");
120 metaDataDCS.SetComment("This preprocessor fills an AliTODataDCS object.");
121 AliInfo("Storing DCS Data");
083f0bec 122 resultDCSStore = Store("Calib","DCSData",fData, &metaDataDCS);
bc943889 123 if (!resultDCSStore)
8bfd9a3e 124 {
bc943889 125 Log("Some problems occurred while storing DCS data results in ReferenceDB");
387638f7 126 return 2;// return error Code for processed DCS data not stored
bc943889 127 }
dc7ca31d 128
8bfd9a3e 129 }
387638f7 130 */
8bfd9a3e 131 }
132
133 // processing DAQ
bc943889 134
8bfd9a3e 135 TString runType = GetRunType();
bc943889 136
387638f7 137 if(runType == "STANDALONE")
8bfd9a3e 138 {
139 TList* list = GetFileSources(kDAQ, "LASER");
bc943889 140 if (list)
141 {
142 TIter iter(list);
143 TObjString *source;
8bfd9a3e 144 while ((source = dynamic_cast<TObjString *> (iter.Next())))
bc943889 145 {
146 const char *laserFile = GetFile(kDAQ, "LASER", source->GetName());
147 if (laserFile)
148 {
02cf5377 149 Log(Form("File with Id LASER found in source %s!", source->GetName()));
8bfd9a3e 150 AliT0CalibWalk *laser = new AliT0CalibWalk();
8bfd9a3e 151 laser->MakeWalkCorrGraph(laserFile);
152 AliCDBMetaData metaData;
bc943889 153 metaData.SetBeamPeriod(0);
154 metaData.SetResponsible("Tomek&Michal");
155 metaData.SetComment("Walk correction from laser runs.");
a8d3b391 156 resultLaser=Store("Calib","Slewing_Walk", laser, &metaData, 0, 1);
bc943889 157 delete laser;
8bfd9a3e 158 }
bc943889 159 else
160 {
8bfd9a3e 161 Log(Form("Could not find file with Id LASER in source %s!", source->GetName()));
bc943889 162 return 1;
163 }
164 }
165 if (!resultLaser)
8bfd9a3e 166 {
bc943889 167 Log("No Laser Data stored");
168 return 3;//return error code for failure in storing Laser Data
169 }
67b67126 170 } else {
171 Log("No sources found for id LASER!");
172 return 1;
173 }
8bfd9a3e 174 }
175 else if(runType == "PHYSICS")
176 {
02cf5377 177 TList* listPhys = GetFileSources(kDAQ, "PHYSICS");
8bfd9a3e 178 if (listPhys)
179 {
180 TIter iter(listPhys);
181 TObjString *sourcePhys;
182 while ((sourcePhys = dynamic_cast<TObjString *> (iter.Next())))
183 {
184 const char *filePhys = GetFile(kDAQ, "PHYSICS", sourcePhys->GetName());
185 if (filePhys)
186 {
187 AliT0CalibTimeEq *online = new AliT0CalibTimeEq();
188 online->Reset();
387638f7 189 online->ComputeOnlineParams(filePhys);
8bfd9a3e 190 AliCDBMetaData metaData;
191 metaData.SetBeamPeriod(0);
192 metaData.SetResponsible("Tomek&Michal");
193 metaData.SetComment("Time equalizing result.");
02cf5377 194 resultOnline = Store("Calib","TimeDelay", online, &metaData, 0, 1);
8bfd9a3e 195 delete online;
196 }
197 else
198 {
199 Log(Form("Could not find file with Id PHYSICS in source %s!", sourcePhys->GetName()));
200 return 1;
201 }
202 }
203 if (!resultOnline)
bc943889 204 {
205 Log("No Laser Data stored");
206 return 4;//return error code for failure in storing OCDB Data
207 }
67b67126 208 } else {
209 Log("No sources found for id PHYSICS!");
210 return 1;
211 }
8bfd9a3e 212 }
dc7ca31d 213
bc943889 214 return 0;
dc7ca31d 215}