]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TRD/AliHLTTRDAgent.cxx
HLTsim
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDAgent.cxx
1 // $Id$
2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project        * 
4 //* ALICE Experiment at CERN, All rights reserved.                         *
5 //*                                                                        *
6 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
7 //*                  for The ALICE HLT Project.                            *
8 //*                                                                        *
9 //* Permission to use, copy, modify and distribute this software and its   *
10 //* documentation strictly for non-commercial purposes is hereby granted   *
11 //* without fee, provided that the above copyright notice appears in all   *
12 //* copies and that both the copyright notice and this permission notice   *
13 //* appear in the supporting documentation. The authors make no claims     *
14 //* about the suitability of this software for any purpose. It is          *
15 //* provided "as is" without express or implied warranty.                  *
16 //**************************************************************************
17
18 /// @file   AliHLTTRDAgent.cxx
19 /// @author Matthias Richter
20 /// @date   
21 /// @brief  Agent of the libAliHLTTRD library
22 ///
23
24 #include "AliHLTTRDAgent.h"
25 #include "AliHLTTRDDefinitions.h"
26 #include "AliDAQ.h"
27
28 // #include "AliHLTOUT.h"
29 // #include "AliHLTOUTHandlerChain.h"
30 // #include "AliRunLoader.h"
31
32 /** global instance for agent registration */
33 AliHLTTRDAgent gAliHLTTRDAgent;
34
35 // component headers
36 #include "AliHLTTRDClusterizerComponent.h"
37 #include "AliHLTTRDTrackerV1Component.h"
38 #include "AliHLTTRDCalibrationComponent.h"
39 #include "AliHLTTRDCalibFitComponent.h"
40 #include "AliHLTTRDCalibHistoComponent.h"
41 #include "AliHLTTRDEsdWriterComponent.h"
42 #include "AliHLTTRDClusterHistoComponent.h"
43 #include "AliHLTTRDTrackHistoComponent.h"
44 #include "AliHLTTRDHistoMergerComponent.h"
45 #include "AliHLTTRDOfflineClusterizerComponent.h"
46 #include "AliHLTTRDOfflineTrackerV1Component.h"
47 #include "AliHLTTRDPreprocessorComponent.h"
48 #include "AliHLTTRDMonitorComponent.h"
49
50 /** ROOT macro for the implementation of ROOT specific class methods */
51 ClassImp(AliHLTTRDAgent)
52
53   AliHLTTRDAgent::AliHLTTRDAgent()
54     :
55     AliHLTModuleAgent("TRD"),
56     fRawDataHandler(NULL)
57 {
58   // see header file for class documentation
59   // or
60   // refer to README to build package
61   // or
62   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
63 }
64
65 AliHLTTRDAgent::~AliHLTTRDAgent()
66 {
67   // see header file for class documentation
68 }
69
70 UInt_t AliHLTTRDAgent::GetDetectorMask() const
71 {
72   return AliDAQ::kTRD;
73 }
74
75 int AliHLTTRDAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
76                                          AliRawReader* /*rawReader*/,
77                                          AliRunLoader* /*runloader*/) const
78 {
79   // see header file for class documentation
80
81   return 0;
82 }
83
84 const char* AliHLTTRDAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
85                                                     AliRunLoader* /*runloader*/) const
86 {
87   // see header file for class documentation
88
89   return "";
90 }
91
92 const char* AliHLTTRDAgent::GetRequiredComponentLibraries() const
93 {
94   return "";
95 }
96
97 int AliHLTTRDAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
98 {
99   // see header file for class documentation
100   if (!pHandler) return -EINVAL;
101   pHandler->AddComponent(new AliHLTTRDClusterizerComponent);
102   pHandler->AddComponent(new AliHLTTRDTrackerV1Component);
103   pHandler->AddComponent(new AliHLTTRDCalibrationComponent);
104   pHandler->AddComponent(new AliHLTTRDCalibFitComponent);
105   pHandler->AddComponent(new AliHLTTRDCalibHistoComponent);
106   pHandler->AddComponent(new AliHLTTRDEsdWriterComponent);
107   pHandler->AddComponent(new AliHLTTRDClusterHistoComponent);
108   pHandler->AddComponent(new AliHLTTRDTrackHistoComponent);
109   pHandler->AddComponent(new AliHLTTRDHistoMergerComponent);
110   pHandler->AddComponent(new AliHLTTRDOfflineClusterizerComponent);
111   pHandler->AddComponent(new AliHLTTRDOfflineTrackerV1Component);
112   pHandler->AddComponent(new AliHLTTRDPreprocessorComponent);
113   pHandler->AddComponent(new AliHLTTRDMonitorComponent);
114   return 0;
115 }
116
117 int AliHLTTRDAgent::GetHandlerDescription(AliHLTComponentDataType dt,
118                                           AliHLTUInt32_t spec,
119                                           AliHLTOUTHandlerDesc& desc) const
120 {
121   // see header file for class documentation
122
123   // raw data blocks to be fed into offline reconstruction
124   if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTRD)) {
125     desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
126     HLTInfo("module %s handles data block type %s specification %d (0x%x)", 
127             GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
128     return 1;
129   }
130   return 0;
131 }
132
133 AliHLTOUTHandler* AliHLTTRDAgent::GetOutputHandler(AliHLTComponentDataType dt,
134                                                    AliHLTUInt32_t /*spec*/)
135 {
136   // see header file for class documentation
137
138   // raw data blocks to be fed into offline reconstruction
139   if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTRD)) {
140     // use the default handler
141     if (!fRawDataHandler) {
142       fRawDataHandler=new AliHLTOUTHandlerEquId;
143     }
144     return fRawDataHandler;
145   }
146   return NULL;
147 }
148
149 int AliHLTTRDAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
150 {
151   // see header file for class documentation
152   if (pInstance==NULL) return -EINVAL;
153
154   if (pInstance==fRawDataHandler) {
155     delete fRawDataHandler;
156     fRawDataHandler=NULL;
157     return 0;
158   }
159
160   delete pInstance;
161   return 0;
162 }
163