]>
Commit | Line | Data |
---|---|---|
b5279783 | 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 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // this program performs local monitoring on a GDC by running the HLT code // | |
21 | // // | |
22 | // If an argument is given, this is taken as the name of a date file which // | |
23 | // is used instead of the local node. // | |
24 | // The program can be stopped by pressing CTRL-C. // | |
25 | // // | |
26 | /////////////////////////////////////////////////////////////////////////////// | |
27 | ||
28 | #include <TError.h> | |
8ecba4b2 | 29 | #include <TSysEvtHandler.h> |
8c50acf2 | 30 | #ifdef ALI_DATE |
b5279783 | 31 | #include <TROOT.h> |
32 | #include <TSystem.h> | |
b5279783 | 33 | #include <TDatime.h> |
34 | #include "AliRawReaderDate.h" | |
35 | #include "event.h" | |
36 | #include "monitor.h" | |
cae21299 | 37 | /* |
4aa41877 | 38 | #include <AliHLTStandardIncludes.h> |
39 | #include <AliHLTTransform.h> | |
40 | #include <AliHLTMemHandler.h> | |
41 | #include <AliHLTTrackArray.h> | |
42 | #include <AliHLTHoughMaxFinder.h> | |
43 | #include <AliHLTHoughBaseTransformer.h> | |
44 | #include <AliHLTHough.h> | |
45 | #include <AliHLTBenchmark.h> | |
cae21299 | 46 | #include <AliHLTITSclusterer.h> |
47 | #include <AliHLTITSVertexerZ.h> | |
48 | #include <AliHLTITStracker.h> | |
49 | */ | |
50 | #include "AliESDEvent.h" | |
ede6ca10 | 51 | #include "AliESDVertex.h" |
cae21299 | 52 | #include "AliTracker.h" |
b77a0228 | 53 | #include <AliKalmanTrack.h> |
ad693bc1 | 54 | #include "AliITSgeomTGeo.h" |
f7ea67db | 55 | #include "AliITSgeom.h" |
b77a0228 | 56 | #include "AliMagF.h" |
57 | #include "AliMagFMaps.h" | |
b5279783 | 58 | #endif |
b5279783 | 59 | |
b5279783 | 60 | //_____________________________________________________________________________ |
61 | class AliGDCInterruptHandler : public TSignalHandler { | |
62 | public: | |
63 | AliGDCInterruptHandler(); | |
64 | Bool_t Notify() {fStop = kTRUE; return kTRUE;}; | |
65 | Bool_t Stop() const {return fStop;}; | |
66 | private: | |
67 | Bool_t fStop; // CTRL-C pressed | |
68 | }; | |
69 | ||
70 | //_____________________________________________________________________________ | |
71 | AliGDCInterruptHandler::AliGDCInterruptHandler() : | |
72 | TSignalHandler(kSigInterrupt, kFALSE) | |
73 | { | |
74 | fStop = kFALSE; | |
cae21299 | 75 | } |
b5279783 | 76 | |
77 | ||
78 | //_____________________________________________________________________________ | |
8c50acf2 | 79 | #ifdef ALI_DATE |
120b3c73 | 80 | int main(int argc, char** argv) |
81 | { | |
b5279783 | 82 | // set ROOT in batch mode |
83 | gROOT->SetBatch(); | |
84 | ||
85 | // open a log file | |
86 | FILE* file = fopen("monitorGDC.log", "w"); | |
a8ffd46b | 87 | |
b5279783 | 88 | TDatime time; |
89 | ||
90 | // get data from a file or online from this node | |
91 | Int_t status = 0; | |
92 | if (argc > 1) { | |
93 | status = monitorSetDataSource(argv[1]); | |
94 | } else { | |
95 | status = monitorSetDataSource(":"); | |
96 | } | |
97 | if (status) ::Fatal("monitorSetDataSource", monitorDecodeError(status)); | |
98 | ||
99 | // monitor only a sample of physics events | |
100 | char* table[] = {"Physics event", "yes", NULL}; | |
101 | status = monitorDeclareTable(table); | |
102 | if (status) ::Fatal("monitorDeclareTable", monitorDecodeError(status)); | |
103 | ||
104 | // declare this monitoring program to DATE | |
04b48a95 | 105 | status = monitorDeclareMp("GDC physics monitoring"); |
b5279783 | 106 | if (status) ::Fatal("monitorDeclareMp", monitorDecodeError(status)); |
107 | ||
b5279783 | 108 | // initialize HLT transformations |
cae21299 | 109 | // if (!AliHLTTransform::Init("./", kFALSE)) { |
110 | // ::Fatal("AliHLTTransform::Init", "HLT initialization failed"); | |
111 | // } | |
112 | ||
af885e0f | 113 | AliESDEvent *esd = new AliESDEvent; |
114 | esd->CreateStdContent(); | |
cae21299 | 115 | |
116 | // AliITSgeom *geom = new AliITSgeom(); | |
117 | // geom->ReadNewFile("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det"); | |
118 | // if (!geom) return 1; | |
119 | // Int_t sfield = 0; | |
120 | // switch ((Int_t)(AliHLTTransform::GetSolenoidField()+0.5)) { | |
121 | // case 2: | |
122 | // sfield = AliMagFMaps::k2kG; | |
123 | // break; | |
124 | // case 4: | |
125 | // sfield = AliMagFMaps::k4kG; | |
126 | // break; | |
127 | // case 5: | |
128 | // sfield = AliMagFMaps::k5kG; | |
129 | // break; | |
130 | // default: | |
131 | // ::Fatal("AliHLTTransform::GetSolenoidField", "Incorrect magnetic field"); | |
132 | // } | |
133 | AliMagF* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., AliMagFMaps::k5kG); | |
aa95f9f7 | 134 | AliTracker::SetFieldMap(field,kTRUE); |
135 | ||
136 | // Init PID | |
137 | AliPID pid; | |
b5279783 | 138 | |
139 | // create the signal handler | |
140 | AliGDCInterruptHandler* handler = new AliGDCInterruptHandler; | |
141 | gSystem->AddSignalHandler(handler); | |
142 | ||
143 | // endless loop | |
144 | void* ptr = NULL; | |
145 | while (!handler->Stop()) { | |
146 | // get the next event | |
147 | status = monitorGetEventDynamic(&ptr); | |
148 | if (status == (Int_t)MON_ERR_EOF) break; | |
149 | if (status) ::Fatal("monitorGetEventDynamic", monitorDecodeError(status)); | |
150 | ||
151 | // if no new event | |
152 | if (!ptr) { | |
153 | gSystem->Sleep(1000); // sleep for 1 second | |
154 | continue; | |
155 | } | |
156 | ||
04b48a95 | 157 | AliRawReaderDate rawReader(ptr); |
a8ffd46b | 158 | // if ((rawReader.GetAttributes()[0] & 0x02) != 0) { |
04b48a95 | 159 | |
a8ffd46b | 160 | // Int_t errorCode = rawReader.CheckData(); |
161 | Int_t errorCode = 0; | |
3256212a | 162 | if (errorCode && (errorCode != AliRawReader::kErrSize)) { |
163 | time.Set(); | |
164 | if (file) fprintf(file, "%s\n", time.AsString()); | |
165 | if (file) fprintf(file, "run: %d event: %d %d\n", | |
166 | rawReader.GetRunNumber(), | |
167 | rawReader.GetEventId()[0], | |
168 | rawReader.GetEventId()[1]); | |
169 | fprintf(file, "ERROR: %d\n\n", errorCode); | |
170 | ||
171 | } else { | |
172 | ||
cae21299 | 173 | // AliHLTBenchmark *fBenchmark = new AliHLTBenchmark(); |
174 | // fBenchmark->Start("Overall timing"); | |
a8ffd46b | 175 | |
cae21299 | 176 | // // ITS clusterer and vertexer |
177 | // fBenchmark->Start("ITS Clusterer"); | |
178 | // AliHLTITSclusterer clusterer(0); | |
179 | // AliRawReader *itsrawreader=new AliRawReaderDate(ptr); | |
180 | // TTree* treeClusters = new TTree("TreeL3ITSclusters"," "); //make a tree | |
181 | // clusterer.Digits2Clusters(itsrawreader,treeClusters); | |
182 | // fBenchmark->Stop("ITS Clusterer"); | |
b77a0228 | 183 | |
cae21299 | 184 | // AliHLTITSVertexerZ vertexer; |
185 | // AliESDVertex *vertex = vertexer.FindVertexForCurrentEvent(geom,treeClusters); | |
186 | // Double_t vtxPos[3]; | |
187 | // Double_t vtxErr[3]={0.005,0.005,0.010}; | |
188 | // vertex->GetXYZ(vtxPos); | |
189 | // // vertex->GetSigmaXYZ(vtxErr); | |
190 | // esd->SetVertex(vertex); | |
191 | ||
192 | // // TPC Hough reconstruction | |
193 | // Float_t ptmin = 0.1*AliHLTTransform::GetSolenoidField(); | |
194 | // Float_t zvertex = vtxPos[2]; | |
195 | ||
196 | // // Run the Hough Transformer | |
197 | // fBenchmark->Start("Init"); | |
198 | // AliHLTHough *hough1 = new AliHLTHough(); | |
199 | ||
200 | // hough1->SetThreshold(4); | |
201 | // hough1->CalcTransformerParams(ptmin); | |
202 | // hough1->SetPeakThreshold(70,-1); | |
203 | // // printf("Pointer is %x\n",ptr); | |
204 | // hough1->Init("./", kFALSE, 100, kFALSE,4,0,(Char_t*)ptr,zvertex); | |
205 | // hough1->SetAddHistograms(); | |
206 | // fBenchmark->Stop("Init"); | |
207 | ||
208 | // fBenchmark->Start("Init"); | |
209 | // AliHLTHough *hough2 = new AliHLTHough(); | |
210 | ||
211 | // hough2->SetThreshold(4); | |
212 | // hough2->CalcTransformerParams(ptmin); | |
213 | // hough2->SetPeakThreshold(70,-1); | |
214 | // // printf("Pointer is %x\n",ptr); | |
215 | // hough2->Init("./", kFALSE, 100, kFALSE,4,0,(Char_t*)ptr,zvertex); | |
216 | // hough2->SetAddHistograms(); | |
217 | // fBenchmark->Stop("Init"); | |
218 | ||
219 | // Int_t nglobaltracks = 0; | |
220 | // /* | |
221 | // hough1->StartProcessInThread(0,17); | |
222 | // hough2->StartProcessInThread(18,35); | |
223 | ||
224 | // // gSystem->Sleep(20000); | |
225 | // if(hough1->WaitForThreadFinish()) | |
226 | // ::Fatal("AliHLTHough::WaitForThreadFinish"," Can not join the required thread! "); | |
227 | // if(hough2->WaitForThreadFinish()) | |
228 | // ::Fatal("AliHLTHough::WaitForThreadFinish"," Can not join the required thread! "); | |
229 | ||
230 | // gSystem->MakeDirectory("hough1"); | |
231 | // hough1->WriteTracks("./hough1"); | |
232 | // gSystem->MakeDirectory("hough2"); | |
233 | // hough2->WriteTracks("./hough2"); | |
234 | // */ | |
235 | ||
236 | // for(int slice=0; slice<=17; slice++) | |
237 | // { | |
238 | // // cout<<"Processing slice "<<slice<<endl; | |
239 | // fBenchmark->Start("ReadData"); | |
240 | // hough1->ReadData(slice,0); | |
241 | // fBenchmark->Stop("ReadData"); | |
242 | // fBenchmark->Start("Transform"); | |
243 | // hough1->Transform(); | |
244 | // fBenchmark->Stop("Transform"); | |
245 | // hough1->AddAllHistogramsRows(); | |
246 | // hough1->FindTrackCandidatesRow(); | |
247 | // fBenchmark->Start("AddTracks"); | |
248 | // hough1->AddTracks(); | |
249 | // fBenchmark->Stop("AddTracks"); | |
250 | ||
251 | // // AliHLTTrackArray* tracks = (AliHLTTrackArray*)hough1->GetTracks(0); | |
252 | // // nglobaltracks += tracks->GetNTracks(); | |
253 | // } | |
254 | // for(int slice=18; slice<=35; slice++) | |
255 | // { | |
256 | // // cout<<"Processing slice "<<slice<<endl; | |
257 | // fBenchmark->Start("ReadData"); | |
258 | // hough2->ReadData(slice,0); | |
259 | // fBenchmark->Stop("ReadData"); | |
260 | // fBenchmark->Start("Transform"); | |
261 | // hough2->Transform(); | |
262 | // fBenchmark->Stop("Transform"); | |
263 | // hough2->AddAllHistogramsRows(); | |
264 | // hough2->FindTrackCandidatesRow(); | |
265 | // fBenchmark->Start("AddTracks"); | |
266 | // hough2->AddTracks(); | |
267 | // fBenchmark->Stop("AddTracks"); | |
268 | ||
269 | // // AliHLTTrackArray* tracks = (AliHLTTrackArray*)hough2->GetTracks(0); | |
270 | // // nglobaltracks += tracks->GetNTracks(); | |
271 | // } | |
272 | ||
273 | // nglobaltracks += hough1->FillESD(esd); | |
274 | // nglobaltracks += hough2->FillESD(esd); | |
275 | ||
276 | // // ITS tracker | |
277 | // AliHLTITStracker itsTracker(0); | |
278 | // itsTracker.SetVertex(vtxPos,vtxErr); | |
279 | ||
280 | // itsTracker.LoadClusters(treeClusters); | |
281 | // itsTracker.Clusters2Tracks(esd); | |
282 | // itsTracker.UnloadClusters(); | |
283 | ||
284 | // fBenchmark->Stop("Overall timing"); | |
285 | // time.Set(); | |
286 | // if (file) fprintf(file, "%s\n", time.AsString()); | |
287 | // if (file) fprintf(file, "run: %d event: %d %d\n", | |
288 | // rawReader.GetRunNumber(), | |
289 | // rawReader.GetEventId()[0], | |
290 | // rawReader.GetEventId()[1]); | |
291 | // if (errorCode) fprintf(file, "ERROR: %d\n", errorCode); | |
292 | ||
293 | // if (file) fprintf(file, "Hough Transformer found %d tracks\n",nglobaltracks); | |
294 | ||
295 | // hough1->DoBench("hough1"); | |
296 | // hough2->DoBench("hough2"); | |
297 | // fBenchmark->Analyze("overall"); | |
298 | // if (file) { | |
299 | // FILE* bench = fopen("hough1.dat", "r"); | |
300 | // while (bench && !feof(bench)) { | |
301 | // char buffer[256]; | |
302 | // if (!fgets(buffer, 256, bench)) break; | |
303 | // fprintf(file, "%s", buffer); | |
304 | // } | |
305 | // fclose(bench); | |
306 | // } | |
307 | // if (file) { | |
308 | // FILE* bench = fopen("hough2.dat", "r"); | |
309 | // while (bench && !feof(bench)) { | |
310 | // char buffer[256]; | |
311 | // if (!fgets(buffer, 256, bench)) break; | |
312 | // fprintf(file, "%s", buffer); | |
313 | // } | |
314 | // fclose(bench); | |
315 | // } | |
316 | // if (file) { | |
317 | // FILE* bench = fopen("overall.dat", "r"); | |
318 | // while (bench && !feof(bench)) { | |
319 | // char buffer[256]; | |
320 | // if (!fgets(buffer, 256, bench)) break; | |
321 | // fprintf(file, "%s", buffer); | |
322 | // } | |
323 | // fclose(bench); | |
324 | // fprintf(file, "\n\n"); | |
325 | // } | |
326 | ||
327 | // delete hough1; | |
328 | // delete hough2; | |
329 | ||
330 | // esd->Reset(); | |
3256212a | 331 | } |
a8ffd46b | 332 | // } |
333 | ||
334 | /* | |
335 | // read run, event, detector, DDL numbers and data size | |
336 | AliRawReaderDate rawReader(ptr); | |
337 | time.Set(); | |
338 | printf("\n%s\n", time.AsString()); | |
339 | printf("run: %d event: %d %d\n", rawReader.GetRunNumber(), | |
340 | rawReader.GetEventId()[0], rawReader.GetEventId()[1]); | |
341 | while (rawReader.ReadMiniHeader()) { | |
342 | printf(" detector: %d DDL: %d size: %d\n", | |
343 | rawReader.GetDetectorID(), rawReader.GetDDLID(), | |
344 | rawReader.GetDataSize()); | |
04b48a95 | 345 | } |
b5279783 | 346 | |
a8ffd46b | 347 | */ |
348 | ||
df0f3179 | 349 | gSystem->Sleep(100); // sleep for 0.1 second |
b5279783 | 350 | free(ptr); |
351 | ||
352 | gSystem->ProcessEvents(); | |
353 | if (file) fflush(file); | |
a8ffd46b | 354 | |
b5279783 | 355 | } |
356 | ||
357 | gSystem->RemoveSignalHandler(handler); | |
358 | if (file) fclose(file); | |
359 | ||
120b3c73 | 360 | return 0; |
361 | } | |
362 | ||
b5279783 | 363 | #else |
120b3c73 | 364 | int main(int /*argc*/, char** /*argv*/) |
365 | { | |
b5279783 | 366 | ::Fatal("main", "this program was compiled without DATE"); |
b5279783 | 367 | |
120b3c73 | 368 | return 1; |
b5279783 | 369 | } |
120b3c73 | 370 | #endif |