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 **************************************************************************/
17 // $Id: AliHLTMUONDataCheckerComponent.cxx 26179 2008-05-29 22:27:27Z aszostak $
20 /// @file AliHLTMUONDataCheckerComponent.cxx
21 /// @author Artur Szostak <artursz@iafrica.com>
23 /// @brief Implementation of the dHLT data integrity checker component.
25 /// This component is used to check the data integrity of dHLT raw internal data
26 /// blocks. If there are any problems found then an appropriate error message is
30 #include "AliHLTMUONDataCheckerComponent.h"
31 #include "AliHLTMUONConstants.h"
32 #include "AliHLTLogging.h"
33 #include "AliHLTSystem.h"
34 #include "AliHLTDefinitions.h"
35 #include "AliRawDataHeader.h"
36 #include "AliMUONConstants.h"
37 #include "AliMUONTrackerDDLDecoder.h"
38 #include "AliMUONTrackerDDLDecoderEventHandler.h"
39 #include "AliMUONTriggerDDLDecoder.h"
40 #include "AliMUONTriggerDDLDecoderEventHandler.h"
41 #include "AliMpDDLStore.h"
42 #include "AliMpDEStore.h"
43 #include "AliMpDEManager.h"
44 #include "AliMpBusPatch.h"
45 #include "AliMpDetElement.h"
46 #include "AliMpSegmentation.h"
47 #include "AliMpVSegmentation.h"
59 * Routine to check if at least one corresponding DDL has been marked
60 * for a particular chamber.
62 bool ChamberMarkedInDDLList(AliHLTInt32_t chamber, bool ddl[22])
64 if (chamber < 0 or chamber > 21) return false;
67 case 0: return ddl[0] or ddl[1];
68 case 1: return ddl[2] or ddl[3];
69 case 2: return ddl[4] or ddl[5];
70 case 3: return ddl[6] or ddl[7];
71 case 4: return ddl[8] or ddl[9] or ddl[10] or ddl[11];
72 case 5: return ddl[8] or ddl[9] or ddl[10] or ddl[11];
73 case 6: return ddl[12] or ddl[13];
74 case 7: return ddl[14] or ddl[15];
75 case 8: return ddl[16] or ddl[17];
76 case 9: return ddl[18] or ddl[19];
77 case 10: return ddl[20] or ddl[21];
78 case 11: return ddl[20] or ddl[21];
79 case 12: return ddl[20] or ddl[21];
80 case 13: return ddl[20] or ddl[21];
81 default: return false;
88 ClassImp(AliHLTMUONDataCheckerComponent)
91 AliHLTMUONDataCheckerComponent::AliHLTMUONDataCheckerComponent() :
92 AliHLTMUONProcessor(),
96 fFilterBadBlocks(false),
97 fNoGlobalChecks(false),
98 fWarnForUnexpecedBlock(false),
101 /// Default constructor.
105 AliHLTMUONDataCheckerComponent::~AliHLTMUONDataCheckerComponent()
107 /// Default destructor.
110 const char* AliHLTMUONDataCheckerComponent::GetComponentID()
112 /// Inherited from AliHLTComponent. Returns the component ID.
114 return AliHLTMUONConstants::DataCheckerComponentId();
118 void AliHLTMUONDataCheckerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
120 /// Inherited from AliHLTProcessor. Returns the list of expected input data types.
121 /// At the moment this list is "any data type" origin MUON since it is not known
122 /// before hand what kind of input blocks we will get.
124 assert( list.empty() );
125 list.push_back( kAliHLTAnyDataType | kAliHLTDataOriginMUON );
129 AliHLTComponentDataType AliHLTMUONDataCheckerComponent::GetOutputDataType()
131 /// Inherited from AliHLTComponent. Returns the output data type of
132 /// "any data type" with MUON origin.
134 return kAliHLTAnyDataType | kAliHLTDataOriginMUON;
138 void AliHLTMUONDataCheckerComponent::GetOutputDataSize(
139 unsigned long& constBase, double& inputMultiplier
142 /// Inherited from AliHLTComponent.
143 /// Returns an estimate of the expected output data size.
145 // Both of these are zero because we will only ever pass on input data blocks
146 // and never generate data in this component.
152 AliHLTComponent* AliHLTMUONDataCheckerComponent::Spawn()
154 /// Inherited from AliHLTComponent. Creates a new object instance.
156 return new AliHLTMUONDataCheckerComponent;
160 bool AliHLTMUONDataCheckerComponent::IgnoreArgument(const char* arg) const
162 /// Return true if the argument is -delaysetup
163 /// to prevent the parent class from parsing these arguments in DoInit.
165 if (strcmp(arg, "-delaysetup") == 0)
176 int AliHLTMUONDataCheckerComponent::DoInit(int argc, const char** argv)
178 /// Inherited from AliHLTComponent.
179 /// Parses the command line parameters and initialises the component.
181 HLTInfo("Initialising dHLT data checker component.");
183 // Inherit the parents functionality.
184 int result = AliHLTMUONProcessor::DoInit(argc, argv);
185 if (result != 0) return result;
187 // Initialise flags with default values.
190 fDontForward = false;
191 fFilterBadBlocks = false;
192 fNoGlobalChecks = false;
193 fWarnForUnexpecedBlock = false;
194 fReturnError = false;
196 for (int i = 0; i < argc; i++)
198 if (ArgumentAlreadyHandled(i, argv[i])) continue;
200 if (strcmp(argv[i], "-ignoretype") == 0)
203 HLTInfo("Ignoring data type of data blocks as given by framework.");
206 if (strcmp(argv[i], "-ignorespec") == 0)
209 HLTInfo("Ignoring data specification of data blocks as given by framework.");
212 if (strcmp(argv[i], "-dontforward") == 0)
215 HLTInfo("Not forwarding input data blocks.");
218 if (strcmp(argv[i], "-filter") == 0)
220 fFilterBadBlocks = true;
221 HLTInfo("Passing only bad blocks to output.");
224 if (strcmp(argv[i], "-no_global_check") == 0)
226 fNoGlobalChecks = true;
227 HLTInfo("Only per block data consistancy checks will be applied,"
228 " but no global checks will be made."
232 if (strcmp(argv[i], "-warn_on_unexpected_block") == 0)
234 fWarnForUnexpecedBlock = true;
237 if (strcmp(argv[i], "-return_error") == 0)
243 HLTError("Unknown option '%s'.", argv[i]);
251 int AliHLTMUONDataCheckerComponent::DoDeinit()
253 /// Inherited from AliHLTComponent. Performs a cleanup of the component.
255 HLTInfo("Deinitialising dHLT data checker component.");
260 int AliHLTMUONDataCheckerComponent::DoEvent(
261 const AliHLTComponentEventData& evtData,
262 const AliHLTComponentBlockData* blocks,
263 AliHLTComponentTriggerData& trigData,
264 AliHLTUInt8_t* /*outputPtr*/,
265 AliHLTUInt32_t& size,
266 AliHLTComponentBlockDataList& outputBlocks
269 /// Inherited from AliHLTProcessor. Processes the new event data.
270 /// Here we go through the list of input data blocks and apply extensive
271 /// data integrity checking on the data found.
273 if (not IsDataEvent()) return 0;
275 HLTDebug("Processing event %llu with %u input data blocks.",
276 evtData.fEventID, evtData.fBlockCnt
279 // Allocate an array of flags indicating if the data block is OK or not,
280 // also arrays to store specific.
281 bool dataProblems = false;
282 bool* blockOk = NULL;
283 typedef const AliHLTComponentBlockData* PAliHLTComponentBlockData;
284 PAliHLTComponentBlockData* trigRecBlocks = NULL;
285 PAliHLTComponentBlockData* trigRecDebugBlocks = NULL;
286 PAliHLTComponentBlockData* hitBlocks = NULL;
287 PAliHLTComponentBlockData* clusterBlocks = NULL;
288 PAliHLTComponentBlockData* channelBlocks = NULL;
289 PAliHLTComponentBlockData* mansoTrackBlocks = NULL;
290 PAliHLTComponentBlockData* mansoCandidateBlocks = NULL;
291 PAliHLTComponentBlockData* trackBlocks = NULL;
292 PAliHLTComponentBlockData* singleDecisionBlocks = NULL;
293 PAliHLTComponentBlockData* pairDecisionBlocks = NULL;
294 AliHLTUInt32_t trigRecBlocksCount = 0;
295 AliHLTUInt32_t trigRecDebugBlocksCount = 0;
296 AliHLTUInt32_t hitBlocksCount = 0;
297 AliHLTUInt32_t clusterBlocksCount = 0;
298 AliHLTUInt32_t channelBlocksCount = 0;
299 AliHLTUInt32_t mansoTrackBlocksCount = 0;
300 AliHLTUInt32_t mansoCandidateBlocksCount = 0;
301 AliHLTUInt32_t trackBlocksCount = 0;
302 AliHLTUInt32_t singleDecisionBlocksCount = 0;
303 AliHLTUInt32_t pairDecisionBlocksCount = 0;
306 blockOk = new bool[evtData.fBlockCnt];
307 trigRecBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
308 trigRecDebugBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
309 hitBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
310 clusterBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
311 channelBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
312 mansoTrackBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
313 mansoCandidateBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
314 trackBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
315 singleDecisionBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
316 pairDecisionBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
318 catch (const std::bad_alloc&)
320 HLTError("Could not allocate more memory for internal arrays.");
321 // Make sure to clean up if partially allocated memory.
322 if (blockOk != NULL) delete [] blockOk;
323 if (trigRecBlocks != NULL) delete [] trigRecBlocks;
324 if (trigRecDebugBlocks != NULL) delete [] trigRecDebugBlocks;
325 if (hitBlocks != NULL) delete [] hitBlocks;
326 if (clusterBlocks != NULL) delete [] clusterBlocks;
327 if (channelBlocks != NULL) delete [] channelBlocks;
328 if (mansoTrackBlocks != NULL) delete [] mansoTrackBlocks;
329 if (mansoCandidateBlocks != NULL) delete [] mansoCandidateBlocks;
330 if (trackBlocks != NULL) delete [] trackBlocks;
331 if (singleDecisionBlocks != NULL) delete [] singleDecisionBlocks;
332 if (pairDecisionBlocks != NULL) delete [] pairDecisionBlocks;
336 AliHLTComponentDataType anyPrivateType = AliHLTComponentDataTypeInitializer(
337 kAliHLTAnyDataType, kAliHLTDataOriginPrivate
342 // Clear all the flags indicating if the blocks are ok.
343 for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
348 for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
350 HLTDebug("Handling block: %u, with fDataType = '%s', fPtr = %p and fSize = %u bytes.",
351 n, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fPtr, blocks[n].fSize
354 AliHLTMUONDataBlockType blockType = kUnknownDataBlock;
358 // Decode the block type if we must ignore the block type
359 // as given by the HLT framework.
360 if (blocks[n].fSize >= sizeof(AliHLTMUONDataBlockHeader))
362 const AliHLTMUONDataBlockHeader* header =
363 reinterpret_cast<const AliHLTMUONDataBlockHeader*>(blocks[n].fPtr);
364 blockType = AliHLTMUONDataBlockType(header->fType);
369 if (blocks[n].fDataType == anyPrivateType)
371 // Completely ignore any private HLT internal block types.
375 else if (blocks[n].fDataType == AliHLTMUONConstants::DDLRawDataType())
377 blockOk[n] = CheckRawDataBlock(blocks[n], n);
380 else if (blocks[n].fDataType == AliHLTMUONConstants::TriggerRecordsBlockDataType())
382 blockType = kTriggerRecordsDataBlock;
384 else if (blocks[n].fDataType == AliHLTMUONConstants::TrigRecsDebugBlockDataType())
386 blockType = kTrigRecsDebugDataBlock;
388 else if (blocks[n].fDataType == AliHLTMUONConstants::RecHitsBlockDataType())
390 blockType = kRecHitsDataBlock;
392 else if (blocks[n].fDataType == AliHLTMUONConstants::ClusterBlockDataType())
394 blockType = kClustersDataBlock;
396 else if (blocks[n].fDataType == AliHLTMUONConstants::ChannelBlockDataType())
398 blockType = kChannelsDataBlock;
400 else if (blocks[n].fDataType == AliHLTMUONConstants::MansoTracksBlockDataType())
402 blockType = kMansoTracksDataBlock;
404 else if (blocks[n].fDataType == AliHLTMUONConstants::MansoCandidatesBlockDataType())
406 blockType = kMansoCandidatesDataBlock;
408 else if (blocks[n].fDataType == AliHLTMUONConstants::TracksBlockDataType())
410 blockType = kTracksDataBlock;
412 else if (blocks[n].fDataType == AliHLTMUONConstants::SinglesDecisionBlockDataType())
414 blockType = kSinglesDecisionDataBlock;
416 else if (blocks[n].fDataType == AliHLTMUONConstants::PairsDecisionBlockDataType())
418 blockType = kPairsDecisionDataBlock;
422 // Log a message indicating that we got a data block that we
423 // do not know how to handle.
424 if (fWarnForUnexpecedBlock)
425 HLTWarning("Received a data block of a type we cannot"
426 " handle: '%s', spec: 0x%8.8X",
427 DataType2Text(blocks[n].fDataType).c_str(),
428 blocks[n].fSpecification
432 HLTDebug("Received a data block of a type we cannot"
433 " handle: '%s', spec: 0x%8.8X",
434 DataType2Text(blocks[n].fDataType).c_str(),
435 blocks[n].fSpecification
443 case kTriggerRecordsDataBlock:
444 blockOk[n] = CheckTriggerRecordsBlock(blocks[n], n);
445 trigRecBlocks[trigRecBlocksCount++] = &blocks[n];
447 case kTrigRecsDebugDataBlock:
448 blockOk[n] = CheckTrigRecsDebugBlock(blocks[n], n);
449 trigRecDebugBlocks[trigRecDebugBlocksCount++] = &blocks[n];
451 case kRecHitsDataBlock:
452 blockOk[n] = CheckRecHitsBlock(blocks[n], n);
453 hitBlocks[hitBlocksCount++] = &blocks[n];
455 case kClustersDataBlock:
456 blockOk[n] = CheckClustersBlock(blocks[n], n);
457 clusterBlocks[clusterBlocksCount++] = &blocks[n];
459 case kChannelsDataBlock:
460 blockOk[n] = CheckChannelsBlock(blocks[n], n);
461 channelBlocks[channelBlocksCount++] = &blocks[n];
463 case kMansoTracksDataBlock:
464 blockOk[n] = CheckMansoTracksBlock(blocks[n], n);
465 mansoTrackBlocks[mansoTrackBlocksCount++] = &blocks[n];
467 case kMansoCandidatesDataBlock:
468 blockOk[n] = CheckMansoCandidatesBlock(blocks[n], n);
469 mansoCandidateBlocks[mansoCandidateBlocksCount++] = &blocks[n];
471 case kTracksDataBlock:
472 blockOk[n] = CheckTracksBlock(blocks[n], n);
473 trackBlocks[trackBlocksCount++] = &blocks[n];
475 case kSinglesDecisionDataBlock:
476 blockOk[n] = CheckSinglesDecisionBlock(blocks[n], n);
477 singleDecisionBlocks[singleDecisionBlocksCount++] = &blocks[n];
479 case kPairsDecisionDataBlock:
480 blockOk[n] = CheckPairsDecisionBlock(blocks[n], n);
481 pairDecisionBlocks[pairDecisionBlocksCount++] = &blocks[n];
484 HLTDebug("Received a data block for which we could not decode the data type."
485 " fDataType = '%s', fSpecification = 0x%8.8X, fSize = %u bytes.",
486 DataType2Text(blocks[n].fDataType).c_str(),
487 blocks[n].fSpecification,
494 // Apply the global data consistancy checks if not suppressed by the user.
495 if (not fNoGlobalChecks)
498 blocks, blockOk, evtData.fBlockCnt,
499 trigRecBlocks, trigRecBlocksCount,
500 trigRecDebugBlocks, trigRecDebugBlocksCount,
501 hitBlocks, hitBlocksCount,
502 clusterBlocks, clusterBlocksCount,
503 channelBlocks, channelBlocksCount,
504 mansoTrackBlocks, mansoTrackBlocksCount,
505 mansoCandidateBlocks, mansoCandidateBlocksCount,
506 trackBlocks, trackBlocksCount,
507 singleDecisionBlocks, singleDecisionBlocksCount,
508 pairDecisionBlocks, pairDecisionBlocksCount
512 // Forward the input data blocks if we have not been asked to drop them.
513 // Also remember to filter for bad blocks if so specified.
514 if (not fDontForward)
516 for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
518 if (fFilterBadBlocks and blockOk[n]) continue;
519 outputBlocks.push_back(blocks[n]);
523 // Set dataProblems flag is there was at least one block with problems.
524 for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
526 if (not blockOk[n]) dataProblems = true;
531 // make sure to cleanup memory
533 delete [] trigRecBlocks;
534 delete [] trigRecDebugBlocks;
536 delete [] clusterBlocks;
537 delete [] channelBlocks;
538 delete [] mansoTrackBlocks;
539 delete [] mansoCandidateBlocks;
540 delete [] trackBlocks;
541 delete [] singleDecisionBlocks;
542 delete [] pairDecisionBlocks;
545 // Finally we set the total size of output memory we consumed, which is
546 // zero since we just copied the input descriptors to output if anything.
549 if (dataProblems and DumpDataOnError()) DumpEvent(evtData, trigData);
553 // If we were requested to return errors if there were integrity
554 // problems then check if any data blocks had problems and return
556 if (dataProblems) return -EFAULT;
562 bool AliHLTMUONDataCheckerComponent::IsSpecificationValid(
563 const AliHLTComponentBlockData& block,
564 AliHLTUInt32_t blockNumber,
568 /// Checks if the specification bits are valid.
569 /// \param block The block whose specification should be checked.
570 /// \param blockNumber The block index number being checked.
571 /// \param name The name of the type of block being checked.
572 /// \returns true if the specification is valid and false otherwise.
574 if (AliHLTMUONUtils::IsSpecValid(block.fSpecification))
577 HLTError("Problem found with data block %d, fDataType = '%s',"
578 " fPtr = %p and fSize = %u bytes."
579 " Assuming this is a %s data block."
580 " Problem: The specification does not contain a valid pattern,"
581 " received 0x%8.8X for the specification.",
583 DataType2Text(block.fDataType).c_str(),
593 bool AliHLTMUONDataCheckerComponent::IsFromTrackerOnly(
594 const AliHLTComponentBlockData& block,
595 AliHLTUInt32_t blockNumber,
599 /// Checks if the specification bits are valid and indicate the block
600 /// contains data or information only from the tracker DDLs.
601 /// \param block The block whose specification should be checked.
602 /// \param blockNumber The block index number being checked.
603 /// \param name The name of the type of block being checked.
604 /// \returns true if the specification indicates data is only from tracker.
606 bool result = IsSpecificationValid(block, blockNumber, name);
608 if (AliHLTMUONUtils::ContainsDataFromTracker(block.fSpecification) and
609 not AliHLTMUONUtils::ContainsDataFromTrigger(block.fSpecification)
615 HLTError("Problem found with data block %d, fDataType = '%s',"
616 " fPtr = %p and fSize = %u bytes."
617 " Assuming this is a %s data block."
618 " Problem: The data block does not contain data only from the"
619 " tracker DDLs as expected."
620 " Received 0x%8.8X for the specification.",
622 DataType2Text(block.fDataType).c_str(),
632 bool AliHLTMUONDataCheckerComponent::IsFromTriggerOnly(
633 const AliHLTComponentBlockData& block,
634 AliHLTUInt32_t blockNumber,
638 /// Checks if the specification bits are valid and indicate the block
639 /// contains data or information only from the trigger DDLs.
640 /// \param block The block whose specification should be checked.
641 /// \param blockNumber The block index number being checked.
642 /// \param name The name of the type of block being checked.
643 /// \returns true if the specification indicates data is only from trigger.
645 bool result = IsSpecificationValid(block, blockNumber, name);
647 if (AliHLTMUONUtils::ContainsDataFromTrigger(block.fSpecification) and
648 not AliHLTMUONUtils::ContainsDataFromTracker(block.fSpecification)
654 HLTError("Problem found with data block %d, fDataType = '%s',"
655 " fPtr = %p and fSize = %u bytes."
656 " Assuming this is a %s data block."
657 " Problem: The data block does not contain data only from the"
658 " trigger DDLs as expected."
659 " Received 0x%8.8X for the specification.",
661 DataType2Text(block.fDataType).c_str(),
671 bool AliHLTMUONDataCheckerComponent::IsMomentumVectorOk(
672 const AliHLTComponentBlockData& block,
673 AliHLTUInt32_t blockNumber,
675 AliHLTUInt32_t entryNumber,
681 /// Checks if the momentum vector is reasonable.
682 /// \param block The block from which the momentum vector data comes from.
683 /// \param blockNumber The block index number.
684 /// \param name The name of the type of block.
685 /// \param entryNumber The entry index number of the structure holding
686 /// the momentum vector data.
687 /// \param px The X coordinate of the momentum vector (GeV/c).
688 /// \param py The Y coordinate of the momentum vector (GeV/c).
689 /// \param pz The Z coordinate of the momentum vector (GeV/c).
690 /// \returns true if the momentum vector is valid and false otherwise.
692 // If the momentum vector is nil then ignore it.
693 if (px == 0 and py == 0 and pz == 0) return true;
697 // If the momentum vector is sane then we should not have a particle with
698 // more energy than 14 TeV and momentum should be in the negative direction.
699 double momentum = sqrt(px*px + py*py + pz*pz);
702 // Just warn since this is a data sanity problem rather
703 // than a data integrity problem.
704 HLTWarning("Problem found with data block %d, fDataType = '%s',"
705 " fPtr = %p and fSize = %u bytes."
706 " Assuming this is a %s data block."
707 " Problem with entry %d in block: The momentum vector"
708 " p = {%f, %f, %f}, |p| = %f looks too big.",
710 DataType2Text(block.fDataType).c_str(),
723 // Just warn since this is a data sanity problem rather
724 // than a data integrity problem.
725 HLTWarning("Problem found with data block %d, fDataType = '%s',"
726 " fPtr = %p and fSize = %u bytes."
727 " Assuming this is a %s data block."
728 " Problem with entry %d in block: The momentum vector"
729 " p = {%f, %f, %f} points away from the dimuon"
730 " spectrometer (p_z > 0).",
732 DataType2Text(block.fDataType).c_str(),
746 bool AliHLTMUONDataCheckerComponent::AreMomentumCalcParamsOk(
747 const AliHLTComponentBlockData& block,
748 AliHLTUInt32_t blockNumber,
750 AliHLTUInt32_t entryNumber,
751 AliHLTFloat32_t zmiddle,
755 /// Checks if the parameters for the momentum calculation are reasonable.
756 /// \param block The block from which the parameter data comes from.
757 /// \param blockNumber The block index number.
758 /// \param name The name of the type of block.
759 /// \param entryNumber The entry index number of the structure holding
760 /// the parameter data data.
761 /// \param zmiddle The z-coordinate of the middle of the magnetic field (cm).
762 /// \param bl The integrated magnetic field (T.m).
763 /// \returns true if the parameters are valid and false otherwise.
767 // Check that the value of the fZmiddle value is somewhere
768 // within the tracking / dipole magnetic field area.
769 if (zmiddle < AliMUONConstants::AbsZEnd() or
770 zmiddle < AliMUONConstants::MuonFilterZBeg()
773 // Just warn since this is a data sanity problem rather
774 // than a data integrity problem.
775 HLTWarning("Problem found with data block %d, fDataType = '%s',"
776 " fPtr = %p and fSize = %u bytes."
777 " Assuming this is a %s data block."
778 " Problem with entry %d in block: The Z coordinate %f cm"
779 " used as the middle of the magnetic field in the momentum"
780 " calculation is outside the dimuon spectrometers dipole"
781 " magnetic field volume.",
783 DataType2Text(block.fDataType).c_str(),
793 // Also check that the value of the 'bl' value is within a
794 // reasonable range: |bl| < Lmax * Bmax, where
795 // Lmax = max length from vertex to end of spectrometer, and
796 // Bmax = max magnetic field of dipole, taken as 1 tesla.
797 // Approximating Lmax * Bmax as 20 T.m
800 // Just warn since this is a data sanity problem rather
801 // than a data integrity problem.
802 HLTWarning("Problem found with data block %d, fDataType = '%s',"
803 " fPtr = %p and fSize = %u bytes."
804 " Assuming this is a %s data block."
805 " Problem with entry %d in block: The integrated magnetic"
806 " field value %f T.m used in the momentum calculation"
807 " has an unreasonably large absolute value.",
809 DataType2Text(block.fDataType).c_str(),
823 bool AliHLTMUONDataCheckerComponent::IsHitCoordinateOk(
824 const AliHLTComponentBlockData& block,
825 AliHLTUInt32_t blockNumber,
827 AliHLTUInt32_t entryNumber,
828 const AliHLTMUONRecHitStruct& hit,
829 AliHLTInt32_t minChamber,
830 AliHLTInt32_t maxChamber,
831 AliHLTInt32_t expectedChamber,
835 /// Checks if the hit coordinate is compatible with a the location of a
836 /// dimuon spectrometer chamber. Also, if expectedChamber is not -1, then
837 /// the hit coordinate is checked if to comes from that chamber.
838 /// We also check if the fFlags containing the chamber number and detector
839 /// element ID are correct.
840 /// \param block The block from which the hit data comes from.
841 /// \param blockNumber The block index number.
842 /// \param name The name of the type of block.
843 /// \param entryNumber The entry index number of the hit.
844 /// \param hit The hit data being checked.
845 /// \param minChamber The minimum valid chamber number to check for.
846 /// \param maxChamber The maximum valid chamber number to check for.
847 /// \param expectedChamber If not -1 then this is the chamber number to
849 /// \param ddl The array decoded by AliHLTMUONUtils::UnpackSpecBits.
850 /// \returns true if the hit is valid and false otherwise.
852 assert( 0 <= minChamber and minChamber < 14 );
853 assert( 0 <= maxChamber and maxChamber < 14 );
857 AliHLTUInt8_t chNum = 0xFF;
858 AliHLTUInt16_t detElemId = 0xFFFF;
859 AliHLTMUONUtils::UnpackRecHitFlags(hit.fFlags, chNum, detElemId);
861 Int_t chamber = AliMUONConstants::ChamberNumber(hit.fZ, false); // false = do not warn.
862 if (chamber < minChamber or maxChamber < chamber)
864 HLTError("Problem found with data block %d, fDataType = '%s',"
865 " fPtr = %p and fSize = %u bytes."
866 " Assuming this is a %s data block."
867 " Problem with entry %d in block: The hit {x = %f, y = %f,"
868 " z = %f} cm has a z-coordinate that does not correspond"
869 " to the nominal position of any chambers in the range"
872 DataType2Text(block.fDataType).c_str(),
877 hit.fX, hit.fY, hit.fZ,
884 if (chNum != chamber)
886 HLTError("Problem found with data block %d, fDataType = '%s',"
887 " fPtr = %p and fSize = %u bytes."
888 " Assuming this is a %s data block."
889 " Problem with entry %d in block: The hit {x = %f, y = %f,"
890 " z = %f} cm has a chamber number %d that does not correspond"
891 " to the expected chamber %d given by the z-coordinate.",
893 DataType2Text(block.fDataType).c_str(),
898 hit.fX, hit.fY, hit.fZ,
903 if (minChamber <= Int_t(chNum) and Int_t(chNum) <= maxChamber)
905 // Rather use the explicit value in the data if it
911 if (expectedChamber != -1 and chamber != expectedChamber)
913 HLTError("Problem found with data block %d, fDataType = '%s',"
914 " fPtr = %p and fSize = %u bytes."
915 " Assuming this is a %s data block."
916 " Problem with entry %d in block: The hit {x = %f, y = %f,"
917 " z = %f} cm has a position that corresponds to chamber %d,"
918 " but expected it to be on chamber %d.",
920 DataType2Text(block.fDataType).c_str(),
925 hit.fX, hit.fY, hit.fZ,
932 AliHLTFloat32_t rmin = AliMUONConstants::Rmin(chamber / 2);
933 AliHLTFloat32_t rmax = AliMUONConstants::Rmax(chamber / 2);
934 AliHLTFloat32_t radius = sqrt(hit.fX*hit.fX + hit.fY*hit.fY);
935 if (radius < rmin or rmax < radius)
937 HLTError("Problem found with data block %d, fDataType = '%s',"
938 " fPtr = %p and fSize = %u bytes."
939 " Assuming this is a %s data block."
940 " Problem with entry %d in block: The hit {x = %f, y = %f,"
941 " z = %f} cm has a position in the X-Y plane that does not"
942 " correspond to the nominal position of chamber %d.",
944 DataType2Text(block.fDataType).c_str(),
949 hit.fX, hit.fY, hit.fZ,
955 if (not fIgnoreSpec and not ChamberMarkedInDDLList(chamber, ddl))
957 HLTError("Problem found with data block %d, fDataType = '%s',"
958 " fPtr = %p and fSize = %u bytes."
959 " Assuming this is a %s data block."
960 " Problem with entry %d in block: The hit {x = %f, y = %f,"
961 " z = %f} cm has a position that corresponds to chamber %d"
962 " but the data block specification 0x%8.8X does have a"
963 " corresponding DDL bit set.",
965 DataType2Text(block.fDataType).c_str(),
970 hit.fX, hit.fY, hit.fZ,
977 // Check that the detector element ID is valid and it corresponds to
978 // the chamber number.
979 if (FetchMappingStores() == 0) // are stores loaded?
981 Bool_t warn = kFALSE;
982 AliMpDEStore* store = AliMpDEStore::Instance(warn);
983 AliMpDetElement* de = store->GetDetElement(Int_t(detElemId), warn);
986 HLTError("Problem found with data block %d, fDataType = '%s',"
987 " fPtr = %p and fSize = %u bytes."
988 " Assuming this is a %s data block."
989 " Problem with entry %d in block: The hit {x = %f, y = %f,"
990 " z = %f} cm has a detector element ID %d,"
991 " which is not valid.",
993 DataType2Text(block.fDataType).c_str(),
998 hit.fX, hit.fY, hit.fZ,
1004 // Check that the chamber number from the detector element number
1005 // has the expected value.
1006 Int_t ch = AliMpDEManager::GetChamberId(Int_t(detElemId), warn);
1009 HLTError("Problem found with data block %d, fDataType = '%s',"
1010 " fPtr = %p and fSize = %u bytes."
1011 " Assuming this is a %s data block."
1012 " Problem with entry %d in block: The hit {x = %f, y = %f,"
1013 " z = %f} cm has a detector element ID %d,"
1014 " which does not correspond to the chamber %d.",
1016 DataType2Text(block.fDataType).c_str(),
1021 hit.fX, hit.fY, hit.fZ,
1030 HLTWarning("Cannot check a hit's detector element ID information"
1031 " without being able to load the mapping from CDB."
1040 bool AliHLTMUONDataCheckerComponent::IsMansoTrackOk(
1041 const AliHLTComponentBlockData& block,
1042 AliHLTUInt32_t blockNumber,
1044 AliHLTUInt32_t entryNumber,
1045 const AliHLTMUONMansoTrackStruct& track,
1049 /// Checks if the Manso track structure is Ok.
1050 /// \param block The block from which the track data comes from.
1051 /// \param blockNumber The block index number.
1052 /// \param name The name of the type of block.
1053 /// \param entryNumber The entry index number of the structure in the
1054 /// block being checked.
1055 /// \param track The Manso track data being checked.
1056 /// \param ddl The array decoded by AliHLTMUONUtils::UnpackSpecBits.
1057 /// \returns true if the Manso track is valid and false otherwise.
1061 // Chi^2 should not be greater than the worst fit possible, estimated
1062 // as the diameter of largest chamber times the number of points
1063 // findable in a track. Max points is 10 tracker chambers times
1064 // 2 cathodes + 4 trigger chambers.
1065 if (track.fChi2 > AliMUONConstants::Dmax(6)*AliMUONConstants::Dmax(6)*(10*2+4))
1067 // Just a warning since this is not technically an
1068 // integrity problem.
1069 HLTWarning("Problem found with data block %d, fDataType = '%s',"
1070 " fPtr = %p and fSize = %u bytes."
1071 " Assuming this is a %s data block."
1072 " Problem with entry %d in block: The Manso track has"
1073 " the chi squared value of %f that is unreasonably big.",
1075 DataType2Text(block.fDataType).c_str(),
1085 // Check if the momentum vector is reasonable.
1086 bool momOk = IsMomentumVectorOk(
1087 block, blockNumber, name, entryNumber,
1088 track.fPx, track.fPy, track.fPz
1090 if (not momOk) result = false;
1092 AliHLTMUONParticleSign sign;
1094 AliHLTMUONUtils::UnpackMansoTrackFlags(track.fFlags, sign, hitset);
1096 // Min and max allowed chamber numbers for hits:
1098 Int_t maxCh = AliMUONConstants::NTrackingCh() - 1;
1100 // Check that this hit coordinates are OK.
1101 for (AliHLTUInt32_t i = 0; i < 4; i++)
1103 if (not hitset[i]) continue; // ignore hits that are not initialised.
1104 bool hitOk = IsHitCoordinateOk(
1105 block, blockNumber, name, entryNumber, track.fHit[i],
1106 minCh, maxCh, i+6, ddl
1108 if (not hitOk) result = false;
1115 bool AliHLTMUONDataCheckerComponent::IsTrackOk(
1116 const AliHLTComponentBlockData& block,
1117 AliHLTUInt32_t blockNumber,
1119 AliHLTUInt32_t entryNumber,
1120 const AliHLTMUONTrackStruct& track,
1124 /// Checks if the full track structure is Ok.
1125 /// \param block The block from which the track data comes from.
1126 /// \param blockNumber The block index number.
1127 /// \param name The name of the type of block.
1128 /// \param entryNumber The entry index number of the structure in the
1129 /// block being checked.
1130 /// \param track The track data being checked.
1131 /// \param ddl The array decoded by AliHLTMUONUtils::UnpackSpecBits.
1132 /// \returns true if the full track structure is valid and false otherwise.
1136 // Chi^2 should not be greater than the worst fit possible, estimated
1137 // as the diameter of largest chamber times the number of points
1138 // findable in a track. Max points is 10 tracker chambers times
1139 // 2 cathodes + 4 trigger chambers.
1140 if (track.fChi2 > AliMUONConstants::Dmax(6)*AliMUONConstants::Dmax(6)*(10*2+4))
1142 // Just a warning since this is not technically an
1143 // integrity problem.
1144 HLTWarning("Problem found with data block %d, fDataType = '%s',"
1145 " fPtr = %p and fSize = %u bytes."
1146 " Assuming this is a %s data block."
1147 " Problem with entry %d in block: The track has"
1148 " the chi squared value of %f that is unreasonably big.",
1150 DataType2Text(block.fDataType).c_str(),
1160 // Check if the momentum vector is reasonable.
1161 bool momOk = IsMomentumVectorOk(
1162 block, blockNumber, name, entryNumber,
1163 track.fPx, track.fPy, track.fPz
1165 if (not momOk) result = false;
1167 // Check that the momentum parameters correspond to the momentum vector.
1168 double momvalue = sqrt(track.fPy*track.fPy + track.fPz*track.fPz);
1169 double invMom = (momvalue != 0 ? 1. / momvalue : 0);
1170 if (TMath::Abs(invMom - TMath::Abs(track.fInverseBendingMomentum)) > 1e-12)
1172 HLTError("Problem found with data block %d, fDataType = '%s',"
1173 " fPtr = %p and fSize = %u bytes."
1174 " Assuming this is a %s data block."
1175 " Problem with entry %d in block: The track's inverse bending"
1176 " momentum %f does not correspond to the momentum vector.",
1178 DataType2Text(block.fDataType).c_str(),
1183 track.fInverseBendingMomentum
1187 if (track.fPz != 0 and TMath::Abs(track.fPx/track.fPz - track.fThetaX) > 1e-12)
1189 HLTError("Problem found with data block %d, fDataType = '%s',"
1190 " fPtr = %p and fSize = %u bytes."
1191 " Assuming this is a %s data block."
1192 " Problem with entry %d in block: The track's non-bending plane"
1193 " slope parameter %f does not correspond to the momentum vector.",
1195 DataType2Text(block.fDataType).c_str(),
1204 if (track.fPz != 0 and TMath::Abs(track.fPy/track.fPz - track.fThetaY) > 1e-12)
1206 HLTError("Problem found with data block %d, fDataType = '%s',"
1207 " fPtr = %p and fSize = %u bytes."
1208 " Assuming this is a %s data block."
1209 " Problem with entry %d in block: The track's bending plane"
1210 " slope parameter %f does not correspond to the momentum vector.",
1212 DataType2Text(block.fDataType).c_str(),
1222 // Check that the DCA vertex is reasonable. i.e. the vertex is within
1223 // a 1 meter cube of the origin.
1224 if (TMath::Abs(track.fX) > 100 or TMath::Abs(track.fY) > 100 or TMath::Abs(track.fZ) > 100)
1226 // Just a warning since this is not technically an integrity problem.
1227 HLTWarning("Problem found with data block %d, fDataType = '%s',"
1228 " fPtr = %p and fSize = %u bytes."
1229 " Assuming this is a %s data block."
1230 " Problem with entry %d in block: The track's distance of closest"
1231 " approach (DCA) vertex (x, y, z) = (%f, %f, %f) is not a reasonable value.",
1233 DataType2Text(block.fDataType).c_str(),
1238 track.fX, track.fY, track.fZ
1243 AliHLTMUONParticleSign sign;
1245 AliHLTMUONUtils::UnpackTrackFlags(track.fFlags, sign, hitset);
1247 // Min and max allowed chamber numbers for hits:
1249 Int_t maxCh = AliMUONConstants::NTrackingCh() - 1;
1251 // Check that this hit coordinates are OK.
1252 for (AliHLTUInt32_t i = 0; i < 16; i++)
1254 if (not hitset[i]) continue; // ignore hits that are not initialised.
1255 bool hitOk = IsHitCoordinateOk(
1256 block, blockNumber, name, entryNumber, track.fHit[i],
1257 minCh, maxCh, -1, ddl
1259 if (not hitOk) result = false;
1266 bool AliHLTMUONDataCheckerComponent::CheckDetElemIds(
1267 const AliHLTComponentBlockData& infoBlock,
1268 AliHLTUInt32_t infoBlockNumber,
1269 AliHLTUInt32_t infoEntryNumber,
1270 const AliHLTMUONTrigRecInfoStruct& info,
1271 const AliHLTComponentBlockData& trBlock,
1272 AliHLTUInt32_t trBlockNumber,
1273 AliHLTUInt32_t trEntryNumber,
1274 const AliHLTMUONTriggerRecordStruct& tr
1277 /// Checks if the detector element IDs are the same in the debug
1278 /// information structure and the trigger record structure.
1279 /// \param infoBlock The debug information block from which the 'info'
1280 /// data comes from.
1281 /// \param infoBlockNumber The debug information block index number.
1282 /// \param infoEntryNumber The entry index number of the 'info'
1283 /// structure in the debug information data block.
1284 /// \param info The debug information structure being checked.
1285 /// \param trBlock The trigger record block from which the 'tr' data
1287 /// \param trBlockNumber The trigger record block index number.
1288 /// \param trEntryNumber The entry index number of the 'tr' structure
1289 /// in the trigger record data block.
1290 /// \param tr The trigger record structure being checked.
1291 /// \returns true if the detector element IDs are the same and false
1296 for (int i = 0; i < 4; i++)
1298 AliHLTUInt8_t chamber = 0xFF;
1299 AliHLTUInt16_t detElemId = 0xFFFF;
1300 AliHLTMUONUtils::UnpackRecHitFlags(tr.fHit[i].fFlags, chamber, detElemId);
1301 if (info.fDetElemId[i] == detElemId) continue;
1303 HLTError("Problem found with trigger record debug information %d"
1304 " in data block %d (fDataType = '%s', fPtr = %p, fSize"
1305 " = %u bytes) and trigger record %d in data block %d"
1306 " (fDataType = '%s', fPtr = %p, fSize = %u bytes):"
1307 " The detection element ID %d for chamber %d in the debug"
1308 " information, is not the same as %d"
1309 " found in the trigger record.",
1312 DataType2Text(infoBlock.fDataType).c_str(),
1317 DataType2Text(trBlock.fDataType).c_str(),
1331 bool AliHLTMUONDataCheckerComponent::CheckDetElemIds(
1332 const AliHLTComponentBlockData& clusterBlock,
1333 AliHLTUInt32_t clusterBlockNumber,
1334 AliHLTUInt32_t clusterEntryNumber,
1335 const AliHLTMUONClusterStruct& cluster,
1336 const AliHLTComponentBlockData& hitBlock,
1337 AliHLTUInt32_t hitBlockNumber,
1338 AliHLTUInt32_t hitEntryNumber,
1339 const AliHLTMUONRecHitStruct& hit
1342 /// Checks if the detector element IDs are the same in the cluster
1343 /// structure and the reconstructed hit structure.
1344 /// \param clusterBlock The cluster block from which the 'cluster' data
1346 /// \param clusterBlockNumber The cluster block index number.
1347 /// \param clusterEntryNumber The entry index number of the 'cluster'
1348 /// structure in the cluster data block.
1349 /// \param cluster The cluster structure being checked.
1350 /// \param hitBlock The reconstructed hit block from which the 'hit'
1351 /// data comes from.
1352 /// \param hitBlockNumber The reconstructed hit block index number.
1353 /// \param hitEntryNumber The entry index number of the 'hit' structure
1354 /// in the reconstructed hit data block.
1355 /// \param hit The trigger record structure being checked.
1356 /// \returns true if the detector element IDs are the same and false
1361 AliHLTUInt8_t chamber = 0xFF;
1362 AliHLTUInt16_t detElemId = 0xFFFF;
1363 AliHLTMUONUtils::UnpackRecHitFlags(hit.fFlags, chamber, detElemId);
1364 if (cluster.fDetElemId != detElemId)
1366 HLTError("Problem found with cluster %d in data block %d"
1367 " (fDataType = '%s', fPtr = %p, fSize = %u bytes)"
1368 " and reconstructed hit %d in data block %d"
1369 " (fDataType = '%s', fPtr = %p, fSize = %u bytes):"
1370 " The detection element ID %d in the cluster, is not"
1371 " the same as %d found in the reconstructed hit.",
1374 DataType2Text(clusterBlock.fDataType).c_str(),
1379 DataType2Text(hitBlock.fDataType).c_str(),
1395 * Class for logging errors found in raw DDL data.
1397 class AliHLTMUONDecoderHandler : public AliHLTLogging
1401 /// Default constructor
1402 AliHLTMUONDecoderHandler() :
1410 /// Default destructor.
1411 virtual ~AliHLTMUONDecoderHandler() {}
1413 /// Sets the DDL raw data block descriptor.
1414 void SetDescriptor(const AliHLTComponentBlockData* b) { fDescriptor = b; }
1416 /// Sets the block number of the raw data block descriptor.
1417 void SetBlockNumber(AliHLTUInt32_t n) { fBlockNumber = n; }
1419 /// Logs an error message describing the problem with the DDL raw data.
1420 template <typename ErrorCode, class DecoderHandler>
1421 void LogError(ErrorCode code, const void* location, DecoderHandler& handler);
1424 // Do not allow copying of this class.
1426 AliHLTMUONDecoderHandler(const AliHLTMUONDecoderHandler& rhs); // copy constructor
1428 AliHLTMUONDecoderHandler& operator = (const AliHLTMUONDecoderHandler& rhs); // assignment operator
1430 const void* fBufferStart; ///< Pointer to the start of the current DDL payload buffer.
1431 const AliHLTComponentBlockData* fDescriptor; ///< Descriptor for the DDL raw data block corresponding to the buffer.
1432 AliHLTUInt32_t fBlockNumber; ///< The number / index of the block descriptor.
1436 template <typename ErrorCode, class DecoderHandler>
1437 void AliHLTMUONDecoderHandler::LogError(ErrorCode code, const void* location, DecoderHandler& handler)
1439 /// Logs a HLT error message describing the problem with the raw DDL data.
1440 /// \param code The error code describing the problem.
1441 /// \param location A pointer to the location in the raw data buffer
1442 /// where the problem was found.
1443 /// \param handler The decoder handler object.
1445 long bytepos = long(location) - long(fBufferStart) + sizeof(AliRawDataHeader);
1447 // create data type string.
1448 char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2];
1449 memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
1450 strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize );
1451 strncat( dataType, ":", 1 );
1452 strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize );
1454 HLTError("Problem found with data block %d, fDataType = '%s',"
1455 " fPtr = %p and fSize = %u bytes."
1456 " Assuming this is a DDL raw data block."
1457 " Problem: %s (Error code: %d, at byte %d)",
1462 handler.ErrorCodeToMessage(code),
1470 * Class for logging decoding errors when checking tracker raw DDL data.
1471 * Used in the AliHLTMUONDataCheckerComponent::CheckRawDataBlock method.
1473 class AliHLTMUONTrackerDecoderHandler :
1474 public AliMUONTrackerDDLDecoderEventHandler, public AliHLTMUONDecoderHandler
1477 AliHLTMUONTrackerDecoderHandler() :
1478 AliMUONTrackerDDLDecoderEventHandler(),
1479 AliHLTMUONDecoderHandler(),
1483 fCurrentBusPatch(0),
1484 fDataProblems(false)
1487 virtual ~AliHLTMUONTrackerDecoderHandler()
1489 if (fDigits != NULL) delete [] fDigits;
1492 /// Structure to store raw data words found in the raw data.
1495 UInt_t fBusPatchId; ///< Bus patch ID for the data word.
1496 UInt_t fDataWord; ///< Raw data word found in the DDL payload.
1499 /// Returns the number of digits found.
1500 UInt_t DigitCount() const { return fDigitCount; }
1502 /// Returns the array of digits found.
1503 const AliDigit* Digits() const { return fDigits; }
1505 /// Returns true if there were problems with the data.
1506 bool DataProblems() const { return fDataProblems; }
1508 // Methods inherited from AliMUONTrackerDDLDecoderEventHandler:
1510 /// Called for each new buffer.
1511 void OnNewBuffer(const void* buffer, UInt_t bufferSize);
1513 /// Called for each new DSP header.
1514 void OnNewDSP(const AliMUONDSPHeaderStruct* header, const void* /*data*/);
1516 /// Called for each new bus patch. Just marks the current bus patch ID.
1517 void OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* /*data*/)
1519 fCurrentBusPatch = header->fBusPatchId;
1522 /// Called for each new data word found.
1523 void OnData(UInt_t data, bool /*parityError*/);
1525 /// Logs an error message if there was a decoding problem with the DDL payload.
1526 void OnError(ErrorCode code, const void* location)
1528 fDataProblems = true;
1529 LogError(code, location, *this);
1534 // Do not allow copying of this object.
1535 /// Not implemented.
1536 AliHLTMUONTrackerDecoderHandler(const AliHLTMUONTrackerDecoderHandler& obj);
1537 /// Not implemented.
1538 AliHLTMUONTrackerDecoderHandler& operator = (const AliHLTMUONTrackerDecoderHandler& obj);
1540 UInt_t fMaxDigits; ///< Maximum number of digits that can be stored in fDigits.
1541 UInt_t fDigitCount; ///< The number of digits currently stored in fDigits.
1542 AliDigit* fDigits; ///< The array of digits found in the DDL data.
1543 UInt_t fCurrentBusPatch; ///< The current bus patch ID being processed.
1544 bool fDataProblems; ///< flag indicating there were problems with the data.
1548 void AliHLTMUONTrackerDecoderHandler::OnNewBuffer(const void* buffer, UInt_t bufferSize)
1550 /// Called for a new buffer. It will reset internal counters and
1551 /// resize the digits array if necessary.
1553 fDataProblems = false;
1555 fBufferStart = buffer;
1557 // Resize the fDigits array to be able to store
1558 // all the digits in the data buffer.
1559 UInt_t maxSize = bufferSize / sizeof(UInt_t) + 1;
1560 if (maxSize > fMaxDigits)
1562 if (fDigits != NULL)
1570 fDigits = new AliDigit[maxSize];
1571 fMaxDigits = maxSize;
1573 catch (const std::bad_alloc&)
1575 HLTError("Could not allocate enough buffer space for internal arrays.");
1582 void AliHLTMUONTrackerDecoderHandler::OnNewDSP(
1583 const AliMUONDSPHeaderStruct* header, const void* /*data*/
1586 if (header->fPaddingWord != 0 and header->fPaddingWord != 1)
1588 // create data type string.
1589 char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2];
1590 memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
1591 strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize );
1592 strncat( dataType, ":", 1 );
1593 strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize );
1595 HLTError("Problem found with data block %d, fDataType = '%s',"
1596 " fPtr = %p and fSize = %u bytes."
1597 " Assuming this is a tracker DDL raw data block."
1598 " Problem: Found padding word marker 0x%8.8X in DSP"
1599 " header with DSP ID %d which has an invalid value.",
1604 header->fPaddingWord,
1607 fDataProblems = true;
1613 void AliHLTMUONTrackerDecoderHandler::OnData(UInt_t data, bool /*parityError*/)
1615 /// Called for each new data word found. This method will add
1616 /// these to the list of digits and check if they are not duplicated.
1618 assert( fDigits != NULL );
1620 if ((data & 0x60000000) != 0)
1622 // create data type string.
1623 char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2];
1624 memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
1625 strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize );
1626 strncat( dataType, ":", 1 );
1627 strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize );
1629 HLTError("Problem found with data block %d, fDataType = '%s',"
1630 " fPtr = %p and fSize = %u bytes."
1631 " Assuming this is a tracker DDL raw data block."
1632 " Problem: Found a data word 0x%8.8X for bus patch %d"
1633 " whose bits 29 or 30 are not zero.",
1641 fDataProblems = true;
1645 // Check if the data word + bus patch have been duplicated.
1646 for (UInt_t i = 0; i < fDigitCount; i++)
1648 if (fDigits[i].fDataWord == data and fDigits[i].fBusPatchId == fCurrentBusPatch)
1650 // create data type string.
1651 char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2];
1652 memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
1653 strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize );
1654 strncat( dataType, ":", 1 );
1655 strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize );
1657 HLTError("Problem found with data block %d, fDataType = '%s',"
1658 " fPtr = %p and fSize = %u bytes."
1659 " Assuming this is a tracker DDL raw data block."
1660 " Problem: Found a duplicate data word 0x%8.8X for bus patch %d.",
1668 fDataProblems = true;
1673 // Add the data word + bus patch to the list of decoded digits.
1674 if (fDigitCount < fMaxDigits)
1676 fDigits[fDigitCount].fBusPatchId = fCurrentBusPatch;
1677 fDigits[fDigitCount].fDataWord = data;
1683 * Class for logging decoding errors when checking trigger raw DDL data.
1684 * Used in the AliHLTMUONDataCheckerComponent::CheckRawDataBlock method.
1686 class AliHLTMUONTriggerDecoderHandler :
1687 public AliMUONTriggerDDLDecoderEventHandler, public AliHLTMUONDecoderHandler
1690 // Methods inherited from AliMUONTriggerDDLDecoderEventHandler:
1692 /// Called for each new buffer.
1693 void OnNewBuffer(const void* buffer, UInt_t /*bufferSize*/)
1695 fBufferStart = buffer;
1698 /// Logs an error message if there was a decoding problem with the DDL payload.
1699 void OnError(ErrorCode code, const void* location)
1701 LogError(code, location, *this);
1705 } // end of namespace
1708 bool AliHLTMUONDataCheckerComponent::CheckRawDataBlock(
1709 const AliHLTComponentBlockData& block,
1710 AliHLTUInt32_t blockNumber
1713 /// Checks the validity of a raw data block.
1719 HLTWarning("Not able to check DDL raw data if -ignorespec is specified.");
1724 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
1726 // Check that only one DDL was marked in the specification.
1728 for (int i = 0; i < 22; i++)
1730 if (not ddl[i]) continue;
1738 HLTError("Problem found with data block %d, fDataType = '%s',"
1739 " fPtr = %p and fSize = %u bytes."
1740 " Assuming this is a DDL raw data block."
1741 " Problem: The specification indicates multiple"
1742 " DDL sources, DDL %d and %d.",
1744 DataType2Text(block.fDataType).c_str(),
1753 // Check the DDL common data header.
1754 AliHLTUInt32_t totalDDLSize = block.fSize;
1755 if (totalDDLSize < sizeof(AliRawDataHeader))
1757 HLTError("Problem found with data block %d, fDataType = '%s',"
1758 " fPtr = %p and fSize = %u bytes."
1759 " Assuming this is a DDL raw data block."
1760 " Problem: The size of the data block is too short to contain"
1761 " a valid common DDL data header. Size of buffer is only %d"
1762 " bytes, but expected at least %d bytes.",
1764 DataType2Text(block.fDataType).c_str(),
1768 sizeof(AliRawDataHeader)
1773 const AliRawDataHeader* header =
1774 reinterpret_cast<const AliRawDataHeader*>(block.fPtr);
1776 if (header->GetVersion() != 2)
1778 HLTError("Problem found with data block %d, fDataType = '%s',"
1779 " fPtr = %p and fSize = %u bytes."
1780 " Assuming this is a DDL raw data block."
1781 " Problem: The common DDL data header indicates an"
1782 " incorrect version number. Expected 2 but got %d.",
1784 DataType2Text(block.fDataType).c_str(),
1787 int( header->GetVersion() )
1792 if (header->fSize != 0xFFFFFFFF and header->fSize != block.fSize)
1794 HLTError("Problem found with data block %d, fDataType = '%s',"
1795 " fPtr = %p and fSize = %u bytes."
1796 " Assuming this is a DDL raw data block."
1797 " Problem: The common DDL data header indicates an"
1798 " incorrect DDL buffer size. Expected %d bytes but"
1799 " size reported in header is %d bytes.",
1801 DataType2Text(block.fDataType).c_str(),
1810 if (header->fSize != 0xFFFFFFFF and header->fSize != block.fSize)
1812 HLTError("Problem found with data block %d, fDataType = '%s',"
1813 " fPtr = %p and fSize = %u bytes."
1814 " Assuming this is a DDL raw data block."
1815 " Problem: The common DDL data header indicates an"
1816 " incorrect DDL buffer size. Expected %d bytes but"
1817 " size reported in header is %d bytes.",
1819 DataType2Text(block.fDataType).c_str(),
1828 // Check that the bits that should be zero in the CDH are infact zero.
1829 if ((header->fWord2 & 0x00C03000) != 0 or
1830 (header->fEventID2 & 0xFF000000) != 0 or
1831 (header->fStatusMiniEventID & 0xF0000000) != 0 or
1832 (header->fROILowTriggerClassHigh & 0x0FFC0000) != 0
1835 HLTError("Problem found with data block %d, fDataType = '%s',"
1836 " fPtr = %p and fSize = %u bytes."
1837 " Assuming this is a DDL raw data block."
1838 " Problem: The common DDL data header has non-zero"
1839 " bits that are reserved and must be set to zero.",
1841 DataType2Text(block.fDataType).c_str(),
1848 AliHLTUInt32_t payloadSize = block.fSize - sizeof(AliRawDataHeader);
1849 const AliHLTUInt8_t* payload =
1850 reinterpret_cast<const AliHLTUInt8_t*>(header + 1);
1852 if (AliHLTMUONUtils::IsTriggerDDL(block.fSpecification))
1854 bool scalarEvent = ((header->GetL1TriggerMessage() & 0x1) == 0x1);
1855 AliMUONTriggerDDLDecoder<AliHLTMUONTriggerDecoderHandler> decoder;
1856 decoder.ExitOnError(false);
1857 decoder.TryRecover(false);
1858 decoder.AutoDetectScalars(false);
1859 decoder.GetHandler().SetDescriptor(&block);
1860 decoder.GetHandler().SetBlockNumber(blockNumber);
1861 result = decoder.Decode(payload, payloadSize, scalarEvent);
1863 else if (AliHLTMUONUtils::IsTrackerDDL(block.fSpecification))
1865 AliMUONTrackerDDLDecoder<AliHLTMUONTrackerDecoderHandler> decoder;
1866 decoder.ExitOnError(false);
1867 decoder.TryRecover(false);
1868 decoder.SendDataOnParityError(true);
1869 decoder.AutoDetectTrailer(true);
1870 decoder.CheckForTrailer(true);
1871 decoder.GetHandler().SetDescriptor(&block);
1872 decoder.GetHandler().SetBlockNumber(blockNumber);
1873 result = decoder.Decode(payload, payloadSize);
1874 if (decoder.GetHandler().DataProblems()) result = false;
1876 if (FetchMappingStores() == 0) // are stores loaded?
1878 Bool_t warn = kFALSE;
1879 AliMpDDLStore* ddlStore = AliMpDDLStore::Instance(warn);
1881 // Check that the bus patch, manu ID and channel addresses are valid
1882 // for each raw data word.
1883 for (UInt_t i = 0; i < decoder.GetHandler().DigitCount(); i++)
1885 UInt_t busPatchId = decoder.GetHandler().Digits()[i].fBusPatchId;
1886 UInt_t dataWord = decoder.GetHandler().Digits()[i].fDataWord;
1888 UShort_t manuId; UChar_t channelId; UShort_t adc;
1889 AliMUONTrackerDDLDecoderEventHandler::UnpackADC(
1890 dataWord, manuId, channelId, adc
1893 // Check if the bus patch is valid.
1894 AliMpBusPatch* busPatch = ddlStore->GetBusPatch(busPatchId, warn);
1895 if (busPatch == NULL)
1897 HLTError("Problem found with data block %d, fDataType = '%s',"
1898 " fPtr = %p and fSize = %u bytes."
1899 " Assuming this is a tracker DDL raw data block."
1900 " Problem: Found a bus patch identifier %d that"
1903 DataType2Text(block.fDataType).c_str(),
1912 // We can check that the bus patch is for the DDL
1913 // which is also indicated by the specification bits.
1914 if (not fIgnoreSpec and busPatch->GetDdlId() != ddlIndex)
1916 HLTError("Problem found with data block %d, fDataType = '%s',"
1917 " fPtr = %p and fSize = %u bytes."
1918 " Assuming this is a tracker DDL raw data block."
1919 " Problem: Found a bus patch identifier %d for"
1920 " DDL %d, but the data block specification 0x%8.8X"
1921 " indicates a different DDL of %d.",
1923 DataType2Text(block.fDataType).c_str(),
1927 busPatch->GetDdlId(),
1928 block.fSpecification,
1935 // Check if the MANU ID is valid.
1936 if (not busPatch->HasManu(manuId))
1938 HLTError("Problem found with data block %d, fDataType = '%s',"
1939 " fPtr = %p and fSize = %u bytes."
1940 " Assuming this is a tracker DDL raw data block."
1941 " Problem: Found a MANU identifier %d on bus patch %d"
1942 " that is not valid.",
1944 DataType2Text(block.fDataType).c_str(),
1954 // Now try to fetch the detector element to check the MANU channel.
1955 AliMpDetElement* de = ddlStore->GetDetElement(busPatch->GetDEId(), warn);
1958 HLTError("Problem found with data block %d, fDataType = '%s',"
1959 " fPtr = %p and fSize = %u bytes."
1960 " Assuming this is a tracker DDL raw data block."
1961 " Problem: Found a bus patch identifier %d that"
1962 " does not correspond to a detector element.",
1964 DataType2Text(block.fDataType).c_str(),
1973 if (not de->IsConnectedChannel(manuId, channelId))
1975 // Just a warning because this is marked not
1976 // to be an error in the AliMUONDigitMaker.
1977 HLTWarning("Problem found with data block %d, fDataType = '%s',"
1978 " fPtr = %p and fSize = %u bytes."
1979 " Assuming this is a tracker DDL raw data block."
1980 " Problem: Found a channel with address %d on"
1981 " MANU ID %d and bus patch %d that is not connected.",
1983 DataType2Text(block.fDataType).c_str(),
1994 // Need to also load the correct segmentation to check the channel.
1995 const AliMpVSegmentation* seg =
1996 AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(
1997 busPatch->GetDEId(), manuId
2001 HLTError("Could not load segmentation for detector element %d"
2003 busPatch->GetDEId(), manuId
2009 #ifndef HAVE_NOT_MUON_ALIMPPAD_GETPOSITION
2010 AliMpPad pad = seg->PadByLocation(manuId, channelId, warn);
2011 #else // old AliMpPad functionality < r 31742
2012 AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId, channelId), warn);
2013 #endif //HAVE_NOT_MUON_ALIMPPAD_GETPOSITION
2014 if (not pad.IsValid())
2016 HLTError("Problem found with data block %d, fDataType = '%s',"
2017 " fPtr = %p and fSize = %u bytes."
2018 " Assuming this is a tracker DDL raw data block."
2019 " Problem: Found a channel with address %d on"
2020 " MANU ID %d and bus patch %d that is not valid.",
2022 DataType2Text(block.fDataType).c_str(),
2036 HLTWarning("Cannot check if the bus patch IDs, MANU ID and"
2037 " channel addresses for DDL raw data are valid without"
2038 " being able to load the mapping from CDB."
2045 HLTError("Problem found with data block %d, fDataType = '%s',"
2046 " fPtr = %p and fSize = %u bytes."
2047 " Assuming this is a DDL raw data block."
2048 " Problem: The specification does not contain a valid pattern,"
2049 " received 0x%8.8X for the specification.",
2051 DataType2Text(block.fDataType).c_str(),
2054 block.fSpecification
2063 bool AliHLTMUONDataCheckerComponent::CheckTriggerRecordsBlock(
2064 const AliHLTComponentBlockData& block,
2065 AliHLTUInt32_t blockNumber
2068 /// Checks the validity of a trigger records block.
2071 const char* name = "trigger records";
2073 if (not fIgnoreSpec)
2075 if (not IsFromTriggerOnly(block, blockNumber, name))
2079 AliHLTMUONTriggerRecordsBlockReader inblock(block.fPtr, block.fSize);
2080 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2084 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2086 // Min and max allowed chamber numbers for hits:
2087 Int_t minCh = AliMUONConstants::NCh() - AliMUONConstants::NTriggerCh();
2088 Int_t maxCh = AliMUONConstants::NCh() - 1;
2090 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2092 // Check that each hit in each trigger record has a reasonable coordinate.
2093 AliHLTMUONParticleSign sign;
2095 AliHLTMUONUtils::UnpackTriggerRecordFlags(inblock[i].fFlags, sign, hitset);
2097 for (Int_t j = 0; j < 4; j++) // loop over 4 trigger chamber hits.
2099 if (not hitset[i]) continue; // ignore hits that are not initialised.
2100 bool hitOk = IsHitCoordinateOk(
2101 block, blockNumber, name, i, inblock[i].fHit[j],
2102 minCh, maxCh, j+10, ddl
2104 if (not hitOk) result = false;
2107 // We can also check the momentum vector.
2108 bool momOk = IsMomentumVectorOk(
2109 block, blockNumber, name, i,
2110 inblock[i].fPx, inblock[i].fPy, inblock[i].fPz
2112 if (not momOk) result = false;
2115 // Need to check that no entries have duplicated data but with a different
2117 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2119 AliHLTMUONTriggerRecordStruct ti = inblock[i];
2121 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2123 AliHLTMUONTriggerRecordStruct tj = inblock[j];
2128 HLTError("Problem found with data block %d, fDataType = '%s',"
2129 " fPtr = %p and fSize = %u bytes."
2130 " Assuming this is a %s data block."
2131 " Problem: The trigger records %d and %d contain the"
2132 " same data. The data might have been duplicated.",
2134 DataType2Text(block.fDataType).c_str(),
2149 bool AliHLTMUONDataCheckerComponent::CheckTrigRecsDebugBlock(
2150 const AliHLTComponentBlockData& block,
2151 AliHLTUInt32_t blockNumber
2154 /// Checks the validity of a trigger records debug block.
2157 const char* name = "trigger records debug information";
2159 if (not fIgnoreSpec)
2161 if (not IsFromTriggerOnly(block, blockNumber, name))
2165 AliHLTMUONTrigRecsDebugBlockReader inblock(block.fPtr, block.fSize);
2166 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2170 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2172 // Check that each detector element ID is valid and the corresponding DDL
2173 // bit is set in the data block specification.
2174 if (FetchMappingStores() == 0) // are stores loaded?
2176 Bool_t warn = kFALSE;
2177 AliMpDEStore* store = AliMpDEStore::Instance(warn);
2178 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2179 for (AliHLTUInt32_t j = 0; j < 4; j++)
2181 const AliHLTMUONTrigRecInfoStruct& trig = inblock[i];
2182 AliMpDetElement* de = store->GetDetElement(trig.fDetElemId[j], warn);
2185 HLTError("Problem found with data block %d, fDataType = '%s',"
2186 " fPtr = %p and fSize = %u bytes."
2187 " Assuming this is a %s data block."
2188 " Problem: The detector element number %d on chamber"
2189 " %d for trigger record debug structure %d is not valid.",
2191 DataType2Text(block.fDataType).c_str(),
2203 // Check that the chamber number from the detector element number
2204 // has the expected value.
2205 Int_t chamber = AliMpDEManager::GetChamberId(trig.fDetElemId[j], warn);
2206 if (chamber != Int_t(j+10))
2208 HLTError("Problem found with data block %d, fDataType = '%s',"
2209 " fPtr = %p and fSize = %u bytes."
2210 " Assuming this is a %s data block."
2211 " Problem: The detector element number %d for trigger"
2212 " record debug structure %d, corresponds to chamber"
2213 " %d, but we expected a hit for chamber %d.",
2215 DataType2Text(block.fDataType).c_str(),
2227 if (fIgnoreSpec) continue;
2228 if (0 <= de->GetDdlId() and de->GetDdlId() < 22 and not ddl[de->GetDdlId()])
2230 HLTError("Problem found with data block %d, fDataType = '%s',"
2231 " fPtr = %p and fSize = %u bytes."
2232 " Assuming this is a %s data block."
2233 " Problem: The detector element number %d for trigger"
2234 " record %d corresponds to DDL number %d, but the"
2235 " data block specification 0x%8.8X does not have the"
2236 " corresponding bit set.",
2238 DataType2Text(block.fDataType).c_str(),
2245 block.fSpecification
2253 HLTWarning("Cannot check trigger record debug information without"
2254 " being able to load the mapping from CDB."
2259 // Need to check that no entries have duplicated data but with a different
2261 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2263 AliHLTMUONTrigRecInfoStruct ti = inblock[i];
2265 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2267 AliHLTMUONTrigRecInfoStruct tj = inblock[j];
2268 tj.fTrigRecId = ti.fTrigRecId;
2272 HLTError("Problem found with data block %d, fDataType = '%s',"
2273 " fPtr = %p and fSize = %u bytes."
2274 " Assuming this is a %s data block."
2275 " Problem: The trigger record debug information"
2276 " structures %d and %d contain the same data."
2277 " The data might have been duplicated.",
2279 DataType2Text(block.fDataType).c_str(),
2289 // Can also check that the value of the fZmiddle and fBl.
2290 bool paramsOk = AreMomentumCalcParamsOk(
2291 block, blockNumber, name, i, ti.fZmiddle, ti.fBl
2293 if (not paramsOk) result = false;
2300 bool AliHLTMUONDataCheckerComponent::CheckRecHitsBlock(
2301 const AliHLTComponentBlockData& block,
2302 AliHLTUInt32_t blockNumber
2305 /// Checks the validity of a reconstructed hits block.
2308 const char* name = "reconstructed hits";
2310 if (not fIgnoreSpec)
2312 if (not IsFromTrackerOnly(block, blockNumber, name))
2316 AliHLTMUONRecHitsBlockReader inblock(block.fPtr, block.fSize);
2317 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2321 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2323 // Check that each hit has a reasonable coordinate.
2325 Int_t maxCh = AliMUONConstants::NTrackingCh() - 1;
2326 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2328 bool hitOk = IsHitCoordinateOk(
2329 block, blockNumber, name, i, inblock[i],
2330 minCh, maxCh, -1, ddl
2332 if (not hitOk) result = false;
2339 bool AliHLTMUONDataCheckerComponent::CheckClustersBlock(
2340 const AliHLTComponentBlockData& block,
2341 AliHLTUInt32_t blockNumber
2344 /// Checks the validity of a clusters block.
2347 const char* name = "clusters";
2349 if (not fIgnoreSpec)
2351 if (not IsFromTrackerOnly(block, blockNumber, name))
2355 AliHLTMUONClustersBlockReader inblock(block.fPtr, block.fSize);
2356 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2360 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2362 if (FetchMappingStores() == 0) // are stores loaded?
2364 Bool_t warn = kFALSE;
2365 AliMpDEStore* store = AliMpDEStore::Instance(warn);
2366 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2368 const AliHLTMUONClusterStruct& cluster = inblock[i];
2370 // Check that the detector element ID is valid.
2371 AliMpDetElement* de = store->GetDetElement(cluster.fDetElemId, warn);
2374 HLTError("Problem found with data block %d, fDataType = '%s',"
2375 " fPtr = %p and fSize = %u bytes."
2376 " Assuming this is a %s data block."
2377 " Problem: The detector element number %d for cluster"
2378 " %d is not valid.",
2380 DataType2Text(block.fDataType).c_str(),
2391 // Check that the chamber number found from the hit coordinate and
2392 // that from the detector element number are the same.
2393 Int_t chamberFromHit = AliMUONConstants::ChamberNumber(cluster.fHit.fZ, warn);
2394 Int_t chamberFromDE = AliMpDEManager::GetChamberId(cluster.fDetElemId, warn);
2395 if (chamberFromHit != chamberFromDE)
2397 HLTError("Problem found with data block %d, fDataType = '%s',"
2398 " fPtr = %p and fSize = %u bytes."
2399 " Assuming this is a %s data block."
2400 " Problem: The detector element number %d for"
2401 " cluster %d, corresponds to chamber %d, but"
2402 " found a different chamber number %d for the"
2403 " corresponding hit coordinate {x = %f, y = %f,"
2406 DataType2Text(block.fDataType).c_str(),
2421 // Make sure the corresponding DDL bit is set in the data
2422 // block specification.
2423 if (fIgnoreSpec) continue;
2424 if (0 <= de->GetDdlId() and de->GetDdlId() < 22 and not ddl[de->GetDdlId()])
2426 HLTError("Problem found with data block %d, fDataType = '%s',"
2427 " fPtr = %p and fSize = %u bytes."
2428 " Assuming this is a %s data block."
2429 " Problem: The detector element number %d for cluster"
2430 " %d corresponds to DDL number %d, but the data"
2431 " block specification 0x%8.8X does not have the"
2432 " corresponding bit set.",
2434 DataType2Text(block.fDataType).c_str(),
2441 block.fSpecification
2446 // Check that the total cluster charge is a reasonable value.
2447 if ((cluster.fChargeB + cluster.fChargeNB)< 0 and 1e4 < (cluster.fChargeB + cluster.fChargeNB))
2449 HLTError("Problem found with data block %d, fDataType = '%s',"
2450 " fPtr = %p and fSize = %u bytes."
2451 " Assuming this is a %s data block."
2452 " Problem: The total charge %f for the cluster"
2453 " %d is not in a reasonable range [0..1e4].",
2455 DataType2Text(block.fDataType).c_str(),
2459 (cluster.fChargeB + cluster.fChargeNB),
2469 HLTWarning("Cannot check cluster information without being able"
2470 " to load the mapping from CDB."
2475 // Min and max chamber numbers allowed for the cluster hits.
2477 Int_t maxCh = AliMUONConstants::NTrackingCh() - 1;
2479 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2481 // Need to check that no cluster data has duplicated data but with
2482 // a different ID number.
2483 AliHLTMUONClusterStruct ci = inblock[i];
2485 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2487 AliHLTMUONClusterStruct cj = inblock[j];
2492 HLTError("Problem found with data block %d, fDataType = '%s',"
2493 " fPtr = %p and fSize = %u bytes."
2494 " Assuming this is a %s data block."
2495 " Problem: The cluster structures %d and %d contain"
2496 " the same data. The data might have been duplicated.",
2498 DataType2Text(block.fDataType).c_str(),
2508 // Check that the hit structure in the cluster corresponds
2509 // to a tracker chamber.
2510 bool hitOk = IsHitCoordinateOk(
2511 block, blockNumber, name, i, ci.fHit,
2512 minCh, maxCh, -1, ddl
2514 if (not hitOk) result = false;
2521 bool AliHLTMUONDataCheckerComponent::CheckChannelsBlock(
2522 const AliHLTComponentBlockData& block,
2523 AliHLTUInt32_t blockNumber
2526 /// Checks the validity of a channels block.
2529 const char* name = "channels";
2531 if (not fIgnoreSpec)
2533 if (not IsFromTrackerOnly(block, blockNumber, name))
2537 AliHLTMUONChannelsBlockReader inblock(block.fPtr, block.fSize);
2538 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2542 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2544 if (FetchMappingStores() == 0) // are stores loaded?
2546 Bool_t warn = kFALSE;
2547 AliMpDDLStore* store = AliMpDDLStore::Instance(warn);
2549 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2551 const AliHLTMUONChannelStruct& channel = inblock[i];
2553 // Check if the bus patch is valid.
2554 AliMpBusPatch* busPatch = store->GetBusPatch(channel.fBusPatch, warn);
2555 if (busPatch == NULL)
2557 HLTError("Problem found with data block %d, fDataType = '%s',"
2558 " fPtr = %p and fSize = %u bytes."
2559 " Assuming this is a %s data block."
2560 " Problem: Found a bus patch identifier %d that"
2563 DataType2Text(block.fDataType).c_str(),
2573 // We can check that the bus patch is for a DDL
2574 // which is also indicated by the specification bits.
2575 if (not fIgnoreSpec and (
2576 not (0 <= busPatch->GetDdlId() and busPatch->GetDdlId() < 20)
2577 or (0 <= busPatch->GetDdlId() and busPatch->GetDdlId() < 20
2578 and not ddl[busPatch->GetDdlId()])
2581 HLTError("Problem found with data block %d, fDataType = '%s',"
2582 " fPtr = %p and fSize = %u bytes."
2583 " Assuming this is a %s data block."
2584 " Problem: Found a bus patch identifier %d for"
2585 " DDL %d, but the data block specification 0x%8.8X"
2586 " does not have the corresponding bit set.",
2588 DataType2Text(block.fDataType).c_str(),
2593 busPatch->GetDdlId(),
2594 block.fSpecification
2600 // Check if the MANU ID is valid.
2601 if (not busPatch->HasManu(channel.fManu))
2603 HLTError("Problem found with data block %d, fDataType = '%s',"
2604 " fPtr = %p and fSize = %u bytes."
2605 " Assuming this is a %s data block."
2606 " Problem: Found a MANU identifier %d on bus patch %d"
2607 " that is not valid.",
2609 DataType2Text(block.fDataType).c_str(),
2620 // Now try to fetch the detector element to check the MANU channel.
2621 AliMpDetElement* de = store->GetDetElement(busPatch->GetDEId(), warn);
2624 HLTError("Problem found with data block %d, fDataType = '%s',"
2625 " fPtr = %p and fSize = %u bytes."
2626 " Assuming this is a %s data block."
2627 " Problem: Found a bus patch identifier %d that"
2628 " does not correspond to a detector element.",
2630 DataType2Text(block.fDataType).c_str(),
2640 if (not de->IsConnectedChannel(channel.fManu, channel.fChannelAddress))
2642 // Just a warning because this is marked not
2643 // to be an error in the AliMUONDigitMaker.
2644 HLTWarning("Problem found with data block %d, fDataType = '%s',"
2645 " fPtr = %p and fSize = %u bytes."
2646 " Assuming this is a %s data block."
2647 " Problem: Found a channel with address %d on"
2648 " MANU ID %d and bus patch %d that is not connected.",
2650 DataType2Text(block.fDataType).c_str(),
2654 channel.fChannelAddress,
2662 // Need to also load the correct segmentation to check the channel.
2663 const AliMpVSegmentation* seg =
2664 AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(
2665 busPatch->GetDEId(), channel.fManu
2669 HLTError("Could not load segmentation for detector element %d"
2671 busPatch->GetDEId(), channel.fManu
2677 AliMpPad pad = seg->PadByLocation(
2678 #ifndef HAVE_NOT_MUON_ALIMPPAD_GETPOSITION
2679 channel.fManu, channel.fChannelAddress,
2680 #else // old AliMpPad functionality < r 31742
2681 AliMpIntPair(channel.fManu, channel.fChannelAddress),
2682 #endif //HAVE_NOT_MUON_ALIMPPAD_GETPOSITION
2685 if (not pad.IsValid())
2687 HLTError("Problem found with data block %d, fDataType = '%s',"
2688 " fPtr = %p and fSize = %u bytes."
2689 " Assuming this is a %s data block."
2690 " Problem: Found a channel with address %d on"
2691 " MANU ID %d and bus patch %d that is not valid.",
2693 DataType2Text(block.fDataType).c_str(),
2697 channel.fChannelAddress,
2708 HLTWarning("Cannot check channel information without being able"
2709 " to load the mapping from CDB."
2714 // Need to check that no channel data has duplicated data but with
2715 // a different cluster ID number.
2716 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2718 AliHLTMUONChannelStruct ci = inblock[i];
2720 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2722 AliHLTMUONChannelStruct cj = inblock[j];
2723 cj.fClusterId = ci.fClusterId;
2727 HLTError("Problem found with data block %d, fDataType = '%s',"
2728 " fPtr = %p and fSize = %u bytes."
2729 " Assuming this is a %s data block."
2730 " Problem: The channel structures %d and %d contain"
2731 " the same data. The data might have been duplicated.",
2733 DataType2Text(block.fDataType).c_str(),
2748 bool AliHLTMUONDataCheckerComponent::CheckMansoTracksBlock(
2749 const AliHLTComponentBlockData& block,
2750 AliHLTUInt32_t blockNumber
2753 /// Checks the validity of a Manso tracks block.
2756 const char* name = "Manso tracks";
2758 if (not fIgnoreSpec)
2760 if (not IsSpecificationValid(block, blockNumber, name))
2764 AliHLTMUONMansoTracksBlockReader inblock(block.fPtr, block.fSize);
2765 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2769 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2771 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2773 // Need to check that no entries have duplicated data but with
2774 // a different track ID number.
2775 AliHLTMUONMansoTrackStruct ti = inblock[i];
2777 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2779 AliHLTMUONMansoTrackStruct tj = inblock[j];
2784 HLTError("Problem found with data block %d, fDataType = '%s',"
2785 " fPtr = %p and fSize = %u bytes."
2786 " Assuming this is a %s data block."
2787 " Problem: The Manso tracks %d and %d contain the"
2788 " same data. The data might have been duplicated.",
2790 DataType2Text(block.fDataType).c_str(),
2800 bool trackOk = IsMansoTrackOk(block, blockNumber, name, i, ti, ddl);
2801 if (not trackOk) result = false;
2808 bool AliHLTMUONDataCheckerComponent::CheckMansoCandidatesBlock(
2809 const AliHLTComponentBlockData& block,
2810 AliHLTUInt32_t blockNumber
2813 /// Checks the validity of a Manso candidates block.
2816 const char* name = "Manso track candidates";
2818 if (not fIgnoreSpec)
2820 if (not IsSpecificationValid(block, blockNumber, name))
2824 AliHLTMUONMansoCandidatesBlockReader inblock(block.fPtr, block.fSize);
2825 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2829 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2831 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2833 // Need to check that no entries have duplicated data but with a
2834 // different track ID number.
2835 AliHLTMUONMansoCandidateStruct ti = inblock[i];
2837 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2839 AliHLTMUONMansoCandidateStruct tj = inblock[j];
2840 tj.fTrack.fId = ti.fTrack.fId;
2844 HLTError("Problem found with data block %d, fDataType = '%s',"
2845 " fPtr = %p and fSize = %u bytes."
2846 " Assuming this is a %s data block."
2847 " Problem: The Manso track candidates %d and %d"
2848 " contain the same data."
2849 " The data might have been duplicated.",
2851 DataType2Text(block.fDataType).c_str(),
2861 bool trackOk = IsMansoTrackOk(block, blockNumber, name, i, ti.fTrack, ddl);
2862 if (not trackOk) result = false;
2864 // Check that each ROI has a centre point somewhere on the correct
2865 // corresponding chamber and that the Radius is not bigger thant
2866 // the diameter of the chamber which would be pointless.
2867 for (AliHLTInt32_t j = 0; j < 4; j++)
2869 if (ti.fRoI[j].fRadius == -1) continue; // Ignore invalid ROIs
2871 Int_t chamber = AliMUONConstants::ChamberNumber(
2872 ti.fRoI[j].fZ, false // false = do not warn.
2876 HLTError("Problem found with data block %d, fDataType = '%s',"
2877 " fPtr = %p and fSize = %u bytes."
2878 " Assuming this is a %s data block."
2879 " Problem: The region of interest on chamber %d for"
2880 " Manso track candidate %d has a z-coordinate of %f"
2881 " cm that does not correspond to that chamber.",
2883 DataType2Text(block.fDataType).c_str(),
2894 double x = ti.fRoI[j].fX;
2895 double y = ti.fRoI[j].fY;
2896 double r = sqrt(x*x + y*y);
2897 if (r > AliMUONConstants::Dmax((j+6)/2))
2899 // Just a warning since this is not a data integrity problem
2900 // but rather just a data sanity problem.
2901 HLTWarning("Problem found with data block %d, fDataType = '%s',"
2902 " fPtr = %p and fSize = %u bytes."
2903 " Assuming this is a %s data block."
2904 " Problem: The region of interest coordinate {x = %f,"
2905 " y = %f} cm on chamber %d for Manso track candidate %d"
2906 " does not correspond to that chamber.",
2908 DataType2Text(block.fDataType).c_str(),
2920 if (ti.fRoI[j].fRadius > AliMUONConstants::Dmax((j+6)/2))
2922 // Just a warning since this is not a data integrity problem
2923 // but rather just a data sanity problem.
2924 HLTWarning("Problem found with data block %d, fDataType = '%s',"
2925 " fPtr = %p and fSize = %u bytes."
2926 " Assuming this is a %s data block."
2927 " Problem: The region of interest radius of %f cm"
2928 " on chamber %d for Manso track candidate %d"
2929 " is bigger than the chamber diameter %f cm.",
2931 DataType2Text(block.fDataType).c_str(),
2938 AliMUONConstants::Dmax((j+6)/2)
2949 bool AliHLTMUONDataCheckerComponent::CheckTracksBlock(
2950 const AliHLTComponentBlockData& block,
2951 AliHLTUInt32_t blockNumber
2954 /// Checks the validity of a tracks block.
2957 const char* name = "tracks";
2959 if (not fIgnoreSpec)
2961 if (not IsSpecificationValid(block, blockNumber, name))
2965 AliHLTMUONTracksBlockReader inblock(block.fPtr, block.fSize);
2966 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2970 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2972 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2974 // Need to check that no entries have duplicated data but with
2975 // a different track ID number.
2976 AliHLTMUONTrackStruct ti = inblock[i];
2978 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2980 AliHLTMUONTrackStruct tj = inblock[j];
2985 HLTError("Problem found with data block %d, fDataType = '%s',"
2986 " fPtr = %p and fSize = %u bytes."
2987 " Assuming this is a %s data block."
2988 " Problem: The track structures %d and %d contain the"
2989 " same data. The data might have been duplicated.",
2991 DataType2Text(block.fDataType).c_str(),
3001 bool trackOk = IsTrackOk(block, blockNumber, name, i, ti, ddl);
3002 if (not trackOk) result = false;
3009 bool AliHLTMUONDataCheckerComponent::CheckSinglesDecisionBlock(
3010 const AliHLTComponentBlockData& block,
3011 AliHLTUInt32_t blockNumber
3014 /// Checks the validity of a single tracks trigger decision block.
3017 const char* name = "singles decision";
3019 if (not fIgnoreSpec)
3021 if (not IsSpecificationValid(block, blockNumber, name))
3025 AliHLTMUONSinglesDecisionBlockReader inblock(block.fPtr, block.fSize);
3026 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
3033 bool AliHLTMUONDataCheckerComponent::CheckPairsDecisionBlock(
3034 const AliHLTComponentBlockData& block,
3035 AliHLTUInt32_t blockNumber
3038 /// Checks the validity of a track pairs trigger decision block.
3041 const char* name = "pairs decision";
3043 if (not fIgnoreSpec)
3045 if (not IsSpecificationValid(block, blockNumber, name))
3049 AliHLTMUONPairsDecisionBlockReader inblock(block.fPtr, block.fSize);
3050 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
3057 bool AliHLTMUONDataCheckerComponent::AreMomentaCompatible(
3058 AliHLTFloat32_t px1,
3059 AliHLTFloat32_t py1,
3060 AliHLTFloat32_t pz1,
3061 AliHLTFloat32_t px2,
3062 AliHLTFloat32_t py2,
3066 /// Checks to see if the two momenta vectors are compatible or not.
3067 /// The vectors should not have an angle more than 10 degrees between
3068 /// them and their magnitudes should not be more different than 50%.
3070 double p1 = sqrt(double(px1)*double(px1) + double(py1)*double(py1) + double(pz1)*double(pz1));
3071 double p2 = sqrt(double(px2)*double(px2) + double(py2)*double(py2) + double(pz2)*double(pz2));
3072 if (p1 == 0 and p2 == 0) return true;
3073 if (fabs(p1 - p2) / ((p1 + p2)*0.5) > 0.5) return false;
3074 double denom = p1 * p2;
3075 if (denom == 0) return false;
3076 double ratio = (double(px1)*double(px2) + double(py1)*double(py2) + double(pz1)*double(pz2)) / denom;
3077 if (ratio < -1) return true;
3078 if (ratio > 1) return true;
3079 double angle = acos(ratio);
3080 if (angle > 3.14159265358979323846 * 10. / 180.) return false;
3085 bool AliHLTMUONDataCheckerComponent::IsScalarTooLarge(
3086 const AliHLTComponentBlockData* block,
3087 AliHLTUInt32_t blockNumber,
3088 const char* blockTypeName,
3089 const char* scalarName,
3090 AliHLTUInt32_t scalarValue,
3091 AliHLTUInt32_t totalTrackCount
3094 /// Checks if the scalar value is larger than the number of
3095 /// tracks in the event.
3097 if (scalarValue > totalTrackCount)
3099 HLTError("Problem found with %s trigger decision"
3100 " data block %d, fDataType = '%s', fPtr = %p and"
3101 " fSize = %u bytes."
3102 " Problem: The %s scalar with value %d is larger"
3103 " than the total number of tracks found for the"
3104 " event (%d tracks).",
3107 DataType2Text(block->fDataType).c_str(),
3123 bool AliHLTMUONDataCheckerComponent::IsScalarTooLargePairs(
3124 const AliHLTComponentBlockData* block,
3125 AliHLTUInt32_t blockNumber,
3126 const char* blockTypeName,
3127 const char* scalarName,
3128 AliHLTUInt32_t scalarValue,
3129 AliHLTUInt32_t trackPairsCount
3132 /// Checks if the scalar value is larger than the number of
3133 /// track pairs in the event.
3135 if (scalarValue > trackPairsCount)
3137 HLTError("Problem found with %s trigger decision"
3138 " data block %d, fDataType = '%s', fPtr = %p and"
3139 " fSize = %u bytes."
3140 " Problem: The %s scalar with value %d is larger"
3141 " than the total number of track pairs found for the"
3142 " event (%d track pairs).",
3145 DataType2Text(block->fDataType).c_str(),
3161 bool AliHLTMUONDataCheckerComponent::IsScalarALargerThanB(
3162 const AliHLTComponentBlockData* block,
3163 AliHLTUInt32_t blockNumber,
3164 const char* blockTypeName,
3165 const char* scalarAName,
3166 AliHLTUInt32_t scalarAValue,
3167 const char* scalarBName,
3168 AliHLTUInt32_t scalarBValue
3171 /// Checks if the scalar value is larger than the number of Manso
3172 /// tracks in the event.
3174 if (scalarAValue > scalarBValue)
3176 HLTError("Problem found with %s trigger decision"
3177 " data block %d, fDataType = '%s', fPtr = %p and"
3178 " fSize = %u bytes."
3179 " Problem: The %s scalar with value %d is larger"
3180 " than scalar %s with value %d, but is should not be.",
3183 DataType2Text(block->fDataType).c_str(),
3200 void AliHLTMUONDataCheckerComponent::MarkBlock(
3201 const AliHLTComponentBlockData* blocks,
3203 AliHLTUInt32_t blockCount,
3204 const AliHLTComponentBlockData* blockToMark
3207 /// Tries to find the 'blockToMark' in the list of blocks and sets the
3208 /// corresponding 'blockOk' flag to false.
3210 for (AliHLTUInt32_t i = 0; i < blockCount; i++)
3212 if (&blocks[i] == blockToMark)
3221 void AliHLTMUONDataCheckerComponent::MakeGlobalChecks(
3222 const AliHLTComponentBlockData* blocks,
3224 AliHLTUInt32_t blockCount,
3225 const AliHLTComponentBlockData** trigRecBlocks,
3226 AliHLTUInt32_t trigRecBlocksCount,
3227 const AliHLTComponentBlockData** trigRecDebugBlocks,
3228 AliHLTUInt32_t trigRecDebugBlocksCount,
3229 const AliHLTComponentBlockData** hitBlocks,
3230 AliHLTUInt32_t hitBlocksCount,
3231 const AliHLTComponentBlockData** clusterBlocks,
3232 AliHLTUInt32_t clusterBlocksCount,
3233 const AliHLTComponentBlockData** channelBlocks,
3234 AliHLTUInt32_t channelBlocksCount,
3235 const AliHLTComponentBlockData** mansoTrackBlocks,
3236 AliHLTUInt32_t mansoTrackBlocksCount,
3237 const AliHLTComponentBlockData** mansoCandidateBlocks,
3238 AliHLTUInt32_t mansoCandidateBlocksCount,
3239 const AliHLTComponentBlockData** trackBlocks,
3240 AliHLTUInt32_t trackBlocksCount,
3241 const AliHLTComponentBlockData** singleDecisionBlocks,
3242 AliHLTUInt32_t singleDecisionBlocksCount,
3243 const AliHLTComponentBlockData** pairDecisionBlocks,
3244 AliHLTUInt32_t pairDecisionBlocksCount
3247 /// The following set of global checks are performed:
3248 /// 1) Checks if all the ID numbers in all the blocks are unique.
3249 /// 2) Check if all the structures are unique up to their ID numbers,
3250 /// that it, make sure there are no structures with the same data but
3251 /// for a different ID number.
3252 /// 3) Check if the reference ID numbers are correct, i.e. are the
3253 /// trigger record ID numbers in the track structures found in any of
3254 /// the trigger record data blocks.
3255 /// 4) Do the number of channels claimed in the cluster correspond to
3256 /// the number of channel structures.
3257 /// 5) Check that the momentum vectors between the Manso and full tracks,
3258 /// and the corresponding trigger record are compatible.
3259 /// 6) Check that the trigger decision scalars are reasonable.
3260 /// 7) Check that the detector element IDs are the same between rec
3261 /// hits and clusters / trigger record debug blocks.
3263 // Check if all the trigger record identifiers and data are unique.
3264 for (AliHLTUInt32_t bi = 0; bi < trigRecBlocksCount; bi++)
3266 AliHLTMUONTriggerRecordsBlockReader inblocki(trigRecBlocks[bi]->fPtr, trigRecBlocks[bi]->fSize);
3267 if (not inblocki.BufferSizeOk()) continue;
3268 for (AliHLTUInt32_t bj = bi+1; bj < trigRecBlocksCount; bj++)
3270 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
3271 if (not inblockj.BufferSizeOk()) continue;
3273 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3274 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3276 if (inblocki[i].fId == inblockj[j].fId)
3278 HLTError("Problem found with trigger record data block %d,"
3279 " fDataType = '%s', fPtr = %p and fSize = %u bytes,"
3280 " and trigger record data block %d,"
3281 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3282 " Problem: Trigger record %d in block %d and entry"
3283 " %d in block %d have the same identfier, but they"
3284 " should be unique.",
3286 DataType2Text(trigRecBlocks[bi]->fDataType).c_str(),
3287 trigRecBlocks[bi]->fPtr,
3288 trigRecBlocks[bi]->fSize,
3290 DataType2Text(trigRecBlocks[bj]->fDataType).c_str(),
3291 trigRecBlocks[bj]->fPtr,
3292 trigRecBlocks[bj]->fSize,
3296 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bi]);
3297 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bj]);
3300 AliHLTMUONTriggerRecordStruct a = inblocki[i];
3301 AliHLTMUONTriggerRecordStruct b = inblockj[j];
3305 HLTError("Problem found with trigger record data block %d,"
3306 " fDataType = '%s', fPtr = %p and fSize = %u bytes,"
3307 " and trigger record data block %d,"
3308 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3309 " Problem: Trigger record %d in block %d and entry"
3310 " %d in block %d have the same data."
3311 " The data may have been duplicated.",
3313 DataType2Text(trigRecBlocks[bi]->fDataType).c_str(),
3314 trigRecBlocks[bi]->fPtr,
3315 trigRecBlocks[bi]->fSize,
3317 DataType2Text(trigRecBlocks[bj]->fDataType).c_str(),
3318 trigRecBlocks[bj]->fPtr,
3319 trigRecBlocks[bj]->fSize,
3323 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bi]);
3324 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bj]);
3330 for (AliHLTUInt32_t bi = 0; bi < trigRecDebugBlocksCount; bi++)
3332 AliHLTMUONTrigRecsDebugBlockReader inblocki(trigRecDebugBlocks[bi]->fPtr, trigRecDebugBlocks[bi]->fSize);
3333 if (not inblocki.BufferSizeOk()) continue;
3335 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3337 // Check if all the trigger record IDs in the debug information structures exist.
3340 for (AliHLTUInt32_t bj = 0; bj < trigRecBlocksCount and not found; bj++)
3342 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
3343 if (not inblockj.BufferSizeOk()) continue;
3345 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3347 if (inblocki[i].fTrigRecId == inblockj[j].fId)
3351 // Since we found the corresponding trigger record,
3352 // check if the detector element IDs are the same.
3353 bool deOk = CheckDetElemIds(
3354 *trigRecDebugBlocks[bi], bi, i, inblocki[i],
3355 *trigRecBlocks[bj], bj, j, inblockj[j]
3359 MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bi]);
3360 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bj]);
3370 HLTError("Problem found with trigger record debug information"
3371 " data block %d, fDataType = '%s', fPtr = %p and"
3372 " fSize = %u bytes."
3373 " Problem with entry %d in block: The trigger record"
3374 " identifier %d does not exist in any trigger record"
3377 DataType2Text(trigRecDebugBlocks[bi]->fDataType).c_str(),
3378 trigRecDebugBlocks[bi]->fPtr,
3379 trigRecDebugBlocks[bi]->fSize,
3380 i, inblocki[i].fTrigRecId
3382 MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bi]);
3386 // Check if all the trigger record debug information structures are unique.
3387 for (AliHLTUInt32_t bj = bi+1; bj < trigRecDebugBlocksCount; bj++)
3389 AliHLTMUONTrigRecsDebugBlockReader inblockj(trigRecDebugBlocks[bj]->fPtr, trigRecDebugBlocks[bj]->fSize);
3390 if (not inblockj.BufferSizeOk()) continue;
3392 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3393 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3395 AliHLTMUONTrigRecInfoStruct a = inblocki[i];
3396 AliHLTMUONTrigRecInfoStruct b = inblockj[j];
3397 a.fTrigRecId = b.fTrigRecId = -1;
3400 HLTError("Problem found with trigger record debug information"
3401 " data block %d, fDataType = '%s', fPtr = %p and"
3402 " fSize = %u bytes, and trigger record debug"
3403 " information data block %d,"
3404 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3405 " Problem: The trigger record debug inforamtion"
3406 " structure %d in block %d and entry"
3407 " %d in block %d have the same data."
3408 " The data may have been duplicated.",
3410 DataType2Text(trigRecDebugBlocks[bi]->fDataType).c_str(),
3411 trigRecDebugBlocks[bi]->fPtr,
3412 trigRecDebugBlocks[bi]->fSize,
3414 DataType2Text(trigRecDebugBlocks[bj]->fDataType).c_str(),
3415 trigRecDebugBlocks[bj]->fPtr,
3416 trigRecDebugBlocks[bj]->fSize,
3420 MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bi]);
3421 MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bj]);
3427 // Check that all the reconstructed hits are unique.
3428 for (AliHLTUInt32_t bi = 0; bi < hitBlocksCount; bi++)
3430 AliHLTMUONRecHitsBlockReader inblocki(hitBlocks[bi]->fPtr, hitBlocks[bi]->fSize);
3431 if (not inblocki.BufferSizeOk()) continue;
3432 for (AliHLTUInt32_t bj = bi+1; bj < hitBlocksCount; bj++)
3434 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
3435 if (not inblockj.BufferSizeOk()) continue;
3437 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3438 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3440 if (inblocki[i] == inblockj[j])
3442 HLTError("Problem found with reconstructed hit data block %d,"
3443 " fDataType = '%s', fPtr = %p and fSize = %u bytes,"
3444 " and reconstructed hit data block %d,"
3445 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3446 " Problem: Reconstructed hit %d in block %d and entry"
3447 " %d in block %d are the same, but all hits"
3448 " should be unique.",
3450 DataType2Text(hitBlocks[bi]->fDataType).c_str(),
3451 hitBlocks[bi]->fPtr,
3452 hitBlocks[bi]->fSize,
3454 DataType2Text(hitBlocks[bj]->fDataType).c_str(),
3455 hitBlocks[bj]->fPtr,
3456 hitBlocks[bj]->fSize,
3460 MarkBlock(blocks, blockOk, blockCount, hitBlocks[bi]);
3461 MarkBlock(blocks, blockOk, blockCount, hitBlocks[bj]);
3467 for (AliHLTUInt32_t bi = 0; bi < clusterBlocksCount; bi++)
3469 AliHLTMUONClustersBlockReader inblocki(clusterBlocks[bi]->fPtr, clusterBlocks[bi]->fSize);
3470 if (not inblocki.BufferSizeOk()) continue;
3472 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3474 // Check if all the reconstructed hit coordinates in the cluster structures exist.
3477 for (AliHLTUInt32_t bj = 0; bj < hitBlocksCount and not found; bj++)
3479 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
3480 if (not inblockj.BufferSizeOk()) continue;
3482 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3484 if (inblocki[i].fHit == inblockj[j])
3488 // Since we found the corresponding cluster,
3489 // check if the detector element IDs are the same.
3490 bool deOk = CheckDetElemIds(
3491 *clusterBlocks[bi], bi, i, inblocki[i],
3492 *hitBlocks[bj], bj, j, inblockj[j]
3496 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3497 MarkBlock(blocks, blockOk, blockCount, hitBlocks[bj]);
3505 // If the hit was not found then it should be nil.
3506 if (not found and (inblocki[i].fHit != AliHLTMUONConstants::NilRecHitStruct()))
3508 HLTError("Problem found with cluster data block %d,"
3509 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3510 " Problem with entry %d in block: The cluster hit"
3511 " coordinate {x = %f, y = %f, z = %f} does not exist"
3512 " in any reconstructed hit data block.",
3514 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3515 clusterBlocks[bi]->fPtr,
3516 clusterBlocks[bi]->fSize,
3518 inblocki[i].fHit.fX,
3519 inblocki[i].fHit.fY,
3522 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3525 // Check that the fNchannelsB value is correct.
3526 // First count the number of channels found in the channels block that
3527 // correspond to the cluster. Do this for the bending and non-bending planes.
3528 AliHLTUInt32_t countB = 0;
3529 AliHLTUInt32_t countNB = 0;
3530 for (AliHLTUInt32_t bj = 0; bj < channelBlocksCount and not found; bj++)
3532 AliHLTMUONChannelsBlockReader inblockj(channelBlocks[bj]->fPtr, channelBlocks[bj]->fSize);
3533 if (not inblockj.BufferSizeOk()) continue;
3535 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3537 if (inblocki[i].fId != inblockj[j].fClusterId) continue;
3538 if ((inblockj[j].fRawDataWord & (1 << 28)) == 0)
3545 if (inblocki[i].fNchannelsB != countB)
3547 HLTWarning("Problem found with cluster data block %d,"
3548 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3549 " Problem with entry %d in block: The number of bending plane"
3550 " channels in the cluster is reported as %d,"
3551 " but %d channel structures were found.",
3553 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3554 clusterBlocks[bi]->fPtr,
3555 clusterBlocks[bi]->fSize,
3557 inblocki[i].fNchannelsB,
3560 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3563 if (inblocki[i].fNchannelsNB != countNB)
3565 HLTWarning("Problem found with cluster data block %d,"
3566 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3567 " Problem with entry %d in block: The number of"
3568 " channels in the cluster of non-bending plane is reported as %d,"
3569 " but %d channel structures were found.",
3571 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3572 clusterBlocks[bi]->fPtr,
3573 clusterBlocks[bi]->fSize,
3575 inblocki[i].fNchannelsNB,
3578 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3582 // Check if all the cluster structures are unique up to the identifier
3583 // and have unique identifiers.
3584 for (AliHLTUInt32_t bj = bi+1; bj < clusterBlocksCount; bj++)
3586 AliHLTMUONClustersBlockReader inblockj(clusterBlocks[bj]->fPtr, clusterBlocks[bj]->fSize);
3587 if (not inblockj.BufferSizeOk()) continue;
3589 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3590 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3592 if (inblocki[i].fId == inblockj[j].fId)
3594 HLTError("Problem found with cluster"
3595 " data block %d, fDataType = '%s', fPtr = %p and"
3596 " fSize = %u bytes, and cluster data block %d,"
3597 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3598 " Problem: The cluster %d in block %d and entry"
3599 " %d in block %d have the same identifier, but they"
3600 " should be unique.",
3602 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3603 clusterBlocks[bi]->fPtr,
3604 clusterBlocks[bi]->fSize,
3606 DataType2Text(clusterBlocks[bj]->fDataType).c_str(),
3607 clusterBlocks[bj]->fPtr,
3608 clusterBlocks[bj]->fSize,
3612 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3613 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bj]);
3616 AliHLTMUONClusterStruct a = inblocki[i];
3617 AliHLTMUONClusterStruct b = inblockj[j];
3621 HLTError("Problem found with cluster"
3622 " data block %d, fDataType = '%s', fPtr = %p and"
3623 " fSize = %u bytes, and cluster data block %d,"
3624 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3625 " Problem: The cluster %d in block %d and entry"
3626 " %d in block %d have the same data."
3627 " The data may have been duplicated.",
3629 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3630 clusterBlocks[bi]->fPtr,
3631 clusterBlocks[bi]->fSize,
3633 DataType2Text(clusterBlocks[bj]->fDataType).c_str(),
3634 clusterBlocks[bj]->fPtr,
3635 clusterBlocks[bj]->fSize,
3639 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3640 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bj]);
3646 for (AliHLTUInt32_t bi = 0; bi < channelBlocksCount; bi++)
3648 AliHLTMUONChannelsBlockReader inblocki(channelBlocks[bi]->fPtr, channelBlocks[bi]->fSize);
3649 if (not inblocki.BufferSizeOk()) continue;
3651 // Check if all the cluster IDs in the channel structures exist.
3652 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3656 for (AliHLTUInt32_t bj = 0; bj < clusterBlocksCount and not found; bj++)
3658 AliHLTMUONClustersBlockReader inblockj(clusterBlocks[bj]->fPtr, clusterBlocks[bj]->fSize);
3659 if (not inblockj.BufferSizeOk()) continue;
3661 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3663 if (inblocki[i].fClusterId == inblockj[j].fId)
3673 HLTError("Problem found with channel"
3674 " data block %d, fDataType = '%s', fPtr = %p and"
3675 " fSize = %u bytes."
3676 " Problem with entry %d in block: The cluster"
3677 " identifier %d does not exist in any cluster"
3680 DataType2Text(channelBlocks[bi]->fDataType).c_str(),
3681 channelBlocks[bi]->fPtr,
3682 channelBlocks[bi]->fSize,
3683 i, inblocki[i].fClusterId
3685 MarkBlock(blocks, blockOk, blockCount, channelBlocks[bi]);
3689 // Check if all the channel structures are unique up to the cluster ID.
3690 for (AliHLTUInt32_t bj = bi+1; bj < channelBlocksCount; bj++)
3692 AliHLTMUONChannelsBlockReader inblockj(channelBlocks[bj]->fPtr, channelBlocks[bj]->fSize);
3693 if (not inblockj.BufferSizeOk()) continue;
3695 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3696 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3698 AliHLTMUONChannelStruct a = inblocki[i];
3699 AliHLTMUONChannelStruct b = inblockj[j];
3700 a.fClusterId = b.fClusterId = -1;
3703 HLTError("Problem found with channel"
3704 " data block %d, fDataType = '%s', fPtr = %p and"
3705 " fSize = %u bytes, and channel data block %d,"
3706 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3707 " Problem: The channel %d in block %d and entry"
3708 " %d in block %d have the same data."
3709 " The data may have been duplicated.",
3711 DataType2Text(channelBlocks[bi]->fDataType).c_str(),
3712 channelBlocks[bi]->fPtr,
3713 channelBlocks[bi]->fSize,
3715 DataType2Text(channelBlocks[bj]->fDataType).c_str(),
3716 channelBlocks[bj]->fPtr,
3717 channelBlocks[bj]->fSize,
3721 MarkBlock(blocks, blockOk, blockCount, channelBlocks[bi]);
3722 MarkBlock(blocks, blockOk, blockCount, channelBlocks[bj]);
3728 // Will need the total number of tracks later for comparison to trigger scalars.
3729 AliHLTUInt32_t totalTrackCount = 0;
3731 for (AliHLTUInt32_t bi = 0; bi < mansoTrackBlocksCount; bi++)
3733 AliHLTMUONMansoTracksBlockReader inblocki(mansoTrackBlocks[bi]->fPtr, mansoTrackBlocks[bi]->fSize);
3734 if (not inblocki.BufferSizeOk()) continue;
3736 totalTrackCount += inblocki.Nentries();
3738 // Check if all the trigger record IDs in the Manso track structures exist.
3739 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3743 for (AliHLTUInt32_t bj = 0; bj < trigRecBlocksCount and not found; bj++)
3745 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
3746 if (not inblockj.BufferSizeOk()) continue;
3748 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3750 if (inblocki[i].fTrigRec == inblockj[j].fId)
3752 // At this point we can check if the momentum
3753 // is compatible with the trigger record.
3754 if (not AreMomentaCompatible(
3755 inblocki[i].fPx, inblocki[i].fPy, inblocki[i].fPz,
3756 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
3760 HLTWarning("Problem found with Manso track"
3761 " data block %d, fDataType = '%s', fPtr = %p and"
3762 " fSize = %u bytes."
3763 " Problem with Manso track %d in block: The momentum"
3764 " vector of the track p = {%f, %f, %f} GeV/c is not"
3765 " compatible with the momentum vector of the trigger"
3766 " record with p = {%f, %f, %f} GeV/c.",
3768 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3769 mansoTrackBlocks[bi]->fPtr,
3770 mansoTrackBlocks[bi]->fSize,
3771 i, inblocki[i].fPx, inblocki[i].fPy, inblocki[i].fPz,
3772 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
3774 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3785 HLTError("Problem found with Manso track"
3786 " data block %d, fDataType = '%s', fPtr = %p and"
3787 " fSize = %u bytes."
3788 " Problem with Manso track %d in block: The trigger"
3789 " record identifier %d does not exist in any trigger"
3790 " record data block.",
3792 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3793 mansoTrackBlocks[bi]->fPtr,
3794 mansoTrackBlocks[bi]->fSize,
3795 i, inblocki[i].fTrigRec
3797 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3801 // Check if all the hits in the Manso track structures exist.
3802 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3804 AliHLTMUONParticleSign sign;
3806 AliHLTMUONUtils::UnpackMansoTrackFlags(inblocki[i].fFlags, sign, hitset);
3808 for (AliHLTUInt32_t n = 0; n < 4; n++)
3810 if (not hitset[n]) continue;
3813 for (AliHLTUInt32_t bj = 0; bj < hitBlocksCount and not found; bj++)
3815 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
3816 if (not inblockj.BufferSizeOk()) continue;
3818 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3820 if (inblocki[i].fHit[n] == inblockj[j])
3830 HLTError("Problem found with Manso track"
3831 " data block %d, fDataType = '%s', fPtr = %p and"
3832 " fSize = %u bytes."
3833 " Problem with Manso track %d in block: The hit"
3834 " for chamber %d does not exist in any"
3835 " reconstructed hits data block.",
3837 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3838 mansoTrackBlocks[bi]->fPtr,
3839 mansoTrackBlocks[bi]->fSize,
3842 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3847 // Check if all the Manso track structures are unique up to the ID and
3848 // have unique identifiers.
3849 for (AliHLTUInt32_t bj = bi+1; bj < mansoTrackBlocksCount; bj++)
3851 AliHLTMUONMansoTracksBlockReader inblockj(mansoTrackBlocks[bj]->fPtr, mansoTrackBlocks[bj]->fSize);
3852 if (not inblockj.BufferSizeOk()) continue;
3854 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3855 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3857 if (inblocki[i].fId == inblockj[j].fId)
3859 HLTError("Problem found with Manso track"
3860 " data block %d, fDataType = '%s', fPtr = %p and"
3861 " fSize = %u bytes, and Manso track data block %d,"
3862 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3863 " Problem: The Manso track %d in block %d and entry"
3864 " %d in block %d have the same identifier, but they"
3865 " should be unique.",
3867 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3868 mansoTrackBlocks[bi]->fPtr,
3869 mansoTrackBlocks[bi]->fSize,
3871 DataType2Text(mansoTrackBlocks[bj]->fDataType).c_str(),
3872 mansoTrackBlocks[bj]->fPtr,
3873 mansoTrackBlocks[bj]->fSize,
3877 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3878 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bj]);
3881 AliHLTMUONMansoTrackStruct a = inblocki[i];
3882 AliHLTMUONMansoTrackStruct b = inblockj[j];
3886 HLTError("Problem found with Manso track"
3887 " data block %d, fDataType = '%s', fPtr = %p and"
3888 " fSize = %u bytes, and Manso track data block %d,"
3889 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3890 " Problem: The Manso track %d in block %d and entry"
3891 " %d in block %d have the same data."
3892 " The data may have been duplicated.",
3894 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3895 mansoTrackBlocks[bi]->fPtr,
3896 mansoTrackBlocks[bi]->fSize,
3898 DataType2Text(mansoTrackBlocks[bj]->fDataType).c_str(),
3899 mansoTrackBlocks[bj]->fPtr,
3900 mansoTrackBlocks[bj]->fSize,
3904 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3905 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bj]);
3911 for (AliHLTUInt32_t bi = 0; bi < mansoCandidateBlocksCount; bi++)
3913 AliHLTMUONMansoCandidatesBlockReader inblocki(mansoCandidateBlocks[bi]->fPtr, mansoCandidateBlocks[bi]->fSize);
3914 if (not inblocki.BufferSizeOk()) continue;
3916 // Check if all the trigger record IDs in the Manso track candidate structures exist.
3917 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3921 for (AliHLTUInt32_t bj = 0; bj < trigRecBlocksCount and not found; bj++)
3923 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
3924 if (not inblockj.BufferSizeOk()) continue;
3926 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3928 if (inblocki[i].fTrack.fTrigRec == inblockj[j].fId)
3930 // At this point we can check if the momentum
3931 // is compatible with the trigger record.
3932 if (not AreMomentaCompatible(
3933 inblocki[i].fTrack.fPx, inblocki[i].fTrack.fPy, inblocki[i].fTrack.fPz,
3934 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
3938 HLTWarning("Problem found with Manso track candidate"
3939 " data block %d, fDataType = '%s', fPtr = %p and"
3940 " fSize = %u bytes."
3941 " Problem with track candidate %d in block: The momentum"
3942 " vector of the candidate p = {%f, %f, %f} GeV/c is not"
3943 " compatible with the momentum vector of the trigger"
3944 " record with p = {%f, %f, %f} GeV/c.",
3946 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3947 mansoTrackBlocks[bi]->fPtr,
3948 mansoTrackBlocks[bi]->fSize,
3950 inblocki[i].fTrack.fPx, inblocki[i].fTrack.fPy, inblocki[i].fTrack.fPz,
3951 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
3953 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3964 HLTError("Problem found with Manso track candidate"
3965 " data block %d, fDataType = '%s', fPtr = %p and"
3966 " fSize = %u bytes."
3967 " Problem with track candidate %d in block: The trigger"
3968 " record identifier %d does not exist in any trigger"
3969 " record data block.",
3971 DataType2Text(mansoCandidateBlocks[bi]->fDataType).c_str(),
3972 mansoCandidateBlocks[bi]->fPtr,
3973 mansoCandidateBlocks[bi]->fSize,
3974 i, inblocki[i].fTrack.fTrigRec
3976 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bi]);
3980 // Check if all the hits in the Manso track candidate structures exist.
3981 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3983 AliHLTMUONParticleSign sign;
3985 AliHLTMUONUtils::UnpackMansoTrackFlags(inblocki[i].fTrack.fFlags, sign, hitset);
3987 for (AliHLTUInt32_t n = 0; n < 4; n++)
3989 if (not hitset[n]) continue;
3992 for (AliHLTUInt32_t bj = 0; bj < hitBlocksCount and not found; bj++)
3994 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
3995 if (not inblockj.BufferSizeOk()) continue;
3997 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3999 if (inblocki[i].fTrack.fHit[n] == inblockj[j])
4009 HLTError("Problem found with Manso track candidate"
4010 " data block %d, fDataType = '%s', fPtr = %p and"
4011 " fSize = %u bytes."
4012 " Problem with track candidate %d in block: The hit"
4013 " for chamber %d does not exist in any"
4014 " reconstructed hits data block.",
4016 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
4017 mansoTrackBlocks[bi]->fPtr,
4018 mansoTrackBlocks[bi]->fSize,
4021 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
4026 // Check if all the Manso track candidate structures are unique up to the
4027 // track ID and have unique identifiers.
4028 for (AliHLTUInt32_t bj = bi+1; bj < mansoCandidateBlocksCount; bj++)
4030 AliHLTMUONMansoCandidatesBlockReader inblockj(mansoCandidateBlocks[bj]->fPtr, mansoCandidateBlocks[bj]->fSize);
4031 if (not inblockj.BufferSizeOk()) continue;
4033 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
4034 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
4036 if (inblocki[i].fTrack.fId == inblockj[j].fTrack.fId)
4038 HLTError("Problem found with Manso track candidate"
4039 " data block %d, fDataType = '%s', fPtr = %p and"
4040 " fSize = %u bytes, and Manso track candidate data block %d,"
4041 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
4042 " Problem: The track candidate %d in block %d and entry"
4043 " %d in block %d have the same identifier, but they"
4044 " should be unique.",
4046 DataType2Text(mansoCandidateBlocks[bi]->fDataType).c_str(),
4047 mansoCandidateBlocks[bi]->fPtr,
4048 mansoCandidateBlocks[bi]->fSize,
4050 DataType2Text(mansoCandidateBlocks[bj]->fDataType).c_str(),
4051 mansoCandidateBlocks[bj]->fPtr,
4052 mansoCandidateBlocks[bj]->fSize,
4056 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bi]);
4057 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bj]);
4060 AliHLTMUONMansoCandidateStruct a = inblocki[i];
4061 AliHLTMUONMansoCandidateStruct b = inblockj[j];
4062 a.fTrack.fId = b.fTrack.fId = -1;
4065 HLTError("Problem found with Manso track candidate"
4066 " data block %d, fDataType = '%s', fPtr = %p and"
4067 " fSize = %u bytes, and Manso track candidate data block %d,"
4068 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
4069 " Problem: The track candidate %d in block %d and entry"
4070 " %d in block %d have the same data."
4071 " The data may have been duplicated.",
4073 DataType2Text(mansoCandidateBlocks[bi]->fDataType).c_str(),
4074 mansoCandidateBlocks[bi]->fPtr,
4075 mansoCandidateBlocks[bi]->fSize,
4077 DataType2Text(mansoCandidateBlocks[bj]->fDataType).c_str(),
4078 mansoCandidateBlocks[bj]->fPtr,
4079 mansoCandidateBlocks[bj]->fSize,
4083 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bi]);
4084 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bj]);
4090 for (AliHLTUInt32_t bi = 0; bi < trackBlocksCount; bi++)
4092 AliHLTMUONTracksBlockReader inblocki(trackBlocks[bi]->fPtr, trackBlocks[bi]->fSize);
4093 if (not inblocki.BufferSizeOk()) continue;
4095 totalTrackCount += inblocki.Nentries();
4097 // Check if all the trigger record IDs in the track structures exist.
4098 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
4102 for (AliHLTUInt32_t bj = 0; bj < trigRecBlocksCount and not found; bj++)
4104 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
4105 if (not inblockj.BufferSizeOk()) continue;
4107 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
4109 if (inblocki[i].fTrigRec == inblockj[j].fId)
4111 // At this point we can check if the momentum
4112 // is compatible with the trigger record.
4113 if (not AreMomentaCompatible(
4114 inblocki[i].fPx, inblocki[i].fPy, inblocki[i].fPz,
4115 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
4119 HLTWarning("Problem found with track"
4120 " data block %d, fDataType = '%s', fPtr = %p and"
4121 " fSize = %u bytes."
4122 " Problem with track structure %d in block: The momentum"
4123 " vector of the track p = {%f, %f, %f} GeV/c is not"
4124 " compatible with the momentum vector of the trigger"
4125 " record with p = {%f, %f, %f} GeV/c.",
4127 DataType2Text(trackBlocks[bi]->fDataType).c_str(),
4128 trackBlocks[bi]->fPtr,
4129 trackBlocks[bi]->fSize,
4130 i, inblocki[i].fPx, inblocki[i].fPy, inblocki[i].fPz,
4131 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
4133 MarkBlock(blocks, blockOk, blockCount, trackBlocks[bi]);
4144 HLTError("Problem found with track"
4145 " data block %d, fDataType = '%s', fPtr = %p and"
4146 " fSize = %u bytes."
4147 " Problem with track structure %d in block: The trigger"
4148 " record identifier %d does not exist in any trigger"
4149 " record data block.",
4151 DataType2Text(trackBlocks[bi]->fDataType).c_str(),
4152 trackBlocks[bi]->fPtr,
4153 trackBlocks[bi]->fSize,
4154 i, inblocki[i].fTrigRec
4156 MarkBlock(blocks, blockOk, blockCount, trackBlocks[bi]);
4160 // Check if all the hits in the track structures exist.
4161 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
4163 AliHLTMUONParticleSign sign;
4165 AliHLTMUONUtils::UnpackTrackFlags(inblocki[i].fFlags, sign, hitset);
4167 for (AliHLTUInt32_t n = 0; n < 16; n++)
4169 if (not hitset[n]) continue;
4172 for (AliHLTUInt32_t bj = 0; bj < hitBlocksCount and not found; bj++)
4174 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
4175 if (not inblockj.BufferSizeOk()) continue;
4177 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
4179 if (inblocki[i].fHit[n] == inblockj[j])
4189 HLTError("Problem found with track"
4190 " data block %d, fDataType = '%s', fPtr = %p and"
4191 " fSize = %u bytes."
4192 " Problem with track structure %d in block: The hit"
4193 " for chamber %d does not exist in any"
4194 " reconstructed hits data block.",
4196 DataType2Text(trackBlocks[bi]->fDataType).c_str(),
4197 trackBlocks[bi]->fPtr,
4198 trackBlocks[bi]->fSize,
4201 MarkBlock(blocks, blockOk, blockCount, trackBlocks[bi]);
4206 // Check if all the track structures are unique up to the ID and
4207 // have unique identifiers.
4208 for (AliHLTUInt32_t bj = bi+1; bj < trackBlocksCount; bj++)
4210 AliHLTMUONTracksBlockReader inblockj(trackBlocks[bj]->fPtr, trackBlocks[bj]->fSize);
4211 if (not inblockj.BufferSizeOk()) continue;
4213 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
4214 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
4216 if (inblocki[i].fId == inblockj[j].fId)
4218 HLTError("Problem found with track"
4219 " data block %d, fDataType = '%s', fPtr = %p and"
4220 " fSize = %u bytes, and track data block %d,"
4221 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
4222 " Problem: The track structure %d in block %d and entry"
4223 " %d in block %d have the same identifier, but they"
4224 " should be unique.",
4226 DataType2Text(trackBlocks[bi]->fDataType).c_str(),
4227 trackBlocks[bi]->fPtr,
4228 trackBlocks[bi]->fSize,
4230 DataType2Text(trackBlocks[bj]->fDataType).c_str(),
4231 trackBlocks[bj]->fPtr,
4232 trackBlocks[bj]->fSize,
4236 MarkBlock(blocks, blockOk, blockCount, trackBlocks[bi]);
4237 MarkBlock(blocks, blockOk, blockCount, trackBlocks[bj]);
4240 AliHLTMUONTrackStruct a = inblocki[i];
4241 AliHLTMUONTrackStruct b = inblockj[j];
4245 HLTError("Problem found with track"
4246 " data block %d, fDataType = '%s', fPtr = %p and"
4247 " fSize = %u bytes, and track data block %d,"
4248 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
4249 " Problem: The track structure %d in block %d and entry"
4250 " %d in block %d have the same data."
4251 " The data may have been duplicated.",
4253 DataType2Text(trackBlocks[bi]->fDataType).c_str(),
4254 trackBlocks[bi]->fPtr,
4255 trackBlocks[bi]->fSize,
4257 DataType2Text(trackBlocks[bj]->fDataType).c_str(),
4258 trackBlocks[bj]->fPtr,
4259 trackBlocks[bj]->fSize,
4263 MarkBlock(blocks, blockOk, blockCount, trackBlocks[bi]);
4264 MarkBlock(blocks, blockOk, blockCount, trackBlocks[bj]);
4270 for (AliHLTUInt32_t bi = 0; bi < singleDecisionBlocksCount; bi++)
4272 AliHLTMUONSinglesDecisionBlockReader inblocki(singleDecisionBlocks[bi]->fPtr, singleDecisionBlocks[bi]->fSize);
4273 if (not inblocki.BufferSizeOk()) continue;
4275 // Check that the scalars are within reasonable limits.
4276 const AliHLTMUONSinglesDecisionBlockStruct& hdr = inblocki.BlockHeader();
4277 const AliHLTComponentBlockData* block = singleDecisionBlocks[bi];
4278 if (IsScalarTooLarge(block, bi, "single track", "fNlowPt", hdr.fNlowPt, totalTrackCount) or
4279 IsScalarTooLarge(block, bi, "single track", "fNhighPt", hdr.fNhighPt, totalTrackCount) or
4280 IsScalarALargerThanB(block, bi, "single track", "fNhighPt", hdr.fNhighPt, "fNlowPt", hdr.fNlowPt)
4283 MarkBlock(blocks, blockOk, blockCount, block);
4286 // Check if all the Manso track IDs in the trigger decision structures exist.
4287 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
4291 for (AliHLTUInt32_t bj = 0; bj < mansoTrackBlocksCount and not found; bj++)
4293 AliHLTMUONMansoTracksBlockReader inblockj(mansoTrackBlocks[bj]->fPtr, mansoTrackBlocks[bj]->fSize);
4294 if (not inblockj.BufferSizeOk()) continue;
4296 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
4298 if (inblocki[i].fTrackId == inblockj[j].fId)
4308 HLTError("Problem found with single track trigger decision"
4309 " data block %d, fDataType = '%s', fPtr = %p and"
4310 " fSize = %u bytes."
4311 " Problem with decision %d in block: The track"
4312 " identifier %d does not exist in any Manso tracks"
4315 DataType2Text(singleDecisionBlocks[bi]->fDataType).c_str(),
4316 singleDecisionBlocks[bi]->fPtr,
4317 singleDecisionBlocks[bi]->fSize,
4318 i, inblocki[i].fTrackId
4320 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bi]);
4324 // Check if all the trigger decision structures are unique up to the ID and
4325 // have unique Manso track identifiers.
4326 for (AliHLTUInt32_t bj = bi+1; bj < singleDecisionBlocksCount; bj++)
4328 AliHLTMUONSinglesDecisionBlockReader inblockj(singleDecisionBlocks[bj]->fPtr, singleDecisionBlocks[bj]->fSize);
4329 if (not inblockj.BufferSizeOk()) continue;
4331 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
4332 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
4334 if (inblocki[i].fTrackId == inblockj[j].fTrackId)
4336 HLTError("Problem found with single track trigger decision"
4337 " data block %d, fDataType = '%s', fPtr = %p and"
4338 " fSize = %u bytes, and single track trigger decision"
4340 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
4341 " Problem: The trigger decision %d in block %d and entry"
4342 " %d in block %d have the same Manso track identifier,"
4343 " but they should be unique.",
4345 DataType2Text(singleDecisionBlocks[bi]->fDataType).c_str(),
4346 singleDecisionBlocks[bi]->fPtr,
4347 singleDecisionBlocks[bi]->fSize,
4349 DataType2Text(singleDecisionBlocks[bj]->fDataType).c_str(),
4350 singleDecisionBlocks[bj]->fPtr,
4351 singleDecisionBlocks[bj]->fSize,
4355 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bi]);
4356 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bj]);
4359 AliHLTMUONTrackDecisionStruct a = inblocki[i];
4360 AliHLTMUONTrackDecisionStruct b = inblockj[j];
4361 a.fTrackId = b.fTrackId = -1;
4364 HLTError("Problem found with single track trigger decision"
4365 " data block %d, fDataType = '%s', fPtr = %p and"
4366 " fSize = %u bytes, and single track trigger decision"
4368 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
4369 " Problem: The trigger decision %d in block %d and entry"
4370 " %d in block %d have the same data."
4371 " The data may have been duplicated.",
4373 DataType2Text(singleDecisionBlocks[bi]->fDataType).c_str(),
4374 singleDecisionBlocks[bi]->fPtr,
4375 singleDecisionBlocks[bi]->fSize,
4377 DataType2Text(singleDecisionBlocks[bj]->fDataType).c_str(),
4378 singleDecisionBlocks[bj]->fPtr,
4379 singleDecisionBlocks[bj]->fSize,
4383 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bi]);
4384 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bj]);
4390 for (AliHLTUInt32_t bi = 0; bi < pairDecisionBlocksCount; bi++)
4392 AliHLTMUONPairsDecisionBlockReader inblocki(pairDecisionBlocks[bi]->fPtr, pairDecisionBlocks[bi]->fSize);
4393 if (not inblocki.BufferSizeOk()) continue;
4395 AliHLTUInt32_t maxPairs = totalTrackCount * (totalTrackCount-1) / 2;
4396 const AliHLTMUONPairsDecisionBlockStruct& hdr = inblocki.BlockHeader();
4397 const AliHLTComponentBlockData* block = pairDecisionBlocks[bi];
4398 if (IsScalarTooLargePairs(block, bi, "track pair", "fNunlikeAnyPt", hdr.fNunlikeAnyPt, maxPairs) or
4399 IsScalarTooLargePairs(block, bi, "track pair", "fNunlikeLowPt", hdr.fNunlikeLowPt, maxPairs) or
4400 IsScalarTooLargePairs(block, bi, "track pair", "fNunlikeHighPt", hdr.fNunlikeHighPt, maxPairs) or
4401 IsScalarTooLargePairs(block, bi, "track pair", "fNlikeAnyPt", hdr.fNlikeAnyPt, maxPairs) or
4402 IsScalarTooLargePairs(block, bi, "track pair", "fNlikeLowPt", hdr.fNlikeLowPt, maxPairs) or
4403 IsScalarTooLargePairs(block, bi, "track pair", "fNlikeHighPt", hdr.fNlikeHighPt, maxPairs) or
4404 IsScalarTooLargePairs(block, bi, "track pair", "fNmassAny", hdr.fNmassAny, maxPairs) or
4405 IsScalarTooLargePairs(block, bi, "track pair", "fNmassLow", hdr.fNmassLow, maxPairs) or
4406 IsScalarTooLargePairs(block, bi, "track pair", "fNmassHigh", hdr.fNmassHigh, maxPairs) or
4407 IsScalarALargerThanB(block, bi, "track pair", "fNunlikeHighPt", hdr.fNunlikeHighPt, "fNunlikeLowPt", hdr.fNunlikeLowPt) or
4408 IsScalarALargerThanB(block, bi, "track pair", "fNunlikeLowPt", hdr.fNunlikeLowPt, "fNunlikeAnyPt", hdr.fNunlikeAnyPt) or
4409 IsScalarALargerThanB(block, bi, "track pair", "fNlikeHighPt", hdr.fNlikeHighPt, "fNlikeLowPt", hdr.fNlikeLowPt) or
4410 IsScalarALargerThanB(block, bi, "track pair", "fNlikeLowPt", hdr.fNlikeLowPt, "fNlikeAnyPt", hdr.fNlikeAnyPt) or
4411 IsScalarALargerThanB(block, bi, "track pair", "fNmassHigh", hdr.fNmassHigh, "fNmassLow", hdr.fNmassLow) or
4412 IsScalarALargerThanB(block, bi, "track pair", "fNmassLow", hdr.fNmassLow, "fNmassAny", hdr.fNmassAny)
4415 MarkBlock(blocks, blockOk, blockCount, block);
4418 // Check if all the Manso track IDs in the trigger decision structures exist.
4419 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
4423 for (AliHLTUInt32_t bj = 0; bj < mansoTrackBlocksCount and not found; bj++)
4425 AliHLTMUONMansoTracksBlockReader inblockj(mansoTrackBlocks[bj]->fPtr, mansoTrackBlocks[bj]->fSize);
4426 if (not inblockj.BufferSizeOk()) continue;
4428 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
4430 if (inblocki[i].fTrackAId == inblockj[j].fId)
4440 HLTError("Problem found with track pair trigger decision"
4441 " data block %d, fDataType = '%s', fPtr = %p and"
4442 " fSize = %u bytes."
4443 " Problem with decision %d in block: The track"
4444 " identifier %d does not exist in any Manso tracks"
4447 DataType2Text(pairDecisionBlocks[bi]->fDataType).c_str(),
4448 pairDecisionBlocks[bi]->fPtr,
4449 pairDecisionBlocks[bi]->fSize,
4450 i, inblocki[i].fTrackAId
4452 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bi]);
4457 for (AliHLTUInt32_t bj = 0; bj < mansoTrackBlocksCount and not found; bj++)
4459 AliHLTMUONMansoTracksBlockReader inblockj(mansoTrackBlocks[bj]->fPtr, mansoTrackBlocks[bj]->fSize);
4460 if (not inblockj.BufferSizeOk()) continue;
4462 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
4464 if (inblocki[i].fTrackBId == inblockj[j].fId)
4474 HLTError("Problem found with track pair trigger decision"
4475 " data block %d, fDataType = '%s', fPtr = %p and"
4476 " fSize = %u bytes."
4477 " Problem with decision %d in block: The track"
4478 " identifier %d does not exist in any Manso tracks"
4481 DataType2Text(pairDecisionBlocks[bi]->fDataType).c_str(),
4482 pairDecisionBlocks[bi]->fPtr,
4483 pairDecisionBlocks[bi]->fSize,
4484 i, inblocki[i].fTrackBId
4486 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bi]);
4490 // Check if all the trigger decision structures are unique up to the ID and
4491 // have unique Manso track identifier pairs.
4492 for (AliHLTUInt32_t bj = bi+1; bj < pairDecisionBlocksCount; bj++)
4494 AliHLTMUONPairsDecisionBlockReader inblockj(pairDecisionBlocks[bj]->fPtr, pairDecisionBlocks[bj]->fSize);
4495 if (not inblockj.BufferSizeOk()) continue;
4497 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
4498 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
4500 if (inblocki[i].fTrackAId == inblockj[j].fTrackAId and
4501 inblocki[i].fTrackBId == inblockj[j].fTrackBId
4504 HLTError("Problem found with track pair trigger decision"
4505 " data block %d, fDataType = '%s', fPtr = %p and"
4506 " fSize = %u bytes, and track pair trigger decision"
4508 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
4509 " Problem: The trigger decision %d in block %d and entry"
4510 " %d in block %d have the same Manso track identifier pair,"
4511 " but the pair should be unique.",
4513 DataType2Text(pairDecisionBlocks[bi]->fDataType).c_str(),
4514 pairDecisionBlocks[bi]->fPtr,
4515 pairDecisionBlocks[bi]->fSize,
4517 DataType2Text(pairDecisionBlocks[bj]->fDataType).c_str(),
4518 pairDecisionBlocks[bj]->fPtr,
4519 pairDecisionBlocks[bj]->fSize,
4523 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bi]);
4524 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bj]);
4527 AliHLTMUONPairDecisionStruct a = inblocki[i];
4528 AliHLTMUONPairDecisionStruct b = inblockj[j];
4529 a.fTrackAId = a.fTrackBId = b.fTrackAId = b.fTrackBId = -1;
4532 HLTError("Problem found with track pair trigger decision"
4533 " data block %d, fDataType = '%s', fPtr = %p and"
4534 " fSize = %u bytes, and track pair trigger decision"
4536 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
4537 " Problem: The trigger decision %d in block %d and entry"
4538 " %d in block %d have the same data."
4539 " The data may have been duplicated.",
4541 DataType2Text(pairDecisionBlocks[bi]->fDataType).c_str(),
4542 pairDecisionBlocks[bi]->fPtr,
4543 pairDecisionBlocks[bi]->fSize,
4545 DataType2Text(pairDecisionBlocks[bj]->fDataType).c_str(),
4546 pairDecisionBlocks[bj]->fPtr,
4547 pairDecisionBlocks[bj]->fSize,
4551 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bi]);
4552 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bj]);