From a090ff227f498f953b94a2a117f966fe766d5c9c Mon Sep 17 00:00:00 2001 From: aszostak Date: Wed, 18 Jun 2008 16:40:30 +0000 Subject: [PATCH] Making important updates to the internal data structures: Adding detector element ID to hits in a packed format. Removing deprecated AliHLTMUONTriggerChannelsBlockStruct structure. Adding parameters for momentum estimation to Manso candidate structures for debugging. Making appropriate changes to AliHLTMUONUtils and AliHLTMUONDataCheckerComponent to validate data integrity of updated internal data structures. Added logical dump facilities for raw DDL data from the muon tracker and trigger. --- HLT/MUON/AliHLTMUONConstants.cxx | 18 +- HLT/MUON/AliHLTMUONConstants.h | 13 - HLT/MUON/AliHLTMUONDataBlockReader.h | 6 - HLT/MUON/AliHLTMUONDataBlockWriter.h | 7 - HLT/MUON/AliHLTMUONDataTypes.h | 3 +- .../AliHLTMUONMansoCandidatesBlockStruct.cxx | 2 + .../AliHLTMUONMansoCandidatesBlockStruct.h | 9 +- HLT/MUON/AliHLTMUONRecHit.cxx | 13 - HLT/MUON/AliHLTMUONRecHit.h | 2 +- HLT/MUON/AliHLTMUONRecHitsBlockStruct.h | 19 +- .../AliHLTMUONTrigRecsDebugBlockStruct.cxx | 8 +- HLT/MUON/AliHLTMUONTrigRecsDebugBlockStruct.h | 10 +- .../AliHLTMUONTriggerChannelsBlockStruct.cxx | 80 -- .../AliHLTMUONTriggerChannelsBlockStruct.h | 107 -- HLT/MUON/AliHLTMUONUtils.cxx | 225 +++- HLT/MUON/AliHLTMUONUtils.h | 65 +- .../AliHLTMUONHitReconstructor.cxx | 9 +- .../AliHLTMUONTriggerReconstructor.cxx | 3 + ...liHLTMUONTriggerReconstructorComponent.cxx | 4 + .../utils/AliHLTMUONDataCheckerComponent.cxx | 310 ++++- .../utils/AliHLTMUONDataCheckerComponent.h | 26 + HLT/MUON/utils/dHLTdumpraw.cxx | 1199 +++++++++++++---- HLT/MUON/utils/dHLTrootify.cxx | 2 - HLT/libAliHLTMUON.pkg | 1 - 24 files changed, 1585 insertions(+), 556 deletions(-) delete mode 100644 HLT/MUON/AliHLTMUONTriggerChannelsBlockStruct.cxx delete mode 100644 HLT/MUON/AliHLTMUONTriggerChannelsBlockStruct.h diff --git a/HLT/MUON/AliHLTMUONConstants.cxx b/HLT/MUON/AliHLTMUONConstants.cxx index 51e0832afdd..91bb8b0ccdb 100644 --- a/HLT/MUON/AliHLTMUONConstants.cxx +++ b/HLT/MUON/AliHLTMUONConstants.cxx @@ -28,7 +28,6 @@ #include "AliHLTMUONConstants.h" #include "AliHLTMUONTriggerRecordsBlockStruct.h" #include "AliHLTMUONTrigRecsDebugBlockStruct.h" -#include "AliHLTMUONTriggerChannelsBlockStruct.h" #include "AliHLTMUONRecHitsBlockStruct.h" #include "AliHLTMUONClustersBlockStruct.h" #include "AliHLTMUONChannelsBlockStruct.h" @@ -50,13 +49,10 @@ AliHLTMUONConstants::fgkNilTriggerRecordStruct = { }; const AliHLTMUONTrigRecInfoStruct -AliHLTMUONConstants::fgkNilTrigRecInfoStruct = {0, {0, 0, 0, 0}, 0, 0}; - -const AliHLTMUONTriggerChannelStruct -AliHLTMUONConstants::fgkNilTriggerChannelStruct = {0, 0, 0, 0}; +AliHLTMUONConstants::fgkNilTrigRecInfoStruct = {0, {0, 0, 0, 0}, 0, 0, {0, 0, 0, 0, 0}}; const AliHLTMUONRecHitStruct -AliHLTMUONConstants::fgkNilRecHitStruct = {0, 0, 0}; +AliHLTMUONConstants::fgkNilRecHitStruct = {0, 0, 0, 0}; const AliHLTMUONClusterStruct AliHLTMUONConstants::fgkNilClusterStruct = { @@ -88,7 +84,8 @@ AliHLTMUONConstants::fgkNilMansoCandidateStruct = { AliHLTMUONConstants::fgkNilMansoRoIStruct, AliHLTMUONConstants::fgkNilMansoRoIStruct, AliHLTMUONConstants::fgkNilMansoRoIStruct - } + }, + 0, 0 }; const AliHLTMUONTrackDecisionStruct @@ -119,13 +116,6 @@ AliHLTMUONConstants::fgkTrigRecsDebugBlockDataType = (AliHLTComponentDataType){ kAliHLTDataOriginAny } | kAliHLTDataOriginMUON; -const AliHLTComponentDataType -AliHLTMUONConstants::fgkTriggerChannelBlockDataType = (AliHLTComponentDataType){ - sizeof(AliHLTComponentDataType), - {'T','R','I','G','C','H','N','L'}, - kAliHLTDataOriginAny -} | kAliHLTDataOriginMUON; - const AliHLTComponentDataType AliHLTMUONConstants::fgkRecHitsBlockDataType = (AliHLTComponentDataType){ sizeof(AliHLTComponentDataType), diff --git a/HLT/MUON/AliHLTMUONConstants.h b/HLT/MUON/AliHLTMUONConstants.h index b4d23deb68c..d45a1a62eec 100644 --- a/HLT/MUON/AliHLTMUONConstants.h +++ b/HLT/MUON/AliHLTMUONConstants.h @@ -32,7 +32,6 @@ extern "C" { struct AliHLTComponentDataType; struct AliHLTMUONTriggerRecordStruct; struct AliHLTMUONTrigRecInfoStruct; -struct AliHLTMUONTriggerChannelStruct; struct AliHLTMUONRecHitStruct; struct AliHLTMUONChannelStruct; struct AliHLTMUONClusterStruct; @@ -62,11 +61,6 @@ public: return fgkNilTrigRecInfoStruct; } - static const AliHLTMUONTriggerChannelStruct& NilTriggerChannelStruct() - { - return fgkNilTriggerChannelStruct; - } - static const AliHLTMUONRecHitStruct& NilRecHitStruct() { return fgkNilRecHitStruct; @@ -127,11 +121,6 @@ public: return fgkTrigRecsDebugBlockDataType; } - static const AliHLTComponentDataType& TriggerChannelBlockDataType() - { - return fgkTriggerChannelBlockDataType; - } - static const AliHLTComponentDataType& RecHitsBlockDataType() { return fgkRecHitsBlockDataType; @@ -248,7 +237,6 @@ private: // The following are null/nil structures that can also be used as sentinels: static const AliHLTMUONTriggerRecordStruct fgkNilTriggerRecordStruct; // Nil trigger record. static const AliHLTMUONTrigRecInfoStruct fgkNilTrigRecInfoStruct; // Nil trigger record debug information. - static const AliHLTMUONTriggerChannelStruct fgkNilTriggerChannelStruct; // Nil trigger chamber channel. static const AliHLTMUONRecHitStruct fgkNilRecHitStruct; // Nil reconstructed hit. static const AliHLTMUONChannelStruct fgkNilChannelStruct; // Nil tracking chamber channel. static const AliHLTMUONClusterStruct fgkNilClusterStruct; // Nil tracking chamber cluster. @@ -262,7 +250,6 @@ private: static const AliHLTComponentDataType fgkDDLRawDataType; // DDL packed data block type from dimuon spectrometer. static const AliHLTComponentDataType fgkTriggerRecordsBlockDataType; // Trigger records block type generated by trigger DDL translation components. static const AliHLTComponentDataType fgkTrigRecsDebugBlockDataType; // Debugging information block type generated by trigger DDL translation components. - static const AliHLTComponentDataType fgkTriggerChannelBlockDataType; // Debugging information about the channels from the hardware trigger. static const AliHLTComponentDataType fgkRecHitsBlockDataType; // Reconstructed hits block type generated by hit reconstruction components. static const AliHLTComponentDataType fgkClusterBlockDataType; // Debugging information block type for reconstructed hit clusters. static const AliHLTComponentDataType fgkChannelBlockDataType; // Debugging information block type for channels corresponding to clusters. diff --git a/HLT/MUON/AliHLTMUONDataBlockReader.h b/HLT/MUON/AliHLTMUONDataBlockReader.h index 015995c0791..ef39b66d9f0 100644 --- a/HLT/MUON/AliHLTMUONDataBlockReader.h +++ b/HLT/MUON/AliHLTMUONDataBlockReader.h @@ -29,7 +29,6 @@ #include "AliHLTMUONTriggerRecordsBlockStruct.h" #include "AliHLTMUONTrigRecsDebugBlockStruct.h" -#include "AliHLTMUONTriggerChannelsBlockStruct.h" #include "AliHLTMUONRecHitsBlockStruct.h" #include "AliHLTMUONClustersBlockStruct.h" #include "AliHLTMUONChannelsBlockStruct.h" @@ -222,11 +221,6 @@ typedef AliHLTMUONDataBlockReader< AliHLTMUONTrigRecInfoStruct > AliHLTMUONTrigRecsDebugBlockReader; -typedef AliHLTMUONDataBlockReader< - AliHLTMUONTriggerChannelsBlockStruct, - AliHLTMUONTriggerChannelStruct - > AliHLTMUONTriggerChannelsBlockReader; - typedef AliHLTMUONDataBlockReader< AliHLTMUONRecHitsBlockStruct, AliHLTMUONRecHitStruct diff --git a/HLT/MUON/AliHLTMUONDataBlockWriter.h b/HLT/MUON/AliHLTMUONDataBlockWriter.h index 3b64410b1bb..c83050231d2 100644 --- a/HLT/MUON/AliHLTMUONDataBlockWriter.h +++ b/HLT/MUON/AliHLTMUONDataBlockWriter.h @@ -29,7 +29,6 @@ #include "AliHLTMUONTriggerRecordsBlockStruct.h" #include "AliHLTMUONTrigRecsDebugBlockStruct.h" -#include "AliHLTMUONTriggerChannelsBlockStruct.h" #include "AliHLTMUONRecHitsBlockStruct.h" #include "AliHLTMUONClustersBlockStruct.h" #include "AliHLTMUONChannelsBlockStruct.h" @@ -309,12 +308,6 @@ typedef AliHLTMUONDataBlockWriter< kTrigRecsDebugDataBlock > AliHLTMUONTrigRecsDebugBlockWriter; -typedef AliHLTMUONDataBlockWriter< - AliHLTMUONTriggerChannelsBlockStruct, - AliHLTMUONTriggerChannelStruct, - kTriggerChannelsDataBlock - > AliHLTMUONTriggerChannelsBlockWriter; - typedef AliHLTMUONDataBlockWriter< AliHLTMUONRecHitsBlockStruct, AliHLTMUONRecHitStruct, diff --git a/HLT/MUON/AliHLTMUONDataTypes.h b/HLT/MUON/AliHLTMUONDataTypes.h index 387332ca28d..7a69920cc3b 100644 --- a/HLT/MUON/AliHLTMUONDataTypes.h +++ b/HLT/MUON/AliHLTMUONDataTypes.h @@ -67,6 +67,7 @@ struct AliHLTMUONHitRecoLutRow */ struct AliHLTMUONTriggerRecoLutRow { + AliHLTUInt32_t fIdFlags; /// The chamber and detector element identifier packed in AliHLTMUONRecHitStruct::fFlags format. AliHLTFloat32_t fX; // Global X coordinate of channel. AliHLTFloat32_t fY; // Global Y coordinate of channel. AliHLTFloat32_t fZ; // Global Z coordinate of channel. @@ -126,7 +127,6 @@ enum AliHLTMUONDataBlockType kUnknownDataBlock = 0, kTriggerRecordsDataBlock = 1000, kTrigRecsDebugDataBlock = 1001, - kTriggerChannelsDataBlock = 1002, kRecHitsDataBlock = 2000, kClustersDataBlock = 2001, kChannelsDataBlock = 2002, @@ -192,7 +192,6 @@ inline std::ostream& operator << (std::ostream& stream, AliHLTMUONDataBlockType case kUnknownDataBlock: stream << "kUnknownDataBlock"; break; case kTriggerRecordsDataBlock: stream << "kTriggerRecordsDataBlock"; break; case kTrigRecsDebugDataBlock: stream << "kTrigRecsDebugDataBlock"; break; - case kTriggerChannelsDataBlock: stream << "kTriggerChannelsDataBlock"; break; case kRecHitsDataBlock: stream << "kRecHitsDataBlock"; break; case kClustersDataBlock: stream << "kClustersDataBlock"; break; case kChannelsDataBlock: stream << "kChannelsDataBlock"; break; diff --git a/HLT/MUON/AliHLTMUONMansoCandidatesBlockStruct.cxx b/HLT/MUON/AliHLTMUONMansoCandidatesBlockStruct.cxx index e0334948ddb..8dee54a8500 100644 --- a/HLT/MUON/AliHLTMUONMansoCandidatesBlockStruct.cxx +++ b/HLT/MUON/AliHLTMUONMansoCandidatesBlockStruct.cxx @@ -49,6 +49,8 @@ std::ostream& operator << ( << ", fRoI[1] = " << candidate.fRoI[1] << ", fRoI[2] = " << candidate.fRoI[2] << ", fRoI[3] = " << candidate.fRoI[3] + << ", fZmiddle = " << candidate.fZmiddle + << ", fBl = " << candidate.fBl << "}"; return stream; } diff --git a/HLT/MUON/AliHLTMUONMansoCandidatesBlockStruct.h b/HLT/MUON/AliHLTMUONMansoCandidatesBlockStruct.h index 10fcadf1697..5da8e0bd15c 100644 --- a/HLT/MUON/AliHLTMUONMansoCandidatesBlockStruct.h +++ b/HLT/MUON/AliHLTMUONMansoCandidatesBlockStruct.h @@ -46,6 +46,10 @@ struct AliHLTMUONMansoCandidateStruct // The regions of interest searched on the various chambers. // fRoI[0] is region of interest on chamber 7, fRoI[1] is on 8 etc... AliHLTMUONMansoRoIStruct fRoI[4]; + + // The parameters used for momentum estimation: + AliHLTFloat32_t fZmiddle; // Z position in the middle of the magnetic field in centimetres. + AliHLTFloat32_t fBl; // The integrated magnetic field in (T.m) tesla metres. }; /** @@ -75,7 +79,7 @@ std::ostream& operator << ( /** * Stream operator for usage with std::ostream classes which prints the track * candidate information in the following format: - * {fTrack = xx, fRoI[0] = {...}, fRoI[1] = {...}, fRoI[2] = {...}, fRoI[3] = {...}} + * {fTrack = xx, fRoI[0] = {...}, fRoI[1] = {...}, fRoI[2] = {...}, fRoI[3] = {...}, fZmiddle = yy, fBl = zz} */ std::ostream& operator << ( std::ostream& stream, const AliHLTMUONMansoCandidateStruct& candidate @@ -108,7 +112,8 @@ inline bool operator == ( { return a.fTrack == b.fTrack and a.fRoI[0] == b.fRoI[0] and a.fRoI[1] == b.fRoI[1] - and a.fRoI[2] == b.fRoI[2] and a.fRoI[3] == b.fRoI[3]; + and a.fRoI[2] == b.fRoI[2] and a.fRoI[3] == b.fRoI[3] + and a.fZmiddle == b.fZmiddle and a.fBl == b.fBl; } inline bool operator != ( diff --git a/HLT/MUON/AliHLTMUONRecHit.cxx b/HLT/MUON/AliHLTMUONRecHit.cxx index 361ac6df832..66b36adf7f4 100644 --- a/HLT/MUON/AliHLTMUONRecHit.cxx +++ b/HLT/MUON/AliHLTMUONRecHit.cxx @@ -72,19 +72,6 @@ Int_t AliHLTMUONRecHit::Chamber(bool warn) const /// \param warn Indicates if any warning should be printed in case of problems. /// \returns The chamber number of this hit in the range [1..14] or -1 if not known. - if (fSourceDDL != -1) - { - if (fSourceDDL < 1 or fSourceDDL > 20) - { - return ((fSourceDDL-1) / 2) + 1; - } - else if (warn) - { - AliError(Form("The DDL source number: %d is out of range." - " Valid values are [1..20]", fSourceDDL - )); - } - } if (fDetElemId != -1) return AliMpDEManager::GetChamberId(fDetElemId, warn); if (warn) diff --git a/HLT/MUON/AliHLTMUONRecHit.h b/HLT/MUON/AliHLTMUONRecHit.h index e73bbab77e7..1f4ac84227f 100644 --- a/HLT/MUON/AliHLTMUONRecHit.h +++ b/HLT/MUON/AliHLTMUONRecHit.h @@ -188,7 +188,7 @@ public: /** * Returns the chamber number of this hit in the range [1..14]. * If -1 is returned then the chamber number is not known because the - * extra debugging information such as detector element ID was not set. + * detector element ID was not set or is invalid. * @param warn Indicates if any warning should be printed in case of problems. */ Int_t Chamber(bool warn = true) const; diff --git a/HLT/MUON/AliHLTMUONRecHitsBlockStruct.h b/HLT/MUON/AliHLTMUONRecHitsBlockStruct.h index 4f8529b052a..7b4a58e4473 100644 --- a/HLT/MUON/AliHLTMUONRecHitsBlockStruct.h +++ b/HLT/MUON/AliHLTMUONRecHitsBlockStruct.h @@ -29,6 +29,18 @@ extern "C" */ struct AliHLTMUONRecHitStruct { + // The flags word constains the following bit fields (bit 31 is most + // significant): + // + // bits: [ 31 -- 16 ][ 15 -- 12 ][ 11 --- 0 ] + // field: reserved chamber detElemId + // + // Where we have, + // reserved bits must be set to zero. + // chamber - specifies the chamber number in the range [0..13], 0xF for invalid. + // detElemId - specifies the detector element ID number. + AliHLTUInt32_t fFlags; + AliHLTFloat32_t fX; // X coordinate. AliHLTFloat32_t fY; // Y coordinate. AliHLTFloat32_t fZ; // Z coordinate. @@ -57,8 +69,9 @@ inline std::ostream& operator << ( std::ostream& stream, const AliHLTMUONRecHitStruct& hit ) { - stream << "{fX = " << hit.fX << ", fY = " << hit.fY << ", fZ = " - << hit.fZ << "}"; + stream << "{fFlags = " << std::showbase << std::hex + << hit.fFlags << std::dec << ", fX = " << hit.fX + << ", fY = " << hit.fY << ", fZ = " << hit.fZ << "}"; return stream; } @@ -76,7 +89,7 @@ inline bool operator == ( const AliHLTMUONRecHitStruct& a, const AliHLTMUONRecHitStruct& b ) { - return a.fX == b.fX and a.fY == b.fY and a.fZ == b.fZ; + return a.fFlags == b.fFlags and a.fX == b.fX and a.fY == b.fY and a.fZ == b.fZ; } inline bool operator != ( diff --git a/HLT/MUON/AliHLTMUONTrigRecsDebugBlockStruct.cxx b/HLT/MUON/AliHLTMUONTrigRecsDebugBlockStruct.cxx index 87a3942ebb7..3b96b924091 100644 --- a/HLT/MUON/AliHLTMUONTrigRecsDebugBlockStruct.cxx +++ b/HLT/MUON/AliHLTMUONTrigRecsDebugBlockStruct.cxx @@ -38,7 +38,13 @@ std::ostream& operator << ( << ", " << info.fDetElemId[3] << "], fZmiddle = " << info.fZmiddle << ", fBl = " << info.fBl - << "}"; + << ", fL0Struct = {fX2X1 = " << std::showbase << std::hex + << info.fL0Struct.fX2X1 + << ", fX4X3 = " << info.fL0Struct.fX4X3 + << ", fY2Y1 = " << info.fL0Struct.fY2Y1 + << ", fY4Y3 = " << info.fL0Struct.fY4Y3 + << ", fTriggerBits = " << info.fL0Struct.fTriggerBits + << std::dec << "}}"; return stream; } diff --git a/HLT/MUON/AliHLTMUONTrigRecsDebugBlockStruct.h b/HLT/MUON/AliHLTMUONTrigRecsDebugBlockStruct.h index 7f8eaee9416..97c0bbef34b 100644 --- a/HLT/MUON/AliHLTMUONTrigRecsDebugBlockStruct.h +++ b/HLT/MUON/AliHLTMUONTrigRecsDebugBlockStruct.h @@ -17,6 +17,7 @@ */ #include "AliHLTMUONDataTypes.h" +#include "AliMUONTriggerDDLDecoderEventHandler.h" extern "C" { @@ -38,6 +39,8 @@ struct AliHLTMUONTrigRecInfoStruct // The parameters used for momentum estimation: AliHLTFloat32_t fZmiddle; // Z position in the middle of the magnetic field in centimetres. AliHLTFloat32_t fBl; // The integrated magnetic field in (T.m) tesla metres. + + AliMUONLocalInfoStruct fL0Struct; // Copy of the L0 local trigger structure bits. }; /** @@ -80,7 +83,12 @@ inline bool operator == ( ) { return a.fTrigRecId == b.fTrigRecId and a.fDetElemId == b.fDetElemId - and a.fZmiddle == b.fZmiddle and a.fBl == b.fBl; + and a.fZmiddle == b.fZmiddle and a.fBl == b.fBl + and a.fL0Struct.fX2X1 == b.fL0Struct.fX2X1 + and a.fL0Struct.fX4X3 == b.fL0Struct.fX4X3 + and a.fL0Struct.fY2Y1 == b.fL0Struct.fY2Y1 + and a.fL0Struct.fY4Y3 == b.fL0Struct.fY4Y3 + and a.fL0Struct.fTriggerBits == b.fL0Struct.fTriggerBits; } inline bool operator != ( diff --git a/HLT/MUON/AliHLTMUONTriggerChannelsBlockStruct.cxx b/HLT/MUON/AliHLTMUONTriggerChannelsBlockStruct.cxx deleted file mode 100644 index 60328a9f320..00000000000 --- a/HLT/MUON/AliHLTMUONTriggerChannelsBlockStruct.cxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************** - * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - -/* $Id$ */ - -/** - * @file AliHLTMUONTriggerChannelsBlockStruct.cxx - * @author Artur Szostak - * @date - * @brief Implementation of the stream and comparison operators. - */ - -#include "AliHLTMUONTriggerChannelsBlockStruct.h" -#include "AliHLTMUONUtils.h" -#include - -std::ostream& operator << ( - std::ostream& stream, const AliHLTMUONTriggerChannelStruct& channel - ) -{ - stream << "{fTrigRecId = " << channel.fTrigRecId - << ", fChamber = " << channel.fChamber - << ", fSignal = " << channel.fSignal - << ", fRawDataWord = " << std::showbase << std::hex - << channel.fRawDataWord << std::dec << "}"; - return stream; -} - - -std::ostream& operator << ( - std::ostream& stream, - const AliHLTMUONTriggerChannelsBlockStruct& block - ) -{ - assert( AliHLTMUONUtils::IntegrityOk(block) ); - - const AliHLTMUONTriggerChannelStruct* channel = - reinterpret_cast(&block + 1); - stream << "{fHeader = " << block.fHeader << ", fChannel[] = ["; - if (block.fHeader.fNrecords > 0) stream << channel[0]; - for (AliHLTUInt32_t i = 1; i < block.fHeader.fNrecords; i++) - stream << ", " << channel[i]; - stream << "]}"; - return stream; -} - - -bool operator == ( - const AliHLTMUONTriggerChannelsBlockStruct& a, - const AliHLTMUONTriggerChannelsBlockStruct& b - ) -{ - assert( AliHLTMUONUtils::IntegrityOk(a) ); - assert( AliHLTMUONUtils::IntegrityOk(b) ); - - const AliHLTMUONTriggerChannelStruct* channelA = - reinterpret_cast(&a + 1); - const AliHLTMUONTriggerChannelStruct* channelB = - reinterpret_cast(&b + 1); - - // First check if the blocks have the same header. If they do then check - // if every channel is the same. In either case if we find a difference - // return false. - if (a.fHeader != b.fHeader) return false; - for (AliHLTUInt32_t i = 0; i < a.fHeader.fNrecords; i++) - if (channelA[i] != channelB[i]) return false; - return true; -} diff --git a/HLT/MUON/AliHLTMUONTriggerChannelsBlockStruct.h b/HLT/MUON/AliHLTMUONTriggerChannelsBlockStruct.h deleted file mode 100644 index d0a66729bc5..00000000000 --- a/HLT/MUON/AliHLTMUONTriggerChannelsBlockStruct.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef ALIHLTMUONTRIGGERCHANNELSBLOCKSTRUCT_H -#define ALIHLTMUONTRIGGERCHANNELSBLOCKSTRUCT_H -/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* $Id$ */ - -/** - * @file AliHLTMUONTriggerChannelsBlockStruct.h - * @author Artur Szostak - * @date - * @brief Definition of internal dimuon HLT block structure containing - * debugging information about channels that belong to trigger records. - * - * The structures are defined with C linkage since C generally gives us more - * binary compatibility between compilers. - */ - -#include "AliHLTMUONDataTypes.h" -#include - -extern "C" -{ - -/** - * Gives the fired channel/strip information which was considered during - * hit reconstruction on trigger chambers and correlated into a common cluster. - */ -struct AliHLTMUONTriggerChannelStruct -{ - AliHLTInt32_t fTrigRecId; // ID corresponding to the trigger records this - // channel is part of. -1 == invalid. - - AliHLTUInt16_t fChamber; // The chamber this hit corresponds to. - // In the range [11..14]. - - AliHLTUInt16_t fSignal; // ADC value of signal. - AliHLTUInt32_t fRawDataWord; // The raw data word as found in the DDL stream. -}; - -/** - * AliHLTMUONTriggerChannelsBlockStruct defines the format of the internal - * channel data block corresponding to clusters on the trigger chambers. - */ -struct AliHLTMUONTriggerChannelsBlockStruct -{ - AliHLTMUONDataBlockHeader fHeader; // Common data block header - - // Array of trigger channels/strips. - //AliHLTMUONTriggerChannelStruct fChannel[/*fHeader.fNrecords*/]; -}; - -} // extern "C" - - -/** - * Stream operator for usage with std::ostream classes which prints the - * AliHLTMUONTriggerChannelStruct in the following format: - * {fTrigRecId = xx, fChamber = yy, fSignal = zz, fRawDataWord = 0xXXXXXXXX} - */ -std::ostream& operator << ( - std::ostream& stream, const AliHLTMUONTriggerChannelStruct& channel - ); - -/** - * Stream operator for usage with std::ostream classes which prints the - * AliHLTMUONTriggerChannelsBlockStruct in the following format: - * {fHeader = xx, fChannel[] = [{..}, {..}, ...]} - */ -std::ostream& operator << ( - std::ostream& stream, - const AliHLTMUONTriggerChannelsBlockStruct& block - ); - - -inline bool operator == ( - const AliHLTMUONTriggerChannelStruct& a, - const AliHLTMUONTriggerChannelStruct& b - ) -{ - return a.fTrigRecId == b.fTrigRecId and a.fChamber == b.fChamber and - a.fSignal == b.fSignal and a.fRawDataWord == b.fRawDataWord; -} - -inline bool operator != ( - const AliHLTMUONTriggerChannelStruct& a, - const AliHLTMUONTriggerChannelStruct& b - ) -{ - return not operator == (a, b); -} - - -bool operator == ( - const AliHLTMUONTriggerChannelsBlockStruct& a, - const AliHLTMUONTriggerChannelsBlockStruct& b - ); - -inline bool operator != ( - const AliHLTMUONTriggerChannelsBlockStruct& a, - const AliHLTMUONTriggerChannelsBlockStruct& b - ) -{ - return not operator == (a, b); -} - -#endif // ALIHLTMUONTRIGGERCHANNELSBLOCKSTRUCT_H diff --git a/HLT/MUON/AliHLTMUONUtils.cxx b/HLT/MUON/AliHLTMUONUtils.cxx index 43cfd05a9de..697cef20a2a 100644 --- a/HLT/MUON/AliHLTMUONUtils.cxx +++ b/HLT/MUON/AliHLTMUONUtils.cxx @@ -26,7 +26,6 @@ #include "AliHLTMUONConstants.h" #include "AliHLTMUONTriggerRecordsBlockStruct.h" #include "AliHLTMUONTrigRecsDebugBlockStruct.h" -#include "AliHLTMUONTriggerChannelsBlockStruct.h" #include "AliHLTMUONRecHitsBlockStruct.h" #include "AliHLTMUONClustersBlockStruct.h" #include "AliHLTMUONChannelsBlockStruct.h" @@ -93,6 +92,37 @@ void AliHLTMUONUtils::UnpackTriggerRecordFlags( } +AliHLTUInt32_t AliHLTMUONUtils::PackRecHitFlags( + AliHLTUInt8_t chamber, AliHLTUInt16_t detElemId + ) +{ + /// This packs the given parameters into the bits of a word appropriate + /// for AliHLTMUONRecHitStruct::fFlags. + /// @param chamber The chamber number in the range [0..13]. + /// @param detElemId Detector element ID number. + /// @return Returns the 32 bit packed word. + + return ((chamber & 0xF) << 12) | (detElemId & 0xFFF); +} + + +void AliHLTMUONUtils::UnpackRecHitFlags( + AliHLTUInt32_t flags, // [in] + AliHLTUInt8_t& chamber, // [out] + AliHLTUInt16_t& detElemId // [out] + ) +{ + /// This unpacks the AliHLTMUONRecHitStruct::fFlags bits into + /// its component fields. + /// [in] @param flags The flags from an AliHLTMUONRecHitStruct structure. + /// [out] @param chamber Sets the chamber number in the range [0..13]. + /// [out] @param detElemId Sets the detector element ID number. + + chamber = (flags >> 12) & 0xF; + detElemId = flags & 0xFFF; +} + + AliHLTUInt32_t AliHLTMUONUtils::PackTrackDecisionBits(bool highPt, bool lowPt) { /// @@ -392,10 +422,6 @@ AliHLTMUONDataBlockType AliHLTMUONUtils::ParseCommandLineTypeString(const char* { return kTrigRecsDebugDataBlock; } - else if (strcmp(type, "trigchannels") == 0) - { - return kTriggerChannelsDataBlock; - } else if (strcmp(type, "rechits") == 0) { return kRecHitsDataBlock; @@ -444,9 +470,6 @@ const char* AliHLTMUONUtils::DataBlockTypeToString(AliHLTMUONDataBlockType type) case kTrigRecsDebugDataBlock: t = AliHLTMUONConstants::TrigRecsDebugBlockDataType(); break; - case kTriggerChannelsDataBlock: - t = AliHLTMUONConstants::TriggerChannelBlockDataType(); - break; case kRecHitsDataBlock: t = AliHLTMUONConstants::RecHitsBlockDataType(); break; @@ -494,6 +517,7 @@ const char* AliHLTMUONUtils::FailureReasonToString(WhyNotValid reason) case kParticleSignBitsNotValid: return "kParticleSignBitsNotValid"; case kHitNotMarkedAsNil: return "kHitNotMarkedAsNil"; case kInvalidDetElementNumber: return "kInvalidDetElementNumber"; + case kInvalidChamberNumber: return "kInvalidChamberNumber"; case kHitIsNil: return "kHitIsNil"; case kInvalidChannelCount: return "kInvalidChannelCount"; case kInvalidBusPatchId: return "kInvalidBusPatchId"; @@ -550,6 +574,8 @@ const char* AliHLTMUONUtils::FailureReasonToMessage(WhyNotValid reason) " structure was not set to nil."; case kInvalidDetElementNumber: return "An invalid detector element ID was found."; + case kInvalidChamberNumber: + return "An invalid chamber number was found."; case kHitIsNil: return "The hit cannot be set to a nil value."; case kInvalidChannelCount: @@ -623,6 +649,7 @@ bool AliHLTMUONUtils::RecordNumberWasSet(WhyNotValid reason) case kParticleSignBitsNotValid: case kHitNotMarkedAsNil: case kInvalidDetElementNumber: + case kInvalidChamberNumber: case kHitIsNil: case kInvalidChannelCount: case kInvalidBusPatchId: @@ -738,37 +765,6 @@ bool AliHLTMUONUtils::HeaderOk( } -bool AliHLTMUONUtils::HeaderOk( - const AliHLTMUONTriggerChannelsBlockStruct& block, - WhyNotValid* reason - ) -{ - /// Method used to check if the header information corresponds to the - /// supposed type of the raw dHLT data block. - /// [in] \param block The data block to check. - /// [out] \param reason If this is not NULL, then it will be filled with - /// the reason code describing why the header is not valid, if and - /// only if a problem is found with the data. - /// \returns true if there is no problem with the header and false otherwise. - - // The block must have the correct type. - if (block.fHeader.fType != kTriggerChannelsDataBlock) - { - if (reason != NULL) *reason = kHeaderContainsWrongType; - return false; - } - - // The block's record width must be the correct size. - if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTriggerChannelStruct)) - { - if (reason != NULL) *reason = kHeaderContainsWrongRecordWidth; - return false; - } - - return true; -} - - bool AliHLTMUONUtils::HeaderOk( const AliHLTMUONRecHitsBlockStruct& block, WhyNotValid* reason, AliHLTUInt32_t& reasonCount @@ -1179,6 +1175,17 @@ bool AliHLTMUONUtils::IntegrityOk( } result = false; } + + // Check the individual hits + for (int i = 0; i < 4; i++) + { + AliHLTUInt32_t filledCount = maxCount - reasonCount; + if (not IntegrityOk(tr.fHit[i], reason + reasonCount, filledCount)) + { + reasonCount += filledCount; + result = false; + } + } return result; } @@ -1207,6 +1214,8 @@ bool AliHLTMUONUtils::IntegrityOk( /// - kReservedBitsNotZero /// - kParticleSignBitsNotValid /// - kHitNotMarkedAsNil + /// - kInvalidDetElementNumber + /// - kInvalidChamberNumber /// \note You can use RecordNumberWasSet(reason[i]) to check if 'recordNum[i]' /// was set and is valid or not. /// [in/out] \param reasonCount This should initially specify the size of @@ -1296,10 +1305,14 @@ bool AliHLTMUONUtils::IntegrityOk( } // Check that the fDetElemId[i] numbers are valid. - if ( not (trigInfo.fDetElemId[0] >= 0 or trigInfo.fDetElemId[0] == -1) or - not (trigInfo.fDetElemId[1] >= 0 or trigInfo.fDetElemId[1] == -1) or - not (trigInfo.fDetElemId[2] >= 0 or trigInfo.fDetElemId[2] == -1) or - not (trigInfo.fDetElemId[3] >= 0 or trigInfo.fDetElemId[3] == -1) + if ( not ((trigInfo.fDetElemId[0] >= 100 and trigInfo.fDetElemId[0] < 1500) + or trigInfo.fDetElemId[0] == -1) + or not ((trigInfo.fDetElemId[1] >= 100 and trigInfo.fDetElemId[1] < 1500) + or trigInfo.fDetElemId[1] == -1) + or not ((trigInfo.fDetElemId[2] >= 100 and trigInfo.fDetElemId[2] < 1500) + or trigInfo.fDetElemId[2] == -1) + or not ((trigInfo.fDetElemId[3] >= 100 and trigInfo.fDetElemId[3] < 1500) + or trigInfo.fDetElemId[3] == -1) ) { if (reason != NULL and reasonCount < maxCount) @@ -1392,40 +1405,103 @@ bool AliHLTMUONUtils::IntegrityOk( bool AliHLTMUONUtils::IntegrityOk( - const AliHLTMUONTriggerChannelsBlockStruct& block, - WhyNotValid* reason + const AliHLTMUONRecHitStruct& hit, + WhyNotValid* reason, + AliHLTUInt32_t& reasonCount ) { /// This method is used to check more extensively if the integrity of the - /// dHLT raw internal data block is OK and returns true in that case. - /// [in] \param block The trigger channels data block to check. - /// [out] \param reason If this is not NULL, then it will be filled with - /// the reason code describing why the data block is not valid, if and - /// only if a problem is found with the data. - /// \returns true if there is no problem with the data and false otherwise. + /// reconstructed hit structure is OK and returns true in that case. + /// [in] \param hit The reconstructed hit structure to check. + /// [out] \param reason If this is not NULL, then it is assumed to point + /// to an array of at least 'reasonCount' number of elements. It will + /// be filled with the reason codes describing why the structure is + /// not valid. + /// [in/out] \param reasonCount This should initially specify the size of + /// the array pointed to by 'reason'. It will be filled with the number + /// of items actually filled into the reason array upon exit from this + /// method. + /// \returns true if there is no problem with the structure and false otherwise. - if (not HeaderOk(block, reason)) return false; - return true; + AliHLTUInt32_t maxCount = reasonCount; + reasonCount = 0; + bool result = true; + + // If this is a NIL hit then skip all other checks. + if (hit == AliHLTMUONConstants::NilRecHitStruct()) + { + return true; + } + + // Make sure that the reserved bits in the fFlags field are set + // to zero. + if ((hit.fFlags & 0x3FFF0000) != 0) + { + if (reason != NULL and reasonCount < maxCount) + { + reason[reasonCount] = kReservedBitsNotZero; + reasonCount++; + } + result = false; + } + + AliHLTUInt32_t detElemId = hit.fFlags & 0x00000FFF; + AliHLTUInt32_t chamber = (hit.fFlags & 0x0000F000) >> 12; + + // Make sure the detector element ID number is valid. + if (not (detElemId >= 100 and detElemId < 1500)) + { + if (reason != NULL and reasonCount < maxCount) + { + reason[reasonCount] = kInvalidDetElementNumber; + reasonCount++; + } + result = false; + } + + // Make sure the chamber number is valid. + if (((detElemId / 100) - 1) != chamber or chamber >= 14) + { + if (reason != NULL and reasonCount < maxCount) + { + reason[reasonCount] = kInvalidChamberNumber; + reasonCount++; + } + result = false; + } + + return result; } bool AliHLTMUONUtils::IntegrityOk( const AliHLTMUONRecHitsBlockStruct& block, WhyNotValid* reason, + AliHLTUInt32_t* recordNum, AliHLTUInt32_t& reasonCount ) { /// This method is used to check more extensively if the integrity of the - /// dHLT raw internal data block is OK and returns true in that case. + /// dHLT raw internal hits data block is OK and returns true in that case. /// [in] \param block The reconstructed hits data block to check. /// [out] \param reason If this is not NULL, then it is assumed to point /// to an array of at least 'reasonCount' number of elements. It will /// be filled with the reason codes describing why the data block is /// not valid. + /// [out] \param recordNum If this is not NULL, then it is assumed to point + /// to an array of at least 'reasonCount' number of elements. It will + /// be filled with the number of the reconstructed hits that had a problem. + /// The value 'recordNum[i]' will only contain a valid value if + /// the corresponding 'reason[i]' contains one of: + /// - kReservedBitsNotZero + /// - kInvalidDetElementNumber + /// - kInvalidChamberNumber + /// \note You can use RecordNumberWasSet(reason[i]) to check if 'recordNum[i]' + /// was set and is valid or not. /// [in/out] \param reasonCount This should initially specify the size of - /// the array pointed to by 'reason'. It will be filled with the number - /// of items actually filled into the reason array upon exit from this - /// method. + /// the array pointed to by 'reason' and 'recordNum'. It will be filled + /// with the number of items actually filled into the arrays upon exit + /// from this method. /// \returns true if there is no problem with the data and false otherwise. AliHLTUInt32_t maxCount = reasonCount; @@ -1451,6 +1527,24 @@ bool AliHLTMUONUtils::IntegrityOk( } } } + + // Check integrity of the individual hit structures. + for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++) + { + AliHLTUInt32_t filledCount = maxCount - reasonCount; + if (not IntegrityOk(hit[i], reason+reasonCount, filledCount)) + { + // reasons filled in IntegrityOk, now we just need to adjust + // reasonCount and fill the recordNum values. + if (recordNum != NULL) + { + for (AliHLTUInt32_t n = 0; n < filledCount; n++) + recordNum[reasonCount + n] = i; + } + reasonCount += filledCount; + result = false; + } + } return result; } @@ -1502,7 +1596,9 @@ bool AliHLTMUONUtils::IntegrityOk( } // Make sure the detector element is a valid value. - if (not (cluster.fDetElemId >= 0 or cluster.fDetElemId == -1)) + if (not ((cluster.fDetElemId >= 100 and cluster.fDetElemId < 1500) + or cluster.fDetElemId == -1) + ) { if (reason != NULL and reasonCount < maxCount) { @@ -1913,6 +2009,17 @@ bool AliHLTMUONUtils::IntegrityOk( result = false; } + // Check the individual hits + for (int i = 0; i < 4; i++) + { + AliHLTUInt32_t filledCount = maxCount - reasonCount; + if (not IntegrityOk(track.fHit[i], reason + reasonCount, filledCount)) + { + reasonCount += filledCount; + result = false; + } + } + return result; } @@ -1943,6 +2050,8 @@ bool AliHLTMUONUtils::IntegrityOk( /// - kHitNotMarkedAsNil /// - kChiSquareInvalid /// - kMomentumVectorNotZero + /// - kInvalidDetElementNumber + /// - kInvalidChamberNumber /// \note You can use RecordNumberWasSet(reason[i]) to check if 'recordNum[i]' /// was set and is valid or not. /// [in/out] \param reasonCount This should initially specify the size of diff --git a/HLT/MUON/AliHLTMUONUtils.h b/HLT/MUON/AliHLTMUONUtils.h index 491550d949d..e54443ee39a 100644 --- a/HLT/MUON/AliHLTMUONUtils.h +++ b/HLT/MUON/AliHLTMUONUtils.h @@ -21,7 +21,7 @@ struct AliHLTMUONTriggerRecordStruct; struct AliHLTMUONTriggerRecordsBlockStruct; struct AliHLTMUONTrigRecInfoStruct; struct AliHLTMUONTrigRecsDebugBlockStruct; -struct AliHLTMUONTriggerChannelsBlockStruct; +struct AliHLTMUONRecHitStruct; struct AliHLTMUONRecHitsBlockStruct; struct AliHLTMUONClusterStruct; struct AliHLTMUONClustersBlockStruct; @@ -71,6 +71,30 @@ public: AliHLTMUONParticleSign& sign, // [out] bool hitset[4] // [out] ); + + /** + * This packs the given parameters into the bits of a word appropriate + * for AliHLTMUONRecHitStruct::fFlags. + * @param chamber The chamber number in the range [0..13]. + * @param detElemId Detector element ID number. + * @return Returns the 32 bit packed word. + */ + static AliHLTUInt32_t PackRecHitFlags( + AliHLTUInt8_t chamber, AliHLTUInt16_t detElemId + ); + + /** + * This unpacks the AliHLTMUONRecHitStruct::fFlags bits into + * its component fields. + * [in] @param flags The flags from an AliHLTMUONRecHitStruct structure. + * [out] @param chamber Sets the chamber number in the range [0..13]. + * [out] @param detElemId Sets the detector element ID number. + */ + static void UnpackRecHitFlags( + AliHLTUInt32_t flags, // [in] + AliHLTUInt8_t& chamber, // [out] + AliHLTUInt16_t& detElemId // [out] + ); /** * This packs the given parameters into the bits of a word appropriate @@ -334,6 +358,7 @@ public: kParticleSignBitsNotValid, ///< The particle sign bits are not a valid value. kHitNotMarkedAsNil, ///< A hit was marked as not found, but the corresponding hit structure was not set to nil. kInvalidDetElementNumber, ///< An invalid detector element ID was found. + kInvalidChamberNumber, ///< An invalid chamber number was found. kHitIsNil, ///< The hit cannot be set to a nil value. kInvalidChannelCount, ///< The number of channels indicated is zero or outside the valid range. kInvalidBusPatchId, ///< The bus patch ID is outside the valid range. @@ -402,9 +427,6 @@ public: return HeaderOk(block, reason, count); } - // this method is deprecated. - static bool HeaderOk(const AliHLTMUONTriggerChannelsBlockStruct& block, WhyNotValid* reason = NULL); - /** * Method used to check if the header information corresponds to the * supposed type of the reconstructed hits data block. @@ -665,8 +687,23 @@ public: return IntegrityOk(block, reason, recordNum, count); } - // this method is deprecated. - static bool IntegrityOk(const AliHLTMUONTriggerChannelsBlockStruct& block, WhyNotValid* reason = NULL); + /** + * This method is used to check more extensively if the integrity of the + * reconstructed hit structure is OK and returns true in that case. + * [in] \param hit The reconstructed hit structure to check. + * [out] \param reason If this is not NULL, then it will be filled with + * the reason code describing why the structure is not valid, if and + * only if a problem is found with the data. + * \returns true if there is no problem with the data and false otherwise. + */ + static bool IntegrityOk( + const AliHLTMUONRecHitStruct& hit, + WhyNotValid* reason = NULL + ) + { + AliHLTUInt32_t count = 1; + return IntegrityOk(hit, reason, count); + } /** * This method is used to check more extensively if the integrity of the @@ -675,15 +712,19 @@ public: * [out] \param reason If this is not NULL, then it will be filled with * the reason code describing why the data block is not valid, if and * only if a problem is found with the data. + * [out] \param recordNum If this is not NULL, then it will be filled with + * the number of the cluster structure that had a problem. This value + * will only contain a valid value if the method + * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set. * \returns true if there is no problem with the data and false otherwise. */ static bool IntegrityOk( const AliHLTMUONRecHitsBlockStruct& block, - WhyNotValid* reason = NULL + WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL ) { AliHLTUInt32_t count = 1; - return IntegrityOk(block, reason, count); + return IntegrityOk(block, reason, recordNum, count); } /** @@ -956,10 +997,16 @@ public: ); static bool IntegrityOk( - const AliHLTMUONRecHitsBlockStruct& block, + const AliHLTMUONRecHitStruct& hit, WhyNotValid* reason, AliHLTUInt32_t& reasonCount ); + static bool IntegrityOk( + const AliHLTMUONRecHitsBlockStruct& block, + WhyNotValid* reason, AliHLTUInt32_t* recordNum, + AliHLTUInt32_t& reasonCount + ); + static bool IntegrityOk( const AliHLTMUONClusterStruct& cluster, WhyNotValid* reason, AliHLTUInt32_t& reasonCount diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.cxx b/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.cxx index e7e27657e13..544ae221604 100644 --- a/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.cxx +++ b/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.cxx @@ -35,6 +35,7 @@ #include "AliHLTMUONHitReconstructor.h" #include "AliHLTMUONRecHitsBlockStruct.h" +#include "AliHLTMUONUtils.h" #include #include @@ -685,8 +686,12 @@ bool AliHLTMUONHitReconstructor::MergeRecHits() HLTError("Number of RecHit (i.e. %d) exceeds the max number of RecHit limit %d.",(*fRecPointsCount),fMaxRecPointsCount); return false; } - - //fRecPoints[(*fRecPointsCount)].fId = idCentralB; + + AliHLTUInt32_t idflags = AliHLTMUONUtils::PackRecHitFlags( + (fPadData[idCentralB].fDetElemId / 100) - 1, + fPadData[idCentralB].fDetElemId + ); + fRecPoints[(*fRecPointsCount)].fFlags = idflags; fRecPoints[(*fRecPointsCount)].fX = fRecX[nb]; fRecPoints[(*fRecPointsCount)].fY = fRecY[b]; fRecPoints[(*fRecPointsCount)].fZ = fPadData[idCentralB].fRealZ; diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructor.cxx b/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructor.cxx index b834e8dbb92..4f5ac30c519 100644 --- a/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructor.cxx +++ b/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructor.cxx @@ -135,6 +135,7 @@ AliHLTMUONTriggerReconstructor::AliDecoderHandler::AliDecoderHandler() : for (Int_t n = 0; n < 2; n++) for (Int_t m = 0; m < 16; m++) { + fLookupTable.fRow[i][j][k][n][m].fIdFlags = 0x0; fLookupTable.fRow[i][j][k][n][m].fX = 0; fLookupTable.fRow[i][j][k][n][m].fY = 0; fLookupTable.fRow[i][j][k][n][m].fZ = 0; @@ -221,6 +222,8 @@ void AliHLTMUONTriggerReconstructor::AliDecoderHandler::OnLocalStruct( { fOutputTrigRecs[fOutputTrigRecsCount].fHit[iChamber].fX = fLookupTable.fRow[iReg][iLoc][iChamber][iPlane][ibitxy].fX; + fOutputTrigRecs[fOutputTrigRecsCount].fHit[iChamber].fFlags = + fLookupTable.fRow[iReg][iLoc][iChamber][iPlane][ibitxy].fIdFlags; setX[iChamber] = true; } else diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.cxx b/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.cxx index 492d99586d8..1ceb856aa9a 100644 --- a/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.cxx +++ b/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.cxx @@ -564,6 +564,7 @@ int AliHLTMUONTriggerReconstructorComponent::ReadCDB(const char* cdbPath, Int_t for (Int_t n = 0; n < 2; n++) for (Int_t m = 0; m < 16; m++) { + lookupTable->fRow[i][j][k][n][m].fIdFlags = 0x0; lookupTable->fRow[i][j][k][n][m].fX = 0; lookupTable->fRow[i][j][k][n][m].fY = 0; lookupTable->fRow[i][j][k][n][m].fZ = 0; @@ -599,6 +600,8 @@ int AliHLTMUONTriggerReconstructorComponent::ReadCDB(const char* cdbPath, Int_t { Int_t detElemId = ddlStore->GetDEfromLocalBoard(boardId, iChamber); + AliHLTUInt32_t idflags = AliHLTMUONUtils::PackRecHitFlags(iChamber+10, detElemId); + const AliMUONGeometryDetElement* detElemTransform = transformer.GetDetElement(detElemId); if (detElemTransform == NULL) { @@ -633,6 +636,7 @@ int AliHLTMUONTriggerReconstructorComponent::ReadCDB(const char* cdbPath, Int_t detElemTransform->Local2Global(lx, ly, 0, gx, gy, gz); // Fill the LUT + lookupTable->fRow[iReg][iLocBoard][iChamber][iCathode][bitxy].fIdFlags = idflags; lookupTable->fRow[iReg][iLocBoard][iChamber][iCathode][bitxy].fX = gx; lookupTable->fRow[iReg][iLocBoard][iChamber][iCathode][bitxy].fY = gy; lookupTable->fRow[iReg][iLocBoard][iChamber][iCathode][bitxy].fZ = gz; diff --git a/HLT/MUON/utils/AliHLTMUONDataCheckerComponent.cxx b/HLT/MUON/utils/AliHLTMUONDataCheckerComponent.cxx index a391c2f9acd..33cb91cc740 100644 --- a/HLT/MUON/utils/AliHLTMUONDataCheckerComponent.cxx +++ b/HLT/MUON/utils/AliHLTMUONDataCheckerComponent.cxx @@ -783,6 +783,8 @@ bool AliHLTMUONDataCheckerComponent::IsHitCoordinateOk( /// Checks if the hit coordinate is compatible with a the location of a /// dimuon spectrometer chamber. Also, if expectedChamber is not -1, then /// the hit coordinate is checked if to comes from that chamber. + /// We also check if the fFlags containing the chamber number and detector + /// element ID are correct. /// \param block The block from which the hit data comes from. /// \param blockNumber The block index number. /// \param name The name of the type of block. @@ -800,6 +802,10 @@ bool AliHLTMUONDataCheckerComponent::IsHitCoordinateOk( bool result = true; + AliHLTUInt8_t chNum = 0xFF; + AliHLTUInt16_t detElemId = 0xFFFF; + AliHLTMUONUtils::UnpackRecHitFlags(hit.fFlags, chNum, detElemId); + Int_t chamber = AliMUONConstants::ChamberNumber(hit.fZ, false); // false = do not warn. if (chamber < minChamber or maxChamber < chamber) { @@ -823,6 +829,33 @@ bool AliHLTMUONDataCheckerComponent::IsHitCoordinateOk( return false; } + if (chNum != chamber) + { + HLTError("Problem found with data block %d, fDataType = '%s'," + " fPtr = %p and fSize = %u bytes." + " Assuming this is a %s data block." + " Problem with entry %d in block: The hit {x = %f, y = %f," + " z = %f} cm has a chamber number %d that does not correspond" + " to the expected chamber %d given by the z-coordinate.", + blockNumber, + DataType2Text(block.fDataType).c_str(), + block.fPtr, + block.fSize, + name, + entryNumber, + hit.fX, hit.fY, hit.fZ, + chNum+1, + chamber+1 + ); + result = false; + if (Int_t(chNum) < minChamber or maxChamber < Int_t(chNum)) + { + // Rather use the explicit value in the data if it + // is in range. + chamber = chNum; + } + } + if (expectedChamber != -1 and chamber != expectedChamber) { HLTError("Problem found with data block %d, fDataType = '%s'," @@ -889,6 +922,64 @@ bool AliHLTMUONDataCheckerComponent::IsHitCoordinateOk( result = false; } + // Check that the detector element ID is valid and it corresponds to + // the chamber number. + if (FetchMappingStores() == 0) // are stores loaded? + { + Bool_t warn = kFALSE; + AliMpDEStore* store = AliMpDEStore::Instance(warn); + AliMpDetElement* de = store->GetDetElement(Int_t(detElemId), warn); + if (de == NULL) + { + HLTError("Problem found with data block %d, fDataType = '%s'," + " fPtr = %p and fSize = %u bytes." + " Assuming this is a %s data block." + " Problem with entry %d in block: The hit {x = %f, y = %f," + " z = %f} cm has a detector element ID %d," + " which is not valid.", + blockNumber, + DataType2Text(block.fDataType).c_str(), + block.fPtr, + block.fSize, + name, + entryNumber, + hit.fX, hit.fY, hit.fZ, + detElemId + ); + result = false; + } + + // Check that the chamber number from the detector element number + // has the expected value. + Int_t ch = AliMpDEManager::GetChamberId(Int_t(detElemId), warn); + if (ch != chamber) + { + HLTError("Problem found with data block %d, fDataType = '%s'," + " fPtr = %p and fSize = %u bytes." + " Assuming this is a %s data block." + " Problem with entry %d in block: The hit {x = %f, y = %f," + " z = %f} cm has a detector element ID %d," + " which does not correspond to the chamber %d.", + blockNumber, + DataType2Text(block.fDataType).c_str(), + block.fPtr, + block.fSize, + name, + entryNumber, + hit.fX, hit.fY, hit.fZ, + chamber+1 + ); + result = false; + } + } + else + { + HLTWarning("Cannot check a hit's detector element ID information" + " without being able to load the mapping from CDB." + ); + result = false; + } + return result; } @@ -968,6 +1059,132 @@ bool AliHLTMUONDataCheckerComponent::IsMansoTrackOk( } +bool AliHLTMUONDataCheckerComponent::CheckDetElemIds( + const AliHLTComponentBlockData& infoBlock, + AliHLTUInt32_t infoBlockNumber, + AliHLTUInt32_t infoEntryNumber, + const AliHLTMUONTrigRecInfoStruct& info, + const AliHLTComponentBlockData& trBlock, + AliHLTUInt32_t trBlockNumber, + AliHLTUInt32_t trEntryNumber, + const AliHLTMUONTriggerRecordStruct& tr + ) const +{ + /// Checks if the detector element IDs are the same in the debug + /// information structure and the trigger record structure. + /// \param infoBlock The debug information block from which the 'info' + /// data comes from. + /// \param infoBlockNumber The debug information block index number. + /// \param infoEntryNumber The entry index number of the 'info' + /// structure in the debug information data block. + /// \param info The debug information structure being checked. + /// \param trBlock The trigger record block from which the 'tr' data + /// comes from. + /// \param trBlockNumber The trigger record block index number. + /// \param trEntryNumber The entry index number of the 'tr' structure + /// in the trigger record data block. + /// \param tr The trigger record structure being checked. + /// \returns true if the detector element IDs are the same and false + /// otherwise. + + bool result = true; + + for (int i = 0; i < 4; i++) + { + AliHLTUInt8_t chamber = 0xFF; + AliHLTUInt16_t detElemId = 0xFFFF; + AliHLTMUONUtils::UnpackRecHitFlags(tr.fHit[i].fFlags, chamber, detElemId); + if (info.fDetElemId[i] == detElemId) continue; + + HLTError("Problem found with trigger record debug information %d" + " in data block %d (fDataType = '%s', fPtr = %p, fSize" + " = %u bytes) and trigger record %d in data block %d" + " (fDataType = '%s', fPtr = %p, fSize = %u bytes):" + " The detection element ID %d for chamber %d in the debug" + " information, is not the same as %d" + " found in the trigger record.", + infoEntryNumber, + infoBlockNumber, + DataType2Text(infoBlock.fDataType).c_str(), + infoBlock.fPtr, + infoBlock.fSize, + trEntryNumber, + trBlockNumber, + DataType2Text(trBlock.fDataType).c_str(), + trBlock.fPtr, + trBlock.fSize, + info.fDetElemId[i], + i+11, + detElemId + ); + result = false; + } + + return result; +} + + +bool AliHLTMUONDataCheckerComponent::CheckDetElemIds( + const AliHLTComponentBlockData& clusterBlock, + AliHLTUInt32_t clusterBlockNumber, + AliHLTUInt32_t clusterEntryNumber, + const AliHLTMUONClusterStruct& cluster, + const AliHLTComponentBlockData& hitBlock, + AliHLTUInt32_t hitBlockNumber, + AliHLTUInt32_t hitEntryNumber, + const AliHLTMUONRecHitStruct& hit + ) const +{ + /// Checks if the detector element IDs are the same in the cluster + /// structure and the reconstructed hit structure. + /// \param clusterBlock The cluster block from which the 'cluster' data + /// comes from. + /// \param clusterBlockNumber The cluster block index number. + /// \param clusterEntryNumber The entry index number of the 'cluster' + /// structure in the cluster data block. + /// \param cluster The cluster structure being checked. + /// \param hitBlock The reconstructed hit block from which the 'hit' + /// data comes from. + /// \param hitBlockNumber The reconstructed hit block index number. + /// \param hitEntryNumber The entry index number of the 'hit' structure + /// in the reconstructed hit data block. + /// \param hit The trigger record structure being checked. + /// \returns true if the detector element IDs are the same and false + /// otherwise. + + bool result = true; + + AliHLTUInt8_t chamber = 0xFF; + AliHLTUInt16_t detElemId = 0xFFFF; + AliHLTMUONUtils::UnpackRecHitFlags(hit.fFlags, chamber, detElemId); + if (cluster.fDetElemId != detElemId) + { + HLTError("Problem found with cluster %d in data block %d" + " (fDataType = '%s', fPtr = %p, fSize = %u bytes)" + " and reconstructed hit %d in data block %d" + " (fDataType = '%s', fPtr = %p, fSize = %u bytes):" + " The detection element ID %d in the cluster, is not" + " the same as %d found in the reconstructed hit.", + clusterEntryNumber, + clusterBlockNumber, + DataType2Text(clusterBlock.fDataType).c_str(), + clusterBlock.fPtr, + clusterBlock.fSize, + hitEntryNumber, + hitBlockNumber, + DataType2Text(hitBlock.fDataType).c_str(), + hitBlock.fPtr, + hitBlock.fSize, + cluster.fDetElemId, + detElemId + ); + result = false; + } + + return result; +} + + namespace { /** @@ -1089,6 +1306,9 @@ namespace /// Called for each new buffer. void OnNewBuffer(const void* buffer, UInt_t bufferSize); + /// Called for each new DSP header. + void OnNewDSP(const AliMUONDSPHeaderStruct* header, const void* /*data*/); + /// Called for each new bus patch. Just marks the current bus patch ID. void OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* /*data*/) { @@ -1155,6 +1375,37 @@ namespace } + void AliHLTMUONTrackerDecoderHandler::OnNewDSP( + const AliMUONDSPHeaderStruct* header, const void* /*data*/ + ) + { + if (header->fPaddingWord != 0 and header->fPaddingWord != 1) + { + // create data type string. + char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2]; + memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 ); + strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize ); + strcat( dataType, ":" ); + strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize ); + + HLTError("Problem found with data block %d, fDataType = '%s'," + " fPtr = %p and fSize = %u bytes." + " Assuming this is a tracker DDL raw data block." + " Problem: Found padding word marker 0x%8.8X in DSP" + " header with DSP ID %d which has an invalid value.", + fBlockNumber, + &dataType[0], + fDescriptor->fPtr, + fDescriptor->fSize, + header->fPaddingWord, + header->fDSPId + ); + fDataProblems = true; + return; + } + } + + void AliHLTMUONTrackerDecoderHandler::OnData(UInt_t data, bool /*parityError*/) { /// Called for each new data word found. This method will add @@ -1162,6 +1413,31 @@ namespace assert( fDigits != NULL ); + if ((data & 0x60000000) != 0) + { + // create data type string. + char dataType[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2]; + memset( dataType, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 ); + strncat( dataType, fDescriptor->fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize ); + strcat( dataType, ":" ); + strncat( dataType, fDescriptor->fDataType.fID, kAliHLTComponentDataTypefIDsize ); + + HLTError("Problem found with data block %d, fDataType = '%s'," + " fPtr = %p and fSize = %u bytes." + " Assuming this is a tracker DDL raw data block." + " Problem: Found a data word 0x%8.8X for bus patch %d" + " whose bits 29 or 30 are not zero.", + fBlockNumber, + &dataType[0], + fDescriptor->fPtr, + fDescriptor->fSize, + data, + fCurrentBusPatch + ); + fDataProblems = true; + return; + } + // Check if the data word + bus patch have been duplicated. for (UInt_t i = 0; i < fDigitCount; i++) { @@ -1371,7 +1647,7 @@ bool AliHLTMUONDataCheckerComponent::CheckRawDataBlock( if (AliHLTMUONUtils::IsTriggerDDL(block.fSpecification)) { - bool scalarEvent = header->GetL1TriggerMessage() == 0x1; + bool scalarEvent = ((header->GetL1TriggerMessage() & 0x1) == 0x1); AliMUONTriggerDDLDecoder decoder; decoder.ExitOnError(false); decoder.TryRecover(false); @@ -1830,7 +2106,7 @@ bool AliHLTMUONDataCheckerComponent::CheckRecHitsBlock( } AliHLTMUONRecHitsBlockReader inblock(block.fPtr, block.fSize); - if (not CheckBlockHeaderOnly(block, blockNumber, inblock, name)) + if (not CheckBlockIntegrity(block, blockNumber, inblock, name)) return false; bool ddl[22]; @@ -2646,6 +2922,8 @@ void AliHLTMUONDataCheckerComponent::MakeGlobalChecks( /// 5) Check that the momentum vectors between the Manso tracks and /// the corresponding trigger record are compatible. /// 6) Check that the trigger decision scalars are reasonable. + /// 7) Check that the detector element IDs are the same between rec + /// hits and clusters / trigger record debug blocks. // Check if all the trigger record identifiers and data are unique. for (AliHLTUInt32_t bi = 0; bi < trigRecBlocksCount; bi++) @@ -2719,9 +2997,9 @@ void AliHLTMUONDataCheckerComponent::MakeGlobalChecks( AliHLTMUONTrigRecsDebugBlockReader inblocki(trigRecDebugBlocks[bi]->fPtr, trigRecDebugBlocks[bi]->fSize); if (not inblocki.BufferSizeOk()) continue; - // Check if all the trigger record IDs in the debug information structures exist. for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++) { + // Check if all the trigger record IDs in the debug information structures exist. bool found = false; for (AliHLTUInt32_t bj = 0; bj < trigRecBlocksCount and not found; bj++) @@ -2734,6 +3012,19 @@ void AliHLTMUONDataCheckerComponent::MakeGlobalChecks( if (inblocki[i].fTrigRecId == inblockj[j].fId) { found = true; + + // Since we found the corresponding trigger record, + // check if the detector element IDs are the same. + bool deOk = CheckDetElemIds( + *trigRecDebugBlocks[bi], bi, i, inblocki[i], + *trigRecBlocks[bj], bj, j, inblockj[j] + ); + if (not deOk) + { + MarkBlock(blocks, blockOk, blockCount, trigRecDebugBlocks[bi]); + MarkBlock(blocks, blockOk, blockCount, trigRecBlocks[bj]); + } + break; } } @@ -2858,6 +3149,19 @@ void AliHLTMUONDataCheckerComponent::MakeGlobalChecks( if (inblocki[i].fHit == inblockj[j]) { found = true; + + // Since we found the corresponding cluster, + // check if the detector element IDs are the same. + bool deOk = CheckDetElemIds( + *clusterBlocks[bi], bi, i, inblocki[i], + *hitBlocks[bj], bj, j, inblockj[j] + ); + if (not deOk) + { + MarkBlock(blocks, blockOk, blockCount, clusterBlocks[bi]); + MarkBlock(blocks, blockOk, blockCount, hitBlocks[bj]); + } + break; } } diff --git a/HLT/MUON/utils/AliHLTMUONDataCheckerComponent.h b/HLT/MUON/utils/AliHLTMUONDataCheckerComponent.h index e2e18c1bd24..ae7abc83772 100644 --- a/HLT/MUON/utils/AliHLTMUONDataCheckerComponent.h +++ b/HLT/MUON/utils/AliHLTMUONDataCheckerComponent.h @@ -21,6 +21,10 @@ class AliMpDDLStore; extern "C" struct AliHLTMUONRecHitStruct; +extern "C" struct AliHLTMUONClusterStruct; +extern "C" struct AliHLTMUONTriggerRecordStruct; +extern "C" struct AliHLTMUONTrigRecInfoStruct; +extern "C" struct AliHLTMUONMansoTrackStruct; /** * @class AliHLTMUONDataCheckerComponent @@ -164,6 +168,28 @@ private: bool ddl[22] ) const; + bool CheckDetElemIds( + const AliHLTComponentBlockData& infoBlock, + AliHLTUInt32_t infoBlockNumber, + AliHLTUInt32_t infoEntryNumber, + const AliHLTMUONTrigRecInfoStruct& info, + const AliHLTComponentBlockData& trBlock, + AliHLTUInt32_t trBlockNumber, + AliHLTUInt32_t trEntryNumber, + const AliHLTMUONTriggerRecordStruct& tr + ) const; + + bool CheckDetElemIds( + const AliHLTComponentBlockData& clusterBlock, + AliHLTUInt32_t clusterBlockNumber, + AliHLTUInt32_t clusterEntryNumber, + const AliHLTMUONClusterStruct& cluster, + const AliHLTComponentBlockData& hitBlock, + AliHLTUInt32_t hitBlockNumber, + AliHLTUInt32_t hitEntryNumber, + const AliHLTMUONRecHitStruct& hit + ) const; + bool CheckRawDataBlock( const AliHLTComponentBlockData& block, AliHLTUInt32_t blockNumber diff --git a/HLT/MUON/utils/dHLTdumpraw.cxx b/HLT/MUON/utils/dHLTdumpraw.cxx index 39874a1a746..89fcb687a5c 100644 --- a/HLT/MUON/utils/dHLTdumpraw.cxx +++ b/HLT/MUON/utils/dHLTdumpraw.cxx @@ -104,6 +104,20 @@ void PrintRubbishData(AliHLTUInt32_t offset, const char* padByte, AliHLTUInt32_t } +void PrintBitPattern(AliHLTUInt32_t value, int bitcount = 32) +{ + // Prints a bit pattern to cout. + + for (int i = bitcount-1; i >= 0; i--) + { + if ( ((value >> i) & 0x1) == 1 ) + cout << "1"; + else + cout << "0"; + } +} + + template int CheckHeaderField( FieldType& field, const char* buffer, unsigned long bufferSize, @@ -238,67 +252,76 @@ namespace void HandleError( const char* errorMessage, int errorCode, const char* errorCodeString, const void* location - ) - { - unsigned long offset = (unsigned long)location - (unsigned long)fBufferStart - + sizeof(AliRawDataHeader); - - cerr << "ERROR: " << errorMessage - << " [Error code = " << errorCode << " (" - << errorCodeString << "), at byte " - << offset << " (" << noshowbase << hex << "0x" - << offset << dec << ")]" << endl; - - if (fDumpStart == NULL) fDumpStart = location; - fDumpData = true; - } + ); - void TryDumpCorruptData(const void* dumpEnd) - { - if (dumpEnd < fDumpStart) return; - if (not fDumpData) return; - - unsigned long startOffset = (unsigned long)fDumpStart - (unsigned long)fBufferStart - + sizeof(AliRawDataHeader); - unsigned long endOffset = (unsigned long)dumpEnd - (unsigned long)fBufferStart - + sizeof(AliRawDataHeader); - if (endOffset - startOffset > 264) - { - endOffset = startOffset + 264; - dumpEnd = reinterpret_cast(fBufferStart) + endOffset; - } - cerr << "Dumping corrupt data words from byte " << startOffset - << " (" << noshowbase << hex << "0x" << startOffset - << dec << "), to byte " << endOffset << " (" << noshowbase - << hex << "0x" << endOffset << dec << "):" << endl; - const UInt_t* start = reinterpret_cast(fDumpStart); - const UInt_t* end = reinterpret_cast(dumpEnd); - cerr << " Start byte | Data words" << endl; - for (const UInt_t* current = start; current < end; current++) - { - unsigned long currentByte = (unsigned long)current - - (unsigned long)fBufferStart + sizeof(AliRawDataHeader); - cerr << right << setw(9) << dec << currentByte << setw(0) - << " 0x" << left << setw(7) << noshowbase << hex - << currentByte << setw(0) << right << " | "; - char fillChar = cerr.fill(); - cerr.fill('0'); - for (int i = 0; i < 4 and current < end; i++, current++) - { - cerr << noshowbase << hex << "0x" << setw(8) - << (*current) << setw(0) << dec << " "; - } - cerr.fill(fillChar); - cerr << endl; - } - fDumpStart = NULL; - fDumpData = false; - } + void TryDumpCorruptData(const void* dumpEnd); const void* fBufferStart; ///< Start location of buffer. const void* fDumpStart; ///< Start location of corrupt data to dump. bool fDumpData; ///< Flag indicating if fDumpStart points to corrupt data and should be dumped. }; + + + void AliDecoderHandler::HandleError( + const char* errorMessage, int errorCode, + const char* errorCodeString, const void* location + ) + { + unsigned long offset = (unsigned long)location - (unsigned long)fBufferStart + + sizeof(AliRawDataHeader); + + cerr << "ERROR: " << errorMessage + << " [Error code = " << errorCode << " (" + << errorCodeString << "), at byte " + << offset << " (" << noshowbase << hex << "0x" + << offset << dec << ")]" << endl; + + if (fDumpStart == NULL) fDumpStart = location; + fDumpData = true; + } + + + void AliDecoderHandler::TryDumpCorruptData(const void* dumpEnd) + { + if (dumpEnd < fDumpStart) return; + if (not fDumpData) return; + + unsigned long startOffset = (unsigned long)fDumpStart - (unsigned long)fBufferStart + + sizeof(AliRawDataHeader); + unsigned long endOffset = (unsigned long)dumpEnd - (unsigned long)fBufferStart + + sizeof(AliRawDataHeader); + if (endOffset - startOffset > 264) + { + endOffset = startOffset + 264; + dumpEnd = reinterpret_cast(fBufferStart) + endOffset; + } + cerr << "Dumping corrupt data words from byte " << startOffset + << " (" << noshowbase << hex << "0x" << startOffset + << dec << "), to byte " << endOffset << " (" << noshowbase + << hex << "0x" << endOffset << dec << "):" << endl; + const UInt_t* start = reinterpret_cast(fDumpStart); + const UInt_t* end = reinterpret_cast(dumpEnd); + cerr << " Start byte | Data words" << endl; + for (const UInt_t* current = start; current < end; current++) + { + unsigned long currentByte = (unsigned long)current + - (unsigned long)fBufferStart + sizeof(AliRawDataHeader); + cerr << right << setw(9) << dec << currentByte << setw(0) + << " 0x" << left << setw(7) << noshowbase << hex + << currentByte << setw(0) << right << " | "; + char fillChar = cerr.fill(); + cerr.fill('0'); + for (int i = 0; i < 4 and current < end; i++, current++) + { + cerr << noshowbase << hex << "0x" << setw(8) + << (*current) << setw(0) << dec << " "; + } + cerr.fill(fillChar); + cerr << endl; + } + fDumpStart = NULL; + fDumpData = false; + } /** * Event handler for the tracker DDL decoder. @@ -310,7 +333,10 @@ namespace public: AliTrackerDecoderHandler() : AliMUONTrackerDDLDecoderEventHandler(), - AliDecoderHandler() + AliDecoderHandler(), + fBlockNum(0), + fDSPNum(0), + fBusPatchNum(0) {} virtual ~AliTrackerDecoderHandler() {} @@ -318,6 +344,7 @@ namespace void OnNewBuffer(const void* buffer, UInt_t /*bufferSize*/) { fBufferStart = buffer; + fBlockNum = fDSPNum = fBusPatchNum = 0; } void OnEndOfBuffer(const void* buffer, UInt_t bufferSize) @@ -327,53 +354,140 @@ namespace TryDumpCorruptData(bufferEnd); } - void OnNewBlock(const AliMUONBlockHeaderStruct* header, const void* /*data*/) - { - TryDumpCorruptData(header); - - //TODO print nicely. - cout << "block: " << header << endl; - } + void OnNewBlock(const AliMUONBlockHeaderStruct* header, const void* /*data*/); - void OnNewDSP(const AliMUONDSPHeaderStruct* header, const void* /*data*/) - { - TryDumpCorruptData(header); - - //TODO print nicely. - cout << "DSP: " << header << endl; - } + void OnNewDSP(const AliMUONDSPHeaderStruct* header, const void* /*data*/); - void OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* /*data*/) + void OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* /*data*/); + + void OnData(UInt_t data, bool parityError); + + void OnError(ErrorCode error, const void* location); + + private: + + UInt_t fBlockNum; ///< Number of block being processed [1..maxBlock]. + UInt_t fDSPNum; ///< Number of DSP being processed [1..maxDSP]. + UInt_t fBusPatchNum; ///< Number of bus patch being processed [1..maxBusPatch]. + }; + + + void AliTrackerDecoderHandler::OnNewBlock(const AliMUONBlockHeaderStruct* header, const void* /*data*/) + { + TryDumpCorruptData(header); + fBlockNum++; + char fillChar = cout.fill(); // store current fill char to restore it. + cout << "================================ Block header " + << setw(3) << fBlockNum << setw(0) + << " ================================" << endl; + cout << " Data key word for block : 0x" << noshowbase << setw(8) << setfill('0') + << hex << header->fDataKey << dec << setfill(fillChar) << setw(0) << endl; + cout << " Total Length of block : " << header->fTotalLength << endl; + cout << " Length of raw data : " << header->fLength << endl; + cout << " DSP ID : " << header->fDSPId << endl; + cout << " L0 trigger word : " << header->fL0Trigger << " (0x" + << noshowbase << setw(8) << setfill('0') << hex << header->fL0Trigger + << dec << setw(0) << setfill(fillChar) << ")" << endl; + cout << " Mini event ID : " << header->fMiniEventId << " (0x" + << noshowbase << setw(8) << setfill('0') << hex << header->fMiniEventId + << dec << setw(0) << setfill(fillChar) << ")" << endl; + cout << "Event ID In Bunch Crossing : " << header->fEventId1 << " (0x" + << noshowbase << setw(8) << setfill('0') << hex << header->fEventId1 + << dec << setw(0) << setfill(fillChar) << ")" << endl; + cout << " Event ID In Orbit Number : " << header->fEventId2 << " (0x" + << noshowbase << setw(8) << setfill('0') << hex << header->fEventId2 + << dec << setw(0) << setfill(fillChar) << ")" << endl; + } + + + void AliTrackerDecoderHandler::OnNewDSP(const AliMUONDSPHeaderStruct* header, const void* /*data*/) + { + TryDumpCorruptData(header); + fDSPNum++; + char fillChar = cout.fill(); // store current fill char to restore it. + cout << "================================= DSP header " + << setw(3) << fDSPNum << setw(0) + << " =================================" << endl; + cout << " Data key word for FRT : 0x" << noshowbase + << setw(8) << setfill('0') << hex << header->fDataKey << dec + << setfill(fillChar) << setw(0) << endl; + cout << " Total length of structure : " << header->fTotalLength << endl; + cout << " Length of raw data : " << header->fLength << endl; + cout << " DSP ID : " << header->fDSPId << endl; + cout << " L1 accept in block Structure (CRT) : " << header->fBlkL1ATrigger + << " (0x" << noshowbase << setw(8) << setfill('0') << hex + << header->fBlkL1ATrigger << dec << setw(0) << setfill(fillChar) << ")" << endl; + cout << " Mini event ID in bunch crossing : " << header->fMiniEventId + << " (0x" << noshowbase << setw(8) << setfill('0') << hex + << header->fMiniEventId << dec << setw(0) << setfill(fillChar) << ")" << endl; + cout << "Number of L1 accept in DSP Structure (FRT) : " << header->fL1ATrigger << endl; + cout << "Number of L1 reject in DSP Structure (FRT) : " << header->fL1RTrigger << endl; + const char* paddingWordValue = ") (INVALID)"; + if (header->fPaddingWord == 0) paddingWordValue = ") (false)"; + if (header->fPaddingWord == 1) paddingWordValue = ") (true)"; + cout << " Padding word set for 64 bits transfer : " << header->fPaddingWord + << " (0x" << noshowbase << setw(8) << setfill('0') << hex + << header->fPaddingWord << setw(0) << setfill(fillChar) << dec + << paddingWordValue << endl; + cout << " Error word : " << header->fErrorWord + << " (" << noshowbase << setw(8) << setfill('0') << hex + << header->fErrorWord << setw(0) << setfill(fillChar) + << dec << ")" << endl; + } + + + void AliTrackerDecoderHandler::OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* /*data*/) + { + TryDumpCorruptData(header); + fBusPatchNum++; + char fillChar = cout.fill(); // store current fill char to restore it. + cout << "============================== Bus patch header " + << setw(3) << fBusPatchNum << setw(0) + << " ==============================" << endl; + cout << "Data key word for bus patch : 0x" << noshowbase << setw(8) + << setfill('0') << hex << header->fDataKey << dec + << setfill(fillChar) << setw(0) << endl; + cout << " Total length of structure : " << header->fTotalLength << endl; + cout << " Length of raw data : " << header->fLength << endl; + cout << " Bus patch ID : " << header->fBusPatchId << endl; + if (header->fLength > 0) { - TryDumpCorruptData(header); - - //TODO print nicely. - cout << "buspatch: " << header << endl; + cout << " Raw bits | Manu ID | Manu channel | ADC Signal" << endl; + cout << "----------------------------------------------------------" << endl; } - - void OnData(UInt_t data, bool parityError) + } + + + void AliTrackerDecoderHandler::OnData(UInt_t data, bool parityError) + { + UShort_t manuId, adc; + UChar_t manuChannel; + UnpackADC(data, manuId, manuChannel, adc); + char fillChar = cout.fill(); // store current fill char to restore it. + cout << noshowbase << " 0x" << setfill('0') << hex << setw(8) << data + << setw(0) << dec << setfill(fillChar) << " " + << setw(12) << manuId << setw(0) << " " + << setw(12) << (UInt_t)manuChannel << setw(0) << " " + << setw(12) << adc << setw(0); + if (parityError) { - if (parityError) - { - // TODO complete - cerr << "Raw data word with parity error" << data << endl; - } - else - { - //TODO print nicely. - cout << "data word: 0x" << hex << data << dec << endl; - } + cout << " <= WARNING: Raw data word with parity error!" << endl; } - - void OnError(ErrorCode error, const void* location) + else { - TryDumpCorruptData(location); - HandleError( - ErrorCodeToMessage(error), error, - ErrorCodeToString(error), location - ); + cout << endl; } - }; + } + + + void AliTrackerDecoderHandler::OnError(ErrorCode error, const void* location) + { + TryDumpCorruptData(location); + HandleError( + ErrorCodeToMessage(error), error, + ErrorCodeToString(error), location + ); + } /** * Event handler for the trigger DDL decoder. @@ -385,7 +499,9 @@ namespace public: AliTriggerDecoderHandler() : AliMUONTriggerDDLDecoderEventHandler(), - AliDecoderHandler() + AliDecoderHandler(), + fRegNum(0), + fLocNum(0) {} virtual ~AliTriggerDecoderHandler() {} @@ -393,6 +509,7 @@ namespace void OnNewBuffer(const void* buffer, UInt_t /*bufferSize*/) { fBufferStart = buffer; + fRegNum = fLocNum = 0; } void OnEndOfBuffer(const void* buffer, UInt_t bufferSize) @@ -402,80 +519,666 @@ namespace TryDumpCorruptData(bufferEnd); } + const char* EventTypeToString(UInt_t type); + + const char* DarcTypeToString(UInt_t type); + void OnDarcHeader( UInt_t header, const AliMUONDarcScalarsStruct* scalars, const void* data - ) - { - if (scalars != NULL) - TryDumpCorruptData(scalars); - else - TryDumpCorruptData(data); - - //TODO print nicely. - cout << "DARC header: " << header << endl; - } + ); void OnGlobalHeader( const AliMUONGlobalHeaderStruct* header, - const AliMUONGlobalScalarsStruct* /*scalars*/, + const AliMUONGlobalScalarsStruct* scalars, const void* /*data*/ - ) - { - TryDumpCorruptData(header); - - //TODO print nicely. - cout << "global header: " << header << endl; - } + ); void OnNewRegionalStruct( const AliMUONRegionalHeaderStruct* regionalStruct, - const AliMUONRegionalScalarsStruct* /*scalars*/, + const AliMUONRegionalScalarsStruct* scalars, const void* /*data*/ - ) - { - TryDumpCorruptData(regionalStruct); - - //TODO print nicely. - cout << "regional struct: " << regionalStruct << endl; - } + ); void OnLocalStruct( const AliMUONLocalInfoStruct* localStruct, - const AliMUONLocalScalarsStruct* /*scalars*/ - ) + const AliMUONLocalScalarsStruct* scalars + ); + + void OnError(ErrorCode error, const void* location); + + private: + + UInt_t fRegNum; ///< Number of block being processed [1..maxReg]. + UInt_t fLocNum; ///< Number of DSP being processed [1..maxLoc]. + }; + + + const char* AliTriggerDecoderHandler::EventTypeToString(UInt_t type) + { + switch (type) { - TryDumpCorruptData(localStruct); - - //TODO print nicely. - cout << "local struct: " << localStruct << endl; + case 0: return "Other software trigger"; + case 1: return "Physics"; + case 2: return "Start of run"; + case 3: return "End of run"; + default: return "UNKNOWN"; } + } + + + const char* AliTriggerDecoderHandler::DarcTypeToString(UInt_t type) + { + typedef AliMUONTriggerDDLDecoder AliDec; + if (type == AliDec::DarcDefaultType()) return "Default"; + if (type == AliDec::DarcVadorhType()) return "Vadorh"; + return "UNKNOWN"; + } + + + void AliTriggerDecoderHandler::OnDarcHeader( + UInt_t header, + const AliMUONDarcScalarsStruct* scalars, + const void* data + ) + { + if (scalars != NULL) + TryDumpCorruptData(scalars); + else + TryDumpCorruptData(data); - void OnError(ErrorCode error, const void* location) + cout << "================================ DARC header =====================================" << endl; + char fillChar = cout.fill(); // store current fill char to restore it. + cout << noshowbase << " Header bit pattern : 0x" << setfill('0') << hex << setw(8) + << header << setw(0) << dec << setfill(fillChar) << endl; + UInt_t eventType = GetDarcEventType(header); + cout << " Event type : " << eventType << " (" + << EventTypeToString(eventType) << ")" << endl; + cout << " Application type : " << ((header >> 27) & 0x7) << endl; + UInt_t darcType = GetDarcType(header); + cout << " DARC type : " << darcType << " (" + << DarcTypeToString(darcType) << ")" << endl; + cout << " Serial number : " << (UInt_t)GetDarcSerialNb(header) << endl; + cout << " Version : " << (UInt_t)GetDarcVersion(header) << endl; + cout << " VME trigger used : " << boolalpha << GetDarcVMETrig(header) << endl; + cout << "Global card data occurrence : " << boolalpha << GetDarcGlobalFlag(header) << endl; + cout << " CTP or LTU interfaced : " << boolalpha << GetDarcCTPTrig(header) << endl; + cout << " DAQ interfaced : " << boolalpha << GetDarcDAQFlag(header) << endl; + cout << " Regional cards occurrence : 0x" << noshowbase << hex << setw(2) << setfill('0') + << (UInt_t)GetDarcRegPattern(header) << dec << setfill(fillChar) << setw(0) + << " [bits: "; + PrintBitPattern(((UInt_t)GetDarcRegPattern(header) >> 4) & 0xF, 4); cout << " "; + PrintBitPattern(((UInt_t)GetDarcRegPattern(header) >> 0) & 0xF, 4); + cout << "]" << endl; + + cout << "================================ DARC scalars ====================================" << endl; + if (scalars != NULL) { - TryDumpCorruptData(location); - HandleError( - ErrorCodeToMessage(error), error, - ErrorCodeToString(error), location - ); + cout << " Trigger | Received | Used" << endl; + cout << "----------------------------------" << endl; + cout << " L0 " << setw(8) << ((scalars->fL0R >> 16) & 0xFFFF) << setw(0) + << " " << setw(8) << ((scalars->fL0R >> 0) & 0xFFFF) << setw(0) << endl; + cout << " L1 physics " << setw(8) << ((scalars->fL1P >> 16) & 0xFFFF) << setw(0) + << " " << setw(8) << ((scalars->fL1P >> 0) & 0xFFFF) << setw(0) << endl; + cout << "L1 software " << setw(8) << ((scalars->fL1S >> 16) & 0xFFFF) << setw(0) + << " " << setw(8) << ((scalars->fL1S >> 0) & 0xFFFF) << setw(0) << endl; + cout << " L2 accept " << setw(8) << ((scalars->fL2A >> 16) & 0xFFFF) << setw(0) + << " " << setw(8) << ((scalars->fL2A >> 0) & 0xFFFF) << setw(0) << endl; + cout << " L2 reject " << setw(8) << ((scalars->fL2R >> 16) & 0xFFFF) << setw(0) + << " " << setw(8) << ((scalars->fL2R >> 0) & 0xFFFF) << setw(0) << endl; + cout << " Clock : " << scalars->fClk << endl; + cout << "Hold (dead time) : " << scalars->fHold << endl; + cout << " Spare word : " << scalars->fSpare << " (0x" + << setw(8) << setfill('0') << hex << scalars->fSpare << + setw(0) << setfill(fillChar) << dec << ")" << endl; } - }; + else + { + cout << "(None found)" << endl; + } + } + + + void AliTriggerDecoderHandler::OnGlobalHeader( + const AliMUONGlobalHeaderStruct* header, + const AliMUONGlobalScalarsStruct* scalars, + const void* /*data*/ + ) + { + TryDumpCorruptData(header); + + cout << "=============================== Global header ====================================" << endl; + cout << "Global input from regional controllers:" << endl; + cout << " | | High pT | Low pT " << endl; + cout << " | Bit pattern | Single mu | mu pair | Single mu | mu pair " << endl; + cout << "Input | Hex | Binary | -ve | +ve | unlike | like | -ve | +ve | unlike | like" << endl; + cout << "--------------------------------------------------------------------------------" << endl; + char fillChar = cout.fill(); // store current fill char to restore it. + for (int i = 0; i < 4; i++) + { + union + { + UInt_t fWord; + UChar_t fByte[4]; + } input; + input.fWord = header->fInput[i]; + for (int j = 0; j < 4; j++) + { + cout << setw(5) << (i*4+j) << " 0x" << noshowbase << setw(2) + << setfill('0') << hex << (UInt_t)input.fByte[j] << setw(0) + << setfill(fillChar) << dec << " "; + PrintBitPattern(input.fByte[j], 8); + cout << ((((input.fByte[j] >> 7) & 0x1) == 1) ? " yes" : " no"); + cout << ((((input.fByte[j] >> 6) & 0x1) == 1) ? " yes" : " no"); + cout << ((((input.fByte[j] >> 5) & 0x1) == 1) ? " yes " : " no "); + cout << ((((input.fByte[j] >> 4) & 0x1) == 1) ? " yes" : " no"); + cout << ((((input.fByte[j] >> 3) & 0x1) == 1) ? " yes" : " no"); + cout << ((((input.fByte[j] >> 2) & 0x1) == 1) ? " yes" : " no"); + cout << ((((input.fByte[j] >> 1) & 0x1) == 1) ? " yes " : " no "); + cout << ((((input.fByte[j] >> 0) & 0x1) == 1) ? " yes" : " no"); + cout << endl; + } + } + cout << " Global ouput : 0x" << noshowbase << setw(2) << setfill('0') << hex + << (UInt_t)GetGlobalOutput(header) << setw(0) << setfill(fillChar) << dec << " [Bits: "; + PrintBitPattern(((UInt_t)GetGlobalOutput(header) >> 4) & 0xF, 4); cout << " "; + PrintBitPattern(((UInt_t)GetGlobalOutput(header) >> 0) & 0xF, 4); + cout << "]" << endl; + cout << " [ unlike sign | like sign | single muon ]" << endl; + cout << " [ high | low | high | low | high | low ]" << endl; + cout << " [-----------------------------------------]" << endl; + cout << " [ "; + cout << ((((GetGlobalOutput(header) >> 5) & 0x1) == 1) ? " yes" : " no"); + cout << ((((GetGlobalOutput(header) >> 4) & 0x1) == 1) ? " yes" : " no"); + cout << ((((GetGlobalOutput(header) >> 3) & 0x1) == 1) ? " yes" : " no"); + cout << ((((GetGlobalOutput(header) >> 2) & 0x1) == 1) ? " yes" : " no"); + cout << ((((GetGlobalOutput(header) >> 1) & 0x1) == 1) ? " yes" : " no"); + cout << ((((GetGlobalOutput(header) >> 0) & 0x1) == 1) ? " yes" : " no"); + cout << " ]" << endl; + cout << "Global configuration : 0x" << noshowbase << setw(4) << setfill('0') << hex + << GetGlobalConfig(header) << setw(0) << setfill(fillChar) << dec << " [Bits: "; + PrintBitPattern(((UInt_t)GetGlobalConfig(header) >> 12) & 0xF, 4); cout << " "; + PrintBitPattern(((UInt_t)GetGlobalConfig(header) >> 8) & 0xF, 4); cout << " "; + PrintBitPattern(((UInt_t)GetGlobalConfig(header) >> 4) & 0xF, 4); cout << " "; + PrintBitPattern(((UInt_t)GetGlobalConfig(header) >> 0) & 0xF, 4); + cout << "]" << endl; + + cout << "=============================== Global scalars ===================================" << endl; + if (scalars != NULL) + { + cout << " Number of L0 triggers : " << scalars->fL0 << endl; + cout << " Number of clock cycles : " << scalars->fClk << endl; + cout << " Number of unlike mu pair low pT : " << scalars->fScaler[0] << endl; + cout << "Number of unlike mu pair high pT : " << scalars->fScaler[1] << endl; + cout << " Number of like mu pair low pT : " << scalars->fScaler[2] << endl; + cout << " Number of like mu pair high pT : " << scalars->fScaler[3] << endl; + cout << " Number of single mu low pT : " << scalars->fScaler[4] << endl; + cout << " Number of single mu high pT : " << scalars->fScaler[5] << endl; + cout << " Hold (dead time) : " << scalars->fHold << endl; + cout << " Spare word : " << scalars->fSpare << " (0x" + << setw(8) << setfill('0') << hex << scalars->fSpare << + setw(0) << setfill(fillChar) << dec << ")" << endl; + } + else + { + cout << "(None found)" << endl; + } + } + + + void AliTriggerDecoderHandler::OnNewRegionalStruct( + const AliMUONRegionalHeaderStruct* regionalStruct, + const AliMUONRegionalScalarsStruct* scalars, + const void* /*data*/ + ) + { + TryDumpCorruptData(regionalStruct); + + fRegNum++; + cout << "========================= Regional structure header " + << setw(3) << fRegNum << setw(0) + << " ==========================" << endl; + char fillChar = cout.fill(); // store current fill char to restore it. + cout << "Darc word bit pattern : 0x" << noshowbase << setw(8) << setfill('0') + << hex << regionalStruct->fDarcWord << setw(0) + << setfill(fillChar) << dec << endl; + UShort_t errBits = GetRegionalErrorBits(regionalStruct); + cout << " [ Error type : " + << (((errBits >> 7) & 0x1) == 1 ? "1 (Physics) " : "0 (Software)") + << " ]" << endl; + cout << " [ Regional error : " << ((errBits >> 6) & 0x1) << " ]" << endl; + cout << " [ Full error : " << ((errBits >> 6) & 0x1) << " ]" << endl; + cout << " [ Empty error : " << ((errBits >> 6) & 0x1) << " ]" << endl; + cout << " [ DARC L2 reject error : " << ((errBits >> 6) & 0x1) << " ]" << endl; + cout << " [ DARC L2 error : " << ((errBits >> 6) & 0x1) << " ]" << endl; + cout << " [ DARC L1 error : " << ((errBits >> 6) & 0x1) << " ]" << endl; + cout << " [ DARC L0 error : " << ((errBits >> 6) & 0x1) << " ]" << endl; + + cout << " [ FPGA number in card : " + << (UInt_t)GetRegionalFPGANumber(regionalStruct) << " ("; + PrintBitPattern((UInt_t)GetRegionalFPGANumber(regionalStruct), 3); + cout << "b) ]" << endl; + + cout << " [ Physics trigger : " << setw(13) << boolalpha << left + << GetRegionalDarcPhysFlag(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ Regional present : " << setw(13) << boolalpha << left + << GetRegionalPresentFlag(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ RAM not full : " << setw(13) << boolalpha << left + << GetRegionalRamNotFullFlag(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ RAM not empty : " << setw(13) << boolalpha << left + << GetRegionalRamNotEmptyFlag(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ L2 rejected : " << setw(13) << boolalpha << left + << GetRegionalL2RejStatus(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ L2 accepted : " << setw(13) << boolalpha << left + << GetRegionalL2AccStatus(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ L1 found : " << setw(13) << boolalpha << left + << GetRegionalL1Status(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ L0 found : " << setw(13) << boolalpha << left + << GetRegionalL0Status(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ No. of events in RAM : " << setw(13) << left + << (UInt_t)GetRegionalEventInRam(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ Busy word : 0x" + << (UInt_t)GetRegionalBusy(regionalStruct) << " ("; + PrintBitPattern((UInt_t)GetRegionalBusy(regionalStruct), 4); + cout << "b) ]" << endl; + + cout << "Regional word bit pattern : 0x" << noshowbase << setw(8) << setfill('0') + << hex << regionalStruct->fWord << setw(0) + << setfill(fillChar) << dec << endl; + cout << " [ Physics trigger occurred : " << setw(27) << boolalpha << left + << (UInt_t)GetRegionalPhysFlag(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ Number of resets : " << setw(27) << left + << (UInt_t)GetRegionalResetNb(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ Controller Serial number : " << setw(27) << left + << (UInt_t)GetRegionalSerialNb(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ Regional crate ID : " << setw(27) << left + << (UInt_t)GetRegionalId(regionalStruct) << setw(0) + << right << "]" << endl; + cout << " [ FPGA software version : " << setw(27) << left + << (UInt_t)GetRegionalVersion(regionalStruct) << setw(0) + << right << "]" << endl; + UInt_t output = GetRegionalOutput(regionalStruct); + cout << " [ Regional output : 0x" << setw(2) << setfill('0') << hex + << output << dec << setw(0) << setfill(fillChar) << setw(0) << right << " ("; + PrintBitPattern(output, 8); + cout << "b) ]" << endl; + + cout << " [ High pT | Low pT ]" << endl; + cout << " [ Single mu | mu pair | Single mu | mu pair ]" << endl; + cout << " [ -ve | +ve | unlike | like | -ve | +ve | unlike | like ]" << endl; + cout << " [-------------------------------------------------------]" << endl; + cout << ((((output >> 7) & 0x1) == 1) ? " [ yes" : " [ no"); + cout << ((((output >> 6) & 0x1) == 1) ? " yes" : " no"); + cout << ((((output >> 5) & 0x1) == 1) ? " yes " : " no "); + cout << ((((output >> 4) & 0x1) == 1) ? " yes" : " no"); + cout << ((((output >> 3) & 0x1) == 1) ? " yes" : " no"); + cout << ((((output >> 2) & 0x1) == 1) ? " yes" : " no"); + cout << ((((output >> 1) & 0x1) == 1) ? " yes " : " no "); + cout << ((((output >> 0) & 0x1) == 1) ? " yes ]" : " no ]"); + cout << endl; + + cout << "Regional input (low pT) bit pattern : 0x" << noshowbase << setw(8) + << setfill('0') << hex << regionalStruct->fInput[0] + << setw(0) << setfill(fillChar) << dec << endl; + cout << "Regional input (high pT) bit pattern : 0x" << noshowbase << setw(8) + << setfill('0') << hex << regionalStruct->fInput[1] + << setw(0) << setfill(fillChar) << dec << endl; + cout << "Regional input logical dump: " << endl; + cout << " Local | Local | low pT mu | high pT mu" << endl; + cout << "structure no. | board | -ve | +ve | -ve | +ve" << endl; + cout << "-----------------------------------------------" << endl; + for (int i = 15; i >= 0 ; i--) + { + cout << setw(13) << (fLocNum + 16 - i) << setw(0) << " "; + cout << setw(5) << (15 - i) << setw(0) << " "; + cout << ((((regionalStruct->fInput[0] >> (i*2+1)) & 0x1) == 1) ? "yes" : " no"); + cout << ((((regionalStruct->fInput[0] >> (i*2+0)) & 0x1) == 1) ? " yes" : " no"); + cout << ((((regionalStruct->fInput[1] >> (i*2+1)) & 0x1) == 1) ? " yes" : " no"); + cout << ((((regionalStruct->fInput[1] >> (i*2+0)) & 0x1) == 1) ? " yes" : " no"); + cout << endl; + } + + UInt_t mask = GetRegionalMask(regionalStruct); + cout << "Local mask : 0x" << noshowbase << setw(4) << setfill('0') << hex + << mask << dec << setw(0) << setfill(fillChar) << " [Bits: "; + PrintBitPattern(mask >> 12, 4); cout << " "; + PrintBitPattern(mask >> 8, 4); cout << " "; + PrintBitPattern(mask >> 4, 4); cout << " "; + PrintBitPattern(mask >> 0, 4); cout << "]" << endl; + + cout << "L0 counter : " << GetRegionalL0(regionalStruct) << endl; + + cout << "========================= Regional structure scalars " + << setw(3) << fRegNum << setw(0) + << " =========================" << endl; + if (scalars != NULL) + { + cout << " Number of clock cycles : " << scalars->fClk << endl; + cout << " Number of high pT +ve single mu : " << scalars->fScaler[0] << endl; + cout << " Number of high pT -ve single mu : " << scalars->fScaler[1] << endl; + cout << "Number of high pT unlike sign pair : " << scalars->fScaler[2] << endl; + cout << " Number of high pT like sign pair : " << scalars->fScaler[3] << endl; + cout << " Number of low pT +ve single mu : " << scalars->fScaler[4] << endl; + cout << " Number of low pT -ve single mu : " << scalars->fScaler[5] << endl; + cout << " Number of low pT unlike sign pair : " << scalars->fScaler[6] << endl; + cout << " Number of low pT like sign pair : " << scalars->fScaler[7] << endl; + cout << " Hold (dead time) : " << scalars->fHold << endl; + } + else + { + cout << "(None found)" << endl; + } + } + + + void AliTriggerDecoderHandler::OnLocalStruct( + const AliMUONLocalInfoStruct* localStruct, + const AliMUONLocalScalarsStruct* scalars + ) + { + TryDumpCorruptData(localStruct); + + fLocNum++; + cout << "=========================== Local structure header " + << setw(3) << fLocNum << setw(0) + << " ===========================" << endl; + char fillChar = cout.fill(); // store current fill char to restore it. + cout << "L0 strip patterns:" << endl; + cout << "Chamber | X | Y " << endl; + cout << "----------------------------------------------" << endl; + cout << " 11 "; + PrintBitPattern(GetLocalX1(localStruct), 16); + cout << " "; + PrintBitPattern(GetLocalY1(localStruct), 16); + cout << endl; + cout << " 12 "; + PrintBitPattern(GetLocalX2(localStruct), 16); + cout << " "; + PrintBitPattern(GetLocalY2(localStruct), 16); + cout << endl; + cout << " 13 "; + PrintBitPattern(GetLocalX3(localStruct), 16); + cout << " "; + PrintBitPattern(GetLocalY3(localStruct), 16); + cout << endl; + cout << " 12 "; + PrintBitPattern(GetLocalX4(localStruct), 16); + cout << " "; + PrintBitPattern(GetLocalY4(localStruct), 16); + cout << endl; + + cout << "L0 trigger bits: (word = "; + cout << showbase << hex << localStruct->fTriggerBits + << noshowbase << dec << ")" << endl; + cout << " ID | Dec | TrigY | YPos | Sign XDev | XDev | XPos " << endl; + cout << "----------------------------------------------------------------" << endl; + cout << "Decimal : " << setw(4) << (UInt_t)GetLocalId(localStruct) << setw(0) << " "; + cout << setw(4) << (UInt_t)GetLocalDec(localStruct) << setw(0) << " "; + cout << setw(3) << (UInt_t)GetLocalTrigY(localStruct) << setw(0) << " "; + cout << setw(4) << (UInt_t)GetLocalYPos(localStruct) << setw(0) << " "; + cout << setw(5) << (UInt_t)GetLocalSXDev(localStruct) << setw(0) << " "; + cout << setw(4) << (UInt_t)GetLocalXDev(localStruct) << setw(0) << " "; + cout << setw(4) << (UInt_t)GetLocalXPos(localStruct) << setw(0) << endl; + cout << " Binary : "; + PrintBitPattern(AliHLTUInt32_t(GetLocalId(localStruct)), 4); + cout << " "; + PrintBitPattern(AliHLTUInt32_t(GetLocalDec(localStruct)), 4); + cout << " "; + PrintBitPattern(AliHLTUInt32_t(GetLocalTrigY(localStruct)), 1); + cout << " "; + PrintBitPattern(AliHLTUInt32_t(GetLocalYPos(localStruct)), 4); + cout << " "; + PrintBitPattern(AliHLTUInt32_t(GetLocalSXDev(localStruct)), 1); + cout << " "; + PrintBitPattern(AliHLTUInt32_t(GetLocalXDev(localStruct)), 4); + cout << " "; + PrintBitPattern(AliHLTUInt32_t(GetLocalXPos(localStruct)), 5); + cout << endl; + + cout << "L0 decision (Dec): [high pT: "; + PrintBitPattern((UInt_t)GetLocalHpt(localStruct), 2); + cout << "b ("; + switch ((UInt_t)GetLocalHpt(localStruct)) + { + case 0: cout << "No trigger"; break; + case 1: cout << "-ve particle"; break; + case 2: cout << "+ve particle"; break; + case 3: cout << "No deviation trigger"; break; + default: cout << "UNKNOWN"; break; + } + cout << "), low pT: "; + PrintBitPattern((UInt_t)GetLocalLpt(localStruct), 2); + cout << "b ("; + switch ((UInt_t)GetLocalLpt(localStruct)) + { + case 0: cout << "No trigger"; break; + case 1: cout << "-ve particle"; break; + case 2: cout << "+ve particle"; break; + case 3: cout << "No deviation trigger"; break; + default: cout << "UNKNOWN"; break; + } + cout << ")]" << endl; + + cout << "=========================== Local structure scalars " + << setw(3) << fLocNum << setw(0) + << " ==========================" << endl; + if (scalars != NULL) + { + cout << " Number of L0 triggers : " << scalars->fL0 << endl; + cout << " Hold (dead time) : " << scalars->fHold << endl; + cout << " Number of clock cycles : " << scalars->fClk << endl; + cout << " Number of low pT no triggers : " << scalars->fLPtNTrig << endl; + cout << " Number of high pT no triggers : " << scalars->fHPtNTrig << endl; + cout << " Number of low pT right triggers : " << scalars->fLPtRTrig << endl; + cout << " Number of high pT right triggers : " << scalars->fHPtRTrig << endl; + cout << " Number of low pT left triggers : " << scalars->fLPtLTrig << endl; + cout << " Number of high pT left triggers : " << scalars->fHPtLTrig << endl; + cout << " Number of low pT straight triggers : " << scalars->fLPtSTrig << endl; + cout << "Number of high pT straight triggers : " << scalars->fHPtSTrig << endl; + + UInt_t xoryflag = GetLocalComptXY(scalars); + if (xoryflag == 1) + { + cout << "Y strip counts:" << endl; + } + else + { + cout << "X strip counts:" << endl; + } + cout << " | Chamber " << endl; + cout << "Strip | 11 | 12 | 13 | 14" << endl; + cout << "------------------------------------------" << endl; + for (int i = 0; i < 16; i++) + { + cout << setw(5) << i << setw(0) << " " + << setw(6) << (UInt_t)GetLocalXY1(scalars, i) << setw(0) << " " + << setw(6) << (UInt_t)GetLocalXY2(scalars, i) << setw(0) << " " + << setw(6) << (UInt_t)GetLocalXY3(scalars, i) << setw(0) << " " + << setw(6) << (UInt_t)GetLocalXY4(scalars, i) << setw(0) << endl; + } + + cout << " EOS word : 0x" << setw(8) << setfill('0') + << hex << scalars->fEOS << setw(0) << setfill(fillChar) << dec << endl; + cout << " [ Switches : 0x" << setw(3) + << setfill('0') << hex << (UInt_t)GetLocalSwitch(scalars) + << setw(0) << setfill(fillChar) << dec << " ("; + PrintBitPattern((UInt_t)GetLocalSwitch(scalars) >> 8, 2); cout << " "; + PrintBitPattern((UInt_t)GetLocalSwitch(scalars) >> 4, 4); cout << " "; + PrintBitPattern((UInt_t)GetLocalSwitch(scalars) >> 0, 4); + cout << "b) ]" << endl; + cout << " [ X or Y : " << xoryflag + << ((xoryflag == 1) ? " (scalars for Y strips) ]" : " (scalars for X strips) ]") + << endl; + + cout << "Reset signal : " << scalars->fReset << endl; + } + else + { + cout << "(None found)" << endl; + } + } + + + void AliTriggerDecoderHandler::OnError(ErrorCode error, const void* location) + { + TryDumpCorruptData(location); + HandleError( + ErrorCodeToMessage(error), error, + ErrorCodeToString(error), location + ); + } } // end of namespace +int DumpRawDataHeader( + const char* buffer, unsigned long bufferSize, const AliRawDataHeader* header, + bool continueParse + ) +{ + cout << "*************************** Common DDL data header *******************************" << endl; + char fillChar = cout.fill(); // remember fill char to set back to original later. + int result = CheckHeaderField(header->fSize, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + cout << "Size of the raw data in bytes : "; + if (header->fSize != 0xFFFFFFFF) + cout << header->fSize; + else + cout << "0xFFFFFFFF (unknown)"; + cout << endl; + + result = CheckHeaderField(header->fWord2, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + cout << " Format version : " << UInt_t(header->GetVersion()) << endl; + UInt_t l1msg = header->GetL1TriggerMessage(); + cout << " L1 trigger message : 0x" + << noshowbase << hex << setfill('0') << setw(2) << l1msg + << setw(0) << setfill(fillChar) << dec + << " [Spare: " << ((l1msg >> 7) & 0x1) + << ", ClT: " << ((l1msg >> 6) & 0x1) + << ", RoC: 0x" << noshowbase << hex << ((l1msg >> 2) & 0x4) << dec + << ", ESR: " << ((l1msg >> 1) & 0x1) + << ", L1SwC: " << ((l1msg >> 0) & 0x1) << "]" << endl; + cout << " Bunch crossing (Event ID1) : " << header->GetEventID1() << " (0x" + << noshowbase << hex << setfill('0') << setw(3) << header->GetEventID1() + << dec << setw(0) << setfill(fillChar) << ")" << endl; + + result = CheckHeaderField(header->fEventID2, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + cout << " Orbit number (Event ID2) : " << header->fEventID2 << " (0x" + << noshowbase << hex << setfill('0') << setw(6) << header->fEventID2 + << dec << setw(0) << setfill(fillChar) << ")" << endl; + + result = CheckHeaderField(header->fAttributesSubDetectors, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + cout << " Block attributes : " << UInt_t(header->GetAttributes()) << " (0x" + << noshowbase << hex << setfill('0') << setw(2) << UInt_t(header->GetAttributes()) + << dec << setw(0) << setfill(fillChar) << ")" << endl; + cout << " Participating sub-detectors : 0x" << noshowbase << hex + << setfill('0') << setw(6) << header->GetSubDetectors() << dec + << setw(0) << setfill(fillChar) << " [Bits: "; + for (int i = 5; i >= 0; i--) + { + PrintBitPattern(header->GetSubDetectors() >> (i*4), 4); + if (i != 0) + cout << " "; + else + cout << "]" << endl; + } + + result = CheckHeaderField(header->fStatusMiniEventID, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + UInt_t statusBits = header->GetStatus(); + cout << " Status & error bits : 0x" << noshowbase << hex + << setfill('0') << setw(4) << statusBits << setw(0) << setfill(fillChar) + << dec << endl; + cout << " [ Reserved : " << ((statusBits >> 15) & 0x1) << " ]" << endl; + cout << " [ Multi-event buffer error : " << ((statusBits >> 14) & 0x1) << " ]" << endl; + cout << " [ Trigger L1 missing error : " << ((statusBits >> 13) & 0x1) << " ]" << endl; + cout << " [ Trigger error (other) : " << ((statusBits >> 12) & 0x1) << " ]" << endl; + cout << " [ Pre-pulse error : " << ((statusBits >> 11) & 0x1) << " ]" << endl; + cout << " [ Trigger L2 time violation : " << ((statusBits >> 10) & 0x1) << " ]" << endl; + cout << " [ Trigger L1 time violation : " << ((statusBits >> 9) & 0x1) << " ]" << endl; + cout << " [ DDG payload flag : " << ((statusBits >> 8) & 0x1) << " ]" << endl; + cout << " [ HLT payload flag : " << ((statusBits >> 7) & 0x1) << " ]" << endl; + cout << " [ HLT decision flag : " << ((statusBits >> 6) & 0x1) << " ]" << endl; + cout << " [ FEE error : " << ((statusBits >> 5) & 0x1) << " ]" << endl; + cout << " [ Trigger information unavailable : " << ((statusBits >> 4) & 0x1) << " ]" << endl; + cout << " [ Control parity error : " << ((statusBits >> 3) & 0x1) << " ]" << endl; + cout << " [ Data parity error : " << ((statusBits >> 2) & 0x1) << " ]" << endl; + cout << " [ Trigger missing error : " << ((statusBits >> 1) & 0x1) << " ]" << endl; + cout << " [ Trigger overlap error : " << ((statusBits >> 0) & 0x1) << " ]" << endl; + cout << " Mini event ID : " << header->GetMiniEventID() << " (0x" + << noshowbase << hex << setfill('0') << setw(3) << header->GetMiniEventID() + << dec << setw(0) << setfill(fillChar) << ")" << endl; + + result = CheckHeaderField(header->fTriggerClassLow, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + result = CheckHeaderField(header->fROILowTriggerClassHigh, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + ULong64_t triggerClasses = header->GetTriggerClasses(); + cout << " Trigger classes : 0x" << noshowbase << hex << setw(13) + << setfill('0') << triggerClasses << setw(0) << setfill(fillChar) + << dec << endl; + cout << " [Bits: "; + PrintBitPattern(triggerClasses >> (12*4), 2); + cout << " "; + for (int i = 11; i >= 0; i--) + { + PrintBitPattern(triggerClasses >> (i*4), 4); + if (i != 0) + cout << " "; + else + cout << "]" << endl; + } + + result = CheckHeaderField(header->fROIHigh, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + ULong64_t roiBits = header->GetROI(); + cout << " Region of interest : 0x" << noshowbase << hex << setw(9) + << setfill('0') << roiBits << setw(0) << setfill(fillChar) + << dec << endl; + cout << " [Bits: "; + for (int i = 8; i >= 0; i--) + { + PrintBitPattern(roiBits >> (i*4), 4); + if (i != 0) + cout << " "; + else + cout << "]" << endl; + } + cout << "**********************************************************************************" <(buffer); + int result = DumpRawDataHeader(buffer, bufferSize, header, continueParse); + if (result != EXIT_SUCCESS) return result; // Setup the decoder for the DDL payload. AliMUONTrackerDDLDecoder decoder; decoder.ExitOnError(not continueParse); - decoder.SendDataOnParityError(false); + decoder.SendDataOnParityError(true); decoder.TryRecover(false); decoder.AutoDetectTrailer(true); decoder.CheckForTrailer(true); @@ -497,11 +1200,11 @@ int DumpTriggerDDLRawStream( bool continueParse ) { - // TODO dump the CDH header. - const AliRawDataHeader* header = reinterpret_cast(buffer); - bool scalarEvent = header->GetL1TriggerMessage() == 0x1; + int result = DumpRawDataHeader(buffer, bufferSize, header, continueParse); + if(result != EXIT_SUCCESS) return result; + bool scalarEvent = ((header->GetL1TriggerMessage() & 0x1) == 0x1); AliMUONTriggerDDLDecoder decoder; decoder.ExitOnError(not continueParse); @@ -530,7 +1233,24 @@ int DumpRecHitStruct( // At each step check if we have not overflowed the buffer. If we have // not, then we can print the field, otherwise we print the left over // bytes assumed to be corrupted rubbish. - int result = CheckField(hit->fX, buffer, bufferSize, continueParse); + + int result = CheckField(hit->fFlags, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + AliHLTUInt8_t chamber = 0xFF; + AliHLTUInt16_t detElemId = 0xFFFF; + AliHLTMUONUtils::UnpackRecHitFlags(hit->fFlags, chamber, detElemId); + if (chamber == 0 and detElemId == 0) + { + cout << setw(10) << left << (int)(chamber) << setw(0); + cout << setw(12) << left << (int)detElemId << setw(0); + } + else + { + cout << setw(10) << left << (int)(chamber+1) << setw(0); + cout << setw(12) << left << (int)detElemId << setw(0); + } + + result = CheckField(hit->fX, buffer, bufferSize, continueParse); if (result != EXIT_SUCCESS) return result; cout << setw(13) << left << hit->fX << setw(0); @@ -560,8 +1280,8 @@ int DumpRecHitsBlock( AliHLTUInt32_t nentries = CalculateNEntries(block, bufferSize); // Print the data block record entries. - cout << " X (cm) | Y (cm) | Z (cm)" << endl; - cout << "---------------------------------------" << endl; + cout << "Chamber | DetElemID | X (cm) | Y (cm) | Z (cm)" << endl; + cout << "-----------------------------------------------------------" << endl; const AliHLTMUONRecHitStruct* entry = block.GetArray(); for(AliHLTUInt32_t i = 0; i < nentries; i++) { @@ -619,13 +1339,12 @@ int DumpTriggerRecordStruct( if (result != EXIT_SUCCESS) return result; cout << "pz = " << record->fPz << ") GeV/c"<fHit[0]; for(AliHLTUInt32_t ch = 0; ch < 4; ch++) { - cout << setw(10) << left << ch + 11 << setw(0); result = DumpRecHitStruct(buffer, bufferSize, hit++, continueParse); if (result != EXIT_SUCCESS) return result; } @@ -671,22 +1390,91 @@ int DumpTrigRecInfoStruct( // At each step check if we have not overflowed the buffer. If we have // not, then we can print the field, otherwise we print the left over // bytes assumed to be corrupted rubbish. + int result = CheckField(debuginfo->fTrigRecId, buffer, bufferSize, continueParse); if (result != EXIT_SUCCESS) return result; - cout << setw(22) << left << debuginfo->fTrigRecId << setw(0); + cout << "Trigger Record ID: " << debuginfo->fTrigRecId << endl; - result = CheckField(debuginfo->fDetElemId, buffer, bufferSize, continueParse); - if (result != EXIT_SUCCESS) return result; - cout << setw(20) << left << debuginfo->fDetElemId << setw(0); - + cout << "Detector element IDs:" << endl; + cout << " Chamber : 11 | 12 | 13 | 14" << endl; + cout << " ID : "; + for (int i = 0; i < 4; i++) + { + result = CheckField(debuginfo->fDetElemId[i], buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + cout << setw(12) << right << debuginfo->fDetElemId[i] << setw(0); + if (i != 3) cout << " | "; + } + cout << endl; + + cout << "Momentum estimation parameters:" << endl; + cout << " Parameter : Z_middle coordinate (cm) | Integrated magnetic field (T.m)" << endl; + cout << " Value : "; result = CheckField(debuginfo->fZmiddle, buffer, bufferSize, continueParse); if(result != EXIT_SUCCESS) return result; - cout << setw(30) << left << debuginfo->fZmiddle << setw(0); - + cout << setw(24) << right << debuginfo->fZmiddle << setw(0) << " | "; + result = CheckField(debuginfo->fBl, buffer, bufferSize, continueParse); if (result != EXIT_SUCCESS) return result; - cout <fBl << setw(0) << endl; - + cout << setw(31) << right << debuginfo->fBl << setw(0) << endl; + + typedef AliMUONTriggerDDLDecoderEventHandler AliH; + + cout << "L0 strip patterns:" << endl; + cout << "Chamber | X | Y " << endl; + cout << "----------------------------------------------" << endl; + result = CheckField(debuginfo->fL0Struct.fX2X1, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + cout << " 11 "; + PrintBitPattern(AliH::GetLocalX1(&debuginfo->fL0Struct), 16); + result = CheckField(debuginfo->fL0Struct.fY2Y1, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + cout << " "; + PrintBitPattern(AliH::GetLocalY1(&debuginfo->fL0Struct), 16); + cout << endl; + cout << " 12 "; + PrintBitPattern(AliH::GetLocalX2(&debuginfo->fL0Struct), 16); + cout << " "; + PrintBitPattern(AliH::GetLocalY2(&debuginfo->fL0Struct), 16); + cout << endl; + + result = CheckField(debuginfo->fL0Struct.fX4X3, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + cout << " 13 "; + PrintBitPattern(AliH::GetLocalX3(&debuginfo->fL0Struct), 16); + result = CheckField(debuginfo->fL0Struct.fY4Y3, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + cout << " "; + PrintBitPattern(AliH::GetLocalY3(&debuginfo->fL0Struct), 16); + cout << endl; + cout << " 12 "; + PrintBitPattern(AliH::GetLocalX4(&debuginfo->fL0Struct), 16); + cout << " "; + PrintBitPattern(AliH::GetLocalY4(&debuginfo->fL0Struct), 16); + cout << endl; + + cout << "L0 trigger bits: (word = "; + result = CheckField(debuginfo->fL0Struct.fTriggerBits, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + cout << showbase << hex << debuginfo->fL0Struct.fTriggerBits + << noshowbase << dec << ")" << endl; + cout << " ID | Dec | TrigY | YPos | Sign XDev | XDev | XPos " << endl; + cout << "------------------------------------------------------" << endl; + PrintBitPattern(AliHLTUInt32_t(AliH::GetLocalId(&debuginfo->fL0Struct)), 4); + cout << " "; + PrintBitPattern(AliHLTUInt32_t(AliH::GetLocalDec(&debuginfo->fL0Struct)), 4); + cout << " "; + PrintBitPattern(AliHLTUInt32_t(AliH::GetLocalTrigY(&debuginfo->fL0Struct)), 1); + cout << " "; + PrintBitPattern(AliHLTUInt32_t(AliH::GetLocalYPos(&debuginfo->fL0Struct)), 4); + cout << " "; + PrintBitPattern(AliHLTUInt32_t(AliH::GetLocalSXDev(&debuginfo->fL0Struct)), 1); + cout << " "; + PrintBitPattern(AliHLTUInt32_t(AliH::GetLocalXDev(&debuginfo->fL0Struct)), 4); + cout << " "; + PrintBitPattern(AliHLTUInt32_t(AliH::GetLocalXPos(&debuginfo->fL0Struct)), 5); + cout << endl; + return result; } @@ -704,11 +1492,11 @@ int DumpTrigRecsDebugBlock( AliHLTUInt32_t nentries = CalculateNEntries(block, bufferSize); // Print the data block record entries. - cout << "Trigger Record ID | Detector ID | Momentum X Component (Gev/c) | Integrated Magnetic Field (T.m)" << endl; - cout << "--------------------------------------------------------------------------------------------------" << endl; const AliHLTMUONTrigRecInfoStruct* entry = block.GetArray(); for(AliHLTUInt32_t i = 0; i < nentries; i++) { + cout << "============================== Trigger Record debug data " << i+1 + << " of " << nentries << " ==============================" << endl; int subResult = DumpTrigRecInfoStruct(buffer, bufferSize, entry++, continueParse); if (subResult != EXIT_SUCCESS) return subResult; } @@ -717,62 +1505,6 @@ int DumpTrigRecsDebugBlock( } -int DumpTriggerChannelStruct( - const char* buffer, unsigned long bufferSize, - const AliHLTMUONTriggerChannelStruct* triggerchannel, - bool continueParse - ) -{ - // Step through the fields trying to print them. - // At each step check if we have not overflowed the buffer. If we have - // not, then we can print the field, otherwise we print the left over - // bytes assumed to be corrupted rubbish. - int result = CheckField(triggerchannel->fTrigRecId, buffer, bufferSize, continueParse); - if (result != EXIT_SUCCESS) return result; - cout << setw(25) << left << triggerchannel->fTrigRecId << setw(0); - - result = CheckField(triggerchannel->fChamber, buffer, bufferSize, continueParse); - if (result != EXIT_SUCCESS) return result; - cout << setw(13) << left << triggerchannel->fChamber << setw(0); - - result = CheckField(triggerchannel->fSignal, buffer, bufferSize, continueParse); - if (result != EXIT_SUCCESS) return result; - cout << setw(10) << left << triggerchannel->fSignal << setw(0); - - result = CheckField(triggerchannel->fRawDataWord, buffer, bufferSize, continueParse); - if(result != EXIT_SUCCESS) return result; - cout << showbase << hex << triggerchannel->fRawDataWord << dec << setw(0) << endl; - return result; -} - - -int DumpTriggerChannelsBlock( - const char* buffer, unsigned long bufferSize, - bool continueParse - ) -{ - int result = EXIT_SUCCESS; - AliHLTMUONTriggerChannelsBlockReader block(buffer, bufferSize); - - result = CheckCommonHeader(block, buffer, bufferSize, continueParse); - if (result != EXIT_SUCCESS and not continueParse) return result; - - AliHLTUInt32_t nentries = CalculateNEntries(block, bufferSize); - - // Print the data block record entries. - cout << " Trigger Record ID | Chamber | Signal | Raw Data Word " << endl; - cout << "--------------------------------------------------------------" << endl; - const AliHLTMUONTriggerChannelStruct* entry = block.GetArray(); - for(AliHLTUInt32_t i = 0; i < nentries; i++) - { - int subResult = DumpTriggerChannelStruct(buffer, bufferSize, entry++, continueParse); - if (subResult != EXIT_SUCCESS) return subResult; - } - - return result; -} - - int DumpClusterStruct( const char* buffer, unsigned long bufferSize, const AliHLTMUONClusterStruct* cluster, @@ -785,21 +1517,20 @@ int DumpClusterStruct( // bytes assumed to be corrupted rubbish. int result = CheckField(cluster->fId, buffer, bufferSize, continueParse); if (result != EXIT_SUCCESS) return result; - cout << "cluster->fId: " << cluster->fId << "\t"; + cout << " Cluster ID: " << cluster->fId << endl; result = CheckField(cluster->fDetElemId, buffer, bufferSize, continueParse); if (result != EXIT_SUCCESS) return result; - cout << "cluster->fDetElemId: " << cluster->fDetElemId << "\t"; + cout << "Detector Element ID: " << cluster->fDetElemId << endl; result = CheckField(cluster->fNchannels, buffer, bufferSize, continueParse); if(result != EXIT_SUCCESS) return result; - cout << "cluster->fNchannels: " << cluster->fNchannels <fNchannels << endl; - cout << " Corresponding Hit: "<< endl; - cout << " X (cm) | Y (cm) | Z (cm)" << endl; - cout << "---------------------------------------" << endl; - const AliHLTMUONRecHitStruct * hit = & cluster->fHit; - result = DumpRecHitStruct(buffer, bufferSize, hit, continueParse); + cout << "Corresponding Hit: "<< endl; + cout << "Chamber | DetElemID | X (cm) | Y (cm) | Z (cm)" << endl; + cout << "-----------------------------------------------------------" << endl; + result = DumpRecHitStruct(buffer, bufferSize, &cluster->fHit, continueParse); return result; } @@ -884,7 +1615,7 @@ int DumpChannelsBlock( AliHLTUInt32_t nentries = CalculateNEntries(block, bufferSize); // Print the data block record entries. - cout << "Cluster Id | Bus Patch | Manu Address | Channel Addr | Signal Value | Raw Data Word " << endl; + cout << "Cluster ID | Bus Patch | Manu Address | Channel Addr | Signal Value | Raw Data Word " << endl; cout << "----------------------------------------------------------------------------------------------" << endl; const AliHLTMUONChannelStruct* entry = block.GetArray(); for(AliHLTUInt32_t i = 0; i < nentries; i++) @@ -951,12 +1682,11 @@ int DumpMansoTrackStruct( cout << "Chi squared fit: " << track->fChi2 << endl; cout << "Track hits:" << endl; - cout << "Chamber | X (cm) | Y (cm) | Z (cm)" << endl; - cout << "------------------------------------------------" << endl; + cout << "Chamber | DetElemID | X (cm) | Y (cm) | Z (cm)" << endl; + cout << "-----------------------------------------------------------" << endl; const AliHLTMUONRecHitStruct* hit = &track->fHit[0]; for(AliHLTUInt32_t ch = 0; ch < 4; ch++) { - cout << setw(10) << left << ch + 7 << setw(0); result = DumpRecHitStruct(buffer, bufferSize, hit++, continueParse); if (result != EXIT_SUCCESS) return result; } @@ -1041,6 +1771,18 @@ int DumpMansoCandidateStruct( result = DumpMansoRoIStruct(buffer, bufferSize, roi++, continueParse); if (result != EXIT_SUCCESS) return result; } + + cout << "Momentum estimation parameters:" << endl; + cout << " Parameter : Z_middle coordinate (cm) | Integrated magnetic field (T.m)" << endl; + cout << " Value : "; + result = CheckField(candidate->fZmiddle, buffer, bufferSize, continueParse); + if(result != EXIT_SUCCESS) return result; + cout << setw(24) << right << candidate->fZmiddle << setw(0) << " | "; + + result = CheckField(candidate->fBl, buffer, bufferSize, continueParse); + if (result != EXIT_SUCCESS) return result; + cout << setw(31) << right << candidate->fBl << setw(0) << endl; + return result; } @@ -1531,10 +2273,6 @@ int ParseBuffer( subResult = DumpTrigRecsDebugBlock(buffer, bufferSize, continueParse); if (subResult != EXIT_SUCCESS) result = subResult; break; - case kTriggerChannelsDataBlock: - subResult = DumpTriggerChannelsBlock(buffer, bufferSize, continueParse); - if (subResult != EXIT_SUCCESS) result = subResult; - break; case kRecHitsDataBlock: subResult = DumpRecHitsBlock(buffer, bufferSize, continueParse); if (subResult != EXIT_SUCCESS) result = subResult; @@ -1827,7 +2565,6 @@ void PrintUsage(bool asError = true) os << " rawtrigger - raw DDL stream from trigger chambers." << endl; os << " trigrecs - trigger records data." << endl; os << " trigrecsdebug - debugging information about trigger records." << endl; - os << " trigchannels - channel debugging in." << endl; os << " rechits - reconstructed hits data." << endl; os << " channels - channel debugging information from hit reconstruction." << endl; os << " clusters - cluster debugging information from hit reconstruction." << endl; diff --git a/HLT/MUON/utils/dHLTrootify.cxx b/HLT/MUON/utils/dHLTrootify.cxx index aae306979c0..35c4c8ce652 100644 --- a/HLT/MUON/utils/dHLTrootify.cxx +++ b/HLT/MUON/utils/dHLTrootify.cxx @@ -216,7 +216,6 @@ int DecodeFileType(const char* filename, AliHLTMUONDataBlockType& type) { case kTriggerRecordsDataBlock: case kTrigRecsDebugDataBlock: - case kTriggerChannelsDataBlock: case kRecHitsDataBlock: case kClustersDataBlock: case kChannelsDataBlock: @@ -253,7 +252,6 @@ void PrintUsage(bool asError = true) os << " Where can be one of:" << endl; os << " trigrecs - trigger records data." << endl; os << " trigrecsdebug - debugging information about trigger records." << endl; - os << " trigchannels - channel debugging in." << endl; os << " rechits - reconstructed hits data." << endl; os << " channels - channel debugging information from hit reconstruction." << endl; os << " clusters - cluster debugging information from hit reconstruction." << endl; diff --git a/HLT/libAliHLTMUON.pkg b/HLT/libAliHLTMUON.pkg index 828c9084c9e..e986cbdc2cd 100644 --- a/HLT/libAliHLTMUON.pkg +++ b/HLT/libAliHLTMUON.pkg @@ -27,7 +27,6 @@ MODULE_SRCS := $(CLASS_HDRS:.h=.cxx) \ AliHLTMUONConstants.cxx \ AliHLTMUONTriggerRecordsBlockStruct.cxx \ AliHLTMUONTrigRecsDebugBlockStruct.cxx \ - AliHLTMUONTriggerChannelsBlockStruct.cxx \ AliHLTMUONRecHitsBlockStruct.cxx \ AliHLTMUONClustersBlockStruct.cxx \ AliHLTMUONChannelsBlockStruct.cxx \ -- 2.39.3