]>
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 | */ | |
bc943889 | 33 | |
dc7ca31d | 34 | #include "AliT0Preprocessor.h" |
bc943889 | 35 | #include "AliT0DataDCS.h" |
36 | #include "AliT0CalibWalk.h" | |
37 | #include "AliT0CalibTimeEq.h" | |
dc7ca31d | 38 | |
39 | #include "AliCDBMetaData.h" | |
40 | #include "AliDCSValue.h" | |
41 | #include "AliLog.h" | |
dc7ca31d | 42 | |
43 | #include <TTimeStamp.h> | |
44 | #include <TFile.h> | |
5221c818 | 45 | #include <TObjString.h> |
dc7ca31d | 46 | #include <TNamed.h> |
47 | #include "AliT0Dqclass.h" | |
48 | ||
9dcc11e4 | 49 | // T0 preprocessor: |
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. | |
54 | ||
bc943889 | 55 | |
dc7ca31d | 56 | ClassImp(AliT0Preprocessor) |
57 | ||
58 | //____________________________________________________ | |
9dcc11e4 | 59 | AliT0Preprocessor::AliT0Preprocessor(AliShuttleInterface* shuttle) : AliPreprocessor("T00", shuttle), fData(0) |
dc7ca31d | 60 | { |
bc943889 | 61 | //constructor |
dc7ca31d | 62 | } |
bc943889 | 63 | //____________________________________________________ |
dc7ca31d | 64 | |
65 | AliT0Preprocessor::~AliT0Preprocessor() | |
66 | { | |
50e28e1c | 67 | //destructor |
bc943889 | 68 | delete fData; |
69 | fData = 0; | |
70 | } | |
71 | //____________________________________________________ | |
dc7ca31d | 72 | |
bc943889 | 73 | void AliT0Preprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) |
74 | { | |
50e28e1c | 75 | // Creates AliT0DataDCS object |
bc943889 | 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); | |
dc7ca31d | 79 | } |
bc943889 | 80 | //____________________________________________________ |
dc7ca31d | 81 | |
82 | UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap ) | |
83 | { | |
bc943889 | 84 | // T0 preprocessor return codes: |
85 | // return=0 : all ok | |
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 | |
93 | ||
94 | Bool_t resultDCSMap=kFALSE; | |
95 | Bool_t resultDCSStore=kFALSE; | |
96 | Bool_t resultLaser=kFALSE; | |
97 | Bool_t resultOnline=kFALSE; | |
8bfd9a3e | 98 | |
99 | if(!dcsAliasMap) | |
100 | { | |
101 | Log("No DCS input data"); | |
102 | return 1; | |
103 | } | |
104 | else | |
105 | { | |
9dcc11e4 | 106 | |
8bfd9a3e | 107 | resultDCSMap=fData->ProcessData(*dcsAliasMap); |
108 | if(!resultDCSMap) | |
109 | { | |
110 | Log("Error when processing DCS data"); | |
bc943889 | 111 | return 2;// return error Code for processed DCS data not stored |
112 | } | |
113 | else | |
114 | { | |
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"); | |
9dcc11e4 | 120 | resultDCSStore = StoreReferenceData("Calib","DCSData", fData, &metaDataDCS); |
bc943889 | 121 | if (!resultDCSStore) |
8bfd9a3e | 122 | { |
bc943889 | 123 | Log("Some problems occurred while storing DCS data results in ReferenceDB"); |
9dcc11e4 | 124 | //return 2;// return error Code for processed DCS data not stored |
bc943889 | 125 | } |
dc7ca31d | 126 | |
8bfd9a3e | 127 | } |
128 | } | |
129 | ||
130 | // processing DAQ | |
bc943889 | 131 | |
8bfd9a3e | 132 | TString runType = GetRunType(); |
bc943889 | 133 | |
8bfd9a3e | 134 | if(runType == "T0_STANDALONE_LASER") |
135 | { | |
136 | TList* list = GetFileSources(kDAQ, "LASER"); | |
bc943889 | 137 | if (list) |
138 | { | |
139 | TIter iter(list); | |
140 | TObjString *source; | |
8bfd9a3e | 141 | while ((source = dynamic_cast<TObjString *> (iter.Next()))) |
bc943889 | 142 | { |
143 | const char *laserFile = GetFile(kDAQ, "LASER", source->GetName()); | |
144 | if (laserFile) | |
145 | { | |
02cf5377 | 146 | Log(Form("File with Id LASER found in source %s!", source->GetName())); |
8bfd9a3e | 147 | AliT0CalibWalk *laser = new AliT0CalibWalk(); |
8bfd9a3e | 148 | laser->MakeWalkCorrGraph(laserFile); |
149 | AliCDBMetaData metaData; | |
bc943889 | 150 | metaData.SetBeamPeriod(0); |
151 | metaData.SetResponsible("Tomek&Michal"); | |
152 | metaData.SetComment("Walk correction from laser runs."); | |
a8d3b391 | 153 | //TObjArray* arrLaser = laser->GetfWalk(); |
154 | resultLaser=Store("Calib","Slewing_Walk", laser, &metaData, 0, 1); | |
bc943889 | 155 | delete laser; |
8bfd9a3e | 156 | } |
bc943889 | 157 | else |
158 | { | |
8bfd9a3e | 159 | Log(Form("Could not find file with Id LASER in source %s!", source->GetName())); |
bc943889 | 160 | return 1; |
161 | } | |
162 | } | |
163 | if (!resultLaser) | |
8bfd9a3e | 164 | { |
bc943889 | 165 | Log("No Laser Data stored"); |
166 | return 3;//return error code for failure in storing Laser Data | |
167 | } | |
67b67126 | 168 | } else { |
169 | Log("No sources found for id LASER!"); | |
170 | return 1; | |
171 | } | |
8bfd9a3e | 172 | } |
173 | else if(runType == "PHYSICS") | |
174 | { | |
02cf5377 | 175 | TList* listPhys = GetFileSources(kDAQ, "PHYSICS"); |
8bfd9a3e | 176 | if (listPhys) |
177 | { | |
178 | TIter iter(listPhys); | |
179 | TObjString *sourcePhys; | |
180 | while ((sourcePhys = dynamic_cast<TObjString *> (iter.Next()))) | |
181 | { | |
182 | const char *filePhys = GetFile(kDAQ, "PHYSICS", sourcePhys->GetName()); | |
183 | if (filePhys) | |
184 | { | |
185 | AliT0CalibTimeEq *online = new AliT0CalibTimeEq(); | |
186 | online->Reset(); | |
02cf5377 | 187 | online->ComputeOnlineParams("CFD", 20, 4., filePhys); |
8bfd9a3e | 188 | AliCDBMetaData metaData; |
189 | metaData.SetBeamPeriod(0); | |
190 | metaData.SetResponsible("Tomek&Michal"); | |
191 | metaData.SetComment("Time equalizing result."); | |
02cf5377 | 192 | resultOnline = Store("Calib","TimeDelay", online, &metaData, 0, 1); |
8bfd9a3e | 193 | delete online; |
194 | } | |
195 | else | |
196 | { | |
197 | Log(Form("Could not find file with Id PHYSICS in source %s!", sourcePhys->GetName())); | |
198 | return 1; | |
199 | } | |
200 | } | |
201 | if (!resultOnline) | |
bc943889 | 202 | { |
203 | Log("No Laser Data stored"); | |
204 | return 4;//return error code for failure in storing OCDB Data | |
205 | } | |
67b67126 | 206 | } else { |
207 | Log("No sources found for id PHYSICS!"); | |
208 | return 1; | |
209 | } | |
8bfd9a3e | 210 | } |
dc7ca31d | 211 | |
bc943889 | 212 | return 0; |
dc7ca31d | 213 | } |