]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding new track structure for full tracker.
authoraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Feb 2010 14:01:44 +0000 (14:01 +0000)
committeraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Feb 2010 14:01:44 +0000 (14:01 +0000)
14 files changed:
HLT/MUON/AliHLTMUONConstants.cxx
HLT/MUON/AliHLTMUONConstants.h
HLT/MUON/AliHLTMUONDataBlockReader.h
HLT/MUON/AliHLTMUONDataBlockWriter.h
HLT/MUON/AliHLTMUONDataTypes.h
HLT/MUON/AliHLTMUONTracksBlockStruct.cxx [new file with mode: 0644]
HLT/MUON/AliHLTMUONTracksBlockStruct.h [new file with mode: 0644]
HLT/MUON/AliHLTMUONUtils.cxx
HLT/MUON/AliHLTMUONUtils.h
HLT/MUON/utils/AliHLTMUONDataCheckerComponent.cxx
HLT/MUON/utils/AliHLTMUONDataCheckerComponent.h
HLT/MUON/utils/dHLTdumpraw.cxx
HLT/MUON/utils/dHLTrootify.cxx
HLT/libAliHLTMUON.pkg

index 627389f4508589f388ecb5b6b828c28306a5405d..7e1aadd0bc3e0ac070669fc2bf3f2ecd5dd22ce8 100644 (file)
@@ -33,6 +33,7 @@
 #include "AliHLTMUONChannelsBlockStruct.h"
 #include "AliHLTMUONMansoTracksBlockStruct.h"
 #include "AliHLTMUONMansoCandidatesBlockStruct.h"
+#include "AliHLTMUONTracksBlockStruct.h"
 #include "AliHLTMUONSinglesDecisionBlockStruct.h"
 #include "AliHLTMUONPairsDecisionBlockStruct.h"
 
@@ -92,6 +93,29 @@ AliHLTMUONConstants::fgkNilMansoCandidateStruct = {
        0, 0
 };
 
+const AliHLTMUONTrackStruct
+AliHLTMUONConstants::fgkNilTrackStruct = {
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       {
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct,
+        AliHLTMUONConstants::fgkNilRecHitStruct
+       }
+};
+
 const AliHLTMUONTrackDecisionStruct
 AliHLTMUONConstants::fgkNilTrackDecisionStruct = {0, 0, 0};
 
@@ -123,6 +147,9 @@ AliHLTMUONConstants::fgkMansoTracksBlockDataType = AliHLTComponentDataTypeInitia
 const AliHLTComponentDataType
 AliHLTMUONConstants::fgkMansoCandidatesBlockDataType = AliHLTComponentDataTypeInitializer("MNCANDID", kAliHLTDataOriginMUON);
 
+const AliHLTComponentDataType
+AliHLTMUONConstants::fgkTracksBlockDataType = AliHLTComponentDataTypeInitializer("TRACKS  ", kAliHLTDataOriginMUON);
+
 const AliHLTComponentDataType
 AliHLTMUONConstants::fgkSinglesDecisionBlockDataType = AliHLTComponentDataTypeInitializer("DECIDSIN", kAliHLTDataOriginMUON);
 
index a2e8f76071f2de8f6fbcd91d85cdb459ae47c717..4b3163bf8cf0c8eb586970048cd4fdfcbb6f516a 100644 (file)
@@ -40,6 +40,7 @@ struct AliHLTMUONClusterStruct;
 struct AliHLTMUONMansoTrackStruct;
 struct AliHLTMUONMansoRoIStruct;
 struct AliHLTMUONMansoCandidateStruct;
+struct AliHLTMUONTrackStruct;
 struct AliHLTMUONTrackDecisionStruct;
 struct AliHLTMUONPairDecisionStruct;
 } // extern "C"
@@ -93,6 +94,11 @@ public:
                return fgkNilMansoCandidateStruct;
        }
 
+       static const AliHLTMUONTrackStruct& NilTrackStruct()
+       {
+               return fgkNilTrackStruct;
+       }
+
        static const AliHLTMUONTrackDecisionStruct& NilTrackDecisionStruct()
        {
                return fgkNilTrackDecisionStruct;
@@ -148,6 +154,11 @@ public:
                return fgkMansoCandidatesBlockDataType;
        }
 
+       static const AliHLTComponentDataType& TracksBlockDataType()
+       {
+               return fgkTracksBlockDataType;
+       }
+
        static const AliHLTComponentDataType& SinglesDecisionBlockDataType()
        {
                return fgkSinglesDecisionBlockDataType;
@@ -307,6 +318,7 @@ private:
        static const AliHLTMUONMansoTrackStruct fgkNilMansoTrackStruct; // Nil manso track.
        static const AliHLTMUONMansoRoIStruct fgkNilMansoRoIStruct; // Nil manso region of interest.
        static const AliHLTMUONMansoCandidateStruct fgkNilMansoCandidateStruct; // Nil manso candidate track.
+       static const AliHLTMUONTrackStruct fgkNilTrackStruct; // Nil track structure.
        static const AliHLTMUONTrackDecisionStruct fgkNilTrackDecisionStruct; // Nil decision for single track.
        static const AliHLTMUONPairDecisionStruct fgkNilPairDecisionStruct; // Nil decision for track pair.
 
@@ -319,6 +331,7 @@ private:
        static const AliHLTComponentDataType fgkChannelBlockDataType; // Debugging information block type for channels corresponding to clusters.
        static const AliHLTComponentDataType fgkMansoTracksBlockDataType; // Manso tracks block type generated by Manso tracker components.
        static const AliHLTComponentDataType fgkMansoCandidatesBlockDataType; // Debugging information about a track candidate generated by the Manso algorithm.
+       static const AliHLTComponentDataType fgkTracksBlockDataType; // Full tracks block type generated by the tracker components.
        static const AliHLTComponentDataType fgkSinglesDecisionBlockDataType; // Trigger decision block type for single track decisions.
        static const AliHLTComponentDataType fgkPairsDecisionBlockDataType; // Trigger decision block type for pairs of particles.
        static const AliHLTComponentDataType fgkRootifiedEventDataType; // An AliHLTMUONEvent ROOT object.
index 418acea1b3861197905c0e173798b724575b28a0..1b8b435eff506fe98bfdf270931445392ccc2c05 100644 (file)
@@ -34,6 +34,7 @@
 #include "AliHLTMUONChannelsBlockStruct.h"
 #include "AliHLTMUONMansoTracksBlockStruct.h"
 #include "AliHLTMUONMansoCandidatesBlockStruct.h"
+#include "AliHLTMUONTracksBlockStruct.h"
 #include "AliHLTMUONSinglesDecisionBlockStruct.h"
 #include "AliHLTMUONPairsDecisionBlockStruct.h"
 
@@ -246,6 +247,11 @@ typedef AliHLTMUONDataBlockReader<
                AliHLTMUONMansoCandidateStruct
        > AliHLTMUONMansoCandidatesBlockReader;
 
+typedef AliHLTMUONDataBlockReader<
+               AliHLTMUONTracksBlockStruct,
+               AliHLTMUONTrackStruct
+       > AliHLTMUONTracksBlockReader;
+
 typedef AliHLTMUONDataBlockReader<
                AliHLTMUONSinglesDecisionBlockStruct,
                AliHLTMUONTrackDecisionStruct
index d3f49cad64a6eeab6a6adf923eb871533146eb67..f254cb06cabd7870355927939049c23ef5605bb2 100644 (file)
@@ -34,6 +34,7 @@
 #include "AliHLTMUONChannelsBlockStruct.h"
 #include "AliHLTMUONMansoTracksBlockStruct.h"
 #include "AliHLTMUONMansoCandidatesBlockStruct.h"
+#include "AliHLTMUONTracksBlockStruct.h"
 #include "AliHLTMUONSinglesDecisionBlockStruct.h"
 #include "AliHLTMUONPairsDecisionBlockStruct.h"
 
@@ -337,6 +338,12 @@ typedef AliHLTMUONDataBlockWriter<
                AliHLTMUONMansoCandidateStruct,
                kMansoCandidatesDataBlock
        > AliHLTMUONMansoCandidatesBlockWriter;
+
+typedef AliHLTMUONDataBlockWriter<
+               AliHLTMUONTracksBlockStruct,
+               AliHLTMUONTrackStruct,
+               kTracksDataBlock
+       > AliHLTMUONTracksBlockWriter;
        
 typedef AliHLTMUONDataBlockWriter<
                AliHLTMUONSinglesDecisionBlockStruct,
index f75792ff3fbe128e49a12c5469cb5167fe4cfd7a..2e938b489f550b29a0f1f032d182314cdacb4158 100644 (file)
@@ -143,6 +143,7 @@ enum AliHLTMUONDataBlockType
        kChannelsDataBlock = 2002,
        kMansoTracksDataBlock = 3000,
        kMansoCandidatesDataBlock = 3001,
+       kTracksDataBlock = 3100,
        kSinglesDecisionDataBlock = 4000,
        kPairsDecisionDataBlock = 4001
 };
