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