]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/ITS/AliHLTITSAgent.cxx
added write expert option
[u/mrichter/AliRoot.git] / HLT / ITS / AliHLTITSAgent.cxx
1 // $Id$
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 /** @file   AliHLTITSAgent.cxx
20     @author Matthias Richter
21     @date   25.08.2008
22     @brief  Agent of the libAliHLTITS library
23 */
24
25 #include <cassert>
26 #include "AliHLTITSAgent.h"
27 #include "AliHLTConfiguration.h"
28
29 // header files of library components
30
31 // header file of the module preprocessor
32 #include "AliHLTITSCompressRawDataSDDComponent.h"
33
34 // raw data handler of HLTOUT data
35 #include "AliHLTOUTHandlerEquId.h"
36
37 /** global instance for agent registration */
38 AliHLTITSAgent gAliHLTITSAgent;
39
40 /** ROOT macro for the implementation of ROOT specific class methods */
41 ClassImp(AliHLTITSAgent)
42
43 AliHLTITSAgent::AliHLTITSAgent()
44   :
45   AliHLTModuleAgent("ITS"),
46   fRawDataHandler(NULL)
47 {
48   // see header file for class documentation
49   // or
50   // refer to README to build package
51   // or
52   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
53 }
54
55 AliHLTITSAgent::~AliHLTITSAgent()
56 {
57   // see header file for class documentation
58 }
59
60 int AliHLTITSAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
61                                             AliRawReader* /*rawReader*/,
62                                             AliRunLoader* /*runloader*/) const
63 {
64   // see header file for class documentation
65   return 0;
66 }
67
68 const char* AliHLTITSAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
69                                                        AliRunLoader* /*runloader*/) const
70 {
71   // see header file for class documentation
72
73   return "";
74 }
75
76 const char* AliHLTITSAgent::GetRequiredComponentLibraries() const
77 {
78   // see header file for class documentation
79   return "";
80 }
81
82 int AliHLTITSAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
83 {
84   // see header file for class documentation
85   assert(pHandler);
86   if (!pHandler) return -EINVAL;
87   pHandler->AddComponent(new AliHLTITSCompressRawDataSDDComponent);
88
89   return 0;
90 }
91
92 AliHLTModulePreprocessor* AliHLTITSAgent::GetPreprocessor()
93 {
94   // see header file for class documentation
95   return NULL;
96 }
97
98 int AliHLTITSAgent::GetHandlerDescription(AliHLTComponentDataType dt,
99                                              AliHLTUInt32_t spec,
100                                              AliHLTOUTHandlerDesc& desc) const
101 {
102   // see header file for class documentation
103
104   // Handlers for ITS raw data. Even though there are 3 detectors
105   // everything is handled in one module library and one HLTOUT handler.
106   // This assumes that the data blocks are sent with data type
107   // {DDL_RAW :ITS } and the equipment id as specification
108   // The default behavior of AliHLTOUTHandlerEquId is used.
109   if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITS)) {
110       desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
111       HLTInfo("module %s handles data block type %s specification %d (0x%x)", 
112               GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
113       return 1;
114   }
115   return 0;
116 }
117
118 AliHLTOUTHandler* AliHLTITSAgent::GetOutputHandler(AliHLTComponentDataType dt,
119                                                    AliHLTUInt32_t /*spec*/)
120 {
121   // see header file for class documentation
122   if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITS)) {
123     // use the default handler
124     if (!fRawDataHandler) {
125       fRawDataHandler=new AliHLTOUTHandlerEquId;
126     }
127     return fRawDataHandler;
128   }
129   return NULL;
130 }
131
132 int AliHLTITSAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
133 {
134   // see header file for class documentation
135   if (pInstance==NULL) return -EINVAL;
136
137   if (pInstance==fRawDataHandler) {
138     delete fRawDataHandler;
139     fRawDataHandler=NULL;
140     return 0;
141   }
142
143   delete pInstance;
144   return 0;
145 }