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

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : // $Id$
      17             : 
      18             : /**
      19             :  * @file   AliHLTMUONPairsDecisionBlockStruct.cxx
      20             :  * @author Artur Szostak <artursz@iafrica.com>
      21             :  * @date   21 May 2007
      22             :  * @brief  Implementation of useful stream and comparison operators.
      23             :  */
      24             : 
      25             : #include "AliHLTMUONPairsDecisionBlockStruct.h"
      26             : #include "AliHLTMUONUtils.h"
      27             : #include <cassert>
      28             : 
      29             : 
      30             : std::ostream& operator << (
      31             :                 std::ostream& stream,
      32             :                 const AliHLTMUONPairsDecisionBlockStruct& block
      33             :         )
      34             : {
      35           0 :         assert( AliHLTMUONUtils::IntegrityOk(block) );
      36             :         
      37             :         const AliHLTMUONPairDecisionStruct* decision =
      38           0 :                 reinterpret_cast<const AliHLTMUONPairDecisionStruct*>(&block + 1);
      39             : 
      40           0 :         stream  << "{fHeader = " << block.fHeader
      41           0 :                 << ", fNunlikeAnyPt = " << block.fNunlikeAnyPt
      42           0 :                 << ", fNunlikeLowPt = " << block.fNunlikeLowPt
      43           0 :                 << ", fNunlikeHighPt = " << block.fNunlikeHighPt
      44           0 :                 << ", fNlikeAnyPt = " << block.fNlikeAnyPt
      45           0 :                 << ", fNlikeLowPt = " << block.fNlikeLowPt
      46           0 :                 << ", fNlikeHighPt = " << block.fNlikeHighPt
      47           0 :                 << ", fNmassAny = " << block.fNmassAny
      48           0 :                 << ", fNmassLow = " << block.fNmassLow
      49           0 :                 << ", fNmassHigh = " << block.fNmassHigh
      50           0 :                 << ", fDecision[] = [";
      51           0 :         if (block.fHeader.fNrecords > 0) stream << decision[0];
      52           0 :         for (AliHLTUInt32_t i = 1; i < block.fHeader.fNrecords; i++)
      53           0 :                 stream << ", " << decision[i];
      54           0 :         stream << "]}";
      55           0 :         return stream;
      56             : }
      57             : 
      58             : 
      59             : bool operator == (
      60             :                 const AliHLTMUONPairsDecisionBlockStruct& a,
      61             :                 const AliHLTMUONPairsDecisionBlockStruct& b
      62             :         )
      63             : {
      64           0 :         assert( AliHLTMUONUtils::IntegrityOk(a) );
      65           0 :         assert( AliHLTMUONUtils::IntegrityOk(b) );
      66             :         
      67             :         const AliHLTMUONPairDecisionStruct* decisionA =
      68           0 :                 reinterpret_cast<const AliHLTMUONPairDecisionStruct*>(&a + 1);
      69             :         const AliHLTMUONPairDecisionStruct* decisionB =
      70           0 :                 reinterpret_cast<const AliHLTMUONPairDecisionStruct*>(&b + 1);
      71             : 
      72             :         // First check if the blocks have the same header. If they do then
      73             :         // check if every track pair's decision is the same. In either case if
      74             :         // we find a difference return false.
      75           0 :         if (a.fHeader != b.fHeader) return false;
      76           0 :         if (a.fNunlikeAnyPt != b.fNunlikeAnyPt) return false;
      77           0 :         if (a.fNunlikeLowPt != b.fNunlikeLowPt) return false;
      78           0 :         if (a.fNunlikeHighPt != b.fNunlikeHighPt) return false;
      79           0 :         if (a.fNlikeAnyPt != b.fNlikeAnyPt) return false;
      80           0 :         if (a.fNlikeLowPt != b.fNlikeLowPt) return false;
      81           0 :         if (a.fNlikeHighPt != b.fNlikeHighPt) return false;
      82           0 :         if (a.fNmassAny != b.fNmassAny) return false;
      83           0 :         if (a.fNmassLow != b.fNmassLow) return false;
      84           0 :         if (a.fNmassHigh != b.fNmassHigh) return false;
      85           0 :         for (AliHLTUInt32_t i = 0; i < a.fHeader.fNrecords; i++)
      86           0 :                 if (decisionA[i] != decisionB[i]) return false;
      87           0 :         return true;
      88           0 : }

Generated by: LCOV version 1.11