LCOV - code coverage report
Current view: top level - MUON/MUONcalib - AliMUONVCalibParam.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 14 34 41.2 %
Date: 2016-06-14 17:26:59 Functions: 9 18 50.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             : * Copyright(c) 1998-1999, 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             : #include "AliMUONVCalibParam.h"
      19             : 
      20             : #include "AliLog.h"
      21             : 
      22             : //-----------------------------------------------------------------------------
      23             : /// \class AliMUONVCalibParam
      24             : ///  
      25             : /// Defines an interface for a calibration container object.
      26             : ///
      27             : /// Note that a VCalibParam object is identified by a pair (id0,id1), 
      28             : /// where each member of the pair is a 16 bits word, so that id0 and id1
      29             : /// can be packed into a single 32 bits word.
      30             : ///
      31             : /// id1 might be left to zero if not required (e.g. for calibparam which 
      32             : /// can be identified by a single integer)
      33             : ///
      34             : /// Note that the ValueAsXXX methods have 2 versions : with or without bound
      35             : /// checking. The latter is to be used in e.g. loops, where you know for
      36             : /// sure the indices are ok, in order to gain some time.
      37             : ///
      38             : /// \author Laurent Aphecetche, Subatech
      39             : //-----------------------------------------------------------------------------
      40             : 
      41             : /// \cond CLASSIMP
      42          18 : ClassImp(AliMUONVCalibParam)
      43             : /// \endcond
      44             : 
      45             : //_____________________________________________________________________________
      46      219420 : AliMUONVCalibParam::AliMUONVCalibParam() : TObject()
      47      658260 : {
      48             :   ///  Default constructor
      49      219420 : }
      50             : 
      51             : //_____________________________________________________________________________
      52      154304 : AliMUONVCalibParam::AliMUONVCalibParam(Int_t id0, Int_t id1) : TObject()
      53      462912 : {
      54             :   ///  constructor for 2D
      55      154304 :   SetUniqueID(BuildUniqueID(id0,id1));
      56      154304 : }
      57             : 
      58             : //_____________________________________________________________________________
      59             : AliMUONVCalibParam::~AliMUONVCalibParam()
      60           0 : {
      61             : /// Destructor.
      62      308608 : }
      63             : 
      64             : //_____________________________________________________________________________
      65             : UInt_t
      66             : AliMUONVCalibParam::BuildUniqueID(Int_t id0, Int_t id1)
      67             : {
      68             :   /// Build a single index from the pair (id0,id1)
      69    13076704 :   return ( id0 | ( id1 << 16 ) );
      70             : }
      71             : 
      72             : //_____________________________________________________________________________
      73             : void
      74             : AliMUONVCalibParam::DecodeUniqueID(UInt_t uniqueID, Int_t& id0, Int_t& id1)
      75             : {
      76             :   /// Convert single integer into a pair (i,j)
      77           0 :   id0 = ID0(uniqueID);
      78           0 :   id1 = ID1(uniqueID);
      79           0 : }
      80             : 
      81             : //_____________________________________________________________________________
      82             : Int_t
      83             : AliMUONVCalibParam::ID0(UInt_t uniqueID)
      84             : {
      85             :   /// Extract id0 from uniqueID
      86      134624 :   return uniqueID & 0xFFFF;
      87             : }
      88             : 
      89             : //_____________________________________________________________________________
      90             : Int_t
      91             : AliMUONVCalibParam::ID0() const
      92             : {
      93             :   /// Extract first identifier
      94      134624 :   return ID0(GetUniqueID());
      95             : }
      96             : 
      97             : //_____________________________________________________________________________
      98             : Int_t
      99             : AliMUONVCalibParam::ID1(UInt_t uniqueID)
     100             : {
     101             :   /// Extract id1 from uniqueID
     102      269248 :   return ( uniqueID & 0xFFFF0000 ) >> 16;
     103             : }
     104             : 
     105             : //_____________________________________________________________________________
     106             : Int_t
     107             : AliMUONVCalibParam::ID1() const
     108             : {
     109             :   /// Extract second identifier
     110      269248 :   return ID1(GetUniqueID());
     111             : }
     112             : 
     113             : //_____________________________________________________________________________
     114             : const char* 
     115             : AliMUONVCalibParam::GetName() const
     116             : {
     117             :   /// Build a name for this object
     118           0 :   return Form("I=%d,J=%d",ID0(),ID1());
     119             : }
     120             : 
     121             : //_____________________________________________________________________________
     122             : void 
     123             : AliMUONVCalibParam::SetValueAsDouble(Int_t, Int_t, Double_t)
     124             : {
     125             :   /// By default, this one does not exist
     126           0 :   AliFatal("Not implemented");
     127           0 : }
     128             : 
     129             : //_____________________________________________________________________________
     130             : void 
     131             : AliMUONVCalibParam::SetValueAsDoubleFast(Int_t, Int_t, Double_t)
     132             : {
     133             :   /// By default, this one does not exist
     134           0 :   AliFatal("Not implemented");
     135           0 : }
     136             : 
     137             : //_____________________________________________________________________________
     138             : Double_t 
     139             : AliMUONVCalibParam::ValueAsDouble(Int_t , Int_t ) const
     140             : {
     141             :   /// By default, this one does not exist
     142           0 :   AliFatal("Not implemented");
     143           0 :   return 0;
     144             : }
     145             : 
     146             : //_____________________________________________________________________________
     147             : Double_t 
     148             : AliMUONVCalibParam::ValueAsDoubleFast(Int_t , Int_t ) const
     149             : {
     150             :   /// By default, this one does not exist
     151           0 :   AliFatal("Not implemented");
     152           0 :   return 0;
     153             : }
     154             : 
     155             : //_____________________________________________________________________________
     156             : Int_t 
     157             : AliMUONVCalibParam::Compare(const TObject* object) const
     158             : {
     159             :   /// Compare AliMUONVCalibParam objects, trying to get as complete an order as possible.
     160             :   /// We sort by ID0, then by ID1
     161             :   ///
     162           0 :   const AliMUONVCalibParam* param = static_cast<const AliMUONVCalibParam*>(object);
     163             :   
     164           0 :   if ( ID0() == param->ID0() )
     165             :   {
     166           0 :     if ( ID1() == param->ID1() )
     167             :     {
     168           0 :       return 0;
     169             :     }
     170             :     else
     171           0 :       return (ID1() >= param->ID1()) ? 1 : -1;
     172             :   }
     173             :   else
     174           0 :     return ( ID0() >= param->ID0()) ? 1 : -1;
     175           0 : }
     176             : 
     177             : 

Generated by: LCOV version 1.11