@@ -208,6 +209,7 @@ inline std::ostream& operator << (std::ostream& stream, AliHLTMUONDataBlockType
        case kChannelsDataBlock:        stream << "kChannelsDataBlock";        break;
        case kMansoTracksDataBlock:     stream << "kMansoTracksDataBlock";     break;
        case kMansoCandidatesDataBlock: stream << "kMansoCandidatesDataBlock"; break;
+       case kTracksDataBlock:          stream << "kTracksDataBlock";          break;
        case kSinglesDecisionDataBlock: stream << "kSinglesDecisionDataBlock"; break;
        case kPairsDecisionDataBlock:   stream << "kPairsDecisionDataBlock";   break;
        default:                        stream << "INVALID";
diff --git a/HLT/MUON/AliHLTMUONTracksBlockStruct.cxx b/HLT/MUON/AliHLTMUONTracksBlockStruct.cxx
new file mode 100644 (file)
index 0000000..54738f8
--- /dev/null
@@ -0,0 +1,117 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * All rights reserved.                                                   *
+ *                                                                        *
+ * Primary Authors:                                                       *
+ *   Artur Szostak <artursz@iafrica.com>                                  *
+ *                                                                        *
+ * 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: AliHLTMUONTracksBlockStruct.cxx 36627 2009-11-10 19:21:49Z aszostak $
+
+///
+/// @file   AliHLTMUONTracksBlockStruct.cxx
+/// @author Artur Szostak <artursz@iafrica.com>
+/// @date   10 Feb 2010
+/// @brief  Implementation of useful stream and comparison operators.
+///
+/// The tracks data block is an internal dimuon HLT data block structure
+/// generated by the tracker components.
+///
+
+#include "AliHLTMUONTracksBlockStruct.h"
+#include "AliHLTMUONUtils.h"
+#include <cassert>
+
+
+std::ostream& operator << (
+               std::ostream& stream, const AliHLTMUONTrackStruct& track
+       )
+{
+       stream  << "{fId = " << track.fFlags
+               << ", fTrigRec = " << track.fTrigRec
+               << ", fFlags = " << std::showbase << std::hex
+               << track.fFlags << std::dec
+               << ", fPx = " << track.fPx
+               << ", fPy = " << track.fPy
+               << ", fPz = " << track.fPz
+               << ", fInverseBendingMomentum = " << track.fInverseBendingMomentum
+               << ", fThetaX = " << track.fThetaX
+               << ", fThetaX = " << track.fThetaY
+               << ", fX = " << track.fX
+               << ", fY = " << track.fY
+               << ", fZ = " << track.fZ
+               << ", fChi2 = " << track.fChi2;
+       for (AliHLTUInt32_t i = 0; i < 16; i++)
+       {
+               stream << ", fHit[" << i << "] = " << track.fHit[0];
+       }
+       stream << "}";
+       return stream;
+}
+
+
+std::ostream& operator << (
+               std::ostream& stream,
+               const AliHLTMUONTracksBlockStruct& block
+       )
+{
+       assert( AliHLTMUONUtils::IntegrityOk(block) );
+
+       const AliHLTMUONTrackStruct* track =
+               reinterpret_cast<const AliHLTMUONTrackStruct*>(&block + 1);
+       stream  << "{fHeader = " << block.fHeader << ", fTrack[] = [";
+       if (block.fHeader.fNrecords > 0) stream << track[0];
+       for (AliHLTUInt32_t i = 1; i < block.fHeader.fNrecords; i++)
+               stream << ", " << track[i];
+       stream << "]}";
+       return stream;
+}
+
+
+bool operator == (
+               const AliHLTMUONTrackStruct& a,
+               const AliHLTMUONTrackStruct& b
+       )
+{
+       bool result = a.fId == b.fId and a.fTrigRec == b.fTrigRec
+               and a.fFlags == b.fFlags and a.fPx == b.fPx and a.fPy == b.fPy
+               and a.fPz == b.fPz and a.fInverseBendingMomentum == b.fInverseBendingMomentum
+               and a.fThetaX == b.fThetaX and a.fThetaY == b.fThetaY
+               and a.fX == b.fX and a.fY == b.fY and a.fZ == b.fZ and a.fChi2 == b.fChi2;
+       for (AliHLTUInt32_t i = 0; i < 16; i++)
+       {
+               result &= (a.fHit[i] == b.fHit[i]);
+       }
+       return result;
+}
+
+
+bool operator == (
+               const AliHLTMUONTracksBlockStruct& a,
+               const AliHLTMUONTracksBlockStruct& b
+       )
+{
+       assert( AliHLTMUONUtils::IntegrityOk(a) );
+       assert( AliHLTMUONUtils::IntegrityOk(b) );
+
+       const AliHLTMUONTrackStruct* trackA =
+               reinterpret_cast<const AliHLTMUONTrackStruct*>(&a + 1);
+       const AliHLTMUONTrackStruct* trackB =
+               reinterpret_cast<const AliHLTMUONTrackStruct*>(&b + 1);
+       
+       // First check if the blocks have the same header. If they do then check
+       // if every track 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 (trackA[i] != trackB[i]) return false;
+       return true;
+}
diff --git a/HLT/MUON/AliHLTMUONTracksBlockStruct.h b/HLT/MUON/AliHLTMUONTracksBlockStruct.h
new file mode 100644 (file)
index 0000000..738c77c
--- /dev/null
@@ -0,0 +1,127 @@
+#ifndef ALIHLTMUONTRACKSBLOCKSTRUCT_H
+#define ALIHLTMUONTRACKSBLOCKSTRUCT_H
+/* This file is property of and copyright by the ALICE HLT Project        *
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+// $Id: AliHLTMUONTracksBlockStruct.h 36627 2009-11-10 19:21:49Z aszostak $
+
+///
+/// @file   AliHLTMUONTracksBlockStruct.h
+/// @author Artur Szostak <artursz@iafrica.com>
+/// @date   10 Feb 2010
+/// @brief  Definition the internal dimuon HLT data block for full tracks.
+///
+/// The tracks data block is an internal dimuon HLT data block structure generated
+/// by the tracker component to store found tracks.
+/// The structures are defined with C linkage since C generally gives us more
+/// binary compatibility between compilers.
+///
+
+#include "AliHLTMUONRecHitsBlockStruct.h"
+
+extern "C"
+{
+
+/**
+ * Track structure containing information about a track found by the tracker.
+ */
+struct AliHLTMUONTrackStruct
+{
+       AliHLTInt32_t fId; /// Each track should have an ID number unique for a given event. -1 == invalid.
+
+       AliHLTInt32_t fTrigRec; /// The associated trigger record ID that was matched to the track.
+
+       // The flags word constains the following bit fields (bit 31 is most
+       // significant):
+       // bits:  [31][30][29 -- 16][  15   ][  14   ]...[  1   ][  0   ]
+       // field:  -   +   reserved  hst[15]  hst[14]     hst[1]  hst[0]
+       // Where fields hst[i] indicates if fHit[i] has been filled/set.
+       // Reserved bits should be set to zero.
+       // Particle sign: if '-' is set then particle has minus sign.
+       //                if '+' is set then particle has negative sign.
+       // Either '+' or '-' should be set and if neither then the particle
+       // sign is unknown.
+       AliHLTUInt32_t fFlags;  /// Bit fields for the track structure.
+
+       AliHLTFloat32_t fPx; /// Particle's momentum X component in GeV/c.
+       AliHLTFloat32_t fPy; /// Particle's momentum Y component in GeV/c.
+       AliHLTFloat32_t fPz; /// Particle's momentum Z component in GeV/c.
+       
+       AliHLTFloat32_t fInverseBendingMomentum; /// One over the momentum of the fitted track [GeV/c].
+       AliHLTFloat32_t fThetaX; /// The slope of the fitted track in the non-bending plane.
+       AliHLTFloat32_t fThetaY; /// The slope of the fitted track in the bending plane.
+       AliHLTFloat32_t fX; /// Non-bending plane coordinate for the distance of closest approach (DCA) [cm].
+       AliHLTFloat32_t fY; /// Bending plane coordinate for the DCA [cm].
+       AliHLTFloat32_t fZ; /// Z coordinate for the DCA [cm].
+       
+       // Chi squared of the track fit.
+       // If set to -1 then no fit was done and the momentum vector and DCA coordinate is invalid.
+       AliHLTFloat32_t fChi2; /// The chi squared of the fit of fHit points to the track model.
+
+       AliHLTMUONRecHitStruct fHit[16];  /// Particle hit coordinates found by the hit reconstruction stage.
+};
+
+/**
+ * AliHLTMUONTracksBlockStruct defines the format of the internal tracks data block.
+ */
+struct AliHLTMUONTracksBlockStruct
+{
+       AliHLTMUONDataBlockHeader fHeader; // Common data block header.
+
+       // Array of tracks.
+       //AliHLTMUONTrackStruct fTrack[/*fHeader.fNrecords*/];
+};
+
+} // extern "C"
+
+
+/**
+ * Stream operator for usage with std::ostream classes which prints the track
+ * information in the following format:
+ *  {fId = xx, fTrigRec = yy, fFlags = 0xZZ, fPx = uu, fPy = vv, fPz = ww,
+ *   fInverseBendingMomentum = pp, fThetaX = nn, fThetaY = mm, fX = kk, fY = ll, fZ = hh,
+ *   fChi2 = ss, fHit[0] = {...}, fHit[1] = {...}, ... fHit[14] = {...}, fHit[15] = {...}}
+ */
+std::ostream& operator << (
+               std::ostream& stream, const AliHLTMUONTrackStruct& trigrec
+       );
+
+/**
+ * Stream operator for usage with std::ostream classes which prints the
+ * AliHLTMUONTracksBlockStruct in the following format:
+ *   {fHeader = xx, fTrack[] = [{..}, {..}, ...]}
+ */
+std::ostream& operator << (
+               std::ostream& stream, const AliHLTMUONTracksBlockStruct& block
+       );
+
+
+bool operator == (
+               const AliHLTMUONTrackStruct& a,
+               const AliHLTMUONTrackStruct& b
+       );
+
+inline bool operator != (
+               const AliHLTMUONTrackStruct& a,
+               const AliHLTMUONTrackStruct& b
+       )
+{
+       return not operator == (a, b);
+}
+
+
+bool operator == (
+               const AliHLTMUONTracksBlockStruct& a,
+               const AliHLTMUONTracksBlockStruct& b
+       );
+
+inline bool operator != (
+               const AliHLTMUONTracksBlockStruct& a,
+               const AliHLTMUONTracksBlockStruct& b
+       )
+{
+       return not operator == (a, b);
+}
+
+#endif // ALIHLTMUONTRACKSBLOCKSTRUCT_H
index aa371137c6aace4efae8b0a7c4289c6089581906..0b4cd5500f2880795628f724d6c5cb589967a053 100644 (file)
@@ -31,6 +31,7 @@
 #include "AliHLTMUONChannelsBlockStruct.h"
 #include "AliHLTMUONMansoTracksBlockStruct.h"
 #include "AliHLTMUONMansoCandidatesBlockStruct.h"
