]>
Commit | Line | Data |
---|---|---|
9acda34c | 1 | /************************************************************************** |
2 | * This file is property of and copyright by the ALICE HLT Project * | |
3 | * All rights reserved. * | |
4 | * * | |
5 | * Primary Authors: * | |
6 | * Artur Szostak <artursz@iafrica.com> * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | ||
17 | /* $Id$ */ | |
18 | ||
cb35e21b | 19 | /// |
20 | /// @file AliHLTMUONRootifierComponent.cxx | |
21 | /// @author Artur Szostak <artursz@iafrica.com> | |
450e0b36 | 22 | /// @date 29 Sep 2007 |
cb35e21b | 23 | /// @brief Implementation of the AliHLTMUONRootifierComponent component. |
24 | /// | |
9acda34c | 25 | |
26 | #include "AliHLTMUONRootifierComponent.h" | |
450e0b36 | 27 | #include "AliHLTMUONEvent.h" |
9acda34c | 28 | #include "AliHLTMUONConstants.h" |
29 | #include "AliHLTMUONUtils.h" | |
9acda34c | 30 | #include "AliHLTMUONRecHit.h" |
31 | #include "AliHLTMUONTriggerRecord.h" | |
32 | #include "AliHLTMUONMansoTrack.h" | |
450e0b36 | 33 | #include "AliHLTMUONDecision.h" |
34 | #include "TClonesArray.h" | |
9acda34c | 35 | #include <cassert> |
36 | ||
9acda34c | 37 | ClassImp(AliHLTMUONRootifierComponent); |
38 | ||
39 | ||
40 | AliHLTMUONRootifierComponent::AliHLTMUONRootifierComponent() : | |
154cba94 | 41 | AliHLTMUONProcessor(), |
450e0b36 | 42 | fWarnForUnexpecedBlock(false) |
9acda34c | 43 | { |
6253e09b | 44 | /// |
45 | /// Default constructor. | |
46 | /// | |
9acda34c | 47 | } |
48 | ||
49 | ||
50 | AliHLTMUONRootifierComponent::~AliHLTMUONRootifierComponent() | |
51 | { | |
6253e09b | 52 | /// |
53 | /// Default destructor. | |
54 | /// | |
9acda34c | 55 | } |
56 | ||
57 | ||
450e0b36 | 58 | int AliHLTMUONRootifierComponent::DoInit(int argc, const char** argv) |
9acda34c | 59 | { |
6253e09b | 60 | /// |
61 | /// Inherited from AliHLTComponent. | |
62 | /// Parses the command line parameters and initialises the component. | |
63 | /// | |
64 | ||
450e0b36 | 65 | HLTInfo("Initialising dHLT rootifier component."); |
66 | ||
67 | fWarnForUnexpecedBlock = false; | |
68 | ||
69 | for (int i = 0; i < argc; i++) | |
70 | { | |
71 | if (strcmp(argv[i], "-warn_on_unexpected_block") == 0) | |
72 | { | |
73 | fWarnForUnexpecedBlock = true; | |
74 | continue; | |
75 | } | |
76 | ||
77 | HLTError("Unknown option '%s'.", argv[i]); | |
78 | return -EINVAL; | |
79 | } | |
80 | ||
9acda34c | 81 | return 0; |
82 | } | |
83 | ||
84 | ||
85 | int AliHLTMUONRootifierComponent::DoDeinit() | |
86 | { | |
6253e09b | 87 | /// |
88 | /// Inherited from AliHLTComponent. Performs a cleanup of the component. | |
89 | /// | |
90 | ||
450e0b36 | 91 | HLTInfo("Deinitialising dHLT rootifier component."); |
9acda34c | 92 | return 0; |
93 | } | |
94 | ||
95 | ||
96 | const char* AliHLTMUONRootifierComponent::GetComponentID() | |
97 | { | |
6253e09b | 98 | /// |
99 | /// Inherited from AliHLTComponent. Returns the component ID. | |
100 | /// | |
101 | ||
450e0b36 | 102 | return AliHLTMUONConstants::RootifierComponentId(); |
9acda34c | 103 | } |
104 | ||
105 | ||
106 | AliHLTComponentDataType AliHLTMUONRootifierComponent::GetOutputDataType() | |
107 | { | |
bb14e9db | 108 | /// Inherited from AliHLTComponent. Returns kAliHLTMultipleDataType |
109 | /// refer to GetOutputDataTypes for all returned data types. | |
110 | ||
111 | return kAliHLTMultipleDataType; | |
112 | } | |
113 | ||
114 | ||
115 | int AliHLTMUONRootifierComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) | |
116 | { | |
117 | /// Inherited from AliHLTComponent. Returns the output data types. | |
6253e09b | 118 | |
bb14e9db | 119 | tgtList.push_back(kAliHLTAnyDataType); |
120 | return 1; | |
9acda34c | 121 | } |
122 | ||
123 | ||
124 | void AliHLTMUONRootifierComponent::GetInputDataTypes( | |
125 | vector<AliHLTComponentDataType>& list | |
126 | ) | |
127 | { | |
6253e09b | 128 | /// |
129 | /// Inherited from AliHLTProcessor. Returns the list of expected input data types. | |
130 | /// | |
131 | ||
9acda34c | 132 | list.push_back(kAliHLTAnyDataType); |
133 | } | |
134 | ||
135 | ||
136 | void AliHLTMUONRootifierComponent::GetOutputDataSize( | |
137 | unsigned long& constBase, double& inputMultiplier | |
138 | ) | |
139 | { | |
6253e09b | 140 | /// |
141 | /// Inherited from AliHLTComponent. Returns an estimate of the expected output data size. | |
142 | /// | |
143 | ||
477135e2 | 144 | constBase = 1024*1024; |
145 | inputMultiplier = 100; | |
9acda34c | 146 | } |
147 | ||
148 | ||
149 | AliHLTComponent* AliHLTMUONRootifierComponent::Spawn() | |
150 | { | |
6253e09b | 151 | /// |
152 | /// Inherited from AliHLTComponent. Creates a new object instance. | |
153 | /// | |
154 | ||
9acda34c | 155 | return new AliHLTMUONRootifierComponent(); |
156 | } | |
157 | ||
158 | ||
159 | int AliHLTMUONRootifierComponent::DoEvent( | |
160 | const AliHLTComponentEventData& evtData, | |
6253e09b | 161 | AliHLTComponentTriggerData& /*trigData*/ |
9acda34c | 162 | ) |
163 | { | |
6253e09b | 164 | /// |
165 | /// Inherited from AliHLTProcessor. Processes the new event data. | |
166 | /// | |
167 | ||
9acda34c | 168 | AliHLTMUONEvent event(evtData.fEventID); |
450e0b36 | 169 | const AliHLTComponentBlockData* block = NULL; |
649ab027 | 170 | AliHLTUInt32_t specification = 0; // Contains the output data block spec bits. |
9acda34c | 171 | |
172 | // First process the blocks of reconstructed hits and trigger records. | |
173 | for (int i = 0; i < GetNumberOfInputBlocks(); i++) | |
174 | { | |
450e0b36 | 175 | block = GetInputBlock(i); |
9acda34c | 176 | assert( block != NULL ); |
450e0b36 | 177 | |
178 | HLTDebug("Handling block: %u, with fDataType = '%s', fPtr = %p and fSize = %u bytes.", | |
a62ffb4d | 179 | i, DataType2Text(block->fDataType).c_str(), block->fPtr, block->fSize |
450e0b36 | 180 | ); |
181 | ||
9acda34c | 182 | if (block->fDataType == AliHLTMUONConstants::RecHitsBlockDataType()) |
183 | { | |
649ab027 | 184 | specification |= block->fSpecification; |
9acda34c | 185 | AliHLTUInt8_t* ptr = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr); |
186 | ptr += block->fOffset; | |
187 | AliHLTMUONRecHitsBlockReader inblock(ptr, block->fSize); | |
154cba94 | 188 | if (not BlockStructureOk(inblock)) continue; |
9acda34c | 189 | |
190 | // Decode the source DDL from the specification bits. | |
191 | Int_t sourceDDL = -1; | |
192 | bool ddl[22]; | |
193 | AliHLTMUONUtils::UnpackSpecBits(block->fSpecification, ddl); | |
194 | for (int k = 0; k < 22; k++) | |
195 | { | |
196 | if (ddl[k]) | |
197 | { | |
198 | if (sourceDDL == -1) | |
199 | { | |
200 | sourceDDL = k+1; | |
201 | } | |
202 | else | |
203 | { | |
204 | HLTWarning("The input data block %d contains" | |
205 | " data from multiple DDL sources.", i | |
206 | ); | |
207 | } | |
208 | } | |
209 | } | |
210 | if (sourceDDL > 20) | |
211 | { | |
212 | HLTWarning("The source DDL for input data block %d is %d." | |
213 | " The expected range for the DDL is [1..20].", | |
214 | i, sourceDDL | |
215 | ); | |
216 | } | |
217 | ||
218 | for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++) | |
219 | { | |
220 | const AliHLTMUONRecHitStruct& h = inblock[n]; | |
9acda34c | 221 | event.Add(new AliHLTMUONRecHit(h.fX, h.fY, h.fZ, sourceDDL)); |
222 | } | |
223 | } | |
224 | else if (block->fDataType == AliHLTMUONConstants::TriggerRecordsBlockDataType()) | |
225 | { | |
649ab027 | 226 | specification |= block->fSpecification; |
9acda34c | 227 | AliHLTUInt8_t* ptr = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr); |
228 | ptr += block->fOffset; | |
229 | AliHLTMUONTriggerRecordsBlockReader inblock(ptr, block->fSize); | |
154cba94 | 230 | if (not BlockStructureOk(inblock)) continue; |
9acda34c | 231 | |
232 | // Decode the source DDL from the specification bits. | |
233 | Int_t sourceDDL = -1; | |
234 | bool ddl[22]; | |
235 | AliHLTMUONUtils::UnpackSpecBits(block->fSpecification, ddl); | |
236 | for (int k = 0; k < 22; k++) | |
237 | { | |
238 | if (ddl[k]) | |
239 | { | |
240 | if (sourceDDL == -1) | |
241 | { | |
242 | sourceDDL = k+1; | |
243 | } | |
244 | else | |
245 | { | |
246 | HLTWarning("The input data block %d contains" | |
247 | " data from multiple DDL sources.", i | |
248 | ); | |
249 | } | |
250 | } | |
251 | } | |
bb14e9db | 252 | if (sourceDDL != -1 and (sourceDDL < 21 or sourceDDL > 22)) |
9acda34c | 253 | { |
254 | HLTWarning("The source DDL for input data block %d is %d." | |
255 | " The expected range for the DDL is [21..22].", | |
256 | i, sourceDDL | |
257 | ); | |
258 | } | |
259 | ||
260 | for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++) | |
261 | { | |
262 | const AliHLTMUONTriggerRecordStruct& t = inblock[n]; | |
263 | ||
264 | AliHLTMUONParticleSign sign; | |
265 | bool hitset[4]; | |
266 | AliHLTMUONUtils::UnpackTriggerRecordFlags( | |
267 | t.fFlags, sign, hitset | |
268 | ); | |
269 | ||
270 | AliHLTMUONTriggerRecord* tr = new AliHLTMUONTriggerRecord( | |
271 | t.fId, sign, t.fPx, t.fPy, t.fPz, sourceDDL | |
272 | ); | |
273 | for (int k = 0; k < 4; k++) | |
274 | tr->SetHit(k+11, t.fHit[k].fX, t.fHit[k].fY, t.fHit[k].fZ); | |
275 | event.Add(tr); | |
276 | } | |
277 | } | |
278 | else | |
279 | { | |
450e0b36 | 280 | if (block->fDataType != AliHLTMUONConstants::MansoTracksBlockDataType() and |
281 | block->fDataType != AliHLTMUONConstants::SinglesDecisionBlockDataType() and | |
282 | block->fDataType != AliHLTMUONConstants::PairsDecisionBlockDataType() | |
283 | ) | |
284 | { | |
285 | // Log a message indicating that we got a data block that we | |
286 | // do not know how to handle. | |
287 | if (fWarnForUnexpecedBlock) | |
288 | HLTWarning("Received a data block of a type we cannot handle: '%s', spec: 0x%X", | |
289 | DataType2Text(block->fDataType).c_str(), block->fSpecification | |
290 | ); | |
291 | else | |
292 | HLTDebug("Received a data block of a type we cannot handle: '%s', spec: 0x%X", | |
293 | DataType2Text(block->fDataType).c_str(), block->fSpecification | |
294 | ); | |
295 | } | |
9acda34c | 296 | } |
297 | } | |
298 | ||
299 | // Now we can look for tracks to add. We needed the ROOT trigger records | |
300 | // and reco hits created before we can create track objects. | |
450e0b36 | 301 | for (block = GetFirstInputBlock(AliHLTMUONConstants::MansoTracksBlockDataType()); |
302 | block != NULL; | |
303 | block = GetNextInputBlock() | |
304 | ) | |
9acda34c | 305 | { |
649ab027 | 306 | specification |= block->fSpecification; |
450e0b36 | 307 | AliHLTUInt8_t* ptr = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr); |
308 | ptr += block->fOffset; | |
309 | AliHLTMUONMansoTracksBlockReader inblock(ptr, block->fSize); | |
154cba94 | 310 | if (not BlockStructureOk(inblock)) continue; |
450e0b36 | 311 | |
312 | for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++) | |
313 | { | |
314 | const AliHLTMUONMansoTrackStruct& t = inblock[n]; | |
315 | ||
316 | AliHLTMUONParticleSign sign; | |
317 | bool hitset[4]; | |
318 | AliHLTMUONUtils::UnpackMansoTrackFlags( | |
319 | t.fFlags, sign, hitset | |
320 | ); | |
321 | ||
322 | // Try find the trigger record in 'event'. | |
323 | const AliHLTMUONTriggerRecord* trigrec = NULL; | |
324 | for (Int_t k = 0; k < event.Array().GetEntriesFast(); k++) | |
9acda34c | 325 | { |
450e0b36 | 326 | if (event.Array()[k]->IsA() != AliHLTMUONTriggerRecord::Class()) |
327 | continue; | |
328 | const AliHLTMUONTriggerRecord* tk = | |
329 | static_cast<const AliHLTMUONTriggerRecord*>(event.Array()[k]); | |
330 | if (tk->Id() == t.fTrigRec) | |
9acda34c | 331 | { |
450e0b36 | 332 | trigrec = tk; |
333 | break; | |
9acda34c | 334 | } |
450e0b36 | 335 | } |
336 | ||
337 | // Now try find the hits in 'event'. | |
338 | // If they cannot be found then create new ones. | |
339 | const AliHLTMUONRecHit* hit7 = NULL; | |
340 | const AliHLTMUONRecHit* hit8 = NULL; | |
341 | const AliHLTMUONRecHit* hit9 = NULL; | |
342 | const AliHLTMUONRecHit* hit10 = NULL; | |
343 | for (Int_t k = 0; k < event.Array().GetEntriesFast(); k++) | |
344 | { | |
345 | if (event.Array()[k]->IsA() != AliHLTMUONRecHit::Class()) | |
346 | continue; | |
347 | const AliHLTMUONRecHit* h = | |
348 | static_cast<const AliHLTMUONRecHit*>(event.Array()[k]); | |
9acda34c | 349 | |
450e0b36 | 350 | if (hitset[0] and h->X() == t.fHit[0].fX and h->Y() == t.fHit[0].fY |
351 | and h->Z() == t.fHit[0].fZ) | |
9acda34c | 352 | { |
450e0b36 | 353 | hit7 = h; |
9acda34c | 354 | } |
450e0b36 | 355 | if (hitset[1] and h->X() == t.fHit[1].fX and h->Y() == t.fHit[1].fY |
356 | and h->Z() == t.fHit[1].fZ) | |
9acda34c | 357 | { |
450e0b36 | 358 | hit8 = h; |
9acda34c | 359 | } |
450e0b36 | 360 | if (hitset[2] and h->X() == t.fHit[2].fX and h->Y() == t.fHit[2].fY |
361 | and h->Z() == t.fHit[2].fZ) | |
9acda34c | 362 | { |
450e0b36 | 363 | hit9 = h; |
9acda34c | 364 | } |
450e0b36 | 365 | if (hitset[3] and h->X() == t.fHit[3].fX and h->Y() == t.fHit[3].fY |
366 | and h->Z() == t.fHit[3].fZ) | |
9acda34c | 367 | { |
450e0b36 | 368 | hit10 = h; |
9acda34c | 369 | } |
450e0b36 | 370 | } |
371 | AliHLTMUONRecHit* newhit; | |
372 | if (hitset[0] and hit7 == NULL) | |
373 | { | |
374 | newhit = new AliHLTMUONRecHit(t.fHit[0].fX, t.fHit[0].fY, t.fHit[0].fZ); | |
375 | event.Add(newhit); | |
376 | hit7 = newhit; | |
377 | } | |
378 | if (hitset[1] and hit8 == NULL) | |
379 | { | |
380 | newhit = new AliHLTMUONRecHit(t.fHit[1].fX, t.fHit[1].fY, t.fHit[1].fZ); | |
381 | event.Add(newhit); | |
382 | hit8 = newhit; | |
383 | } | |
384 | if (hitset[2] and hit9 == NULL) | |
385 | { | |
386 | newhit = new AliHLTMUONRecHit(t.fHit[2].fX, t.fHit[2].fY, t.fHit[2].fZ); | |
387 | event.Add(newhit); | |
388 | hit9 = newhit; | |
389 | } | |
390 | if (hitset[3] and hit10 == NULL) | |
391 | { | |
392 | newhit = new AliHLTMUONRecHit(t.fHit[3].fX, t.fHit[3].fY, t.fHit[3].fZ); | |
393 | event.Add(newhit); | |
394 | hit10 = newhit; | |
395 | } | |
396 | ||
397 | AliHLTMUONMansoTrack* tr = new AliHLTMUONMansoTrack( | |
398 | t.fId, sign, t.fPx, t.fPy, t.fPz, t.fChi2, | |
399 | trigrec, hit7, hit8, hit9, hit10 | |
400 | ); | |
401 | event.Add(tr); | |
402 | } | |
403 | } | |
404 | ||
8e0220c2 | 405 | bool decisionBlockFound = false; |
450e0b36 | 406 | UInt_t numLowPt = 0; |
407 | UInt_t numHighPt = 0; | |
408 | TClonesArray singlesDecisions("AliHLTMUONDecision::AliTrackDecision"); | |
409 | ||
410 | // Find the single tracks decision blocks and add their information. | |
411 | // We just sum the trigger scalars and single decisions. | |
412 | for (block = GetFirstInputBlock(AliHLTMUONConstants::SinglesDecisionBlockDataType()); | |
413 | block != NULL; | |
414 | block = GetNextInputBlock() | |
415 | ) | |
416 | { | |
8e0220c2 | 417 | decisionBlockFound = true; |
649ab027 | 418 | specification |= block->fSpecification; |
450e0b36 | 419 | AliHLTUInt8_t* ptr = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr); |
420 | ptr += block->fOffset; | |
421 | AliHLTMUONSinglesDecisionBlockReader inblock(ptr, block->fSize); | |
154cba94 | 422 | if (not BlockStructureOk(inblock)) continue; |
450e0b36 | 423 | |
424 | numLowPt += inblock.BlockHeader().fNlowPt; | |
425 | numHighPt += inblock.BlockHeader().fNhighPt; | |
426 | ||
427 | for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++) | |
428 | { | |
429 | const AliHLTMUONTrackDecisionStruct& t = inblock[n]; | |
430 | ||
431 | bool highPt, lowPt; | |
432 | AliHLTMUONUtils::UnpackTrackDecisionBits(t.fTriggerBits, highPt, lowPt); | |
433 | ||
434 | // Try find the corresponding track in the 'event'. | |
435 | const AliHLTMUONMansoTrack* track = NULL; | |
436 | for (Int_t k = 0; k < event.Array().GetEntriesFast(); k++) | |
437 | { | |
438 | if (event.Array()[k]->IsA() != AliHLTMUONMansoTrack::Class()) | |
439 | continue; | |
440 | const AliHLTMUONMansoTrack* tk = | |
441 | static_cast<const AliHLTMUONMansoTrack*>(event.Array()[k]); | |
442 | if (tk->Id() == t.fTrackId) | |
9acda34c | 443 | { |
450e0b36 | 444 | track = tk; |
445 | break; | |
9acda34c | 446 | } |
450e0b36 | 447 | } |
9acda34c | 448 | |
450e0b36 | 449 | // If the track was not found then create a dummy one. |
450 | if (track == NULL) | |
451 | { | |
452 | AliHLTMUONMansoTrack* tr = new AliHLTMUONMansoTrack(t.fTrackId); | |
9acda34c | 453 | event.Add(tr); |
450e0b36 | 454 | track = tr; |
9acda34c | 455 | } |
450e0b36 | 456 | |
457 | new (singlesDecisions[singlesDecisions.GetEntriesFast()]) | |
458 | AliHLTMUONDecision::AliTrackDecision(t.fPt, lowPt, highPt, track); | |
9acda34c | 459 | } |
450e0b36 | 460 | } |
461 | ||
462 | UInt_t numUnlikeAnyPt = 0; | |
463 | UInt_t numUnlikeLowPt = 0; | |
464 | UInt_t numUnlikeHighPt = 0; | |
465 | UInt_t numLikeAnyPt = 0; | |
466 | UInt_t numLikeLowPt = 0; | |
467 | UInt_t numLikeHighPt = 0; | |
468 | UInt_t numAnyMass = 0; | |
469 | UInt_t numLowMass = 0; | |
470 | UInt_t numHighMass = 0; | |
471 | TClonesArray pairsDecisions("AliHLTMUONDecision::AliPairDecision"); | |
472 | ||
473 | // Find the track pairs decision blocks and add their information. | |
474 | // We just sum the trigger scalars and track pair decisions. | |
475 | for (block = GetFirstInputBlock(AliHLTMUONConstants::PairsDecisionBlockDataType()); | |
476 | block != NULL; | |
477 | block = GetNextInputBlock() | |
478 | ) | |
479 | { | |
8e0220c2 | 480 | decisionBlockFound = true; |
649ab027 | 481 | specification |= block->fSpecification; |
450e0b36 | 482 | AliHLTUInt8_t* ptr = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr); |
483 | ptr += block->fOffset; | |
484 | AliHLTMUONPairsDecisionBlockReader inblock(ptr, block->fSize); | |
154cba94 | 485 | if (not BlockStructureOk(inblock)) continue; |
450e0b36 | 486 | |
487 | numUnlikeAnyPt += inblock.BlockHeader().fNunlikeAnyPt; | |
488 | numUnlikeLowPt += inblock.BlockHeader().fNunlikeLowPt; | |
489 | numUnlikeHighPt += inblock.BlockHeader().fNunlikeHighPt; | |
490 | numLikeAnyPt += inblock.BlockHeader().fNlikeAnyPt; | |
491 | numLikeLowPt += inblock.BlockHeader().fNlikeLowPt; | |
492 | numLikeHighPt += inblock.BlockHeader().fNlikeHighPt; | |
493 | numAnyMass += inblock.BlockHeader().fNmassAny; | |
494 | numLowMass += inblock.BlockHeader().fNmassLow; | |
495 | numHighMass += inblock.BlockHeader().fNmassHigh; | |
496 | ||
497 | for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++) | |
498 | { | |
499 | const AliHLTMUONPairDecisionStruct& t = inblock[n]; | |
500 | ||
501 | bool highMass, lowMass, unlike; | |
502 | AliHLTUInt8_t highPtCount, lowPtCount; | |
503 | AliHLTMUONUtils::UnpackPairDecisionBits( | |
504 | t.fTriggerBits, highMass, lowMass, unlike, | |
505 | highPtCount, lowPtCount | |
506 | ); | |
507 | ||
508 | // Try find the corresponding tracks in the 'event'. | |
509 | const AliHLTMUONMansoTrack* trackA = NULL; | |
510 | const AliHLTMUONMansoTrack* trackB = NULL; | |
511 | for (Int_t k = 0; k < event.Array().GetEntriesFast(); k++) | |
512 | { | |
513 | if (event.Array()[k]->IsA() != AliHLTMUONMansoTrack::Class()) | |
514 | continue; | |
515 | const AliHLTMUONMansoTrack* tk = | |
516 | static_cast<const AliHLTMUONMansoTrack*>(event.Array()[k]); | |
517 | if (tk->Id() == t.fTrackAId) trackA = tk; | |
518 | if (tk->Id() == t.fTrackBId) trackB = tk; | |
519 | if (trackA != NULL and trackB != NULL) break; | |
520 | } | |
521 | ||
522 | // If either of the tracks was not found then create a dummy one. | |
523 | if (trackA == NULL) | |
524 | { | |
525 | AliHLTMUONMansoTrack* tr = new AliHLTMUONMansoTrack(t.fTrackAId); | |
526 | event.Add(tr); | |
527 | trackA = tr; | |
528 | } | |
529 | if (trackB == NULL) | |
530 | { | |
531 | AliHLTMUONMansoTrack* tr = new AliHLTMUONMansoTrack(t.fTrackBId); | |
532 | event.Add(tr); | |
533 | trackB = tr; | |
534 | } | |
535 | ||
536 | new (pairsDecisions[pairsDecisions.GetEntriesFast()]) | |
537 | AliHLTMUONDecision::AliPairDecision( | |
538 | t.fInvMass, lowMass, highMass, unlike, | |
539 | lowPtCount, highPtCount, trackA, trackB | |
540 | ); | |
541 | } | |
542 | } | |
543 | ||
8e0220c2 | 544 | |
545 | // Do not add the decision if no decision blocks were found. | |
546 | if (decisionBlockFound) | |
450e0b36 | 547 | { |
8e0220c2 | 548 | AliHLTMUONDecision* triggerDecision = new AliHLTMUONDecision( |
549 | numLowPt, numHighPt, numUnlikeAnyPt, numUnlikeLowPt, | |
550 | numUnlikeHighPt, numLikeAnyPt, numLikeLowPt, | |
551 | numLikeHighPt, numAnyMass, numLowMass, numHighMass | |
552 | ); | |
553 | for (Int_t i = 0; i < singlesDecisions.GetEntriesFast(); i++) | |
554 | { | |
555 | AliHLTMUONDecision::AliTrackDecision* decision = | |
556 | static_cast<AliHLTMUONDecision::AliTrackDecision*>( singlesDecisions[i] ); | |
557 | triggerDecision->AddDecision(decision); | |
558 | } | |
559 | for (Int_t j = 0; j < pairsDecisions.GetEntriesFast(); j++) | |
560 | { | |
561 | AliHLTMUONDecision::AliPairDecision* decision = | |
562 | static_cast<AliHLTMUONDecision::AliPairDecision*>( pairsDecisions[j] ); | |
563 | triggerDecision->AddDecision(decision); | |
564 | } | |
565 | ||
566 | event.Add(triggerDecision); | |
450e0b36 | 567 | } |
9acda34c | 568 | |
649ab027 | 569 | PushBack(&event, "ROOTEVNT", "MUON", specification); |
9acda34c | 570 | |
571 | return 0; | |
572 | } | |
6253e09b | 573 |