]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/ZDC/AliHLTZDCAgent.cxx
Masking of not calibrated chambers
[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
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 int AliHLTZDCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
62                                          AliRawReader* rawReader,
63                                          AliRunLoader* runloader) const
64 {
65   // see header file for class documentation
66
67   if (!handler) 
68     return -EINVAL;
69
70   if (rawReader || !runloader) {
71     // AliSimulation: use the AliRawReaderPublisher if the raw reader is available
72     // Alireconstruction: indicated by runloader==NULL, run always on raw data
73
74     // -- Define the ZDC raw publisher
75     // -----------------------------------
76     TString arg("-equipmentid 3840 -datatype 'DDL_RAW ' 'ZDC ' -dataspec 0x01");
77     handler->CreateConfiguration("ZDC-DP_0", "AliRawReaderPublisher", NULL , arg.Data());
78
79     // -- Define the VZERO reconstruction components
80     // -----------------------------------------------
81     handler->CreateConfiguration("ZDC-RECO", "ZDCESDReco", "ZDC-DP_0", "");
82   }
83   else if (runloader && !rawReader) {
84     // indicates AliSimulation with no RawReader available -> run on digits
85     
86     /* NOT Tested/ implemented yet
87       handler->CreateConfiguration("DigitPublisher","AliLoaderPublisher",NULL,
88       "-loader ZDCLoader -datatype 'ALITREED' 'ZDC '");
89       handler->CreateConfiguration("Digit","ZDCReconstruction","DigitPublisher","");
90     */
91   }
92   
93   return 0;
94 }
95
96 const char* AliHLTZDCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
97                                                     AliRunLoader* /*runloader*/) const
98 {
99   // see header file for class documentation
100   
101   // ZDC called only from the EsdConverter
102   return NULL;
103 }
104
105 const char* AliHLTZDCAgent::GetRequiredComponentLibraries() const
106 {
107   // see header file for class documentation
108   return "libAliHLTUtil.so libAliHLTZDC.so";
109 }
110
111 int AliHLTZDCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
112 {
113   // see header file for class documentation
114   assert(pHandler);
115   if (!pHandler) return -EINVAL;
116   pHandler->AddComponent(new AliHLTZDCESDRecoComponent);
117
118   return 0;
119 }
120
121 int AliHLTZDCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
122                                              AliHLTUInt32_t spec,
123                                              AliHLTOUTHandlerDesc& desc) const
124 {
125   // see header file for class documentation
126   if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginZDC)) {
127       desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
128       HLTInfo("module %s handles data block type %s specification %d (0x%x)", 
129               GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
130       return 1;
131   }
132
133   // add TObject data blocks of type {ESD_CONT:ZDC } to ESD
134   if (dt==(kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC)) {
135       desc=AliHLTOUTHandlerDesc(kEsd, dt, GetModuleId());
136       HLTInfo("module %s handles data block type %s specification %d (0x%x)", 
137               GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
138       return 1;
139   }
140
141   return 0;
142 }
143
144 AliHLTOUTHandler* AliHLTZDCAgent::GetOutputHandler(AliHLTComponentDataType dt,
145                                                    AliHLTUInt32_t /*spec*/)
146 {
147   // see header file for class documentation
148   if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginZDC)) {
149     // use the default handler
150     static AliHLTOUTHandlerEquId handler;
151     return &handler;
152   }
153
154   if (dt==(kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC)) {
155     // use AliHLTOUTHandlerEsdBranch handler to add the TObject
156     // to the ESD branch
157     // Note: the object should have an appropriate name returned
158     // by GetName(). Use SetName() to prepare the object before streaming
159     static AliHLTOUTHandlerEsdBranch handler;
160     return &handler;
161   }
162
163   return NULL;
164 }
165
166 int AliHLTZDCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
167 {
168   // see header file for class documentation
169   if (pInstance==NULL) return -EINVAL;
170
171   // nothing to delete, the handler have been defined static
172   return 0;
173 }
174
175 // #################################################################################
176 AliHLTModulePreprocessor* AliHLTZDCAgent::GetPreprocessor() {
177   // see header file for class documentation
178   ALIHLTERRORGUARD(5, "GetPreProcessor not implemented for this module");
179   return NULL;
180 }