Adding functionality to generate AliESDEvent objects from dHLT raw data during offlin...
[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 "AliHLTMUONESDMaker.h"
36 #include "AliHLTMUONEmptyEventFilterComponent.h"
37 #include "AliHLTMUONDataCheckerComponent.h"
38 #include "AliHLTOUTHandlerChain.h"
39 #include "AliRawReader.h"
40 #include "AliRunLoader.h"
41 #include "TSystem.h"
42 #include "TString.h"
43
44 // The single global instance of the dimuon HLT agent.
45 AliHLTMUONAgent AliHLTMUONAgent::fgkInstance;
46
47 AliHLTOUTHandlerChain AliHLTMUONAgent::fgkESDMakerChain("libAliHLTMUON.so chains=dHLT-make-esd");
48 AliHLTOUTHandlerChain AliHLTMUONAgent::fgkRootifyDumpChain("libAliHLTMUON.so chains=dHLT-rootify-and-dump");
49
50
51 ClassImp(AliHLTMUONAgent);
52
53
54 AliHLTMUONAgent::AliHLTMUONAgent() : AliHLTModuleAgent("MUON")
55 {
56         ///
57         /// Default constructor.
58         ///
59 }
60
61 AliHLTMUONAgent::~AliHLTMUONAgent()
62 {
63         ///
64         /// Default destructor.
65         ///
66 }
67
68 const char* AliHLTMUONAgent::GetReconstructionChains(AliRawReader* rawReader,
69                                                      AliRunLoader* runloader
70         ) const
71 {
72         ///
73         /// Inherited from AliHLTModuleAgent.
74         /// Returns the top processing chain configurations for local event
75         /// reconstruction.
76         /// @param rawReader  [in] AliRoot rawreader instance.
77         /// @param runloader  [in] AliRoot runloader
78         /// @return string containing the top configurations separated by blanks.
79         ///
80         /// If rawReader is not NULL then the standard dHLT chain is run taking
81         /// data from raw DDL data. Otherwise runloader is checked and if it is
82         /// not NULL then a dHLT chain is run with input data from digits.
83         
84         if (rawReader != NULL)
85         {
86                 // Check if there is any data from the tracker and trigger.
87                 bool dataFromTracker = false;
88                 bool dataFromTrigger = false;
89                 rawReader->Select("MUONTRK", 0, 19);
90                 for (Int_t i = 0; i < 20; i++)
91                 {
92                         if (rawReader->ReadHeader()) dataFromTracker = true;
93                 }
94                 rawReader->Select("MUONTRG", 0, 1);
95                 for (Int_t i = 0; i < 2; i++)
96                 {
97                         if (rawReader->ReadHeader()) dataFromTrigger = true;
98                 }
99                 rawReader->RewindEvents();
100                 
101                 // If raw data was found for our detector then select the
102                 // appropriate chain.
103                 if (dataFromTracker and dataFromTrigger)
104                         return "dHLT-sim-fromRaw";
105         }
106         
107         if (runloader != NULL)
108         {
109                 if (runloader->GetLoader("MUONLoader") != NULL)
110                         return "dHLT-sim";
111         }
112         
113         return "";
114 }
115
116 const char* AliHLTMUONAgent::GetRequiredComponentLibraries() const
117 {
118         ///
119         /// Inherited from AliHLTModuleAgent.
120         /// Returns a list of libraries which the configurations registered by
121         /// this module agent depend on.
122         /// @return list of component libraries as a blank-separated string.
123         ///
124         
125         // List of libraries that we depend on.
126         static const char* libs[] =
127         {
128                 "libCore.so",
129                 "libCint.so",
130                 "libGraf.so",
131                 "libRIO.so",
132                 "libNet.so",
133                 "libHist.so",
134                 "libMatrix.so",
135                 "libMathCore.so",
136                 "libMinuit.so",
137                 "libTree.so",
138                 "libGraf3d.so",
139                 "libGpad.so",
140                 "libPhysics.so",
141                 "libGui.so",
142                 "libProofPlayer.so",
143                 "libProof.so",
144                 "libThread.so",
145                 "libGeom.so",
146                 "libEG.so",
147                 "libTreePlayer.so",
148                 "libXMLIO.so",
149                 "libVMC.so",
150                 "libESD.so",
151                 "libCDB.so",
152                 "libSTEERBase.so",
153                 "libSTEER.so",
154                 "libGui.so",
155                 "libRAWDatasim.so",
156                 "libRAWDatarec.so",
157                 "libRAWDatabase.so",
158                 "libMUONcore.so",
159                 "libMUONraw.so",
160                 "libMUONbase.so",
161                 "libMUONgeometry.so",
162                 "libMUONmapping.so",
163                 "libMUONcalib.so",
164                 "libMUONsim.so",
165                 "libMUONtrigger.so",
166                 "libMUONevaluation.so",
167                 "libMUONrec.so",
168                 "libHLTbase.so",
169                 "libAliHLTUtil.so",
170                 NULL
171         };
172         
173         // First check if the library is not already loaded. If it is then we have
174         // no reason to declare it as needed, so that we do not load it again.
175         static TString result;
176         for (const char** lib = libs; *lib != NULL; lib++)
177         {
178                 const char* list = gSystem->GetLibraries(*lib, "", kFALSE);
179                 if (list == NULL) continue;
180                 // Check if not found, i.e. result was an empty string.
181                 // If so then add the library to the required list.
182                 if (list[0] == '\0')
183                 {
184                         result += *lib;
185                         result += " ";
186                 }
187         }
188         return result.Data();
189 }
190
191
192 int AliHLTMUONAgent::CreateConfigurations(
193                 AliHLTConfigurationHandler* handler,
194                 AliRawReader* rawReader,
195                 AliRunLoader* runloader
196         ) const
197 {
198         /// Register all processing configurations belonging to the dimuon HLT
199         /// library with the AliHLTConfigurationHandler.
200         /// @param handler      the configuration handler
201         /// @param rawReader  [in] AliRoot rawreader instance.
202         /// @param runloader    AliRoot runloader
203         /// @return Zero on success and error code if failed.
204         ///
205         /// Chains available:
206         /// dHLT-sim          - standard dHLT simulation chain.
207         /// dHLT-sim-fromRaw  - standard dHLT chain taking raw DDL data as input.
208         /// dHLT-sim-fromMC   - dHLT chain taking Monte Carlo hit data as input.
209         ///                     So hit reconstruction is not checked, just the tracker.
210         
211         if (handler == NULL) return 0;
212         
213         const char* trackerId = AliHLTMUONConstants::MansoTrackerFSMId();
214         const char* decCompId = AliHLTMUONConstants::DecisionComponentId();
215         
216         if (rawReader != NULL)
217         {
218                 // Implement the dHLT-sim-fromRaw dHLT simulation chain reading
219                 // from raw data.
220                 const char* rawPubComp = "AliRawReaderPublisher";
221                 const char* cmd13 = "-minid 2572 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x001000";
222                 const char* cmd14 = "-minid 2573 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x002000";
223                 const char* cmd15 = "-minid 2574 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x004000";
224                 const char* cmd16 = "-minid 2575 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x008000";
225                 const char* cmd17 = "-minid 2576 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x010000";
226                 const char* cmd18 = "-minid 2577 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x020000";
227                 const char* cmd19 = "-minid 2578 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x040000";
228                 const char* cmd20 = "-minid 2579 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x080000";
229                 const char* cmd21 = "-minid 2816 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x100000";
230                 const char* cmd22 = "-minid 2817 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x200000";
231                 handler->CreateConfiguration("RawDDL13", rawPubComp, NULL, cmd13);
232                 handler->CreateConfiguration("RawDDL14", rawPubComp, NULL, cmd14);
233                 handler->CreateConfiguration("RawDDL15", rawPubComp, NULL, cmd15);
234                 handler->CreateConfiguration("RawDDL16", rawPubComp, NULL, cmd16);
235                 handler->CreateConfiguration("RawDDL17", rawPubComp, NULL, cmd17);
236                 handler->CreateConfiguration("RawDDL18", rawPubComp, NULL, cmd18);
237                 handler->CreateConfiguration("RawDDL19", rawPubComp, NULL, cmd19);
238                 handler->CreateConfiguration("RawDDL20", rawPubComp, NULL, cmd20);
239                 handler->CreateConfiguration("RawDDL21", rawPubComp, NULL, cmd21);
240                 handler->CreateConfiguration("RawDDL22", rawPubComp, NULL, cmd22);
241                 const char* hrId = AliHLTMUONConstants::HitReconstructorId();
242                 const char* trId = AliHLTMUONConstants::TriggerReconstructorId();
243                 handler->CreateConfiguration("RecoRawDDL13", hrId, "RawDDL13", "-ddl 13 -cdb");
244                 handler->CreateConfiguration("RecoRawDDL14", hrId, "RawDDL14", "-ddl 14 -cdb");
245                 handler->CreateConfiguration("RecoRawDDL15", hrId, "RawDDL15", "-ddl 15 -cdb");
246                 handler->CreateConfiguration("RecoRawDDL16", hrId, "RawDDL16", "-ddl 16 -cdb");
247                 handler->CreateConfiguration("RecoRawDDL17", hrId, "RawDDL17", "-ddl 17 -cdb");
248                 handler->CreateConfiguration("RecoRawDDL18", hrId, "RawDDL18", "-ddl 18 -cdb");
249                 handler->CreateConfiguration("RecoRawDDL19", hrId, "RawDDL19", "-ddl 19 -cdb");
250                 handler->CreateConfiguration("RecoRawDDL20", hrId, "RawDDL20", "-ddl 20 -cdb");
251                 handler->CreateConfiguration("RecoRawDDL21", trId, "RawDDL21", "-ddl 21 -cdb -suppress_partial_triggers");
252                 handler->CreateConfiguration("RecoRawDDL22", trId, "RawDDL22", "-ddl 22 -cdb -suppress_partial_triggers");
253                 
254                 const char* recoSrcs = "RecoRawDDL13 RecoRawDDL14 RecoRawDDL15 RecoRawDDL16 RecoRawDDL17"
255                         " RecoRawDDL18 RecoRawDDL19 RecoRawDDL20 RecoRawDDL21 RecoRawDDL22";
256                 handler->CreateConfiguration("MansoTrackerForRaw", trackerId, recoSrcs, "");
257                 
258                 handler->CreateConfiguration("DecisionForRaw", decCompId, "MansoTrackerForRaw", "");
259                 
260                 TString outputSrcs = "DecisionForRaw MansoTrackerForRaw ";
261                 outputSrcs += recoSrcs;
262                 handler->CreateConfiguration("dHLT-sim-fromRaw", "BlockFilter", outputSrcs, "");
263         }
264         
265         if (runloader != NULL)
266         {
267                 // Implement the dHLT-sim dHLT simulation chain reading from
268                 // simulated digits.
269                 const char* digitPub = AliHLTMUONConstants::DigitPublisherId();
270                 handler->CreateConfiguration("DigitDDL13", digitPub, NULL, "-simdata -ddl 13");
271                 handler->CreateConfiguration("DigitDDL14", digitPub, NULL, "-simdata -ddl 14");
272                 handler->CreateConfiguration("DigitDDL15", digitPub, NULL, "-simdata -ddl 15");
273                 handler->CreateConfiguration("DigitDDL16", digitPub, NULL, "-simdata -ddl 16");
274                 handler->CreateConfiguration("DigitDDL17", digitPub, NULL, "-simdata -ddl 17");
275                 handler->CreateConfiguration("DigitDDL18", digitPub, NULL, "-simdata -ddl 18");
276                 handler->CreateConfiguration("DigitDDL19", digitPub, NULL, "-simdata -ddl 19");
277                 handler->CreateConfiguration("DigitDDL20", digitPub, NULL, "-simdata -ddl 20");
278                 handler->CreateConfiguration("DigitDDL21", digitPub, NULL, "-simdata -ddl 21");
279                 handler->CreateConfiguration("DigitDDL22", digitPub, NULL, "-simdata -ddl 22");
280                 const char* hrId = AliHLTMUONConstants::HitReconstructorId();
281                 const char* trId = AliHLTMUONConstants::TriggerReconstructorId();
282                 handler->CreateConfiguration("RecoDDL13", hrId, "DigitDDL13", "-ddl 13 -cdb");
283                 handler->CreateConfiguration("RecoDDL14", hrId, "DigitDDL14", "-ddl 14 -cdb");
284                 handler->CreateConfiguration("RecoDDL15", hrId, "DigitDDL15", "-ddl 15 -cdb");
285                 handler->CreateConfiguration("RecoDDL16", hrId, "DigitDDL16", "-ddl 16 -cdb");
286                 handler->CreateConfiguration("RecoDDL17", hrId, "DigitDDL17", "-ddl 17 -cdb");
287                 handler->CreateConfiguration("RecoDDL18", hrId, "DigitDDL18", "-ddl 18 -cdb");
288                 handler->CreateConfiguration("RecoDDL19", hrId, "DigitDDL19", "-ddl 19 -cdb");
289                 handler->CreateConfiguration("RecoDDL20", hrId, "DigitDDL20", "-ddl 20 -cdb");
290                 handler->CreateConfiguration("RecoDDL21", trId, "DigitDDL21", "-ddl 21 -cdb -suppress_partial_triggers");
291                 handler->CreateConfiguration("RecoDDL22", trId, "DigitDDL22", "-ddl 22 -cdb -suppress_partial_triggers");
292                 
293                 const char* recoSrcs = "RecoDDL13 RecoDDL14 RecoDDL15 RecoDDL16 RecoDDL17"
294                         " RecoDDL18 RecoDDL19 RecoDDL20 RecoDDL21 RecoDDL22";
295                 handler->CreateConfiguration("MansoTracker", trackerId, recoSrcs, "");
296                 
297                 handler->CreateConfiguration("Decision", decCompId, "MansoTracker", "");
298                 
299                 TString outputSrcs = "Decision MansoTracker ";
300                 outputSrcs += recoSrcs;
301                 handler->CreateConfiguration("dHLT-sim", "BlockFilter", outputSrcs.Data(), "");
302         
303                 // Implement the dHLT-sim-fromMC dHLT simulation chain reading
304                 // Monte Carlo geant hits and putting those into a tracker component.
305                 const char* rhsId = AliHLTMUONConstants::RecHitsSourceId();
306                 const char* trsId = AliHLTMUONConstants::TriggerRecordsSourceId();
307                 handler->CreateConfiguration("HitsDDL13", rhsId, NULL, "-simdata -plane left  -chamber 7");
308                 handler->CreateConfiguration("HitsDDL14", rhsId, NULL, "-simdata -plane right -chamber 7");
309                 handler->CreateConfiguration("HitsDDL15", rhsId, NULL, "-simdata -plane left  -chamber 8");
310                 handler->CreateConfiguration("HitsDDL16", rhsId, NULL, "-simdata -plane right -chamber 8");
311                 handler->CreateConfiguration("HitsDDL17", rhsId, NULL, "-simdata -plane left  -chamber 9");
312                 handler->CreateConfiguration("HitsDDL18", rhsId, NULL, "-simdata -plane right -chamber 9");
313                 handler->CreateConfiguration("HitsDDL19", rhsId, NULL, "-simdata -plane left  -chamber 10");
314                 handler->CreateConfiguration("HitsDDL20", rhsId, NULL, "-simdata -plane right -chamber 10");
315                 handler->CreateConfiguration("TrigRecsDDL21", trsId, NULL, "-hitdata -plane left");
316                 handler->CreateConfiguration("TrigRecsDDL22", trsId, NULL, "-hitdata -plane right");
317                 
318                 const char* dataSrcs = "HitsDDL13 HitsDDL14 HitsDDL15 HitsDDL16 HitsDDL17"
319                         " HitsDDL18 HitsDDL19 HitsDDL20 TrigRecsDDL21 TrigRecsDDL22";
320                 handler->CreateConfiguration("MansoTrackerForMC", trackerId, dataSrcs, "");
321                 
322                 handler->CreateConfiguration("DecisionForMC", decCompId, "MansoTrackerForMC", "");
323                 
324                 outputSrcs = "DecisionForMC MansoTrackerForMC ";
325                 outputSrcs += dataSrcs;
326                 handler->CreateConfiguration("dHLT-sim-fromMC", "BlockFilter", outputSrcs.Data(), "");
327         }
328         
329         // Create a chain for generating AliESDEvent objects from dHLT raw reconstructed data.
330         handler->CreateConfiguration("HLTOUTPubTrigRecs", "AliHLTOUTPublisher", NULL, "-datatype 'TRIGRECS' 'MUON'");
331         handler->CreateConfiguration("HLTOUTPubMansoTracks", "AliHLTOUTPublisher", NULL, "-datatype 'MANTRACK' 'MUON'");
332         handler->CreateConfiguration(
333                         "dHLT-make-esd",
334                         AliHLTMUONConstants::ESDMakerId(),
335                         "HLTOUTPubTrigRecs HLTOUTPubMansoTracks",
336                         "-make_minimal_esd"
337                 );
338         
339         // Create a chain for rootifying the raw dHLT data and dumping to file.
340         // This is used during AliRoot reconstruction.
341         handler->CreateConfiguration("HLTOUTPubTrigDbg", "AliHLTOUTPublisher", NULL, "-datatype 'TRIGRDBG' 'MUON'");
342         handler->CreateConfiguration("HLTOUTPubHits", "AliHLTOUTPublisher", NULL, "-datatype 'RECHITS ' 'MUON'");
343         handler->CreateConfiguration("HLTOUTPubClusters", "AliHLTOUTPublisher", NULL, "-datatype 'CLUSTERS' 'MUON'");
344         handler->CreateConfiguration("HLTOUTPubChannels", "AliHLTOUTPublisher", NULL, "-datatype 'CHANNELS' 'MUON'");
345         handler->CreateConfiguration("HLTOUTPubCandidates", "AliHLTOUTPublisher", NULL, "-datatype 'MNCANDID' 'MUON'");
346         handler->CreateConfiguration("HLTOUTPubSingles", "AliHLTOUTPublisher", NULL, "-datatype 'DECIDSIN' 'MUON'");
347         handler->CreateConfiguration("HLTOUTPubPairs", "AliHLTOUTPublisher", NULL, "-datatype 'DECIDPAR' 'MUON'");
348         handler->CreateConfiguration(
349                         "HLTOUTConverter",
350                         AliHLTMUONConstants::RootifierComponentId(),
351                         "HLTOUTPubTrigRecs HLTOUTPubTrigDbg HLTOUTPubHits HLTOUTPubClusters"
352                          " HLTOUTPubChannels HLTOUTPubMansoTracks HLTOUTPubCandidates"
353                          " HLTOUTPubSingles HLTOUTPubPairs",
354                         ""
355                 );
356         handler->CreateConfiguration(
357                         "dHLT-rootify-and-dump",
358                         "ROOTFileWriter",
359                         "HLTOUTConverter",
360                         "-concatenate-events -datafile dHLTRawData.root -specfmt"
361                 );
362         
363         return 0;
364 }
365
366
367 int AliHLTMUONAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
368 {
369         ///
370         /// Registers all available components of this module.
371         /// @param pHandler  [in] instance of the component handler.
372         ///
373         
374         if (pHandler == NULL) return -EINVAL;
375         pHandler->AddComponent(new AliHLTMUONRecHitsSource);
376         pHandler->AddComponent(new AliHLTMUONTriggerRecordsSource);
377         pHandler->AddComponent(new AliHLTMUONDigitPublisherComponent);
378         pHandler->AddComponent(new AliHLTMUONRootifierComponent);
379         pHandler->AddComponent(new AliHLTMUONHitReconstructorComponent);
380         pHandler->AddComponent(new AliHLTMUONTriggerReconstructorComponent);
381         pHandler->AddComponent(new AliHLTMUONMansoTrackerFSMComponent);
382         pHandler->AddComponent(new AliHLTMUONDecisionComponent);
383         pHandler->AddComponent(new AliHLTMUONESDMaker);
384         pHandler->AddComponent(new AliHLTMUONEmptyEventFilterComponent);
385         pHandler->AddComponent(new AliHLTMUONDataCheckerComponent);
386         return 0;
387 }
388
389
390 int AliHLTMUONAgent::GetHandlerDescription(
391                 AliHLTComponentDataType dt,
392 #ifdef __DEBUG
393                 AliHLTUInt32_t spec,
394 #else
395                 AliHLTUInt32_t /*spec*/,
396 #endif
397                 AliHLTOUTHandlerDesc& desc
398         ) const
399 {
400         /// Get handler decription for MUON data in the HLTOUT data stream.
401         
402         if (dt == AliHLTMUONConstants::TriggerRecordsBlockDataType() or
403             dt == AliHLTMUONConstants::MansoTracksBlockDataType()
404            )
405         {
406                 HLTDebug("Indicating we can handle data type = %s and specification"
407                         " = 0x%8.8X with dHLT-make-esd chain",
408                         AliHLTComponent::DataType2Text(dt).c_str(),
409                         spec
410                 );
411                 desc = AliHLTOUTHandlerDesc(kChain, dt, "dHLT-make-esd");
412                 return 1;
413         }
414         
415         if (dt == AliHLTMUONConstants::TriggerRecordsBlockDataType() or
416             dt == AliHLTMUONConstants::TrigRecsDebugBlockDataType() or
417             dt == AliHLTMUONConstants::RecHitsBlockDataType() or
418             dt == AliHLTMUONConstants::ClusterBlockDataType() or
419             dt == AliHLTMUONConstants::ChannelBlockDataType() or
420             dt == AliHLTMUONConstants::MansoTracksBlockDataType() or
421             dt == AliHLTMUONConstants::MansoCandidatesBlockDataType() or
422             dt == AliHLTMUONConstants::SinglesDecisionBlockDataType() or
423             dt == AliHLTMUONConstants::PairsDecisionBlockDataType()
424            )
425         {
426                 HLTDebug("Indicating we can handle data type = %s and specification"
427                         " = 0x%8.8X with dHLT-rootify-and-dump chain",
428                         AliHLTComponent::DataType2Text(dt).c_str(),
429                         spec
430                 );
431                 desc = AliHLTOUTHandlerDesc(kChain, dt, "dHLT-rootify-and-dump");
432                 return 1;
433         }
434         
435         return 0;
436 }
437
438
439 AliHLTOUTHandler* AliHLTMUONAgent::GetOutputHandler(
440                 AliHLTComponentDataType dt,
441 #ifdef __DEBUG
442                 AliHLTUInt32_t spec
443 #else
444                 AliHLTUInt32_t /*spec*/
445 #endif
446         )
447 {
448         /// Get specific handler for MUON data in the HLTOUT data stream.
449         
450         HLTDebug("Trying to create HLTOUT handler for data type = %s and"
451                 " specification = 0x%8.8X",
452                 AliHLTComponent::DataType2Text(dt).c_str(),
453                 spec
454         );
455         
456         if (dt == AliHLTMUONConstants::TriggerRecordsBlockDataType() or
457             dt == AliHLTMUONConstants::MansoTracksBlockDataType()
458            )
459         {
460                 return &fgkESDMakerChain;
461         }
462         
463         if (dt == AliHLTMUONConstants::TriggerRecordsBlockDataType() or
464             dt == AliHLTMUONConstants::TrigRecsDebugBlockDataType() or
465             dt == AliHLTMUONConstants::RecHitsBlockDataType() or
466             dt == AliHLTMUONConstants::ClusterBlockDataType() or
467             dt == AliHLTMUONConstants::ChannelBlockDataType() or
468             dt == AliHLTMUONConstants::MansoTracksBlockDataType() or
469             dt == AliHLTMUONConstants::MansoCandidatesBlockDataType() or
470             dt == AliHLTMUONConstants::SinglesDecisionBlockDataType() or
471             dt == AliHLTMUONConstants::PairsDecisionBlockDataType()
472            )
473         {
474                 return &fgkRootifyDumpChain;
475         }
476         
477         return NULL;
478 }
479
480
481 int AliHLTMUONAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
482 {
483         /// Deletes the HLTOUT handlers. In this case since the handlers are
484         /// allocated statically, we just check that the right pointer was
485         /// given and exit.
486         
487         HLTDebug("Trying to delete HLTOUT handler: %p", pInstance);
488         
489         if (pInstance != &fgkESDMakerChain or pInstance != &fgkRootifyDumpChain)
490                 return -EINVAL;
491         
492         return 0;
493 }