]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx
Integrating dimuon HLT with AliSimulation framework via AliHLTSystem interfaces.
[u/mrichter/AliRoot.git] / HLT / MUON / OfflineInterface / AliHLTMUONAgent.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2007, 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 /// @file   AliHLTMUONAgent.cxx
20 /// @author Artur Szostak <artursz@iafrica.com>
21 /// @date   28 May 2007
22 /// @brief  Implementation of the AliHLTMUONAgent class.
23 ///
24
25 #include "AliHLTMUONAgent.h"
26 #include "AliHLTMUONConstants.h"
27 #include "AliHLTMUONRecHitsSource.h"
28 #include "AliHLTMUONTriggerRecordsSource.h"
29 #include "AliHLTMUONDigitPublisherComponent.h"
30 #include "AliHLTMUONRootifierComponent.h"
31 #include "AliHLTMUONHitReconstructorComponent.h"
32 #include "AliHLTMUONTriggerReconstructorComponent.h"
33 #include "AliHLTMUONMansoTrackerFSMComponent.h"
34 #include "AliHLTMUONDecisionComponent.h"
35 #include "AliHLTMUONEmptyEventFilterComponent.h"
36 #include "AliHLTMUONDataCheckerComponent.h"
37 #include "AliRunLoader.h"
38 #include "TSystem.h"
39 #include "TString.h"
40
41 // The single global instance of the dimuon HLT agent.
42 AliHLTMUONAgent AliHLTMUONAgent::fgkInstance;
43
44 ClassImp(AliHLTMUONAgent);
45
46
47 AliHLTMUONAgent::AliHLTMUONAgent() : AliHLTModuleAgent("MUON")
48 {
49         ///
50         /// Default constructor.
51         ///
52 }
53
54 AliHLTMUONAgent::~AliHLTMUONAgent()
55 {
56         ///
57         /// Default destructor.
58         ///
59 }
60
61 const char* AliHLTMUONAgent::GetReconstructionChains(AliRawReader* rawReader,
62                                                      AliRunLoader* runloader
63         ) const
64 {
65         ///
66         /// Inherited from AliHLTModuleAgent.
67         /// Returns the top processing chain configurations for local event
68         /// reconstruction.
69         /// @param rawReader  [in] AliRoot rawreader instance.
70         /// @param runloader  [in] AliRoot runloader
71         /// @return string containing the top configurations separated by blanks.
72         ///
73         /// If rawReader is not NULL then the standard dHLT chain is run taking
74         /// data from raw DDL data. Otherwise runloader is checked and if it is
75         /// not NULL then a dHLT chain is run with input data from digits.
76         
77         if (rawReader != NULL)
78         {
79                 return "dHLT-sim-fromRaw";
80         }
81         else if (runloader != NULL)
82         {
83                 return "dHLT-sim";
84         }
85         else
86         {
87                 return "";
88         }
89 }
90
91 const char* AliHLTMUONAgent::GetRequiredComponentLibraries() const
92 {
93         ///
94         /// Inherited from AliHLTModuleAgent.
95         /// Returns a list of libraries which the configurations registered by
96         /// this module agent depend on.
97         /// @return list of component libraries as a blank-separated string.
98         ///
99         
100         // List of libraries that we depend on.
101         static const char* libs[] =
102         {
103                 "libCore.so",
104                 "libCint.so",
105                 "libGraf.so",
106                 "libRIO.so",
107                 "libNet.so",
108                 "libHist.so",
109                 "libMatrix.so",
110                 "libMathCore.so",
111                 "libMinuit.so",
112                 "libTree.so",
113                 "libGraf3d.so",
114                 "libGpad.so",
115                 "libPhysics.so",
116                 "libGui.so",
117                 "libProofPlayer.so",
118                 "libProof.so",
119                 "libThread.so",
120                 "libGeom.so",
121                 "libMinuit.so",
122                 "libEG.so",
123                 "libTreePlayer.so",
124                 "libXMLIO.so",
125                 "libVMC.so",
126                 "libESD.so",
127                 "libCDB.so",
128                 "libSTEERBase.so",
129                 "libSTEER.so",
130                 "libGui.so",
131                 "libRAWDatasim.so",
132                 "libRAWDatarec.so",
133                 "libRAWDatabase.so",
134                 "libMUONcore.so",
135                 "libMUONraw.so",
136                 "libMUONbase.so",
137                 "libMUONgeometry.so",
138                 "libMUONmapping.so",
139                 "libMUONcalib.so",
140                 "libMUONsim.so",
141                 "libMUONtrigger.so",
142                 "libMUONevaluation.so",
143                 "libMUONrec.so",
144                 "libHLTbase.so",
145                 "libAliHLTUtil.so",
146                 NULL
147         };
148         
149         // First check if the library is not already loaded. If it is then we have
150         // no reason to declare it as needed, so that we do not load it again.
151         static TString result;
152         for (const char** lib = libs; *lib != NULL; lib++)
153         {
154                 const char* list = gSystem->GetLibraries(*lib, "", kFALSE);
155                 if (list == NULL) continue;
156                 // Check if not found, i.e. result was an empty string.
157                 // If so then add the library to the required list.
158                 if (list[0] == '\0')
159                 {
160                         result += *lib;
161                         result += " ";
162                 }
163         }
164         return result.Data();
165 }
166
167
168 int AliHLTMUONAgent::CreateConfigurations(
169                 AliHLTConfigurationHandler* handler,
170                 AliRawReader* rawReader,
171                 AliRunLoader* runloader
172         ) const
173 {
174         /// Register all processing configurations belonging to the dimuon HLT
175         /// library with the AliHLTConfigurationHandler.
176         /// @param handler      the configuration handler
177         /// @param rawReader  [in] AliRoot rawreader instance.
178         /// @param runloader    AliRoot runloader
179         /// @return Zero on success and error code if failed.
180         ///
181         /// Chains available:
182         /// dHLT-sim          - standard dHLT simulation chain.
183         /// dHLT-sim-fromRaw  - standard dHLT chain taking raw DDL data as input.
184         /// dHLT-sim-fromMC   - dHLT chain taking Monte Carlo hit data as input.
185         ///                     So hit reconstruction is not checked, just the tracker.
186         
187         if (handler == NULL) return 0;
188         
189         const char* trackerId = AliHLTMUONConstants::MansoTrackerFSMId();
190         const char* decCompId = AliHLTMUONConstants::DecisionComponentId();
191         
192         if (rawReader != NULL)
193         {
194                 // Implement the dHLT-sim-fromRaw dHLT simulation chain reading
195                 // from raw data.
196                 const char* rawPubComp = "AliRawReaderPublisher";
197                 const char* cmd13 = "-minid 2572 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x001000";
198                 const char* cmd14 = "-minid 2573 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x002000";
199                 const char* cmd15 = "-minid 2574 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x004000";
200                 const char* cmd16 = "-minid 2575 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x008000";
201                 const char* cmd17 = "-minid 2576 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x010000";
202                 const char* cmd18 = "-minid 2577 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x020000";
203                 const char* cmd19 = "-minid 2578 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x040000";
204                 const char* cmd20 = "-minid 2579 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x080000";
205                 const char* cmd21 = "-minid 2816 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x100000";
206                 const char* cmd22 = "-minid 2817 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x200000";
207                 handler->CreateConfiguration("RawDDL13", rawPubComp, NULL, cmd13);
208                 handler->CreateConfiguration("RawDDL14", rawPubComp, NULL, cmd14);
209                 handler->CreateConfiguration("RawDDL15", rawPubComp, NULL, cmd15);
210                 handler->CreateConfiguration("RawDDL16", rawPubComp, NULL, cmd16);
211                 handler->CreateConfiguration("RawDDL17", rawPubComp, NULL, cmd17);
212                 handler->CreateConfiguration("RawDDL18", rawPubComp, NULL, cmd18);
213                 handler->CreateConfiguration("RawDDL19", rawPubComp, NULL, cmd19);
214                 handler->CreateConfiguration("RawDDL20", rawPubComp, NULL, cmd20);
215                 handler->CreateConfiguration("RawDDL21", rawPubComp, NULL, cmd21);
216                 handler->CreateConfiguration("RawDDL22", rawPubComp, NULL, cmd22);
217                 const char* hrId = AliHLTMUONConstants::HitReconstructorId();
218                 const char* trId = AliHLTMUONConstants::TriggerReconstructorId();
219                 handler->CreateConfiguration("RecoRawDDL13", hrId, "RawDDL13", "-ddl 13 -cdb");
220                 handler->CreateConfiguration("RecoRawDDL14", hrId, "RawDDL14", "-ddl 14 -cdb");
221                 handler->CreateConfiguration("RecoRawDDL15", hrId, "RawDDL15", "-ddl 15 -cdb");
222                 handler->CreateConfiguration("RecoRawDDL16", hrId, "RawDDL16", "-ddl 16 -cdb");
223                 handler->CreateConfiguration("RecoRawDDL17", hrId, "RawDDL17", "-ddl 17 -cdb");
224                 handler->CreateConfiguration("RecoRawDDL18", hrId, "RawDDL18", "-ddl 18 -cdb");
225                 handler->CreateConfiguration("RecoRawDDL19", hrId, "RawDDL19", "-ddl 19 -cdb");
226                 handler->CreateConfiguration("RecoRawDDL20", hrId, "RawDDL20", "-ddl 20 -cdb");
227                 handler->CreateConfiguration("RecoRawDDL21", trId, "RawDDL21", "-ddl 21 -cdb -suppress_partial_triggers");
228                 handler->CreateConfiguration("RecoRawDDL22", trId, "RawDDL22", "-ddl 22 -cdb -suppress_partial_triggers");
229                 
230                 const char* recoSrcs = "RecoRawDDL13 RecoRawDDL14 RecoRawDDL15 RecoRawDDL16 RecoRawDDL17"
231                         " RecoRawDDL18 RecoRawDDL19 RecoRawDDL20 RecoRawDDL21 RecoRawDDL22";
232                 handler->CreateConfiguration("MansoTrackerForRaw", trackerId, recoSrcs, "");
233                 
234                 handler->CreateConfiguration("dHLT-sim-fromRaw", decCompId, "MansoTrackerForRaw", "");
235         }
236         
237         if (runloader != NULL)
238         {
239                 // Implement the dHLT-sim dHLT simulation chain reading from
240                 // simulated digits.
241                 const char* digitPub = AliHLTMUONConstants::DigitPublisherId();
242                 handler->CreateConfiguration("DigitDDL13", digitPub, NULL, "-simdata -ddl 13");
243                 handler->CreateConfiguration("DigitDDL14", digitPub, NULL, "-simdata -ddl 14");
244                 handler->CreateConfiguration("DigitDDL15", digitPub, NULL, "-simdata -ddl 15");
245                 handler->CreateConfiguration("DigitDDL16", digitPub, NULL, "-simdata -ddl 16");
246                 handler->CreateConfiguration("DigitDDL17", digitPub, NULL, "-simdata -ddl 17");
247                 handler->CreateConfiguration("DigitDDL18", digitPub, NULL, "-simdata -ddl 18");
248                 handler->CreateConfiguration("DigitDDL19", digitPub, NULL, "-simdata -ddl 19");
249                 handler->CreateConfiguration("DigitDDL20", digitPub, NULL, "-simdata -ddl 20");
250                 handler->CreateConfiguration("DigitDDL21", digitPub, NULL, "-simdata -ddl 21");
251                 handler->CreateConfiguration("DigitDDL22", digitPub, NULL, "-simdata -ddl 22");
252                 const char* hrId = AliHLTMUONConstants::HitReconstructorId();
253                 const char* trId = AliHLTMUONConstants::TriggerReconstructorId();
254                 handler->CreateConfiguration("RecoDDL13", hrId, "DigitDDL13", "-ddl 13 -cdb");
255                 handler->CreateConfiguration("RecoDDL14", hrId, "DigitDDL14", "-ddl 14 -cdb");
256                 handler->CreateConfiguration("RecoDDL15", hrId, "DigitDDL15", "-ddl 15 -cdb");
257                 handler->CreateConfiguration("RecoDDL16", hrId, "DigitDDL16", "-ddl 16 -cdb");
258                 handler->CreateConfiguration("RecoDDL17", hrId, "DigitDDL17", "-ddl 17 -cdb");
259                 handler->CreateConfiguration("RecoDDL18", hrId, "DigitDDL18", "-ddl 18 -cdb");
260                 handler->CreateConfiguration("RecoDDL19", hrId, "DigitDDL19", "-ddl 19 -cdb");
261                 handler->CreateConfiguration("RecoDDL20", hrId, "DigitDDL20", "-ddl 20 -cdb");
262                 handler->CreateConfiguration("RecoDDL21", trId, "DigitDDL21", "-ddl 21 -cdb -suppress_partial_triggers");
263                 handler->CreateConfiguration("RecoDDL22", trId, "DigitDDL22", "-ddl 22 -cdb -suppress_partial_triggers");
264                 
265                 const char* recoSrcs = "RecoDDL13 RecoDDL14 RecoDDL15 RecoDDL16 RecoDDL17"
266                         " RecoDDL18 RecoDDL19 RecoDDL20 RecoDDL21 RecoDDL22";
267                 handler->CreateConfiguration("MansoTracker", trackerId, recoSrcs, "");
268                 
269                 handler->CreateConfiguration("dHLT-sim", decCompId, "MansoTracker", "");
270         
271                 // Implement the dHLT-sim-fromMC dHLT simulation chain reading
272                 // Monte Carlo geant hits and putting those into a tracker component.
273                 const char* rhsId = AliHLTMUONConstants::RecHitsSourceId();
274                 const char* trsId = AliHLTMUONConstants::TriggerRecordsSourceId();
275                 handler->CreateConfiguration("HitsDDL13", rhsId, NULL, "-simdata -plane left  -chamber 7");
276                 handler->CreateConfiguration("HitsDDL14", rhsId, NULL, "-simdata -plane right -chamber 7");
277                 handler->CreateConfiguration("HitsDDL15", rhsId, NULL, "-simdata -plane left  -chamber 8");
278                 handler->CreateConfiguration("HitsDDL16", rhsId, NULL, "-simdata -plane right -chamber 8");
279                 handler->CreateConfiguration("HitsDDL17", rhsId, NULL, "-simdata -plane left  -chamber 9");
280                 handler->CreateConfiguration("HitsDDL18", rhsId, NULL, "-simdata -plane right -chamber 9");
281                 handler->CreateConfiguration("HitsDDL19", rhsId, NULL, "-simdata -plane left  -chamber 10");
282                 handler->CreateConfiguration("HitsDDL20", rhsId, NULL, "-simdata -plane right -chamber 10");
283                 handler->CreateConfiguration("TrigRecsDDL21", trsId, NULL, "-hitdata -plane left");
284                 handler->CreateConfiguration("TrigRecsDDL22", trsId, NULL, "-hitdata -plane right");
285                 
286                 const char* dataSrcs = "HitsDDL13 HitsDDL14 HitsDDL15 HitsDDL16 HitsDDL17"
287                         " HitsDDL18 HitsDDL19 HitsDDL20 TrigRecsDDL21 TrigRecsDDL22";
288                 handler->CreateConfiguration("MansoTrackerForMC", trackerId, dataSrcs, "");
289                 
290                 handler->CreateConfiguration("dHLT-sim-fromMC", decCompId, "MansoTrackerForMC", "");
291         }
292         
293         return 0;
294 }
295
296
297 int AliHLTMUONAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
298 {
299         ///
300         /// Registers all available components of this module.
301         /// @param pHandler  [in] instance of the component handler.
302         ///
303         
304         if (pHandler == NULL) return -EINVAL;
305         pHandler->AddComponent(new AliHLTMUONRecHitsSource);
306         pHandler->AddComponent(new AliHLTMUONTriggerRecordsSource);
307         pHandler->AddComponent(new AliHLTMUONDigitPublisherComponent);
308         pHandler->AddComponent(new AliHLTMUONRootifierComponent);
309         pHandler->AddComponent(new AliHLTMUONHitReconstructorComponent);
310         pHandler->AddComponent(new AliHLTMUONTriggerReconstructorComponent);
311         pHandler->AddComponent(new AliHLTMUONMansoTrackerFSMComponent);
312         pHandler->AddComponent(new AliHLTMUONDecisionComponent);
313         pHandler->AddComponent(new AliHLTMUONEmptyEventFilterComponent);
314         pHandler->AddComponent(new AliHLTMUONDataCheckerComponent);
315         return 0;
316 }
317