+#include "AliHLTMUONTracksBlockStruct.h"
 #include "AliHLTMUONSinglesDecisionBlockStruct.h"
 #include "AliHLTMUONPairsDecisionBlockStruct.h"
 #include "AliMUONTrackerDDLDecoderEventHandler.h"
@@ -125,6 +126,59 @@ void AliHLTMUONUtils::UnpackRecHitFlags(
 }
 
 
+AliHLTUInt32_t AliHLTMUONUtils::PackTrackFlags(
+               AliHLTMUONParticleSign sign, const bool hitset[16]
+       )
+{
+       /// This packs the given parameters into the bits of a word appropriate
+       /// for AliHLTMUONTrackStruct::fFlags.
+       /// @param sign    The particle sign.
+       /// @param hitset  Flags to indicate if the corresponding fHits[i] elements
+       ///                was set/filled.
+       /// @return  Returns the 32 bit packed word.
+       
+       AliHLTUInt32_t flags;
+       switch (sign)
+       {
+       case kSignMinus: flags = 0x80000000; break;
+       case kSignPlus:  flags = 0x40000000; break;
+       default:         flags = 0x00000000; break;
+       }
+       
+       for (AliHLTUInt32_t i = 0; i < 16; i++)
+       {
+               flags |= (hitset[i] ? (0x1 << i) : 0);
+       }
+       return flags;
+}
+
+
+void AliHLTMUONUtils::UnpackTrackFlags(
+               AliHLTUInt32_t flags, AliHLTMUONParticleSign& sign, bool hitset[16]
+       )
+{
+       /// This unpacks the AliHLTMUONTrackStruct::fFlags bits into
+       /// its component fields.
+       /// @param flags  The flags from an AliHLTMUONTrackStruct structure.
+       /// @param sign    Sets this to the particle sign.
+       /// @param hitset  Sets the array elements to indicate if the corresponding
+       ///                fHits[i] element was set/filled.
+       
+       AliHLTUInt32_t signbits = flags & 0xC0000000;
+       switch (signbits)
+       {
+       case 0x80000000: sign = kSignMinus;   break;
+       case 0x40000000: sign = kSignPlus;    break;
+       default:         sign = kSignUnknown; break;
+       }
+       
+       for (AliHLTUInt32_t i = 0; i < 16; i++)
+       {
+               hitset[i] = ((flags & (0x1 << i)) == (0x1 << i));
+       }
+}
+
+
 AliHLTUInt32_t AliHLTMUONUtils::PackTrackDecisionBits(bool highPt, bool lowPt)
 {
        ///
@@ -444,6 +498,10 @@ AliHLTMUONDataBlockType AliHLTMUONUtils::ParseCommandLineTypeString(const char*
        {
                return kMansoCandidatesDataBlock;
        }
+       else if (strcmp(type, "tracks") == 0)
+       {
+               return kTracksDataBlock;
+       }
        else if (strcmp(type, "singlesdecision") == 0)
        {
                return kSinglesDecisionDataBlock;
@@ -487,6 +545,9 @@ const char* AliHLTMUONUtils::DataBlockTypeToString(AliHLTMUONDataBlockType type)
        case kMansoCandidatesDataBlock:
                t = AliHLTMUONConstants::MansoCandidatesBlockDataType();
                break;
+       case kTracksDataBlock:
+               t = AliHLTMUONConstants::TracksBlockDataType();
+               break;
        case kSinglesDecisionDataBlock:
                t = AliHLTMUONConstants::SinglesDecisionBlockDataType();
                break;
@@ -532,6 +593,8 @@ const char* AliHLTMUONUtils::FailureReasonToString(WhyNotValid reason)
        case kDataWordDifferent: return "kDataWordDifferent";
        case kChiSquareInvalid: return "kChiSquareInvalid";
        case kMomentumVectorNotZero: return "kMomentumVectorNotZero";
+       case kMomentumParamsNotZero: return "kMomentumParamsNotZero";
+       case kDCAVertexNotZero: return "kDCAVertexNotZero";
        case kRoiRadiusInvalid: return "kRoiRadiusInvalid";
        case kHitNotWithinRoi: return "kHitNotWithinRoi";
        case kPtValueNotValid: return "kPtValueNotValid";
@@ -605,10 +668,16 @@ const char* AliHLTMUONUtils::FailureReasonToMessage(WhyNotValid reason)
                return "The raw data word is different from the unpacked values.";
        case kChiSquareInvalid:
                return "The chi squared value must be a positive value or -1"
-                       " indicating a fitting error.";
+                       " indicating no fit or a fitting error.";
        case kMomentumVectorNotZero:
                return "The chi sqaured value is set to -1 indicating momentum"
                        " was not fitted, but the momentum vector was not zero.";
+       case kMomentumParamsNotZero:
+               return "The chi sqaured value is set to -1 indicating the track"
+                       " was not fitted, but the fitted momentum parameters are not zero.";
+       case kDCAVertexNotZero:
+               return "The chi sqaured value is set to -1 indicating the track"
+                       " was not fitted, but the DCA vertex is not zero.";
        case kRoiRadiusInvalid:
                return "The region of interest radius is invalid.";
        case kHitNotWithinRoi:
@@ -1020,6 +1089,54 @@ bool AliHLTMUONUtils::HeaderOk(
 }
 
 
+bool AliHLTMUONUtils::HeaderOk(
+               const AliHLTMUONTracksBlockStruct& block,
+               WhyNotValid* reason, AliHLTUInt32_t& reasonCount
+       )
+{
+       /// 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 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 header 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 header and false otherwise.
+       
+       AliHLTUInt32_t maxCount = reasonCount;
+       reasonCount = 0;
+       bool result = true;
+       
+       // The block must have the correct type.
+       if (block.fHeader.fType != kTracksDataBlock)
+       {
+               if (reason != NULL and reasonCount < maxCount)
+               {
+                       reason[reasonCount] = kHeaderContainsWrongType;
+                       reasonCount++;
+               }
+               result = false;
+       }
+       
+       // The block's record width must be the correct size.
+       if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTrackStruct))
+       {
+               if (reason != NULL and reasonCount < maxCount)
+               {
+                       reason[reasonCount] = kHeaderContainsWrongRecordWidth;
+                       reasonCount++;
+               }
+               result = false;
+       }
+       
+       return result;
+}
+
+
 bool AliHLTMUONUtils::HeaderOk(
                const AliHLTMUONSinglesDecisionBlockStruct& block,
                WhyNotValid* reason, AliHLTUInt32_t& reasonCount
@@ -2280,6 +2397,240 @@ bool AliHLTMUONUtils::IntegrityOk(
 }
 
 
+bool AliHLTMUONUtils::IntegrityOk(
+               const AliHLTMUONTrackStruct& track,
+               WhyNotValid* reason,
+               AliHLTUInt32_t& reasonCount
+       )
+{
+       /// This method is used to check more extensively if the integrity of the
+       /// full track structure is OK and returns true in that case.
+       /// [in] \param track  The track 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.
+       
+       AliHLTUInt32_t maxCount = reasonCount;
+       reasonCount = 0;
+       bool result = true;
+       
+       // Check that the track ID has a valid value.
+       if (not (track.fId >= 0 or track.fId == -1))
+       {
+               if (reason != NULL and reasonCount < maxCount)
+               {
+                       reason[reasonCount] = kInvalidIdValue;
+                       reasonCount++;
+               }
+               result = false;
+       }
+       
+       // Check that the corresponding trigger record ID has a valid value.
+       if (not (track.fTrigRec >= 0 or track.fTrigRec == -1))
+       {
+               if (reason != NULL and reasonCount < maxCount)
+               {
+                       reason[reasonCount] = kInvalidTriggerIdValue;
+                       reasonCount++;
+               }
+               result = false;
+       }
+       
+       // Make sure that the reserved bits in the fFlags field are set
+       // to zero.
+       if ((track.fFlags & 0x3FFF0000) != 0)
+       {
+               if (reason != NULL and reasonCount < maxCount)
+               {
+                       reason[reasonCount] = kReservedBitsNotZero;
+                       reasonCount++;
+               }
+               result = false;
+       }
+
+       // Make sure the sign is not invalid.
+       if ((track.fFlags & 0xC0000000) == 0xC0000000)
+       {
+               if (reason != NULL and reasonCount < maxCount)
+               {
+                       reason[reasonCount] = kParticleSignBitsNotValid;
+                       reasonCount++;
+               }
+               result = false;
+       }
+
+       // Check that fHit[i] is nil if the corresponding bit in the
+       // flags word is zero.
+       const AliHLTMUONRecHitStruct& nilhit = AliHLTMUONConstants::NilRecHitStruct();
+       for (int i = 0; i < 16; i++)
+       {
+               if ((track.fFlags & (0x1 << i)) == 0 and track.fHit[i] != nilhit)
+               {
+                       if (reason != NULL and reasonCount < maxCount)
+                       {
+                               reason[reasonCount] = kHitNotMarkedAsNil;
+                               reasonCount++;
+                       }
+                       result = false;
+                       break;
+               }
+       }
+
+       // Check that the chi squared value is valid
+       if (not (track.fChi2 >= 0 or track.fChi2 == -1))
+       {
+               if (reason != NULL and reasonCount < maxCount)
+               {
+                       reason[reasonCount] = kChiSquareInvalid;
+                       reasonCount++;
+               }
+               result = false;
+       }
+
+       // Check that if chi squared is -1 then the momentum vector is zero.
+       if (track.fChi2 == -1 and
+           not (track.fPx == 0 and track.fPy == 0 and track.fPz == 0)
+          )
+       {
+               if (reason != NULL and reasonCount < maxCount)
+               {
+                       reason[reasonCount] = kMomentumVectorNotZero;
+                       reasonCount++;
+               }
+               result = false;
+       }
+
+       // Check that if chi squared is -1 then the momentum parameters are zero.
+       if (track.fChi2 == -1 and
+           not (track.fInverseBendingMomentum == 0 and track.fThetaX == 0 and track.fThetaY == 0)
+          )
+       {
+               if (reason != NULL and reasonCount < maxCount)
+               {
+                       reason[reasonCount] = kMomentumParamsNotZero;
+                       reasonCount++;
+               }
+               result = false;
+       }
+
+       // Check that if chi squared is -1 then the momentum parameters are zero.
+       if (track.fChi2 == -1 and
+           not (track.fX == 0 and track.fY == 0 and track.fZ == 0)
+          )
+       {
+               if (reason != NULL and reasonCount < maxCount)
+               {
+                       reason[reasonCount] = kDCAVertexNotZero;
+                       reasonCount++;
+               }
+               result = false;
+       }
+       
+       // Check the individual hits
+       for (int i = 0; i < 16; i++)
+       {
+               AliHLTUInt32_t filledCount = maxCount - reasonCount;
+               if (not IntegrityOk(track.fHit[i], reason + reasonCount, filledCount))
+               {
+                       reasonCount += filledCount;
+                       result = false;
+               }
+       }
+       
+       return result;
+}
+
+
+bool AliHLTMUONUtils::IntegrityOk(
+               const AliHLTMUONTracksBlockStruct& block,
+               WhyNotValid* reason,
+               AliHLTUInt32_t* recordNum,
+               AliHLTUInt32_t& reasonCount
+       )
+{
+       /// This method is used to check more extensively if the integrity of the
+       /// dHLT internal track data block is OK and returns true in that case.
+       /// [in] \param block  The track 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 Manso track that had a problem.
+       ///      The value 'recordNum[i]' will only contain a valid value if
+       ///      the corresponding 'reason[i]' contains one of:
+       ///        - kInvalidIdValue
+       ///        - kInvalidTriggerIdValue
+       ///        - kReservedBitsNotZero
+       ///        - kParticleSignBitsNotValid
+       ///        - kHitNotMarkedAsNil
+       ///        - kChiSquareInvalid
+       ///        - kMomentumVectorNotZero
+       ///        - kMomentumParamsNotZero
+       ///        - kDCAVertexNotZero
+       ///        - 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' 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;
+       bool result = HeaderOk(block, reason, reasonCount);
+       
+       const AliHLTMUONTrackStruct* track =
+               reinterpret_cast<const AliHLTMUONTrackStruct*>(&block + 1);
+       
+       // Check if any track ID is duplicated.
+       for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
+       {
+               AliHLTInt32_t id = track[i].fId;
+               for (AliHLTUInt32_t j = i+1; j < block.fHeader.fNrecords; j++)
+               {
+                       if (id == track[j].fId)
+                       {
+                               if (reason != NULL and reasonCount < maxCount)
+                               {
+                                       reason[reasonCount] = kFoundDuplicateIDs;
+                                       reasonCount++;
+                               }
+                               result = false;
+                       }
+               }
+       }
+       
+       // Check that all the tracks have integrity.
+       for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
+       {
+               AliHLTUInt32_t filledCount = maxCount - reasonCount;
+               if (not IntegrityOk(track[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;
+}
+
+
 bool AliHLTMUONUtils::IntegrityOk(
                const AliHLTMUONTrackDecisionStruct& decision,
                WhyNotValid* reason,
index ba9e4769e202f04cbc29fc01a0bd76f8801156b2..48cf384020d52c88400f3e318985084a0e64031f 100644 (file)
@@ -32,6 +32,8 @@ struct AliHLTMUONMansoTrackStruct;
 struct AliHLTMUONMansoTracksBlockStruct;
 struct AliHLTMUONMansoCandidateStruct;
 struct AliHLTMUONMansoCandidatesBlockStruct;
+struct AliHLTMUONTrackStruct;
+struct AliHLTMUONTracksBlockStruct;
 struct AliHLTMUONTrackDecisionStruct;
 struct AliHLTMUONSinglesDecisionBlockStruct;
 struct AliHLTMUONPairDecisionStruct;
@@ -137,6 +139,32 @@ public:
        {
                UnpackTriggerRecordFlags(flags, sign, hitset);
        }
+
+       /**
+        * This packs the given parameters into the bits of a word appropriate
+        * for AliHLTMUONTrackStruct::fFlags.
+        * @param sign    The particle sign.
+        * @param hitset  Flags to indicate if the corresponding fHits[i] elements
+        *                was set/filled.
+        * @return  Returns the 32 bit packed word.
+        */
+       static AliHLTUInt32_t PackTrackFlags(
+                       AliHLTMUONParticleSign sign, const bool hitset[16]
+               );
+
+       /**
+        * This unpacks the AliHLTMUONTrackStruct::fFlags bits into
+        * its component fields.
+        * @param flags  The flags from an AliHLTMUONTrackStruct structure.
+        * @param sign    Sets this to the particle sign.
+        * @param hitset  Sets the array elements to indicate if the corresponding
+        *                fHits[i] element was set/filled.
+        */
+       static void UnpackTrackFlags(
+                       AliHLTUInt32_t flags, // [in]
+                       AliHLTMUONParticleSign& sign, // [out]
+                       bool hitset[16] // [out]
+               );
        
        /**
         * This packs the given parameters into the bits of a word appropriate
@@ -381,6 +409,8 @@ public:
                kDataWordDifferent, ///< The raw data word is different from the unpacked values.
                kChiSquareInvalid,  ///< The chi squared value must be a positive value or -1 indicating a fitting error.
                kMomentumVectorNotZero, ///< The chi sqaured value is set to -1, but momentum vector not zero.
+               kMomentumParamsNotZero, ///< The chi sqaured value is set to -1, but fitted momentum parameters are not zero.
+               kDCAVertexNotZero, ///< The chi sqaured value is set to -1, but DCA vertex is not zero.
                kRoiRadiusInvalid, ///< The region of interest radius is invalid.
                kHitNotWithinRoi, ///< A tracks hit is not within the corresponding region of interest.
                kPtValueNotValid,  ///< The pT value is not positive nor -1 indicating an invalid value.
@@ -530,6 +560,24 @@ public:
                return HeaderOk(block, reason, count);
        }
        
+       /**
+        * Method used to check if the header information corresponds to the
+        * supposed type of the tracks data block given.
+        * This method will return either kHeaderContainsWrongType or
+        * kHeaderContainsWrongRecordWidth as the reason code.
+        * [in]  \param block  The data block to check.
+        * [out] \param reason  If this is not NULL, then the variable pointed to
+        *      by this pointer 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.
+        */
+       static bool HeaderOk(const AliHLTMUONTracksBlockStruct& block, WhyNotValid* reason = NULL)
+       {
+               AliHLTUInt32_t count = 1;
+               return HeaderOk(block, reason, count);
+       }
+       
        /**
         * Method used to check if the header information corresponds to the
         * supposed type of the single tracks dHLT trigger decision data block.
@@ -610,6 +658,11 @@ public:
                        WhyNotValid* reason, AliHLTUInt32_t& reasonCount
                );
        
+       static bool HeaderOk(
+                       const AliHLTMUONTracksBlockStruct& block,
+                       WhyNotValid* reason, AliHLTUInt32_t& reasonCount
+               );
+       
        static bool HeaderOk(
                        const AliHLTMUONSinglesDecisionBlockStruct& block,
                        WhyNotValid* reason, AliHLTUInt32_t& reasonCount
@@ -900,6 +953,46 @@ public:
                return IntegrityOk(block, reason, recordNum, count);
        }
        
+       /**
+        * This method is used to check more extensively if the integrity of the
+        * full track structure is OK and returns true in that case.
+        * [in] \param track  The track 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 structure and false otherwise.
+        */
+       static bool IntegrityOk(
+                       const AliHLTMUONTrackStruct& track,
+                       WhyNotValid* reason = NULL
+               )
+       {
+               AliHLTUInt32_t count = 1;
+               return IntegrityOk(track, reason, count);
+       }
+       
+       /**
+        * 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 track 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.
+        * [out] \param recordNum  If this is not NULL, then it will be filled with
+        *      the number of the Manso track 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 AliHLTMUONTracksBlockStruct& block,
+                       WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
+               )
+       {
+               AliHLTUInt32_t count = 1;
+               return IntegrityOk(block, reason, recordNum, count);
+       }
+       
        /**
         * This method is used to check more extensively if the integrity of the
         * single track trigger decision structure is OK and returns true in that case.
@@ -1064,6 +1157,17 @@ public:
                        AliHLTUInt32_t& reasonCount
                );
        
+       static bool IntegrityOk(
+                       const AliHLTMUONTrackStruct& track,
+                       WhyNotValid* reason, AliHLTUInt32_t& reasonCount
+               );
+       
+       static bool IntegrityOk(
+                       const AliHLTMUONTracksBlockStruct& block,
+                       WhyNotValid* reason, AliHLTUInt32_t* recordNum,
+                       AliHLTUInt32_t& reasonCount
+               );
+       
        static bool IntegrityOk(
                        const AliHLTMUONTrackDecisionStruct& decision,
                        WhyNotValid* reason, AliHLTUInt32_t& reasonCount
index 3bad6d596aeb427dc7af6e85b0805b6f84645ceb..fd6ce70f07f95bcc09a574e628d8c3203d3129ef 100644 (file)
@@ -288,6 +288,7 @@ int AliHLTMUONDataCheckerComponent::DoEvent(
        PAliHLTComponentBlockData* channelBlocks = NULL;
        PAliHLTComponentBlockData* mansoTrackBlocks = NULL;
        PAliHLTComponentBlockData* mansoCandidateBlocks = NULL;
+       PAliHLTComponentBlockData* trackBlocks = NULL;
        PAliHLTComponentBlockData* singleDecisionBlocks = NULL;
        PAliHLTComponentBlockData* pairDecisionBlocks = NULL;
        AliHLTUInt32_t trigRecBlocksCount = 0;
@@ -297,6 +298,7 @@ int AliHLTMUONDataCheckerComponent::DoEvent(
        AliHLTUInt32_t channelBlocksCount = 0;
        AliHLTUInt32_t mansoTrackBlocksCount = 0;
        AliHLTUInt32_t mansoCandidateBlocksCount = 0;
+       AliHLTUInt32_t trackBlocksCount = 0;
        AliHLTUInt32_t singleDecisionBlocksCount = 0;
        AliHLTUInt32_t pairDecisionBlocksCount = 0;
        try
@@ -309,6 +311,7 @@ int AliHLTMUONDataCheckerComponent::DoEvent(
                channelBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
                mansoTrackBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
                mansoCandidateBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
+               trackBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
                singleDecisionBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
                pairDecisionBlocks = new PAliHLTComponentBlockData[evtData.fBlockCnt];
        }
@@ -324,6 +327,7 @@ int AliHLTMUONDataCheckerComponent::DoEvent(
                if (channelBlocks != NULL) delete [] channelBlocks;
                if (mansoTrackBlocks != NULL) delete [] mansoTrackBlocks;
                if (mansoCandidateBlocks != NULL) delete [] mansoCandidateBlocks;
+               if (trackBlocks != NULL) delete [] trackBlocks;
                if (singleDecisionBlocks != NULL) delete [] singleDecisionBlocks;
                if (pairDecisionBlocks != NULL) delete [] pairDecisionBlocks;
                return -ENOMEM;
@@ -401,6 +405,10 @@ int AliHLTMUONDataCheckerComponent::DoEvent(
                                {
                                        blockType = kMansoCandidatesDataBlock;
                                }
+                               else if (blocks[n].fDataType == AliHLTMUONConstants::TracksBlockDataType())
+                               {
+                                       blockType = kTracksDataBlock;
+                               }
                                else if (blocks[n].fDataType == AliHLTMUONConstants::SinglesDecisionBlockDataType())
                                {
                                        blockType = kSinglesDecisionDataBlock;
@@ -460,6 +468,10 @@ int AliHLTMUONDataCheckerComponent::DoEvent(
                                blockOk[n] = CheckMansoCandidatesBlock(blocks[n], n);
                                mansoCandidateBlocks[mansoCandidateBlocksCount++] = &blocks[n];
                                break;
+                       case kTracksDataBlock:
+                               blockOk[n] = CheckTracksBlock(blocks[n], n);
+                               trackBlocks[trackBlocksCount++] = &blocks[n];
+                               break;
                        case kSinglesDecisionDataBlock:
                                blockOk[n] = CheckSinglesDecisionBlock(blocks[n], n);
                                singleDecisionBlocks[singleDecisionBlocksCount++] = &blocks[n];
@@ -491,6 +503,7 @@ int AliHLTMUONDataCheckerComponent::DoEvent(
                                channelBlocks, channelBlocksCount,
                                mansoTrackBlocks, mansoTrackBlocksCount,
                                mansoCandidateBlocks, mansoCandidateBlocksCount,
+                               trackBlocks, trackBlocksCount,
                                singleDecisionBlocks, singleDecisionBlocksCount,
                                pairDecisionBlocks, pairDecisionBlocksCount
                        );
@@ -524,6 +537,7 @@ int AliHLTMUONDataCheckerComponent::DoEvent(
                delete [] channelBlocks;
                delete [] mansoTrackBlocks;
                delete [] mansoCandidateBlocks;
+               delete [] trackBlocks;
                delete [] singleDecisionBlocks;
                delete [] pairDecisionBlocks;
        )
@@ -1040,7 +1054,7 @@ bool AliHLTMUONDataCheckerComponent::IsMansoTrackOk(
        ///      block being checked.
        /// \param  track The Manso track data being checked.
        /// \param  ddl  The array decoded by AliHLTMUONUtils::UnpackSpecBits.
-       /// \returns true if the hit is valid and false otherwise.
+       /// \returns true if the Manso track is valid and false otherwise.
        
        bool result = true;
        
@@ -1056,7 +1070,7 @@ bool AliHLTMUONDataCheckerComponent::IsMansoTrackOk(
                        " fPtr = %p and fSize = %u bytes."
                        " Assuming this is a %s data block."
                        " Problem with entry %d in block: The Manso track has"
-                       " the chi squared value of %f that unreasonably big.",
+                       " the chi squared value of %f that is unreasonably big.",
                        blockNumber,
                        DataType2Text(block.fDataType).c_str(),
                        block.fPtr,
@@ -1098,6 +1112,157 @@ bool AliHLTMUONDataCheckerComponent::IsMansoTrackOk(
 }
 
 
+bool AliHLTMUONDataCheckerComponent::IsTrackOk(
+               const AliHLTComponentBlockData& block,
+               AliHLTUInt32_t blockNumber,
+               const char* name,
+               AliHLTUInt32_t entryNumber,
+               const AliHLTMUONTrackStruct& track,
+               bool ddl[22]
+       ) const
+{
+       /// Checks if the full track structure is Ok.
+       /// \param  block The block from which the track data comes from.
+       /// \param  blockNumber The block index number.
+       /// \param  name The name of the type of block.
+       /// \param  entryNumber The entry index number of the structure in the
+       ///      block being checked.
+       /// \param  track The track data being checked.
+       /// \param  ddl  The array decoded by AliHLTMUONUtils::UnpackSpecBits.
+       /// \returns true if the full track structure is valid and false otherwise.
+       
+       bool result = true;
+       
+       // Chi^2 should not be greater than the worst fit possible, estimated
+       // as the diameter of largest chamber times the number of points
+       // findable in a track. Max points is 10 tracker chambers times
+       // 2 cathodes + 4 trigger chambers.
+       if (track.fChi2 > AliMUONConstants::Dmax(6)*AliMUONConstants::Dmax(6)*(10*2+4))
+       {
+               // Just a warning since this is not technically an
+               // integrity problem.
+               HLTWarning("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 track has"
+                       " the chi squared value of %f that is unreasonably big.",
+                       blockNumber,
+                       DataType2Text(block.fDataType).c_str(),
+                       block.fPtr,
+                       block.fSize,
+                       name,
+                       entryNumber,
+                       track.fChi2
+               );
+               result = false;
+       }
+       
+       // Check if the momentum vector is reasonable.
+       bool momOk = IsMomentumVectorOk(
+                       block, blockNumber, name, entryNumber,
+                       track.fPx, track.fPy, track.fPz
+               );
+       if (not momOk) result = false;
+       
+       // Check that the momentum parameters correspond to the momentum vector.
+       double momvalue = sqrt(track.fPy*track.fPy + track.fPz*track.fPz);
+       double invMom = (momvalue != 0 ? 1. / momvalue : 0);
+       if (TMath::Abs(invMom - TMath::Abs(track.fInverseBendingMomentum)) > 1e-12)
+       {
+               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 track's inverse bending"
+                       " momentum %f does not correspond to the momentum vector.",
+                       blockNumber,
+                       DataType2Text(block.fDataType).c_str(),
+                       block.fPtr,
+                       block.fSize,
+                       name,
+                       entryNumber,
+                       track.fInverseBendingMomentum
+               );
+               result = false;
+       }
+       if (track.fPz != 0 and TMath::Abs(track.fPx/track.fPz - track.fThetaX) > 1e-12)
+       {
+               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 track's non-bending plane"
+                       " slope parameter %f does not correspond to the momentum vector.",
+                       blockNumber,
+                       DataType2Text(block.fDataType).c_str(),
+                       block.fPtr,
+                       block.fSize,
+                       name,
+                       entryNumber,
+                       track.fThetaX
+               );
+               result = false;
+       }
+       if (track.fPz != 0 and TMath::Abs(track.fPy/track.fPz - track.fThetaY) > 1e-12)
+       {
+               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 track's bending plane"
+                       " slope parameter %f does not correspond to the momentum vector.",
+                       blockNumber,
+                       DataType2Text(block.fDataType).c_str(),
+                       block.fPtr,
+                       block.fSize,
+                       name,
+                       entryNumber,
+                       track.fThetaY
+               );
+               result = false;
+       }
+       
+       // Check that the DCA vertex is reasonable. i.e. the vertex is within
+       // a 1 meter cube of the origin.
+       if (TMath::Abs(track.fX) > 100 or TMath::Abs(track.fY) > 100 or TMath::Abs(track.fZ) > 100)
+       {
+               // Just a warning since this is not technically an integrity problem.
+               HLTWarning("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 track's distance of closest"
+                       " approach (DCA) vertex (x, y, z) = (%f, %f, %f) is not a reasonable value.",
+                       blockNumber,
+                       DataType2Text(block.fDataType).c_str(),
+                       block.fPtr,
+                       block.fSize,
+                       name,
+                       entryNumber,
+                       track.fX, track.fY, track.fZ
+               );
+               result = false;
+       }
+       
+       AliHLTMUONParticleSign sign;
+       bool hitset[16];
+       AliHLTMUONUtils::UnpackTrackFlags(track.fFlags, sign, hitset);
+       
+       // Min and max allowed chamber numbers for hits:
+       Int_t minCh = 0;
+       Int_t maxCh = AliMUONConstants::NTrackingCh() - 1;
+       
+       // Check that this hit coordinates are OK.
+       for (AliHLTUInt32_t i = 0; i < 16; i++)
+       {
+               if (not hitset[i]) continue; // ignore hits that are not initialised.
+               bool hitOk = IsHitCoordinateOk(
+                               block, blockNumber, name, entryNumber, track.fHit[i],
+                               minCh, maxCh, -1, ddl
+                       );
+               if (not hitOk) result = false;
+       }
+       
+       return result;
+}
+
+
 bool AliHLTMUONDataCheckerComponent::CheckDetElemIds(
                const AliHLTComponentBlockData& infoBlock,
                AliHLTUInt32_t infoBlockNumber,
@@ -2781,6 +2946,66 @@ bool AliHLTMUONDataCheckerComponent::CheckMansoCandidatesBlock(
 }
 
 
+bool AliHLTMUONDataCheckerComponent::CheckTracksBlock(
+               const AliHLTComponentBlockData& block,
+               AliHLTUInt32_t blockNumber
+       ) const
+{
+       /// Checks the validity of a tracks block.
+
+       bool result = true;
+       const char* name = "tracks";
+       
+       if (not fIgnoreSpec)
+       {
+               if (not IsSpecificationValid(block, blockNumber, name))
+                       result = false;
+       }
+       
+       AliHLTMUONTracksBlockReader inblock(block.fPtr, block.fSize);
+       if (not CheckBlockIntegrity(block, blockNumber, inblock, name))
+               return false;
+       
+       bool ddl[22];
+       AliHLTMUONUtils::UnpackSpecBits(block.fSpecification, ddl);
+       
+       for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
+       {
+               // Need to check that no entries have duplicated data but with
+               // a different track ID number.
+               AliHLTMUONTrackStruct ti = inblock[i];
+               ti.fId = -1;
+               for (AliHLTUInt32_t j = i+1; j < inblock.Nentries(); j++)
+               {
+                       AliHLTMUONTrackStruct tj = inblock[j];
+                       tj.fId = ti.fId;
+                       
+                       if (ti == tj)
+                       {
+                               HLTError("Problem found with data block %d, fDataType = '%s',"
+                                       " fPtr = %p and fSize = %u bytes."
+                                       " Assuming this is a %s data block."
+                                       " Problem: The track structures %d and %d contain the"
+                                       " same data. The data might have been duplicated.",
+                                       blockNumber,
+                                       DataType2Text(block.fDataType).c_str(),
+                                       block.fPtr,
+                                       block.fSize,
+                                       name,
+                                       i, j
+                               );
+                               result = false;
+                       }
+               }
+               
+               bool trackOk = IsTrackOk(block, blockNumber, name, i, ti, ddl);
+               if (not trackOk) result = false;
+       }
+       
+       return result;
+}
+
+
 bool AliHLTMUONDataCheckerComponent::CheckSinglesDecisionBlock(
                const AliHLTComponentBlockData& block,
                AliHLTUInt32_t blockNumber
@@ -2866,7 +3091,7 @@ bool AliHLTMUONDataCheckerComponent::IsScalarTooLarge(
                AliHLTUInt32_t totalTrackCount
        ) const
 {
-       /// Checks if the scalar value is larger than the number of Manso
+       /// Checks if the scalar value is larger than the number of
        /// tracks in the event.
 
        if (scalarValue > totalTrackCount)
@@ -2875,7 +3100,7 @@ bool AliHLTMUONDataCheckerComponent::IsScalarTooLarge(
                        " data block %d, fDataType = '%s', fPtr = %p and"
                        " fSize = %u bytes."
                        " Problem: The %s scalar with value %d is larger"
-                       " than the total number of Manso tracks found for the"
+                       " than the total number of tracks found for the"
                        " event (%d tracks).",
                        blockTypeName,
                        blockNumber,
@@ -2895,6 +3120,44 @@ bool AliHLTMUONDataCheckerComponent::IsScalarTooLarge(
 }
 
 
+bool AliHLTMUONDataCheckerComponent::IsScalarTooLargePairs(
+               const AliHLTComponentBlockData* block,
+               AliHLTUInt32_t blockNumber,
+               const char* blockTypeName,
+               const char* scalarName,
+               AliHLTUInt32_t scalarValue,
+               AliHLTUInt32_t trackPairsCount
+       ) const
+{
+       /// Checks if the scalar value is larger than the number of
+       /// track pairs in the event.
+
+       if (scalarValue > trackPairsCount)
+       {
+               HLTError("Problem found with %s trigger decision"
+                       " data block %d, fDataType = '%s', fPtr = %p and"
+                       " fSize = %u bytes."
+                       " Problem: The %s scalar with value %d is larger"
+                       " than the total number of track pairs found for the"
+                       " event (%d track pairs).",
+                       blockTypeName,
+                       blockNumber,
+                       DataType2Text(block->fDataType).c_str(),
+                       block->fPtr,
+                       block->fSize,
+                       scalarName,
+                       scalarValue,
+                       trackPairsCount
+               );
+               return true;
+       }
+       else
+       {
+               return false;
+       }
+}
+
+
 bool AliHLTMUONDataCheckerComponent::IsScalarALargerThanB(
                const AliHLTComponentBlockData* block,
                AliHLTUInt32_t blockNumber,
@@ -2973,6 +3236,8 @@ void AliHLTMUONDataCheckerComponent::MakeGlobalChecks(
                AliHLTUInt32_t mansoTrackBlocksCount,
                const AliHLTComponentBlockData** mansoCandidateBlocks,
                AliHLTUInt32_t mansoCandidateBlocksCount,
+               const AliHLTComponentBlockData** trackBlocks,
+               AliHLTUInt32_t trackBlocksCount,
                const AliHLTComponentBlockData** singleDecisionBlocks,
                AliHLTUInt32_t singleDecisionBlocksCount,
                const AliHLTComponentBlockData** pairDecisionBlocks,
@@ -2989,8 +3254,8 @@ void AliHLTMUONDataCheckerComponent::MakeGlobalChecks(
        /// the trigger record data blocks.
        /// 4) Do the number of channels claimed in the cluster correspond to
        /// the number of channel structures.
-       /// 5) Check that the momentum vectors between the Manso tracks and
-       /// the corresponding trigger record are compatible.
+       /// 5) Check that the momentum vectors between the Manso and full 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.
@@ -3822,6 +4087,186 @@ void AliHLTMUONDataCheckerComponent::MakeGlobalChecks(
                }
        }
        
+       for (AliHLTUInt32_t bi = 0; bi < trackBlocksCount; bi++)
+       {
+               AliHLTMUONTracksBlockReader inblocki(trackBlocks[bi]->fPtr, trackBlocks[bi]->fSize);
+               if (not inblocki.BufferSizeOk()) continue;
+               
+               totalTrackCount += inblocki.Nentries();
+               
+               // Check if all the trigger record IDs in the track structures exist.
+               for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
+               {
+                       bool found = false;
+                       
+                       for (AliHLTUInt32_t bj = 0; bj < trigRecBlocksCount and not found; bj++)
+                       {
+                               AliHLTMUONTriggerRecordsBlockReader inblockj(trigRecBlocks[bj]->fPtr, trigRecBlocks[bj]->fSize);
+                               if (not inblockj.BufferSizeOk()) continue;
+                               
+                               for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
+                               {
+                                       if (inblocki[i].fTrigRec == inblockj[j].fId)
+                                       {
+                                               // At this point we can check if the momentum
+                                               // is compatible with the trigger record.
+                                               if (not AreMomentaCompatible(
+                                                               inblocki[i].fPx, inblocki[i].fPy, inblocki[i].fPz,
+                                                               inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
+                                                       )
+                                                  )
+                                               {
+                                                       HLTWarning("Problem found with track"
+                                                               " data block %d, fDataType = '%s', fPtr = %p and"
+                                                               " fSize = %u bytes."
+                                                               " Problem with track structure %d in block: The momentum"
+                                                               " vector of the track p = {%f, %f, %f} GeV/c is not"
+                                                               " compatible with the momentum vector of the trigger"
+                                                               " record with p = {%f, %f, %f} GeV/c.",
+                                                               bi,
+                                                               DataType2Text(trackBlocks[bi]->fDataType).c_str(),
+                                                               trackBlocks[bi]->fPtr,
+                                                               trackBlocks[bi]->fSize,
+                                                               i, inblocki[i].fPx, inblocki[i].fPy, inblocki[i].fPz,
+                                                               inblockj[j].fPx, inblockj[j].fPy, inblockj[j].fPz
+                                                       );
+                                                       MarkBlock(blocks, blockOk, blockCount, trackBlocks[bi]);
+                                               }
+                                               
+                                               found = true;
+                                               break;
+                                       }
+                               }
+                       }
+                       
+                       if (not found)
+                       {
+                               HLTError("Problem found with track"
+                                       " data block %d, fDataType = '%s', fPtr = %p and"
+                                       " fSize = %u bytes."
+                                       " Problem with track structure %d in block: The trigger"
+                                       " record identifier %d does not exist in any trigger"
+                                       " record data block.",
+                                       bi,
+                                       DataType2Text(trackBlocks[bi]->fDataType).c_str(),
+                                       trackBlocks[bi]->fPtr,
+                                       trackBlocks[bi]->fSize,
+                                       i, inblocki[i].fTrigRec
+                               );
+                               MarkBlock(blocks, blockOk, blockCount, trackBlocks[bi]);
+                       }
+               }
+               
+               // Check if all the hits in the track structures exist.
+               for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
+               {
+                       AliHLTMUONParticleSign sign;
+                       bool hitset[16];
+                       AliHLTMUONUtils::UnpackTrackFlags(inblocki[i].fFlags, sign, hitset);
+                       
+                       for (AliHLTUInt32_t n = 0; n < 16; n++)
+                       {
+                               if (not hitset[n]) continue;
+                               bool found = false;
+                               
+                               for (AliHLTUInt32_t bj = 0; bj < hitBlocksCount and not found; bj++)
+                               {
+                                       AliHLTMUONRecHitsBlockReader inblockj(hitBlocks[bj]->fPtr, hitBlocks[bj]->fSize);
+                                       if (not inblockj.BufferSizeOk()) continue;
+                                       
+                                       for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
+                                       {
+                                               if (inblocki[i].fHit[n] == inblockj[j])
+                                               {
+                                                       found = true;
+                                                       break;
+                                               }
+                                       }
+                               }
+                               
+                               if (not found)
+                               {
+                                       HLTError("Problem found with track"
+                                               " data block %d, fDataType = '%s', fPtr = %p and"
+                                               " fSize = %u bytes."
+                                               " Problem with track structure %d in block: The hit"
+                                               " for chamber %d does not exist in any"
+                                               " reconstructed hits data block.",
+                                               bi,
+                                               DataType2Text(trackBlocks[bi]->fDataType).c_str(),
+                                               trackBlocks[bi]->fPtr,
+                                               trackBlocks[bi]->fSize,
+                                               i, n+6+1
+                                       );
+                                       MarkBlock(blocks, blockOk, blockCount, trackBlocks[bi]);
+                               }
+                       }
+               }
+               
+               // Check if all the track structures are unique up to the ID and
+               // have unique identifiers.
+               for (AliHLTUInt32_t bj = bi+1; bj < trackBlocksCount; bj++)
+               {
+                       AliHLTMUONTracksBlockReader inblockj(trackBlocks[bj]->fPtr, trackBlocks[bj]->fSize);
+                       if (not inblockj.BufferSizeOk()) continue;
+                       
+                       for (AliHLTUInt32_t i = 0; i < inblocki.Nentries(); i++)
+                       for (AliHLTUInt32_t j = 0; j < inblockj.Nentries(); j++)
+                       {
+                               if (inblocki[i].fId == inblockj[j].fId)
+                               {
+                                       HLTError("Problem found with track"
+                                               " data block %d, fDataType = '%s', fPtr = %p and"
+                                               " fSize = %u bytes, and track data block %d,"
+                                               " fDataType = '%s', fPtr = %p and fSize = %u bytes."
+                                               " Problem: The track structure %d in block %d and entry"
+                                               " %d in block %d have the same identifier, but they"
+                                               " should be unique.",
+                                               bi,
+                                               DataType2Text(trackBlocks[bi]->fDataType).c_str(),
+                                               trackBlocks[bi]->fPtr,
+                                               trackBlocks[bi]->fSize,
+                                               bj,
+                                               DataType2Text(trackBlocks[bj]->fDataType).c_str(),
+                                               trackBlocks[bj]->fPtr,
+                                               trackBlocks[bj]->fSize,
+                                               bi, i,
+                                               bj, j
+                                       );
+                                       MarkBlock(blocks, blockOk, blockCount, trackBlocks[bi]);
+                                       MarkBlock(blocks, blockOk, blockCount, trackBlocks[bj]);
+                               }
+                               
+                               AliHLTMUONTrackStruct a = inblocki[i];
+                               AliHLTMUONTrackStruct b = inblockj[j];
+                               a.fId = b.fId = -1;
+                               if (a == b)
+                               {
+                                       HLTError("Problem found with track"
+                                               " data block %d, fDataType = '%s', fPtr = %p and"
+                                               " fSize = %u bytes, and track data block %d,"
+                                               " fDataType = '%s', fPtr = %p and fSize = %u bytes."
+                                               " Problem: The track structure %d in block %d and entry"
+                                               " %d in block %d have the same data."
+                                               " The data may have been duplicated.",
+                                               bi,
+                                               DataType2Text(trackBlocks[bi]->fDataType).c_str(),
+                                               trackBlocks[bi]->fPtr,
+                                               trackBlocks[bi]->fSize,
+                                               bj,
+                                               DataType2Text(trackBlocks[bj]->fDataType).c_str(),
+                                               trackBlocks[bj]->fPtr,
+                                               trackBlocks[bj]->fSize,
+                                               bi, i,
+                                               bj, j
+                                       );
+                                       MarkBlock(blocks, blockOk, blockCount, trackBlocks[bi]);
+                                       MarkBlock(blocks, blockOk, blockCount, trackBlocks[bj]);
+                               }
+                       }
+               }
+       }
+       
        for (AliHLTUInt32_t bi = 0; bi < singleDecisionBlocksCount; bi++)
        {
                AliHLTMUONSinglesDecisionBlockReader inblocki(singleDecisionBlocks[bi]->fPtr, singleDecisionBlocks[bi]->fSize);
@@ -3950,15 +4395,15 @@ void AliHLTMUONDataCheckerComponent::MakeGlobalChecks(
                AliHLTUInt32_t maxPairs = totalTrackCount * (totalTrackCount-1) / 2;
                const AliHLTMUONPairsDecisionBlockStruct& hdr = inblocki.BlockHeader();
                const AliHLTComponentBlockData* block = pairDecisionBlocks[bi];
-               if (IsScalarTooLarge(block, bi, "track pair", "fNunlikeAnyPt", hdr.fNunlikeAnyPt, maxPairs) or
-                   IsScalarTooLarge(block, bi, "track pair", "fNunlikeLowPt", hdr.fNunlikeLowPt, maxPairs) or
-                   IsScalarTooLarge(block, bi, "track pair", "fNunlikeHighPt", hdr.fNunlikeHighPt, maxPairs) or
-                   IsScalarTooLarge(block, bi, "track pair", "fNlikeAnyPt", hdr.fNlikeAnyPt, maxPairs) or
-                   IsScalarTooLarge(block, bi, "track pair", "fNlikeLowPt", hdr.fNlikeLowPt, maxPairs) or
-                   IsScalarTooLarge(block, bi, "track pair", "fNlikeHighPt", hdr.fNlikeHighPt, maxPairs) or
-                   IsScalarTooLarge(block, bi, "track pair", "fNmassAny", hdr.fNmassAny, maxPairs) or
-                   IsScalarTooLarge(block, bi, "track pair", "fNmassLow", hdr.fNmassLow, maxPairs) or
-                   IsScalarTooLarge(block, bi, "track pair", "fNmassHigh", hdr.fNmassHigh, maxPairs) or
+               if (IsScalarTooLargePairs(block, bi, "track pair", "fNunlikeAnyPt", hdr.fNunlikeAnyPt, maxPairs) or
+                   IsScalarTooLargePairs(block, bi, "track pair", "fNunlikeLowPt", hdr.fNunlikeLowPt, maxPairs) or
+                   IsScalarTooLargePairs(block, bi, "track pair", "fNunlikeHighPt", hdr.fNunlikeHighPt, maxPairs) or
+                   IsScalarTooLargePairs(block, bi, "track pair", "fNlikeAnyPt", hdr.fNlikeAnyPt, maxPairs) or
+                   IsScalarTooLargePairs(block, bi, "track pair", "fNlikeLowPt", hdr.fNlikeLowPt, maxPairs) or
+                   IsScalarTooLargePairs(block, bi, "track pair", "fNlikeHighPt", hdr.fNlikeHighPt, maxPairs) or
+                   IsScalarTooLargePairs(block, bi, "track pair", "fNmassAny", hdr.fNmassAny, maxPairs) or
+                   IsScalarTooLargePairs(block, bi, "track pair", "fNmassLow", hdr.fNmassLow, maxPairs) or
+                   IsScalarTooLargePairs(block, bi, "track pair", "fNmassHigh", hdr.fNmassHigh, maxPairs) or
                    IsScalarALargerThanB(block, bi, "track pair", "fNunlikeHighPt", hdr.fNunlikeHighPt, "fNunlikeLowPt", hdr.fNunlikeLowPt) or
                    IsScalarALargerThanB(block, bi, "track pair", "fNunlikeLowPt", hdr.fNunlikeLowPt, "fNunlikeAnyPt", hdr.fNunlikeAnyPt) or
                    IsScalarALargerThanB(block, bi, "track pair", "fNlikeHighPt", hdr.fNlikeHighPt, "fNlikeLowPt", hdr.fNlikeLowPt) or
index 53a5e772c53700478e86b1aa7a6f89d4a29af9c3..913f1bd0d477a32a78b1cb8005f70ebd0d64727a 100644 (file)
@@ -25,6 +25,7 @@ extern "C" struct AliHLTMUONClusterStruct;
 extern "C" struct AliHLTMUONTriggerRecordStruct;
 extern "C" struct AliHLTMUONTrigRecInfoStruct;
 extern "C" struct AliHLTMUONMansoTrackStruct;
+extern "C" struct AliHLTMUONTrackStruct;
 
 /**
  * @class AliHLTMUONDataCheckerComponent
@@ -183,6 +184,15 @@ private:
                        bool ddl[22]
                ) const;
        
+       bool IsTrackOk(
+                       const AliHLTComponentBlockData& block,
+                       AliHLTUInt32_t blockNumber,
+                       const char* name,
+                       AliHLTUInt32_t entryNumber,
+                       const AliHLTMUONTrackStruct& track,
+                       bool ddl[22]
+               ) const;
+       
        bool CheckDetElemIds(
                        const AliHLTComponentBlockData& infoBlock,
                        AliHLTUInt32_t infoBlockNumber,
@@ -245,6 +255,11 @@ private:
                        AliHLTUInt32_t blockNumber
                ) const;
        
+       bool CheckTracksBlock(
+                       const AliHLTComponentBlockData& block,
+                       AliHLTUInt32_t blockNumber
+               ) const;
+       
        bool CheckSinglesDecisionBlock(
                        const AliHLTComponentBlockData& block,
                        AliHLTUInt32_t blockNumber
@@ -289,6 +304,15 @@ private:
                        AliHLTUInt32_t totalTrackCount
                ) const;
        
+       bool IsScalarTooLargePairs(
+                       const AliHLTComponentBlockData* block,
+                       AliHLTUInt32_t blockNumber,
+                       const char* blockTypeName,
+                       const char* scalarName,
+                       AliHLTUInt32_t scalarValue,
+                       AliHLTUInt32_t trackPairsCount
+               ) const;
+       
        bool IsScalarALargerThanB(
                        const AliHLTComponentBlockData* block,
                        AliHLTUInt32_t blockNumber,
@@ -324,6 +348,8 @@ private:
                        AliHLTUInt32_t mansoTrackBlocksCount,
                        const AliHLTComponentBlockData** mansoCandidateBlocks,
                        AliHLTUInt32_t mansoCandidateBlocksCount,
+                       const AliHLTComponentBlockData** trackBlocks,
+                       AliHLTUInt32_t trackBlocksCount,
                        const AliHLTComponentBlockData** singleDecisionBlocks,
                        AliHLTUInt32_t singleDecisionBlocksCount,
                        const AliHLTComponentBlockData** pairDecisionBlocks,
index c6c24d52f33cf69cac458156581b5ba5abe195fc..97442c47f323b5dfcf36f1710ff5602458fe9f52 100644 (file)
@@ -1049,6 +1049,8 @@ int DumpRawDataHeader(
                bool continueParse
        )
 {
+       // Dumps the common DDL raw data block header.
+       
        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);
@@ -1170,6 +1172,8 @@ int DumpTrackerDDLRawStream(
                bool continueParse
        )
 {
+       // Dumps a tracker DDL raw stream data.
+       
        const AliRawDataHeader* header =
                reinterpret_cast<const AliRawDataHeader*>(buffer);
        int result = DumpRawDataHeader(buffer, bufferSize, header, continueParse);
@@ -1200,6 +1204,8 @@ int DumpTriggerDDLRawStream(
                bool continueParse
        )
 {
+       // Dumps a trigger DDL raw stream data.
+       
        const AliRawDataHeader* header =
                reinterpret_cast<const AliRawDataHeader*>(buffer);
        int result = DumpRawDataHeader(buffer, bufferSize, header, continueParse);
@@ -1271,6 +1277,8 @@ int DumpRecHitsBlock(
                bool continueParse
        )
 {
+       // Dumps a reconstructed hits data block.
+       
        int result = EXIT_SUCCESS;
        AliHLTMUONRecHitsBlockReader block(buffer, bufferSize);
        
@@ -1359,6 +1367,8 @@ int DumpTriggerRecordsBlock(
                bool continueParse
        )
 {
+       // Dumps a trigger records data block.
+       
        AliHLTMUONTriggerRecordsBlockReader block(buffer, bufferSize);
        
        int result = CheckCommonHeader(block, buffer, bufferSize, continueParse);
@@ -1504,6 +1514,8 @@ int DumpTrigRecsDebugBlock(
                bool continueParse
        )
 {
+       // Dumps the debugging information for trigger records.
+       
        AliHLTMUONTrigRecsDebugBlockReader block(buffer, bufferSize);
        
        int result = CheckCommonHeader(block, buffer, bufferSize, continueParse);
@@ -1573,6 +1585,8 @@ int DumpClustersBlock(
                bool continueParse
        )
 {
+       // Dumps a clusters block structure.
+       
         int result = EXIT_SUCCESS;
        AliHLTMUONClustersBlockReader block(buffer, bufferSize);
        
@@ -1638,6 +1652,8 @@ int DumpChannelsBlock(
                bool continueParse
        )
 {
+       // Dumps a channels block structure.
+       
         int result = EXIT_SUCCESS;
        AliHLTMUONChannelsBlockReader block(buffer, bufferSize);
        
@@ -1732,6 +1748,8 @@ int DumpMansoTracksBlock(
                bool continueParse
        )
 {
+       // Dumps the Manso tracks block structure.
+       
        int result = EXIT_SUCCESS;
        AliHLTMUONMansoTracksBlockReader block(buffer, bufferSize);
        
@@ -1790,6 +1808,8 @@ int DumpMansoCandidateStruct(
                bool continueParse
        )
 {
+       // Dumps the manso candidate structure.
+       
        int result = DumpMansoTrackStruct(buffer, bufferSize, &candidate->fTrack, continueParse);
        if (result != EXIT_SUCCESS) return result;
        
@@ -1824,6 +1844,8 @@ int DumpMansoCandidatesBlock(
                bool continueParse
        )
 {
+       // Dumps the manso candidates block structure.
+       
        int result = EXIT_SUCCESS;
        AliHLTMUONMansoCandidatesBlockReader block(buffer, bufferSize);
        
@@ -1846,6 +1868,127 @@ int DumpMansoCandidatesBlock(
 }
 
 
+int DumpTrackStruct(
+               const char* buffer, unsigned long bufferSize,
+               const AliHLTMUONTrackStruct* track,
+               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(track->fId, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "Track ID: " << track->fId << "\t";
+
+       result = CheckField(track->fTrigRec, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "Trigger Record ID: " << track->fTrigRec << endl;
+       
+       result = CheckField(track->fFlags, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "Flags: " << showbase << hex << track->fFlags << dec;
+       
+       // Print the individual trigger bits.
+       AliHLTMUONParticleSign sign;
+       bool hitset[16];
+       AliHLTMUONUtils::UnpackTrackFlags(track->fFlags, sign, hitset);
+       cout << " [Sign: " << sign << ", Hits set: ";
+       bool first = true;
+       for (AliHLTUInt32_t i = 0; i < 16; i++)
+       {
+               if (hitset[i])
+               {
+                       cout << (first ? "" : ", ") << i;
+                       first = false;
+               }
+       }
+       cout << (first ? "none]" : "]") << endl;
+
+       result = CheckField(track->fPx, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "Momentum: (px = " << track->fPx << ", ";
+
+       result = CheckField(track->fPy, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "py = " << track->fPy << ", ";
+
+       result = CheckField(track->fPz, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "pz = " << track->fPz << ") GeV/c" << endl;
+       
+       result = CheckField(track->fInverseBendingMomentum, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "Inverse bending momentum: " << track->fInverseBendingMomentum << " c/GeV" << endl;
+       
+       result = CheckField(track->fThetaX, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "Slope: (non-bending plane = " << track->fThetaX << ", ";
+       
+       result = CheckField(track->fThetaY, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "bending plane = " << track->fThetaY << ")" << endl;
+
+       result = CheckField(track->fX, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "DCA vertex: (x = " << track->fX << ", ";
+
+       result = CheckField(track->fY, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "y = " << track->fY << ", ";
+
+       result = CheckField(track->fZ, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "z = " << track->fZ << ") cm" << endl;
+
+       result = CheckField(track->fChi2, buffer, bufferSize, continueParse);
+       if (result != EXIT_SUCCESS) return result;
+       cout << "Chi squared fit: " << track->fChi2 << endl;
+       
+       cout << "Track hits:" << 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 < 16; ch++)
+       {
+               result = DumpRecHitStruct(buffer, bufferSize, hit++, continueParse);
+               if (result != EXIT_SUCCESS) return result;
+       }
+
+       return result;
+}
+
+
+int DumpTracksBlock(
+               const char* buffer, unsigned long bufferSize,
+               bool continueParse
+       )
+{
+       // Dumps the full tracks block structure.
+       
+       int result = EXIT_SUCCESS;
+       AliHLTMUONTracksBlockReader 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.
+       const AliHLTMUONTrackStruct* entry = block.GetArray();
+       for(AliHLTUInt32_t i = 0; i < nentries; i++)
+       {
+               cout << "================================ track number " << i+1
+                       << " of " << nentries << " ================================" << endl;
+               int subResult = DumpTrackStruct(buffer, bufferSize, entry++, continueParse);
+               if (subResult != EXIT_SUCCESS) return subResult;
+       }
+       
+       return result;
+}
+
+
 int DumpSinglesDecisionBlockHeader(
                const char* buffer, unsigned long bufferSize,
                const AliHLTMUONSinglesDecisionBlockStruct* header,
@@ -2325,6 +2468,10 @@ int ParseBuffer(
                subResult = DumpMansoCandidatesBlock(buffer, bufferSize, continueParse);
                if (subResult != EXIT_SUCCESS) result = subResult;
                break;
+       case kTracksDataBlock:
+               subResult = DumpTracksBlock(buffer, bufferSize, continueParse);
+               if (subResult != EXIT_SUCCESS) result = subResult;
+               break;
        case kSinglesDecisionDataBlock:
                subResult = DumpSinglesDecisionBlock(buffer, bufferSize, continueParse);
                if (subResult != EXIT_SUCCESS) result = subResult;
@@ -2606,6 +2753,7 @@ void PrintUsage(bool asError = true)
        os << "         clusters - cluster debugging information from hit reconstruction." << endl;
        os << "         mansotracks - partial tracks from Manso algorithm." << endl;
        os << "         mansocandidates - track candidates considered in the Manso algorithm." << endl;
+       os << "         tracks - tracks from full tracker component." << endl;
        os << "         singlesdecision - trigger decisions for single tracks." << endl;
        os << "         pairsdecision - trigger decisions for track pairs." << endl;
        os << "         autodetect - the type of the data block will be automatically" << endl;
index 9e23d6c499631e29ea3d7edd746a39dd59b94aee..6e6161784bdea08f2c5d6b2ab7676496d7213015 100644 (file)
@@ -224,6 +224,7 @@ int DecodeFileType(const char* filename, AliHLTMUONDataBlockType& type)
        case kChannelsDataBlock:
        case kMansoTracksDataBlock:
        case kMansoCandidatesDataBlock:
+       case kTracksDataBlock:
        case kSinglesDecisionDataBlock:
        case kPairsDecisionDataBlock:
                break;
@@ -261,6 +262,7 @@ void PrintUsage(bool asError = true)
        os << "         clusters - cluster debugging information from hit reconstruction." << endl;
        os << "         mansotracks - partial tracks from Manso algorithm." << endl;
        os << "         mansocandidates - track candidates considered in the Manso algorithm." << endl;
+       os << "         tracks - tracks from full tracker components." << endl;
        os << "         singlesdecision - trigger decisions for single tracks." << endl;
        os << "         pairsdecision - trigger decisions for track pairs." << endl;
        os << "         autodetect - the type of the data block will be automatically" << endl;
index 0eea8270a026f09e5307a1115f23ad5339c580ac..f6232f9b5bed063a8f41530c01cae459b04274a4 100644 (file)
@@ -37,6 +37,7 @@ MODULE_SRCS :=        $(CLASS_HDRS:.h=.cxx) \
                AliHLTMUONChannelsBlockStruct.cxx \
                AliHLTMUONMansoTracksBlockStruct.cxx \
                AliHLTMUONMansoCandidatesBlockStruct.cxx \
+               AliHLTMUONTracksBlockStruct.cxx \
                AliHLTMUONSinglesDecisionBlockStruct.cxx \
                AliHLTMUONPairsDecisionBlockStruct.cxx \
                OnlineAnalysis/AliHLTMUONCalculations.cxx \