]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/shuttle/AliHLTPreprocessor.cxx
In the calculation of the jacobian use the transposed matrix instead of its inverse...
[u/mrichter/AliRoot.git] / HLT / shuttle / AliHLTPreprocessor.cxx
1 // $Id: AliHLTPreprocessor.cxx 23039 2007-12-13 20:53:02Z richterm $
2
3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project        * 
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
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  */
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),
37   fProcessors(),
38   fActiveDetectors(0)
39 {
40   // see header file for class documentation
41   // or
42   // refer to README to build package
43   // or
44   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
45
46   // run types according to 
47   // http://alice-ecs.web.cern.ch/alice-ecs/runtypes_3.16.html
48
49   // PHOS (retrieve Huffman tables)
50   AddRunType("STANDALONE");
51
52   // TPC (retrieve Huffman tables and temperature data)
53   AddRunType("PHYSICS");
54   AddRunType("COSMIC");
55   AddRunType("LASER");
56   AddRunType("PEDESTAL");
57   AddRunType("PULSER");
58
59   // TRD
60   AddRunType("PEDESTAL");
61   AddRunType("STANDALONE");
62  
63   fProcessors.SetOwner();
64
65 }
66
67 const char* AliHLTPreprocessor::fgkHLTPreproc = "HLT";
68
69 /** HLT default component libraries */
70 const char* AliHLTPreprocessor::fgkHLTDefaultShuttleLibs[]= {
71   "libAliHLTUtil.so", 
72   "libAliHLTRCU.so", 
73   "libAliHLTTPC.so", 
74   "libAliHLTComp.so", 
75   "libAliHLTSample.so",
76   //"libAliHLTPHOS.so",
77   //"libAliHLTMUON.so",
78   "libAliHLTTRD.so",
79   NULL
80 };
81
82 AliHLTPreprocessor::~AliHLTPreprocessor()
83 {
84   // see header file for function documentation
85 }
86
87 void AliHLTPreprocessor::Initialize(Int_t run, UInt_t startTime, 
88                         UInt_t endTime) 
89 {
90   // see header file for function documentation
91   fRun = run;
92   fStartTime = startTime;
93   fEndTime = endTime;
94
95   // retrieve list of active detectors from previous run.
96   fActiveDetectors = atoi(AliPreprocessor::GetRunParameter("detectorMask"));
97
98   //   TString msg("Preprocessor for HLT initialized for run: ");
99   //   msg += run;
100   //   Log(msg.Data());
101   
102   // load component libraries
103   TString libs;
104   const char** deflib=fgkHLTDefaultShuttleLibs;
105   while (*deflib) {
106     if (gSystem->Load(*deflib)==0) {
107       Log(Form("HLT component library %s loaded", *deflib));
108     }
109     
110     deflib++;
111   }
112
113   for (AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent();
114        pAgent!=NULL;
115        pAgent=AliHLTModuleAgent::GetNextAgent()) {
116     AliHLTModulePreprocessor* pProc=pAgent->GetPreprocessor();
117     if (pProc) 
118       {
119
120         // test if pProc is necessary, if not, take next one
121         if((pProc->GetModuleNumber() & fActiveDetectors) == 0)
122           {
123             TString msg;
124             msg.Form("%s not needed", pProc->GetModuleID());
125             Log(msg.Data());
126             continue;
127           }
128         
129         pProc->SetShuttleInterface(this);
130         pProc->Initialize(run, startTime, endTime);
131         fProcessors.Add(pProc);
132         TString msg;
133         msg.Form("added preprocessor %p with ID %s for module %p", pProc, pProc->GetModuleID(), pAgent);
134         Log(msg.Data());
135       }
136   }
137 }
138
139 UInt_t AliHLTPreprocessor::Process(TMap* dcsAliasMap)
140 {
141   // see header file for function documentation
142   UInt_t retVal = 0;
143
144   if (!GetHLTStatus()) {
145     return 0;
146   }
147
148   bool bAllFailed=true;
149   TObjLink *lnk = NULL;
150   lnk=fProcessors.FirstLink();
151   while (lnk) {
152     AliHLTModulePreprocessor* pProc=dynamic_cast<AliHLTModulePreprocessor*>(lnk->GetObject());
153     if (pProc) {
154       UInt_t result=pProc->Process(dcsAliasMap);
155       if (result) {
156         TString msg;
157         msg.Form("preprocessor for module %s failed with error code %d", pProc->GetName(), result);
158         Log(msg.Data());
159       } else {
160         bAllFailed=false;
161       }
162     }
163     lnk = lnk->Next();
164   }
165
166   if (bAllFailed) return 1;
167   return retVal;
168 }
169
170
171 Bool_t AliHLTPreprocessor::ProcessDCS()
172 {
173   // see header file for function documentation
174   return kFALSE;
175 }