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: AliT0Preprocessor.cxx,v $
18 Revision 1.8 2007/12/07 15:22:51 alla
21 Revision 1.7 2007/12/06 16:35:24 alla
22 new bugs fixed by Tomek
24 Revision 1.5 2007/11/23 19:28:52 alla
27 Version 2.1 2007/11/21
28 Preprocessor storing data to OCDB (T.Malkiewicz)
31 Preliminary test version (T.Malkiewicz)
34 #include "AliT0Preprocessor.h"
35 #include "AliT0DataDCS.h"
36 #include "AliT0CalibWalk.h"
37 #include "AliT0CalibTimeEq.h"
39 #include "AliCDBMetaData.h"
40 #include "AliDCSValue.h"
43 #include <TTimeStamp.h>
45 #include <TObjString.h>
47 #include "AliT0Dqclass.h"
50 // 1) takes data from DCS and passes it to the class AliTOFDataDCS
51 // for processing and writes the result to the Reference DB.
52 // 2) takes data form DAQ (both from Laser Calibration and Physics runs),
53 // processes it, and stores either to OCDB or to Reference DB.
56 ClassImp(AliT0Preprocessor)
58 //____________________________________________________
59 AliT0Preprocessor::AliT0Preprocessor(AliShuttleInterface* shuttle) : AliPreprocessor("T00", shuttle), fData(0)
63 //____________________________________________________
65 AliT0Preprocessor::~AliT0Preprocessor()
71 //____________________________________________________
73 void AliT0Preprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
75 // Creates AliT0DataDCS object
76 AliPreprocessor::Initialize(run, startTime, endTime);
77 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString()));
78 fData = new AliT0DataDCS(fRun, fStartTime, fEndTime);
80 //____________________________________________________
82 UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap )
84 // T0 preprocessor return codes:
86 // return=1 : no DCS input data
87 // return=2 : failed to store DCS data
88 // return=3 : no Laser data (Walk correction)
89 // return=4 : failed to store OCDB time equalized data
90 // return=5 : no DAQ input for OCDB
91 // return=6 : failed to retrieve DAQ data from OCDB
92 // return=7 : failed to store T0 OCDB data
94 Bool_t resultDCSMap=kFALSE;
95 Bool_t resultDCSStore=kFALSE;
96 Bool_t resultLaser=kFALSE;
97 Bool_t resultOnline=kFALSE;
101 Log("No DCS input data");
107 resultDCSMap=fData->ProcessData(*dcsAliasMap);
110 Log("Error when processing DCS data");
111 return 2;// return error Code for processed DCS data not stored
115 AliCDBMetaData metaDataDCS;
116 metaDataDCS.SetBeamPeriod(0);
117 metaDataDCS.SetResponsible("Tomasz Malkiewicz");
118 metaDataDCS.SetComment("This preprocessor fills an AliTODataDCS object.");
119 AliInfo("Storing DCS Data");
120 resultDCSStore = StoreReferenceData("Calib","DCSData", fData, &metaDataDCS);
123 Log("Some problems occurred while storing DCS data results in ReferenceDB");
124 //return 2;// return error Code for processed DCS data not stored
132 TString runType = GetRunType();
134 if(runType == "T0_STANDALONE_LASER")
136 TList* list = GetFileSources(kDAQ, "LASER");
141 while ((source = dynamic_cast<TObjString *> (iter.Next())))
143 const char *laserFile = GetFile(kDAQ, "LASER", source->GetName());
146 Log(Form("File with Id LASER found in source %s!", source->GetName()));
147 AliT0CalibWalk *laser = new AliT0CalibWalk();
148 laser->MakeWalkCorrGraph(laserFile);
149 AliCDBMetaData metaData;
150 metaData.SetBeamPeriod(0);
151 metaData.SetResponsible("Tomek&Michal");
152 metaData.SetComment("Walk correction from laser runs.");
153 //TObjArray* arrLaser = laser->GetfWalk();
154 resultLaser=Store("Calib","Slewing_Walk", laser, &metaData, 0, 1);
159 Log(Form("Could not find file with Id LASER in source %s!", source->GetName()));
165 Log("No Laser Data stored");
166 return 3;//return error code for failure in storing Laser Data
169 Log("No sources found for id LASER!");
173 else if(runType == "PHYSICS")
175 TList* listPhys = GetFileSources(kDAQ, "PHYSICS");
178 TIter iter(listPhys);
179 TObjString *sourcePhys;
180 while ((sourcePhys = dynamic_cast<TObjString *> (iter.Next())))
182 const char *filePhys = GetFile(kDAQ, "PHYSICS", sourcePhys->GetName());
185 AliT0CalibTimeEq *online = new AliT0CalibTimeEq();
187 online->ComputeOnlineParams("CFD", 20, 4., filePhys);
188 AliCDBMetaData metaData;
189 metaData.SetBeamPeriod(0);
190 metaData.SetResponsible("Tomek&Michal");
191 metaData.SetComment("Time equalizing result.");
192 resultOnline = Store("Calib","TimeDelay", online, &metaData, 0, 1);
197 Log(Form("Could not find file with Id PHYSICS in source %s!", sourcePhys->GetName()));
203 Log("No Laser Data stored");
204 return 4;//return error code for failure in storing OCDB Data
207 Log("No sources found for id PHYSICS!");