]>
Commit | Line | Data |
---|---|---|
a1408c4b | 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: Matthias Richter <Matthias.Richter@ift.uib.no> * | |
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 | ||
a0b62fd1 | 19 | // @file AliHLTGlobalEsdConverterComponent.cxx |
20 | // @author Matthias Richter | |
21 | // @date | |
22 | // @brief Global ESD converter component. | |
23 | // | |
a1408c4b | 24 | |
25 | // see header file for class documentation | |
26 | // or | |
27 | // refer to README to build package | |
28 | // or | |
29 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
30 | ||
31 | #include <cassert> | |
32 | #include "AliHLTGlobalEsdConverterComponent.h" | |
33 | #include "AliHLTGlobalBarrelTrack.h" | |
34 | #include "AliHLTExternalTrackParam.h" | |
093b64dc | 35 | #include "AliHLTTrackMCLabel.h" |
6117ef63 | 36 | #include "AliHLTCTPData.h" |
331d51c5 | 37 | #include "AliHLTErrorGuard.h" |
a1408c4b | 38 | #include "AliESDEvent.h" |
39 | #include "AliESDtrack.h" | |
f064ef44 | 40 | #include "AliESDMuonTrack.h" |
fe0324de | 41 | #include "AliESDMuonCluster.h" |
a1408c4b | 42 | #include "AliCDBEntry.h" |
43 | #include "AliCDBManager.h" | |
18ada816 | 44 | #include "AliPID.h" |
a1408c4b | 45 | #include "TTree.h" |
46 | #include "TList.h" | |
f064ef44 | 47 | #include "TClonesArray.h" |
9a9467ed | 48 | #include "AliHLTESDCaloClusterMaker.h" |
49 | #include "AliHLTCaloClusterDataStruct.h" | |
50 | #include "AliHLTCaloClusterReader.h" | |
51 | #include "AliESDCaloCluster.h" | |
331d51c5 | 52 | #include "AliESDVZERO.h" |
d9386025 | 53 | #include "AliHLTGlobalVertexerComponent.h" |
b7449dbe | 54 | #include "AliHLTVertexFinderBase.h" |
a1408c4b | 55 | |
56 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
57 | ClassImp(AliHLTGlobalEsdConverterComponent) | |
58 | ||
59 | AliHLTGlobalEsdConverterComponent::AliHLTGlobalEsdConverterComponent() | |
60 | : AliHLTProcessor() | |
a1408c4b | 61 | , fWriteTree(0) |
093b64dc | 62 | , fVerbosity(0) |
8b7a0f3c | 63 | , fESD(NULL) |
a8714ffa | 64 | , fSolenoidBz(-5.00668) |
57a4102f | 65 | , fBenchmark("EsdConverter") |
a1408c4b | 66 | { |
67 | // see header file for class documentation | |
68 | // or | |
69 | // refer to README to build package | |
70 | // or | |
71 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
72 | } | |
73 | ||
74 | AliHLTGlobalEsdConverterComponent::~AliHLTGlobalEsdConverterComponent() | |
75 | { | |
76 | // see header file for class documentation | |
77 | if (fESD) delete fESD; | |
78 | fESD=NULL; | |
79 | } | |
80 | ||
81 | int AliHLTGlobalEsdConverterComponent::Configure(const char* arguments) | |
82 | { | |
83 | // see header file for class documentation | |
84 | int iResult=0; | |
85 | if (!arguments) return iResult; | |
86 | ||
87 | TString allArgs=arguments; | |
88 | TString argument; | |
89 | int bMissingParam=0; | |
90 | ||
91 | TObjArray* pTokens=allArgs.Tokenize(" "); | |
92 | if (pTokens) { | |
93 | for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) { | |
d7d775b6 | 94 | argument=((TObjString*)pTokens->At(i))->String(); |
a1408c4b | 95 | if (argument.IsNull()) continue; |
96 | ||
97 | if (argument.CompareTo("-solenoidBz")==0) { | |
98 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
75970b8d | 99 | HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz()); |
a1408c4b | 100 | continue; |
101 | } else { | |
102 | HLTError("unknown argument %s", argument.Data()); | |
103 | iResult=-EINVAL; | |
104 | break; | |
105 | } | |
106 | } | |
107 | delete pTokens; | |
108 | } | |
109 | if (bMissingParam) { | |
110 | HLTError("missing parameter for argument %s", argument.Data()); | |
111 | iResult=-EINVAL; | |
112 | } | |
113 | ||
114 | return iResult; | |
115 | } | |
116 | ||
117 | int AliHLTGlobalEsdConverterComponent::Reconfigure(const char* cdbEntry, const char* chainId) | |
118 | { | |
119 | // see header file for class documentation | |
120 | int iResult=0; | |
75970b8d | 121 | const char* path=NULL; |
a1408c4b | 122 | const char* defaultNotify=""; |
123 | if (cdbEntry) { | |
124 | path=cdbEntry; | |
125 | defaultNotify=" (default)"; | |
126 | } | |
127 | if (path) { | |
128 | HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>"); | |
129 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); | |
130 | if (pEntry) { | |
131 | TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject()); | |
132 | if (pString) { | |
d7d775b6 | 133 | HLTInfo("received configuration object string: \'%s\'", pString->String().Data()); |
134 | iResult=Configure(pString->String().Data()); | |
a1408c4b | 135 | } else { |
136 | HLTError("configuration object \"%s\" has wrong type, required TObjString", path); | |
137 | } | |
138 | } else { | |
139 | HLTError("can not fetch object \"%s\" from CDB", path); | |
140 | } | |
141 | } | |
142 | ||
143 | return iResult; | |
144 | } | |
145 | ||
146 | void AliHLTGlobalEsdConverterComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) | |
147 | { | |
148 | // see header file for class documentation | |
149 | list.push_back(kAliHLTDataTypeTrack); | |
150 | list.push_back(kAliHLTDataTypeTrackMC); | |
9a9467ed | 151 | list.push_back(kAliHLTDataTypeCaloCluster); |
0973c527 | 152 | list.push_back(kAliHLTDataTypedEdx ); |
7f167a74 | 153 | list.push_back(kAliHLTDataTypeESDVertex ); |
f064ef44 | 154 | list.push_back(kAliHLTDataTypeESDObject); |
155 | list.push_back(kAliHLTDataTypeTObject); | |
d9963894 | 156 | list.push_back(kAliHLTDataTypeGlobalVertexer); |
b7449dbe | 157 | list.push_back(kAliHLTDataTypeV0Finder); // array of track ids for V0s |
158 | list.push_back(kAliHLTDataTypeKFVertex); // KFVertex object from vertexer | |
159 | list.push_back(kAliHLTDataTypePrimaryFinder); // array of track ids for prim vertex | |
331d51c5 | 160 | list.push_back(kAliHLTDataTypeESDContent); |
a1408c4b | 161 | } |
162 | ||
163 | AliHLTComponentDataType AliHLTGlobalEsdConverterComponent::GetOutputDataType() | |
164 | { | |
165 | // see header file for class documentation | |
7a9de6d1 | 166 | return kAliHLTDataTypeESDObject|kAliHLTDataOriginOut; |
a1408c4b | 167 | } |
168 | ||
169 | void AliHLTGlobalEsdConverterComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) | |
170 | { | |
171 | // see header file for class documentation | |
172 | constBase=2000000; | |
173 | inputMultiplier=10.0; | |
174 | } | |
175 | ||
176 | int AliHLTGlobalEsdConverterComponent::DoInit(int argc, const char** argv) | |
177 | { | |
178 | // see header file for class documentation | |
179 | int iResult=0; | |
180 | TString argument=""; | |
181 | int bMissingParam=0; | |
a1408c4b | 182 | |
d57fc872 | 183 | // default list of skiped ESD objects |
184 | TString skipObjects= | |
185 | // "AliESDRun," | |
186 | // "AliESDHeader," | |
421e1221 | 187 | // "AliESDZDC," |
d57fc872 | 188 | "AliESDFMD," |
189 | // "AliESDVZERO," | |
190 | // "AliESDTZERO," | |
191 | // "TPCVertex," | |
192 | // "SPDVertex," | |
193 | // "PrimaryVertex," | |
194 | // "AliMultiplicity," | |
195 | // "PHOSTrigger," | |
196 | // "EMCALTrigger," | |
197 | // "SPDPileupVertices," | |
198 | // "TrkPileupVertices," | |
199 | "Cascades," | |
200 | "Kinks," | |
201 | "AliRawDataErrorLogs," | |
202 | "AliESDACORDE"; | |
203 | ||
f167b631 | 204 | iResult=Reconfigure(NULL, NULL); |
205 | TString allArgs = ""; | |
206 | for ( int i = 0; i < argc; i++ ) { | |
207 | if ( !allArgs.IsNull() ) allArgs += " "; | |
208 | allArgs += argv[i]; | |
209 | } | |
a1408c4b | 210 | |
f167b631 | 211 | TObjArray* pTokens=allArgs.Tokenize(" "); |
212 | if (pTokens) { | |
213 | for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) { | |
d7d775b6 | 214 | argument=((TObjString*)pTokens->At(i))->String(); |
f167b631 | 215 | if (argument.IsNull()) continue; |
216 | ||
217 | // -notree | |
218 | if (argument.CompareTo("-notree")==0) { | |
219 | fWriteTree=0; | |
220 | ||
221 | // -tree | |
222 | } else if (argument.CompareTo("-tree")==0) { | |
223 | fWriteTree=1; | |
224 | } else if (argument.CompareTo("-solenoidBz")==0) { | |
225 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
d7d775b6 | 226 | HLTInfo("Magnetic Field set to: %s", ((TObjString*)pTokens->At(i))->String().Data()); |
d57fc872 | 227 | HLTWarning("argument '-solenoidBz' is deprecated, solenoid field initiaized from CDB settings"); |
f167b631 | 228 | continue; |
d57fc872 | 229 | } else if (argument.Contains("-skipobject=")) { |
230 | argument.ReplaceAll("-skipobject=", ""); | |
231 | skipObjects=argument; | |
f167b631 | 232 | } else { |
233 | HLTError("unknown argument %s", argument.Data()); | |
d57fc872 | 234 | iResult=-EINVAL; |
f167b631 | 235 | break; |
236 | } | |
a1408c4b | 237 | } |
238 | } | |
239 | if (bMissingParam) { | |
240 | HLTError("missing parameter for argument %s", argument.Data()); | |
241 | iResult=-EINVAL; | |
242 | } | |
243 | ||
75970b8d | 244 | fSolenoidBz=GetBz(); |
245 | ||
a1408c4b | 246 | if (iResult>=0) { |
247 | fESD = new AliESDEvent; | |
248 | if (fESD) { | |
249 | fESD->CreateStdContent(); | |
d57fc872 | 250 | |
251 | // remove some of the objects which are not needed | |
252 | if (fESD->GetList() && !skipObjects.IsNull()) { | |
253 | pTokens=skipObjects.Tokenize(","); | |
254 | if (pTokens) { | |
255 | const char* id=NULL; | |
256 | TIter next(pTokens); | |
257 | TObject* pObject=NULL; | |
258 | while ((pObject=next())!=NULL) { | |
d7d775b6 | 259 | id=((TObjString*)pObject)->String().Data(); |
a0b62fd1 | 260 | TObject* pObj=fESD->GetList()->FindObject(id); |
261 | if (pObj) { | |
d57fc872 | 262 | HLTDebug("removing object %s", id); |
a0b62fd1 | 263 | fESD->GetList()->Remove(pObj); |
264 | delete pObj; | |
d57fc872 | 265 | } else { |
266 | HLTWarning("failed to remove object '%s' from ESD", id); | |
267 | } | |
268 | } | |
d57fc872 | 269 | fESD->GetStdContent(); |
270 | delete pTokens; | |
271 | } | |
272 | } | |
a1408c4b | 273 | } else { |
274 | iResult=-ENOMEM; | |
275 | } | |
6117ef63 | 276 | |
277 | SetupCTPData(); | |
a1408c4b | 278 | } |
279 | ||
57a4102f | 280 | fBenchmark.SetTimer(0,"total"); |
281 | ||
a1408c4b | 282 | return iResult; |
283 | } | |
284 | ||
285 | int AliHLTGlobalEsdConverterComponent::DoDeinit() | |
286 | { | |
287 | // see header file for class documentation | |
288 | if (fESD) delete fESD; | |
289 | fESD=NULL; | |
290 | ||
291 | return 0; | |
292 | } | |
293 | ||
294 | int AliHLTGlobalEsdConverterComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, | |
6117ef63 | 295 | AliHLTComponentTriggerData& trigData) |
a1408c4b | 296 | { |
297 | // see header file for class documentation | |
298 | int iResult=0; | |
299 | if (!fESD) return -ENODEV; | |
300 | ||
57a4102f | 301 | if (IsDataEvent()) fBenchmark.StartNewEvent(); |
302 | fBenchmark.Start(0); | |
303 | ||
a1408c4b | 304 | AliESDEvent* pESD = fESD; |
305 | ||
306 | pESD->Reset(); | |
307 | pESD->SetMagneticField(fSolenoidBz); | |
6117ef63 | 308 | pESD->SetRunNumber(GetRunNo()); |
6700298e | 309 | pESD->SetPeriodNumber(GetPeriodNumber()); |
310 | pESD->SetOrbitNumber(GetOrbitNumber()); | |
311 | pESD->SetBunchCrossNumber(GetBunchCrossNumber()); | |
312 | pESD->SetTimeStamp(GetTimeStamp()); | |
a1408c4b | 313 | |
6117ef63 | 314 | const AliHLTCTPData* pCTPData=CTPData(); |
315 | if (pCTPData) { | |
16e6f752 | 316 | AliHLTTriggerMask_t mask=pCTPData->ActiveTriggers(trigData); |
6117ef63 | 317 | for (int index=0; index<gkNCTPTriggerClasses; index++) { |
16e6f752 | 318 | if ((mask&(AliHLTTriggerMask_t(0x1)<<index)) == 0) continue; |
6117ef63 | 319 | pESD->SetTriggerClass(pCTPData->Name(index), index); |
320 | } | |
16e6f752 | 321 | //first 50 triggers |
322 | AliHLTTriggerMask_t mask50; | |
323 | mask50.set(); // set all bits | |
324 | mask50 >>= 50; // shift 50 right | |
325 | pESD->SetTriggerMask((mask&mask50).to_ulong()); | |
326 | /* next 50, to be implemented | |
327 | pESD->SetTriggerMaskNext50((mask>>50).to_ulong()); | |
328 | */ | |
6117ef63 | 329 | } |
330 | ||
a1408c4b | 331 | TTree* pTree = NULL; |
332 | if (fWriteTree) | |
333 | pTree = new TTree("esdTree", "Tree with HLT ESD objects"); | |
334 | ||
335 | if (pTree) { | |
336 | pTree->SetDirectory(0); | |
337 | } | |
338 | ||
81509fd3 | 339 | if ((iResult=ProcessBlocks(pTree, pESD))>=0) { |
a1408c4b | 340 | // TODO: set the specification correctly |
341 | if (pTree) { | |
342 | // the esd structure is written to the user info and is | |
343 | // needed in te ReadFromTree method to read all objects correctly | |
344 | pTree->GetUserInfo()->Add(pESD); | |
345 | pESD->WriteToTree(pTree); | |
7a9de6d1 | 346 | iResult=PushBack(pTree, kAliHLTDataTypeESDTree|kAliHLTDataOriginOut, 0); |
a1408c4b | 347 | } else { |
7a9de6d1 | 348 | iResult=PushBack(pESD, kAliHLTDataTypeESDObject|kAliHLTDataOriginOut, 0); |
a1408c4b | 349 | } |
57a4102f | 350 | fBenchmark.AddOutput(GetLastObjectSize()); |
a1408c4b | 351 | } |
352 | if (pTree) { | |
353 | // clear user info list to prevent objects from being deleted | |
354 | pTree->GetUserInfo()->Clear(); | |
355 | delete pTree; | |
356 | } | |
57a4102f | 357 | |
358 | fBenchmark.Stop(0); | |
359 | HLTInfo( fBenchmark.GetStatistics() ); | |
360 | ||
a1408c4b | 361 | return iResult; |
362 | } | |
363 | ||
364 | int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent* pESD) | |
365 | { | |
366 | // see header file for class documentation | |
367 | ||
368 | int iResult=0; | |
369 | int iAddedDataBlocks=0; | |
370 | ||
b7449dbe | 371 | // check if there is an ESD block in the input and copy its content first to the |
372 | // ESD | |
373 | const TObject* pEsdObj = GetFirstInputObject(kAliHLTDataTypeESDObject, "AliESDEvent"); | |
374 | AliESDEvent* pInputESD=NULL; | |
375 | if (pEsdObj) pInputESD=dynamic_cast<AliESDEvent*>(const_cast<TObject*>(pEsdObj)); | |
376 | if (pInputESD) { | |
377 | pInputESD->GetStdContent(); | |
378 | *pESD=*pInputESD; | |
379 | } | |
380 | if (GetNextInputObject()!=NULL) { | |
381 | HLTWarning("handling of multiple ESD input objects not implemented, skipping input"); | |
382 | } | |
383 | ||
a1408c4b | 384 | // Barrel tracking |
e85f2e31 | 385 | // tracks are based on the TPC tracks, and only updated from the ITS information |
386 | // Sequence: | |
387 | // 1) extract MC information for TPC and ITS from specific data blocks and store in | |
388 | // intermediate vector arrays | |
389 | // 2) extract TPC tracks, update with MC labels if available, the track parameters | |
390 | // are estimated at the first cluster position | |
391 | // 2.1) propagate to last cluster position and update kTPCout, sets also outer param (fOp) | |
392 | // 2.2) update kTPCin, sets also inner param (fIp) and TPC inner param (fTPCInner) | |
393 | // 2.3) update kTPCrefit using the same parameters at the first cluster position | |
394 | // HLT has strictly spoking no refit, but we want the flag to be set | |
395 | // can be changed to be done after all the individual barrel detector parameters | |
396 | // have been updated by looping over the tracks again | |
397 | // 3) extract ITS tracks, the tracks are actually TPC tracks updated from the ITS | |
398 | // tracking information | |
399 | // 3.1) TODO 2010-07-12: handle ITS standalone tracks by updating kITSout before kITSin | |
400 | // 3.2) update with kITSin | |
401 | // TODO 2010-07-12 find out if the kITSrefit has to be set as well | |
402 | // 4) extract TRD tracks and add to ESD | |
403 | // TODO 2010-07-12 at the moment there is no matching or merging of TPC and TRD tracks | |
331d51c5 | 404 | // 5) Add Trigger Detectors |
405 | // VZERO, ZDC | |
e85f2e31 | 406 | |
407 | // 1) first read MC information (if present) | |
eb60b0c1 | 408 | std::map<int,int> mcLabelsTPC; |
d72d9d99 | 409 | std::map<int,int> mcLabelsITS; |
093b64dc | 410 | |
411 | for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrackMC|kAliHLTDataOriginTPC); | |
412 | pBlock!=NULL; pBlock=GetNextInputBlock()) { | |
57a4102f | 413 | |
414 | fBenchmark.AddInput(pBlock->fSize); | |
415 | ||
093b64dc | 416 | AliHLTTrackMCData* dataPtr = reinterpret_cast<AliHLTTrackMCData*>( pBlock->fPtr ); |
417 | if (sizeof(AliHLTTrackMCData)+dataPtr->fCount*sizeof(AliHLTTrackMCLabel)==pBlock->fSize) { | |
418 | for( unsigned int il=0; il<dataPtr->fCount; il++ ){ | |
419 | AliHLTTrackMCLabel &lab = dataPtr->fLabels[il]; | |
eb60b0c1 | 420 | mcLabelsTPC[lab.fTrackID] = lab.fMCLabel; |
093b64dc | 421 | } |
422 | } else { | |
423 | HLTWarning("data mismatch in block %s (0x%08x): count %d, size %d -> ignoring track MC information", | |
424 | DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification, | |
425 | dataPtr->fCount, pBlock->fSize); | |
426 | } | |
427 | } | |
d72d9d99 | 428 | |
429 | for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrackMC|kAliHLTDataOriginITS); | |
430 | pBlock!=NULL; pBlock=GetNextInputBlock()) { | |
431 | ||
432 | fBenchmark.AddInput(pBlock->fSize); | |
433 | ||
434 | AliHLTTrackMCData* dataPtr = reinterpret_cast<AliHLTTrackMCData*>( pBlock->fPtr ); | |
435 | if (sizeof(AliHLTTrackMCData)+dataPtr->fCount*sizeof(AliHLTTrackMCLabel)==pBlock->fSize) { | |
436 | for( unsigned int il=0; il<dataPtr->fCount; il++ ){ | |
437 | AliHLTTrackMCLabel &lab = dataPtr->fLabels[il]; | |
438 | mcLabelsITS[lab.fTrackID] = lab.fMCLabel; | |
439 | } | |
440 | } else { | |
441 | HLTWarning("data mismatch in block %s (0x%08x): count %d, size %d -> ignoring track MC information", | |
442 | DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification, | |
443 | dataPtr->fCount, pBlock->fSize); | |
444 | } | |
445 | } | |
446 | ||
093b64dc | 447 | |
0973c527 | 448 | // read dEdx information (if present) |
e85f2e31 | 449 | // TODO 2010-07-12 this needs to be verified |
0973c527 | 450 | |
451 | AliHLTFloat32_t *dEdxTPC = 0; | |
452 | Int_t ndEdxTPC = 0; | |
453 | for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypedEdx|kAliHLTDataOriginTPC); | |
e38918a2 | 454 | pBlock!=NULL; pBlock=NULL/*GetNextInputBlock() there is only one block*/) { |
57a4102f | 455 | fBenchmark.AddInput(pBlock->fSize); |
0973c527 | 456 | dEdxTPC = reinterpret_cast<AliHLTFloat32_t*>( pBlock->fPtr ); |
72a916d9 | 457 | ndEdxTPC = pBlock->fSize / (3*sizeof(AliHLTFloat32_t)); |
0973c527 | 458 | } |
459 | ||
e85f2e31 | 460 | // 2) convert the TPC tracks to ESD tracks |
a1408c4b | 461 | for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginTPC); |
462 | pBlock!=NULL; pBlock=GetNextInputBlock()) { | |
b7449dbe | 463 | if (pInputESD && pInputESD->GetNumberOfTracks()>0) { |
464 | HLTWarning("Tracks array already filled from the input esd block, additional filling from TPC tracks block might cause inconsistent content"); | |
465 | } | |
57a4102f | 466 | fBenchmark.AddInput(pBlock->fSize); |
a1408c4b | 467 | vector<AliHLTGlobalBarrelTrack> tracks; |
81509fd3 | 468 | if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>=0) { |
a1408c4b | 469 | for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin(); |
470 | element!=tracks.end(); element++) { | |
471 | Float_t points[4] = { | |
2cb809a5 | 472 | static_cast<Float_t>(element->GetX()), |
473 | static_cast<Float_t>(element->GetY()), | |
474 | static_cast<Float_t>(element->GetLastPointX()), | |
475 | static_cast<Float_t>(element->GetLastPointY()) | |
a1408c4b | 476 | }; |
093b64dc | 477 | |
478 | Int_t mcLabel = -1; | |
eb60b0c1 | 479 | if( mcLabelsTPC.find(element->TrackID())!=mcLabelsTPC.end() ) |
480 | mcLabel = mcLabelsTPC[element->TrackID()]; | |
093b64dc | 481 | element->SetLabel( mcLabel ); |
482 | ||
a1408c4b | 483 | AliESDtrack iotrack; |
550ecaab | 484 | |
485 | // for the moment, the number of clusters are not set when processing the | |
486 | // kTPCin update, only at kTPCout | |
487 | // there ar emainly three parameters updated for kTPCout | |
488 | // number of clusters | |
489 | // chi2 | |
490 | // pid signal | |
491 | // The first one can be updated already at that stage here, while the two others | |
492 | // eventually require to update from the ITS tracks before. The exact scheme | |
ab700b08 | 493 | // needs to be checked |
c3261a7d | 494 | iotrack.SetID( element->TrackID() ); |
e85f2e31 | 495 | |
496 | // 2.1 set kTPCout | |
497 | // TODO 2010-07-12 disabled for the moment because of bug | |
498 | // https://savannah.cern.ch/bugs/index.php?69875 | |
499 | // the propagation does not work, there is an offset in z | |
500 | // propagate to last cluster and update parameters with flag kTPCout | |
501 | // Note: updating with flag kITSout further down will overwrite the outer | |
502 | // parameter again so this can be done only for ITS standalone tracks, meaning | |
503 | // tracks in the ITS not associated with any TPC track | |
504 | // HLT does not provide such standalone tracking | |
c3261a7d | 505 | { |
f167b631 | 506 | AliHLTGlobalBarrelTrack outPar(*element); |
114e074b | 507 | //outPar.AliExternalTrackParam::PropagateTo( element->GetLastPointX(), fSolenoidBz ); |
508 | const Int_t N=10; // number of steps. | |
509 | const Float_t xRange = element->GetLastPointX() - element->GetX(); | |
510 | const Float_t xStep = xRange / N ; | |
511 | for(int i = 1; i <= N; ++i) { | |
512 | if(!outPar.AliExternalTrackParam::PropagateTo(element->GetX() + xStep * i, fSolenoidBz)) break; | |
513 | } | |
b9838c05 | 514 | outPar.SetLabel(element->GetLabel()); |
114e074b | 515 | iotrack.UpdateTrackParams(&outPar,AliESDtrack::kTPCout); |
c3261a7d | 516 | } |
e85f2e31 | 517 | // 2.2 TPC tracking estimates parameters at first cluster |
ab700b08 | 518 | iotrack.UpdateTrackParams(&(*element),AliESDtrack::kTPCin); |
e85f2e31 | 519 | |
520 | // 2.3 use the same parameters also for kTPCrefit, there is no proper refit in HLT | |
521 | // maybe this can be done later, however also the inner parameter is changed which | |
522 | // is used as a reference point in the display. That point should be at the first | |
523 | // TPC cluster | |
524 | iotrack.UpdateTrackParams(&(*element),AliESDtrack::kTPCrefit); | |
a1408c4b | 525 | iotrack.SetTPCPoints(points); |
0973c527 | 526 | if( element->TrackID()<ndEdxTPC ){ |
72a916d9 | 527 | AliHLTFloat32_t *val = &(dEdxTPC[3*element->TrackID()]); |
5c2dca91 | 528 | iotrack.SetTPCsignal( val[0], val[1], (UChar_t) val[2] ); |
7e32fedf | 529 | //AliTPCseed s; |
530 | //s.Set( element->GetX(), element->GetAlpha(), | |
531 | //element->GetParameter(), element->GetCovariance() ); | |
72a916d9 | 532 | //s.SetdEdx( val[0] ); |
7e32fedf | 533 | //s.CookPID(); |
534 | //iotrack.SetTPCpid(s.TPCrPIDs() ); | |
0973c527 | 535 | } else { |
536 | if( dEdxTPC ) HLTWarning("Wrong number of dEdx TPC labels"); | |
537 | } | |
b9838c05 | 538 | iotrack.SetLabel(mcLabel); |
7fd2e09c | 539 | pESD->AddTrack(&iotrack); |
093b64dc | 540 | if (fVerbosity>0) element->Print(); |
a1408c4b | 541 | } |
093b64dc | 542 | HLTInfo("converted %d track(s) to AliESDtrack and added to ESD", tracks.size()); |
a1408c4b | 543 | iAddedDataBlocks++; |
544 | } else if (iResult<0) { | |
093b64dc | 545 | HLTError("can not extract tracks from data block of type %s (specification %08x) of size %d: error %d", |
546 | DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification, pBlock->fSize, iResult); | |
a1408c4b | 547 | } |
548 | } | |
549 | ||
7f167a74 | 550 | |
551 | // Get ITS SPD vertex | |
57a4102f | 552 | for( const AliHLTComponentBlockData *i= GetFirstInputBlock(kAliHLTDataTypeESDVertex|kAliHLTDataOriginITS); i!=NULL; i=GetNextInputBlock() ){ |
553 | fBenchmark.AddInput(i->fSize); | |
554 | } | |
7f167a74 | 555 | |
556 | for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDVertex|kAliHLTDataOriginITS); iter != NULL; iter = GetNextInputObject() ) { | |
557 | AliESDVertex *vtx = dynamic_cast<AliESDVertex*>(const_cast<TObject*>( iter ) ); | |
558 | pESD->SetPrimaryVertexSPD( vtx ); | |
559 | } | |
560 | ||
e85f2e31 | 561 | // 3.1. now update ESD tracks with the ITSOut info |
562 | // updating track parameters with flag kITSout will overwrite parameter set above with flag kTPCout | |
563 | // TODO 2010-07-12 there are some issues with this updating sequence, for the moment update with | |
564 | // flag kITSout is disabled, would require | |
565 | // a) to update kTPCout after kITSout | |
566 | // b) update only for ITS standalone tracks. The HLT ITS tracker does not provide standalone | |
567 | // tracking, every track is related to a TPC track | |
568 | // Furthermore there seems to be a bug as the data blocks describe track parameters around the | |
569 | // vertex, not at the outer ITS | |
570 | // bug https://savannah.cern.ch/bugs/index.php?69872 | |
f167b631 | 571 | for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginITSOut); |
cd60a73f | 572 | pBlock!=NULL; pBlock=GetNextInputBlock()) { |
57a4102f | 573 | fBenchmark.AddInput(pBlock->fSize); |
cd60a73f | 574 | vector<AliHLTGlobalBarrelTrack> tracks; |
575 | if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>0) { | |
576 | for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin(); | |
577 | element!=tracks.end(); element++) { | |
cd60a73f | 578 | int tpcID=element->TrackID(); |
579 | // the ITS tracker assigns the TPC track used as seed for a certain track to | |
580 | // the trackID | |
581 | if( tpcID<0 || tpcID>=pESD->GetNumberOfTracks()) continue; | |
cd60a73f | 582 | AliESDtrack *tESD = pESD->GetTrack( tpcID ); |
b9838c05 | 583 | element->SetLabel(tESD->GetLabel()); |
e85f2e31 | 584 | // 2010-07-12 disabled, see above, bugfix https://savannah.cern.ch/bugs/index.php?69872 |
585 | //if( tESD ) tESD->UpdateTrackParams( &(*element), AliESDtrack::kITSout ); | |
a1408c4b | 586 | } |
cd60a73f | 587 | } |
588 | } | |
18ada816 | 589 | |
e85f2e31 | 590 | // 3.2. now update ESD tracks with the ITS info |
f167b631 | 591 | for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginITS); |
b7ed2eb4 | 592 | pBlock!=NULL; pBlock=GetNextInputBlock()) { |
57a4102f | 593 | fBenchmark.AddInput(pBlock->fSize); |
b7ed2eb4 | 594 | vector<AliHLTGlobalBarrelTrack> tracks; |
595 | if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>0) { | |
596 | for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin(); | |
597 | element!=tracks.end(); element++) { | |
b7ed2eb4 | 598 | int tpcID=element->TrackID(); |
599 | // the ITS tracker assigns the TPC track used as seed for a certain track to | |
600 | // the trackID | |
601 | if( tpcID<0 || tpcID>=pESD->GetNumberOfTracks()) continue; | |
d72d9d99 | 602 | Int_t mcLabel = -1; |
603 | if( mcLabelsITS.find(element->TrackID())!=mcLabelsITS.end() ) | |
604 | mcLabel = mcLabelsITS[element->TrackID()]; | |
b7ed2eb4 | 605 | AliESDtrack *tESD = pESD->GetTrack( tpcID ); |
b9838c05 | 606 | if (!tESD) continue; |
eb60b0c1 | 607 | // the labels for the TPC and ITS tracking params can be different, e.g. |
608 | // there can be a decay. The ITS label should then be the better one, the | |
609 | // TPC label is saved in a member of AliESDtrack | |
610 | if (mcLabel>=0) { | |
611 | // upadte only if the ITS label is available, otherwise keep TPC label | |
612 | element->SetLabel( mcLabel ); | |
e85f2e31 | 613 | } else { |
614 | // bugfix https://savannah.cern.ch/bugs/?69713 | |
615 | element->SetLabel( tESD->GetLabel() ); | |
b9838c05 | 616 | } |
b9838c05 | 617 | tESD->UpdateTrackParams( &(*element), AliESDtrack::kITSin ); |
618 | ||
619 | // TODO: add a proper refit | |
620 | //tESD->UpdateTrackParams( &(*element), AliESDtrack::kTPCrefit ); | |
b7ed2eb4 | 621 | } |
622 | } | |
623 | } | |
624 | ||
d9386025 | 625 | // update with vertices and vertex-fitted tracks |
b7449dbe | 626 | // output of the GlobalVertexerComponent |
d9386025 | 627 | for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeGlobalVertexer); |
628 | pBlock!=NULL; pBlock=GetNextInputBlock()) { | |
57a4102f | 629 | fBenchmark.AddInput(pBlock->fSize); |
d9386025 | 630 | AliHLTGlobalVertexerComponent::FillESD( pESD, reinterpret_cast<AliHLTGlobalVertexerComponent::AliHLTGlobalVertexerData* >(pBlock->fPtr) ); |
631 | } | |
632 | ||
b7449dbe | 633 | // update with vertices and vertex-fitted tracks |
634 | // output of PrimaryVertexer and V0Finder components | |
635 | TObject* pBase = (TObject*)GetFirstInputObject(kAliHLTDataTypeKFVertex | kAliHLTDataOriginOut); | |
636 | if (pBase) { | |
637 | AliKFVertex* kfVertex = dynamic_cast<AliKFVertex *>(pBase); | |
638 | if (kfVertex) { | |
639 | const AliHLTComponentBlockData* pP = GetFirstInputBlock(kAliHLTDataTypePrimaryFinder | kAliHLTDataOriginOut); | |
640 | if (pP && pP->fSize && pP->fPtr) { | |
641 | const AliHLTComponentBlockData* pV0 = GetFirstInputBlock(kAliHLTDataTypeV0Finder | kAliHLTDataOriginOut); | |
642 | if (pV0 && pV0->fPtr && pInputESD && pInputESD->GetNumberOfV0s()>0) { | |
643 | const int* v0s = static_cast<const int*>(pV0->fPtr); | |
644 | HLTWarning("V0 array already filled from the input esd block, additional filling from V0 block of %d entries might cause inconsistent content", v0s[0]); | |
645 | } | |
646 | AliHLTVertexFinderBase::FillESD(pESD, kfVertex, pP->fPtr, pV0?pV0->fPtr:NULL); | |
647 | } else | |
648 | HLTWarning("Problem with primary finder's data block"); | |
649 | } else { | |
650 | HLTWarning("primary vertex block of wrong type, expecting AliKFVertex instead of %s", pBase->GetName()); | |
651 | } | |
652 | } else { | |
653 | // throw an error if there is a V0 data block which can not be handled without | |
654 | // the AliKFVertex object | |
655 | if (GetFirstInputBlock(kAliHLTDataTypeV0Finder | kAliHLTDataOriginOut)!=NULL) { | |
656 | ALIHLTERRORGUARD(1, "missing AliKFVertex object ignoring V0 data block of type %s", | |
657 | DataType2Text(kAliHLTDataTypeV0Finder|kAliHLTDataOriginOut).c_str()); | |
658 | } | |
659 | } | |
660 | ||
0d2e4e41 | 661 | // Fill DCA parameters for TPC tracks |
e85f2e31 | 662 | // TODO 2010-07-12 this propagates also the TPC inner param to beamline |
663 | // sounds not very reasonable | |
664 | // https://savannah.cern.ch/bugs/index.php?69873 | |
7fd2e09c | 665 | for (int i=0; i<pESD->GetNumberOfTracks(); i++) { |
0d2e4e41 | 666 | if (!pESD->GetTrack(i) || |
667 | !pESD->GetTrack(i)->GetTPCInnerParam() ) continue; | |
7fd2e09c | 668 | pESD->GetTrack(i)->RelateToVertexTPC(pESD->GetPrimaryVertexTracks(), fSolenoidBz, 1000 ); |
0d2e4e41 | 669 | } |
670 | ||
b9838c05 | 671 | // loop over all tracks and set the TPC refit flag by updating with the |
672 | // original TPC inner parameter if not yet set | |
673 | // TODO: replace this by a proper refit | |
674 | // code is comented for the moment as it does not fully solve the problems with | |
675 | // the display | |
e85f2e31 | 676 | // - would set the main parameters to the TPC inner wall again, or |
677 | // - changes the inner param if the parameters are propagated, so we loose the track | |
678 | // reference point for the display | |
679 | // with the current sequence we have the latter case as the DCA operations above | |
680 | // change the TPC inner parameters | |
b9838c05 | 681 | /* |
682 | for (int i=0; i<pESD->GetNumberOfTracks(); i++) { | |
683 | if (!pESD->GetTrack(i) || | |
684 | !pESD->GetTrack(i)->GetTPCInnerParam() || | |
685 | pESD->GetTrack(i)->IsOn(AliESDtrack::kTPCrefit)) continue; | |
686 | AliESDtrack* tESD=pESD->GetTrack(i); | |
687 | AliHLTGlobalBarrelTrack inner(*tESD->GetTPCInnerParam()); | |
688 | inner.SetLabel(tESD->GetLabel()); | |
689 | tESD->UpdateTrackParams(&inner, AliESDtrack::kTPCrefit); | |
690 | } | |
691 | */ | |
b7ed2eb4 | 692 | |
e85f2e31 | 693 | // 4. convert the HLT TRD tracks to ESD tracks |
18ada816 | 694 | for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack | kAliHLTDataOriginTRD); |
695 | pBlock!=NULL; pBlock=GetNextInputBlock()) { | |
57a4102f | 696 | fBenchmark.AddInput(pBlock->fSize); |
18ada816 | 697 | vector<AliHLTGlobalBarrelTrack> tracks; |
698 | if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>0) { | |
699 | for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin(); | |
700 | element!=tracks.end(); element++) { | |
701 | ||
702 | Double_t TRDpid[AliPID::kSPECIES], eProb(0.2), restProb((1-eProb)/(AliPID::kSPECIES-1)); //eprob(element->GetTRDpid...); | |
703 | for(Int_t i=0; i<AliPID::kSPECIES; i++){ | |
704 | switch(i){ | |
705 | case AliPID::kElectron: TRDpid[AliPID::kElectron]=eProb; break; | |
706 | default: TRDpid[i]=restProb; break; | |
707 | } | |
708 | } | |
709 | ||
710 | AliESDtrack iotrack; | |
0d096bba | 711 | iotrack.UpdateTrackParams(&(*element),AliESDtrack::kTRDout); |
0b745718 | 712 | iotrack.SetStatus(AliESDtrack::kTRDin); |
18ada816 | 713 | iotrack.SetTRDpid(TRDpid); |
714 | ||
715 | pESD->AddTrack(&iotrack); | |
716 | if (fVerbosity>0) element->Print(); | |
717 | } | |
718 | HLTInfo("converted %d track(s) to AliESDtrack and added to ESD", tracks.size()); | |
719 | iAddedDataBlocks++; | |
720 | } else if (iResult<0) { | |
721 | HLTError("can not extract tracks from data block of type %s (specification %08x) of size %d: error %d", | |
722 | DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification, pBlock->fSize, iResult); | |
723 | } | |
724 | } | |
b4479a87 | 725 | for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeCaloCluster | kAliHLTDataOriginAny); pBlock!=NULL; pBlock=GetNextInputBlock()) |
9a9467ed | 726 | { |
57a4102f | 727 | fBenchmark.AddInput(pBlock->fSize); |
9a9467ed | 728 | AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(pBlock->fPtr); |
729 | ||
730 | HLTDebug("%d HLT clusters from spec: 0x%X", caloClusterHeaderPtr->fNClusters, pBlock->fSpecification); | |
731 | ||
2a24cbbe | 732 | //AliHLTCaloClusterReader reader; |
733 | //reader.SetMemory(caloClusterHeaderPtr); | |
9a9467ed | 734 | |
735 | AliHLTESDCaloClusterMaker clusterMaker; | |
736 | ||
737 | int nClusters = clusterMaker.FillESD(pESD, caloClusterHeaderPtr); | |
2a24cbbe | 738 | |
9a9467ed | 739 | HLTInfo("converted %d cluster(s) to AliESDCaloCluster and added to ESD", nClusters); |
740 | iAddedDataBlocks++; | |
741 | } | |
f064ef44 | 742 | |
331d51c5 | 743 | // 5) Add Trigger Detectors |
744 | // VZERO, ZDC | |
745 | ||
746 | // FIXME: the size of all input blocks can be added in one loop | |
747 | for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO); | |
748 | pBlock!=NULL; pBlock=GetNextInputBlock()) { | |
749 | fBenchmark.AddInput(pBlock->fSize); | |
750 | } | |
751 | ||
752 | for ( const TObject *pObject = GetFirstInputObject(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO); | |
753 | pObject != NULL; pObject = GetNextInputObject() ) { | |
754 | AliESDVZERO *esdVZERO = dynamic_cast<AliESDVZERO*>(const_cast<TObject*>( pObject ) ); | |
755 | if (esdVZERO) { | |
756 | pESD->SetVZEROData( esdVZERO ); | |
757 | break; | |
758 | } else { | |
759 | ALIHLTERRORGUARD(1, "input object of data type %s is not of class AliESDVZERO", | |
760 | DataType2Text(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO).c_str()); | |
761 | } | |
762 | } | |
763 | ||
421e1221 | 764 | // FIXME: the size of all input blocks can be added in one loop |
765 | for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC); | |
766 | pBlock!=NULL; pBlock=GetNextInputBlock()) { | |
767 | fBenchmark.AddInput(pBlock->fSize); | |
768 | } | |
769 | for ( const TObject *pObject = GetFirstInputObject(kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC); | |
770 | pObject != NULL; pObject = GetNextInputObject() ) { | |
771 | AliESDZDC *esdZDC = dynamic_cast<AliESDZDC*>(const_cast<TObject*>( pObject ) ); | |
772 | if (esdZDC) { | |
8cd67fda | 773 | #ifndef HAVE_NOT_ALIZDCRECONSTRUCTOR_r43770 |
421e1221 | 774 | pESD->SetZDCData( esdZDC ); |
8cd67fda | 775 | #else |
776 | ALIHLTERRORGUARD(1, "Processing of ZDC data requires AliRoot r43770m skipping data block of type %s", | |
777 | DataType2Text(kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC).c_str()); | |
778 | #endif | |
421e1221 | 779 | break; |
780 | } else { | |
781 | ALIHLTERRORGUARD(1, "input object of data type %s is not of class AliESDZDC", | |
782 | DataType2Text(kAliHLTDataTypeESDContent|kAliHLTDataOriginZDC).c_str()); | |
783 | } | |
784 | } | |
785 | ||
fe0324de | 786 | // Add tracks and clusters from MUON. |
57a4102f | 787 | for( const AliHLTComponentBlockData *i= GetFirstInputBlock(kAliHLTAnyDataType | kAliHLTDataOriginMUON); i!=NULL; i=GetNextInputBlock() ){ |
788 | fBenchmark.AddInput(i->fSize); | |
789 | } | |
790 | ||
f064ef44 | 791 | for (const TObject* obj = GetFirstInputObject(kAliHLTAnyDataType | kAliHLTDataOriginMUON); |
792 | obj != NULL; | |
793 | obj = GetNextInputObject() | |
794 | ) | |
795 | { | |
796 | const TClonesArray* tracklist = NULL; | |
fe0324de | 797 | const TClonesArray* clusterlist = NULL; |
f064ef44 | 798 | if (obj->IsA() == AliESDEvent::Class()) |
799 | { | |
800 | const AliESDEvent* event = static_cast<const AliESDEvent*>(obj); | |
801 | HLTDebug("Received a MUON ESD with specification: 0x%X", GetSpecification(obj)); | |
802 | if (event->GetList() == NULL) continue; | |
803 | tracklist = dynamic_cast<const TClonesArray*>(event->GetList()->FindObject("MuonTracks")); | |
804 | if (tracklist == NULL) continue; | |
fe0324de | 805 | clusterlist = dynamic_cast<const TClonesArray*>(event->GetList()->FindObject("MuonClusters")); |
806 | if (clusterlist == NULL) continue; | |
f064ef44 | 807 | } |
808 | else if (obj->IsA() == TClonesArray::Class()) | |
809 | { | |
fe0324de | 810 | if (!strcmp(obj->GetName(), "MuonTracks")) { |
811 | tracklist = static_cast<const TClonesArray*>(obj); | |
812 | HLTDebug("Received a MUON TClonesArray of tracks with specification: 0x%X", GetSpecification(obj)); | |
813 | } else { | |
814 | clusterlist = static_cast<const TClonesArray*>(obj); | |
815 | HLTDebug("Received a MUON TClonesArray of clusters with specification: 0x%X", GetSpecification(obj)); | |
816 | } | |
f064ef44 | 817 | } |
818 | else | |
819 | { | |
820 | // Cannot handle this object type. | |
821 | continue; | |
822 | } | |
fe0324de | 823 | // copy tracks |
824 | if (tracklist) { | |
825 | HLTDebug("Received %d MUON tracks.", tracklist->GetEntriesFast()); | |
826 | if (tracklist->GetEntriesFast() > 0) | |
827 | { | |
828 | const AliESDMuonTrack* track = dynamic_cast<const AliESDMuonTrack*>(tracklist->UncheckedAt(0)); | |
829 | if (track == NULL) | |
830 | { | |
831 | HLTError(Form("%s from MUON does not contain AliESDMuonTrack objects.", obj->ClassName())); | |
832 | continue; | |
833 | } | |
834 | } | |
835 | for (Int_t i = 0; i < tracklist->GetEntriesFast(); ++i) | |
f064ef44 | 836 | { |
fe0324de | 837 | AliESDMuonTrack* track = pESD->NewMuonTrack(); |
838 | *track = *(static_cast<const AliESDMuonTrack*>(tracklist->UncheckedAt(i))); | |
a1408c4b | 839 | } |
f064ef44 | 840 | } |
fe0324de | 841 | // copy clusters |
842 | if (clusterlist) { | |
843 | HLTDebug("Received %d MUON clusters.", clusterlist->GetEntriesFast()); | |
844 | if (clusterlist->GetEntriesFast() > 0) | |
845 | { | |
846 | const AliESDMuonCluster* cluster = dynamic_cast<const AliESDMuonCluster*>(clusterlist->UncheckedAt(0)); | |
847 | if (cluster == NULL) | |
848 | { | |
849 | HLTError(Form("%s from MUON does not contain AliESDMuonCluster objects.", obj->ClassName())); | |
850 | continue; | |
851 | } | |
852 | } | |
853 | for (Int_t i = 0; i < clusterlist->GetEntriesFast(); ++i) | |
854 | { | |
855 | AliESDMuonCluster* cluster = pESD->NewMuonCluster(); | |
856 | *cluster = *(static_cast<const AliESDMuonCluster*>(clusterlist->UncheckedAt(i))); | |
857 | } | |
f064ef44 | 858 | } |
859 | } | |
860 | ||
861 | if (iAddedDataBlocks>0 && pTree) { | |
862 | pTree->Fill(); | |
863 | } | |
a1408c4b | 864 | |
865 | if (iResult>=0) iResult=iAddedDataBlocks; | |
866 | return iResult; | |
867 | } |