]>
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 | |
271b5bd3 | 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 |
2a8e3409 | 64 | AddRunType("PHYSICS"); |
65 | AddRunType("STANDALONE"); | |
dc7ca31d | 66 | } |
bc943889 | 67 | //____________________________________________________ |
dc7ca31d | 68 | |
69 | AliT0Preprocessor::~AliT0Preprocessor() | |
70 | { | |
50e28e1c | 71 | //destructor |
bc943889 | 72 | delete fData; |
73 | fData = 0; | |
74 | } | |
75 | //____________________________________________________ | |
dc7ca31d | 76 | |
bc943889 | 77 | void AliT0Preprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) |
78 | { | |
50e28e1c | 79 | // Creates AliT0DataDCS object |
bc943889 | 80 | AliPreprocessor::Initialize(run, startTime, endTime); |
81 | AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString())); | |
82 | fData = new AliT0DataDCS(fRun, fStartTime, fEndTime); | |
dc7ca31d | 83 | } |
bc943889 | 84 | //____________________________________________________ |
dc7ca31d | 85 | |
49ab1618 | 86 | Bool_t AliT0Preprocessor::ProcessDCS(){ |
87 | // Check whether DCS should be processed or not... | |
88 | TString runType = GetRunType(); | |
89 | Log(Form("ProcessDCS - RunType: %s",runType.Data())); | |
90 | ||
91 | if((runType == "STANDALONE")||(runType == "PHYSICS")){ | |
6634bcbc | 92 | // return kFALSE; |
93 | return kTRUE; | |
49ab1618 | 94 | }else{ |
95 | return kFALSE; | |
96 | } | |
97 | } | |
98 | //____________________________________________________ | |
bc943889 | 99 | |
49ab1618 | 100 | UInt_t AliT0Preprocessor::ProcessDCSDataPoints(TMap* dcsAliasMap){ |
101 | // Fills data into AliT0DataDCS object | |
102 | Log("Processing DCS DP"); | |
bc943889 | 103 | Bool_t resultDCSMap=kFALSE; |
104 | Bool_t resultDCSStore=kFALSE; | |
49ab1618 | 105 | |
8bfd9a3e | 106 | if(!dcsAliasMap) |
107 | { | |
108 | Log("No DCS input data"); | |
49ab1618 | 109 | return 1; |
8bfd9a3e | 110 | } |
111 | else | |
112 | { | |
113 | resultDCSMap=fData->ProcessData(*dcsAliasMap); | |
114 | if(!resultDCSMap) | |
115 | { | |
116 | Log("Error when processing DCS data"); | |
bc943889 | 117 | return 2;// return error Code for processed DCS data not stored |
118 | } | |
119 | else | |
120 | { | |
121 | AliCDBMetaData metaDataDCS; | |
122 | metaDataDCS.SetBeamPeriod(0); | |
123 | metaDataDCS.SetResponsible("Tomasz Malkiewicz"); | |
124 | metaDataDCS.SetComment("This preprocessor fills an AliTODataDCS object."); | |
125 | AliInfo("Storing DCS Data"); | |
083f0bec | 126 | resultDCSStore = Store("Calib","DCSData",fData, &metaDataDCS); |
bc943889 | 127 | if (!resultDCSStore) |
8bfd9a3e | 128 | { |
bc943889 | 129 | Log("Some problems occurred while storing DCS data results in ReferenceDB"); |
387638f7 | 130 | return 2;// return error Code for processed DCS data not stored |
bc943889 | 131 | } |
8bfd9a3e | 132 | } |
133 | } | |
49ab1618 | 134 | return 0; |
135 | } | |
136 | //____________________________________________________ | |
8bfd9a3e | 137 | |
49ab1618 | 138 | UInt_t AliT0Preprocessor::ProcessLaser(){ |
139 | // Processing data from DAQ Standalone run | |
271b5bd3 | 140 | Log("Processing Laser calibration - Walk Correction"); |
49ab1618 | 141 | |
142 | Bool_t resultLaser=kFALSE; | |
143 | //processing DAQ | |
144 | TList* list = GetFileSources(kDAQ, "LASER"); | |
145 | if (list) | |
8bfd9a3e | 146 | { |
bc943889 | 147 | TIter iter(list); |
148 | TObjString *source; | |
8bfd9a3e | 149 | while ((source = dynamic_cast<TObjString *> (iter.Next()))) |
bc943889 | 150 | { |
151 | const char *laserFile = GetFile(kDAQ, "LASER", source->GetName()); | |
152 | if (laserFile) | |
153 | { | |
02cf5377 | 154 | Log(Form("File with Id LASER found in source %s!", source->GetName())); |
8bfd9a3e | 155 | AliT0CalibWalk *laser = new AliT0CalibWalk(); |
8bfd9a3e | 156 | laser->MakeWalkCorrGraph(laserFile); |
157 | AliCDBMetaData metaData; | |
bc943889 | 158 | metaData.SetBeamPeriod(0); |
159 | metaData.SetResponsible("Tomek&Michal"); | |
160 | metaData.SetComment("Walk correction from laser runs."); | |
a8d3b391 | 161 | resultLaser=Store("Calib","Slewing_Walk", laser, &metaData, 0, 1); |
bc943889 | 162 | delete laser; |
271b5bd3 | 163 | Log(Form("resultLaser = %d",resultLaser)); |
8bfd9a3e | 164 | } |
bc943889 | 165 | else |
166 | { | |
8bfd9a3e | 167 | Log(Form("Could not find file with Id LASER in source %s!", source->GetName())); |
bc943889 | 168 | return 1; |
169 | } | |
170 | } | |
171 | if (!resultLaser) | |
8bfd9a3e | 172 | { |
bc943889 | 173 | Log("No Laser Data stored"); |
174 | return 3;//return error code for failure in storing Laser Data | |
175 | } | |
67b67126 | 176 | } else { |
177 | Log("No sources found for id LASER!"); | |
178 | return 1; | |
179 | } | |
49ab1618 | 180 | return 0; |
181 | } | |
182 | //____________________________________________________ | |
183 | ||
184 | UInt_t AliT0Preprocessor::ProcessPhysics(){ | |
185 | //Processing data from DAQ Physics run | |
186 | Log("Processing Physics"); | |
187 | ||
271b5bd3 | 188 | Bool_t resultOnline=kFALSE; |
49ab1618 | 189 | //processing DAQ |
190 | TList* listPhys = GetFileSources(kDAQ, "PHYSICS"); | |
191 | if (listPhys) | |
8bfd9a3e | 192 | { |
193 | TIter iter(listPhys); | |
194 | TObjString *sourcePhys; | |
195 | while ((sourcePhys = dynamic_cast<TObjString *> (iter.Next()))) | |
196 | { | |
197 | const char *filePhys = GetFile(kDAQ, "PHYSICS", sourcePhys->GetName()); | |
198 | if (filePhys) | |
199 | { | |
200 | AliT0CalibTimeEq *online = new AliT0CalibTimeEq(); | |
201 | online->Reset(); | |
387638f7 | 202 | online->ComputeOnlineParams(filePhys); |
8bfd9a3e | 203 | AliCDBMetaData metaData; |
204 | metaData.SetBeamPeriod(0); | |
205 | metaData.SetResponsible("Tomek&Michal"); | |
206 | metaData.SetComment("Time equalizing result."); | |
02cf5377 | 207 | resultOnline = Store("Calib","TimeDelay", online, &metaData, 0, 1); |
271b5bd3 | 208 | Log(Form("resultOnline = %d",resultOnline)); |
8bfd9a3e | 209 | delete online; |
210 | } | |
271b5bd3 | 211 | else |
8bfd9a3e | 212 | { |
213 | Log(Form("Could not find file with Id PHYSICS in source %s!", sourcePhys->GetName())); | |
214 | return 1; | |
215 | } | |
271b5bd3 | 216 | |
8bfd9a3e | 217 | } |
218 | if (!resultOnline) | |
bc943889 | 219 | { |
271b5bd3 | 220 | Log("No Data stored"); |
bc943889 | 221 | return 4;//return error code for failure in storing OCDB Data |
222 | } | |
67b67126 | 223 | } else { |
224 | Log("No sources found for id PHYSICS!"); | |
225 | return 1; | |
226 | } | |
49ab1618 | 227 | return 0; |
228 | } | |
229 | //____________________________________________________ | |
230 | ||
271b5bd3 | 231 | UInt_t AliT0Preprocessor::ProcessCosmic(){ |
232 | //Processing data from DAQ Physics run | |
233 | Log("Processing Laser Physics"); | |
234 | ||
235 | Bool_t resultLaserOnline=kFALSE; | |
236 | //processing DAQ | |
237 | TList* listLaser = GetFileSources(kDAQ, "COSMIC"); | |
238 | if (listLaser) | |
239 | { | |
240 | TIter iter(listLaser); | |
241 | TObjString *sourceLaser; | |
242 | while ((sourceLaser = dynamic_cast<TObjString *> (iter.Next()))) | |
243 | { | |
244 | const char *fileLaser = GetFile(kDAQ, "COSMIC", sourceLaser->GetName()); | |
245 | if (fileLaser) | |
246 | { | |
247 | AliT0CalibTimeEq *onlineLaser = new AliT0CalibTimeEq(); | |
248 | onlineLaser->Reset(); | |
249 | onlineLaser->ComputeOnlineParams(fileLaser); | |
250 | AliCDBMetaData metaData; | |
251 | metaData.SetBeamPeriod(0); | |
252 | metaData.SetResponsible("Tomek&Michal"); | |
253 | metaData.SetComment("Time equalizing result."); | |
254 | resultLaserOnline = Store("Calib","LaserTimeDelay", onlineLaser, &metaData, 0, 1); | |
255 | Log(Form("resultLaserOnline = %d",resultLaserOnline)); | |
256 | delete onlineLaser; | |
257 | } | |
258 | else | |
259 | { | |
260 | Log(Form("Could not find file with Id COSMIC in source %s!", sourceLaser->GetName())); | |
261 | return 0; | |
262 | } | |
263 | ||
264 | } | |
265 | if (!resultLaserOnline) | |
266 | { | |
267 | Log("No Laser Data stored"); | |
268 | return 0;//return error code for failure in storing OCDB Data | |
269 | } | |
270 | } else { | |
271 | Log("No sources found for id COSMIC!"); | |
272 | return 0; | |
273 | } | |
274 | return 0; | |
275 | } | |
276 | //____________________________________________________ | |
277 | ||
49ab1618 | 278 | UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap ) |
279 | { | |
280 | // T0 preprocessor return codes: | |
281 | // return=0 : all ok | |
282 | // return=1 : no DCS input data | |
283 | // return=2 : failed to store DCS data | |
284 | // return=3 : no Laser data (Walk correction) | |
285 | // return=4 : failed to store OCDB time equalized data | |
286 | // return=5 : no DAQ input for OCDB | |
287 | // return=6 : failed to retrieve DAQ data from OCDB | |
288 | // return=7 : failed to store T0 OCDB data | |
289 | Bool_t dcsDP = ProcessDCS(); | |
290 | Log(Form("dcsDP = %d",dcsDP)); | |
291 | TString runType = GetRunType(); | |
292 | Log(Form("RunType: %s",runType.Data())); | |
293 | //processing | |
294 | if(runType == "STANDALONE"){ | |
295 | Int_t iresultLaser = ProcessLaser(); | |
296 | if(dcsDP==1){ | |
297 | Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap); | |
298 | return iresultDCS; | |
299 | } | |
271b5bd3 | 300 | Log(Form("iresultLaser = %d",iresultLaser)); |
49ab1618 | 301 | return iresultLaser; |
302 | } | |
303 | else if(runType == "PHYSICS"){ | |
304 | Int_t iresultPhysics = ProcessPhysics(); | |
271b5bd3 | 305 | Int_t iresultCosmic = ProcessCosmic(); |
49ab1618 | 306 | if(dcsDP==1){ |
307 | Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap); | |
308 | return iresultDCS; | |
309 | } | |
271b5bd3 | 310 | Log(Form("iresultPhysics = %d",iresultPhysics)); |
49ab1618 | 311 | return iresultPhysics; |
312 | } | |
dc7ca31d | 313 | |
bc943889 | 314 | return 0; |
dc7ca31d | 315 | } |