1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
7 /// \class AliMUONVCalibParam
8 /// \brief Container of calibration values for a given number of channels.
10 // Author Laurent Aphecetche
12 #ifndef ALIMUONVCALIBPARAM_H
13 #define ALIMUONVCALIBPARAM_H
19 class AliMUONVCalibParam : public TObject
23 //AliMUONVCalibParam(Int_t id0);
24 AliMUONVCalibParam(Int_t id0, Int_t id1);
25 virtual ~AliMUONVCalibParam();
27 virtual const char* GetName() const;
29 /// Advertise that we can be sorted in TCollections
30 virtual Bool_t IsSortable() const { return kTRUE; }
32 /// First id of this object
33 virtual Int_t ID0() const;
35 /// Second id of this object (might not be required)
36 virtual Int_t ID1() const;
38 /// method for sorting pedestal values ordered by ID0 and ID1
39 virtual Int_t Compare(const TObject* object) const;
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; }
44 /// j indices in following methods are valid from 0 to Dimension()-1.
45 virtual Int_t Dimension() const = 0;
47 /** Set one value, for channel i, dimension j. Consider value is a double.
48 Only ok to use if IsDoublePrecision() is kTRUE.
50 virtual void SetValueAsDouble(Int_t i, Int_t j, Double_t value);
52 /// Same as above but w/o bound checking
53 virtual void SetValueAsDoubleFast(Int_t i, Int_t j, Double_t value);
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;
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.
61 virtual void SetValueAsFloatFast(Int_t i, Int_t j, Float_t value) = 0;
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;
66 /// Same as above but w/o bound checkings.
67 virtual void SetValueAsIntFast(Int_t i, Int_t j, Int_t value) = 0;
69 /// The number of channels handled by this object.
70 virtual Int_t Size() const = 0;
72 /// Whether we can store double precision values
73 virtual Bool_t IsDoublePrecision() const { return kFALSE; }
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
79 virtual Double_t ValueAsDouble(Int_t i, Int_t j=0) const;
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)
85 virtual Double_t ValueAsDoubleFast(Int_t i, Int_t j=0) const;
87 /** Retrieve the value for a given (channel,dim) as a float, with
88 bound checking on (i,j).
90 virtual Float_t ValueAsFloat(Int_t i, Int_t j=0) const = 0;
92 /// Same as above but without bound checking.
93 virtual Float_t ValueAsFloatFast(Int_t i, Int_t j=0) const = 0;
95 /** Retrieve the value for a given (channel,dim) as an integer.
98 virtual Int_t ValueAsInt(Int_t i, Int_t j=0) const = 0;
100 /// Same as above but w/o bound checking.
101 virtual Int_t ValueAsIntFast(Int_t i, Int_t j=0) const = 0;
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; }
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; }
109 /// Return 1E38 as invalid float value
110 static Float_t InvalidFloatValue() { return 1E38; }
112 static UInt_t BuildUniqueID(Int_t id0, Int_t id1);
113 static void DecodeUniqueID(UInt_t uniqueID, Int_t& id0, Int_t& id1);
117 static Int_t ID0(UInt_t uniqueID);
118 static Int_t ID1(UInt_t uniqueID);
120 ClassDef(AliMUONVCalibParam,0) // Base class for a calibration data holder (usually for 64 channels)