]>
Commit | Line | Data |
---|---|---|
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 $ |
18 | Revision 1.8 2007/12/07 15:22:51 alla | |
19 | bug fixed by Alberto | |
20 | ||
67b67126 | 21 | Revision 1.7 2007/12/06 16:35:24 alla |
22 | new bugs fixed by Tomek | |
23 | ||
02cf5377 | 24 | Revision 1.5 2007/11/23 19:28:52 alla |
25 | bug fixed | |
26 | ||
bc943889 | 27 | Version 2.1 2007/11/21 |
28 | Preprocessor storing data to OCDB (T.Malkiewicz) | |
29 | ||
30 | Version 1.1 2006/10 | |
31 | Preliminary 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 | 56 | ClassImp(AliT0Preprocessor) |
57 | ||
58 | //____________________________________________________ | |
387638f7 | 59 | AliT0Preprocessor::AliT0Preprocessor(AliShuttleInterface* shuttle) : |
60 | AliPreprocessor("T00", shuttle), | |
61 | fData(0) | |
dc7ca31d | 62 | { |
bc943889 | 63 | //constructor |
dc7ca31d | 64 | } |
bc943889 | 65 | //____________________________________________________ |
dc7ca31d | 66 | |
67 | AliT0Preprocessor::~AliT0Preprocessor() | |
68 | { | |
50e28e1c | 69 | //destructor |
bc943889 | 70 | delete fData; |
71 | fData = 0; | |
72 | } | |
73 | //____________________________________________________ | |
dc7ca31d | 74 | |
bc943889 | 75 | void 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 | |
49ab1618 | 84 | Bool_t AliT0Preprocessor::ProcessDCS(){ |
85 | // Check whether DCS should be processed or not... | |
86 | TString runType = GetRunType(); | |
87 | Log(Form("ProcessDCS - RunType: %s",runType.Data())); | |
88 | ||
89 | if((runType == "STANDALONE")||(runType == "PHYSICS")){ | |
90 | return kFALSE; | |
91 | }else{ | |
92 | return kFALSE; | |
93 | } | |
94 | } | |
95 | //____________________________________________________ | |
bc943889 | 96 | |
49ab1618 | 97 | UInt_t AliT0Preprocessor::ProcessDCSDataPoints(TMap* dcsAliasMap){ |
98 | // Fills data into AliT0DataDCS object | |
99 | Log("Processing DCS DP"); | |
bc943889 | 100 | Bool_t resultDCSMap=kFALSE; |
101 | Bool_t resultDCSStore=kFALSE; | |
49ab1618 | 102 | |
8bfd9a3e | 103 | if(!dcsAliasMap) |
104 | { | |
105 | Log("No DCS input data"); | |
49ab1618 | 106 | return 1; |
8bfd9a3e | 107 | } |
108 | else | |
109 | { | |
110 | resultDCSMap=fData->ProcessData(*dcsAliasMap); | |
111 | if(!resultDCSMap) | |
112 | { | |
113 | Log("Error when processing DCS data"); | |
bc943889 | 114 | return 2;// return error Code for processed DCS data not stored |
115 | } | |
116 | else | |
117 | { | |
118 | AliCDBMetaData metaDataDCS; | |
119 | metaDataDCS.SetBeamPeriod(0); | |
120 | metaDataDCS.SetResponsible("Tomasz Malkiewicz"); | |
121 | metaDataDCS.SetComment("This preprocessor fills an AliTODataDCS object."); | |
122 | AliInfo("Storing DCS Data"); | |
083f0bec | 123 | resultDCSStore = Store("Calib","DCSData",fData, &metaDataDCS); |
bc943889 | 124 | if (!resultDCSStore) |
8bfd9a3e | 125 | { |
bc943889 | 126 | Log("Some problems occurred while storing DCS data results in ReferenceDB"); |
387638f7 | 127 | return 2;// return error Code for processed DCS data not stored |
bc943889 | 128 | } |
8bfd9a3e | 129 | } |
130 | } | |
49ab1618 | 131 | return 0; |
132 | } | |
133 | //____________________________________________________ | |
8bfd9a3e | 134 | |
49ab1618 | 135 | UInt_t AliT0Preprocessor::ProcessLaser(){ |
136 | // Processing data from DAQ Standalone run | |
137 | Log("Processing Laser calibration"); | |
138 | ||
139 | Bool_t resultLaser=kFALSE; | |
140 | //processing DAQ | |
141 | TList* list = GetFileSources(kDAQ, "LASER"); | |
142 | if (list) | |
8bfd9a3e | 143 | { |
bc943889 | 144 | TIter iter(list); |
145 | TObjString *source; | |
8bfd9a3e | 146 | while ((source = dynamic_cast<TObjString *> (iter.Next()))) |
bc943889 | 147 | { |
148 | const char *laserFile = GetFile(kDAQ, "LASER", source->GetName()); | |
149 | if (laserFile) | |
150 | { | |
02cf5377 | 151 | Log(Form("File with Id LASER found in source %s!", source->GetName())); |
8bfd9a3e | 152 | AliT0CalibWalk *laser = new AliT0CalibWalk(); |
8bfd9a3e | 153 | laser->MakeWalkCorrGraph(laserFile); |
154 | AliCDBMetaData metaData; | |
bc943889 | 155 | metaData.SetBeamPeriod(0); |
156 | metaData.SetResponsible("Tomek&Michal"); | |
157 | metaData.SetComment("Walk correction from laser runs."); | |
a8d3b391 | 158 | resultLaser=Store("Calib","Slewing_Walk", laser, &metaData, 0, 1); |
bc943889 | 159 | delete laser; |
8bfd9a3e | 160 | } |
bc943889 | 161 | else |
162 | { | |
8bfd9a3e | 163 | Log(Form("Could not find file with Id LASER in source %s!", source->GetName())); |
bc943889 | 164 | return 1; |
165 | } | |
166 | } | |
167 | if (!resultLaser) | |
8bfd9a3e | 168 | { |
bc943889 | 169 | Log("No Laser Data stored"); |
170 | return 3;//return error code for failure in storing Laser Data | |
171 | } | |
67b67126 | 172 | } else { |
173 | Log("No sources found for id LASER!"); | |
174 | return 1; | |
175 | } | |
49ab1618 | 176 | return 0; |
177 | } | |
178 | //____________________________________________________ | |
179 | ||
180 | UInt_t AliT0Preprocessor::ProcessPhysics(){ | |
181 | //Processing data from DAQ Physics run | |
182 | Log("Processing Physics"); | |
183 | ||
184 | Bool_t resultOnline=kFALSE; | |
185 | //processing DAQ | |
186 | TList* listPhys = GetFileSources(kDAQ, "PHYSICS"); | |
187 | if (listPhys) | |
8bfd9a3e | 188 | { |
189 | TIter iter(listPhys); | |
190 | TObjString *sourcePhys; | |
191 | while ((sourcePhys = dynamic_cast<TObjString *> (iter.Next()))) | |
192 | { | |
193 | const char *filePhys = GetFile(kDAQ, "PHYSICS", sourcePhys->GetName()); | |
194 | if (filePhys) | |
195 | { | |
196 | AliT0CalibTimeEq *online = new AliT0CalibTimeEq(); | |
197 | online->Reset(); | |
387638f7 | 198 | online->ComputeOnlineParams(filePhys); |
8bfd9a3e | 199 | AliCDBMetaData metaData; |
200 | metaData.SetBeamPeriod(0); | |
201 | metaData.SetResponsible("Tomek&Michal"); | |
202 | metaData.SetComment("Time equalizing result."); | |
02cf5377 | 203 | resultOnline = Store("Calib","TimeDelay", online, &metaData, 0, 1); |
8bfd9a3e | 204 | delete online; |
205 | } | |
206 | else | |
207 | { | |
208 | Log(Form("Could not find file with Id PHYSICS in source %s!", sourcePhys->GetName())); | |
209 | return 1; | |
210 | } | |
211 | } | |
212 | if (!resultOnline) | |
bc943889 | 213 | { |
214 | Log("No Laser Data stored"); | |
215 | return 4;//return error code for failure in storing OCDB Data | |
216 | } | |
67b67126 | 217 | } else { |
218 | Log("No sources found for id PHYSICS!"); | |
219 | return 1; | |
220 | } | |
49ab1618 | 221 | return 0; |
222 | } | |
223 | //____________________________________________________ | |
224 | ||
225 | UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap ) | |
226 | { | |
227 | // T0 preprocessor return codes: | |
228 | // return=0 : all ok | |
229 | // return=1 : no DCS input data | |
230 | // return=2 : failed to store DCS data | |
231 | // return=3 : no Laser data (Walk correction) | |
232 | // return=4 : failed to store OCDB time equalized data | |
233 | // return=5 : no DAQ input for OCDB | |
234 | // return=6 : failed to retrieve DAQ data from OCDB | |
235 | // return=7 : failed to store T0 OCDB data | |
236 | Bool_t dcsDP = ProcessDCS(); | |
237 | Log(Form("dcsDP = %d",dcsDP)); | |
238 | TString runType = GetRunType(); | |
239 | Log(Form("RunType: %s",runType.Data())); | |
240 | //processing | |
241 | if(runType == "STANDALONE"){ | |
242 | Int_t iresultLaser = ProcessLaser(); | |
243 | if(dcsDP==1){ | |
244 | Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap); | |
245 | return iresultDCS; | |
246 | } | |
247 | return iresultLaser; | |
248 | } | |
249 | else if(runType == "PHYSICS"){ | |
250 | Int_t iresultPhysics = ProcessPhysics(); | |
251 | if(dcsDP==1){ | |
252 | Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap); | |
253 | return iresultDCS; | |
254 | } | |
255 | return iresultPhysics; | |
256 | } | |
dc7ca31d | 257 | |
bc943889 | 258 | return 0; |
dc7ca31d | 259 | } |