]>
Commit | Line | Data |
---|---|---|
12ec5482 | 1 | // $Id: AliHLTPreprocessor.cxx 23039 2007-12-13 20:53:02Z richterm $ |
2 | ||
3 | //************************************************************************** | |
23bd5d2a | 4 | //* This file is property of and copyright by the * |
12ec5482 | 5 | //* ALICE Experiment at CERN, All rights reserved. * |
6 | //* * | |
7 | //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * | |
8 | //* for The ALICE HLT Project. * | |
9 | //* * | |
10 | //* Permission to use, copy, modify and distribute this software and its * | |
11 | //* documentation strictly for non-commercial purposes is hereby granted * | |
12 | //* without fee, provided that the above copyright notice appears in all * | |
13 | //* copies and that both the copyright notice and this permission notice * | |
14 | //* appear in the supporting documentation. The authors make no claims * | |
15 | //* about the suitability of this software for any purpose. It is * | |
16 | //* provided "as is" without express or implied warranty. * | |
17 | //************************************************************************** | |
18 | ||
8a6d545f | 19 | |
20 | // @file AliHLTPreprocessor.cxx | |
21 | // @author Matthias Richter | |
22 | // @brief Container for HLT module preprocessors, acts to the outside as | |
23 | // HLT preprocessor used by the Offline Shuttle | |
24 | // | |
12ec5482 | 25 | |
26 | #include "AliHLTPreprocessor.h" | |
27 | #include "AliHLTModulePreprocessor.h" | |
28 | #include "AliHLTSystem.h" | |
29 | #include "AliHLTModuleAgent.h" | |
30 | #include "TSystem.h" | |
31 | ||
32 | ClassImp(AliHLTPreprocessor) | |
33 | ||
34 | AliHLTPreprocessor::AliHLTPreprocessor(AliShuttleInterface* shuttle) | |
35 | : | |
36 | AliPreprocessor(fgkHLTPreproc, shuttle), | |
d83b59c6 | 37 | fProcessors(), |
38 | fActiveDetectors(0) | |
12ec5482 | 39 | { |
23bd5d2a | 40 | // Implementation of the HLT version for the Shuttle Preprocessor. |
41 | // Since HLT requires a more modular concept of the pre-processors, this | |
42 | // class acts as HLT pre-processor to the outside and container class for | |
43 | // the specific HLT module pre-processors to the inside. | |
12ec5482 | 44 | |
d83b59c6 | 45 | // run types according to |
46 | // http://alice-ecs.web.cern.ch/alice-ecs/runtypes_3.16.html | |
47 | ||
48 | // PHOS (retrieve Huffman tables) | |
49 | AddRunType("STANDALONE"); | |
50 | ||
51 | // TPC (retrieve Huffman tables and temperature data) | |
52 | AddRunType("PHYSICS"); | |
53 | AddRunType("COSMIC"); | |
54 | AddRunType("LASER"); | |
55 | AddRunType("PEDESTAL"); | |
56 | AddRunType("PULSER"); | |
57 | ||
58 | // TRD | |
59 | AddRunType("PEDESTAL"); | |
60 | AddRunType("STANDALONE"); | |
61 | ||
12ec5482 | 62 | fProcessors.SetOwner(); |
d83b59c6 | 63 | |
12ec5482 | 64 | } |
65 | ||
66 | const char* AliHLTPreprocessor::fgkHLTPreproc = "HLT"; | |
67 | ||
68 | /** HLT default component libraries */ | |
69 | const char* AliHLTPreprocessor::fgkHLTDefaultShuttleLibs[]= { | |
70 | "libAliHLTUtil.so", | |
d83b59c6 | 71 | "libAliHLTRCU.so", |
12ec5482 | 72 | "libAliHLTTPC.so", |
73 | "libAliHLTComp.so", | |
12ec5482 | 74 | //"libAliHLTPHOS.so", |
75 | //"libAliHLTMUON.so", | |
76 | "libAliHLTTRD.so", | |
8a6d545f | 77 | "libAliHLTGlobal.so", |
78 | "libAliHLTTrigger.so", | |
12ec5482 | 79 | NULL |
80 | }; | |
81 | ||
82 | AliHLTPreprocessor::~AliHLTPreprocessor() | |
83 | { | |
23bd5d2a | 84 | // destructor |
12ec5482 | 85 | } |
86 | ||
87 | void AliHLTPreprocessor::Initialize(Int_t run, UInt_t startTime, | |
88 | UInt_t endTime) | |
89 | { | |
23bd5d2a | 90 | // init the preprocessor |
12ec5482 | 91 | fRun = run; |
92 | fStartTime = startTime; | |
93 | fEndTime = endTime; | |
94 | ||
8a6d545f | 95 | // TODO: read a configuration object from OCDB |
96 | // configure | |
97 | // - component libraries | |
98 | ||
d83b59c6 | 99 | // retrieve list of active detectors from previous run. |
100 | fActiveDetectors = atoi(AliPreprocessor::GetRunParameter("detectorMask")); | |
12ec5482 | 101 | |
d83b59c6 | 102 | // TString msg("Preprocessor for HLT initialized for run: "); |
103 | // msg += run; | |
104 | // Log(msg.Data()); | |
105 | ||
12ec5482 | 106 | // load component libraries |
107 | TString libs; | |
108 | const char** deflib=fgkHLTDefaultShuttleLibs; | |
109 | while (*deflib) { | |
110 | if (gSystem->Load(*deflib)==0) { | |
111 | Log(Form("HLT component library %s loaded", *deflib)); | |
112 | } | |
d83b59c6 | 113 | |
114 | deflib++; | |
12ec5482 | 115 | } |
116 | ||
d83b59c6 | 117 | for (AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent(); |
118 | pAgent!=NULL; | |
119 | pAgent=AliHLTModuleAgent::GetNextAgent()) { | |
12ec5482 | 120 | AliHLTModulePreprocessor* pProc=pAgent->GetPreprocessor(); |
d83b59c6 | 121 | if (pProc) |
122 | { | |
123 | ||
ee82b9b6 | 124 | // filter preprocessors according to active detector pattern |
125 | // don't filter if module returns 0 (i.e. always active) | |
126 | int moduleNo=pProc->GetModuleNumber(); | |
127 | if(moduleNo>0 && (moduleNo & fActiveDetectors) == 0) | |
d83b59c6 | 128 | { |
129 | TString msg; | |
ee82b9b6 | 130 | msg.Form("preprocessor module %s inactive", pProc->GetModuleID()); |
d83b59c6 | 131 | Log(msg.Data()); |
132 | continue; | |
133 | } | |
134 | ||
135 | pProc->SetShuttleInterface(this); | |
136 | pProc->Initialize(run, startTime, endTime); | |
137 | fProcessors.Add(pProc); | |
138 | TString msg; | |
139 | msg.Form("added preprocessor %p with ID %s for module %p", pProc, pProc->GetModuleID(), pAgent); | |
140 | Log(msg.Data()); | |
141 | } | |
12ec5482 | 142 | } |
143 | } | |
144 | ||
145 | UInt_t AliHLTPreprocessor::Process(TMap* dcsAliasMap) | |
146 | { | |
23bd5d2a | 147 | // process map of objects |
12ec5482 | 148 | UInt_t retVal = 0; |
149 | ||
150 | if (!GetHLTStatus()) { | |
151 | return 0; | |
152 | } | |
153 | ||
ee82b9b6 | 154 | bool bAllFailed=fProcessors.GetEntries()>0; |
12ec5482 | 155 | TObjLink *lnk = NULL; |
156 | lnk=fProcessors.FirstLink(); | |
157 | while (lnk) { | |
158 | AliHLTModulePreprocessor* pProc=dynamic_cast<AliHLTModulePreprocessor*>(lnk->GetObject()); | |
159 | if (pProc) { | |
160 | UInt_t result=pProc->Process(dcsAliasMap); | |
161 | if (result) { | |
162 | TString msg; | |
163 | msg.Form("preprocessor for module %s failed with error code %d", pProc->GetName(), result); | |
164 | Log(msg.Data()); | |
165 | } else { | |
166 | bAllFailed=false; | |
167 | } | |
168 | } | |
169 | lnk = lnk->Next(); | |
170 | } | |
171 | ||
ee82b9b6 | 172 | // error if all preprocessors failed |
12ec5482 | 173 | if (bAllFailed) return 1; |
174 | return retVal; | |
175 | } |