]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
helper methods to get single slice and partition from block specification
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 23 Jan 2012 09:13:24 +0000 (09:13 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 23 Jan 2012 09:13:24 +0000 (09:13 +0000)
HLT/TPCLib/AliHLTTPCDefinitions.cxx
HLT/TPCLib/AliHLTTPCDefinitions.h

index e176c85b38f2d5a945487c9fb11374039f45656d..c698835dd62ef9bf7b84926f453227166acb3051 100644 (file)
@@ -24,7 +24,8 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "AliHLTTPCDefinitions.h"
-
+#include "AliHLTTPCTransform.h"
+#include <cerrno>
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTPCDefinitions)
@@ -204,3 +205,26 @@ bool AliHLTTPCDefinitions::DDLIdToSlicePatch(AliHLTInt32_t ddlid, AliHLTUInt8_t&
        return true;
 }
     
+Int_t AliHLTTPCDefinitions::GetSingleSliceNr( ULong_t spec )
+{
+  // get the slice number provided that spec encodes a single slice
+  // return -EINVAL if encoded min and max slice differ
+  // return -ERANGE if slice number out of range
+  AliHLTUInt8_t min=GetMinSliceNr(spec);
+  AliHLTUInt8_t max=GetMaxSliceNr(spec);
+  if (min!=max) return -EINVAL;
+  if (max>=AliHLTTPCTransform::GetNSlice()) return -ERANGE;
+  return min;
+}
+
+Int_t AliHLTTPCDefinitions::GetSinglePatchNr( ULong_t spec )
+{
+  // get the patch number provided that spec encodes a single patch
+  // return -EINVAL if encoded min and max patch differ
+  // return -ERANGE if patch number out of range
+  AliHLTUInt8_t min=GetMinPatchNr(spec);
+  AliHLTUInt8_t max=GetMaxPatchNr(spec);
+  if (min!=max) return -EINVAL;
+  if (max>=AliHLTTPCTransform::GetNumberOfPatches()) return -ERANGE;
+  return min;
+}
index 27bf8c327e798131cacdd6057cfd76233ded3404..983b9513022f48cc80a4d1cbcc26093e95cb66dc 100644 (file)
@@ -36,6 +36,11 @@ public:
                {
                return (AliHLTUInt8_t)( (spec & 0xFF000000) >> 24 );
                }
+       static Int_t GetSingleSliceNr( const AliHLTComponentBlockData& block )
+               {
+               return GetSingleSliceNr(block.fSpecification);
+               }
+       static Int_t GetSingleSliceNr( ULong_t spec );
        static AliHLTUInt8_t GetMinPatchNr( const AliHLTComponentBlockData& block )
                {
                return (AliHLTUInt8_t)( (block.fSpecification & 0x000000FF) );
@@ -52,7 +57,11 @@ public:
                {
                return (AliHLTUInt8_t)( (spec & 0x0000FF00) >> 8 );
                }
-       
+       static Int_t GetSinglePatchNr( const AliHLTComponentBlockData& block )
+               {
+               return GetSinglePatchNr(block.fSpecification);
+               }
+       static Int_t GetSinglePatchNr( ULong_t spec );
        static AliHLTUInt32_t EncodeDataSpecification( AliHLTUInt8_t minSliceNr, 
                                                AliHLTUInt8_t maxSliceNr,
                                                AliHLTUInt8_t minPatchNr,