1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
6 * Artur Szostak <artursz@iafrica.com> *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 /* $Id: AliHLTMUONDataCheckerComponent.cxx 26179 2008-05-29 22:27:27Z aszostak $ */
20 /// @file AliHLTMUONDataCheckerComponent.cxx
21 /// @author Artur Szostak <artursz@iafrica.com>
23 /// @brief Implementation of the dHLT data integrity checker component.
25 /// This component is used to check the data integrity of dHLT raw internal data
26 /// blocks. If there are any problems found then an appropriate error message is
30 #include "AliHLTMUONDataCheckerComponent.h"
31 #include "AliHLTMUONConstants.h"
32 #include "AliHLTLogging.h"
33 #include "AliHLTSystem.h"
34 #include "AliHLTDefinitions.h"
35 #include "AliRawDataHeader.h"
36 #include "AliMUONConstants.h"
37 #include "AliMUONTrackerDDLDecoder.h"
38 #include "AliMUONTrackerDDLDecoderEventHandler.h"
39 #include "AliMUONTriggerDDLDecoder.h"
40 #include "AliMUONTriggerDDLDecoderEventHandler.h"
41 #include "AliMpDDLStore.h"
42 #include "AliMpDEStore.h"
43 #include "AliMpDEManager.h"
44 #include "AliMpBusPatch.h"
45 #include "AliMpDetElement.h"
46 #include "AliMpSegmentation.h"
47 #include "AliMpVSegmentation.h"
59 * Routine to check if at least one corresponding DDL has been marked
60 * for a particular chamber.
62 bool ChamberMarkedInDDLList(AliHLTInt32_t chamber, bool ddl[22])
64 if (chamber < 0 or chamber > 21) return false;
67 case 0: return ddl[0] or ddl[1];
68 case 1: return ddl[2] or ddl[3];
69 case 2: return ddl[4] or ddl[5];
70 case 3: return ddl[6] or ddl[7];
71 case 4: return ddl[8] or ddl[9] or ddl[10] or ddl[11];
72 case 5: return ddl[8] or ddl[9] or ddl[10] or ddl[11];
73 case 6: return ddl[12] or ddl[13];
74 case 7: return ddl[14] or ddl[15];
75 case 8: return ddl[16] or ddl[17];
76 case 9: return ddl[18] or ddl[19];
77 case 10: return ddl[20] or ddl[21];
78 case 11: return ddl[20] or ddl[21];
79 case 12: return ddl[20] or ddl[21];
80 case 13: return ddl[20] or ddl[21];
81 default: return false;
88 ClassImp(AliHLTMUONDataCheckerComponent)
91 AliHLTMUONDataCheckerComponent::AliHLTMUONDataCheckerComponent() :
92 AliHLTMUONProcessor(),
96 fFilterBadBlocks(false),
97 fNoGlobalChecks(false),
98 fWarnForUnexpecedBlock(false),
101 /// Default constructor.
105 AliHLTMUONDataCheckerComponent::~AliHLTMUONDataCheckerComponent()
107 /// Default destructor.
110 const char* AliHLTMUONDataCheckerComponent::GetComponentID()
112 /// Inherited from AliHLTComponent. Returns the component ID.
114 return AliHLTMUONConstants::DataCheckerComponentId();
118 void AliHLTMUONDataCheckerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
120 /// Inherited from AliHLTProcessor. Returns the list of expected input data types.
121 /// At the moment this list is "any data type" 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 // Inherit the parents functionality.
168 int result = AliHLTMUONProcessor::DoInit(argc, argv);
169 if (result != 0) return result;
171 // Initialise flags with default values.
174 fDontForward = false;
175 fFilterBadBlocks = false;
176 fNoGlobalChecks = false;
177 fWarnForUnexpecedBlock = false;
178 fReturnError = false;
180 for (int i = 0; i < argc; i++)
182 if (ArgumentAlreadyHandled(i, argv[i])) continue;
184 if (strcmp(argv[i], "-ignoretype") == 0)
187 HLTInfo("Ignoring data type of data blocks as given by framework.");
190 if (strcmp(argv[i], "-ignorespec") == 0)
193 HLTInfo("Ignoring data specification of data blocks as given by framework.");
196 if (strcmp(argv[i], "-dontforward") == 0)
199 HLTInfo("Not forwarding input data blocks.");
202 if (strcmp(argv[i], "-filter") == 0)
204 fFilterBadBlocks = true;
205 HLTInfo("Passing only bad blocks to output.");
208 if (strcmp(argv[i], "-no_global_check") == 0)
210 fNoGlobalChecks = true;
211 HLTInfo("Only per block data consistancy checks will be applied,"
212 " but no global checks will be made."
216 if (strcmp(argv[i], "-warn_on_unexpected_block") == 0)
218 fWarnForUnexpecedBlock = true;
221 if (strcmp(argv[i], "-return_error") == 0)
227 HLTError("Unknown option '%s'.", argv[i]);
235 int AliHLTMUONDataCheckerComponent::DoDeinit()
237 /// Inherited from AliHLTComponent. Performs a cleanup of the component.
239 HLTInfo("Deinitialising dHLT data checker component.");
244 int AliHLTMUONDataCheckerComponent::DoEvent(
245 const AliHLTComponentEventData& evtData,
246 const AliHLTComponentBlockData* blocks,
247 AliHLTComponentTriggerData& trigData,
248 AliHLTUInt8_t* /*outputPtr*/,
249 AliHLTUInt32_t& size,
250 AliHLTComponentBlockDataList& outputBlocks
253 /// Inherited from AliHLTProcessor. Processes the new event data.
254 /// Here we go through the list of input data blocks and apply extensive
255 /// data integrity checking on the data found.
257 if (not IsDataEvent()) return 0;
259 HLTDebug("Processing event %llu with %u input data blocks.",
260 evtData.fEventID, evtData.fBlockCnt
263 // Allocate an array of flags indicating if the data block is OK or not,
264 // also arrays to store specific.
265 bool dataProblems = false;
266 bool* blockOk = NULL;
267 typedef const AliHLTComponentBlockData* PAliHLTComponentBlockData;
268 PAliHLTComponentBlockData* trigRecBlocks = NULL;
269 PAliHLTComponentBlockData* trigRecDebugBlocks = NULL;
270 PAliHLTComponentBlockData* hitBlocks = NULL;
271 PAliHLTComponentBlockData* clusterBlocks = NULL;
272 PAliHLTComponentBlockData* channelBlocks = NULL;
273 PAliHLTComponentBlockData* mansoTrackBlocks = NULL;
274 PAliHLTComponentBlockData* mansoCandidateBlocks = NULL;
275 PAliHLTComponentBlockData* singleDecisionBlocks = NULL;
276 PAliHLTComponentBlockData* pairDecisionBlocks = NULL;
277 AliHLTUInt32_t trigRecBlocksCount = 0;
278 AliHLTUInt32_t trigRecDebugBlocksCount = 0;
279 AliHLTUInt32_t hitBlocksCount = 0;
280 AliHLTUInt32_t clusterBlocksCount = 0;
281 AliHLTUInt32_t channelBlocksCount = 0;
282 AliHLTUInt32_t mansoTrackBlocksCount = 0;
283 AliHLTUInt32_t mansoCandidateBlocksCount = 0;
284 AliHLTUInt32_t singleDecisionBlocksCount = 0;
285 AliHLTUInt32_t pairDecisionBlocksCount = 0;
288 blockOk = new bool[evtData.fBlockCnt];
289 trigRecBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
290 trigRecDebugBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
291 hitBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
292 clusterBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
293 channelBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
294 mansoTrackBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
295 mansoCandidateBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
296 singleDecisionBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
297 pairDecisionBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
299 catch (const std::bad_alloc&)
301 HLTError("Could not allocate more memory for internal arrays.");
302 // Make sure to clean up if partially allocated memory.
303 if (blockOk != NULL) delete [] blockOk;
304 if (trigRecBlocks != NULL) delete [] trigRecBlocks;
305 if (trigRecDebugBlocks != NULL) delete [] trigRecDebugBlocks;
306 if (hitBlocks != NULL) delete [] hitBlocks;
307 if (clusterBlocks != NULL) delete [] clusterBlocks;
308 if (channelBlocks != NULL) delete [] channelBlocks;
309 if (mansoTrackBlocks != NULL) delete [] mansoTrackBlocks;
310 if (mansoCandidateBlocks != NULL) delete [] mansoCandidateBlocks;
311 if (singleDecisionBlocks != NULL) delete [] singleDecisionBlocks;
312 if (pairDecisionBlocks != NULL) delete [] pairDecisionBlocks;
316 AliHLTComponentDataType anyPrivateType = AliHLTComponentDataTypeInitializer(
317 kAliHLTAnyDataType, kAliHLTDataOriginPrivate
322 // Clear all the flags indicating if the blocks are ok.
323 for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
328 for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
330 HLTDebug("Handling block: %u, with fDataType = '%s', fPtr = %p and fSize = %u bytes.",
331 n, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fPtr, blocks[n].fSize
334 AliHLTMUONDataBlockType blockType = kUnknownDataBlock;
338 // Decode the block type if we must ignore the block type
339 // as given by the HLT framework.
340 if (blocks[n].fSize >= sizeof(AliHLTMUONDataBlockHeader))
342 const AliHLTMUONDataBlockHeader* header =
343 reinterpret_cast<const AliHLTMUONDataBlockHeader*>(blocks[n].fPtr);
344 blockType = AliHLTMUONDataBlockType(header->fType);
349 if (blocks[n].fDataType == anyPrivateType)
351 // Completely ignore any private HLT internal block types.
355 else if (blocks[n].fDataType == AliHLTMUONConstants::DDLRawDataType())
357 blockOk[n] = CheckRawDataBlock(blocks[n], n);
360 else if (blocks[n].fDataType == AliHLTMUONConstants::TriggerRecordsBlockDataType())
362 blockType = kTriggerRecordsDataBlock;
364 else if (blocks[n].fDataType == AliHLTMUONConstants::TrigRecsDebugBlockDataType())
366 blockType = kTrigRecsDebugDataBlock;
368 else if (blocks[n].fDataType == AliHLTMUONConstants::RecHitsBlockDataType())
370 blockType = kRecHitsDataBlock;
372 else if (blocks[n].fDataType == AliHLTMUONConstants::ClusterBlockDataType())
374 blockType = kClustersDataBlock;
376 else if (blocks[n].fDataType == AliHLTMUONConstants::ChannelBlockDataType())
378 blockType = kChannelsDataBlock;
380 else if (blocks[n].fDataType == AliHLTMUONConstants::MansoTracksBlockDataType())
382 blockType = kMansoTracksDataBlock;
384 else if (blocks[n].fDataType == AliHLTMUONConstants::MansoCandidatesBlockDataType())
386 blockType = kMansoCandidatesDataBlock;
388 else if (blocks[n].fDataType == AliHLTMUONConstants::SinglesDecisionBlockDataType())
390 blockType = kSinglesDecisionDataBlock;
392 else if (blocks[n].fDataType == AliHLTMUONConstants::PairsDecisionBlockDataType())
394 blockType = kPairsDecisionDataBlock;
398 // Log a message indicating that we got a data block that we
399 // do not know how to handle.
400 if (fWarnForUnexpecedBlock)
401 HLTWarning("Received a data block of a type we cannot"
402 " handle: '%s', spec: 0x%8.8X",
403 DataType2Text(blocks[n].fDataType).c_str(),
404 blocks[n].fSpecification
408 HLTDebug("Received a data block of a type we cannot"
409 " handle: '%s', spec: 0x%8.8X",
410 DataType2Text(blocks[n].fDataType).c_str(),
411 blocks[n].fSpecification
419 case kTriggerRecordsDataBlock:
420 blockOk[n] = CheckTriggerRecordsBlock(blocks[n], n);
421 trigRecBlocks[trigRecBlocksCount++] = &blocks[n];
423 case kTrigRecsDebugDataBlock:
424 blockOk[n] = CheckTrigRecsDebugBlock(blocks[n], n);
425 trigRecDebugBlocks[trigRecDebugBlocksCount++] = &blocks[n];
427 case kRecHitsDataBlock:
428 blockOk[n] = CheckRecHitsBlock(blocks[n], n);
429 hitBlocks[hitBlocksCount++] = &blocks[n];
431 case kClustersDataBlock:
432 blockOk[n] = CheckClustersBlock(blocks[n], n);
433 clusterBlocks[clusterBlocksCount++] = &blocks[n];
435 case kChannelsDataBlock:
436 blockOk[n] = CheckChannelsBlock(blocks[n], n);
437 channelBlocks[channelBlocksCount++] = &blocks[n];
439 case kMansoTracksDataBlock:
440 blockOk[n] = CheckMansoTracksBlock(blocks[n], n);
441 mansoTrackBlocks[mansoTrackBlocksCount++] = &blocks[n];
443 case kMansoCandidatesDataBlock:
444 blockOk[n] = CheckMansoCandidatesBlock(blocks[n], n);
445 mansoCandidateBlocks[mansoCandidateBlocksCount++] = &blocks[n];
447 case kSinglesDecisionDataBlock:
448 blockOk[n] = CheckSinglesDecisionBlock(blocks[n], n);
449 singleDecisionBlocks[singleDecisionBlocksCount++] = &blocks[n];
451 case kPairsDecisionDataBlock:
452 blockOk[n] = CheckPairsDecisionBlock(blocks[n], n);
453 pairDecisionBlocks[pairDecisionBlocksCount++] = &blocks[n];
456 HLTDebug("Received a data block for which we could not decode the data type."
457 " fDataType = '%s', fSpecification = 0x%8.8X, fSize = %u bytes.",
458 DataType2Text(blocks[n].fDataType).c_str(),
459 blocks[n].fSpecification,
466 // Apply the global data consistancy checks if not suppressed by the user.
467 if (not fNoGlobalChecks)
470 blocks, blockOk, evtData.fBlockCnt,
471 trigRecBlocks, trigRecBlocksCount,
472 trigRecDebugBlocks, trigRecDebugBlocksCount,
473 hitBlocks, hitBlocksCount,
474 clusterBlocks, clusterBlocksCount,
475 channelBlocks, channelBlocksCount,
476 mansoTrackBlocks, mansoTrackBlocksCount,
477 mansoCandidateBlocks, mansoCandidateBlocksCount,
478 singleDecisionBlocks, singleDecisionBlocksCount,
479 pairDecisionBlocks, pairDecisionBlocksCount
483 // Forward the input data blocks if we have not been asked to drop them.
484 // Also remember to filter for bad blocks if so specified.
485 if (not fDontForward)
487 for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
489 if (fFilterBadBlocks and blockOk[n]) continue;
490 outputBlocks.push_back(blocks[n]);
494 // Set dataProblems flag is there was at least one block with problems.
495 for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
497 if (not blockOk[n]) dataProblems = true;
502 // make sure to cleanup memory
504 delete [] trigRecBlocks;
505 delete [] trigRecDebugBlocks;
507 delete [] clusterBlocks;
508 delete [] channelBlocks;
509 delete [] mansoTrackBlocks;
510 delete [] mansoCandidateBlocks;
511 delete [] singleDecisionBlocks;
512 delete [] pairDecisionBlocks;
515 // Finally we set the total size of output memory we consumed, which is
516 // zero since we just copied the input descriptors to output if anything.
519 if (dataProblems and DumpDataOnError()) DumpEvent(evtData, trigData);
523 // If we were requested to return errors if there were integrity
524 // problems then check if any data blocks had problems and return
526 if (dataProblems) return -EFAULT;
532 bool AliHLTMUONDataCheckerComponent::IsSpecificationValid(
533 const AliHLTComponentBlockData& block,
534 AliHLTUInt32_t blockNumber,
538 /// Checks if the specification bits are valid.
539 /// \param block The block whose specification should be checked.
540 /// \param blockNumber The block index number being checked.
541 /// \param name The name of the type of block being checked.
542 /// \returns true if the specification is valid and false otherwise.
544 if (AliHLTMUONUtils::IsSpecValid(block.fSpecification))
547 HLTError("Problem found with data block %d, fDataType = '%s',"
548 " fPtr = %p and fSize = %u bytes."
549 " Assuming this is a %s data block."
550 " Problem: The specification does not contain a valid pattern,"
551 " received 0x%8.8X for the specification.",
553 DataType2Text(block.fDataType).c_str(),
563 bool AliHLTMUONDataCheckerComponent::IsFromTrackerOnly(
564 const AliHLTComponentBlockData& block,
565 AliHLTUInt32_t blockNumber,
569 /// Checks if the specification bits are valid and indicate the block
570 /// contains data or information only from the tracker DDLs.
571 /// \param block The block whose specification should be checked.
572 /// \param blockNumber The block index number being checked.
573 /// \param name The name of the type of block being checked.
574 /// \returns true if the specification indicates data is only from tracker.
576 bool result = IsSpecificationValid(block, blockNumber, name);
578 if (AliHLTMUONUtils::ContainsDataFromTracker(block.fSpecification) and
579 not AliHLTMUONUtils::ContainsDataFromTrigger(block.fSpecification)
585 HLTError("Problem found with data block %d, fDataType = '%s',"
586 " fPtr = %p and fSize = %u bytes."
587 " Assuming this is a %s data block."
588 " Problem: The data block does not contain data only from the"
589 " tracker DDLs as expected."
590 " Received 0x%8.8X for the specification.",
592 DataType2Text(block.fDataType).c_str(),
602 bool AliHLTMUONDataCheckerComponent::IsFromTriggerOnly(
603 const AliHLTComponentBlockData& block,
604 AliHLTUInt32_t blockNumber,
608 /// Checks if the specification bits are valid and indicate the block
609 /// contains data or information only from the trigger DDLs.
610 /// \param block The block whose specification should be checked.
611 /// \param blockNumber The block index number being checked.
612 /// \param name The name of the type of block being checked.
613 /// \returns true if the specification indicates data is only from trigger.
615 bool result = IsSpecificationValid(block, blockNumber, name);
617 if (AliHLTMUONUtils::ContainsDataFromTrigger(block.fSpecification) and
618 not AliHLTMUONUtils::ContainsDataFromTracker(block.fSpecification)
624 HLTError("Problem found with data block %d, fDataType = '%s',"
625 " fPtr = %p and fSize = %u bytes."
626 " Assuming this is a %s data block."
627 " Problem: The data block does not contain data only from the"
628 " trigger DDLs as expected."
629 " Received 0x%8.8X for the specification.",
631 DataType2Text(block.fDataType).c_str(),
641 bool AliHLTMUONDataCheckerComponent::IsMomentumVectorOk(
642 const AliHLTComponentBlockData& block,
643 AliHLTUInt32_t blockNumber,
645 AliHLTUInt32_t entryNumber,
651 /// Checks if the momentum vector is reasonable.
652 /// \param block The block from which the momentum vector data comes from.
653 /// \param blockNumber The block index number.
654 /// \param name The name of the type of block.
655 /// \param entryNumber The entry index number of the structure holding
656 /// the momentum vector data.
657 /// \param px The X coordinate of the momentum vector (GeV/c).
658 /// \param py The Y coordinate of the momentum vector (GeV/c).
659 /// \param pz The Z coordinate of the momentum vector (GeV/c).
660 /// \returns true if the momentum vector is valid and false otherwise.
662 // If the momentum vector is nil then ignore it.
663 if (px == 0 and py == 0 and pz == 0) return true;
667 // If the momentum vector is sane then we should not have a particle with
668 // more energy than 14 TeV and momentum should be in the negative direction.
669 double momentum = sqrt(px*px + py*py + pz*pz);
672 // Just warn since this is a data sanity problem rather
673 // than a data integrity problem.
674 HLTWarning("Problem found with data block %d, fDataType = '%s',"
675 " fPtr = %p and fSize = %u bytes."
676 " Assuming this is a %s data block."
677 " Problem with entry %d in block: The momentum vector"
678 " p = {%f, %f, %f}, |p| = %f looks too big.",
680 DataType2Text(block.fDataType).c_str(),
693 // Just warn since this is a data sanity problem rather
694 // than a data integrity problem.
695 HLTWarning("Problem found with data block %d, fDataType = '%s',"
696 " fPtr = %p and fSize = %u bytes."
697 " Assuming this is a %s data block."
698 " Problem with entry %d in block: The momentum vector"
699 " p = {%f, %f, %f} points away from the dimuon"
700 " spectrometer (p_z > 0).",
702 DataType2Text(block.fDataType).c_str(),
716 bool AliHLTMUONDataCheckerComponent::AreMomentumCalcParamsOk(
717 const AliHLTComponentBlockData& block,
718 AliHLTUInt32_t blockNumber,
720 AliHLTUInt32_t entryNumber,
721 AliHLTFloat32_t zmiddle,
725 /// Checks if the parameters for the momentum calculation are reasonable.
726 /// \param block The block from which the parameter data comes from.
727 /// \param blockNumber The block index number.
728 /// \param name The name of the type of block.
729 /// \param entryNumber The entry index number of the structure holding
730 /// the parameter data data.
731 /// \param zmiddle The z-coordinate of the middle of the magnetic field (cm).
732 /// \param bl The integrated magnetic field (T.m).
733 /// \returns true if the parameters are valid and false otherwise.
737 // Check that the value of the fZmiddle value is somewhere
738 // within the tracking / dipole magnetic field area.
739 if (zmiddle < AliMUONConstants::AbsZEnd() or
740 zmiddle < AliMUONConstants::MuonFilterZBeg()
743 // Just warn since this is a data sanity problem rather
744 // than a data integrity problem.
745 HLTWarning("Problem found with data block %d, fDataType = '%s',"
746 " fPtr = %p and fSize = %u bytes."
747 " Assuming this is a %s data block."
748 " Problem with entry %d in block: The Z coordinate %f cm"
749 " used as the middle of the magnetic field in the momentum"
750 " calculation is outside the dimuon spectrometers dipole"
751 " magnetic field volume.",
753 DataType2Text(block.fDataType).c_str(),
763 // Also check that the value of the 'bl' value is within a
764 // reasonable range: |bl| < Lmax * Bmax, where
765 // Lmax = max length from vertex to end of spectrometer, and
766 // Bmax = max magnetic field of dipole, taken as 1 tesla.
767 // Approximating Lmax * Bmax as 20 T.m
770 // Just warn since this is a data sanity problem rather
771 // than a data integrity problem.
772 HLTWarning("Problem found with data block %d, fDataType = '%s',"
773 " fPtr = %p and fSize = %u bytes."
774 " Assuming this is a %s data block."
775 " Problem with entry %d in block: The integrated magnetic"
776 " field value %f T.m used in the momentum calculation"
777 " has an unreasonably large absolute value.",
779 DataType2Text(block.fDataType).c_str(),
793 bool AliHLTMUONDataCheckerComponent::IsHitCoordinateOk(
794 const AliHLTComponentBlockData& block,
795 AliHLTUInt32_t blockNumber,
797 AliHLTUInt32_t entryNumber,
798 const AliHLTMUONRecHitStruct& hit,
799 AliHLTInt32_t minChamber,
800 AliHLTInt32_t maxChamber,
801 AliHLTInt32_t expectedChamber,
805 /// Checks if the hit coordinate is compatible with a the location of a
806 /// dimuon spectrometer chamber. Also, if expectedChamber is not -1, then
807 /// the hit coordinate is checked if to comes from that chamber.
808 /// We also check if the fFlags containing the chamber number and detector
809 /// element ID are correct.
810 /// \param block The block from which the hit data comes from.
811 /// \param blockNumber The block index number.
812 /// \param name The name of the type of block.
813 /// \param entryNumber The entry index number of the hit.
814 /// \param hit The hit data being checked.
815 /// \param minChamber The minimum valid chamber number to check for.
816 /// \param maxChamber The maximum valid chamber number to check for.
817 /// \param expectedChamber If not -1 then this is the chamber number to
819 /// \param ddl The array decoded by AliHLTMUONUtils::UnpackSpecBits.
820 /// \returns true if the hit is valid and false otherwise.
822 assert( 0 <= minChamber and minChamber < 14 );
823 assert( 0 <= maxChamber and maxChamber < 14 );
827 AliHLTUInt8_t chNum = 0xFF;
828 AliHLTUInt16_t detElemId = 0xFFFF;
829 AliHLTMUONUtils::UnpackRecHitFlags(hit.fFlags, chNum, detElemId);
831 Int_t chamber = AliMUONConstants::ChamberNumber(hit.fZ, false); // false = do not warn.
832 if (chamber < minChamber or maxChamber < 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 z-coordinate that does not correspond"
839 " to the nominal position of any chambers in the range"
842 DataType2Text(block.fDataType).c_str(),
847 hit.fX, hit.fY, hit.fZ,
854 if (chNum != chamber)
856 HLTError("Problem found with data block %d, fDataType = '%s',"
857 " fPtr = %p and fSize = %u bytes."
858 " Assuming this is a %s data block."
859 " Problem with entry %d in block: The hit {x = %f, y = %f,"
860 " z = %f} cm has a chamber number %d that does not correspond"
861 " to the expected chamber %d given by the z-coordinate.",
863 DataType2Text(block.fDataType).c_str(),
868 hit.fX, hit.fY, hit.fZ,
873 if (minChamber <= Int_t(chNum) and Int_t(chNum) <= maxChamber)
875 // Rather use the explicit value in the data if it
881 if (expectedChamber != -1 and chamber != expectedChamber)
883 HLTError("Problem found with data block %d, fDataType = '%s',"
884 " fPtr = %p and fSize = %u bytes."
885 " Assuming this is a %s data block."
886 " Problem with entry %d in block: The hit {x = %f, y = %f,"
887 " z = %f} cm has a position that corresponds to chamber %d,"
888 " but expected it to be on chamber %d.",
890 DataType2Text(block.fDataType).c_str(),
895 hit.fX, hit.fY, hit.fZ,
902 AliHLTFloat32_t rmin = AliMUONConstants::Rmin(chamber / 2);
903 AliHLTFloat32_t rmax = AliMUONConstants::Rmax(chamber / 2);
904 AliHLTFloat32_t radius = sqrt(hit.fX*hit.fX + hit.fY*hit.fY);
905 if (radius < rmin or rmax < radius)
907 HLTError("Problem found with data block %d, fDataType = '%s',"
908 " fPtr = %p and fSize = %u bytes."
909 " Assuming this is a %s data block."
910 " Problem with entry %d in block: The hit {x = %f, y = %f,"
911 " z = %f} cm has a position in the X-Y plane that does not"
912 " correspond to the nominal position of chamber %d.",
914 DataType2Text(block.fDataType).c_str(),
919 hit.fX, hit.fY, hit.fZ,
925 if (not fIgnoreSpec and not ChamberMarkedInDDLList(chamber, ddl))
927 HLTError("Problem found with data block %d, fDataType = '%s',"
928 " fPtr = %p and fSize = %u bytes."
929 " Assuming this is a %s data block."
930 " Problem with entry %d in block: The hit {x = %f, y = %f,"
931 " z = %f} cm has a position that corresponds to chamber %d"
932 " but the data block specification 0x%8.8X does have a"
933 " corresponding DDL bit set.",
935 DataType2Text(block.fDataType).c_str(),
940 hit.fX, hit.fY, hit.fZ,
947 // Check that the detector element ID is valid and it corresponds to
948 // the chamber number.
949 if (FetchMappingStores() == 0) // are stores loaded?
951 Bool_t warn = kFALSE;
952 AliMpDEStore* store = AliMpDEStore::Instance(warn);
953 AliMpDetElement* de = store->GetDetElement(Int_t(detElemId), warn);
956 HLTError("Problem found with data block %d, fDataType = '%s',"
957 " fPtr = %p and fSize = %u bytes."
958 " Assuming this is a %s data block."
959 " Problem with entry %d in block: The hit {x = %f, y = %f,"
960 " z = %f} cm has a detector element ID %d,"
961 " which is not valid.",
963 DataType2Text(block.fDataType).c_str(),
968 hit.fX, hit.fY, hit.fZ,
974 // Check that the chamber number from the detector element number
975 // has the expected value.
976 Int_t ch = AliMpDEManager::GetChamberId(Int_t(detElemId), warn);
979 HLTError("Problem found with data block %d, fDataType = '%s',"
980 " fPtr = %p and fSize = %u bytes."
981 " Assuming this is a %s data block."
982 " Problem with entry %d in block: The hit {x = %f, y = %f,"
983 " z = %f} cm has a detector element ID %d,"
984 " which does not correspond to the chamber %d.",
986 DataType2Text(block.fDataType).c_str(),
991 hit.fX, hit.fY, hit.fZ,
1000 HLTWarning("Cannot check a hit's detector element ID information"
1001 " without being able to load the mapping from CDB."
1010 bool AliHLTMUONDataCheckerComponent::IsMansoTrackOk(
1011 const AliHLTComponentBlockData& block,
1012 AliHLTUInt32_t blockNumber,
1014 AliHLTUInt32_t entryNumber,
1015 const AliHLTMUONMansoTrackStruct& track,
1019 /// Checks if the Manso track structure is Ok.
1020 /// \param block The block from which the track data comes from.
1021 /// \param blockNumber The block index number.
1022 /// \param name The name of the type of block.
1023 /// \param entryNumber The entry index number of the structure in the
1024 /// block being checked.
1025 /// \param track The Manso track data being checked.
1026 /// \param ddl The array decoded by AliHLTMUONUtils::UnpackSpecBits.
1027 /// \returns true if the hit is valid and false otherwise.
1031 // Chi^2 should not be greater than the worst fit possible, estimated
1032 // as the diameter of largest chamber times the number of points
1033 // findable in a track. Max points is 10 tracker chambers times
1034 // 2 cathodes + 4 trigger chambers.
1035 if (track.fChi2 > AliMUONConstants::Dmax(6)*AliMUONConstants::Dmax(6)*(10*2+4))
1037 // Just a warning since this is not technically an
1038 // integrity problem.
1039 HLTWarning("Problem found with data block %d, fDataType = '%s',"
1040 " fPtr = %p and fSize = %u bytes."
1041 " Assuming this is a %s data block."
1042 " Problem with entry %d in block: The Manso track has"
1043 " the chi squared value of %f that unreasonably big.",
1045 DataType2Text(block.fDataType).c_str(),
1055 // Check if the momentum vector is reasonable.
1056 bool momOk = IsMomentumVectorOk(
1057 block, blockNumber, name, entryNumber,
1058 track.fPx, track.fPy, track.fPz
1060 if (not momOk) result = false;
1062 AliHLTMUONParticleSign sign;
1064 AliHLTMUONUtils::UnpackMansoTrackFlags(track.fFlags, sign, hitset);
1066 // Min and max allowed chamber numbers for hits:
1068 Int_t maxCh = AliMUONConstants::NTrackingCh() - 1;
1070 // Check that this hit coordinates are OK.
1071 for (AliHLTUInt32_t i = 0; i < 4; i++)
1073 if (not hitset[i]) continue; // ignore hits that are not initialised.
1074 bool hitOk = IsHitCoordinateOk(
1075 block, blockNumber, name, entryNumber, track.fHit[i],
1076 minCh, maxCh, i+6, ddl
1078 if (not hitOk) result = false;
1085 bool AliHLTMUONDataCheckerComponent::CheckDetElemIds(
1086 const AliHLTComponentBlockData& infoBlock,
1087 AliHLTUInt32_t infoBlockNumber,
1088 AliHLTUInt32_t infoEntryNumber,
1089 const AliHLTMUONTrigRecInfoStruct& info,
1090 const AliHLTComponentBlockData& trBlock,
1091 AliHLTUInt32_t trBlockNumber,
1092 AliHLTUInt32_t trEntryNumber,
1093 const AliHLTMUONTriggerRecordStruct& tr
1096 /// Checks if the detector element IDs are the same in the debug
1097 /// information structure and the trigger record structure.
1098 /// \param infoBlock The debug information block from which the 'info'
1099 /// data comes from.
1100 /// \param infoBlockNumber The debug information block index number.
1101 /// \param infoEntryNumber The entry index number of the 'info'
1102 /// structure in the debug information data block.
1103 /// \param info The debug information structure being checked.
1104 /// \param trBlock The trigger record block from which the 'tr' data
1106 /// \param trBlockNumber The trigger record block index number.
1107 /// \param trEntryNumber The entry index number of the 'tr' structure
1108 /// in the trigger record data block.
1109 /// \param tr The trigger record structure being checked.
1110 /// \returns true if the detector element IDs are the same and false
1115 for (int i = 0; i < 4; i++)
1117 AliHLTUInt8_t chamber = 0xFF;
1118 AliHLTUInt16_t detElemId = 0xFFFF;
1119 AliHLTMUONUtils::UnpackRecHitFlags(tr.fHit[i].fFlags, chamber, detElemId);
1120 if (info.fDetElemId[i] == detElemId) continue;
1122 HLTError("Problem found with trigger record debug information %d"
1123 " in data block %d (fDataType = '%s', fPtr = %p, fSize"
1124 " = %u bytes) and trigger record %d in data block %d"
1125 " (fDataType = '%s', fPtr = %p, fSize = %u bytes):"
1126 " The detection element ID %d for chamber %d in the debug"
1127 " information, is not the same as %d"
1128 " found in the trigger record.",
1131 DataType2Text(infoBlock.fDataType).c_str(),
1136 DataType2Text(trBlock.fDataType).c_str(),
1150 bool AliHLTMUONDataCheckerComponent::CheckDetElemIds(
1151 const AliHLTComponentBlockData& clusterBlock,
1152 AliHLTUInt32_t clusterBlockNumber,
1153 AliHLTUInt32_t clusterEntryNumber,
1154 const AliHLTMUONClusterStruct& cluster,
1155 const AliHLTComponentBlockData& hitBlock,
1156 AliHLTUInt32_t hitBlockNumber,
1157 AliHLTUInt32_t hitEntryNumber,
1158 const AliHLTMUONRecHitStruct& hit
1161 /// Checks if the detector element IDs are the same in the cluster
1162 /// structure and the reconstructed hit structure.
1163 /// \param clusterBlock The cluster block from which the 'cluster' data
1165 /// \param clusterBlockNumber The cluster block index number.
1166 /// \param clusterEntryNumber The entry index number of the 'cluster'
1167 /// structure in the cluster data block.
1168 /// \param cluster The cluster structure being checked.
1169 /// \param hitBlock The reconstructed hit block from which the 'hit'
1170 /// data comes from.
1171 /// \param hitBlockNumber The reconstructed hit block index number.
1172 /// \param hitEntryNumber The entry index number of the 'hit' structure
1173 /// in the reconstructed hit data block.
1174 /// \param hit The trigger record structure being checked.
1175 /// \returns true if the detector element IDs are the same and false
1180 AliHLTUInt8_t chamber = 0xFF;
1181 AliHLTUInt16_t detElemId = 0xFFFF;
1182 AliHLTMUONUtils::UnpackRecHitFlags(hit.fFlags, chamber, detElemId);
1183 if (cluster.fDetElemId != detElemId)
1185 HLTError("Problem found with cluster %d in data block %d"
1186 " (fDataType = '%s', fPtr = %p, fSize = %u bytes)"
1187 " and reconstructed hit %d in data block %d"
1188 " (fDataType = '%s', fPtr = %p, fSize = %u bytes):"
1189 " The detection element ID %d in the cluster, is not"
1190 " the same as %d found in the reconstructed hit.",
1193 DataType2Text(clusterBlock.fDataType).c_str(),
1198 DataType2Text(hitBlock.fDataType).c_str(),
1214 * Class for logging errors found in raw DDL data.
1216 class AliHLTMUONDecoderHandler : public AliHLTLogging
1220 /// Default constructor
1221 AliHLTMUONDecoderHandler() :
1229 /// Default destructor.
1230 virtual ~AliHLTMUONDecoderHandler() {}
1232 /// Sets the DDL raw data block descriptor.
1233 void SetDescriptor(const AliHLTComponentBlockData* b) { fDescriptor = b; }
1235 /// Sets the block number of the raw data block descriptor.
1236 void SetBlockNumber(AliHLTUInt32_t n) { fBlockNumber = n; }
1238 /// Logs an error message describing the problem with the DDL raw data.
1239 template <typename ErrorCode, class DecoderHandler>
1240 void LogError(ErrorCode code, const void* location, DecoderHandler& handler);
1243 // Do not allow copying of this class.
1245 AliHLTMUONDecoderHandler(const AliHLTMUONDecoderHandler& rhs); // copy constructor
1247 AliHLTMUONDecoderHandler& operator = (const AliHLTMUONDecoderHandler& rhs); // assignment operator
1249 const void* fBufferStart; ///< Pointer to the start of the current DDL payload buffer.
1250 const AliHLTComponentBlockData* fDescriptor; ///< Descriptor for the DDL raw data block corresponding to the buffer.
1251 AliHLTUInt32_t fBlockNumber; ///< The number / index of the block descriptor.
1255 template <typename ErrorCode, class DecoderHandler>
1256 void AliHLTMUONDecoderHandler::LogError(ErrorCode code, const void* location, DecoderHandler& handler)
1258 /// Logs a HLT error message describing the problem with the raw DDL data.
1259 /// \param code The error code describing the problem.
1260 /// \param location A pointer to the location in the raw data buffer
1261 /// where the problem was found.
1262 /// \param handler The decoder handler object.
1264 long bytepos = long(location) - long(fBufferStart) + sizeof(AliRawDataHeader);
1266 // create data type string.
1267 char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2];
1268 memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
1269 strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize );
1270 strcat( dataType, ":" );
1271 strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize );
1273 HLTError("Problem found with data block %d, fDataType = '%s',"
1274 " fPtr = %p and fSize = %u bytes."
1275 " Assuming this is a DDL raw data block."
1276 " Problem: %s (Error code: %d, at byte %d)",
1281 handler.ErrorCodeToMessage(code),
1289 * Class for logging decoding errors when checking tracker raw DDL data.
1290 * Used in the AliHLTMUONDataCheckerComponent::CheckRawDataBlock method.
1292 class AliHLTMUONTrackerDecoderHandler :
1293 public AliMUONTrackerDDLDecoderEventHandler, public AliHLTMUONDecoderHandler
1296 AliHLTMUONTrackerDecoderHandler() :
1297 AliMUONTrackerDDLDecoderEventHandler(),
1298 AliHLTMUONDecoderHandler(),
1302 fCurrentBusPatch(0),
1303 fDataProblems(false)
1306 virtual ~AliHLTMUONTrackerDecoderHandler()
1308 if (fDigits != NULL) delete [] fDigits;
1311 /// Structure to store raw data words found in the raw data.
1314 UInt_t fBusPatchId; ///< Bus patch ID for the data word.
1315 UInt_t fDataWord; ///< Raw data word found in the DDL payload.
1318 /// Returns the number of digits found.
1319 UInt_t DigitCount() const { return fDigitCount; }
1321 /// Returns the array of digits found.
1322 const AliDigit* Digits() const { return fDigits; }
1324 /// Returns true if there were problems with the data.
1325 bool DataProblems() const { return fDataProblems; }
1327 // Methods inherited from AliMUONTrackerDDLDecoderEventHandler:
1329 /// Called for each new buffer.
1330 void OnNewBuffer(const void* buffer, UInt_t bufferSize);
1332 /// Called for each new DSP header.
1333 void OnNewDSP(const AliMUONDSPHeaderStruct* header, const void* /*data*/);
1335 /// Called for each new bus patch. Just marks the current bus patch ID.
1336 void OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* /*data*/)
1338 fCurrentBusPatch = header->fBusPatchId;
1341 /// Called for each new data word found.
1342 void OnData(UInt_t data, bool /*parityError*/);
1344 /// Logs an error message if there was a decoding problem with the DDL payload.
1345 void OnError(ErrorCode code, const void* location)
1347 fDataProblems = true;
1348 LogError(code, location, *this);
1353 // Do not allow copying of this object.
1354 /// Not implemented.
1355 AliHLTMUONTrackerDecoderHandler(const AliHLTMUONTrackerDecoderHandler& obj);
1356 /// Not implemented.
1357 AliHLTMUONTrackerDecoderHandler& operator = (const AliHLTMUONTrackerDecoderHandler& obj);
1359 UInt_t fMaxDigits; ///< Maximum number of digits that can be stored in fDigits.
1360 UInt_t fDigitCount; ///< The number of digits currently stored in fDigits.
1361 AliDigit* fDigits; ///< The array of digits found in the DDL data.
1362 UInt_t fCurrentBusPatch; ///< The current bus patch ID being processed.
1363 bool fDataProblems; ///< flag indicating there were problems with the data.
1367 void AliHLTMUONTrackerDecoderHandler::OnNewBuffer(const void* buffer, UInt_t bufferSize)
1369 /// Called for a new buffer. It will reset internal counters and
1370 /// resize the digits array if necessary.
1372 fDataProblems = false;
1374 fBufferStart = buffer;
1376 // Resize the fDigits array to be able to store
1377 // all the digits in the data buffer.
1378 UInt_t maxSize = bufferSize / sizeof(UInt_t) + 1;
1379 if (maxSize > fMaxDigits)
1381 if (fDigits != NULL)
1389 fDigits = new AliDigit[maxSize];
1390 fMaxDigits = maxSize;
1392 catch (const std::bad_alloc&)
1394 HLTError("Could not allocate enough buffer space for internal arrays.");
1401 void AliHLTMUONTrackerDecoderHandler::OnNewDSP(
1402 const AliMUONDSPHeaderStruct* header, const void* /*data*/
1405 if (header->fPaddingWord != 0 and header->fPaddingWord != 1)
1407 // create data type string.
1408 char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2];
1409 memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
1410 strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize );
1411 strcat( dataType, ":" );
1412 strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize );
1414 HLTError("Problem found with data block %d, fDataType = '%s',"
1415 " fPtr = %p and fSize = %u bytes."
1416 " Assuming this is a tracker DDL raw data block."
1417 " Problem: Found padding word marker 0x%8.8X in DSP"
1418 " header with DSP ID %d which has an invalid value.",
1423 header->fPaddingWord,
1426 fDataProblems = true;
1432 void AliHLTMUONTrackerDecoderHandler::OnData(UInt_t data, bool /*parityError*/)
1434 /// Called for each new data word found. This method will add
1435 /// these to the list of digits and check if they are not duplicated.
1437 assert( fDigits != NULL );
1439 if ((data & 0x60000000) != 0)
1441 // create data type string.
1442 char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2];
1443 memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
1444 strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize );
1445 strcat( dataType, ":" );
1446 strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize );
1448 HLTError("Problem found with data block %d, fDataType = '%s',"
1449 " fPtr = %p and fSize = %u bytes."
1450 " Assuming this is a tracker DDL raw data block."
1451 " Problem: Found a data word 0x%8.8X for bus patch %d"
1452 " whose bits 29 or 30 are not zero.",
1460 fDataProblems = true;
1464 // Check if the data word + bus patch have been duplicated.
1465 for (UInt_t i = 0; i < fDigitCount; i++)
1467 if (fDigits[i].fDataWord == data and fDigits[i].fBusPatchId == fCurrentBusPatch)
1469 // create data type string.
1470 char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2];
1471 memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
1472 strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize );
1473 strcat( dataType, ":" );
1474 strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize );
1476 HLTError("Problem found with data block %d, fDataType = '%s',"
1477 " fPtr = %p and fSize = %u bytes."
1478 " Assuming this is a tracker DDL raw data block."
1479 " Problem: Found a duplicate data word 0x%8.8X for bus patch %d.",
1487 fDataProblems = true;
1492 // Add the data word + bus patch to the list of decoded digits.
1493 if (fDigitCount < fMaxDigits)
1495 fDigits[fDigitCount].fBusPatchId = fCurrentBusPatch;
1496 fDigits[fDigitCount].fDataWord = data;
1502 * Class for logging decoding errors when checking trigger raw DDL data.
1503 * Used in the AliHLTMUONDataCheckerComponent::CheckRawDataBlock method.
1505 class AliHLTMUONTriggerDecoderHandler :
1506 public AliMUONTriggerDDLDecoderEventHandler, public AliHLTMUONDecoderHandler
1509 // Methods inherited from AliMUONTriggerDDLDecoderEventHandler:
1511 /// Called for each new buffer.
1512 void OnNewBuffer(const void* buffer, UInt_t /*bufferSize*/)
1514 fBufferStart = buffer;
1517 /// Logs an error message if there was a decoding problem with the DDL payload.
1518 void OnError(ErrorCode code, const void* location)
1520 LogError(code, location, *this);
1524 } // end of namespace
1527 bool AliHLTMUONDataCheckerComponent::CheckRawDataBlock(
1528 const AliHLTComponentBlockData& block,
1529 AliHLTUInt32_t blockNumber
1532 /// Checks the validity of a raw data block.
1538 HLTWarning("Not able to check DDL raw data if -ignorespec is specified.");
1543 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
1545 // Check that only one DDL was marked in the specification.
1547 for (int i = 0; i < 22; i++)
1549 if (not ddl[i]) continue;
1557 HLTError("Problem found with data block %d, fDataType = '%s',"
1558 " fPtr = %p and fSize = %u bytes."
1559 " Assuming this is a DDL raw data block."
1560 " Problem: The specification indicates multiple"
1561 " DDL sources, DDL %d and %d.",
1563 DataType2Text(block.fDataType).c_str(),
1572 // Check the DDL common data header.
1573 AliHLTUInt32_t totalDDLSize = block.fSize;
1574 if (totalDDLSize < sizeof(AliRawDataHeader))
1576 HLTError("Problem found with data block %d, fDataType = '%s',"
1577 " fPtr = %p and fSize = %u bytes."
1578 " Assuming this is a DDL raw data block."
1579 " Problem: The size of the data block is too short to contain"
1580 " a valid common DDL data header. Size of buffer is only %d"
1581 " bytes, but expected at least %d bytes.",
1583 DataType2Text(block.fDataType).c_str(),
1587 sizeof(AliRawDataHeader)
1592 const AliRawDataHeader* header =
1593 reinterpret_cast<const AliRawDataHeader*>(block.fPtr);
1595 if (header->GetVersion() != 2)
1597 HLTError("Problem found with data block %d, fDataType = '%s',"
1598 " fPtr = %p and fSize = %u bytes."
1599 " Assuming this is a DDL raw data block."
1600 " Problem: The common DDL data header indicates an"
1601 " incorrect version number. Expected 2 but got %d.",
1603 DataType2Text(block.fDataType).c_str(),
1606 int( header->GetVersion() )
1611 if (header->fSize != 0xFFFFFFFF and header->fSize != block.fSize)
1613 HLTError("Problem found with data block %d, fDataType = '%s',"
1614 " fPtr = %p and fSize = %u bytes."
1615 " Assuming this is a DDL raw data block."
1616 " Problem: The common DDL data header indicates an"
1617 " incorrect DDL buffer size. Expected %d bytes but"
1618 " size reported in header is %d bytes.",
1620 DataType2Text(block.fDataType).c_str(),
1629 if (header->fSize != 0xFFFFFFFF and header->fSize != block.fSize)
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 indicates an"
1635 " incorrect DDL buffer size. Expected %d bytes but"
1636 " size reported in header is %d bytes.",
1638 DataType2Text(block.fDataType).c_str(),
1647 // Check that the bits that should be zero in the CDH are infact zero.
1648 if ((header->fWord2 & 0x00C03000) != 0 or
1649 (header->fEventID2 & 0xFF000000) != 0 or
1650 (header->fStatusMiniEventID & 0xF0000000) != 0 or
1651 (header->fROILowTriggerClassHigh & 0x0FFC0000) != 0
1654 HLTError("Problem found with data block %d, fDataType = '%s',"
1655 " fPtr = %p and fSize = %u bytes."
1656 " Assuming this is a DDL raw data block."
1657 " Problem: The common DDL data header has non-zero"
1658 " bits that are reserved and must be set to zero.",
1660 DataType2Text(block.fDataType).c_str(),
1667 AliHLTUInt32_t payloadSize = block.fSize - sizeof(AliRawDataHeader);
1668 const AliHLTUInt8_t* payload =
1669 reinterpret_cast<const AliHLTUInt8_t*>(header + 1);
1671 if (AliHLTMUONUtils::IsTriggerDDL(block.fSpecification))
1673 bool scalarEvent = ((header->GetL1TriggerMessage() & 0x1) == 0x1);
1674 AliMUONTriggerDDLDecoder<AliHLTMUONTriggerDecoderHandler> decoder;
1675 decoder.ExitOnError(false);
1676 decoder.TryRecover(false);
1677 decoder.AutoDetectScalars(false);
1678 decoder.GetHandler().SetDescriptor(&block);
1679 decoder.GetHandler().SetBlockNumber(blockNumber);
1680 result = decoder.Decode(payload, payloadSize, scalarEvent);
1682 else if (AliHLTMUONUtils::IsTrackerDDL(block.fSpecification))
1684 AliMUONTrackerDDLDecoder<AliHLTMUONTrackerDecoderHandler> decoder;
1685 decoder.ExitOnError(false);
1686 decoder.TryRecover(false);
1687 decoder.SendDataOnParityError(true);
1688 decoder.AutoDetectTrailer(true);
1689 decoder.CheckForTrailer(true);
1690 decoder.GetHandler().SetDescriptor(&block);
1691 decoder.GetHandler().SetBlockNumber(blockNumber);
1692 result = decoder.Decode(payload, payloadSize);
1693 if (decoder.GetHandler().DataProblems()) result = false;
1695 if (FetchMappingStores() == 0) // are stores loaded?
1697 Bool_t warn = kFALSE;
1698 AliMpDDLStore* ddlStore = AliMpDDLStore::Instance(warn);
1700 // Check that the bus patch, manu ID and channel addresses are valid
1701 // for each raw data word.
1702 for (UInt_t i = 0; i < decoder.GetHandler().DigitCount(); i++)
1704 UInt_t busPatchId = decoder.GetHandler().Digits()[i].fBusPatchId;
1705 UInt_t dataWord = decoder.GetHandler().Digits()[i].fDataWord;
1707 UShort_t manuId; UChar_t channelId; UShort_t adc;
1708 AliMUONTrackerDDLDecoderEventHandler::UnpackADC(
1709 dataWord, manuId, channelId, adc
1712 // Check if the bus patch is valid.
1713 AliMpBusPatch* busPatch = ddlStore->GetBusPatch(busPatchId, warn);
1714 if (busPatch == NULL)
1716 HLTError("Problem found with data block %d, fDataType = '%s',"
1717 " fPtr = %p and fSize = %u bytes."
1718 " Assuming this is a tracker DDL raw data block."
1719 " Problem: Found a bus patch identifier %d that"
1722 DataType2Text(block.fDataType).c_str(),
1731 // We can check that the bus patch is for the DDL
1732 // which is also indicated by the specification bits.
1733 if (not fIgnoreSpec and busPatch->GetDdlId() != ddlIndex)
1735 HLTError("Problem found with data block %d, fDataType = '%s',"
1736 " fPtr = %p and fSize = %u bytes."
1737 " Assuming this is a tracker DDL raw data block."
1738 " Problem: Found a bus patch identifier %d for"
1739 " DDL %d, but the data block specification 0x%8.8X"
1740 " indicates a different DDL of %d.",
1742 DataType2Text(block.fDataType).c_str(),
1746 busPatch->GetDdlId(),
1747 block.fSpecification,
1754 // Check if the MANU ID is valid.
1755 if (not busPatch->HasManu(manuId))
1757 HLTError("Problem found with data block %d, fDataType = '%s',"
1758 " fPtr = %p and fSize = %u bytes."
1759 " Assuming this is a tracker DDL raw data block."
1760 " Problem: Found a MANU identifier %d on bus patch %d"
1761 " that is not valid.",
1763 DataType2Text(block.fDataType).c_str(),
1773 // Now try to fetch the detector element to check the MANU channel.
1774 AliMpDetElement* de = ddlStore->GetDetElement(busPatch->GetDEId(), warn);
1777 HLTError("Problem found with data block %d, fDataType = '%s',"
1778 " fPtr = %p and fSize = %u bytes."
1779 " Assuming this is a tracker DDL raw data block."
1780 " Problem: Found a bus patch identifier %d that"
1781 " does not correspond to a detector element.",
1783 DataType2Text(block.fDataType).c_str(),
1792 if (not de->IsConnectedChannel(manuId, channelId))
1794 // Just a warning because this is marked not
1795 // to be an error in the AliMUONDigitMaker.
1796 HLTWarning("Problem found with data block %d, fDataType = '%s',"
1797 " fPtr = %p and fSize = %u bytes."
1798 " Assuming this is a tracker DDL raw data block."
1799 " Problem: Found a channel with address %d on"
1800 " MANU ID %d and bus patch %d that is not connected.",
1802 DataType2Text(block.fDataType).c_str(),
1813 // Need to also load the correct segmentation to check the channel.
1814 const AliMpVSegmentation* seg =
1815 AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(
1816 busPatch->GetDEId(), manuId
1820 HLTError("Could not load segmentation for detector element %d"
1822 busPatch->GetDEId(), manuId
1828 #ifndef HAVE_NOT_MUON_ALIMPPAD_GETPOSITION
1829 AliMpPad pad = seg->PadByLocation(manuId, channelId, warn);
1830 #else // old AliMpPad functionality < r 31742
1831 AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId, channelId), warn);
1832 #endif //HAVE_NOT_MUON_ALIMPPAD_GETPOSITION
1833 if (not pad.IsValid())
1835 HLTError("Problem found with data block %d, fDataType = '%s',"
1836 " fPtr = %p and fSize = %u bytes."
1837 " Assuming this is a tracker DDL raw data block."
1838 " Problem: Found a channel with address %d on"
1839 " MANU ID %d and bus patch %d that is not valid.",
1841 DataType2Text(block.fDataType).c_str(),
1855 HLTWarning("Cannot check if the bus patch IDs, MANU ID and"
1856 " channel addresses for DDL raw data are valid without"
1857 " being able to load the mapping from CDB."
1864 HLTError("Problem found with data block %d, fDataType = '%s',"
1865 " fPtr = %p and fSize = %u bytes."
1866 " Assuming this is a DDL raw data block."
1867 " Problem: The specification does not contain a valid pattern,"
1868 " received 0x%8.8X for the specification.",
1870 DataType2Text(block.fDataType).c_str(),
1873 block.fSpecification
1882 bool AliHLTMUONDataCheckerComponent::CheckTriggerRecordsBlock(
1883 const AliHLTComponentBlockData& block,
1884 AliHLTUInt32_t blockNumber
1887 /// Checks the validity of a trigger records block.
1890 const char* name = "trigger records";
1892 if (not fIgnoreSpec)
1894 if (not IsFromTriggerOnly(block, blockNumber, name))
1898 AliHLTMUONTriggerRecordsBlockReader inblock(block.fPtr, block.fSize);
1899 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
1903 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
1905 // Min and max allowed chamber numbers for hits:
1906 Int_t minCh = AliMUONConstants::NCh() - AliMUONConstants::NTriggerCh();
1907 Int_t maxCh = AliMUONConstants::NCh() - 1;
1909 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
1911 // Check that each hit in each trigger record has a reasonable coordinate.
1912 AliHLTMUONParticleSign sign;
1914 AliHLTMUONUtils::UnpackTriggerRecordFlags(inblock[i].fFlags, sign, hitset);
1916 for (Int_t j = 0; j < 4; j++) // loop over 4 trigger chamber hits.
1918 if (not hitset[i]) continue; // ignore hits that are not initialised.
1919 bool hitOk = IsHitCoordinateOk(
1920 block, blockNumber, name, i, inblock[i].fHit[j],
1921 minCh, maxCh, j+10, ddl
1923 if (not hitOk) result = false;
1926 // We can also check the momentum vector.
1927 bool momOk = IsMomentumVectorOk(
1928 block, blockNumber, name, i,
1929 inblock[i].fPx, inblock[i].fPy, inblock[i].fPz
1931 if (not momOk) result = false;
1934 // Need to check that no entries have duplicated data but with a different
1936 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
1938 AliHLTMUONTriggerRecordStruct ti = inblock[i];
1940 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
1942 AliHLTMUONTriggerRecordStruct tj = inblock[j];
1947 HLTError("Problem found with data block %d, fDataType = '%s',"
1948 " fPtr = %p and fSize = %u bytes."
1949 " Assuming this is a %s data block."
1950 " Problem: The trigger records %d and %d contain the"
1951 " same data. The data might have been duplicated.",
1953 DataType2Text(block.fDataType).c_str(),
1968 bool AliHLTMUONDataCheckerComponent::CheckTrigRecsDebugBlock(
1969 const AliHLTComponentBlockData& block,
1970 AliHLTUInt32_t blockNumber
1973 /// Checks the validity of a trigger records debug block.
1976 const char* name = "trigger records debug information";
1978 if (not fIgnoreSpec)
1980 if (not IsFromTriggerOnly(block, blockNumber, name))
1984 AliHLTMUONTrigRecsDebugBlockReader inblock(block.fPtr, block.fSize);
1985 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
1989 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
1991 // Check that each detector element ID is valid and the corresponding DDL
1992 // bit is set in the data block specification.
1993 if (FetchMappingStores() == 0) // are stores loaded?
1995 Bool_t warn = kFALSE;
1996 AliMpDEStore* store = AliMpDEStore::Instance(warn);
1997 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
1998 for (AliHLTUInt32_t j = 0; j < 4; j++)
2000 const AliHLTMUONTrigRecInfoStruct& trig = inblock[i];
2001 AliMpDetElement* de = store->GetDetElement(trig.fDetElemId[j], warn);
2004 HLTError("Problem found with data block %d, fDataType = '%s',"
2005 " fPtr = %p and fSize = %u bytes."
2006 " Assuming this is a %s data block."
2007 " Problem: The detector element number %d on chamber"
2008 " %d for trigger record debug structure %d is not valid.",
2010 DataType2Text(block.fDataType).c_str(),
2022 // Check that the chamber number from the detector element number
2023 // has the expected value.
2024 Int_t chamber = AliMpDEManager::GetChamberId(trig.fDetElemId[j], warn);
2025 if (chamber != Int_t(j+10))
2027 HLTError("Problem found with data block %d, fDataType = '%s',"
2028 " fPtr = %p and fSize = %u bytes."
2029 " Assuming this is a %s data block."
2030 " Problem: The detector element number %d for trigger"
2031 " record debug structure %d, corresponds to chamber"
2032 " %d, but we expected a hit for chamber %d.",
2034 DataType2Text(block.fDataType).c_str(),
2046 if (fIgnoreSpec) continue;
2047 if (0 <= de->GetDdlId() and de->GetDdlId() < 22 and not ddl[de->GetDdlId()])
2049 HLTError("Problem found with data block %d, fDataType = '%s',"
2050 " fPtr = %p and fSize = %u bytes."
2051 " Assuming this is a %s data block."
2052 " Problem: The detector element number %d for trigger"
2053 " record %d corresponds to DDL number %d, but the"
2054 " data block specification 0x%8.8X does not have the"
2055 " corresponding bit set.",
2057 DataType2Text(block.fDataType).c_str(),
2064 block.fSpecification
2072 HLTWarning("Cannot check trigger record debug information without"
2073 " being able to load the mapping from CDB."
2078 // Need to check that no entries have duplicated data but with a different
2080 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2082 AliHLTMUONTrigRecInfoStruct ti = inblock[i];
2084 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2086 AliHLTMUONTrigRecInfoStruct tj = inblock[j];
2087 tj.fTrigRecId = ti.fTrigRecId;
2091 HLTError("Problem found with data block %d, fDataType = '%s',"
2092 " fPtr = %p and fSize = %u bytes."
2093 " Assuming this is a %s data block."
2094 " Problem: The trigger record debug information"
2095 " structures %d and %d contain the same data."
2096 " The data might have been duplicated.",
2098 DataType2Text(block.fDataType).c_str(),
2108 // Can also check that the value of the fZmiddle and fBl.
2109 bool paramsOk = AreMomentumCalcParamsOk(
2110 block, blockNumber, name, i, ti.fZmiddle, ti.fBl
2112 if (not paramsOk) result = false;
2119 bool AliHLTMUONDataCheckerComponent::CheckRecHitsBlock(
2120 const AliHLTComponentBlockData& block,
2121 AliHLTUInt32_t blockNumber
2124 /// Checks the validity of a reconstructed hits block.
2127 const char* name = "reconstructed hits";
2129 if (not fIgnoreSpec)
2131 if (not IsFromTrackerOnly(block, blockNumber, name))
2135 AliHLTMUONRecHitsBlockReader inblock(block.fPtr, block.fSize);
2136 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2140 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2142 // Check that each hit has a reasonable coordinate.
2144 Int_t maxCh = AliMUONConstants::NTrackingCh() - 1;
2145 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2147 bool hitOk = IsHitCoordinateOk(
2148 block, blockNumber, name, i, inblock[i],
2149 minCh, maxCh, -1, ddl
2151 if (not hitOk) result = false;
2158 bool AliHLTMUONDataCheckerComponent::CheckClustersBlock(
2159 const AliHLTComponentBlockData& block,
2160 AliHLTUInt32_t blockNumber
2163 /// Checks the validity of a clusters block.
2166 const char* name = "clusters";
2168 if (not fIgnoreSpec)
2170 if (not IsFromTrackerOnly(block, blockNumber, name))
2174 AliHLTMUONClustersBlockReader inblock(block.fPtr, block.fSize);
2175 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2179 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2181 if (FetchMappingStores() == 0) // are stores loaded?
2183 Bool_t warn = kFALSE;
2184 AliMpDEStore* store = AliMpDEStore::Instance(warn);
2185 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2187 const AliHLTMUONClusterStruct& cluster = inblock[i];
2189 // Check that the detector element ID is valid.
2190 AliMpDetElement* de = store->GetDetElement(cluster.fDetElemId, warn);
2193 HLTError("Problem found with data block %d, fDataType = '%s',"
2194 " fPtr = %p and fSize = %u bytes."
2195 " Assuming this is a %s data block."
2196 " Problem: The detector element number %d for cluster"
2197 " %d is not valid.",
2199 DataType2Text(block.fDataType).c_str(),
2210 // Check that the chamber number found from the hit coordinate and
2211 // that from the detector element number are the same.
2212 Int_t chamberFromHit = AliMUONConstants::ChamberNumber(cluster.fHit.fZ, warn);
2213 Int_t chamberFromDE = AliMpDEManager::GetChamberId(cluster.fDetElemId, warn);
2214 if (chamberFromHit != chamberFromDE)
2216 HLTError("Problem found with data block %d, fDataType = '%s',"
2217 " fPtr = %p and fSize = %u bytes."
2218 " Assuming this is a %s data block."
2219 " Problem: The detector element number %d for"
2220 " cluster %d, corresponds to chamber %d, but"
2221 " found a different chamber number %d for the"
2222 " corresponding hit coordinate {x = %f, y = %f,"
2225 DataType2Text(block.fDataType).c_str(),
2240 // Make sure the corresponding DDL bit is set in the data
2241 // block specification.
2242 if (fIgnoreSpec) continue;
2243 if (0 <= de->GetDdlId() and de->GetDdlId() < 22 and not ddl[de->GetDdlId()])
2245 HLTError("Problem found with data block %d, fDataType = '%s',"
2246 " fPtr = %p and fSize = %u bytes."
2247 " Assuming this is a %s data block."
2248 " Problem: The detector element number %d for cluster"
2249 " %d corresponds to DDL number %d, but the data"
2250 " block specification 0x%8.8X does not have the"
2251 " corresponding bit set.",
2253 DataType2Text(block.fDataType).c_str(),
2260 block.fSpecification
2265 // Check that the total cluster charge is a reasonable value.
2266 if ((cluster.fChargeB + cluster.fChargeNB)< 0 and 1e4 < (cluster.fChargeB + cluster.fChargeNB))
2268 HLTError("Problem found with data block %d, fDataType = '%s',"
2269 " fPtr = %p and fSize = %u bytes."
2270 " Assuming this is a %s data block."
2271 " Problem: The total charge %f for the cluster"
2272 " %d is not in a reasonable range [0..1e4].",
2274 DataType2Text(block.fDataType).c_str(),
2278 (cluster.fChargeB + cluster.fChargeNB),
2288 HLTWarning("Cannot check cluster information without being able"
2289 " to load the mapping from CDB."
2294 // Min and max chamber numbers allowed for the cluster hits.
2296 Int_t maxCh = AliMUONConstants::NTrackingCh() - 1;
2298 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2300 // Need to check that no cluster data has duplicated data but with
2301 // a different ID number.
2302 AliHLTMUONClusterStruct ci = inblock[i];
2304 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2306 AliHLTMUONClusterStruct cj = inblock[j];
2311 HLTError("Problem found with data block %d, fDataType = '%s',"
2312 " fPtr = %p and fSize = %u bytes."
2313 " Assuming this is a %s data block."
2314 " Problem: The cluster structures %d and %d contain"
2315 " the same data. The data might have been duplicated.",
2317 DataType2Text(block.fDataType).c_str(),
2327 // Check that the hit structure in the cluster corresponds
2328 // to a tracker chamber.
2329 bool hitOk = IsHitCoordinateOk(
2330 block, blockNumber, name, i, ci.fHit,
2331 minCh, maxCh, -1, ddl
2333 if (not hitOk) result = false;
2340 bool AliHLTMUONDataCheckerComponent::CheckChannelsBlock(
2341 const AliHLTComponentBlockData& block,
2342 AliHLTUInt32_t blockNumber
2345 /// Checks the validity of a channels block.
2348 const char* name = "channels";
2350 if (not fIgnoreSpec)
2352 if (not IsFromTrackerOnly(block, blockNumber, name))
2356 AliHLTMUONChannelsBlockReader inblock(block.fPtr, block.fSize);
2357 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2361 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2363 if (FetchMappingStores() == 0) // are stores loaded?
2365 Bool_t warn = kFALSE;
2366 AliMpDDLStore* store = AliMpDDLStore::Instance(warn);
2368 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2370 const AliHLTMUONChannelStruct& channel = inblock[i];
2372 // Check if the bus patch is valid.
2373 AliMpBusPatch* busPatch = store->GetBusPatch(channel.fBusPatch, warn);
2374 if (busPatch == NULL)
2376 HLTError("Problem found with data block %d, fDataType = '%s',"
2377 " fPtr = %p and fSize = %u bytes."
2378 " Assuming this is a %s data block."
2379 " Problem: Found a bus patch identifier %d that"
2382 DataType2Text(block.fDataType).c_str(),
2392 // We can check that the bus patch is for a DDL
2393 // which is also indicated by the specification bits.
2394 if (not fIgnoreSpec and (
2395 not (0 <= busPatch->GetDdlId() and busPatch->GetDdlId() < 20)
2396 or (0 <= busPatch->GetDdlId() and busPatch->GetDdlId() < 20
2397 and not ddl[busPatch->GetDdlId()])
2400 HLTError("Problem found with data block %d, fDataType = '%s',"
2401 " fPtr = %p and fSize = %u bytes."
2402 " Assuming this is a %s data block."
2403 " Problem: Found a bus patch identifier %d for"
2404 " DDL %d, but the data block specification 0x%8.8X"
2405 " does not have the corresponding bit set.",
2407 DataType2Text(block.fDataType).c_str(),
2412 busPatch->GetDdlId(),
2413 block.fSpecification
2419 // Check if the MANU ID is valid.
2420 if (not busPatch->HasManu(channel.fManu))
2422 HLTError("Problem found with data block %d, fDataType = '%s',"
2423 " fPtr = %p and fSize = %u bytes."
2424 " Assuming this is a %s data block."
2425 " Problem: Found a MANU identifier %d on bus patch %d"
2426 " that is not valid.",
2428 DataType2Text(block.fDataType).c_str(),
2439 // Now try to fetch the detector element to check the MANU channel.
2440 AliMpDetElement* de = store->GetDetElement(busPatch->GetDEId(), warn);
2443 HLTError("Problem found with data block %d, fDataType = '%s',"
2444 " fPtr = %p and fSize = %u bytes."
2445 " Assuming this is a %s data block."
2446 " Problem: Found a bus patch identifier %d that"
2447 " does not correspond to a detector element.",
2449 DataType2Text(block.fDataType).c_str(),
2459 if (not de->IsConnectedChannel(channel.fManu, channel.fChannelAddress))
2461 // Just a warning because this is marked not
2462 // to be an error in the AliMUONDigitMaker.
2463 HLTWarning("Problem found with data block %d, fDataType = '%s',"
2464 " fPtr = %p and fSize = %u bytes."
2465 " Assuming this is a %s data block."
2466 " Problem: Found a channel with address %d on"
2467 " MANU ID %d and bus patch %d that is not connected.",
2469 DataType2Text(block.fDataType).c_str(),
2473 channel.fChannelAddress,
2481 // Need to also load the correct segmentation to check the channel.
2482 const AliMpVSegmentation* seg =
2483 AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(
2484 busPatch->GetDEId(), channel.fManu
2488 HLTError("Could not load segmentation for detector element %d"
2490 busPatch->GetDEId(), channel.fManu
2496 AliMpPad pad = seg->PadByLocation(
2497 #ifndef HAVE_NOT_MUON_ALIMPPAD_GETPOSITION
2498 channel.fManu, channel.fChannelAddress,
2499 #else // old AliMpPad functionality < r 31742
2500 AliMpIntPair(channel.fManu, channel.fChannelAddress),
2501 #endif //HAVE_NOT_MUON_ALIMPPAD_GETPOSITION
2504 if (not pad.IsValid())
2506 HLTError("Problem found with data block %d, fDataType = '%s',"
2507 " fPtr = %p and fSize = %u bytes."
2508 " Assuming this is a %s data block."
2509 " Problem: Found a channel with address %d on"
2510 " MANU ID %d and bus patch %d that is not valid.",
2512 DataType2Text(block.fDataType).c_str(),
2516 channel.fChannelAddress,
2527 HLTWarning("Cannot check channel information without being able"
2528 " to load the mapping from CDB."
2533 // Need to check that no channel data has duplicated data but with
2534 // a different cluster ID number.
2535 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2537 AliHLTMUONChannelStruct ci = inblock[i];
2539 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2541 AliHLTMUONChannelStruct cj = inblock[j];
2542 cj.fClusterId = ci.fClusterId;
2546 HLTError("Problem found with data block %d, fDataType = '%s',"
2547 " fPtr = %p and fSize = %u bytes."
2548 " Assuming this is a %s data block."
2549 " Problem: The channel structures %d and %d contain"
2550 " the same data. The data might have been duplicated.",
2552 DataType2Text(block.fDataType).c_str(),
2567 bool AliHLTMUONDataCheckerComponent::CheckMansoTracksBlock(
2568 const AliHLTComponentBlockData& block,
2569 AliHLTUInt32_t blockNumber
2572 /// Checks the validity of a Manso tracks block.
2575 const char* name = "Manso tracks";
2577 if (not fIgnoreSpec)
2579 if (not IsSpecificationValid(block, blockNumber, name))
2583 AliHLTMUONMansoTracksBlockReader inblock(block.fPtr, block.fSize);
2584 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2588 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2590 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2592 // Need to check that no entries have duplicated data but with
2593 // a different track ID number.
2594 AliHLTMUONMansoTrackStruct ti = inblock[i];
2596 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2598 AliHLTMUONMansoTrackStruct tj = inblock[j];
2603 HLTError("Problem found with data block %d, fDataType = '%s',"
2604 " fPtr = %p and fSize = %u bytes."
2605 " Assuming this is a %s data block."
2606 " Problem: The Manso tracks %d and %d contain the"
2607 " same data. The data might have been duplicated.",
2609 DataType2Text(block.fDataType).c_str(),
2619 bool trackOk = IsMansoTrackOk(block, blockNumber, name, i, ti, ddl);
2620 if (not trackOk) result = false;
2627 bool AliHLTMUONDataCheckerComponent::CheckMansoCandidatesBlock(
2628 const AliHLTComponentBlockData& block,
2629 AliHLTUInt32_t blockNumber
2632 /// Checks the validity of a Manso candidates block.
2635 const char* name = "Manso track candidates";
2637 if (not fIgnoreSpec)
2639 if (not IsSpecificationValid(block, blockNumber, name))
2643 AliHLTMUONMansoCandidatesBlockReader inblock(block.fPtr, block.fSize);
2644 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2648 AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
2650 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
2652 // Need to check that no entries have duplicated data but with a
2653 // different track ID number.
2654 AliHLTMUONMansoCandidateStruct ti = inblock[i];
2656 for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
2658 AliHLTMUONMansoCandidateStruct tj = inblock[j];
2659 tj.fTrack.fId = ti.fTrack.fId;
2663 HLTError("Problem found with data block %d, fDataType = '%s',"
2664 " fPtr = %p and fSize = %u bytes."
2665 " Assuming this is a %s data block."
2666 " Problem: The Manso track candidates %d and %d"
2667 " contain the same data."
2668 " The data might have been duplicated.",
2670 DataType2Text(block.fDataType).c_str(),
2680 bool trackOk = IsMansoTrackOk(block, blockNumber, name, i, ti.fTrack, ddl);
2681 if (not trackOk) result = false;
2683 // Check that each ROI has a centre point somewhere on the correct
2684 // corresponding chamber and that the Radius is not bigger thant
2685 // the diameter of the chamber which would be pointless.
2686 for (AliHLTInt32_t j = 0; j < 4; j++)
2688 if (ti.fRoI[j].fRadius == -1) continue; // Ignore invalid ROIs
2690 Int_t chamber = AliMUONConstants::ChamberNumber(
2691 ti.fRoI[j].fZ, false // false = do not warn.
2695 HLTError("Problem found with data block %d, fDataType = '%s',"
2696 " fPtr = %p and fSize = %u bytes."
2697 " Assuming this is a %s data block."
2698 " Problem: The region of interest on chamber %d for"
2699 " Manso track candidate %d has a z-coordinate of %f"
2700 " cm that does not correspond to that chamber.",
2702 DataType2Text(block.fDataType).c_str(),
2713 double x = ti.fRoI[j].fX;
2714 double y = ti.fRoI[j].fY;
2715 double r = sqrt(x*x + y*y);
2716 if (r > AliMUONConstants::Dmax((j+6)/2))
2718 // Just a warning since this is not a data integrity problem
2719 // but rather just a data sanity problem.
2720 HLTWarning("Problem found with data block %d, fDataType = '%s',"
2721 " fPtr = %p and fSize = %u bytes."
2722 " Assuming this is a %s data block."
2723 " Problem: The region of interest coordinate {x = %f,"
2724 " y = %f} cm on chamber %d for Manso track candidate %d"
2725 " does not correspond to that chamber.",
2727 DataType2Text(block.fDataType).c_str(),
2739 if (ti.fRoI[j].fRadius > AliMUONConstants::Dmax((j+6)/2))
2741 // Just a warning since this is not a data integrity problem
2742 // but rather just a data sanity problem.
2743 HLTWarning("Problem found with data block %d, fDataType = '%s',"
2744 " fPtr = %p and fSize = %u bytes."
2745 " Assuming this is a %s data block."
2746 " Problem: The region of interest radius of %f cm"
2747 " on chamber %d for Manso track candidate %d"
2748 " is bigger than the chamber diameter %f cm.",
2750 DataType2Text(block.fDataType).c_str(),
2757 AliMUONConstants::Dmax((j+6)/2)
2768 bool AliHLTMUONDataCheckerComponent::CheckSinglesDecisionBlock(
2769 const AliHLTComponentBlockData& block,
2770 AliHLTUInt32_t blockNumber
2773 /// Checks the validity of a single tracks trigger decision block.
2776 const char* name = "singles decision";
2778 if (not fIgnoreSpec)
2780 if (not IsSpecificationValid(block, blockNumber, name))
2784 AliHLTMUONSinglesDecisionBlockReader inblock(block.fPtr, block.fSize);
2785 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2792 bool AliHLTMUONDataCheckerComponent::CheckPairsDecisionBlock(
2793 const AliHLTComponentBlockData& block,
2794 AliHLTUInt32_t blockNumber
2797 /// Checks the validity of a track pairs trigger decision block.
2800 const char* name = "pairs decision";
2802 if (not fIgnoreSpec)
2804 if (not IsSpecificationValid(block, blockNumber, name))
2808 AliHLTMUONPairsDecisionBlockReader inblock(block.fPtr, block.fSize);
2809 if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
2816 bool AliHLTMUONDataCheckerComponent::AreMomentaCompatible(
2817 AliHLTFloat32_t px1,
2818 AliHLTFloat32_t py1,
2819 AliHLTFloat32_t pz1,
2820 AliHLTFloat32_t px2,
2821 AliHLTFloat32_t py2,
2825 /// Checks to see if the two momenta vectors are compatible or not.
2826 /// The vectors should not have an angle more than 10 degrees between
2827 /// them and their magnitudes should not be more different than 50%.
2829 double p1 = sqrt(double(px1)*double(px1) + double(py1)*double(py1) + double(pz1)*double(pz1));
2830 double p2 = sqrt(double(px2)*double(px2) + double(py2)*double(py2) + double(pz2)*double(pz2));
2831 if (p1 == 0 and p2 == 0) return true;
2832 if (fabs(p1 - p2) / ((p1 + p2)*0.5) > 0.5) return false;
2833 double denom = p1 * p2;
2834 if (denom == 0) return false;
2835 double ratio = (double(px1)*double(px2) + double(py1)*double(py2) + double(pz1)*double(pz2)) / denom;
2836 if (ratio < -1) return true;
2837 if (ratio > 1) return true;
2838 double angle = acos(ratio);
2839 if (angle > 3.14159265358979323846 * 10. / 180.) return false;
2844 bool AliHLTMUONDataCheckerComponent::IsScalarTooLarge(
2845 const AliHLTComponentBlockData* block,
2846 AliHLTUInt32_t blockNumber,
2847 const char* blockTypeName,
2848 const char* scalarName,
2849 AliHLTUInt32_t scalarValue,
2850 AliHLTUInt32_t totalTrackCount
2853 /// Checks if the scalar value is larger than the number of Manso
2854 /// tracks in the event.
2856 if (scalarValue > totalTrackCount)
2858 HLTError("Problem found with %s trigger decision"
2859 " data block %d, fDataType = '%s', fPtr = %p and"
2860 " fSize = %u bytes."
2861 " Problem: The %s scalar with value %d is larger"
2862 " than the total number of Manso tracks found for the"
2863 " event (%d tracks).",
2866 DataType2Text(block->fDataType).c_str(),
2882 bool AliHLTMUONDataCheckerComponent::IsScalarALargerThanB(
2883 const AliHLTComponentBlockData* block,
2884 AliHLTUInt32_t blockNumber,
2885 const char* blockTypeName,
2886 const char* scalarAName,
2887 AliHLTUInt32_t scalarAValue,
2888 const char* scalarBName,
2889 AliHLTUInt32_t scalarBValue
2892 /// Checks if the scalar value is larger than the number of Manso
2893 /// tracks in the event.
2895 if (scalarAValue > scalarBValue)
2897 HLTError("Problem found with %s trigger decision"
2898 " data block %d, fDataType = '%s', fPtr = %p and"
2899 " fSize = %u bytes."
2900 " Problem: The %s scalar with value %d is larger"
2901 " than scalar %s with value %d, but is should not be.",
2904 DataType2Text(block->fDataType).c_str(),
2921 void AliHLTMUONDataCheckerComponent::MarkBlock(
2922 const AliHLTComponentBlockData* blocks,
2924 AliHLTUInt32_t blockCount,
2925 const AliHLTComponentBlockData* blockToMark
2928 /// Tries to find the 'blockToMark' in the list of blocks and sets the
2929 /// corresponding 'blockOk' flag to false.
2931 for (AliHLTUInt32_t i = 0; i < blockCount; i++)
2933 if (&blocks[i] == blockToMark)
2942 void AliHLTMUONDataCheckerComponent::MakeGlobalChecks(
2943 const AliHLTComponentBlockData* blocks,
2945 AliHLTUInt32_t blockCount,
2946 const AliHLTComponentBlockData** trigRecBlocks,
2947 AliHLTUInt32_t trigRecBlocksCount,
2948 const AliHLTComponentBlockData** trigRecDebugBlocks,
2949 AliHLTUInt32_t trigRecDebugBlocksCount,
2950 const AliHLTComponentBlockData** hitBlocks,
2951 AliHLTUInt32_t hitBlocksCount,
2952 const AliHLTComponentBlockData** clusterBlocks,
2953 AliHLTUInt32_t clusterBlocksCount,
2954 const AliHLTComponentBlockData** channelBlocks,
2955 AliHLTUInt32_t channelBlocksCount,
2956 const AliHLTComponentBlockData** mansoTrackBlocks,
2957 AliHLTUInt32_t mansoTrackBlocksCount,
2958 const AliHLTComponentBlockData** mansoCandidateBlocks,
2959 AliHLTUInt32_t mansoCandidateBlocksCount,
2960 const AliHLTComponentBlockData** singleDecisionBlocks,
2961 AliHLTUInt32_t singleDecisionBlocksCount,
2962 const AliHLTComponentBlockData** pairDecisionBlocks,
2963 AliHLTUInt32_t pairDecisionBlocksCount
2966 /// The following set of global checks are performed:
2967 /// 1) Checks if all the ID numbers in all the blocks are unique.
2968 /// 2) Check if all the structures are unique up to their ID numbers,
2969 /// that it, make sure there are no structures with the same data but
2970 /// for a different ID number.
2971 /// 3) Check if the reference ID numbers are correct, i.e. are the
2972 /// trigger record ID numbers in the track structures found in any of
2973 /// the trigger record data blocks.
2974 /// 4) Do the number of channels claimed in the cluster correspond to
2975 /// the number of channel structures.
2976 /// 5) Check that the momentum vectors between the Manso tracks and
2977 /// the corresponding trigger record are compatible.
2978 /// 6) Check that the trigger decision scalars are reasonable.
2979 /// 7) Check that the detector element IDs are the same between rec
2980 /// hits and clusters / trigger record debug blocks.
2982 // Check if all the trigger record identifiers and data are unique.
2983 for (AliHLTUInt32_t bi = 0; bi < trigRecBlocksCount; bi++)
2985 AliHLTMUONTriggerRecordsBlockReader inblocki(trigRecBlocks[bi]->fPtr, trigRecBlocks[bi]->fSize);
2986 if (not inblocki.BufferSizeOk()) continue;
2987 for (AliHLTUInt32_t bj = bi+1; bj < trigRecBlocksCount; bj++)
2989 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
2990 if (not inblockj.BufferSizeOk()) continue;
2992 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
2993 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
2995 if (inblocki[i].fId == inblockj[j].fId)
2997 HLTError("Problem found with trigger record data block %d,"
2998 " fDataType = '%s', fPtr = %p and fSize = %u bytes,"
2999 " and trigger record data block %d,"
3000 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3001 " Problem: Trigger record %d in block %d and entry"
3002 " %d in block %d have the same identfier, but they"
3003 " should be unique.",
3005 DataType2Text(trigRecBlocks[bi]->fDataType).c_str(),
3006 trigRecBlocks[bi]->fPtr,
3007 trigRecBlocks[bi]->fSize,
3009 DataType2Text(trigRecBlocks[bj]->fDataType).c_str(),
3010 trigRecBlocks[bj]->fPtr,
3011 trigRecBlocks[bj]->fSize,
3015 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bi]);
3016 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bj]);
3019 AliHLTMUONTriggerRecordStruct a = inblocki[i];
3020 AliHLTMUONTriggerRecordStruct b = inblockj[j];
3024 HLTError("Problem found with trigger record data block %d,"
3025 " fDataType = '%s', fPtr = %p and fSize = %u bytes,"
3026 " and trigger record data block %d,"
3027 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3028 " Problem: Trigger record %d in block %d and entry"
3029 " %d in block %d have the same data."
3030 " The data may have been duplicated.",
3032 DataType2Text(trigRecBlocks[bi]->fDataType).c_str(),
3033 trigRecBlocks[bi]->fPtr,
3034 trigRecBlocks[bi]->fSize,
3036 DataType2Text(trigRecBlocks[bj]->fDataType).c_str(),
3037 trigRecBlocks[bj]->fPtr,
3038 trigRecBlocks[bj]->fSize,
3042 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bi]);
3043 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bj]);
3049 for (AliHLTUInt32_t bi = 0; bi < trigRecDebugBlocksCount; bi++)
3051 AliHLTMUONTrigRecsDebugBlockReader inblocki(trigRecDebugBlocks[bi]->fPtr, trigRecDebugBlocks[bi]->fSize);
3052 if (not inblocki.BufferSizeOk()) continue;
3054 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3056 // Check if all the trigger record IDs in the debug information structures exist.
3059 for (AliHLTUInt32_t bj = 0; bj < trigRecBlocksCount and not found; bj++)
3061 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
3062 if (not inblockj.BufferSizeOk()) continue;
3064 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3066 if (inblocki[i].fTrigRecId == inblockj[j].fId)
3070 // Since we found the corresponding trigger record,
3071 // check if the detector element IDs are the same.
3072 bool deOk = CheckDetElemIds(
3073 *trigRecDebugBlocks[bi], bi, i, inblocki[i],
3074 *trigRecBlocks[bj], bj, j, inblockj[j]
3078 MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bi]);
3079 MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bj]);
3089 HLTError("Problem found with trigger record debug information"
3090 " data block %d, fDataType = '%s', fPtr = %p and"
3091 " fSize = %u bytes."
3092 " Problem with entry %d in block: The trigger record"
3093 " identifier %d does not exist in any trigger record"
3096 DataType2Text(trigRecDebugBlocks[bi]->fDataType).c_str(),
3097 trigRecDebugBlocks[bi]->fPtr,
3098 trigRecDebugBlocks[bi]->fSize,
3099 i, inblocki[i].fTrigRecId
3101 MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bi]);
3105 // Check if all the trigger record debug information structures are unique.
3106 for (AliHLTUInt32_t bj = bi+1; bj < trigRecDebugBlocksCount; bj++)
3108 AliHLTMUONTrigRecsDebugBlockReader inblockj(trigRecDebugBlocks[bj]->fPtr, trigRecDebugBlocks[bj]->fSize);
3109 if (not inblockj.BufferSizeOk()) continue;
3111 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3112 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3114 AliHLTMUONTrigRecInfoStruct a = inblocki[i];
3115 AliHLTMUONTrigRecInfoStruct b = inblockj[j];
3116 a.fTrigRecId = b.fTrigRecId = -1;
3119 HLTError("Problem found with trigger record debug information"
3120 " data block %d, fDataType = '%s', fPtr = %p and"
3121 " fSize = %u bytes, and trigger record debug"
3122 " information data block %d,"
3123 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3124 " Problem: The trigger record debug inforamtion"
3125 " structure %d in block %d and entry"
3126 " %d in block %d have the same data."
3127 " The data may have been duplicated.",
3129 DataType2Text(trigRecDebugBlocks[bi]->fDataType).c_str(),
3130 trigRecDebugBlocks[bi]->fPtr,
3131 trigRecDebugBlocks[bi]->fSize,
3133 DataType2Text(trigRecDebugBlocks[bj]->fDataType).c_str(),
3134 trigRecDebugBlocks[bj]->fPtr,
3135 trigRecDebugBlocks[bj]->fSize,
3139 MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bi]);
3140 MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bj]);
3146 // Check that all the reconstructed hits are unique.
3147 for (AliHLTUInt32_t bi = 0; bi < hitBlocksCount; bi++)
3149 AliHLTMUONRecHitsBlockReader inblocki(hitBlocks[bi]->fPtr, hitBlocks[bi]->fSize);
3150 if (not inblocki.BufferSizeOk()) continue;
3151 for (AliHLTUInt32_t bj = bi+1; bj < hitBlocksCount; bj++)
3153 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
3154 if (not inblockj.BufferSizeOk()) continue;
3156 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3157 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3159 if (inblocki[i] == inblockj[j])
3161 HLTError("Problem found with reconstructed hit data block %d,"
3162 " fDataType = '%s', fPtr = %p and fSize = %u bytes,"
3163 " and reconstructed hit data block %d,"
3164 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3165 " Problem: Reconstructed hit %d in block %d and entry"
3166 " %d in block %d are the same, but all hits"
3167 " should be unique.",
3169 DataType2Text(hitBlocks[bi]->fDataType).c_str(),
3170 hitBlocks[bi]->fPtr,
3171 hitBlocks[bi]->fSize,
3173 DataType2Text(hitBlocks[bj]->fDataType).c_str(),
3174 hitBlocks[bj]->fPtr,
3175 hitBlocks[bj]->fSize,
3179 MarkBlock(blocks, blockOk, blockCount, hitBlocks[bi]);
3180 MarkBlock(blocks, blockOk, blockCount, hitBlocks[bj]);
3186 for (AliHLTUInt32_t bi = 0; bi < clusterBlocksCount; bi++)
3188 AliHLTMUONClustersBlockReader inblocki(clusterBlocks[bi]->fPtr, clusterBlocks[bi]->fSize);
3189 if (not inblocki.BufferSizeOk()) continue;
3191 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3193 // Check if all the reconstructed hit coordinates in the cluster structures exist.
3196 for (AliHLTUInt32_t bj = 0; bj < hitBlocksCount and not found; bj++)
3198 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
3199 if (not inblockj.BufferSizeOk()) continue;
3201 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3203 if (inblocki[i].fHit == inblockj[j])
3207 // Since we found the corresponding cluster,
3208 // check if the detector element IDs are the same.
3209 bool deOk = CheckDetElemIds(
3210 *clusterBlocks[bi], bi, i, inblocki[i],
3211 *hitBlocks[bj], bj, j, inblockj[j]
3215 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3216 MarkBlock(blocks, blockOk, blockCount, hitBlocks[bj]);
3224 // If the hit was not found then it should be nil.
3225 if (not found and (inblocki[i].fHit != AliHLTMUONConstants::NilRecHitStruct()))
3227 HLTError("Problem found with cluster data block %d,"
3228 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3229 " Problem with entry %d in block: The cluster hit"
3230 " coordinate {x = %f, y = %f, z = %f} does not exist"
3231 " in any reconstructed hit data block.",
3233 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3234 clusterBlocks[bi]->fPtr,
3235 clusterBlocks[bi]->fSize,
3237 inblocki[i].fHit.fX,
3238 inblocki[i].fHit.fY,
3241 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3244 // Check that the fNchannelsB value is correct.
3245 // First count the number of channels found in the channels block that
3246 // correspond to the cluster. Do this for the bending and non-bending planes.
3247 AliHLTUInt32_t countB = 0;
3248 AliHLTUInt32_t countNB = 0;
3249 for (AliHLTUInt32_t bj = 0; bj < channelBlocksCount and not found; bj++)
3251 AliHLTMUONChannelsBlockReader inblockj(channelBlocks[bj]->fPtr, channelBlocks[bj]->fSize);
3252 if (not inblockj.BufferSizeOk()) continue;
3254 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3256 if (inblocki[i].fId != inblockj[j].fClusterId) continue;
3257 if ((inblockj[j].fRawDataWord & (1 << 28)) == 0)
3264 if (inblocki[i].fNchannelsB != countB)
3266 HLTWarning("Problem found with cluster data block %d,"
3267 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3268 " Problem with entry %d in block: The number of bending plane"
3269 " channels in the cluster is reported as %d,"
3270 " but %d channel structures were found.",
3272 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3273 clusterBlocks[bi]->fPtr,
3274 clusterBlocks[bi]->fSize,
3276 inblocki[i].fNchannelsB,
3279 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3282 if (inblocki[i].fNchannelsNB != countNB)
3284 HLTWarning("Problem found with cluster data block %d,"
3285 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3286 " Problem with entry %d in block: The number of"
3287 " channels in the cluster of non-bending plane is reported as %d,"
3288 " but %d channel structures were found.",
3290 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3291 clusterBlocks[bi]->fPtr,
3292 clusterBlocks[bi]->fSize,
3294 inblocki[i].fNchannelsNB,
3297 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3301 // Check if all the cluster structures are unique up to the identifier
3302 // and have unique identifiers.
3303 for (AliHLTUInt32_t bj = bi+1; bj < clusterBlocksCount; bj++)
3305 AliHLTMUONClustersBlockReader inblockj(clusterBlocks[bj]->fPtr, clusterBlocks[bj]->fSize);
3306 if (not inblockj.BufferSizeOk()) continue;
3308 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3309 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3311 if (inblocki[i].fId == inblockj[j].fId)
3313 HLTError("Problem found with cluster"
3314 " data block %d, fDataType = '%s', fPtr = %p and"
3315 " fSize = %u bytes, and cluster data block %d,"
3316 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3317 " Problem: The cluster %d in block %d and entry"
3318 " %d in block %d have the same identifier, but they"
3319 " should be unique.",
3321 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3322 clusterBlocks[bi]->fPtr,
3323 clusterBlocks[bi]->fSize,
3325 DataType2Text(clusterBlocks[bj]->fDataType).c_str(),
3326 clusterBlocks[bj]->fPtr,
3327 clusterBlocks[bj]->fSize,
3331 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3332 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bj]);
3335 AliHLTMUONClusterStruct a = inblocki[i];
3336 AliHLTMUONClusterStruct b = inblockj[j];
3340 HLTError("Problem found with cluster"
3341 " data block %d, fDataType = '%s', fPtr = %p and"
3342 " fSize = %u bytes, and cluster data block %d,"
3343 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3344 " Problem: The cluster %d in block %d and entry"
3345 " %d in block %d have the same data."
3346 " The data may have been duplicated.",
3348 DataType2Text(clusterBlocks[bi]->fDataType).c_str(),
3349 clusterBlocks[bi]->fPtr,
3350 clusterBlocks[bi]->fSize,
3352 DataType2Text(clusterBlocks[bj]->fDataType).c_str(),
3353 clusterBlocks[bj]->fPtr,
3354 clusterBlocks[bj]->fSize,
3358 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]);
3359 MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bj]);
3365 for (AliHLTUInt32_t bi = 0; bi < channelBlocksCount; bi++)
3367 AliHLTMUONChannelsBlockReader inblocki(channelBlocks[bi]->fPtr, channelBlocks[bi]->fSize);
3368 if (not inblocki.BufferSizeOk()) continue;
3370 // Check if all the cluster IDs in the channel structures exist.
3371 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3375 for (AliHLTUInt32_t bj = 0; bj < clusterBlocksCount and not found; bj++)
3377 AliHLTMUONClustersBlockReader inblockj(clusterBlocks[bj]->fPtr, clusterBlocks[bj]->fSize);
3378 if (not inblockj.BufferSizeOk()) continue;
3380 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3382 if (inblocki[i].fClusterId == inblockj[j].fId)
3392 HLTError("Problem found with channel"
3393 " data block %d, fDataType = '%s', fPtr = %p and"
3394 " fSize = %u bytes."
3395 " Problem with entry %d in block: The cluster"
3396 " identifier %d does not exist in any cluster"
3399 DataType2Text(channelBlocks[bi]->fDataType).c_str(),
3400 channelBlocks[bi]->fPtr,
3401 channelBlocks[bi]->fSize,
3402 i, inblocki[i].fClusterId
3404 MarkBlock(blocks, blockOk, blockCount, channelBlocks[bi]);
3408 // Check if all the channel structures are unique up to the cluster ID.
3409 for (AliHLTUInt32_t bj = bi+1; bj < channelBlocksCount; bj++)
3411 AliHLTMUONChannelsBlockReader inblockj(channelBlocks[bj]->fPtr, channelBlocks[bj]->fSize);
3412 if (not inblockj.BufferSizeOk()) continue;
3414 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3415 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3417 AliHLTMUONChannelStruct a = inblocki[i];
3418 AliHLTMUONChannelStruct b = inblockj[j];
3419 a.fClusterId = b.fClusterId = -1;
3422 HLTError("Problem found with channel"
3423 " data block %d, fDataType = '%s', fPtr = %p and"
3424 " fSize = %u bytes, and channel data block %d,"
3425 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3426 " Problem: The channel %d in block %d and entry"
3427 " %d in block %d have the same data."
3428 " The data may have been duplicated.",
3430 DataType2Text(channelBlocks[bi]->fDataType).c_str(),
3431 channelBlocks[bi]->fPtr,
3432 channelBlocks[bi]->fSize,
3434 DataType2Text(channelBlocks[bj]->fDataType).c_str(),
3435 channelBlocks[bj]->fPtr,
3436 channelBlocks[bj]->fSize,
3440 MarkBlock(blocks, blockOk, blockCount, channelBlocks[bi]);
3441 MarkBlock(blocks, blockOk, blockCount, channelBlocks[bj]);
3447 // Will need the total number of tracks later for comparison to trigger scalars.
3448 AliHLTUInt32_t totalTrackCount = 0;
3450 for (AliHLTUInt32_t bi = 0; bi < mansoTrackBlocksCount; bi++)
3452 AliHLTMUONMansoTracksBlockReader inblocki(mansoTrackBlocks[bi]->fPtr, mansoTrackBlocks[bi]->fSize);
3453 if (not inblocki.BufferSizeOk()) continue;
3455 totalTrackCount += inblocki.Nentries();
3457 // Check if all the trigger record IDs in the Manso track structures exist.
3458 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3462 for (AliHLTUInt32_t bj = 0; bj < trigRecBlocksCount and not found; bj++)
3464 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
3465 if (not inblockj.BufferSizeOk()) continue;
3467 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3469 if (inblocki[i].fTrigRec == inblockj[j].fId)
3471 // At this point we can check if the momentum
3472 // is compatible with the trigger record.
3473 if (not AreMomentaCompatible(
3474 inblocki[i].fPx, inblocki[i].fPy, inblocki[i].fPz,
3475 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
3479 HLTWarning("Problem found with Manso track"
3480 " data block %d, fDataType = '%s', fPtr = %p and"
3481 " fSize = %u bytes."
3482 " Problem with Manso track %d in block: The momentum"
3483 " vector of the track p = {%f, %f, %f} GeV/c is not"
3484 " compatible with the momentum vector of the trigger"
3485 " record with p = {%f, %f, %f} GeV/c.",
3487 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3488 mansoTrackBlocks[bi]->fPtr,
3489 mansoTrackBlocks[bi]->fSize,
3490 i, inblocki[i].fPx, inblocki[i].fPy, inblocki[i].fPz,
3491 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
3493 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3504 HLTError("Problem found with Manso track"
3505 " data block %d, fDataType = '%s', fPtr = %p and"
3506 " fSize = %u bytes."
3507 " Problem with Manso track %d in block: The trigger"
3508 " record identifier %d does not exist in any trigger"
3509 " record data block.",
3511 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3512 mansoTrackBlocks[bi]->fPtr,
3513 mansoTrackBlocks[bi]->fSize,
3514 i, inblocki[i].fTrigRec
3516 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3520 // Check if all the hits in the Manso track structures exist.
3521 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3523 AliHLTMUONParticleSign sign;
3525 AliHLTMUONUtils::UnpackMansoTrackFlags(inblocki[i].fFlags, sign, hitset);
3527 for (AliHLTUInt32_t n = 0; n < 4; n++)
3529 if (not hitset[n]) continue;
3532 for (AliHLTUInt32_t bj = 0; bj < hitBlocksCount and not found; bj++)
3534 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
3535 if (not inblockj.BufferSizeOk()) continue;
3537 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3539 if (inblocki[i].fHit[n] == inblockj[j])
3549 HLTError("Problem found with Manso track"
3550 " data block %d, fDataType = '%s', fPtr = %p and"
3551 " fSize = %u bytes."
3552 " Problem with Manso track %d in block: The hit"
3553 " for chamber %d does not exist in any"
3554 " reconstructed hits data block.",
3556 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3557 mansoTrackBlocks[bi]->fPtr,
3558 mansoTrackBlocks[bi]->fSize,
3561 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3566 // Check if all the Manso track structures are unique up to the ID and
3567 // have unique identifiers.
3568 for (AliHLTUInt32_t bj = bi+1; bj < mansoTrackBlocksCount; bj++)
3570 AliHLTMUONMansoTracksBlockReader inblockj(mansoTrackBlocks[bj]->fPtr, mansoTrackBlocks[bj]->fSize);
3571 if (not inblockj.BufferSizeOk()) continue;
3573 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3574 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3576 if (inblocki[i].fId == inblockj[j].fId)
3578 HLTError("Problem found with Manso track"
3579 " data block %d, fDataType = '%s', fPtr = %p and"
3580 " fSize = %u bytes, and Manso track data block %d,"
3581 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3582 " Problem: The Manso track %d in block %d and entry"
3583 " %d in block %d have the same identifier, but they"
3584 " should be unique.",
3586 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3587 mansoTrackBlocks[bi]->fPtr,
3588 mansoTrackBlocks[bi]->fSize,
3590 DataType2Text(mansoTrackBlocks[bj]->fDataType).c_str(),
3591 mansoTrackBlocks[bj]->fPtr,
3592 mansoTrackBlocks[bj]->fSize,
3596 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3597 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bj]);
3600 AliHLTMUONMansoTrackStruct a = inblocki[i];
3601 AliHLTMUONMansoTrackStruct b = inblockj[j];
3605 HLTError("Problem found with Manso track"
3606 " data block %d, fDataType = '%s', fPtr = %p and"
3607 " fSize = %u bytes, and Manso track data block %d,"
3608 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3609 " Problem: The Manso track %d in block %d and entry"
3610 " %d in block %d have the same data."
3611 " The data may have been duplicated.",
3613 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3614 mansoTrackBlocks[bi]->fPtr,
3615 mansoTrackBlocks[bi]->fSize,
3617 DataType2Text(mansoTrackBlocks[bj]->fDataType).c_str(),
3618 mansoTrackBlocks[bj]->fPtr,
3619 mansoTrackBlocks[bj]->fSize,
3623 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3624 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bj]);
3630 for (AliHLTUInt32_t bi = 0; bi < mansoCandidateBlocksCount; bi++)
3632 AliHLTMUONMansoCandidatesBlockReader inblocki(mansoCandidateBlocks[bi]->fPtr, mansoCandidateBlocks[bi]->fSize);
3633 if (not inblocki.BufferSizeOk()) continue;
3635 // Check if all the trigger record IDs in the Manso track candidate structures exist.
3636 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3640 for (AliHLTUInt32_t bj = 0; bj < trigRecBlocksCount and not found; bj++)
3642 AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
3643 if (not inblockj.BufferSizeOk()) continue;
3645 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3647 if (inblocki[i].fTrack.fTrigRec == inblockj[j].fId)
3649 // At this point we can check if the momentum
3650 // is compatible with the trigger record.
3651 if (not AreMomentaCompatible(
3652 inblocki[i].fTrack.fPx, inblocki[i].fTrack.fPy, inblocki[i].fTrack.fPz,
3653 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
3657 HLTWarning("Problem found with Manso track candidate"
3658 " data block %d, fDataType = '%s', fPtr = %p and"
3659 " fSize = %u bytes."
3660 " Problem with track candidate %d in block: The momentum"
3661 " vector of the candidate p = {%f, %f, %f} GeV/c is not"
3662 " compatible with the momentum vector of the trigger"
3663 " record with p = {%f, %f, %f} GeV/c.",
3665 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3666 mansoTrackBlocks[bi]->fPtr,
3667 mansoTrackBlocks[bi]->fSize,
3669 inblocki[i].fTrack.fPx, inblocki[i].fTrack.fPy, inblocki[i].fTrack.fPz,
3670 inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
3672 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3683 HLTError("Problem found with Manso track candidate"
3684 " data block %d, fDataType = '%s', fPtr = %p and"
3685 " fSize = %u bytes."
3686 " Problem with track candidate %d in block: The trigger"
3687 " record identifier %d does not exist in any trigger"
3688 " record data block.",
3690 DataType2Text(mansoCandidateBlocks[bi]->fDataType).c_str(),
3691 mansoCandidateBlocks[bi]->fPtr,
3692 mansoCandidateBlocks[bi]->fSize,
3693 i, inblocki[i].fTrack.fTrigRec
3695 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bi]);
3699 // Check if all the hits in the Manso track candidate structures exist.
3700 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3702 AliHLTMUONParticleSign sign;
3704 AliHLTMUONUtils::UnpackMansoTrackFlags(inblocki[i].fTrack.fFlags, sign, hitset);
3706 for (AliHLTUInt32_t n = 0; n < 4; n++)
3708 if (not hitset[n]) continue;
3711 for (AliHLTUInt32_t bj = 0; bj < hitBlocksCount and not found; bj++)
3713 AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
3714 if (not inblockj.BufferSizeOk()) continue;
3716 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3718 if (inblocki[i].fTrack.fHit[n] == inblockj[j])
3728 HLTError("Problem found with Manso track candidate"
3729 " data block %d, fDataType = '%s', fPtr = %p and"
3730 " fSize = %u bytes."
3731 " Problem with track candidate %d in block: The hit"
3732 " for chamber %d does not exist in any"
3733 " reconstructed hits data block.",
3735 DataType2Text(mansoTrackBlocks[bi]->fDataType).c_str(),
3736 mansoTrackBlocks[bi]->fPtr,
3737 mansoTrackBlocks[bi]->fSize,
3740 MarkBlock(blocks, blockOk, blockCount, mansoTrackBlocks[bi]);
3745 // Check if all the Manso track candidate structures are unique up to the
3746 // track ID and have unique identifiers.
3747 for (AliHLTUInt32_t bj = bi+1; bj < mansoCandidateBlocksCount; bj++)
3749 AliHLTMUONMansoCandidatesBlockReader inblockj(mansoCandidateBlocks[bj]->fPtr, mansoCandidateBlocks[bj]->fSize);
3750 if (not inblockj.BufferSizeOk()) continue;
3752 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3753 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3755 if (inblocki[i].fTrack.fId == inblockj[j].fTrack.fId)
3757 HLTError("Problem found with Manso track candidate"
3758 " data block %d, fDataType = '%s', fPtr = %p and"
3759 " fSize = %u bytes, and Manso track candidate data block %d,"
3760 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3761 " Problem: The track candidate %d in block %d and entry"
3762 " %d in block %d have the same identifier, but they"
3763 " should be unique.",
3765 DataType2Text(mansoCandidateBlocks[bi]->fDataType).c_str(),
3766 mansoCandidateBlocks[bi]->fPtr,
3767 mansoCandidateBlocks[bi]->fSize,
3769 DataType2Text(mansoCandidateBlocks[bj]->fDataType).c_str(),
3770 mansoCandidateBlocks[bj]->fPtr,
3771 mansoCandidateBlocks[bj]->fSize,
3775 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bi]);
3776 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bj]);
3779 AliHLTMUONMansoCandidateStruct a = inblocki[i];
3780 AliHLTMUONMansoCandidateStruct b = inblockj[j];
3781 a.fTrack.fId = b.fTrack.fId = -1;
3784 HLTError("Problem found with Manso track candidate"
3785 " data block %d, fDataType = '%s', fPtr = %p and"
3786 " fSize = %u bytes, and Manso track candidate data block %d,"
3787 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3788 " Problem: The track candidate %d in block %d and entry"
3789 " %d in block %d have the same data."
3790 " The data may have been duplicated.",
3792 DataType2Text(mansoCandidateBlocks[bi]->fDataType).c_str(),
3793 mansoCandidateBlocks[bi]->fPtr,
3794 mansoCandidateBlocks[bi]->fSize,
3796 DataType2Text(mansoCandidateBlocks[bj]->fDataType).c_str(),
3797 mansoCandidateBlocks[bj]->fPtr,
3798 mansoCandidateBlocks[bj]->fSize,
3802 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bi]);
3803 MarkBlock(blocks, blockOk, blockCount, mansoCandidateBlocks[bj]);
3809 for (AliHLTUInt32_t bi = 0; bi < singleDecisionBlocksCount; bi++)
3811 AliHLTMUONSinglesDecisionBlockReader inblocki(singleDecisionBlocks[bi]->fPtr, singleDecisionBlocks[bi]->fSize);
3812 if (not inblocki.BufferSizeOk()) continue;
3814 // Check that the scalars are within reasonable limits.
3815 const AliHLTMUONSinglesDecisionBlockStruct& hdr = inblocki.BlockHeader();
3816 const AliHLTComponentBlockData* block = singleDecisionBlocks[bi];
3817 if (IsScalarTooLarge(block, bi, "single track", "fNlowPt", hdr.fNlowPt, totalTrackCount) or
3818 IsScalarTooLarge(block, bi, "single track", "fNhighPt", hdr.fNhighPt, totalTrackCount) or
3819 IsScalarALargerThanB(block, bi, "single track", "fNhighPt", hdr.fNhighPt, "fNlowPt", hdr.fNlowPt)
3822 MarkBlock(blocks, blockOk, blockCount, block);
3825 // Check if all the Manso track IDs in the trigger decision structures exist.
3826 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3830 for (AliHLTUInt32_t bj = 0; bj < mansoTrackBlocksCount and not found; bj++)
3832 AliHLTMUONMansoTracksBlockReader inblockj(mansoTrackBlocks[bj]->fPtr, mansoTrackBlocks[bj]->fSize);
3833 if (not inblockj.BufferSizeOk()) continue;
3835 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3837 if (inblocki[i].fTrackId == inblockj[j].fId)
3847 HLTError("Problem found with single track trigger decision"
3848 " data block %d, fDataType = '%s', fPtr = %p and"
3849 " fSize = %u bytes."
3850 " Problem with decision %d in block: The track"
3851 " identifier %d does not exist in any Manso tracks"
3854 DataType2Text(singleDecisionBlocks[bi]->fDataType).c_str(),
3855 singleDecisionBlocks[bi]->fPtr,
3856 singleDecisionBlocks[bi]->fSize,
3857 i, inblocki[i].fTrackId
3859 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bi]);
3863 // Check if all the trigger decision structures are unique up to the ID and
3864 // have unique Manso track identifiers.
3865 for (AliHLTUInt32_t bj = bi+1; bj < singleDecisionBlocksCount; bj++)
3867 AliHLTMUONSinglesDecisionBlockReader inblockj(singleDecisionBlocks[bj]->fPtr, singleDecisionBlocks[bj]->fSize);
3868 if (not inblockj.BufferSizeOk()) continue;
3870 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3871 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3873 if (inblocki[i].fTrackId == inblockj[j].fTrackId)
3875 HLTError("Problem found with single track trigger decision"
3876 " data block %d, fDataType = '%s', fPtr = %p and"
3877 " fSize = %u bytes, and single track trigger decision"
3879 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3880 " Problem: The trigger decision %d in block %d and entry"
3881 " %d in block %d have the same Manso track identifier,"
3882 " but they should be unique.",
3884 DataType2Text(singleDecisionBlocks[bi]->fDataType).c_str(),
3885 singleDecisionBlocks[bi]->fPtr,
3886 singleDecisionBlocks[bi]->fSize,
3888 DataType2Text(singleDecisionBlocks[bj]->fDataType).c_str(),
3889 singleDecisionBlocks[bj]->fPtr,
3890 singleDecisionBlocks[bj]->fSize,
3894 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bi]);
3895 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bj]);
3898 AliHLTMUONTrackDecisionStruct a = inblocki[i];
3899 AliHLTMUONTrackDecisionStruct b = inblockj[j];
3900 a.fTrackId = b.fTrackId = -1;
3903 HLTError("Problem found with single track trigger decision"
3904 " data block %d, fDataType = '%s', fPtr = %p and"
3905 " fSize = %u bytes, and single track trigger decision"
3907 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
3908 " Problem: The trigger decision %d in block %d and entry"
3909 " %d in block %d have the same data."
3910 " The data may have been duplicated.",
3912 DataType2Text(singleDecisionBlocks[bi]->fDataType).c_str(),
3913 singleDecisionBlocks[bi]->fPtr,
3914 singleDecisionBlocks[bi]->fSize,
3916 DataType2Text(singleDecisionBlocks[bj]->fDataType).c_str(),
3917 singleDecisionBlocks[bj]->fPtr,
3918 singleDecisionBlocks[bj]->fSize,
3922 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bi]);
3923 MarkBlock(blocks, blockOk, blockCount, singleDecisionBlocks[bj]);
3929 for (AliHLTUInt32_t bi = 0; bi < pairDecisionBlocksCount; bi++)
3931 AliHLTMUONPairsDecisionBlockReader inblocki(pairDecisionBlocks[bi]->fPtr, pairDecisionBlocks[bi]->fSize);
3932 if (not inblocki.BufferSizeOk()) continue;
3934 AliHLTUInt32_t maxPairs = totalTrackCount * (totalTrackCount-1) / 2;
3935 const AliHLTMUONPairsDecisionBlockStruct& hdr = inblocki.BlockHeader();
3936 const AliHLTComponentBlockData* block = pairDecisionBlocks[bi];
3937 if (IsScalarTooLarge(block, bi, "track pair", "fNunlikeAnyPt", hdr.fNunlikeAnyPt, maxPairs) or
3938 IsScalarTooLarge(block, bi, "track pair", "fNunlikeLowPt", hdr.fNunlikeLowPt, maxPairs) or
3939 IsScalarTooLarge(block, bi, "track pair", "fNunlikeHighPt", hdr.fNunlikeHighPt, maxPairs) or
3940 IsScalarTooLarge(block, bi, "track pair", "fNlikeAnyPt", hdr.fNlikeAnyPt, maxPairs) or
3941 IsScalarTooLarge(block, bi, "track pair", "fNlikeLowPt", hdr.fNlikeLowPt, maxPairs) or
3942 IsScalarTooLarge(block, bi, "track pair", "fNlikeHighPt", hdr.fNlikeHighPt, maxPairs) or
3943 IsScalarTooLarge(block, bi, "track pair", "fNmassAny", hdr.fNmassAny, maxPairs) or
3944 IsScalarTooLarge(block, bi, "track pair", "fNmassLow", hdr.fNmassLow, maxPairs) or
3945 IsScalarTooLarge(block, bi, "track pair", "fNmassHigh", hdr.fNmassHigh, maxPairs) or
3946 IsScalarALargerThanB(block, bi, "track pair", "fNunlikeHighPt", hdr.fNunlikeHighPt, "fNunlikeLowPt", hdr.fNunlikeLowPt) or
3947 IsScalarALargerThanB(block, bi, "track pair", "fNunlikeLowPt", hdr.fNunlikeLowPt, "fNunlikeAnyPt", hdr.fNunlikeAnyPt) or
3948 IsScalarALargerThanB(block, bi, "track pair", "fNlikeHighPt", hdr.fNlikeHighPt, "fNlikeLowPt", hdr.fNlikeLowPt) or
3949 IsScalarALargerThanB(block, bi, "track pair", "fNlikeLowPt", hdr.fNlikeLowPt, "fNlikeAnyPt", hdr.fNlikeAnyPt) or
3950 IsScalarALargerThanB(block, bi, "track pair", "fNmassHigh", hdr.fNmassHigh, "fNmassLow", hdr.fNmassLow) or
3951 IsScalarALargerThanB(block, bi, "track pair", "fNmassLow", hdr.fNmassLow, "fNmassAny", hdr.fNmassAny)
3954 MarkBlock(blocks, blockOk, blockCount, block);
3957 // Check if all the Manso track IDs in the trigger decision structures exist.
3958 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
3962 for (AliHLTUInt32_t bj = 0; bj < mansoTrackBlocksCount and not found; bj++)
3964 AliHLTMUONMansoTracksBlockReader inblockj(mansoTrackBlocks[bj]->fPtr, mansoTrackBlocks[bj]->fSize);
3965 if (not inblockj.BufferSizeOk()) continue;
3967 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
3969 if (inblocki[i].fTrackAId == inblockj[j].fId)
3979 HLTError("Problem found with track pair trigger decision"
3980 " data block %d, fDataType = '%s', fPtr = %p and"
3981 " fSize = %u bytes."
3982 " Problem with decision %d in block: The track"
3983 " identifier %d does not exist in any Manso tracks"
3986 DataType2Text(pairDecisionBlocks[bi]->fDataType).c_str(),
3987 pairDecisionBlocks[bi]->fPtr,
3988 pairDecisionBlocks[bi]->fSize,
3989 i, inblocki[i].fTrackAId
3991 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bi]);
3996 for (AliHLTUInt32_t bj = 0; bj < mansoTrackBlocksCount and not found; bj++)
3998 AliHLTMUONMansoTracksBlockReader inblockj(mansoTrackBlocks[bj]->fPtr, mansoTrackBlocks[bj]->fSize);
3999 if (not inblockj.BufferSizeOk()) continue;
4001 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
4003 if (inblocki[i].fTrackBId == inblockj[j].fId)
4013 HLTError("Problem found with track pair trigger decision"
4014 " data block %d, fDataType = '%s', fPtr = %p and"
4015 " fSize = %u bytes."
4016 " Problem with decision %d in block: The track"
4017 " identifier %d does not exist in any Manso tracks"
4020 DataType2Text(pairDecisionBlocks[bi]->fDataType).c_str(),
4021 pairDecisionBlocks[bi]->fPtr,
4022 pairDecisionBlocks[bi]->fSize,
4023 i, inblocki[i].fTrackBId
4025 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bi]);
4029 // Check if all the trigger decision structures are unique up to the ID and
4030 // have unique Manso track identifier pairs.
4031 for (AliHLTUInt32_t bj = bi+1; bj < pairDecisionBlocksCount; bj++)
4033 AliHLTMUONPairsDecisionBlockReader inblockj(pairDecisionBlocks[bj]->fPtr, pairDecisionBlocks[bj]->fSize);
4034 if (not inblockj.BufferSizeOk()) continue;
4036 for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
4037 for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
4039 if (inblocki[i].fTrackAId == inblockj[j].fTrackAId and
4040 inblocki[i].fTrackBId == inblockj[j].fTrackBId
4043 HLTError("Problem found with track pair trigger decision"
4044 " data block %d, fDataType = '%s', fPtr = %p and"
4045 " fSize = %u bytes, and track pair trigger decision"
4047 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
4048 " Problem: The trigger decision %d in block %d and entry"
4049 " %d in block %d have the same Manso track identifier pair,"
4050 " but the pair should be unique.",
4052 DataType2Text(pairDecisionBlocks[bi]->fDataType).c_str(),
4053 pairDecisionBlocks[bi]->fPtr,
4054 pairDecisionBlocks[bi]->fSize,
4056 DataType2Text(pairDecisionBlocks[bj]->fDataType).c_str(),
4057 pairDecisionBlocks[bj]->fPtr,
4058 pairDecisionBlocks[bj]->fSize,
4062 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bi]);
4063 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bj]);
4066 AliHLTMUONPairDecisionStruct a = inblocki[i];
4067 AliHLTMUONPairDecisionStruct b = inblockj[j];
4068 a.fTrackAId = a.fTrackBId = b.fTrackAId = b.fTrackBId = -1;
4071 HLTError("Problem found with track pair trigger decision"
4072 " data block %d, fDataType = '%s', fPtr = %p and"
4073 " fSize = %u bytes, and track pair trigger decision"
4075 " fDataType = '%s', fPtr = %p and fSize = %u bytes."
4076 " Problem: The trigger decision %d in block %d and entry"
4077 " %d in block %d have the same data."
4078 " The data may have been duplicated.",
4080 DataType2Text(pairDecisionBlocks[bi]->fDataType).c_str(),
4081 pairDecisionBlocks[bi]->fPtr,
4082 pairDecisionBlocks[bi]->fSize,
4084 DataType2Text(pairDecisionBlocks[bj]->fDataType).c_str(),
4085 pairDecisionBlocks[bj]->fPtr,
4086 pairDecisionBlocks[bj]->fSize,
4090 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bi]);
4091 MarkBlock(blocks, blockOk, blockCount, pairDecisionBlocks[bj]);