]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONVCalibParam.h
Coverity fix
[u/mrichter/AliRoot.git] / MUON / AliMUONVCalibParam.h
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice                               */
3
4 // $Id$
5
6 /// \ingroup calib
7 /// \class AliMUONVCalibParam
8 /// \brief Container of calibration values for a given number of channels.
9 /// 
10 //  Author Laurent Aphecetche
11
12 #ifndef ALIMUONVCALIBPARAM_H
13 #define ALIMUONVCALIBPARAM_H
14
15 #ifndef ROOT_TObject
16 #  include "TObject.h"
17 #endif
18
19 class AliMUONVCalibParam : public TObject
20 {
21 public:
22   AliMUONVCalibParam();
23   //AliMUONVCalibParam(Int_t id0);
24   AliMUONVCalibParam(Int_t id0, Int_t id1);
25   virtual ~AliMUONVCalibParam();
26
27   virtual const char* GetName() const;
28
29   /// Advertise that we can be sorted in TCollections
30   virtual Bool_t IsSortable() const { return kTRUE; }
31   
32   /// First id of this object
33   virtual Int_t ID0() const;
34   
35   /// Second id of this object (might not be required)
36   virtual Int_t ID1() const;
37
38   /// method for sorting pedestal values ordered by ID0 and ID1
39   virtual Int_t Compare(const TObject* object) const;
40   
41   /// whether or not the value we store are packed, e.g. as v = a*cste + b
42   virtual Bool_t IsPacked() const { return kFALSE; }
43   
44   /// j indices in following methods are valid from 0 to Dimension()-1.
45   virtual Int_t Dimension() const = 0;
46
47   /** Set one value, for channel i, dimension j. Consider value is a double.
48     Only ok to use if IsDoublePrecision() is kTRUE.
49     */
50   virtual void SetValueAsDouble(Int_t i, Int_t j, Double_t value);
51
52   /// Same as above but w/o bound checking
53   virtual void SetValueAsDoubleFast(Int_t i, Int_t j, Double_t value);
54
55   /// Set one value, for channel i, dimension j. Consider value is a float.
56   virtual void SetValueAsFloat(Int_t i, Int_t j, Float_t value) = 0;
57
58   /** Set one value, for channel i, dimension j. Consider value is a float.
59     Assume (i,j) are valid indices, i.e. do not check them.
60     */
61   virtual void SetValueAsFloatFast(Int_t i, Int_t j, Float_t value) = 0;
62
63   /// Set one value, for channel i, dimension j. Consider value is an integer.
64   virtual void SetValueAsInt(Int_t i, Int_t j, Int_t value) = 0;
65
66   /// Same as above but w/o bound checkings.
67   virtual void SetValueAsIntFast(Int_t i, Int_t j, Int_t value) = 0;
68
69   /// The number of channels handled by this object.
70   virtual Int_t Size() const = 0;
71
72   /// Whether we can store double precision values   
73   virtual Bool_t IsDoublePrecision() const { return kFALSE; }
74   
75   /** Retrieve the value for a given (channel,dim) as a double.
76       Only ok if IsDoublePrecision() is kTRUE.
77       (i,j) are checked to within boundaries
78     */
79   virtual Double_t ValueAsDouble(Int_t i, Int_t j=0) const;
80
81   /** Retrieve the value for a given (channel,dim) as a double.
82     Only ok if IsDoublePrecision() is kTRUE.
83     Fast means there's no bound checking on (i,j)
84     */
85   virtual Double_t ValueAsDoubleFast(Int_t i, Int_t j=0) const;
86   
87   /** Retrieve the value for a given (channel,dim) as a float, with
88       bound checking on (i,j).
89     */
90   virtual Float_t ValueAsFloat(Int_t i, Int_t j=0) const = 0;
91
92   /// Same as above but without bound checking.
93   virtual Float_t ValueAsFloatFast(Int_t i, Int_t j=0) const = 0;
94
95   /** Retrieve the value for a given (channel,dim) as an integer.
96       With bound checking.
97     */
98   virtual Int_t ValueAsInt(Int_t i, Int_t j=0) const = 0;
99
100   /// Same as above but w/o bound checking.
101   virtual Int_t ValueAsIntFast(Int_t i, Int_t j=0) const = 0;
102
103   /// Unpack a value into a couple (a,b). Returns false if IsPacked()==kFALSE
104   virtual Bool_t UnpackValue(Int_t /*value*/, Int_t& /*a*/, Int_t& /*b*/) const { return kFALSE; }
105   
106   /// Pack (a,b) as a single int. Returns false if IsPacked()==kFALSE
107   virtual Bool_t PackValues(Int_t /*a*/, Int_t /*b*/, Int_t& /*packedValue*/) const { return kFALSE; }
108   
109   /// Return 1E38 as invalid float value
110   static Float_t InvalidFloatValue() { return 1E38; }
111
112   static UInt_t BuildUniqueID(Int_t id0, Int_t id1);
113   static void DecodeUniqueID(UInt_t uniqueID, Int_t& id0, Int_t& id1);
114
115 protected:
116   
117   static Int_t ID0(UInt_t uniqueID);
118   static Int_t ID1(UInt_t uniqueID);
119   
120   ClassDef(AliMUONVCalibParam,0) // Base class for a calibration data holder (usually for 64 channels)
121 };
122
123 #endif