Line data Source code
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: Jochen Thaeder <jochen@thaeder.de> *
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 AliHLTVZEROAgent.cxx
20 : @author Jochen Thaeder <jochen@thaeder.de>
21 : @brief Agent of the libAliHLTVZERO library
22 : */
23 :
24 : #include <cassert>
25 :
26 : #include "TSystem.h"
27 : #include "AliDAQ.h"
28 :
29 : #include "AliHLTVZEROAgent.h"
30 :
31 : #include "AliHLTErrorGuard.h"
32 :
33 : // header files of library components
34 : #include "AliHLTVZERORecoComponent.h"
35 :
36 : // raw data handler of HLTOUT data
37 : #include "AliHLTOUTHandlerEquId.h"
38 : #include "AliHLTOUTHandlerEsdBranch.h"
39 :
40 : /** global instance for agent registration */
41 6 : AliHLTVZEROAgent gAliHLTVZEROAgent;
42 :
43 : /** ROOT macro for the implementation of ROOT specific class methods */
44 6 : ClassImp(AliHLTVZEROAgent)
45 :
46 : /*
47 : * ---------------------------------------------------------------------------------
48 : * Constructor / Destructor
49 : * ---------------------------------------------------------------------------------
50 : */
51 :
52 : // #################################################################################
53 : AliHLTVZEROAgent::AliHLTVZEROAgent() :
54 12 : AliHLTModuleAgent("VZERO") {
55 : // see header file for class documentation
56 : // or
57 : // refer to README to build package
58 : // or
59 : // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
60 6 : }
61 :
62 : // #################################################################################
63 6 : AliHLTVZEROAgent::~AliHLTVZEROAgent() {
64 : // see header file for class documentation
65 9 : }
66 :
67 : /*
68 : * ---------------------------------------------------------------------------------
69 : * Public functions to implement AliHLTModuleAgent's interface.
70 : * These functions are required for the registration process
71 : * ---------------------------------------------------------------------------------
72 : */
73 :
74 : UInt_t AliHLTVZEROAgent::GetDetectorMask() const
75 : {
76 0 : return AliDAQ::kVZERO;
77 : }
78 :
79 : // #################################################################################
80 : Int_t AliHLTVZEROAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
81 : AliRawReader* rawReader, AliRunLoader* runloader) const {
82 : // see header file for class documentation
83 :
84 0 : if (!handler)
85 0 : return -EINVAL;
86 :
87 0 : if (rawReader || !runloader) {
88 : // AliSimulation: use the AliRawReaderPublisher if the raw reader is available
89 : // Alireconstruction: indicated by runloader==NULL, run always on raw data
90 :
91 : // -- Define the VZERO raw publisher
92 : // -----------------------------------
93 0 : TString arg("-equipmentid 3584 -datatype 'DDL_RAW ' 'VZRO' -dataspec 0x01");
94 0 : handler->CreateConfiguration("VZERO-DP_0", "AliRawReaderPublisher", NULL , arg.Data());
95 :
96 : // -- Define the VZERO reconstruction components
97 : // -----------------------------------------------
98 0 : handler->CreateConfiguration("VZERO-RECO", "VZEROReconstruction", "VZERO-DP_0", "");
99 0 : }
100 0 : else if (runloader && !rawReader) {
101 : // indicates AliSimulation with no RawReader available -> run on digits
102 :
103 : // NOT Tested/ implemented yet
104 : /*
105 : handler->CreateConfiguration("V0DigitPublisher","AliLoaderPublisher",NULL,
106 : "-loader VZEROLoader -datatype 'ALITREED' 'VZRO'");
107 : //handler->CreateConfiguration("Digit","VZEROReconstruction","DigitPublisher","");
108 : handler->CreateConfiguration("VZERO-RECO", "VZEROReconstruction", "V0DigitPublisher", "");
109 : */
110 : }
111 :
112 0 : return 0;
113 0 : }
114 :
115 : // #################################################################################
116 : const Char_t* AliHLTVZEROAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
117 : AliRunLoader* /*runloader*/) const {
118 : // see header file for class documentation
119 :
120 : // VZERO called only from the EsdConverter
121 0 : return NULL;
122 : }
123 :
124 : // #################################################################################
125 : const Char_t* AliHLTVZEROAgent::GetRequiredComponentLibraries() const {
126 : // see header file for class documentation
127 0 : return "libAliHLTUtil.so libAliHLTVZERO.so";
128 : }
129 :
130 : // #################################################################################
131 : Int_t AliHLTVZEROAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const {
132 : // see header file for class documentation
133 6 : assert(pHandler);
134 3 : if (!pHandler) return -EINVAL;
135 :
136 6 : pHandler->AddComponent(new AliHLTVZERORecoComponent);
137 :
138 3 : return 0;
139 3 : }
140 :
141 : // #################################################################################
142 : Int_t AliHLTVZEROAgent::GetHandlerDescription(AliHLTComponentDataType dt, AliHLTUInt32_t spec,
143 : AliHLTOUTHandlerDesc& desc) const {
144 : // see header file for class documentation
145 0 : if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginVZERO)) {
146 0 : desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
147 0 : HLTInfo("module %s handles data block type %s specification %d (0x%x)",
148 : GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
149 0 : return 1;
150 : }
151 :
152 : // add TObject data blocks of type {ESD_CONT:VZRO} to ESD
153 0 : if (dt==(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO)) {
154 0 : desc=AliHLTOUTHandlerDesc(kEsd, dt, GetModuleId());
155 0 : HLTInfo("module %s handles data block type %s specification %d (0x%x)",
156 : GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
157 0 : return 1;
158 : }
159 :
160 0 : return 0;
161 0 : }
162 :
163 : // #################################################################################
164 : AliHLTOUTHandler* AliHLTVZEROAgent::GetOutputHandler(AliHLTComponentDataType dt,
165 : AliHLTUInt32_t /*spec*/) {
166 : // see header file for class documentation
167 0 : if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginVZERO)) {
168 : // use the default handler
169 0 : static AliHLTOUTHandlerEquId handler;
170 0 : return &handler;
171 : }
172 :
173 0 : if (dt==(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO)) {
174 : // use AliHLTOUTHandlerEsdBranch handler to add the TObject
175 : // to the ESD branch
176 : // Note: the object should have an appropriate name returned
177 : // by GetName(). Use SetName() to prepare the object before streaming
178 0 : static AliHLTOUTHandlerEsdBranch handler;
179 0 : return &handler;
180 : }
181 :
182 0 : return NULL;
183 0 : }
184 :
185 : // #################################################################################
186 : Int_t AliHLTVZEROAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance) {
187 : // see header file for class documentation
188 0 : if (pInstance==NULL) return -EINVAL;
189 :
190 : // nothing to delete, the handler have been defined static
191 0 : return 0;
192 0 : }
193 :
194 : // #################################################################################
195 : AliHLTModulePreprocessor* AliHLTVZEROAgent::GetPreprocessor() {
196 : // see header file for class documentation
197 0 : ALIHLTERRORGUARD(5, "GtePreProcessor not implemented for this module");
198 0 : return NULL;
199 0 : }
|