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