1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
6 * Artur Szostak <artursz@iafrica.com> *
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 **************************************************************************/
20 /// @file AliHLTMUONRootifierComponent.cxx
21 /// @author Artur Szostak <artursz@iafrica.com>
23 /// @brief Implementation of the AliHLTMUONRootifierComponent component.
25 /// Implements a component to convert dHLT raw data into TObjects.
27 #include "AliHLTMUONRootifierComponent.h"
28 #include "AliHLTMUONEvent.h"
29 #include "AliHLTMUONConstants.h"
30 #include "AliHLTMUONUtils.h"
31 #include "AliHLTMUONRecHit.h"
32 #include "AliHLTMUONTriggerRecord.h"
33 #include "AliHLTMUONMansoTrack.h"
34 #include "AliHLTMUONTrack.h"
35 #include "AliHLTMUONDecision.h"
36 #include "AliMUONTriggerDDLDecoderEventHandler.h"
37 #include "TClonesArray.h"
41 ClassImp(AliHLTMUONRootifierComponent);
44 AliHLTMUONRootifierComponent::AliHLTMUONRootifierComponent() :
45 AliHLTMUONProcessor(),
46 fWarnForUnexpecedBlock(false)
49 /// Default constructor.
54 AliHLTMUONRootifierComponent::~AliHLTMUONRootifierComponent()
57 /// Default destructor.
62 bool AliHLTMUONRootifierComponent::IgnoreArgument(const char* arg) const
64 /// Return true if the argument is one of -cdbpath -run or -delaysetup
65 /// to prevent the parent class from parsing these arguments in DoInit.
67 if (strcmp(arg, "-cdbpath") == 0 or strcmp(arg, "-run") == 0 or
68 strcmp(arg, "-delaysetup") == 0)
79 int AliHLTMUONRootifierComponent::DoInit(int argc, const char** argv)
82 /// Inherited from AliHLTComponent.
83 /// Parses the command line parameters and initialises the component.
86 HLTInfo("Initialising dHLT rootifier component.");
88 // Inherit the parents functionality.
89 int result = AliHLTMUONProcessor::DoInit(argc, argv);
90 if (result != 0) return result;
92 fWarnForUnexpecedBlock = false;
94 for (int i = 0; i < argc; i++)
96 if (ArgumentAlreadyHandled(i, argv[i])) continue;
98 if (strcmp(argv[i], "-warn_on_unexpected_block") == 0)
100 fWarnForUnexpecedBlock = true;
104 HLTError("Unknown option '%s'.", argv[i]);
112 int AliHLTMUONRootifierComponent::DoDeinit()
115 /// Inherited from AliHLTComponent. Performs a cleanup of the component.
118 HLTInfo("Deinitialising dHLT rootifier component.");
123 const char* AliHLTMUONRootifierComponent::GetComponentID()
126 /// Inherited from AliHLTComponent. Returns the component ID.
129 return AliHLTMUONConstants::RootifierComponentId();
133 AliHLTComponentDataType AliHLTMUONRootifierComponent::GetOutputDataType()
135 /// Inherited from AliHLTComponent. Returns kAliHLTMultipleDataType
136 /// refer to GetOutputDataTypes for all returned data types.
138 return kAliHLTMultipleDataType;
142 int AliHLTMUONRootifierComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
144 /// Inherited from AliHLTComponent. Returns the output data types.
146 tgtList.push_back(AliHLTMUONConstants::RootifiedEventDataType());
147 return tgtList.size();
151 void AliHLTMUONRootifierComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
154 /// Inherited from AliHLTProcessor. Returns the list of expected input data types.
157 list.push_back(kAliHLTAnyDataType);
161 void AliHLTMUONRootifierComponent::GetOutputDataSize(
162 unsigned long& constBase, double& inputMultiplier
166 /// Inherited from AliHLTComponent. Returns an estimate of the expected output data size.
169 constBase = 1024*1024;
170 inputMultiplier = 100;
174 AliHLTComponent* AliHLTMUONRootifierComponent::Spawn()
177 /// Inherited from AliHLTComponent. Creates a new object instance.
180 return new AliHLTMUONRootifierComponent();
184 int AliHLTMUONRootifierComponent::DoEvent(
185 const AliHLTComponentEventData& evtData,
186 AliHLTComponentTriggerData& trigData
190 /// Inherited from AliHLTProcessor. Processes the new event data.
193 if (not IsDataEvent()) return 0;
195 AliHLTMUONEvent event(evtData.fEventID);
196 const AliHLTComponentBlockData* block = NULL;
197 AliHLTUInt32_t specification = 0; // Contains the output data block spec bits.
198 std::map<AliHLTInt32_t, AliHLTMUONTriggerRecord*> triggerMap;
200 // First process the blocks of reconstructed hits and trigger records.
201 for (int i = 0; i < GetNumberOfInputBlocks(); i++)
203 block = GetInputBlock(i);
204 assert( block != NULL );
206 HLTDebug("Handling block: %u, with fDataType = '%s', fPtr = %p and fSize = %u bytes.",
207 i, DataType2Text(block->fDataType).c_str(), block->fPtr, block->fSize
210 if (block->fDataType == AliHLTMUONConstants::RecHitsBlockDataType())
212 specification |= block->fSpecification;
213 AliHLTMUONRecHitsBlockReader inblock(block->fPtr, block->fSize);
214 if (not BlockStructureOk(inblock))
216 if (DumpDataOnError()) DumpEvent(evtData, trigData);
220 // Decode the source DDL from the specification bits.
221 Int_t sourceDDL = -1;
223 AliHLTMUONUtils::UnpackSpecBits(block->fSpecification, ddl);
224 for (int k = 0; k < 22; k++)
234 HLTWarning("The input data block %d contains"
235 " data from multiple DDL sources.", i
242 HLTWarning("The source DDL for input data block %d is %d."
243 " The expected range for the DDL is [1..20].",
248 for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
250 const AliHLTMUONRecHitStruct& h = inblock[n];
251 AliHLTUInt8_t chamber;
252 AliHLTUInt16_t detElemId;
253 AliHLTMUONUtils::UnpackRecHitFlags(h.fFlags, chamber, detElemId);
254 event.Add(new AliHLTMUONRecHit(h.fX, h.fY, h.fZ, sourceDDL, detElemId));
257 else if (block->fDataType == AliHLTMUONConstants::TriggerRecordsBlockDataType())
259 specification |= block->fSpecification;
260 AliHLTMUONTriggerRecordsBlockReader inblock(block->fPtr, block->fSize);
261 if (not BlockStructureOk(inblock))
263 if (DumpDataOnError()) DumpEvent(evtData, trigData);
267 // Decode the source DDL from the specification bits.
268 Int_t sourceDDL = -1;
270 AliHLTMUONUtils::UnpackSpecBits(block->fSpecification, ddl);
271 for (int k = 0; k < 22; k++)
281 HLTWarning("The input data block %d contains"
282 " data from multiple DDL sources.", i
287 if (sourceDDL != -1 and (sourceDDL < 21 or sourceDDL > 22))
289 HLTWarning("The source DDL for input data block %d is %d."
290 " The expected range for the DDL is [21..22].",
295 for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
297 const AliHLTMUONTriggerRecordStruct& t = inblock[n];
299 AliHLTMUONParticleSign sign;
301 AliHLTMUONUtils::UnpackTriggerRecordFlags(
302 t.fFlags, sign, hitset
305 AliHLTMUONTriggerRecord* tr = new AliHLTMUONTriggerRecord(
306 t.fId, sign, t.fPx, t.fPy, t.fPz, sourceDDL
308 for (int k = 0; k < 4; k++)
310 if (not hitset[k]) continue;
311 Int_t detElemId = AliHLTMUONUtils::GetDetElemIdFromFlags(t.fHit[k].fFlags);
312 tr->SetHit(k+11, t.fHit[k].fX, t.fHit[k].fY, t.fHit[k].fZ, detElemId);
315 triggerMap[t.fId] = tr;
320 if (block->fDataType != AliHLTMUONConstants::TrigRecsDebugBlockDataType() and
321 block->fDataType != AliHLTMUONConstants::ClusterBlockDataType() and
322 block->fDataType != AliHLTMUONConstants::ChannelBlockDataType() and
323 block->fDataType != AliHLTMUONConstants::MansoTracksBlockDataType() and
324 block->fDataType != AliHLTMUONConstants::MansoCandidatesBlockDataType() and
325 block->fDataType != AliHLTMUONConstants::SinglesDecisionBlockDataType() and
326 block->fDataType != AliHLTMUONConstants::PairsDecisionBlockDataType()
329 // Log a message indicating that we got a data block that we
330 // do not know how to handle.
331 if (fWarnForUnexpecedBlock)
332 HLTWarning("Received a data block of a type we cannot handle: '%s', spec: 0x%X",
333 DataType2Text(block->fDataType).c_str(), block->fSpecification
337 HLTDebug("Received a data block of a type we cannot handle: '%s', spec: 0x%X",
338 DataType2Text(block->fDataType).c_str(), block->fSpecification
345 // We need to check if there are any trigger record debug data blocks
346 // and add their information to the AliHLTMUONTriggerRecord objects.
347 for (block = GetFirstInputBlock(AliHLTMUONConstants::TrigRecsDebugBlockDataType());
349 block = GetNextInputBlock()
352 specification |= block->fSpecification;
353 AliHLTMUONTrigRecsDebugBlockReader inblock(block->fPtr, block->fSize);
354 if (not BlockStructureOk(inblock))
356 if (DumpDataOnError()) DumpEvent(evtData, trigData);
360 for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
362 const AliHLTMUONTrigRecInfoStruct& triginfo = inblock[n];
364 AliHLTMUONTriggerRecord* trigrec = triggerMap[triginfo.fTrigRecId];
367 // Decode the source DDL from the specification bits.
368 Int_t sourceDDL = -1;
370 AliHLTMUONUtils::UnpackSpecBits(block->fSpecification, ddl);
371 for (int k = 0; k < 22; k++)
381 HLTWarning("An trigger debug information data block"
382 " contains data from multiple DDL sources."
387 if (sourceDDL != -1 and (sourceDDL < 21 or sourceDDL > 22))
389 HLTWarning("The source DDL for a trigger debug information data"
390 " block is %d. The expected range for the DDL is [21..22].",
395 // Add an new empty trigger record since none was found.
396 trigrec = new AliHLTMUONTriggerRecord(
397 0, 0, 0, 0, 0, sourceDDL
399 triggerMap[triginfo.fTrigRecId] = trigrec;
404 for (Int_t j = 0; j < 4; ++j)
406 if (trigrec->DetElemId(j+11) != -1 and triginfo.fDetElemId[j] != trigrec->DetElemId(j+11))
408 HLTWarning("Found a trigger record with a hit on chamber %d with a different"
409 " detector element ID %d than the debug information %d.",
410 j, trigrec->DetElemId(j+11), triginfo.fDetElemId[j]
416 typedef AliMUONTriggerDDLDecoderEventHandler Handler;
418 trigrec->SetDebugInfo(triginfo.fZmiddle, triginfo.fBl);
420 UShort_t patternX[4][3] = {
422 Handler::GetLocalX1(&triginfo.fL0StructPrev),
423 Handler::GetLocalX1(&triginfo.fL0Struct),
424 Handler::GetLocalX1(&triginfo.fL0StructNext)
426 Handler::GetLocalX2(&triginfo.fL0StructPrev),
427 Handler::GetLocalX2(&triginfo.fL0Struct),
428 Handler::GetLocalX2(&triginfo.fL0StructNext)
430 Handler::GetLocalX3(&triginfo.fL0StructPrev),
431 Handler::GetLocalX3(&triginfo.fL0Struct),
432 Handler::GetLocalX3(&triginfo.fL0StructNext)
434 Handler::GetLocalX4(&triginfo.fL0StructPrev),
435 Handler::GetLocalX4(&triginfo.fL0Struct),
436 Handler::GetLocalX4(&triginfo.fL0StructNext)
439 UShort_t patternY[4][3] = {
441 Handler::GetLocalY1(&triginfo.fL0StructPrev),
442 Handler::GetLocalY1(&triginfo.fL0Struct),
443 Handler::GetLocalY1(&triginfo.fL0StructNext)
445 Handler::GetLocalY2(&triginfo.fL0StructPrev),
446 Handler::GetLocalY2(&triginfo.fL0Struct),
447 Handler::GetLocalY2(&triginfo.fL0StructNext)
449 Handler::GetLocalY3(&triginfo.fL0StructPrev),
450 Handler::GetLocalY3(&triginfo.fL0Struct),
451 Handler::GetLocalY3(&triginfo.fL0StructNext)
453 Handler::GetLocalY4(&triginfo.fL0StructPrev),
454 Handler::GetLocalY4(&triginfo.fL0Struct),
455 Handler::GetLocalY4(&triginfo.fL0StructNext)
459 for (Int_t j = 0; j < 4; ++j)
461 trigrec->SetHitDebugInfo(j+11, patternX[j], patternY[j]);
466 std::map<AliHLTInt32_t, AliHLTMUONRecHit*> clusterMap;
468 // We need to check if there are any cluster data blocks and add their
469 // information to the AliHLTMUONRecHit objects.
470 for (block = GetFirstInputBlock(AliHLTMUONConstants::ClusterBlockDataType());
472 block = GetNextInputBlock()
475 specification |= block->fSpecification;
476 AliHLTMUONClustersBlockReader inblock(block->fPtr, block->fSize);
477 if (not BlockStructureOk(inblock))
479 if (DumpDataOnError()) DumpEvent(evtData, trigData);
483 for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
485 const AliHLTMUONClusterStruct& clust = inblock[n];
487 AliHLTUInt8_t chamber;
488 AliHLTUInt16_t detElemId;
489 AliHLTMUONUtils::UnpackRecHitFlags(clust.fHit.fFlags, chamber, detElemId);
490 if (clust.fDetElemId != detElemId)
492 HLTWarning("Found a cluster with a different detector element ID (%d)"
493 " from its corresponding hit (x,y,z = %f,%f,%f and detElemId = %d).",
495 clust.fHit.fX, clust.fHit.fY, clust.fHit.fZ,
500 // Try find the corresponding reconstructed hit in 'event'.
501 AliHLTMUONRecHit* hit = NULL;
502 for (Int_t k = 0; k < event.Array().GetEntriesFast(); k++)
504 if (event.Array()[k]->IsA() != AliHLTMUONRecHit::Class())
506 AliHLTMUONRecHit* h = static_cast<AliHLTMUONRecHit*>(event.Array()[k]);
507 if (h->DetElemId() == detElemId and h->X() == clust.fHit.fX
508 and h->Y() == clust.fHit.fY and h->Z() == clust.fHit.fZ)
515 // If we could not find the corresponding hit then we need to create
516 // a new hit object, otherwise we can just append the information.
519 // Decode the source DDL from the specification bits.
520 Int_t sourceDDL = -1;
522 AliHLTMUONUtils::UnpackSpecBits(block->fSpecification, ddl);
523 for (int k = 0; k < 22; k++)
533 HLTWarning("An input block of cluster data contains"
534 " data from multiple DDL sources."
541 HLTWarning("The source DDL of a cluster data input block is %d."
542 " The expected range for the DDL is [1..20].",
546 hit = new AliHLTMUONRecHit(
547 clust.fHit.fX, clust.fHit.fY, clust.fHit.fZ,
555 detElemId, clust.fId,
556 clust.fNchannelsB, clust.fNchannelsNB,
557 clust.fChargeB, clust.fChargeNB,
562 clusterMap[clust.fId] = hit;
566 // We need to check if there are any channel data blocks and add their
567 // information to the AliHLTMUONRecHit objects.
568 for (block = GetFirstInputBlock(AliHLTMUONConstants::ChannelBlockDataType());
570 block = GetNextInputBlock()
573 specification |= block->fSpecification;
574 AliHLTMUONChannelsBlockReader inblock(block->fPtr, block->fSize);
575 if (not BlockStructureOk(inblock))
577 if (DumpDataOnError()) DumpEvent(evtData, trigData);
581 for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
583 const AliHLTMUONChannelStruct& channel = inblock[n];
585 AliHLTMUONRecHit* hit = clusterMap[channel.fClusterId];
588 // Decode the source DDL from the specification bits.
589 Int_t sourceDDL = -1;
591 AliHLTMUONUtils::UnpackSpecBits(block->fSpecification, ddl);
592 for (int k = 0; k < 22; k++)
602 HLTWarning("An input block of cluster data contains"
603 " data from multiple DDL sources."
610 HLTWarning("The source DDL of a cluster data input block is %d."
611 " The expected range for the DDL is [1..20].",
615 hit = new AliHLTMUONRecHit(0, 0, 0, sourceDDL, -1);
620 channel.fBusPatch, channel.fManu,
621 channel.fChannelAddress, channel.fSignal,
627 // Now we can look for tracks to add. We needed the ROOT trigger records
628 // and reco hits created before we can create track objects.
630 std::map<AliHLTInt32_t, AliHLTMUONTrack*> trackMap;
632 for (block = GetFirstInputBlock(AliHLTMUONConstants::TracksBlockDataType());
634 block = GetNextInputBlock()
637 specification |= block->fSpecification;
638 AliHLTMUONTracksBlockReader inblock(block->fPtr, block->fSize);
639 if (not BlockStructureOk(inblock))
641 if (DumpDataOnError()) DumpEvent(evtData, trigData);
645 for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
647 const AliHLTMUONTrackStruct& t = inblock[n];
648 trackMap[t.fId] = AddTrack(event, t);
652 std::map<AliHLTInt32_t, AliHLTMUONMansoTrack*> mansoTrackMap;
654 for (block = GetFirstInputBlock(AliHLTMUONConstants::MansoTracksBlockDataType());
656 block = GetNextInputBlock()
659 specification |= block->fSpecification;
660 AliHLTMUONMansoTracksBlockReader inblock(block->fPtr, block->fSize);
661 if (not BlockStructureOk(inblock))
663 if (DumpDataOnError()) DumpEvent(evtData, trigData);
667 for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
669 const AliHLTMUONMansoTrackStruct& t = inblock[n];
670 mansoTrackMap[t.fId] = AddTrack(event, t);
674 // Look for Manso track candidates to add the debug info to the tracks.
675 for (block = GetFirstInputBlock(AliHLTMUONConstants::MansoCandidatesBlockDataType());
677 block = GetNextInputBlock()
680 specification |= block->fSpecification;
681 AliHLTMUONMansoCandidatesBlockReader inblock(block->fPtr, block->fSize);
682 if (not BlockStructureOk(inblock))
684 if (DumpDataOnError()) DumpEvent(evtData, trigData);
688 for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
690 const AliHLTMUONMansoCandidateStruct& tc = inblock[n];
691 AliHLTMUONMansoTrack* mtrack = mansoTrackMap[tc.fTrack.fId];
694 // If we got here then we could not find the corresponding Manso
695 // track. So we need to create and add a new track object.
696 mtrack = AddTrack(event, tc.fTrack);
698 mtrack->SetDebugData(tc.fZmiddle, tc.fBl);
699 for (AliHLTUInt32_t i = 0; i < 4; ++i)
701 if (tc.fRoI[i] == AliHLTMUONConstants::NilMansoRoIStruct()) continue;
702 mtrack->SetRoI(i+7, tc.fRoI[i].fX, tc.fRoI[i].fY, tc.fRoI[i].fZ, tc.fRoI[i].fRadius);
707 bool decisionBlockFound = false;
709 UInt_t numHighPt = 0;
710 TClonesArray singlesDecisions("AliHLTMUONDecision::AliTrackDecision");
712 // Find the single tracks decision blocks and add their information.
713 // We just sum the trigger scalars and single decisions.
714 for (block = GetFirstInputBlock(AliHLTMUONConstants::SinglesDecisionBlockDataType());
716 block = GetNextInputBlock()
719 decisionBlockFound = true;
720 specification |= block->fSpecification;
721 AliHLTMUONSinglesDecisionBlockReader inblock(block->fPtr, block->fSize);
722 if (not BlockStructureOk(inblock))
724 if (DumpDataOnError()) DumpEvent(evtData, trigData);
728 numLowPt += inblock.BlockHeader().fNlowPt;
729 numHighPt += inblock.BlockHeader().fNhighPt;
731 for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
733 const AliHLTMUONTrackDecisionStruct& t = inblock[n];
736 AliHLTMUONUtils::UnpackTrackDecisionBits(t.fTriggerBits, highPt, lowPt);
738 // Try find the corresponding track.
739 const TObject* track = trackMap[t.fTrackId];
740 if (track == NULL) track = mansoTrackMap[t.fTrackId];
742 // If the track was not found then create a dummy one.
745 AliHLTMUONMansoTrack* tr = new AliHLTMUONMansoTrack(t.fTrackId);
748 mansoTrackMap[t.fTrackId] = tr;
751 new (singlesDecisions[singlesDecisions.GetEntriesFast()])
752 AliHLTMUONDecision::AliTrackDecision(t.fPt, lowPt, highPt, track);
756 UInt_t numUnlikeAnyPt = 0;
757 UInt_t numUnlikeLowPt = 0;
758 UInt_t numUnlikeHighPt = 0;
759 UInt_t numLikeAnyPt = 0;
760 UInt_t numLikeLowPt = 0;
761 UInt_t numLikeHighPt = 0;
762 UInt_t numAnyMass = 0;
763 UInt_t numLowMass = 0;
764 UInt_t numHighMass = 0;
765 TClonesArray pairsDecisions("AliHLTMUONDecision::AliPairDecision");
767 // Find the track pairs decision blocks and add their information.
768 // We just sum the trigger scalars and track pair decisions.
769 for (block = GetFirstInputBlock(AliHLTMUONConstants::PairsDecisionBlockDataType());
771 block = GetNextInputBlock()
774 decisionBlockFound = true;
775 specification |= block->fSpecification;
776 AliHLTMUONPairsDecisionBlockReader inblock(block->fPtr, block->fSize);
777 if (not BlockStructureOk(inblock))
779 if (DumpDataOnError()) DumpEvent(evtData, trigData);
783 numUnlikeAnyPt += inblock.BlockHeader().fNunlikeAnyPt;
784 numUnlikeLowPt += inblock.BlockHeader().fNunlikeLowPt;
785 numUnlikeHighPt += inblock.BlockHeader().fNunlikeHighPt;
786 numLikeAnyPt += inblock.BlockHeader().fNlikeAnyPt;
787 numLikeLowPt += inblock.BlockHeader().fNlikeLowPt;
788 numLikeHighPt += inblock.BlockHeader().fNlikeHighPt;
789 numAnyMass += inblock.BlockHeader().fNmassAny;
790 numLowMass += inblock.BlockHeader().fNmassLow;
791 numHighMass += inblock.BlockHeader().fNmassHigh;
793 for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
795 const AliHLTMUONPairDecisionStruct& t = inblock[n];
797 bool highMass, lowMass, unlike;
798 AliHLTUInt8_t highPtCount, lowPtCount;
799 AliHLTMUONUtils::UnpackPairDecisionBits(
800 t.fTriggerBits, highMass, lowMass, unlike,
801 highPtCount, lowPtCount
804 // Try find the corresponding tracks.
805 const TObject* trackA = trackMap[t.fTrackAId];
806 if (trackA == NULL) trackA = mansoTrackMap[t.fTrackAId];
807 const TObject* trackB = trackMap[t.fTrackBId];
808 if (trackB == NULL) trackB = mansoTrackMap[t.fTrackBId];
810 // If either of the tracks was not found then create a dummy one.
813 AliHLTMUONMansoTrack* tr = new AliHLTMUONMansoTrack(t.fTrackAId);
816 mansoTrackMap[t.fTrackAId] = tr;
820 AliHLTMUONMansoTrack* tr = new AliHLTMUONMansoTrack(t.fTrackBId);
823 mansoTrackMap[t.fTrackBId] = tr;
826 new (pairsDecisions[pairsDecisions.GetEntriesFast()])
827 AliHLTMUONDecision::AliPairDecision(
828 t.fInvMass, lowMass, highMass, unlike,
829 lowPtCount, highPtCount, trackA, trackB
834 // Do not add the decision if no decision blocks were found.
835 if (decisionBlockFound)
837 AliHLTMUONDecision* triggerDecision = new AliHLTMUONDecision(
838 numLowPt, numHighPt, numUnlikeAnyPt, numUnlikeLowPt,
839 numUnlikeHighPt, numLikeAnyPt, numLikeLowPt,
840 numLikeHighPt, numAnyMass, numLowMass, numHighMass
842 for (Int_t i = 0; i < singlesDecisions.GetEntriesFast(); i++)
844 AliHLTMUONDecision::AliTrackDecision* decision =
845 static_cast<AliHLTMUONDecision::AliTrackDecision*>( singlesDecisions[i] );
846 triggerDecision->AddDecision(decision);
848 for (Int_t j = 0; j < pairsDecisions.GetEntriesFast(); j++)
850 AliHLTMUONDecision::AliPairDecision* decision =
851 static_cast<AliHLTMUONDecision::AliPairDecision*>( pairsDecisions[j] );
852 triggerDecision->AddDecision(decision);
855 event.Add(triggerDecision);
858 PushBack(&event, AliHLTMUONConstants::RootifiedEventDataType(), specification);
864 AliHLTMUONMansoTrack* AliHLTMUONRootifierComponent::AddTrack(
865 AliHLTMUONEvent& event, const AliHLTMUONMansoTrackStruct& track
868 // Converts the track structure and adds it to the event object.
870 AliHLTMUONParticleSign sign;
872 AliHLTMUONUtils::UnpackMansoTrackFlags(
873 track.fFlags, sign, hitset
876 // Try find the trigger record in 'event'.
877 const AliHLTMUONTriggerRecord* trigrec = NULL;
878 for (Int_t k = 0; k < event.Array().GetEntriesFast(); k++)
880 if (event.Array()[k]->IsA() != AliHLTMUONTriggerRecord::Class())
882 const AliHLTMUONTriggerRecord* tk =
883 static_cast<const AliHLTMUONTriggerRecord*>(event.Array()[k]);
884 if (tk->Id() == track.fTrigRec)
891 // Now try find the hits in 'event'.
892 // If they cannot be found then create new ones.
893 const AliHLTMUONRecHit* hit7 = NULL;
894 const AliHLTMUONRecHit* hit8 = NULL;
895 const AliHLTMUONRecHit* hit9 = NULL;
896 const AliHLTMUONRecHit* hit10 = NULL;
897 for (Int_t k = 0; k < event.Array().GetEntriesFast(); k++)
899 if (event.Array()[k]->IsA() != AliHLTMUONRecHit::Class())
901 const AliHLTMUONRecHit* h =
902 static_cast<const AliHLTMUONRecHit*>(event.Array()[k]);
904 if (hitset[0] and h->X() == track.fHit[0].fX and h->Y() == track.fHit[0].fY
905 and h->Z() == track.fHit[0].fZ)
909 if (hitset[1] and h->X() == track.fHit[1].fX and h->Y() == track.fHit[1].fY
910 and h->Z() == track.fHit[1].fZ)
914 if (hitset[2] and h->X() == track.fHit[2].fX and h->Y() == track.fHit[2].fY
915 and h->Z() == track.fHit[2].fZ)
919 if (hitset[3] and h->X() == track.fHit[3].fX and h->Y() == track.fHit[3].fY
920 and h->Z() == track.fHit[3].fZ)
925 AliHLTMUONRecHit* newhit;
926 if (hitset[0] and hit7 == NULL)
928 newhit = new AliHLTMUONRecHit(track.fHit[0].fX, track.fHit[0].fY, track.fHit[0].fZ);
932 if (hitset[1] and hit8 == NULL)
934 newhit = new AliHLTMUONRecHit(track.fHit[1].fX, track.fHit[1].fY, track.fHit[1].fZ);
938 if (hitset[2] and hit9 == NULL)
940 newhit = new AliHLTMUONRecHit(track.fHit[2].fX, track.fHit[2].fY, track.fHit[2].fZ);
944 if (hitset[3] and hit10 == NULL)
946 newhit = new AliHLTMUONRecHit(track.fHit[3].fX, track.fHit[3].fY, track.fHit[3].fZ);
951 AliHLTMUONMansoTrack* tr = new AliHLTMUONMansoTrack(
952 track.fId, sign, track.fPx, track.fPy, track.fPz, track.fChi2,
953 trigrec, hit7, hit8, hit9, hit10
960 AliHLTMUONTrack* AliHLTMUONRootifierComponent::AddTrack(
961 AliHLTMUONEvent& event, const AliHLTMUONTrackStruct& track
964 // Converts the track structure and adds it to the event object.
966 AliHLTMUONParticleSign sign;
968 AliHLTMUONUtils::UnpackTrackFlags(
969 track.fFlags, sign, hitset
972 // Try find the trigger record in 'event'.
973 const AliHLTMUONTriggerRecord* trigrec = NULL;
974 for (Int_t k = 0; k < event.Array().GetEntriesFast(); k++)
976 if (event.Array()[k]->IsA() != AliHLTMUONTriggerRecord::Class())
978 const AliHLTMUONTriggerRecord* tk =
979 static_cast<const AliHLTMUONTriggerRecord*>(event.Array()[k]);
980 if (tk->Id() == track.fTrigRec)
987 // Now try find the hits in 'event'.
988 // If they cannot be found then create new ones.
989 const AliHLTMUONRecHit* hits[16];
990 for (int i = 0; i < 16; ++i) hits[i] = NULL;
991 for (Int_t k = 0; k < event.Array().GetEntriesFast(); k++)
993 if (event.Array()[k]->IsA() != AliHLTMUONRecHit::Class())
995 const AliHLTMUONRecHit* h =
996 static_cast<const AliHLTMUONRecHit*>(event.Array()[k]);
997 for (int i = 0; i < 16; ++i)
999 if (hitset[i] and h->X() == track.fHit[i].fX and h->Y() == track.fHit[i].fY
1000 and h->Z() == track.fHit[i].fZ)
1006 AliHLTMUONRecHit* newhit;
1007 for (int i = 0; i < 16; ++i)
1009 if (hitset[i] and hits[i] == NULL)
1011 newhit = new AliHLTMUONRecHit(track.fHit[i].fX, track.fHit[i].fY, track.fHit[i].fZ);
1017 AliHLTMUONTrack* tr = new AliHLTMUONTrack(
1018 track.fId, sign, track.fPx, track.fPy, track.fPz,
1019 track.fInverseBendingMomentum, track.fThetaX, track.fThetaY,
1020 track.fX, track.fY, track.fZ, track.fChi2,