]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/ZDC/AliHLTZDCAgent.cxx
ALIROOT-5600 - skip non-participating detector modules
[u/mrichter/AliRoot.git] / HLT / ZDC / AliHLTZDCAgent.cxx
1 //-*- Mode: C++ -*-
2 // $Id$
3
4 /**************************************************************************
5  * This file is property of and copyright by the ALICE HLT Project        * 
6  * ALICE Experiment at CERN, All rights reserved.                         *
7  *                                                                        *
8  * Primary Authors: Chiara Oppedisano <Chiara.Oppedisano@to.infn.it>      *
9  *                  for The ALICE HLT Project.                            *
10  *                                                                        *
11  * Permission to use, copy, modify and distribute this software and its   *
12  * documentation strictly for non-commercial purposes is hereby granted   *
13  * without fee, provided that the above copyright notice appears in all   *
14  * copies and that both the copyright notice and this permission notice   *
15  * appear in the supporting documentation. The authors make no claims     *
16  * about the suitability of this software for any purpose. It is          *
17  * provided "as is" without express or implied warranty.                  *
18  **************************************************************************/
19
20 /** @file   AliHLTZDCAgent.cxx
21     @author Chiara Oppedisano <Chiara.Oppedisano@to.infn.it>
22     @brief  Agent of the libAliHLTZDC library
23 */
24
25 #include <cassert>
26
27 #include "TSystem.h"
28 #include "AliDAQ.h"
29 #include "AliHLTZDCAgent.h"
30
31 #include "AliHLTErrorGuard.h"
32
33 // header files of library components
34 #include "AliHLTZDCESDRecoComponent.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 AliHLTZDCAgent gAliHLTZDCAgent;
42
43 /** ROOT macro for the implementation of ROOT specific class methods */
44 ClassImp(AliHLTZDCAgent)
45
46 AliHLTZDCAgent::AliHLTZDCAgent()  :
47   AliHLTModuleAgent("ZDC")
48 {
49   // see header file for class documentation
50   // or
51   // refer to README to build package
52   // or
53   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
54 }
55
56 AliHLTZDCAgent::~AliHLTZDCAgent()
57 {
58   // see header file for class documentation
59 }
60
61 UInt_t AliHLTZDCAgent::GetDetectorMask() const
62 {
63   return AliDAQ::kZDC;
64 }
65
66 int AliHLTZDCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
67                                          AliRawReader* rawReader,
68                                          AliRunLoader* runloader) const
69 {
70   // see header file for class documentation
71
72   if (!handler) 
73     return -EINVAL;
74
75   if (rawReader || !runloader) {
76     // AliSimulation: use the AliRawReaderPublisher if the raw reader is available
77     // Alireconstruction: indicated by runloader==NULL, run always on raw data
78
79     // -- Define the ZDC raw publisher
80     // -----------------------------------
81     TString arg("-equipmentid 3840 -datatype 'DDL_RAW ' 'ZDC ' -dataspec 0x01");
82     handler->CreateConfiguration("ZDC-DP_0", "AliRawReaderPublisher", NULL , arg.Data());
83
84     // -- Define the VZERO reconstruction components
85     // -----------------------------------------------
86     handler->CreateConfiguration("ZDC-RECO", "ZDCESDReco", "ZDC-DP_0", "");
87   }
88   else if (runloader && !rawReader) {
89     // indicates AliSimulation with no RawReader available -> run on digits
90     
91     /* NOT Tested/ implemented yet
92       handler->CreateConfiguration("DigitPublisher","AliLoaderPublisher",NULL,
93       "-loader ZDCLoader -datatype 'ALITREED' 'ZDC '");
94       handler->CreateConfiguration("Digit","ZDCReconstruction","DigitPublisher","");
95     */
96   }
97   
98   return 0;
99 }
100
101 const char* AliHLTZDCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
102                                                     AliRunLoader* /*runloader*/) const
103 {
104   // see header file for class documentation
105   
106   // ZDC called only from the EsdConverter
107   return NULL;
108 }
109
110 const char* AliHLTZDCAgent::GetRequiredComponentLibraries() const
111 {
112   // see header file for class documentation
113   return "libAliHLTUtil.so libAliHLTZDC.so";
114 }
115
116 int AliHLTZDCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
117 {
118   // see header file for class documentation
119   assert(pHandler);
120   if (!pHandler) return -EINVAL;
121   pHandler->AddComponent(new AliHLTZDCESDRecoComponent);
122
123   return 0;
124 }
125
126 int AliHLTZDCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
127                                              AliHLTUInt32_t spec,
128                                              AliHLTOUTHandlerDesc& desc) const
129 {
130   // see header file for class documentation
131   if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginZDC)) {
132       desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
133       HLTInfo("module %s handles data block type %s specification %d (0x%x)", 
134               GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
135       return 1;
136   }
137
138   // add TObject data blocks of type {ESD_CONT:ZDC } to ESD
139   if (dt==(kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC)) {
140       desc=AliHLTOUTHandlerDesc(kEsd, dt, GetModuleId());
141       HLTInfo("module %s handles data block type %s specification %d (0x%x)", 
142               GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
143       return 1;
144   }
145
146   return 0;
147 }
148
149 AliHLTOUTHandler* AliHLTZDCAgent::GetOutputHandler(AliHLTComponentDataType dt,
150                                                    AliHLTUInt32_t /*spec*/)
151 {
152   // see header file for class documentation
153   if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginZDC)) {
154     // use the default handler
155     static AliHLTOUTHandlerEquId handler;
156     return &handler;
157   }
158
159   if (dt==(kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC)) {
160     // use AliHLTOUTHandlerEsdBranch handler to add the TObject
161     // to the ESD branch
162     // Note: the object should have an appropriate name returned
163     // by GetName(). Use SetName() to prepare the object before streaming
164     static AliHLTOUTHandlerEsdBranch handler;
165     return &handler;
166   }
167
168   return NULL;
169 }
170
171 int AliHLTZDCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
172 {
173   // see header file for class documentation
174   if (pInstance==NULL) return -EINVAL;
175
176   // nothing to delete, the handler have been defined static
177   return 0;
178 }
179
180 // #################################################################################
181 AliHLTModulePreprocessor* AliHLTZDCAgent::GetPreprocessor() {
182   // see header file for class documentation
183   ALIHLTERRORGUARD(5, "GetPreProcessor not implemented for this module");
184   return NULL;
185 }