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( std::vector<AliHLTComponentDataType>& list)
120 /// Inherited from AliHLTProcessor. Returns the list of expected input data types.
121 /// At the moment this list is "any data type" since it is not known before
122 /// hand what kind of input blocks we will get.
124 assert( list.empty() );
125 list.push_back( kAliHLTAnyDataType );
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 int AliHLTMUONDataCheckerComponent::DoInit(int argc, const char** argv)
162 /// Inherited from AliHLTComponent.
163 /// Parses the command line parameters and initialises the component.
165 HLTInfo("Initialising dHLT data checker component.");
167 // Initialise flags with default values.
170 fDontForward = false;
171 fFilterBadBlocks = false;
172 fNoGlobalChecks = false;
173 fWarnForUnexpecedBlock = false;
174 fReturnError = false;
176 for (int i = 0; i < argc; i++)
178 if (strcmp(argv[i], "-ignoretype") == 0)
181 HLTInfo("Ignoring data type of data blocks as given by framework.");
184 if (strcmp(argv[i], "-ignorespec") == 0)
187 HLTInfo("Ignoring data specification of data blocks as given by framework.");
190 if (strcmp(argv[i], "-dontforward") == 0)
193 HLTInfo("Not forwarding input data blocks.");
196 if (strcmp(argv[i], "-filter") == 0)
198 fFilterBadBlocks = true;
199 HLTInfo("Passing only bad blocks to output.");
202 if (strcmp(argv[i], "-no_global_check") == 0)
204 fNoGlobalChecks = true;
205 HLTInfo("Only per block data consistancy checks will be applied,"
206 " but no global checks will be made."
210 if (strcmp(argv[i], "-warn_on_unexpected_block") == 0)
212 fWarnForUnexpecedBlock = true;
215 if (strcmp(argv[i], "-return_error") == 0)
221 HLTError("Unknown option '%s'.", argv[i]);
229 int AliHLTMUONDataCheckerComponent::DoDeinit()
231 /// Inherited from AliHLTComponent. Performs a cleanup of the component.
233 HLTInfo("Deinitialising dHLT data checker component.");
238 int AliHLTMUONDataCheckerComponent::DoEvent(
239 const AliHLTComponentEventData& evtData,
240 const AliHLTComponentBlockData* blocks,
241 AliHLTComponentTriggerData& /*trigData*/,
242 AliHLTUInt8_t* /*outputPtr*/,
243 AliHLTUInt32_t& size,
244 std::vector<AliHLTComponentBlockData>& outputBlocks
247 /// Inherited from AliHLTProcessor. Processes the new event data.
248 /// Here we go through the list of input data blocks and apply extensive
249 /// data integrity checking on the data found.
251 HLTDebug("Processing event %llu with %u input data blocks.",
252 evtData.fEventID, evtData.fBlockCnt
255 // Allocate an array of flags indicating if the data block is OK or not,
256 // also arrays to store specific.
257 bool dataProblems = false;
258 bool* blockOk = NULL;
259 typedef const AliHLTComponentBlockData* PAliHLTComponentBlockData;
260 PAliHLTComponentBlockData* trigRecBlocks = NULL;
261 PAliHLTComponentBlockData* trigRecDebugBlocks = NULL;
262 PAliHLTComponentBlockData* hitBlocks = NULL;
263 PAliHLTComponentBlockData* clusterBlocks = NULL;
264 PAliHLTComponentBlockData* channelBlocks = NULL;
265 PAliHLTComponentBlockData* mansoTrackBlocks = NULL;
266 PAliHLTComponentBlockData* mansoCandidateBlocks = NULL;
267 PAliHLTComponentBlockData* singleDecisionBlocks = NULL;
268 PAliHLTComponentBlockData* pairDecisionBlocks = NULL;
269 AliHLTUInt32_t trigRecBlocksCount = 0;
270 AliHLTUInt32_t trigRecDebugBlocksCount = 0;
271 AliHLTUInt32_t hitBlocksCount = 0;
272 AliHLTUInt32_t clusterBlocksCount = 0;
273 AliHLTUInt32_t channelBlocksCount = 0;
274 AliHLTUInt32_t mansoTrackBlocksCount = 0;
275 AliHLTUInt32_t mansoCandidateBlocksCount = 0;
276 AliHLTUInt32_t singleDecisionBlocksCount = 0;
277 AliHLTUInt32_t pairDecisionBlocksCount = 0;
280 blockOk = new bool[evtData.fBlockCnt];
281 trigRecBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
282 trigRecDebugBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
283 hitBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
284 clusterBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
285 channelBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
286 mansoTrackBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
287 mansoCandidateBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
288 singleDecisionBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
289 pairDecisionBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
291 catch (const std::bad_alloc&)
293 HLTError("Could not allocate more memory for internal arrays.");
294 // Make sure to clean up if partially allocated memory.
295 if (blockOk != NULL) delete [] blockOk;
296 if (trigRecBlocks != NULL) delete [] trigRecBlocks;
297 if (trigRecDebugBlocks != NULL) delete [] trigRecDebugBlocks;
298 if (hitBlocks != NULL) delete [] hitBlocks;
299 if (clusterBlocks != NULL) delete [] clusterBlocks;
300 if (channelBlocks != NULL) delete [] channelBlocks;
301 if (mansoTrackBlocks != NULL) delete [] mansoTrackBlocks;
302 if (mansoCandidateBlocks != NULL) delete [] mansoCandidateBlocks;
303 if (singleDecisionBlocks != NULL) delete [] singleDecisionBlocks;
304 if (pairDecisionBlocks != NULL) delete [] pairDecisionBlocks;
310 // Clear all the flags indicating if the blocks are ok.
311 for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
316 for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
318 HLTDebug("Handling block: %u, with fDataType = '%s', fPtr = %p and fSize = %u bytes.",
319 n, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fPtr, blocks[n].fSize
322 AliHLTMUONDataBlockType blockType = kUnknownDataBlock;
326 // Decode the block type of we must ignore the block type
327 // as given by the HLT framework.
328 if (blocks[n].fSize >= sizeof(AliHLTMUONDataBlockHeader))
330 const AliHLTMUONDataBlockHeader* header =
331 reinterpret_cast<const AliHLTMUONDataBlockHeader*>(blocks[n].fPtr);
332 blockType = AliHLTMUONDataBlockType(header->fType);
337 if (blocks[n].fDataType == AliHLTMUONConstants::DDLRawDataType())
339 blockOk[n] = CheckRawDataBlock(blocks[n], n);
342 else if (blocks[n].fDataType == AliHLTMUONConstants::TriggerRecordsBlockDataType())
344 blockType = kTriggerRecordsDataBlock;
346 else if (blocks[n].fDataType == AliHLTMUONConstants::TrigRecsDebugBlockDataType())
348 blockType = kTrigRecsDebugDataBlock;
350 else if (blocks[n].fDataType == AliHLTMUONConstants::RecHitsBlockDataType())
352 blockType = kRecHitsDataBlock;
354 else if (blocks[n].fDataType == AliHLTMUONConstants::ClusterBlockDataType())
356 blockType = kClustersDataBlock;
358 else if (blocks[n].fDataType == AliHLTMUONConstants::ChannelBlockDataType())
360 blockType = kChannelsDataBlock;
362 else if (blocks[n].fDataType == AliHLTMUONConstants::MansoTracksBlockDataType())
364 blockType = kMansoTracksDataBlock;
366 else if (blocks[n].fDataType == AliHLTMUONConstants::MansoCandidatesBlockDataType())
368 blockType = kMansoCandidatesDataBlock;
370 else if (blocks[n].fDataType == AliHLTMUONConstants::SinglesDecisionBlockDataType())
372 blockType = kSinglesDecisionDataBlock;
374 else if (blocks[n].fDataType == AliHLTMUONConstants::PairsDecisionBlockDataType())
376 blockType = kPairsDecisionDataBlock;
380 // Log a message indicating that we got a data block that we
381 // do not know how to handle.
382 if (fWarnForUnexpecedBlock)
383 HLTWarning("Received a data block of a type we cannot"
384 " handle: '%s', spec: 0x%8.8X",
385 DataType2Text(blocks[n].fDataType).c_str(),
386 blocks[n].fSpecification
389 HLTDebug("Received a data block of a type we cannot"
390 " handle: '%s', spec: 0x%8.8X",
391 DataType2Text(blocks[n].fDataType).c_str(),
392 blocks[n].fSpecification
399 case kTriggerRecordsDataBlock:
400 blockOk[n] = CheckTriggerRecordsBlock(blocks[n], n);
401 trigRecBlocks[trigRecBlocksCount++] = &blocks[n];
403 case kTrigRecsDebugDataBlock:
404 blockOk[n] = CheckTrigRecsDebugBlock(blocks[n], n);
405 trigRecDebugBlocks[trigRecDebugBlocksCount++] = &blocks[n];
407 case kRecHitsDataBlock:
408 blockOk[n] = CheckRecHitsBlock(blocks[n], n);
409 hitBlocks[hitBlocksCount++] = &blocks[n];
411 case kClustersDataBlock:
412 blockOk[n] = CheckClustersBlock(blocks[n], n);
413 clusterBlocks[clusterBlocksCount++] = &blocks[n];
415 case kChannelsDataBlock:
416 blockOk[n] = CheckChannelsBlock(blocks[n], n);
417 channelBlocks[channelBlocksCount++] = &blocks[n];
419 case kMansoTracksDataBlock:
420 blockOk[n] = CheckMansoTracksBlock(blocks[n], n);
421 mansoTrackBlocks[mansoTrackBlocksCount++] = &blocks[n];
423 case kMansoCandidatesDataBlock:
424 blockOk[n] = CheckMansoCandidatesBlock(blocks[n], n);
425 mansoCandidateBlocks[mansoCandidateBlocksCount++] = &blocks[n];
427 case kSinglesDecisionDataBlock:
428 blockOk[n] = CheckSinglesDecisionBlock(blocks[n], n);
429 singleDecisionBlocks[singleDecisionBlocksCount++] = &blocks[n];
431 case kPairsDecisionDataBlock:
432 blockOk[n] = CheckPairsDecisionBlock(blocks[n], n);
433 pairDecisionBlocks[pairDecisionBlocksCount++] = &blocks[n];
436 HLTDebug("Received a data block for which we could not decode the data type."
437 " fDataType = '%s', fSpecification = 0x%8.8X, fSize = %u bytes.",
438 DataType2Text(blocks[n].fDataType).c_str(),
439 blocks[n].fSpecification,
446 // Apply the global data consistancy checks if not suppressed by the user.
447 if (not fNoGlobalChecks)
450 blocks, blockOk, evtData.fBlockCnt,
451 trigRecBlocks, trigRecBlocksCount,
452 trigRecDebugBlocks, trigRecDebugBlocksCount,
453 hitBlocks, hitBlocksCount,
454 clusterBlocks, clusterBlocksCount,
455 channelBlocks, channelBlocksCount,
456 mansoTrackBlocks, mansoTrackBlocksCount,
457 mansoCandidateBlocks, mansoCandidateBlocksCount,
458 singleDecisionBlocks, singleDecisionBlocksCount,
459 pairDecisionBlocks, pairDecisionBlocksCount
463 // Forward the input data blocks if we have not been asked to drop them.
464 // Also remember to filter for bad blocks if so specified.
465 if (not fDontForward)
467 for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
469 if (fFilterBadBlocks and blockOk[n]) continue;
470 outputBlocks.push_back(blocks[n]);
474 // Set dataProblems flag is there was at least one block with problems.
475 for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
477 if (not blockOk[n]) dataProblems = true;
482 // make sure to cleanup memory
484 delete [] trigRecBlocks;
485 delete [] trigRecDebugBlocks;
487 delete [] clusterBlocks;
488 delete [] channelBlocks;
489 delete [] mansoTrackBlocks;
490 delete [] mansoCandidateBlocks;
491 delete [] singleDecisionBlocks;
492 delete [] pairDecisionBlocks;
495 // Finally we set the total size of output memory we consumed, which is
496 // zero since we just copied the input descriptors to output if anything.
501 // If we were requested to return errors if there were integrity
502 // problems then check if any data blocks had problems and return
504 if (dataProblems) return -EFAULT;
510 bool AliHLTMUONDataCheckerComponent::IsSpecificationValid(
511 const AliHLTComponentBlockData& block,
512 AliHLTUInt32_t blockNumber,
516 /// Checks if the specification bits are valid.
517 /// \param block The block whose specification should be checked.
518 /// \param blockNumber The block index number being checked.
519 /// \param name The name of the type of block being checked.
520 /// \returns true if the specification is valid and false otherwise.
522 if (AliHLTMUONUtils::IsSpecValid(block.fSpecification))
525 HLTError("Problem found with data block %d, fDataType = '%s',"
526 " fPtr = %p and fSize = %u bytes."
527 " Assuming this is a %s data block."
528 " Problem: The specification does not contain a valid pattern,"
529 " received 0x%8.8X for the specification.",
531 DataType2Text(block.fDataType).c_str(),
541 bool AliHLTMUONDataCheckerComponent::IsFromTrackerOnly(
542 const AliHLTComponentBlockData& block,
543 AliHLTUInt32_t blockNumber,
547 /// Checks if the specification bits are valid and indicate the block
548 /// contains data or information only from the tracker DDLs.
549 /// \param block The block whose specification should be checked.
550 /// \param blockNumber The block index number being checked.
551 /// \param name The name of the type of block being checked.
552 /// \returns true if the specification indicates data is only from tracker.
554 bool result = IsSpecificationValid(block, blockNumber, name);
556 if (AliHLTMUONUtils::ContainsDataFromTracker(block.fSpecification) and
557 not AliHLTMUONUtils::ContainsDataFromTrigger(block.fSpecification)
563 HLTError("Problem found with data block %d, fDataType = '%s',"
564 " fPtr = %p and fSize = %u bytes."
565 " Assuming this is a %s data block."
566 " Problem: The data block does not contain data only from the"
567 " tracker DDLs as expected."
568 " Received 0x%8.8X for the specification.",
570 DataType2Text(block.fDataType).c_str(),
580 bool AliHLTMUONDataCheckerComponent::IsFromTriggerOnly(
581 const AliHLTComponentBlockData& block,
582 AliHLTUInt32_t blockNumber,
586 /// Checks if the specification bits are valid and indicate the block
587 /// contains data or information only from the trigger DDLs.
588 /// \param block The block whose specification should be checked.
589 /// \param blockNumber The block index number being checked.
590 /// \param name The name of the type of block being checked.
591 /// \returns true if the specification indicates data is only from trigger.
593 bool result = IsSpecificationValid(block, blockNumber, name);
595 if (AliHLTMUONUtils::ContainsDataFromTrigger(block.fSpecification) and
596 not AliHLTMUONUtils::ContainsDataFromTracker(block.fSpecification)
602 HLTError("Problem found with data block %d, fDataType = '%s',"
603 " fPtr = %p and fSize = %u bytes."
604 " Assuming this is a %s data block."
605 " Problem: The data block does not contain data only from the"
606 " trigger DDLs as expected."
607 " Received 0x%8.8X for the specification.",
609 DataType2Text(block.fDataType).c_str(),
619 bool AliHLTMUONDataCheckerComponent::IsMomentumVectorOk(
620 const AliHLTComponentBlockData& block,
621 AliHLTUInt32_t blockNumber,
623 AliHLTUInt32_t entryNumber,
629 /// Checks if the momentum vector is reasonable.
630 /// \param block The block from which the momentum vector data comes from.
631 /// \param blockNumber The block index number.
632 /// \param name The name of the type of block.
633 /// \param entryNumber The entry index number of the structure holding
634 /// the momentum vector data.
635 /// \param px The X coordinate of the momentum vector (GeV/c).
636 /// \param py The Y coordinate of the momentum vector (GeV/c).
637 /// \param pz The Z coordinate of the momentum vector (GeV/c).
638 /// \returns true if the momentum vector is valid and false otherwise.
640 // If the momentum vector is nil then ignore it.
641 if (px == 0 and py == 0 and pz == 0) return true;
645 // If the momentum vector is sane then we should not have a particle with
646 // more energy than 14 TeV and momentum should be in the negative direction.
647 double momentum = sqrt(px*px + py*py + pz*pz);
650 // Just warn since this is a data sanity problem rather
651 // than a data integrity problem.
652 HLTWarning("Problem found with data block %d, fDataType = '%s',"
653 " fPtr = %p and fSize = %u bytes."
654 " Assuming this is a %s data block."
655 " Problem with entry %d in block: The momentum vector"
656 " p = {%f, %f, %f}, |p| = %f looks too big.",
658 DataType2Text(block.fDataType).c_str(),
671 // Just warn since this is a data sanity problem rather
672 // than a data integrity problem.
673 HLTWarning("Problem found with data block %d, fDataType = '%s',"
674 " fPtr = %p and fSize = %u bytes."
675 " Assuming this is a %s data block."
676 " Problem with entry %d in block: The momentum vector"
677 " p = {%f, %f, %f} points away from the dimuon"
678 " spectrometer (p_z > 0).",
680 DataType2Text(block.fDataType).c_str(),
694 bool AliHLTMUONDataCheckerComponent::AreMomentumCalcParamsOk(
695 const AliHLTComponentBlockData& block,
696 AliHLTUInt32_t blockNumber,
698 AliHLTUInt32_t entryNumber,
699 AliHLTFloat32_t zmiddle,
703 /// Checks if the parameters for the momentum calculation are reasonable.
704 /// \param block The block from which the parameter data comes from.
705 /// \param blockNumber The block index number.
706 /// \param name The name of the type of block.
707 /// \param entryNumber The entry index number of the structure holding
708 /// the parameter data data.
709 /// \param zmiddle The z-coordinate of the middle of the magnetic field (cm).
710 /// \param bl The integrated magnetic field (T.m).
711 /// \returns true if the parameters are valid and false otherwise.
715 // Check that the value of the fZmiddle value is somewhere
716 // within the tracking / dipole magnetic field area.
717 if (zmiddle < AliMUONConstants::AbsZEnd() or
718 zmiddle < AliMUONConstants::MuonFilterZBeg()
721 // Just warn since this is a data sanity problem rather
722 // than a data integrity problem.
723 HLTWarning("Problem found with data block %d, fDataType = '%s',"
724 " fPtr = %p and fSize = %u bytes."
725 " Assuming this is a %s data block."
726 " Problem with entry %d in block: The Z coordinate %f cm"
727 " used as the middle of the magnetic field in the momentum"
728 " calculation is outside the dimuon spectrometers dipole"
729 " magnetic field volume.",
731 DataType2Text(block.fDataType).c_str(),
741 // Also check that the value of the 'bl' value is within a
742 // reasonable range: |bl| < Lmax * Bmax, where
743 // Lmax = max length from vertex to end of spectrometer, and
744 // Bmax = max magnetic field of dipole, taken as 1 tesla.
745 // Approximating Lmax * Bmax as 20 T.m
748 // Just warn since this is a data sanity problem rather
749 // than a data integrity problem.
750 HLTWarning("Problem found with data block %d, fDataType = '%s',"
751 " fPtr = %p and fSize = %u bytes."
752 " Assuming this is a %s data block."
753 " Problem with entry %d in block: The integrated magnetic"
754 " field value %f T.m used in the momentum calculation"
755 " has an unreasonably large absolute value.",
757 DataType2Text(block.fDataType).c_str(),
771 bool AliHLTMUONDataCheckerComponent::IsHitCoordinateOk(
772 const AliHLTComponentBlockData& block,
773 AliHLTUInt32_t blockNumber,
775 AliHLTUInt32_t entryNumber,
776 const AliHLTMUONRecHitStruct& hit,
777 AliHLTInt32_t minChamber,
778 AliHLTInt32_t maxChamber,
779 AliHLTInt32_t expectedChamber,
783 /// Checks if the hit coordinate is compatible with a the location of a
784 /// dimuon spectrometer chamber. Also, if expectedChamber is not -1, then
785 /// the hit coordinate is checked if to comes from that chamber.
786 /// We also check if the fFlags containing the chamber number and detector
787 /// element ID are correct.
788 /// \param block The block from which the hit data comes from.
789 /// \param blockNumber The block index number.
790 /// \param name The name of the type of block.
791 /// \param entryNumber The entry index number of the hit.
792 /// \param hit The hit data being checked.
793 /// \param minChamber The minimum valid chamber number to check for.
794 /// \param maxChamber The maximum valid chamber number to check for.
795 /// \param expectedChamber If not -1 then this is the chamber number to
797 /// \param ddl The array decoded by AliHLTMUONUtils::UnpackSpecBits.
798 /// \returns true if the hit is valid and false otherwise.
800 assert( 0 <= minChamber and minChamber < 14 );
801 assert( 0 <= maxChamber and maxChamber < 14 );
805 AliHLTUInt8_t chNum = 0xFF;
806 AliHLTUInt16_t detElemId = 0xFFFF;
807 AliHLTMUONUtils::UnpackRecHitFlags(hit.fFlags, chNum, detElemId);
809 Int_t chamber = AliMUONConstants::ChamberNumber(hit.fZ, false); // false = do not warn.
810 if (chamber < minChamber or maxChamber < chamber)
812 HLTError("Problem found with data block %d, fDataType = '%s',"
813 " fPtr = %p and fSize = %u bytes."
814 " Assuming this is a %s data block."
815 " Problem with entry %d in block: The hit {x = %f, y = %f,"
816 " z = %f} cm has a z-coordinate that does not correspond"
817 " to the nominal position of any chambers in the range"
820 DataType2Text(block.fDataType).c_str(),
825 hit.fX, hit.fY, hit.fZ,
832 if (chNum != chamber)
834 HLTError("Problem found with data block %d, fDataType = '%s',"
835 " fPtr = %p and fSize = %u bytes."
836 " Assuming this is a %s data block."
837 " Problem with entry %d in block: The hit {x = %f, y = %f,"
838 " z = %f} cm has a chamber number %d that does not correspond"
839 " to the expected chamber %d given by the z-coordinate.",
841 DataType2Text(block.fDataType).c_str(),
846 hit.fX, hit.fY, hit.fZ,
851 if (Int_t(chNum) < minChamber or maxChamber < Int_t(chNum))
853 // Rather use the explicit value in the data if it
859 if (expectedChamber != -1 and chamber != expectedChamber)
861 HLTError("Problem found with data block %d, fDataType = '%s',"
862 " fPtr = %p and fSize = %u bytes."
863 " Assuming this is a %s data block."
864 " Problem with entry %d in block: The hit {x = %f, y = %f,"
865 " z = %f} cm has a position that corresponds to chamber %d,"
866 " but expected it to be on chamber %d.",
868 DataType2Text(block.fDataType).c_str(),
873 hit.fX, hit.fY, hit.fZ,
880 AliHLTFloat32_t rmin = AliMUONConstants::Rmin(chamber / 2);
881 AliHLTFloat32_t rmax = AliMUONConstants::Rmax(chamber / 2);
882 AliHLTFloat32_t radius = sqrt(hit.fX*hit.fX + hit.fY*hit.fY);
883 if (radius < rmin or rmax < radius)
885 HLTError("Problem found with data block %d, fDataType = '%s',"
886 " fPtr = %p and fSize = %u bytes."
887 " Assuming this is a %s data block."
888 " Problem with entry %d in block: The hit {x = %f, y = %f,"
889 " z = %f} cm has a position in the X-Y plane that does not"
890 " correspond to the nominal position of chamber %d.",
892 DataType2Text(block.fDataType).c_str(),
897 hit.fX, hit.fY, hit.fZ,
903 if (not fIgnoreSpec and not ChamberMarkedInDDLList(chamber, ddl))
905 HLTError("Problem found with data block %d, fDataType = '%s',"
906 " fPtr = %p and fSize = %u bytes."
907 " Assuming this is a %s data block."
908 " Problem with entry %d in block: The hit {x = %f, y = %f,"
909 " z = %f} cm has a position that corresponds to chamber %d"
910 " but the data block specification 0x%8.8X does have a"
911 " corresponding DDL bit set.",
913 DataType2Text(block.fDataType).c_str(),
918 hit.fX, hit.fY, hit.fZ,
925 // Check that the detector element ID is valid and it corresponds to
926 // the chamber number.
927 if (FetchMappingStores() == 0) // are stores loaded?
929 Bool_t warn = kFALSE;
930 AliMpDEStore* store = AliMpDEStore::Instance(warn);
931 AliMpDetElement* de = store->GetDetElement(Int_t(detElemId), warn);
934 HLTError("Problem found with data block %d, fDataType = '%s',"
935 " fPtr = %p and fSize = %u bytes."
936 " Assuming this is a %s data block."
937 " Problem with entry %d in block: The hit {x = %f, y = %f,"
938 " z = %f} cm has a detector element ID %d,"
939 " which is not valid.",
941 DataType2Text(block.fDataType).c_str(),
946 hit.fX, hit.fY, hit.fZ,
952 // Check that the chamber number from the detector element number
953 // has the expected value.
954 Int_t ch = AliMpDEManager::GetChamberId(Int_t(detElemId), warn);
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 detector element ID %d,"
962 " which does not correspond to the chamber %d.",
964 DataType2Text(block.fDataType).c_str(),
969 hit.fX, hit.fY, hit.fZ,
977 HLTWarning("Cannot check a hit's detector element ID information"
978 " without being able to load the mapping from CDB."
987 bool AliHLTMUONDataCheckerComponent::IsMansoTrackOk(
988 const AliHLTComponentBlockData& block,
989 AliHLTUInt32_t blockNumber,
991 AliHLTUInt32_t entryNumber,
992 const AliHLTMUONMansoTrackStruct& track,
996 /// Checks if the Manso track structure is Ok.
997 /// \param block The block from which the track data comes from.
998 /// \param blockNumber The block index number.
999 /// \param name The name of the type of block.
1000 /// \param entryNumber The entry index number of the structure in the
1001 /// block being checked.
1002 /// \param track The Manso track data being checked.
1003 /// \param ddl The array decoded by AliHLTMUONUtils::UnpackSpecBits.
1004 /// \returns true if the hit is valid and false otherwise.
1008 // Chi^2 should not be greater than the worst fit possible, estimated
1009 // as the diameter of largest chamber times the number of points
1010 // findable in a track. Max points is 10 tracker chambers times
1011 // 2 cathodes + 4 trigger chambers.
1012 if (track.fChi2 > AliMUONConstants::Dmax(6)*AliMUONConstants::Dmax(6)*(10*2+4))
1014 // Just a warning since this is not technically an
1015 // integrity problem.
1016 HLTWarning("Problem found with data block %d, fDataType = '%s',"
1017 " fPtr = %p and fSize = %u bytes."
1018 " Assuming this is a %s data block."
1019 " Problem with entry %d in block: The Manso track has"
1020 " the chi squared value of %f that unreasonably big.",
1022 DataType2Text(block.fDataType).c_str(),
1032 // Check if the momentum vector is reasonable.
1033 bool momOk = IsMomentumVectorOk(
1034 block, blockNumber, name, entryNumber,
1035 track.fPx, track.fPy, track.fPz
1037 if (not momOk) result = false;
1039 AliHLTMUONParticleSign sign;
1041 AliHLTMUONUtils::UnpackMansoTrackFlags(track.fFlags, sign, hitset);
1043 // Min and max allowed chamber numbers for hits:
1045 Int_t maxCh = AliMUONConstants::NTrackingCh() - 1;
1047 // Check that this hit coordinates are OK.
1048 for (AliHLTUInt32_t i = 0; i < 4; i++)
1050 if (not hitset[i]) continue; // ignore hits that are not initialised.
1051 bool hitOk = IsHitCoordinateOk(
1052 block, blockNumber, name, entryNumber, track.fHit[i],
1053 minCh, maxCh, i+6, ddl
1055 if (not hitOk) result = false;
1062 bool AliHLTMUONDataCheckerComponent::CheckDetElemIds(
1063 const AliHLTComponentBlockData& infoBlock,
1064 AliHLTUInt32_t infoBlockNumber,
1065 AliHLTUInt32_t infoEntryNumber,
1066 const AliHLTMUONTrigRecInfoStruct& info,
1067 const AliHLTComponentBlockData& trBlock,
1068 AliHLTUInt32_t trBlockNumber,
1069 AliHLTUInt32_t trEntryNumber,
1070 const AliHLTMUONTriggerRecordStruct& tr
1073 /// Checks if the detector element IDs are the same in the debug
1074 /// information structure and the trigger record structure.
1075 /// \param infoBlock The debug information block from which the 'info'
1076 /// data comes from.
1077 /// \param infoBlockNumber The debug information block index number.
1078 /// \param infoEntryNumber The entry index number of the 'info'
1079 /// structure in the debug information data block.
1080 /// \param info The debug information structure being checked.
1081 /// \param trBlock The trigger record block from which the 'tr' data
1083 /// \param trBlockNumber The trigger record block index number.
1084 /// \param trEntryNumber The entry index number of the 'tr' structure
1085 /// in the trigger record data block.
1086 /// \param tr The trigger record structure being checked.
1087 /// \returns true if the detector element IDs are the same and false
1092 for (int i = 0; i < 4; i++)
1094 AliHLTUInt8_t chamber = 0xFF;
1095 AliHLTUInt16_t detElemId = 0xFFFF;
1096 AliHLTMUONUtils::UnpackRecHitFlags(tr.fHit[i].fFlags, chamber, detElemId);
1097 if (info.fDetElemId[i] == detElemId) continue;
1099 HLTError("Problem found with trigger record debug information %d"
1100 " in data block %d (fDataType = '%s', fPtr = %p, fSize"
1101 " = %u bytes) and trigger record %d in data block %d"
1102 " (fDataType = '%s', fPtr = %p, fSize = %u bytes):"
1103 " The detection element ID %d for chamber %d in the debug"
1104 " information, is not the same as %d"
1105 " found in the trigger record.",
1108 DataType2Text(infoBlock.fDataType).c_str(),
1113 DataType2Text(trBlock.fDataType).c_str(),
1127 bool AliHLTMUONDataCheckerComponent::CheckDetElemIds(
1128 const AliHLTComponentBlockData& clusterBlock,
1129 AliHLTUInt32_t clusterBlockNumber,
1130 AliHLTUInt32_t clusterEntryNumber,
1131 const AliHLTMUONClusterStruct& cluster,
1132 const AliHLTComponentBlockData& hitBlock,
1133 AliHLTUInt32_t hitBlockNumber,
1134 AliHLTUInt32_t hitEntryNumber,
1135 const AliHLTMUONRecHitStruct& hit
1138 /// Checks if the detector element IDs are the same in the cluster
1139 /// structure and the reconstructed hit structure.
1140 /// \param clusterBlock The cluster block from which the 'cluster' data
1142 /// \param clusterBlockNumber The cluster block index number.
1143 /// \param clusterEntryNumber The entry index number of the 'cluster'
1144 /// structure in the cluster data block.
1145 /// \param cluster The cluster structure being checked.
1146 /// \param hitBlock The reconstructed hit block from which the 'hit'
1147 /// data comes from.
1148 /// \param hitBlockNumber The reconstructed hit block index number.
1149 /// \param hitEntryNumber The entry index number of the 'hit' structure
1150 /// in the reconstructed hit data block.
1151 /// \param hit The trigger record structure being checked.
1152 /// \returns true if the detector element IDs are the same and false
1157 AliHLTUInt8_t chamber = 0xFF;
1158 AliHLTUInt16_t detElemId = 0xFFFF;
1159 AliHLTMUONUtils::UnpackRecHitFlags(hit.fFlags, chamber, detElemId);
1160 if (cluster.fDetElemId != detElemId)
1162 HLTError("Problem found with cluster %d in data block %d"
1163 " (fDataType = '%s', fPtr = %p, fSize = %u bytes)"
1164 " and reconstructed hit %d in data block %d"
1165 " (fDataType = '%s', fPtr = %p, fSize = %u bytes):"
1166 " The detection element ID %d in the cluster, is not"
1167 " the same as %d found in the reconstructed hit.",
1170 DataType2Text(clusterBlock.fDataType).c_str(),
1175 DataType2Text(hitBlock.fDataType).c_str(),
1191 * Class for logging errors found in raw DDL data.
1193 class AliHLTMUONDecoderHandler : public AliHLTLogging
1197 /// Default constructor
1198 AliHLTMUONDecoderHandler() :
1206 /// Default destructor.
1207 virtual ~AliHLTMUONDecoderHandler() {}
1209 /// Sets the DDL raw data block descriptor.
1210 void SetDescriptor(const AliHLTComponentBlockData* b) { fDescriptor = b; }
1212 /// Sets the block number of the raw data block descriptor.
1213 void SetBlockNumber(AliHLTUInt32_t n) { fBlockNumber = n; }
1215 /// Logs an error message describing the problem with the DDL raw data.
1216 template <typename ErrorCode, class DecoderHandler>
1217 void LogError(ErrorCode code, const void* location, DecoderHandler& handler);
1220 // Do not allow copying of this class.
1222 AliHLTMUONDecoderHandler(const AliHLTMUONDecoderHandler& rhs); // copy constructor
1224 AliHLTMUONDecoderHandler& operator = (const AliHLTMUONDecoderHandler& rhs); // assignment operator
1226 const void* fBufferStart; ///< Pointer to the start of the current DDL payload buffer.
1227 const AliHLTComponentBlockData* fDescriptor; ///< Descriptor for the DDL raw data block corresponding to the buffer.
1228 AliHLTUInt32_t fBlockNumber; ///< The number / index of the block descriptor.
1232 template <typename ErrorCode, class DecoderHandler>
1233 void AliHLTMUONDecoderHandler::LogError(ErrorCode code, const void* location, DecoderHandler& handler)
1235 /// Logs a HLT error message describing the problem with the raw DDL data.
1236 /// \param code The error code describing the problem.
1237 /// \param location A pointer to the location in the raw data buffer
1238 /// where the problem was found.
1239 /// \param handler The decoder handler object.
1241 long bytepos = long(location) - long(fBufferStart) + sizeof(AliRawDataHeader);
1243 // create data type string.
1244 char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2];
1245 memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
1246 strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize );
1247 strcat( dataType, ":" );
1248 strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize );
1250 HLTError("Problem found with data block %d, fDataType = '%s',"
1251 " fPtr = %p and fSize = %u bytes."
1252 " Assuming this is a DDL raw data block."
1253 " Problem: %s (Error code: %d, at byte %d)",
1258 handler.ErrorCodeToMessage(code),
1266 * Class for logging decoding errors when checking tracker raw DDL data.
1267 * Used in the AliHLTMUONDataCheckerComponent::CheckRawDataBlock method.
1269 class AliHLTMUONTrackerDecoderHandler :
1270 public AliMUONTrackerDDLDecoderEventHandler, public AliHLTMUONDecoderHandler
1273 AliHLTMUONTrackerDecoderHandler() :
1274 AliMUONTrackerDDLDecoderEventHandler(),
1275 AliHLTMUONDecoderHandler(),
1279 fCurrentBusPatch(0),
1280 fDataProblems(false)
1283 virtual ~AliHLTMUONTrackerDecoderHandler()
1285 if (fDigits != NULL) delete [] fDigits;
1288 /// Structure to store raw data words found in the raw data.
1291 UInt_t fBusPatchId; ///< Bus patch ID for the data word.
1292 UInt_t fDataWord; ///< Raw data word found in the DDL payload.
1295 /// Returns the number of digits found.
1296 UInt_t DigitCount() const { return fDigitCount; }
1298 /// Returns the array of digits found.
1299 const AliDigit* Digits() const { return fDigits; }
1301 /// Returns true if there were problems with the data.
1302 bool DataProblems() const { return fDataProblems; }
1304 // Methods inherited from AliMUONTrackerDDLDecoderEventHandler:
1306 /// Called for each new buffer.
1307 void OnNewBuffer(const void* buffer, UInt_t bufferSize);
1309 /// Called for each new DSP header.
1310 void OnNewDSP(const AliMUONDSPHeaderStruct* header, const void* /*data*/);
1312 /// Called for each new bus patch. Just marks the current bus patch ID.
1313 void OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* /*data*/)
1315 fCurrentBusPatch = header->fBusPatchId;
1318 /// Called for each new data word found.
1319 void OnData(UInt_t data, bool /*parityError*/);
1321 /// Logs an error message if there was a decoding problem with the DDL payload.
1322 void OnError(ErrorCode code, const void* location)
1324 fDataProblems = true;
1325 LogError(code, location, *this);
1330 // Do not allow copying of this object.
1331 /// Not implemented.
1332 AliHLTMUONTrackerDecoderHandler(const AliHLTMUONTrackerDecoderHandler& obj);
1333 /// Not implemented.
1334 AliHLTMUONTrackerDecoderHandler& operator = (const AliHLTMUONTrackerDecoderHandler& obj);
1336 UInt_t fMaxDigits; ///< Maximum number of digits that can be stored in fDigits.
1337 UInt_t fDigitCount; ///< The number of digits currently stored in fDigits.
1338 AliDigit* fDigits; ///< The array of digits found in the DDL data.
1339 UInt_t fCurrentBusPatch; ///< The current bus patch ID being processed.
1340 bool fDataProblems; ///< flag indicating there were problems with the data.
1344 void AliHLTMUONTrackerDecoderHandler::OnNewBuffer(const void* buffer, UInt_t bufferSize)
1346 /// Called for a new buffer. It will reset internal counters and
1347 /// resize the digits array if necessary.
1349 fDataProblems = false;
1351 fBufferStart = buffer;
1353 // Resize the fDigits array to be able to store
1354 // all the digits in the data buffer.
1355 UInt_t maxSize = bufferSize / sizeof(UInt_t) + 1;
1356 if (maxSize > fMaxDigits)
1358 if (fDigits != NULL)
1366 fDigits = new AliDigit[maxSize];
1367 fMaxDigits = maxSize;
1369 catch (const std::bad_alloc&)
1371 HLTError("Could not allocate enough buffer space for internal arrays.");
1378 void AliHLTMUONTrackerDecoderHandler::OnNewDSP(
1379 const AliMUONDSPHeaderStruct* header, const void* /*data*/
1382 if (header->fPaddingWord != 0 and header->fPaddingWord != 1)
1384 // create data type string.
1385 char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2];
1386 memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
1387 strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize );
1388 strcat( dataType, ":" );
1389 strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize );
1391 HLTError("Problem found with data block %d, fDataType = '%s',"
1392 " fPtr = %p and fSize = %u bytes."
1393 " Assuming this is a tracker DDL raw data block."
1394 " Problem: Found padding word marker 0x%8.8X in DSP"
1395 " header with DSP ID %d which has an invalid value.",
1400 header->fPaddingWord,
1403 fDataProblems = true;
1409 void AliHLTMUONTrackerDecoderHandler::OnData(UInt_t data, bool /*parityError*/)
1411 /// Called for each new data word found. This method will add
1412 /// these to the list of digits and check if they are not duplicated.
1414 assert( fDigits != NULL );
1416 if ((data & 0x60000000) != 0)
1418 // create data type string.
1419 char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2];
1420 memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
1421 strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize );
1422 strcat( dataType, ":" );
1423 strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize );
1425 HLTError("Problem found with data block %d, fDataType = '%s',"
1426 " fPtr = %p and fSize = %u bytes."
1427 " Assuming this is a tracker DDL raw data block."
1428 " Problem: Found a data word 0x%8.8X for bus patch %d"
1429 " whose bits 29 or 30 are not zero.",
1437 fDataProblems = true;
1441 // Check if the data word + bus patch have been duplicated.
1442 for (UInt_t i = 0; i < fDigitCount; i++)
1444 if (fDigits[i].fDataWord == data and fDigits[i].fBusPatchId == fCurrentBusPatch)
1446 // create data type string.
1447 char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2];
1448 memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
1449 strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize );
1450 strcat( dataType, ":" );
1451 strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize );
1453 HLTError("Problem found with data block %d, fDataType = '%s',"
1454 " fPtr = %p and fSize = %u bytes."
1455 " Assuming this is a tracker DDL raw data block."
1456 " Problem: Found a duplicate data word 0x%8.8X for bus patch %d.",
1464 fDataProblems = true;
1469 // Add the data word + bus patch to the list of decoded digits.
1470 if (fDigitCount < fMaxDigits)
1472 fDigits[fDigitCount].fBusPatchId = fCurrentBusPatch;
1473 fDigits[fDigitCount].fDataWord = data;
1479 * Class for logging decoding errors when checking trigger raw DDL data.
1480 * Used in the AliHLTMUONDataCheckerComponent::CheckRawDataBlock method.
1482 class AliHLTMUONTriggerDecoderHandler :
1483 public AliMUONTriggerDDLDecoderEventHandler, public AliHLTMUONDecoderHandler
1486 // Methods inherited from AliMUONTriggerDDLDecoderEventHandler:
1488 /// Called for each new buffer.
1489 void OnNewBuffer(const void* buffer, UInt_t /*bufferSize*/)
1491 fBufferStart = buffer;
1494 /// Logs an error message if there was a decoding problem with the DDL payload.
1495 void OnError(ErrorCode code, const void* location)
1497 LogError(code, location, *this);
1501 } // end of namespace
1504 bool AliHLTMUONDataCheckerComponent::CheckRawDataBlock(
1505 const AliHLTComponentBlockData& block,
1506 AliHLTUInt32_t blockNumber
1509 /// Checks the validity of a raw data block.
1515 HLTWarning("Not able to check DDL raw data if -ignorespec is specified.");
1520 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
1522 // Check that only one DDL was marked in the specification.
1524 for (int i = 0; i < 22; i++)
1526 if (not ddl[i]) continue;
1534 HLTError("Problem found with data block %d, fDataType = '%s',"
1535 " fPtr = %p and fSize = %u bytes."
1536 " Assuming this is a DDL raw data block."
1537 " Problem: The specification indicates multiple"
1538 " DDL sources, DDL %d and %d.",
1540 DataType2Text(block.fDataType).c_str(),
1549 // Check the DDL common data header.
1550 AliHLTUInt32_t totalDDLSize = block.fSize;
1551 if (totalDDLSize < sizeof(AliRawDataHeader))
1553 HLTError("Problem found with data block %d, fDataType = '%s',"
1554 " fPtr = %p and fSize = %u bytes."
1555 " Assuming this is a DDL raw data block."
1556 " Problem: The size of the data block is too short to contain"
1557 " a valid common DDL data header. Size of buffer is only %d"
1558 " bytes, but expected at least %d bytes.",
1560 DataType2Text(block.fDataType).c_str(),
1564 sizeof(AliRawDataHeader)
1569 const AliRawDataHeader* header =
1570 reinterpret_cast<const AliRawDataHeader*>(block.fPtr);
1572 if (header->GetVersion() != 2)
1574 HLTError("Problem found with data block %d, fDataType = '%s',"
1575 " fPtr = %p and fSize = %u bytes."
1576 " Assuming this is a DDL raw data block."
1577 " Problem: The common DDL data header indicates an"
1578 " incorrect version number. Expected 2 but got %d.",
1580 DataType2Text(block.fDataType).c_str(),
1583 int( header->GetVersion() )
1588 if (header->fSize != 0xFFFFFFFF and header->fSize != block.fSize)
1590 HLTError("Problem found with data block %d, fDataType = '%s',"
1591 " fPtr = %p and fSize = %u bytes."
1592 " Assuming this is a DDL raw data block."
1593 " Problem: The common DDL data header indicates an"
1594 " incorrect DDL buffer size. Expected %d bytes but"
1595 " size reported in header is %d bytes.",
1597 DataType2Text(block.fDataType).c_str(),
1606 if (header->fSize != 0xFFFFFFFF and header->fSize != block.fSize)
1608 HLTError("Problem found with data block %d, fDataType = '%s',"
1609 " fPtr = %p and fSize = %u bytes."
1610 " Assuming this is a DDL raw data block."
1611 " Problem: The common DDL data header indicates an"
1612 " incorrect DDL buffer size. Expected %d bytes but"
1613 " size reported in header is %d bytes.",
1615 DataType2Text(block.fDataType).c_str(),
1624 // Check that the bits that should be zero in the CDH are infact zero.
1625 if ((header->fWord2 & 0x00C03000) != 0 or
1626 (header->fEventID2 & 0xFF000000) != 0 or
1627 (header->fStatusMiniEventID & 0xF0000000) != 0 or
1628 (header->fROILowTriggerClassHigh & 0x0FFC0000) != 0
1631 HLTError("Problem found with data block %d, fDataType = '%s',"
1632 " fPtr = %p and fSize = %u bytes."
1633 " Assuming this is a DDL raw data block."
1634 " Problem: The common DDL data header has non-zero"
1635 " bits that are reserved and must be set to zero.",
1637 DataType2Text(block.fDataType).c_str(),
1644 AliHLTUInt32_t payloadSize = block.fSize - sizeof(AliRawDataHeader);
1645 const AliHLTUInt8_t* payload =
1646 reinterpret_cast<const AliHLTUInt8_t*>(header + 1);
1648 if (AliHLTMUONUtils::IsTriggerDDL(block.fSpecification))
1650 bool scalarEvent = ((header->GetL1TriggerMessage() & 0x1) == 0x1);
1651 AliMUONTriggerDDLDecoder<AliHLTMUONTriggerDecoderHandler> decoder;
1652 decoder.ExitOnError(false);
1653 decoder.TryRecover(false);
1654 decoder.AutoDetectScalars(false);
1655 decoder.GetHandler().SetDescriptor(&block);
1656 decoder.GetHandler().SetBlockNumber(blockNumber);
1657 result = decoder.Decode(payload, payloadSize, scalarEvent);
1659 else if (AliHLTMUONUtils::IsTrackerDDL(block.fSpecification))
1661 AliMUONTrackerDDLDecoder<AliHLTMUONTrackerDecoderHandler> decoder;
1662 decoder.ExitOnError(false);
1663 decoder.TryRecover(false);
1664 decoder.SendDataOnParityError(true);
1665 decoder.AutoDetectTrailer(true);
1666 decoder.CheckForTrailer(true);
1667 decoder.GetHandler().SetDescriptor(&block);
1668 decoder.GetHandler().SetBlockNumber(blockNumber);
1669 result = decoder.Decode(payload, payloadSize);
1670 if (decoder.GetHandler().DataProblems()) result = false;
1672 if (FetchMappingStores() == 0) // are stores loaded?
1674 Bool_t warn = kFALSE;
1675 AliMpDDLStore* ddlStore = AliMpDDLStore::Instance(warn);
1677 // Check that the bus patch, manu ID and channel addresses are valid
1678 // for each raw data word.
1679 for (UInt_t i = 0; i < decoder.GetHandler().DigitCount(); i++)
1681 UInt_t busPatchId = decoder.GetHandler().Digits()[i].fBusPatchId;
1682 UInt_t dataWord = decoder.GetHandler().Digits()[i].fDataWord;
1684 UShort_t manuId; UChar_t channelId; UShort_t adc;
1685 AliMUONTrackerDDLDecoderEventHandler::UnpackADC(
1686 dataWord, manuId, channelId, adc
1689 // Check if the bus patch is valid.
1690 AliMpBusPatch* busPatch = ddlStore->GetBusPatch(busPatchId, warn);
1691 if (busPatch == NULL)
1693 HLTError("Problem found with data block %d, fDataType = '%s',"
1694 " fPtr = %p and fSize = %u bytes."
1695 " Assuming this is a tracker DDL raw data block."
1696 " Problem: Found a bus patch identifier %d that"
1699 DataType2Text(block.fDataType).c_str(),
1708 // We can check that the bus patch is for the DDL
1709 // which is also indicated by the specification bits.
1710 if (not fIgnoreSpec and busPatch->GetDdlId() != ddlIndex)
1712 HLTError("Problem found with data block %d, fDataType = '%s',"
1713 " fPtr = %p and fSize = %u bytes."
1714 " Assuming this is a tracker DDL raw data block."
1715 " Problem: Found a bus patch identifier %d for"
1716 " DDL %d, but the data block specification 0x%8.8X"
1717 " indicates a different DDL of %d.",
1719 DataType2Text(block.fDataType).c_str(),
1723 busPatch->GetDdlId(),
1724 block.fSpecification,
1731 // Check if the MANU ID is valid.
1732 if (not busPatch->HasManu(manuId))
1734 HLTError("Problem found with data block %d, fDataType = '%s',"
1735 " fPtr = %p and fSize = %u bytes."
1736 " Assuming this is a tracker DDL raw data block."
1737 " Problem: Found a MANU identifier %d on bus patch %d"
1738 " that is not valid.",
1740 DataType2Text(block.fDataType).c_str(),
1750 // Now try to fetch the detector element to check the MANU channel.
1751 AliMpDetElement* de = ddlStore->GetDetElement(busPatch->GetDEId(), warn);
1754 HLTError("Problem found with data block %d, fDataType = '%s',"
1755 " fPtr = %p and fSize = %u bytes."
1756 " Assuming this is a tracker DDL raw data block."
1757 " Problem: Found a bus patch identifier %d that"
1758 " does not correspond to a detector element.",
1760 DataType2Text(block.fDataType).c_str(),
1769 if (not de->IsConnectedChannel(manuId, channelId))
1771 // Just a warning because this is marked not
1772 // to be an error in the AliMUONDigitMaker.
1773 HLTWarning("Problem found with data block %d, fDataType = '%s',"
1774 " fPtr = %p and fSize = %u bytes."
1775 " Assuming this is a tracker DDL raw data block."
1776 " Problem: Found a channel with address %d on"
1777 " MANU ID %d and bus patch %d that is not connected.",
1779 DataType2Text(block.fDataType).c_str(),
1790 // Need to also load the correct segmentation to check the channel.
1791 const AliMpVSegmentation* seg =
1792 AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(
1793 busPatch->GetDEId(), manuId
1797 HLTError("Could not load segmentation for detector element %d"
1799 busPatch->GetDEId(), manuId
1805 AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId, channelId), warn);
1806 if (not pad.IsValid())
1808 HLTError("Problem found with data block %d, fDataType = '%s',"
1809 " fPtr = %p and fSize = %u bytes."
1810 " Assuming this is a tracker DDL raw data block."
1811 " Problem: Found a channel with address %d on"
1812 " MANU ID %d and bus patch %d that is not valid.",
1814 DataType2Text(block.fDataType).c_str(),
1828 HLTWarning("Cannot check if the bus patch IDs, MANU ID and"
1829 " channel addresses for DDL raw data are valid without"
1830 " being able to load the mapping from CDB."
1837 HLTError("Problem found with data block %d, fDataType = '%s',"
1838 " fPtr = %p and fSize = %u bytes."
1839 " Assuming this is a DDL raw data block."
1840 " Problem: The specification does not contain a valid pattern,"
1841 " received 0x%8.8X for the specification.",
1843 DataType2Text(block.fDataType).c_str(),
1846 block.fSpecification
1855 bool AliHLTMUONDataCheckerComponent::CheckTriggerRecordsBlock(
1856 const AliHLTComponentBlockData& block,
1857 AliHLTUInt32_t blockNumber
1860 /// Checks the validity of a trigger records block.
1863 const char* name = "trigger records";
1865 if (not fIgnoreSpec)
1867 if (not IsFromTriggerOnly(block, blockNumber, name))
1871 AliHLTMUONTriggerRecordsBlockReader inblock(block.fPtr, block.fSize);
1872 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
1876 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
1878 // Min and max allowed chamber numbers for hits:
1879 Int_t minCh = AliMUONConstants::NCh() - AliMUONConstants::NTriggerCh();
1880 Int_t maxCh = AliMUONConstants::NCh() - 1;
1882 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
1884 // Check that each hit in each trigger record has a reasonable coordinate.
1885 AliHLTMUONParticleSign sign;
1887 AliHLTMUONUtils::UnpackTriggerRecordFlags(inblock[i].fFlags, sign, hitset);
1889 for (Int_t j = 0; j < 4; j++) // loop over 4 trigger chamber hits.
1891 if (not hitset[i]) continue; // ignore hits that are not initialised.
1892 bool hitOk = IsHitCoordinateOk(
1893 block, blockNumber, name, i, inblock[i].fHit[j],
1894 minCh, maxCh, j+10, ddl
1896 if (not hitOk) result = false;
1899 // We can also check the momentum vector.
1900 bool momOk = IsMomentumVectorOk(
1901 block, blockNumber, name, i,
1902 inblock[i].fPx, inblock[i].fPy, inblock[i].fPz
1904 if (not momOk) result = false;
1907 // Need to check that no entries have duplicated data but with a different
1909 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
1911 AliHLTMUONTriggerRecordStruct ti = inblock[i];
1913 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
1915 AliHLTMUONTriggerRecordStruct tj = inblock[j];
1920 HLTError("Problem found with data block %d, fDataType = '%s',"
1921 " fPtr = %p and fSize = %u bytes."
1922 " Assuming this is a %s data block."
1923 " Problem: The trigger records %d and %d contain the"
1924 " same data. The data might have been duplicated.",
1926 DataType2Text(block.fDataType).c_str(),
1941 bool AliHLTMUONDataCheckerComponent::CheckTrigRecsDebugBlock(
1942 const AliHLTComponentBlockData& block,
1943 AliHLTUInt32_t blockNumber
1946 /// Checks the validity of a trigger records debug block.
1949 const char* name = "trigger records debug information";
1951 if (not fIgnoreSpec)
1953 if (not IsFromTriggerOnly(block, blockNumber, name))
1957 AliHLTMUONTrigRecsDebugBlockReader inblock(block.fPtr, block.fSize);
1958 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
1962 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
1964 // Check that each detector element ID is valid and the corresponding DDL
1965 // bit is set in the data block specification.
1966 if (FetchMappingStores() == 0) // are stores loaded?
1968 Bool_t warn = kFALSE;
1969 AliMpDEStore* store = AliMpDEStore::Instance(warn);
1970 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
1971 for (AliHLTUInt32_t j = 0; j < 4; j++)
1973 const AliHLTMUONTrigRecInfoStruct& trig = inblock[i];
1974 AliMpDetElement* de = store->GetDetElement(trig.fDetElemId[j], warn);
1977 HLTError("Problem found with data block %d, fDataType = '%s',"
1978 " fPtr = %p and fSize = %u bytes."
1979 " Assuming this is a %s data block."
1980 " Problem: The detector element number %d on chamber"
1981 " %d for trigger record debug structure %d is not valid.",
1983 DataType2Text(block.fDataType).c_str(),
1995 // Check that the chamber number from the detector element number
1996 // has the expected value.
1997 Int_t chamber = AliMpDEManager::GetChamberId(trig.fDetElemId[j], warn);
1998 if (chamber != Int_t(j+10))
2000 HLTError("Problem found with data block %d, fDataType = '%s',"
2001 " fPtr = %p and fSize = %u bytes."
2002 " Assuming this is a %s data block."
2003 " Problem: The detector element number %d for trigger"
2004 " record debug structure %d, corresponds to chamber"
2005 " %d, but we expected a hit for chamber %d.",
2007 DataType2Text(block.fDataType).c_str(),
2019 if (fIgnoreSpec) continue;
2020 if (0 <= de->GetDdlId() and de->GetDdlId() < 22 and ddl[de->GetDdlId()])
2022 HLTError("Problem found with data block %d, fDataType = '%s',"
2023 " fPtr = %p and fSize = %u bytes."
2024 " Assuming this is a %s data block."
2025 " Problem: The detector element number %d for trigger"
2026 " record %d corresponds to DDL number %d, but the"
2027 " data block specification 0x%8.8X does not have the"
2028 " corresponding bit set.",
2030 DataType2Text(block.fDataType).c_str(),
2037 block.fSpecification
2045 HLTWarning("Cannot check trigger record debug information without"
2046 " being able to load the mapping from CDB."
2051 // Need to check that no entries have duplicated data but with a different
2053 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2055 AliHLTMUONTrigRecInfoStruct ti = inblock[i];
2057 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2059 AliHLTMUONTrigRecInfoStruct tj = inblock[j];
2060 tj.fTrigRecId = ti.fTrigRecId;
2064 HLTError("Problem found with data block %d, fDataType = '%s',"
2065 " fPtr = %p and fSize = %u bytes."
2066 " Assuming this is a %s data block."
2067 " Problem: The trigger record debug information"
2068 " structures %d and %d contain the same data."
2069 " The data might have been duplicated.",
2071 DataType2Text(block.fDataType).c_str(),
2081 // Can also check that the value of the fZmiddle and fBl.
2082 bool paramsOk = AreMomentumCalcParamsOk(
2083 block, blockNumber, name, i, ti.fZmiddle, ti.fBl
2085 if (not paramsOk) result = false;
2092 bool AliHLTMUONDataCheckerComponent::CheckRecHitsBlock(
2093 const AliHLTComponentBlockData& block,
2094 AliHLTUInt32_t blockNumber
2097 /// Checks the validity of a reconstructed hits block.
2100 const char* name = "reconstructed hits";
2102 if (not fIgnoreSpec)
2104 if (not IsFromTrackerOnly(block, blockNumber, name))
2108 AliHLTMUONRecHitsBlockReader inblock(block.fPtr, block.fSize);
2109 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2113 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2115 // Check that each hit has a reasonable coordinate.
2117 Int_t maxCh = AliMUONConstants::NTrackingCh() - 1;
2118 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2120 bool hitOk = IsHitCoordinateOk(
2121 block, blockNumber, name, i, inblock[i],
2122 minCh, maxCh, -1, ddl
2124 if (not hitOk) result = false;
2131 bool AliHLTMUONDataCheckerComponent::CheckClustersBlock(
2132 const AliHLTComponentBlockData& block,
2133 AliHLTUInt32_t blockNumber
2136 /// Checks the validity of a clusters block.
2139 const char* name = "clusters";
2141 if (not fIgnoreSpec)
2143 if (not IsFromTrackerOnly(block, blockNumber, name))
2147 AliHLTMUONClustersBlockReader inblock(block.fPtr, block.fSize);
2148 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2152 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2154 if (FetchMappingStores() == 0) // are stores loaded?
2156 Bool_t warn = kFALSE;
2157 AliMpDEStore* store = AliMpDEStore::Instance(warn);
2158 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2160 const AliHLTMUONClusterStruct& cluster = inblock[i];
2162 // Check that the detector element ID is valid.
2163 AliMpDetElement* de = store->GetDetElement(cluster.fDetElemId, warn);
2166 HLTError("Problem found with data block %d, fDataType = '%s',"
2167 " fPtr = %p and fSize = %u bytes."
2168 " Assuming this is a %s data block."
2169 " Problem: The detector element number %d for cluster"
2170 " %d is not valid.",
2172 DataType2Text(block.fDataType).c_str(),
2183 // Check that the chamber number found from the hit coordinate and
2184 // that from the detector element number are the same.
2185 Int_t chamberFromHit = AliMUONConstants::ChamberNumber(cluster.fHit.fZ, warn);
2186 Int_t chamberFromDE = AliMpDEManager::GetChamberId(cluster.fDetElemId, warn);
2187 if (chamberFromHit != chamberFromDE)
2189 HLTError("Problem found with data block %d, fDataType = '%s',"
2190 " fPtr = %p and fSize = %u bytes."
2191 " Assuming this is a %s data block."
2192 " Problem: The detector element number %d for"
2193 " cluster %d, corresponds to chamber %d, but"
2194 " found a different chamber number %d for the"
2195 " corresponding hit coordinate {x = %f, y = %f,"
2198 DataType2Text(block.fDataType).c_str(),
2213 // Make sure the corresponding DDL bit is set in the data
2214 // block specification.
2215 if (fIgnoreSpec) continue;
2216 if (0 <= de->GetDdlId() and de->GetDdlId() < 22 and ddl[de->GetDdlId()])
2218 HLTError("Problem found with data block %d, fDataType = '%s',"
2219 " fPtr = %p and fSize = %u bytes."
2220 " Assuming this is a %s data block."
2221 " Problem: The detector element number %d for cluster"
2222 " %d corresponds to DDL number %d, but the data"
2223 " block specification 0x%8.8X does not have the"
2224 " corresponding bit set.",
2226 DataType2Text(block.fDataType).c_str(),
2233 block.fSpecification
2241 HLTWarning("Cannot check cluster information without being able"
2242 " to load the mapping from CDB."
2247 // Min and max chamber numbers allowed for the cluster hits.
2249 Int_t maxCh = AliMUONConstants::NTrackingCh() - 1;
2251 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2253 // Need to check that no cluster data has duplicated data but with
2254 // a different ID number.
2255 AliHLTMUONClusterStruct ci = inblock[i];
2257 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2259 AliHLTMUONClusterStruct cj = inblock[j];
2264 HLTError("Problem found with data block %d, fDataType = '%s',"
2265 " fPtr = %p and fSize = %u bytes."
2266 " Assuming this is a %s data block."
2267 " Problem: The cluster structures %d and %d contain"
2268 " the same data. The data might have been duplicated.",
2270 DataType2Text(block.fDataType).c_str(),
2280 // Check that the hit structure in the cluster corresponds
2281 // to a tracker chamber.
2282 bool hitOk = IsHitCoordinateOk(
2283 block, blockNumber, name, i, ci.fHit,
2284 minCh, maxCh, -1, ddl
2286 if (not hitOk) result = false;
2293 bool AliHLTMUONDataCheckerComponent::CheckChannelsBlock(
2294 const AliHLTComponentBlockData& block,
2295 AliHLTUInt32_t blockNumber
2298 /// Checks the validity of a channels block.
2301 const char* name = "channels";
2303 if (not fIgnoreSpec)
2305 if (not IsFromTrackerOnly(block, blockNumber, name))
2309 AliHLTMUONChannelsBlockReader inblock(block.fPtr, block.fSize);
2310 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2314 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2316 if (FetchMappingStores() == 0) // are stores loaded?
2318 Bool_t warn = kFALSE;
2319 AliMpDDLStore* store = AliMpDDLStore::Instance(warn);
2321 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2323 const AliHLTMUONChannelStruct& channel = inblock[i];
2325 // Check if the bus patch is valid.
2326 AliMpBusPatch* busPatch = store->GetBusPatch(channel.fBusPatch, warn);
2327 if (busPatch == NULL)
2329 HLTError("Problem found with data block %d, fDataType = '%s',"
2330 " fPtr = %p and fSize = %u bytes."
2331 " Assuming this is a %s data block."
2332 " Problem: Found a bus patch identifier %d that"
2335 DataType2Text(block.fDataType).c_str(),
2345 // We can check that the bus patch is for a DDL
2346 // which is also indicated by the specification bits.
2347 if (not fIgnoreSpec and (
2348 not (0 <= busPatch->GetDdlId() and busPatch->GetDdlId() < 20)
2349 or (0 <= busPatch->GetDdlId() and busPatch->GetDdlId() < 20
2350 and not ddl[busPatch->GetDdlId()])
2353 HLTError("Problem found with data block %d, fDataType = '%s',"
2354 " fPtr = %p and fSize = %u bytes."
2355 " Assuming this is a %s data block."
2356 " Problem: Found a bus patch identifier %d for"
2357 " DDL %d, but the data block specification 0x%8.8X"
2358 " does not have the corresponding bit set.",
2360 DataType2Text(block.fDataType).c_str(),
2365 busPatch->GetDdlId(),
2366 block.fSpecification
2372 // Check if the MANU ID is valid.
2373 if (not busPatch->HasManu(channel.fManu))
2375 HLTError("Problem found with data block %d, fDataType = '%s',"
2376 " fPtr = %p and fSize = %u bytes."
2377 " Assuming this is a %s data block."
2378 " Problem: Found a MANU identifier %d on bus patch %d"
2379 " that is not valid.",
2381 DataType2Text(block.fDataType).c_str(),
2392 // Now try to fetch the detector element to check the MANU channel.
2393 AliMpDetElement* de = store->GetDetElement(busPatch->GetDEId(), warn);
2396 HLTError("Problem found with data block %d, fDataType = '%s',"
2397 " fPtr = %p and fSize = %u bytes."
2398 " Assuming this is a %s data block."
2399 " Problem: Found a bus patch identifier %d that"
2400 " does not correspond to a detector element.",
2402 DataType2Text(block.fDataType).c_str(),
2412 if (not de->IsConnectedChannel(channel.fManu, channel.fChannelAddress))
2414 // Just a warning because this is marked not
2415 // to be an error in the AliMUONDigitMaker.
2416 HLTWarning("Problem found with data block %d, fDataType = '%s',"
2417 " fPtr = %p and fSize = %u bytes."
2418 " Assuming this is a %s data block."
2419 " Problem: Found a channel with address %d on"
2420 " MANU ID %d and bus patch %d that is not connected.",
2422 DataType2Text(block.fDataType).c_str(),
2426 channel.fChannelAddress,
2434 // Need to also load the correct segmentation to check the channel.
2435 const AliMpVSegmentation* seg =
2436 AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(
2437 busPatch->GetDEId(), channel.fManu
2441 HLTError("Could not load segmentation for detector element %d"
2443 busPatch->GetDEId(), channel.fManu
2449 AliMpPad pad = seg->PadByLocation(
2450 AliMpIntPair(channel.fManu, channel.fChannelAddress),
2453 if (not pad.IsValid())
2455 HLTError("Problem found with data block %d, fDataType = '%s',"
2456 " fPtr = %p and fSize = %u bytes."
2457 " Assuming this is a %s data block."
2458 " Problem: Found a channel with address %d on"
2459 " MANU ID %d and bus patch %d that is not valid.",
2461 DataType2Text(block.fDataType).c_str(),
2465 channel.fChannelAddress,
2476 HLTWarning("Cannot check channel information without being able"
2477 " to load the mapping from CDB."
2482 // Need to check that no channel data has duplicated data but with
2483 // a different cluster ID number.
2484 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2486 AliHLTMUONChannelStruct ci = inblock[i];
2488 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2490 AliHLTMUONChannelStruct cj = inblock[j];
2491 cj.fClusterId = ci.fClusterId;
2495 HLTError("Problem found with data block %d, fDataType = '%s',"
2496 " fPtr = %p and fSize = %u bytes."
2497 " Assuming this is a %s data block."
2498 " Problem: The channel structures %d and %d contain"
2499 " the same data. The data might have been duplicated.",
2501 DataType2Text(block.fDataType).c_str(),
2516 bool AliHLTMUONDataCheckerComponent::CheckMansoTracksBlock(
2517 const AliHLTComponentBlockData& block,
2518 AliHLTUInt32_t blockNumber
2521 /// Checks the validity of a Manso tracks block.
2524 const char* name = "Manso tracks";
2526 if (not fIgnoreSpec)
2528 if (not IsSpecificationValid(block, blockNumber, name))
2532 AliHLTMUONMansoTracksBlockReader inblock(block.fPtr, block.fSize);
2533 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2537 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2539 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2541 // Need to check that no entries have duplicated data but with
2542 // a different track ID number.
2543 AliHLTMUONMansoTrackStruct ti = inblock[i];
2545 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2547 AliHLTMUONMansoTrackStruct tj = inblock[j];
2552 HLTError("Problem found with data block %d, fDataType = '%s',"
2553 " fPtr = %p and fSize = %u bytes."
2554 " Assuming this is a %s data block."
2555 " Problem: The Manso tracks %d and %d contain the"
2556 " same data. The data might have been duplicated.",
2558 DataType2Text(block.fDataType).c_str(),
2568 bool trackOk = IsMansoTrackOk(block, blockNumber, name, i, ti, ddl);
2569 if (not trackOk) result = false;
2576 bool AliHLTMUONDataCheckerComponent::CheckMansoCandidatesBlock(
2577 const AliHLTComponentBlockData& block,
2578 AliHLTUInt32_t blockNumber
2581 /// Checks the validity of a Manso candidates block.
2584 const char* name = "Manso track candidates";
2586 if (not fIgnoreSpec)
2588 if (not IsSpecificationValid(block, blockNumber, name))
2592 AliHLTMUONMansoCandidatesBlockReader inblock(block.fPtr, block.fSize);
2593 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2597 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2599 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2601 // Need to check that no entries have duplicated data but with a
2602 // different track ID number.
2603 AliHLTMUONMansoCandidateStruct ti = inblock[i];
2605 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2607 AliHLTMUONMansoCandidateStruct tj = inblock[j];
2608 tj.fTrack.fId = ti.fTrack.fId;
2612 HLTError("Problem found with data block %d, fDataType = '%s',"
2613 " fPtr = %p and fSize = %u bytes."
2614 " Assuming this is a %s data block."
2615 " Problem: The Manso track candidates %d and %d"
2616 " contain the same data."
2617 " The data might have been duplicated.",
2619 DataType2Text(block.fDataType).c_str(),
2629 bool trackOk = IsMansoTrackOk(block, blockNumber, name, i, ti.fTrack, ddl);
2630 if (not trackOk) result = false;
2632 // Check that each ROI has a centre point somewhere on the correct
2633 // corresponding chamber and that the Radius is not bigger thant
2634 // the diameter of the chamber which would be pointless.
2635 for (AliHLTInt32_t j = 0; j < 4; j++)
2637 if (ti.fRoI[j].fRadius == -1) continue; // Ignore invalid ROIs
2639 Int_t chamber = AliMUONConstants::ChamberNumber(
2640 ti.fRoI[j].fZ, false // false = do not warn.
2644 HLTError("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: The region of interest on chamber %d for"
2648 " Manso track candidate %d has a z-coordinate of %f"
2649 " cm that does not correspond to that chamber.",
2651 DataType2Text(block.fDataType).c_str(),
2662 double x = ti.fRoI[j].fX;
2663 double y = ti.fRoI[j].fY;
2664 double r = sqrt(x*x + y*y);
2665 if (r > AliMUONConstants::Dmax((j+6)/2))
2667 // Just a warning since this is not a data integrity problem
2668 // but rather just a data sanity problem.
2669 HLTWarning("Problem found with data block %d, fDataType = '%s',"
2670 " fPtr = %p and fSize = %u bytes."
2671 " Assuming this is a %s data block."
2672 " Problem: The region of interest coordinate {x = %f,"
2673 " y = %f} cm on chamber %d for Manso track candidate %d"
2674 " does not correspond to that chamber.",
2676 DataType2Text(block.fDataType).c_str(),
2688 if (ti.fRoI[j].fRadius > AliMUONConstants::Dmax((j+6)/2))
2690 // Just a warning since this is not a data integrity problem
2691 // but rather just a data sanity problem.
2692 HLTWarning("Problem found with data block %d, fDataType = '%s',"
2693 " fPtr = %p and fSize = %u bytes."
2694 " Assuming this is a %s data block."
2695 " Problem: The region of interest radius of %f cm"
2696 " on chamber %d for Manso track candidate %d"
2697 " is bigger than the chamber diameter %f cm.",
2699 DataType2Text(block.fDataType).c_str(),
2706 AliMUONConstants::Dmax((j+6)/2)
2717 bool AliHLTMUONDataCheckerComponent::CheckSinglesDecisionBlock(
2718 const AliHLTComponentBlockData& block,
2719 AliHLTUInt32_t blockNumber
2722 /// Checks the validity of a single tracks trigger decision block.
2725 const char* name = "singles decision";
2727 if (not fIgnoreSpec)
2729 if (not IsSpecificationValid(block, blockNumber, name))
2733 AliHLTMUONSinglesDecisionBlockReader inblock(block.fPtr, block.fSize);
2734 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2741 bool AliHLTMUONDataCheckerComponent::CheckPairsDecisionBlock(
2742 const AliHLTComponentBlockData& block,
2743 AliHLTUInt32_t blockNumber
2746 /// Checks the validity of a track pairs trigger decision block.
2749 const char* name = "pairs decision";
2751 if (not fIgnoreSpec)
2753 if (not IsSpecificationValid(block, blockNumber, name))
2757 AliHLTMUONPairsDecisionBlockReader inblock(block.fPtr, block.fSize);
2758 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2765 bool AliHLTMUONDataCheckerComponent::AreMomentaCompatible(
2766 AliHLTFloat32_t px1,
2767 AliHLTFloat32_t py1,
2768 AliHLTFloat32_t pz1,
2769 AliHLTFloat32_t px2,
2770 AliHLTFloat32_t py2,
2774 /// Checks to see if the two momenta vectors are compatible or not.
2775 /// The vectors should not have an angle more than 10 degrees between
2776 /// them and their magnitudes should not be more different than 50%.
2778 double p1 = sqrt(px1*px1 + py1*py1 + pz1*pz1);
2779 double p2 = sqrt(px2*px2 + py2*py2 + pz2*pz2);
2780 if (p1 == 0 and p2 == 0) return true;
2781 if (fabs(p1 - p2) / ((p1 + p2)*0.5) > 0.5) return false;
2782 double denom = p1 * p2;
2783 if (denom == 0) return false;
2784 double angle = acos( (px1*px2 + py1*py2 + pz1*pz2) / denom );
2785 if (angle > 3.14159265358979323846 * 10. / 180.) return false;
2790 bool AliHLTMUONDataCheckerComponent::IsScalarTooLarge(
2791 const AliHLTComponentBlockData* block,
2792 AliHLTUInt32_t blockNumber,
2793 const char* blockTypeName,
2794 const char* scalarName,
2795 AliHLTUInt32_t scalarValue,
2796 AliHLTUInt32_t totalTrackCount
2799 /// Checks if the scalar value is larger than the number of Manso
2800 /// tracks in the event.
2802 if (scalarValue > totalTrackCount)
2804 HLTError("Problem found with %s trigger decision"
2805 " data block %d, fDataType = '%s', fPtr = %p and"
2806 " fSize = %u bytes."
2807 " Problem: The %s scalar with value %d is larger"
2808 " than the total number of Manso tracks found for the"
2809 " event (%d tracks).",
2812 DataType2Text(block->fDataType).c_str(),
2828 bool AliHLTMUONDataCheckerComponent::IsScalarALargerThanB(
2829 const AliHLTComponentBlockData* block,
2830 AliHLTUInt32_t blockNumber,
2831 const char* blockTypeName,
2832 const char* scalarAName,
2833 AliHLTUInt32_t scalarAValue,
2834 const char* scalarBName,
2835 AliHLTUInt32_t scalarBValue
2838 /// Checks if the scalar value is larger than the number of Manso
2839 /// tracks in the event.
2841 if (scalarAValue > scalarBValue)
2843 HLTError("Problem found with %s trigger decision"
2844 " data block %d, fDataType = '%s', fPtr = %p and"
2845 " fSize = %u bytes."
2846 " Problem: The %s scalar with value %d is larger"
2847 " than scalar %s with value %d, but is should not be.",
2850 DataType2Text(block->fDataType).c_str(),
2867 void AliHLTMUONDataCheckerComponent::MarkBlock(
2868 const AliHLTComponentBlockData* blocks,
2870 AliHLTUInt32_t blockCount,
2871 const AliHLTComponentBlockData* blockToMark
2874 /// Tries to find the 'blockToMark' in the list of blocks and sets the
2875 /// corresponding 'blockOk' flag to false.
2877 for (AliHLTUInt32_t i = 0; i < blockCount; i++)
2879 if (&blocks[i] == blockToMark)
2888 void AliHLTMUONDataCheckerComponent::MakeGlobalChecks(
2889 const AliHLTComponentBlockData* blocks,
2891 AliHLTUInt32_t blockCount,
2892 const AliHLTComponentBlockData** trigRecBlocks,
2893 AliHLTUInt32_t trigRecBlocksCount,
2894 const AliHLTComponentBlockData** trigRecDebugBlocks,
2895 AliHLTUInt32_t trigRecDebugBlocksCount,
2896 const AliHLTComponentBlockData** hitBlocks,
2897 AliHLTUInt32_t hitBlocksCount,
2898 const AliHLTComponentBlockData** clusterBlocks,
2899 AliHLTUInt32_t clusterBlocksCount,
2900 const AliHLTComponentBlockData** channelBlocks,
2901 AliHLTUInt32_t channelBlocksCount,
2902 const AliHLTComponentBlockData** mansoTrackBlocks,
2903 AliHLTUInt32_t mansoTrackBlocksCount,
2904 const AliHLTComponentBlockData** mansoCandidateBlocks,
2905 AliHLTUInt32_t mansoCandidateBlocksCount,
2906 const AliHLTComponentBlockData** singleDecisionBlocks,
2907 AliHLTUInt32_t singleDecisionBlocksCount,
2908 const AliHLTComponentBlockData** pairDecisionBlocks,
2909 AliHLTUInt32_t pairDecisionBlocksCount
2912 /// The following set of global checks are performed:
2913 /// 1) Checks if all the ID numbers in all the blocks are unique.
2914 /// 2) Check if all the structures are unique up to their ID numbers,
2915 /// that it, make sure there are no structures with the same data but
2916 /// for a different ID number.
2917 /// 3) Check if the reference ID numbers are correct, i.e. are the
2918 /// trigger record ID numbers in the track structures found in any of
2919 /// the trigger record data blocks.
2920 /// 4) Do the number of channels claimed in the cluster correspond to
2921 /// the number of channel structures.
2922 /// 5) Check that the momentum vectors between the Manso tracks and
2923 /// the corresponding trigger record are compatible.
2924 /// 6) Check that the trigger decision scalars are reasonable.
2925 /// 7) Check that the detector element IDs are the same between rec
2926 /// hits and clusters / trigger record debug blocks.
2928 // Check if all the trigger record identifiers and data are unique.
2929 for (AliHLTUInt32_t bi = 0; bi < trigRecBlocksCount; bi++)
2931 AliHLTMUONTriggerRecordsBlockReader inblocki(trigRecBlocks[bi]->fPtr, trigRecBlocks[bi]->fSize);
2932 if (not inblocki.BufferSizeOk()) continue;
2933 for (AliHLTUInt32_t bj = bi+1; bj < trigRecBlocksCount; bj++)
2935 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
2936 if (not inblockj.BufferSizeOk()) continue;
2938 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
2939 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
2941 if (inblocki[i].fId == inblockj[j].fId)
2943 HLTError("Problem found with trigger record data block %d,"
2944 " fDataType = '%s', fPtr = %p and fSize = %u bytes,"
2945 " and trigger record data block %d,"
2946 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
2947 " Problem: Trigger record %d in block %d and entry"
2948 " %d in block %d have the same identfier, but they"
2949 " should be unique.",
2951 DataType2Text(trigRecBlocks[bi]->fDataType).c_str(),
2952 trigRecBlocks[bi]->fPtr,
2953 trigRecBlocks[bi]->fSize,
2955 DataType2Text(trigRecBlocks[bj]->fDataType).c_str(),
2956 trigRecBlocks[bj]->fPtr,
2957 trigRecBlocks[bj]->fSize,
2961 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bi]);
2962 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bj]);
2965 AliHLTMUONTriggerRecordStruct a = inblocki[i];
2966 AliHLTMUONTriggerRecordStruct b = inblockj[j];
2970 HLTError("Problem found with trigger record data block %d,"
2971 " fDataType = '%s', fPtr = %p and fSize = %u bytes,"
2972 " and trigger record data block %d,"
2973 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
2974 " Problem: Trigger record %d in block %d and entry"
2975 " %d in block %d have the same data."
2976 " The data may have been duplicated.",
2978 DataType2Text(trigRecBlocks[bi]->fDataType).c_str(),
2979 trigRecBlocks[bi]->fPtr,
2980 trigRecBlocks[bi]->fSize,
2982 DataType2Text(trigRecBlocks[bj]->fDataType).c_str(),
2983 trigRecBlocks[bj]->fPtr,
2984 trigRecBlocks[bj]->fSize,
2988 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bi]);
2989 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bj]);
2995 for (AliHLTUInt32_t bi = 0; bi < trigRecDebugBlocksCount; bi++)
2997 AliHLTMUONTrigRecsDebugBlockReader inblocki(trigRecDebugBlocks[bi]->fPtr, trigRecDebugBlocks[bi]->fSize);
2998 if (not inblocki.BufferSizeOk()) continue;
3000 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3002 // Check if all the trigger record IDs in the debug information structures exist.
3005 for (AliHLTUInt32_t bj = 0; bj < trigRecBlocksCount and not found; bj++)
3007 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
3008 if (not inblockj.BufferSizeOk()) continue;
3010 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3012 if (inblocki[i].fTrigRecId == inblockj[j].fId)
3016 // Since we found the corresponding trigger record,
3017 // check if the detector element IDs are the same.
3018 bool deOk = CheckDetElemIds(
3019 *trigRecDebugBlocks[bi], bi, i, inblocki[i],
3020 *trigRecBlocks[bj], bj, j, inblockj[j]
3024 MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bi]);
3025 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bj]);
3035 HLTError("Problem found with trigger record debug information"
3036 " data block %d, fDataType = '%s', fPtr = %p and"
3037 " fSize = %u bytes."
3038 " Problem with entry %d in block: The trigger record"
3039 " identifier %d does not exist in any trigger record"
3042 DataType2Text(trigRecDebugBlocks[bi]->fDataType).c_str(),
3043 trigRecDebugBlocks[bi]->fPtr,
3044 trigRecDebugBlocks[bi]->fSize,
3045 i, inblocki[i].fTrigRecId
3047 MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bi]);
3051 // Check if all the trigger record debug information structures are unique.
3052 for (AliHLTUInt32_t bj = bi+1; bj < trigRecDebugBlocksCount; bj++)
3054 AliHLTMUONTrigRecsDebugBlockReader inblockj(trigRecDebugBlocks[bj]->fPtr, trigRecDebugBlocks[bj]->fSize);
3055 if (not inblockj.BufferSizeOk()) continue;
3057 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3058 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3060 AliHLTMUONTrigRecInfoStruct a = inblocki[i];
3061 AliHLTMUONTrigRecInfoStruct b = inblockj[j];
3062 a.fTrigRecId = b.fTrigRecId = -1;
3065 HLTError("Problem found with trigger record debug information"
3066 " data block %d, fDataType = '%s', fPtr = %p and"
3067 " fSize = %u bytes, and trigger record debug"
3068 " information data block %d,"
3069 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3070 " Problem: The trigger record debug inforamtion"
3071 " structure %d in block %d and entry"
3072 " %d in block %d have the same data."
3073 " The data may have been duplicated.",
3075 DataType2Text(trigRecDebugBlocks[bi]->fDataType).c_str(),
3076 trigRecDebugBlocks[bi]->fPtr,
3077 trigRecDebugBlocks[bi]->fSize,
3079 DataType2Text(trigRecDebugBlocks[bj]->fDataType).c_str(),
3080 trigRecDebugBlocks[bj]->fPtr,
3081 trigRecDebugBlocks[bj]->fSize,
3085 MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bi]);
3086 MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bj]);
3092 // Check that all the reconstructed hits are unique.
3093 for (AliHLTUInt32_t bi = 0; bi < hitBlocksCount; bi++)
3095 AliHLTMUONRecHitsBlockReader inblocki(hitBlocks[bi]->fPtr, hitBlocks[bi]->fSize);
3096 if (not inblocki.BufferSizeOk()) continue;
3097 for (AliHLTUInt32_t bj = bi+1; bj < hitBlocksCount; bj++)
3099 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
3100 if (not inblockj.BufferSizeOk()) continue;
3102 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3103 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3105 if (inblocki[i] == inblockj[j])
3107 HLTError("Problem found with reconstructed hit data block %d,"
3108 " fDataType = '%s', fPtr = %p and fSize = %u bytes,"
3109 " and reconstructed hit data block %d,"
3110 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3111 " Problem: Reconstructed hit %d in block %d and entry"
3112 " %d in block %d are the same, but all hits"
3113 " should be unique.",
3115 DataType2Text(hitBlocks[bi]->fDataType).c_str(),
3116 hitBlocks[bi]->fPtr,
3117 hitBlocks[bi]->fSize,
3119 DataType2Text(hitBlocks[bj]->fDataType).c_str(),
3120 hitBlocks[bj]->fPtr,
3121 hitBlocks[bj]->fSize,
3125 MarkBlock(blocks, blockOk, blockCount, hitBlocks[bi]);
3126 MarkBlock(blocks, blockOk, blockCount, hitBlocks[bj]);
3132 for (AliHLTUInt32_t bi = 0; bi < clusterBlocksCount; bi++)
3134 AliHLTMUONClustersBlockReader inblocki(clusterBlocks[bi]->fPtr, clusterBlocks[bi]->fSize);
3135 if (not inblocki.BufferSizeOk()) continue;
3137 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3139 // Check if all the reconstructed hit coordinates in the cluster structures exist.
3142 for (AliHLTUInt32_t bj = 0; bj < hitBlocksCount and not found; bj++)
3144 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
3145 if (not inblockj.BufferSizeOk()) continue;
3147 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3149 if (inblocki[i].fHit == inblockj[j])
3153 // Since we found the corresponding cluster,
3154 // check if the detector element IDs are the same.
3155 bool deOk = CheckDetElemIds(
3156 *clusterBlocks[bi], bi, i, inblocki[i],
3157 *hitBlocks[bj], bj, j, inblockj[j]
3161 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3162 MarkBlock(blocks, blockOk, blockCount, hitBlocks[bj]);
3170 // If the hit was not found then it should be nil.
3171 if (not found and (inblocki[i].fHit != AliHLTMUONConstants::NilRecHitStruct()))
3173 HLTError("Problem found with cluster data block %d,"
3174 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3175 " Problem with entry %d in block: The cluster hit"
3176 " coordinate {x = %f, y = %f, z = %f} does not exist"
3177 " in any reconstructed hit data block.",
3179 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3180 clusterBlocks[bi]->fPtr,
3181 clusterBlocks[bi]->fSize,
3183 inblocki[i].fHit.fX,
3184 inblocki[i].fHit.fY,
3187 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3190 // Check that the fNchannels value is correct.
3191 AliHLTUInt32_t count = 0;
3192 for (AliHLTUInt32_t bj = 0; bj < channelBlocksCount and not found; bj++)
3194 AliHLTMUONChannelsBlockReader inblockj(channelBlocks[bj]->fPtr, channelBlocks[bj]->fSize);
3195 if (not inblockj.BufferSizeOk()) continue;
3197 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3199 if (inblocki[i].fId == inblockj[j].fClusterId)
3206 if (inblocki[i].fNchannels != count)
3208 HLTError("Problem found with cluster data block %d,"
3209 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3210 " Problem with entry %d in block: The number of"
3211 " channels in the cluster is reported as %d, but"
3212 " only %d channel structures were found.",
3214 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3215 clusterBlocks[bi]->fPtr,
3216 clusterBlocks[bi]->fSize,
3218 inblocki[i].fNchannels,
3221 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3225 // Check if all the cluster structures are unique up to the identifier
3226 // and have unique identifiers.
3227 for (AliHLTUInt32_t bj = bi+1; bj < clusterBlocksCount; bj++)
3229 AliHLTMUONClustersBlockReader inblockj(clusterBlocks[bj]->fPtr, clusterBlocks[bj]->fSize);
3230 if (not inblockj.BufferSizeOk()) continue;
3232 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3233 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3235 if (inblocki[i].fId == inblockj[j].fId)
3237 HLTError("Problem found with cluster"
3238 " data block %d, fDataType = '%s', fPtr = %p and"
3239 " fSize = %u bytes, and cluster data block %d,"
3240 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3241 " Problem: The cluster %d in block %d and entry"
3242 " %d in block %d have the same identifier, but they"
3243 " should be unique.",
3245 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3246 clusterBlocks[bi]->fPtr,
3247 clusterBlocks[bi]->fSize,
3249 DataType2Text(clusterBlocks[bj]->fDataType).c_str(),
3250 clusterBlocks[bj]->fPtr,
3251 clusterBlocks[bj]->fSize,
3255 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3256 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bj]);
3259 AliHLTMUONClusterStruct a = inblocki[i];
3260 AliHLTMUONClusterStruct b = inblockj[j];
3264 HLTError("Problem found with cluster"
3265 " data block %d, fDataType = '%s', fPtr = %p and"
3266 " fSize = %u bytes, and cluster data block %d,"
3267 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3268 " Problem: The cluster %d in block %d and entry"
3269 " %d in block %d have the same data."
3270 " The data may have been duplicated.",
3272 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3273 clusterBlocks[bi]->fPtr,
3274 clusterBlocks[bi]->fSize,
3276 DataType2Text(clusterBlocks[bj]->fDataType).c_str(),
3277 clusterBlocks[bj]->fPtr,
3278 clusterBlocks[bj]->fSize,
3282 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3283 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bj]);
3289 for (AliHLTUInt32_t bi = 0; bi < channelBlocksCount; bi++)
3291 AliHLTMUONChannelsBlockReader inblocki(channelBlocks[bi]->fPtr, channelBlocks[bi]->fSize);
3292 if (not inblocki.BufferSizeOk()) continue;
3294 // Check if all the cluster IDs in the channel structures exist.
3295 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3299 for (AliHLTUInt32_t bj = 0; bj < clusterBlocksCount and not found; bj++)
3301 AliHLTMUONClustersBlockReader inblockj(clusterBlocks[bj]->fPtr, clusterBlocks[bj]->fSize);
3302 if (not inblockj.BufferSizeOk()) continue;
3304 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3306 if (inblocki[i].fClusterId == inblockj[j].fId)
3316 HLTError("Problem found with channel"
3317 " data block %d, fDataType = '%s', fPtr = %p and"
3318 " fSize = %u bytes."
3319 " Problem with entry %d in block: The cluster"
3320 " identifier %d does not exist in any cluster"
3323 DataType2Text(channelBlocks[bi]->fDataType).c_str(),
3324 channelBlocks[bi]->fPtr,
3325 channelBlocks[bi]->fSize,
3326 i, inblocki[i].fClusterId
3328 MarkBlock(blocks, blockOk, blockCount, channelBlocks[bi]);
3332 // Check if all the channel structures are unique up to the cluster ID.
3333 for (AliHLTUInt32_t bj = bi+1; bj < channelBlocksCount; bj++)
3335 AliHLTMUONChannelsBlockReader inblockj(channelBlocks[bj]->fPtr, channelBlocks[bj]->fSize);
3336 if (not inblockj.BufferSizeOk()) continue;
3338 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3339 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3341 AliHLTMUONChannelStruct a = inblocki[i];
3342 AliHLTMUONChannelStruct b = inblockj[j];
3343 a.fClusterId = b.fClusterId = -1;
3346 HLTError("Problem found with channel"
3347 " data block %d, fDataType = '%s', fPtr = %p and"
3348 " fSize = %u bytes, and channel data block %d,"
3349 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3350 " Problem: The channel %d in block %d and entry"
3351 " %d in block %d have the same data."
3352 " The data may have been duplicated.",
3354 DataType2Text(channelBlocks[bi]->fDataType).c_str(),
3355 channelBlocks[bi]->fPtr,
3356 channelBlocks[bi]->fSize,
3358 DataType2Text(channelBlocks[bj]->fDataType).c_str(),
3359 channelBlocks[bj]->fPtr,
3360 channelBlocks[bj]->fSize,
3364 MarkBlock(blocks, blockOk, blockCount, channelBlocks[bi]);
3365 MarkBlock(blocks, blockOk, blockCount, channelBlocks[bj]);
3371 // Will need the total number of tracks later for comparison to trigger scalars.
3372 AliHLTUInt32_t totalTrackCount = 0;
3374 for (AliHLTUInt32_t bi = 0; bi < mansoTrackBlocksCount; bi++)
3376 AliHLTMUONMansoTracksBlockReader inblocki(mansoTrackBlocks[bi]->fPtr, mansoTrackBlocks[bi]->fSize);
3377 if (not inblocki.BufferSizeOk()) continue;
3379 totalTrackCount += inblocki.Nentries();
3381 // Check if all the trigger record IDs in the Manso track structures exist.
3382 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3386 for (AliHLTUInt32_t bj = 0; bj < trigRecBlocksCount and not found; bj++)
3388 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
3389 if (not inblockj.BufferSizeOk()) continue;
3391 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3393 if (inblocki[i].fTrigRec == inblockj[j].fId)
3395 // At this point we can check if the momentum
3396 // is compatible with the trigger record.
3397 if (not AreMomentaCompatible(
3398 inblocki[i].fPx, inblocki[i].fPy, inblocki[i].fPz,
3399 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
3403 HLTWarning("Problem found with Manso track"
3404 " data block %d, fDataType = '%s', fPtr = %p and"
3405 " fSize = %u bytes."
3406 " Problem with Manso track %d in block: The momentum"
3407 " vector of the track p = {%f, %f, %f} GeV/c is not"
3408 " compatible with the momentum vector of the trigger"
3409 " record with p = {%f, %f, %f} GeV/c.",
3411 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3412 mansoTrackBlocks[bi]->fPtr,
3413 mansoTrackBlocks[bi]->fSize,
3414 i, inblocki[i].fPx, inblocki[i].fPy, inblocki[i].fPz,
3415 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
3417 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3428 HLTError("Problem found with Manso track"
3429 " data block %d, fDataType = '%s', fPtr = %p and"
3430 " fSize = %u bytes."
3431 " Problem with Manso track %d in block: The trigger"
3432 " record identifier %d does not exist in any trigger"
3433 " record data block.",
3435 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3436 mansoTrackBlocks[bi]->fPtr,
3437 mansoTrackBlocks[bi]->fSize,
3438 i, inblocki[i].fTrigRec
3440 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3444 // Check if all the hits in the Manso track structures exist.
3445 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3447 AliHLTMUONParticleSign sign;
3449 AliHLTMUONUtils::UnpackMansoTrackFlags(inblocki[i].fFlags, sign, hitset);
3451 for (AliHLTUInt32_t n = 0; n < 4; n++)
3453 if (not hitset[n]) continue;
3456 for (AliHLTUInt32_t bj = 0; bj < hitBlocksCount and not found; bj++)
3458 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
3459 if (not inblockj.BufferSizeOk()) continue;
3461 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3463 if (inblocki[i].fHit[n] == inblockj[j])
3473 HLTError("Problem found with Manso track"
3474 " data block %d, fDataType = '%s', fPtr = %p and"
3475 " fSize = %u bytes."
3476 " Problem with Manso track %d in block: The hit"
3477 " for chamber %d does not exist in any"
3478 " reconstructed hits data block.",
3480 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3481 mansoTrackBlocks[bi]->fPtr,
3482 mansoTrackBlocks[bi]->fSize,
3485 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3490 // Check if all the Manso track structures are unique up to the ID and
3491 // have unique identifiers.
3492 for (AliHLTUInt32_t bj = bi+1; bj < mansoTrackBlocksCount; bj++)
3494 AliHLTMUONMansoTracksBlockReader inblockj(mansoTrackBlocks[bj]->fPtr, mansoTrackBlocks[bj]->fSize);
3495 if (not inblockj.BufferSizeOk()) continue;
3497 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3498 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3500 if (inblocki[i].fId == inblockj[j].fId)
3502 HLTError("Problem found with Manso track"
3503 " data block %d, fDataType = '%s', fPtr = %p and"
3504 " fSize = %u bytes, and Manso track data block %d,"
3505 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3506 " Problem: The Manso track %d in block %d and entry"
3507 " %d in block %d have the same identifier, but they"
3508 " should be unique.",
3510 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3511 mansoTrackBlocks[bi]->fPtr,
3512 mansoTrackBlocks[bi]->fSize,
3514 DataType2Text(mansoTrackBlocks[bj]->fDataType).c_str(),
3515 mansoTrackBlocks[bj]->fPtr,
3516 mansoTrackBlocks[bj]->fSize,
3520 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3521 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bj]);
3524 AliHLTMUONMansoTrackStruct a = inblocki[i];
3525 AliHLTMUONMansoTrackStruct b = inblockj[j];
3529 HLTError("Problem found with Manso track"
3530 " data block %d, fDataType = '%s', fPtr = %p and"
3531 " fSize = %u bytes, and Manso track data block %d,"
3532 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3533 " Problem: The Manso track %d in block %d and entry"
3534 " %d in block %d have the same data."
3535 " The data may have been duplicated.",
3537 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3538 mansoTrackBlocks[bi]->fPtr,
3539 mansoTrackBlocks[bi]->fSize,
3541 DataType2Text(mansoTrackBlocks[bj]->fDataType).c_str(),
3542 mansoTrackBlocks[bj]->fPtr,
3543 mansoTrackBlocks[bj]->fSize,
3547 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3548 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bj]);
3554 for (AliHLTUInt32_t bi = 0; bi < mansoCandidateBlocksCount; bi++)
3556 AliHLTMUONMansoCandidatesBlockReader inblocki(mansoCandidateBlocks[bi]->fPtr, mansoCandidateBlocks[bi]->fSize);
3557 if (not inblocki.BufferSizeOk()) continue;
3559 // Check if all the trigger record IDs in the Manso track candidate structures exist.
3560 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3564 for (AliHLTUInt32_t bj = 0; bj < trigRecBlocksCount and not found; bj++)
3566 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
3567 if (not inblockj.BufferSizeOk()) continue;
3569 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3571 if (inblocki[i].fTrack.fTrigRec == inblockj[j].fId)
3573 // At this point we can check if the momentum
3574 // is compatible with the trigger record.
3575 if (not AreMomentaCompatible(
3576 inblocki[i].fTrack.fPx, inblocki[i].fTrack.fPy, inblocki[i].fTrack.fPz,
3577 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
3581 HLTWarning("Problem found with Manso track candidate"
3582 " data block %d, fDataType = '%s', fPtr = %p and"
3583 " fSize = %u bytes."
3584 " Problem with track candidate %d in block: The momentum"
3585 " vector of the candidate p = {%f, %f, %f} GeV/c is not"
3586 " compatible with the momentum vector of the trigger"
3587 " record with p = {%f, %f, %f} GeV/c.",
3589 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3590 mansoTrackBlocks[bi]->fPtr,
3591 mansoTrackBlocks[bi]->fSize,
3593 inblocki[i].fTrack.fPx, inblocki[i].fTrack.fPy, inblocki[i].fTrack.fPz,
3594 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
3596 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3607 HLTError("Problem found with Manso track candidate"
3608 " data block %d, fDataType = '%s', fPtr = %p and"
3609 " fSize = %u bytes."
3610 " Problem with track candidate %d in block: The trigger"
3611 " record identifier %d does not exist in any trigger"
3612 " record data block.",
3614 DataType2Text(mansoCandidateBlocks[bi]->fDataType).c_str(),
3615 mansoCandidateBlocks[bi]->fPtr,
3616 mansoCandidateBlocks[bi]->fSize,
3617 i, inblocki[i].fTrack.fTrigRec
3619 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bi]);
3623 // Check if all the hits in the Manso track candidate structures exist.
3624 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3626 AliHLTMUONParticleSign sign;
3628 AliHLTMUONUtils::UnpackMansoTrackFlags(inblocki[i].fTrack.fFlags, sign, hitset);
3630 for (AliHLTUInt32_t n = 0; n < 4; n++)
3632 if (not hitset[n]) continue;
3635 for (AliHLTUInt32_t bj = 0; bj < hitBlocksCount and not found; bj++)
3637 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
3638 if (not inblockj.BufferSizeOk()) continue;
3640 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3642 if (inblocki[i].fTrack.fHit[n] == inblockj[j])
3652 HLTError("Problem found with Manso track candidate"
3653 " data block %d, fDataType = '%s', fPtr = %p and"
3654 " fSize = %u bytes."
3655 " Problem with track candidate %d in block: The hit"
3656 " for chamber %d does not exist in any"
3657 " reconstructed hits data block.",
3659 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3660 mansoTrackBlocks[bi]->fPtr,
3661 mansoTrackBlocks[bi]->fSize,
3664 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3669 // Check if all the Manso track candidate structures are unique up to the
3670 // track ID and have unique identifiers.
3671 for (AliHLTUInt32_t bj = bi+1; bj < mansoCandidateBlocksCount; bj++)
3673 AliHLTMUONMansoCandidatesBlockReader inblockj(mansoCandidateBlocks[bj]->fPtr, mansoCandidateBlocks[bj]->fSize);
3674 if (not inblockj.BufferSizeOk()) continue;
3676 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3677 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3679 if (inblocki[i].fTrack.fId == inblockj[j].fTrack.fId)
3681 HLTError("Problem found with Manso track candidate"
3682 " data block %d, fDataType = '%s', fPtr = %p and"
3683 " fSize = %u bytes, and Manso track candidate data block %d,"
3684 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3685 " Problem: The track candidate %d in block %d and entry"
3686 " %d in block %d have the same identifier, but they"
3687 " should be unique.",
3689 DataType2Text(mansoCandidateBlocks[bi]->fDataType).c_str(),
3690 mansoCandidateBlocks[bi]->fPtr,
3691 mansoCandidateBlocks[bi]->fSize,
3693 DataType2Text(mansoCandidateBlocks[bj]->fDataType).c_str(),
3694 mansoCandidateBlocks[bj]->fPtr,
3695 mansoCandidateBlocks[bj]->fSize,
3699 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bi]);
3700 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bj]);
3703 AliHLTMUONMansoCandidateStruct a = inblocki[i];
3704 AliHLTMUONMansoCandidateStruct b = inblockj[j];
3705 a.fTrack.fId = b.fTrack.fId = -1;
3708 HLTError("Problem found with Manso track candidate"
3709 " data block %d, fDataType = '%s', fPtr = %p and"
3710 " fSize = %u bytes, and Manso track candidate data block %d,"
3711 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3712 " Problem: The track candidate %d in block %d and entry"
3713 " %d in block %d have the same data."
3714 " The data may have been duplicated.",
3716 DataType2Text(mansoCandidateBlocks[bi]->fDataType).c_str(),
3717 mansoCandidateBlocks[bi]->fPtr,
3718 mansoCandidateBlocks[bi]->fSize,
3720 DataType2Text(mansoCandidateBlocks[bj]->fDataType).c_str(),
3721 mansoCandidateBlocks[bj]->fPtr,
3722 mansoCandidateBlocks[bj]->fSize,
3726 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bi]);
3727 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bj]);
3733 for (AliHLTUInt32_t bi = 0; bi < singleDecisionBlocksCount; bi++)
3735 AliHLTMUONSinglesDecisionBlockReader inblocki(singleDecisionBlocks[bi]->fPtr, singleDecisionBlocks[bi]->fSize);
3736 if (not inblocki.BufferSizeOk()) continue;
3738 // Check that the scalars are within reasonable limits.
3739 const AliHLTMUONSinglesDecisionBlockStruct& hdr = inblocki.BlockHeader();
3740 const AliHLTComponentBlockData* block = singleDecisionBlocks[bi];
3741 if (IsScalarTooLarge(block, bi, "single track", "fNlowPt", hdr.fNlowPt, totalTrackCount) or
3742 IsScalarTooLarge(block, bi, "single track", "fNhighPt", hdr.fNhighPt, totalTrackCount) or
3743 IsScalarALargerThanB(block, bi, "single track", "fNlowPt", hdr.fNlowPt, "fNhighPt", hdr.fNhighPt)
3746 MarkBlock(blocks, blockOk, blockCount, block);
3749 // Check if all the Manso track IDs in the trigger decision structures exist.
3750 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3754 for (AliHLTUInt32_t bj = 0; bj < mansoTrackBlocksCount and not found; bj++)
3756 AliHLTMUONMansoTracksBlockReader inblockj(mansoTrackBlocks[bj]->fPtr, mansoTrackBlocks[bj]->fSize);
3757 if (not inblockj.BufferSizeOk()) continue;
3759 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3761 if (inblocki[i].fTrackId == inblockj[j].fId)
3771 HLTError("Problem found with single track trigger decision"
3772 " data block %d, fDataType = '%s', fPtr = %p and"
3773 " fSize = %u bytes."
3774 " Problem with decision %d in block: The track"
3775 " identifier %d does not exist in any Manso tracks"
3778 DataType2Text(singleDecisionBlocks[bi]->fDataType).c_str(),
3779 singleDecisionBlocks[bi]->fPtr,
3780 singleDecisionBlocks[bi]->fSize,
3781 i, inblocki[i].fTrackId
3783 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bi]);
3787 // Check if all the trigger decision structures are unique up to the ID and
3788 // have unique Manso track identifiers.
3789 for (AliHLTUInt32_t bj = bi+1; bj < singleDecisionBlocksCount; bj++)
3791 AliHLTMUONSinglesDecisionBlockReader inblockj(singleDecisionBlocks[bj]->fPtr, singleDecisionBlocks[bj]->fSize);
3792 if (not inblockj.BufferSizeOk()) continue;
3794 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3795 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3797 if (inblocki[i].fTrackId == inblockj[j].fTrackId)
3799 HLTError("Problem found with single track trigger decision"
3800 " data block %d, fDataType = '%s', fPtr = %p and"
3801 " fSize = %u bytes, and single track trigger decision"
3803 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3804 " Problem: The trigger decision %d in block %d and entry"
3805 " %d in block %d have the same Manso track identifier,"
3806 " but they should be unique.",
3808 DataType2Text(singleDecisionBlocks[bi]->fDataType).c_str(),
3809 singleDecisionBlocks[bi]->fPtr,
3810 singleDecisionBlocks[bi]->fSize,
3812 DataType2Text(singleDecisionBlocks[bj]->fDataType).c_str(),
3813 singleDecisionBlocks[bj]->fPtr,
3814 singleDecisionBlocks[bj]->fSize,
3818 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bi]);
3819 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bj]);
3822 AliHLTMUONTrackDecisionStruct a = inblocki[i];
3823 AliHLTMUONTrackDecisionStruct b = inblockj[j];
3824 a.fTrackId = b.fTrackId = -1;
3827 HLTError("Problem found with single track trigger decision"
3828 " data block %d, fDataType = '%s', fPtr = %p and"
3829 " fSize = %u bytes, and single track trigger decision"
3831 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3832 " Problem: The trigger decision %d in block %d and entry"
3833 " %d in block %d have the same data."
3834 " The data may have been duplicated.",
3836 DataType2Text(singleDecisionBlocks[bi]->fDataType).c_str(),
3837 singleDecisionBlocks[bi]->fPtr,
3838 singleDecisionBlocks[bi]->fSize,
3840 DataType2Text(singleDecisionBlocks[bj]->fDataType).c_str(),
3841 singleDecisionBlocks[bj]->fPtr,
3842 singleDecisionBlocks[bj]->fSize,
3846 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bi]);
3847 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bj]);
3853 for (AliHLTUInt32_t bi = 0; bi < pairDecisionBlocksCount; bi++)
3855 AliHLTMUONPairsDecisionBlockReader inblocki(pairDecisionBlocks[bi]->fPtr, pairDecisionBlocks[bi]->fSize);
3856 if (not inblocki.BufferSizeOk()) continue;
3858 AliHLTUInt32_t maxPairs = totalTrackCount * (totalTrackCount-1) / 2;
3859 const AliHLTMUONPairsDecisionBlockStruct& hdr = inblocki.BlockHeader();
3860 const AliHLTComponentBlockData* block = pairDecisionBlocks[bi];
3861 if (IsScalarTooLarge(block, bi, "track pair", "fNunlikeAnyPt", hdr.fNunlikeAnyPt, maxPairs) or
3862 IsScalarTooLarge(block, bi, "track pair", "fNunlikeLowPt", hdr.fNunlikeLowPt, maxPairs) or
3863 IsScalarTooLarge(block, bi, "track pair", "fNunlikeHighPt", hdr.fNunlikeHighPt, maxPairs) or
3864 IsScalarTooLarge(block, bi, "track pair", "fNlikeAnyPt", hdr.fNlikeAnyPt, maxPairs) or
3865 IsScalarTooLarge(block, bi, "track pair", "fNlikeLowPt", hdr.fNlikeLowPt, maxPairs) or
3866 IsScalarTooLarge(block, bi, "track pair", "fNlikeHighPt", hdr.fNlikeHighPt, maxPairs) or
3867 IsScalarTooLarge(block, bi, "track pair", "fNmassAny", hdr.fNmassAny, maxPairs) or
3868 IsScalarTooLarge(block, bi, "track pair", "fNmassLow", hdr.fNmassLow, maxPairs) or
3869 IsScalarTooLarge(block, bi, "track pair", "fNmassHigh", hdr.fNmassHigh, maxPairs) or
3870 IsScalarALargerThanB(block, bi, "track pair", "fNunlikeLowPt", hdr.fNunlikeLowPt, "fNunlikeHighPt", hdr.fNunlikeHighPt) or
3871 IsScalarALargerThanB(block, bi, "track pair", "fNunlikeAnyPt", hdr.fNunlikeAnyPt, "fNunlikeLowPt", hdr.fNunlikeLowPt) or
3872 IsScalarALargerThanB(block, bi, "track pair", "fNlikeLowPt", hdr.fNlikeLowPt, "fNlikeHighPt", hdr.fNlikeHighPt) or
3873 IsScalarALargerThanB(block, bi, "track pair", "fNlikeAnyPt", hdr.fNlikeAnyPt, "fNlikeLowPt", hdr.fNlikeLowPt) or
3874 IsScalarALargerThanB(block, bi, "track pair", "fNmassLow", hdr.fNmassLow, "fNmassHigh", hdr.fNmassHigh) or
3875 IsScalarALargerThanB(block, bi, "track pair", "fNmassAny", hdr.fNmassAny, "fNmassLow", hdr.fNmassLow)
3878 MarkBlock(blocks, blockOk, blockCount, block);
3881 // Check if all the Manso track IDs in the trigger decision structures exist.
3882 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3886 for (AliHLTUInt32_t bj = 0; bj < mansoTrackBlocksCount and not found; bj++)
3888 AliHLTMUONMansoTracksBlockReader inblockj(mansoTrackBlocks[bj]->fPtr, mansoTrackBlocks[bj]->fSize);
3889 if (not inblockj.BufferSizeOk()) continue;
3891 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3893 if (inblocki[i].fTrackAId == inblockj[j].fId)
3903 HLTError("Problem found with track pair trigger decision"
3904 " data block %d, fDataType = '%s', fPtr = %p and"
3905 " fSize = %u bytes."
3906 " Problem with decision %d in block: The track"
3907 " identifier %d does not exist in any Manso tracks"
3910 DataType2Text(pairDecisionBlocks[bi]->fDataType).c_str(),
3911 pairDecisionBlocks[bi]->fPtr,
3912 pairDecisionBlocks[bi]->fSize,
3913 i, inblocki[i].fTrackAId
3915 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bi]);
3920 for (AliHLTUInt32_t bj = 0; bj < mansoTrackBlocksCount and not found; bj++)
3922 AliHLTMUONMansoTracksBlockReader inblockj(mansoTrackBlocks[bj]->fPtr, mansoTrackBlocks[bj]->fSize);
3923 if (not inblockj.BufferSizeOk()) continue;
3925 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3927 if (inblocki[i].fTrackBId == inblockj[j].fId)
3937 HLTError("Problem found with track pair trigger decision"
3938 " data block %d, fDataType = '%s', fPtr = %p and"
3939 " fSize = %u bytes."
3940 " Problem with decision %d in block: The track"
3941 " identifier %d does not exist in any Manso tracks"
3944 DataType2Text(pairDecisionBlocks[bi]->fDataType).c_str(),
3945 pairDecisionBlocks[bi]->fPtr,
3946 pairDecisionBlocks[bi]->fSize,
3947 i, inblocki[i].fTrackBId
3949 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bi]);
3953 // Check if all the trigger decision structures are unique up to the ID and
3954 // have unique Manso track identifier pairs.
3955 for (AliHLTUInt32_t bj = bi+1; bj < pairDecisionBlocksCount; bj++)
3957 AliHLTMUONPairsDecisionBlockReader inblockj(pairDecisionBlocks[bj]->fPtr, pairDecisionBlocks[bj]->fSize);
3958 if (not inblockj.BufferSizeOk()) continue;
3960 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3961 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3963 if (inblocki[i].fTrackAId == inblockj[j].fTrackAId and
3964 inblocki[i].fTrackBId == inblockj[j].fTrackBId
3967 HLTError("Problem found with track pair trigger decision"
3968 " data block %d, fDataType = '%s', fPtr = %p and"
3969 " fSize = %u bytes, and track pair trigger decision"
3971 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3972 " Problem: The trigger decision %d in block %d and entry"
3973 " %d in block %d have the same Manso track identifier pair,"
3974 " but the pair should be unique.",
3976 DataType2Text(pairDecisionBlocks[bi]->fDataType).c_str(),
3977 pairDecisionBlocks[bi]->fPtr,
3978 pairDecisionBlocks[bi]->fSize,
3980 DataType2Text(pairDecisionBlocks[bj]->fDataType).c_str(),
3981 pairDecisionBlocks[bj]->fPtr,
3982 pairDecisionBlocks[bj]->fSize,
3986 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bi]);
3987 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bj]);
3990 AliHLTMUONPairDecisionStruct a = inblocki[i];
3991 AliHLTMUONPairDecisionStruct b = inblockj[j];
3992 a.fTrackAId = a.fTrackBId = b.fTrackAId = b.fTrackBId = -1;
3995 HLTError("Problem found with track pair trigger decision"
3996 " data block %d, fDataType = '%s', fPtr = %p and"
3997 " fSize = %u bytes, and track pair trigger decision"
3999 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
4000 " Problem: The trigger decision %d in block %d and entry"
4001 " %d in block %d have the same data."
4002 " The data may have been duplicated.",
4004 DataType2Text(pairDecisionBlocks[bi]->fDataType).c_str(),
4005 pairDecisionBlocks[bi]->fPtr,
4006 pairDecisionBlocks[bi]->fSize,
4008 DataType2Text(pairDecisionBlocks[bj]->fDataType).c_str(),
4009 pairDecisionBlocks[bj]->fPtr,
4010 pairDecisionBlocks[bj]->fSize,
4014 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bi]);
4015 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bj]);