1 // $Id: AliHLTPreprocessor.cxx 23039 2007-12-13 20:53:02Z richterm $
3 //**************************************************************************
4 //* This file is property of and copyright by the *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 //* for The ALICE HLT Project. *
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 //**************************************************************************
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
26 #include "AliHLTPreprocessor.h"
27 #include "AliHLTModulePreprocessor.h"
28 #include "AliHLTSystem.h"
29 #include "AliHLTModuleAgent.h"
32 ClassImp(AliHLTPreprocessor)
34 AliHLTPreprocessor::AliHLTPreprocessor(AliShuttleInterface* shuttle)
36 AliPreprocessor(fgkHLTPreproc, shuttle),
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.
45 // run types according to
46 // http://alice-ecs.web.cern.ch/alice-ecs/runtypes_3.16.html
48 // PHOS (retrieve Huffman tables)
49 AddRunType("STANDALONE");
51 // TPC (retrieve Huffman tables and temperature data)
52 AddRunType("PHYSICS");
55 AddRunType("PEDESTAL");
59 AddRunType("PEDESTAL");
60 AddRunType("STANDALONE");
62 fProcessors.SetOwner();
66 const char* AliHLTPreprocessor::fgkHLTPreproc = "HLT";
68 /** HLT default component libraries */
69 const char* AliHLTPreprocessor::fgkHLTDefaultShuttleLibs[]= {
78 "libAliHLTTrigger.so",
82 AliHLTPreprocessor::~AliHLTPreprocessor()
87 void AliHLTPreprocessor::Initialize(Int_t run, UInt_t startTime,
90 // init the preprocessor
92 fStartTime = startTime;
95 // TODO: read a configuration object from OCDB
97 // - component libraries
99 // retrieve list of active detectors from previous run.
100 fActiveDetectors = atoi(AliPreprocessor::GetRunParameter("detectorMask"));
102 // TString msg("Preprocessor for HLT initialized for run: ");
106 // load component libraries
108 const char** deflib=fgkHLTDefaultShuttleLibs;
110 if (gSystem->Load(*deflib)==0) {
111 Log(Form("HLT component library %s loaded", *deflib));
117 for (AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent();
119 pAgent=AliHLTModuleAgent::GetNextAgent()) {
120 AliHLTModulePreprocessor* pProc=pAgent->GetPreprocessor();
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)
130 msg.Form("preprocessor module %s inactive", pProc->GetModuleID());
135 pProc->SetShuttleInterface(this);
136 pProc->Initialize(run, startTime, endTime);
137 fProcessors.Add(pProc);
139 msg.Form("added preprocessor %p with ID %s for module %p", pProc, pProc->GetModuleID(), pAgent);
145 UInt_t AliHLTPreprocessor::Process(TMap* dcsAliasMap)
147 // process map of objects
150 if (!GetHLTStatus()) {
154 bool bAllFailed=fProcessors.GetEntries()>0;
155 TObjLink *lnk = NULL;
156 lnk=fProcessors.FirstLink();
158 AliHLTModulePreprocessor* pProc=dynamic_cast<AliHLTModulePreprocessor*>(lnk->GetObject());
160 UInt_t result=pProc->Process(dcsAliasMap);
163 msg.Form("preprocessor for module %s failed with error code %d", pProc->GetName(), result);
172 // error if all preprocessors failed
173 if (bAllFailed) return 1;