]>
Commit | Line | Data |
---|---|---|
9e239e96 | 1 | //-*- Mode: C++ -*- |
2 | // $Id: AliHLTZDCESDRecoComponent.cxx $ | |
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: Chiara Oppedisano <Chiara.Oppedisano@to.infn.it> * | |
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 AliHLTZDCESDRecoComponent.cxx | |
20 | @author Chiara Oppedisano <Chiara.Oppedisano@to.infn.it> | |
21 | @brief ZDC reconstruction component | |
22 | */ | |
23 | ||
24 | #if __GNUC__>= 3 | |
25 | using namespace std; | |
26 | #endif | |
27 | ||
28 | #include "AliHLTErrorGuard.h" | |
29 | #include "AliHLTSystem.h" | |
30 | #include "AliHLTZDCESDRecoComponent.h" | |
31 | #include "AliHLTDefinitions.h" | |
32 | #include "AliRawReaderMemory.h" | |
672f9506 | 33 | #include "AliGeomManager.h" |
9e239e96 | 34 | #include "AliGRPObject.h" |
35 | #include "AliZDCReconstructor.h" | |
36 | #include "AliZDCRecoParam.h" | |
37 | #include "AliZDCRecoParampp.h" | |
38 | #include "AliZDCRecoParamPbPb.h" | |
39 | #include "AliESDEvent.h" | |
40 | #include "AliESDZDC.h" | |
41 | #include "AliCDBManager.h" | |
42 | #include "AliHLTDataTypes.h" | |
43 | #include <cstdlib> | |
44 | #include <cerrno> | |
45 | ||
46 | ClassImp(AliHLTZDCESDRecoComponent) | |
47 | ||
48 | //_____________________________________________________________________ | |
49 | AliHLTZDCESDRecoComponent::AliHLTZDCESDRecoComponent() | |
50 | : AliHLTProcessor(), | |
51 | fClusterTree(NULL), | |
52 | fRawReader(NULL), | |
53 | fReconstructor(NULL) | |
54 | { | |
55 | } | |
56 | ||
57 | //_____________________________________________________________________ | |
58 | AliHLTZDCESDRecoComponent::~AliHLTZDCESDRecoComponent() | |
59 | { | |
60 | // see header file for class documentation | |
61 | } | |
62 | ||
63 | //_____________________________________________________________________ | |
64 | const char* AliHLTZDCESDRecoComponent::GetComponentID() | |
65 | { | |
66 | // see header file for class documentation | |
67 | return "ZDCESDReco"; // The ID of this component | |
68 | } | |
69 | ||
70 | //_____________________________________________________________________ | |
71 | void AliHLTZDCESDRecoComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) | |
72 | { | |
73 | // see header file for class documentation | |
74 | list.push_back(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginZDC); | |
75 | } | |
76 | ||
77 | //_____________________________________________________________________ | |
78 | AliHLTComponentDataType AliHLTZDCESDRecoComponent::GetOutputDataType() | |
79 | { | |
80 | return kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC; | |
81 | } | |
82 | ||
83 | //_____________________________________________________________________ | |
84 | void AliHLTZDCESDRecoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
85 | { | |
86 | // see header file for class documentation | |
87 | constBase = 1000; | |
88 | inputMultiplier = 0; | |
89 | } | |
90 | ||
91 | //_____________________________________________________________________ | |
92 | AliHLTComponent* AliHLTZDCESDRecoComponent::Spawn() | |
93 | { | |
94 | // see header file for class documentation | |
95 | return new AliHLTZDCESDRecoComponent; | |
96 | } | |
97 | ||
98 | //_____________________________________________________________________ | |
99 | int AliHLTZDCESDRecoComponent::DoInit( int argc, const char** argv ) | |
100 | { | |
101 | // see header file for class documentation | |
102 | int iResult=0; | |
103 | ||
672f9506 | 104 | // -- Load GeomManager |
105 | if(AliGeomManager::GetGeometry()==NULL){ | |
106 | AliGeomManager::LoadGeometry(); | |
107 | } | |
108 | ||
9e239e96 | 109 | // read configuration object : HLT/ConfigZDC/ |
110 | TString cdbPath="HLT/ConfigZDC/"; | |
111 | cdbPath+=GetComponentID(); | |
112 | iResult=ConfigureFromCDBTObjString(cdbPath); | |
113 | ||
114 | // init stage 3: read the component arguments | |
115 | if (iResult>=0) { | |
116 | iResult=ConfigureFromArgumentString(argc, argv); | |
117 | } | |
118 | ||
119 | // init stage 1: default values for all data members | |
120 | ||
121 | TObject* pOCDBEntry = LoadAndExtractOCDBObject("GRP/GRP/Data"); | |
122 | AliGRPObject* pGRP = pOCDBEntry?dynamic_cast<AliGRPObject*>(pOCDBEntry):NULL; | |
123 | Float_t beamEnergy=0.; | |
124 | if(pGRP) beamEnergy = pGRP->GetBeamEnergy(); | |
672f9506 | 125 | |
9e239e96 | 126 | TString beamType=""; |
127 | if(pGRP) beamType = pGRP->GetBeamType(); | |
128 | ||
129 | // implement the component initialization | |
130 | do { | |
131 | if (iResult<0) break; | |
132 | ||
133 | fReconstructor = new AliZDCReconstructor; | |
134 | if (!fReconstructor) { | |
135 | iResult=-ENOMEM; | |
136 | break; | |
137 | } | |
138 | ||
139 | fRawReader = new AliRawReaderMemory; | |
140 | if (!fRawReader) { | |
141 | iResult=-ENOMEM; | |
142 | break; | |
143 | } | |
144 | ||
145 | fClusterTree = new TTree("TreeR", "Tree for reco points in HLT");; | |
146 | if (!fClusterTree) { | |
147 | iResult=-ENOMEM; | |
148 | break; | |
149 | } | |
150 | ||
151 | // implement further initialization | |
152 | } while (0); | |
153 | ||
154 | if (iResult<0) { | |
155 | // implement cleanup | |
156 | ||
157 | if (fClusterTree) delete fClusterTree; | |
158 | fClusterTree = NULL; | |
159 | ||
160 | if (fRawReader) delete fRawReader; | |
161 | fRawReader = NULL; | |
162 | ||
163 | if (fReconstructor) delete fReconstructor; | |
164 | fReconstructor = NULL; | |
165 | } | |
166 | ||
167 | if (iResult>=0) { | |
168 | if((beamType.CompareTo("p-p"))==0) fReconstructor->SetRecoParam(AliZDCRecoParampp::GetLowFluxParam()); | |
169 | else if((beamType.CompareTo("A-A"))==0) fReconstructor->SetRecoParam(AliZDCRecoParamPbPb::GetHighFluxParam(2*beamEnergy)); | |
170 | else HLTWarning(" Beam type not known by ZDC!"); | |
171 | ||
672f9506 | 172 | if((beamType.CompareTo("A-A"))==0) |
173 | beamEnergy = 2760.; | |
174 | ||
9e239e96 | 175 | fReconstructor->Init(beamType, beamEnergy); |
176 | } | |
177 | ||
178 | return iResult; | |
179 | } | |
180 | ||
181 | //_____________________________________________________________________ | |
182 | int AliHLTZDCESDRecoComponent::ScanConfigurationArgument(int /*argc*/, const char** argv) | |
183 | { | |
184 | // Scan configuration arguments | |
185 | // Return the number of processed arguments | |
186 | // -EPROTO if argument format error (e.g. number expected but not found) | |
187 | // | |
188 | // The AliHLTComponent base class implements a parsing loop for argument strings and | |
189 | // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString | |
190 | // The component needs to implement ScanConfigurationArgument in order to decode the arguments. | |
191 | ||
192 | int i=0; | |
193 | TString argument=argv[i]; | |
194 | ||
195 | if (argument.IsNull()) return 0; | |
196 | ||
197 | return 0; | |
198 | } | |
199 | ||
200 | //_____________________________________________________________________ | |
201 | int AliHLTZDCESDRecoComponent::DoDeinit() | |
202 | { | |
203 | if(fRawReader) delete fRawReader; | |
204 | if(fReconstructor) delete fReconstructor; | |
205 | if(fClusterTree) delete fClusterTree; | |
206 | return 0; | |
207 | } | |
208 | ||
209 | //_____________________________________________________________________ | |
210 | int AliHLTZDCESDRecoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, | |
211 | AliHLTComponentTriggerData& /*trigData*/) | |
212 | { | |
213 | // event processing function | |
214 | int iResult=0; | |
215 | ||
216 | // check if this is a data event, there are a couple of special events | |
217 | // which should be ignored for normal processing | |
218 | if (!IsDataEvent()) return 0; | |
219 | ||
220 | // get ZDC raw input data block and set up the rawreader | |
221 | const AliHLTComponentBlockData* pBlock = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginZDC); | |
222 | if (!pBlock) { | |
672f9506 | 223 | HLTInfo("No ZDC input block !!!"); |
224 | return 0; | |
9e239e96 | 225 | } |
226 | ||
227 | // add input block to raw reader | |
228 | if (!fRawReader->SetMemory((UChar_t*) pBlock->fPtr, pBlock->fSize )){ | |
229 | HLTError("Could not add buffer of data block %s, 0x%08x to rawreader", | |
230 | DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification); | |
231 | iResult = -1; | |
232 | } | |
233 | ||
234 | if (iResult >= 0) { | |
235 | ||
236 | // set ZDC EquipmentID | |
237 | fRawReader->SetEquipmentID(3840); | |
238 | ||
239 | fReconstructor->Reconstruct(fRawReader, fClusterTree); | |
240 | ||
241 | fReconstructor->FillZDCintoESD(fClusterTree, (AliESDEvent *) NULL); | |
242 | ||
243 | // send AliESDZDC | |
244 | PushBack(static_cast<TObject*>(fReconstructor->GetZDCESDData()), | |
245 | kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC,0); | |
246 | ||
247 | } | |
248 | ||
249 | // clear the rawreader | |
250 | fClusterTree->Reset(); | |
251 | fRawReader->ClearBuffers(); | |
252 | ||
253 | return iResult; | |
254 | } | |
255 | ||
256 | ||
257 | //_____________________________________________________________________ | |
258 | int AliHLTZDCESDRecoComponent::Reconfigure(const char* cdbEntry, const char* chainId) | |
259 | { | |
260 | // reconfigure the component from the specified CDB entry, or default CDB entry | |
261 | // function is invoked by the framework if a reconfigure command was received. | |
262 | // | |
263 | int iResult=0; | |
264 | TString cdbPath; | |
265 | if (cdbEntry) { | |
266 | cdbPath=cdbEntry; | |
267 | } else { | |
268 | cdbPath="HLT/ConfigZDC/"; | |
269 | cdbPath+=GetComponentID(); | |
270 | } | |
271 | AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)")); | |
272 | iResult=ConfigureFromCDBTObjString(cdbPath); | |
273 | ||
274 | return iResult; | |
275 | } | |
276 | ||
277 | ||
278 | //_____________________________________________________________________ | |
279 | int AliHLTZDCESDRecoComponent::ReadPreprocessorValues(const char* /*modules*/) | |
280 | { | |
281 | // see header file for class documentation | |
282 | ALIHLTERRORGUARD(5, "ReadPreProcessorValues not implemented for this component"); | |
283 | return 0; | |
284 | } |