]> git.uio.no Git - u/mrichter/AliRoot.git/blame - T0/AliT0Preprocessor.cxx
Updated misalignment macros (Raffaele)
[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/*
17$Log$
67b67126 18Revision 1.7 2007/12/06 16:35:24 alla
19new bugs fixed by Tomek
20
02cf5377 21Revision 1.5 2007/11/23 19:28:52 alla
22bug fixed
23
bc943889 24Version 2.1 2007/11/21
25Preprocessor storing data to OCDB (T.Malkiewicz)
26
27Version 1.1 2006/10
28Preliminary test version (T.Malkiewicz)
29*/
30
31// T0 preprocessor:
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.
34
dc7ca31d 35#include "AliT0Preprocessor.h"
bc943889 36#include "AliT0DataDCS.h"
37#include "AliT0CalibWalk.h"
38#include "AliT0CalibTimeEq.h"
dc7ca31d 39
40#include "AliCDBMetaData.h"
41#include "AliDCSValue.h"
42#include "AliLog.h"
dc7ca31d 43
44#include <TTimeStamp.h>
45#include <TFile.h>
5221c818 46#include <TObjString.h>
dc7ca31d 47#include <TNamed.h>
48#include "AliT0Dqclass.h"
49
bc943889 50
dc7ca31d 51ClassImp(AliT0Preprocessor)
52
53//____________________________________________________
8bfd9a3e 54AliT0Preprocessor::AliT0Preprocessor(AliShuttleInterface* shuttle) : AliPreprocessor("T00", shuttle), fData(0)
dc7ca31d 55{
bc943889 56 //constructor
dc7ca31d 57}
bc943889 58//____________________________________________________
dc7ca31d 59
60AliT0Preprocessor::~AliT0Preprocessor()
61{
bc943889 62 delete fData;
63 fData = 0;
64}
65//____________________________________________________
dc7ca31d 66
bc943889 67void AliT0Preprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
68{
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);
dc7ca31d 72}
bc943889 73//____________________________________________________
dc7ca31d 74
75UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap )
76{
bc943889 77 // T0 preprocessor return codes:
78 // return=0 : all ok
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
86
87 Bool_t resultDCSMap=kFALSE;
88 Bool_t resultDCSStore=kFALSE;
89 Bool_t resultLaser=kFALSE;
90 Bool_t resultOnline=kFALSE;
8bfd9a3e 91
92 if(!dcsAliasMap)
93 {
94 Log("No DCS input data");
95 return 1;
96 }
97 else
98 {
02cf5377 99 /*
8bfd9a3e 100 resultDCSMap=fData->ProcessData(*dcsAliasMap);
101 if(!resultDCSMap)
102 {
103 Log("Error when processing DCS data");
bc943889 104 return 2;// return error Code for processed DCS data not stored
105 }
106 else
107 {
02cf5377 108 Float_t *meanScaler[24] = fData->GetScalerMean();
109
bc943889 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");
02cf5377 115 resultDCSStore = Store("Calib","DCSData",meanScaler, &metaDataDCS);
bc943889 116 if (!resultDCSStore)
8bfd9a3e 117 {
bc943889 118 Log("Some problems occurred while storing DCS data results in ReferenceDB");
119 return 2;// return error Code for processed DCS data not stored
120 }
dc7ca31d 121
8bfd9a3e 122 }
02cf5377 123 */
8bfd9a3e 124 }
125
126 // processing DAQ
bc943889 127
8bfd9a3e 128 TString runType = GetRunType();
bc943889 129
8bfd9a3e 130 if(runType == "T0_STANDALONE_LASER")
131 {
132 TList* list = GetFileSources(kDAQ, "LASER");
bc943889 133 if (list)
134 {
135 TIter iter(list);
136 TObjString *source;
8bfd9a3e 137 while ((source = dynamic_cast<TObjString *> (iter.Next())))
bc943889 138 {
139 const char *laserFile = GetFile(kDAQ, "LASER", source->GetName());
140 if (laserFile)
141 {
02cf5377 142 Log(Form("File with Id LASER found in source %s!", source->GetName()));
8bfd9a3e 143 AliT0CalibWalk *laser = new AliT0CalibWalk();
8bfd9a3e 144 laser->MakeWalkCorrGraph(laserFile);
145 AliCDBMetaData metaData;
bc943889 146 metaData.SetBeamPeriod(0);
147 metaData.SetResponsible("Tomek&Michal");
148 metaData.SetComment("Walk correction from laser runs.");
a8d3b391 149 //TObjArray* arrLaser = laser->GetfWalk();
150 resultLaser=Store("Calib","Slewing_Walk", laser, &metaData, 0, 1);
bc943889 151 delete laser;
8bfd9a3e 152 }
bc943889 153 else
154 {
8bfd9a3e 155 Log(Form("Could not find file with Id LASER in source %s!", source->GetName()));
bc943889 156 return 1;
157 }
158 }
159 if (!resultLaser)
8bfd9a3e 160 {
bc943889 161 Log("No Laser Data stored");
162 return 3;//return error code for failure in storing Laser Data
163 }
67b67126 164 } else {
165 Log("No sources found for id LASER!");
166 return 1;
167 }
8bfd9a3e 168 }
169 else if(runType == "PHYSICS")
170 {
02cf5377 171 TList* listPhys = GetFileSources(kDAQ, "PHYSICS");
8bfd9a3e 172 if (listPhys)
173 {
174 TIter iter(listPhys);
175 TObjString *sourcePhys;
176 while ((sourcePhys = dynamic_cast<TObjString *> (iter.Next())))
177 {
178 const char *filePhys = GetFile(kDAQ, "PHYSICS", sourcePhys->GetName());
179 if (filePhys)
180 {
181 AliT0CalibTimeEq *online = new AliT0CalibTimeEq();
182 online->Reset();
02cf5377 183 online->ComputeOnlineParams("CFD", 20, 4., filePhys);
8bfd9a3e 184 AliCDBMetaData metaData;
185 metaData.SetBeamPeriod(0);
186 metaData.SetResponsible("Tomek&Michal");
187 metaData.SetComment("Time equalizing result.");
02cf5377 188 resultOnline = Store("Calib","TimeDelay", online, &metaData, 0, 1);
8bfd9a3e 189 delete online;
190 }
191 else
192 {
193 Log(Form("Could not find file with Id PHYSICS in source %s!", sourcePhys->GetName()));
194 return 1;
195 }
196 }
197 if (!resultOnline)
bc943889 198 {
199 Log("No Laser Data stored");
200 return 4;//return error code for failure in storing OCDB Data
201 }
67b67126 202 } else {
203 Log("No sources found for id PHYSICS!");
204 return 1;
205 }
8bfd9a3e 206 }
dc7ca31d 207
bc943889 208 return 0;
dc7ca31d 209}
210