LCOV - code coverage report
Current view: top level - HLT/MUON - AliHLTMUONTracksBlockStruct.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 45 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 4 0.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * This file is property of and copyright by the ALICE HLT Project        *
       3             :  * All rights reserved.                                                   *
       4             :  *                                                                        *
       5             :  * Primary Authors:                                                       *
       6             :  *   Artur Szostak <artursz@iafrica.com>                                  *
       7             :  *                                                                        *
       8             :  * Permission to use, copy, modify and distribute this software and its   *
       9             :  * documentation strictly for non-commercial purposes is hereby granted   *
      10             :  * without fee, provided that the above copyright notice appears in all   *
      11             :  * copies and that both the copyright notice and this permission notice   *
      12             :  * appear in the supporting documentation. The authors make no claims     *
      13             :  * about the suitability of this software for any purpose. It is          *
      14             :  * provided "as is" without express or implied warranty.                  *
      15             :  **************************************************************************/
      16             : 
      17             : // $Id: AliHLTMUONTracksBlockStruct.cxx 36627 2009-11-10 19:21:49Z aszostak $
      18             : 
      19             : ///
      20             : /// @file   AliHLTMUONTracksBlockStruct.cxx
      21             : /// @author Artur Szostak <artursz@iafrica.com>
      22             : /// @date   10 Feb 2010
      23             : /// @brief  Implementation of useful stream and comparison operators.
      24             : ///
      25             : /// The tracks data block is an internal dimuon HLT data block structure
      26             : /// generated by the tracker components.
      27             : ///
      28             : 
      29             : #include "AliHLTMUONTracksBlockStruct.h"
      30             : #include "AliHLTMUONUtils.h"
      31             : #include <cassert>
      32             : 
      33             : 
      34             : std::ostream& operator << (
      35             :                 std::ostream& stream, const AliHLTMUONTrackStruct& track
      36             :         )
      37             : {
      38           0 :         std::ios::fmtflags oldflags = stream.flags();
      39           0 :         stream  << "{fId = " << track.fFlags
      40           0 :                 << ", fTrigRec = " << track.fTrigRec
      41           0 :                 << ", fFlags = " << std::showbase << std::hex
      42           0 :                 << track.fFlags << std::dec
      43           0 :                 << ", fPx = " << track.fPx
      44           0 :                 << ", fPy = " << track.fPy
      45           0 :                 << ", fPz = " << track.fPz
      46           0 :                 << ", fInverseBendingMomentum = " << track.fInverseBendingMomentum
      47           0 :                 << ", fThetaX = " << track.fThetaX
      48           0 :                 << ", fThetaX = " << track.fThetaY
      49           0 :                 << ", fX = " << track.fX
      50           0 :                 << ", fY = " << track.fY
      51           0 :                 << ", fZ = " << track.fZ
      52           0 :                 << ", fChi2 = " << track.fChi2;
      53           0 :         for (AliHLTUInt32_t i = 0; i < 16; i++)
      54             :         {
      55           0 :                 stream << ", fHit[" << i << "] = " << track.fHit[0];
      56             :         }
      57           0 :         stream << "}";
      58           0 :         stream.flags(oldflags);
      59           0 :         return stream;
      60             : }
      61             : 
      62             : 
      63             : std::ostream& operator << (
      64             :                 std::ostream& stream,
      65             :                 const AliHLTMUONTracksBlockStruct& block
      66             :         )
      67             : {
      68           0 :         assert( AliHLTMUONUtils::IntegrityOk(block) );
      69             : 
      70             :         const AliHLTMUONTrackStruct* track =
      71           0 :                 reinterpret_cast<const AliHLTMUONTrackStruct*>(&block + 1);
      72           0 :         stream  << "{fHeader = " << block.fHeader << ", fTrack[] = [";
      73           0 :         if (block.fHeader.fNrecords > 0) stream << track[0];
      74           0 :         for (AliHLTUInt32_t i = 1; i < block.fHeader.fNrecords; i++)
      75           0 :                 stream << ", " << track[i];
      76           0 :         stream << "]}";
      77           0 :         return stream;
      78             : }
      79             : 
      80             : 
      81             : bool operator == (
      82             :                 const AliHLTMUONTrackStruct& a,
      83             :                 const AliHLTMUONTrackStruct& b
      84             :         )
      85             : {
      86           0 :         bool result = a.fId == b.fId and a.fTrigRec == b.fTrigRec
      87           0 :                 and a.fFlags == b.fFlags and a.fPx == b.fPx and a.fPy == b.fPy
      88           0 :                 and a.fPz == b.fPz and a.fInverseBendingMomentum == b.fInverseBendingMomentum
      89           0 :                 and a.fThetaX == b.fThetaX and a.fThetaY == b.fThetaY
      90           0 :                 and a.fX == b.fX and a.fY == b.fY and a.fZ == b.fZ and a.fChi2 == b.fChi2;
      91           0 :         for (AliHLTUInt32_t i = 0; i < 16; i++)
      92             :         {
      93           0 :                 result &= (a.fHit[i] == b.fHit[i]);
      94             :         }
      95           0 :         return result;
      96             : }
      97             : 
      98             : 
      99             : bool operator == (
     100             :                 const AliHLTMUONTracksBlockStruct& a,
     101             :                 const AliHLTMUONTracksBlockStruct& b
     102             :         )
     103             : {
     104           0 :         assert( AliHLTMUONUtils::IntegrityOk(a) );
     105           0 :         assert( AliHLTMUONUtils::IntegrityOk(b) );
     106             : 
     107             :         const AliHLTMUONTrackStruct* trackA =
     108           0 :                 reinterpret_cast<const AliHLTMUONTrackStruct*>(&a + 1);
     109             :         const AliHLTMUONTrackStruct* trackB =
     110           0 :                 reinterpret_cast<const AliHLTMUONTrackStruct*>(&b + 1);
     111             :         
     112             :         // First check if the blocks have the same header. If they do then check
     113             :         // if every track is the same. In either case if we find a difference
     114             :         // return false.
     115           0 :         if (a.fHeader != b.fHeader) return false;
     116           0 :         for (AliHLTUInt32_t i = 0; i < a.fHeader.fNrecords; i++)
     117           0 :                 if (trackA[i] != trackB[i]) return false;
     118           0 :         return true;
     119           0 : }

Generated by: LCOV version 1.11