]>
Commit | Line | Data |
---|---|---|
7bda16d5 | 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 | ||
a1546c3a | 20 | #include "AliLog.h" |
21 | ||
3d1463c8 | 22 | //----------------------------------------------------------------------------- |
85fec35d | 23 | /// \class AliMUONVCalibParam |
24 | /// | |
25 | /// Defines an interface for a calibration container object. | |
26 | /// | |
a1546c3a | 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 | /// | |
4db2bfee | 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 | /// | |
a1546c3a | 38 | /// \author Laurent Aphecetche, Subatech |
3d1463c8 | 39 | //----------------------------------------------------------------------------- |
7bda16d5 | 40 | |
5398f946 | 41 | /// \cond CLASSIMP |
7bda16d5 | 42 | ClassImp(AliMUONVCalibParam) |
5398f946 | 43 | /// \endcond |
7bda16d5 | 44 | |
85fec35d | 45 | //_____________________________________________________________________________ |
a1546c3a | 46 | AliMUONVCalibParam::AliMUONVCalibParam() : TObject() |
85fec35d | 47 | { |
a1546c3a | 48 | /// Default constructor |
49 | } | |
50 | ||
51 | //_____________________________________________________________________________ | |
52 | AliMUONVCalibParam::AliMUONVCalibParam(Int_t id0, Int_t id1) : TObject() | |
53 | { | |
54 | /// constructor for 2D | |
55 | SetUniqueID(BuildUniqueID(id0,id1)); | |
85fec35d | 56 | } |
57 | ||
7bda16d5 | 58 | //_____________________________________________________________________________ |
59 | AliMUONVCalibParam::~AliMUONVCalibParam() | |
60 | { | |
5398f946 | 61 | /// Destructor. |
7bda16d5 | 62 | } |
a1546c3a | 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 | 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 | id0 = ID0(uniqueID); | |
78 | id1 = ID1(uniqueID); | |
79 | } | |
80 | ||
81 | //_____________________________________________________________________________ | |
82 | Int_t | |
83 | AliMUONVCalibParam::ID0(UInt_t uniqueID) | |
84 | { | |
85 | /// Extract id0 from uniqueID | |
86 | return uniqueID & 0xFFFF; | |
87 | } | |
88 | ||
89 | //_____________________________________________________________________________ | |
90 | Int_t | |
91 | AliMUONVCalibParam::ID0() const | |
92 | { | |
93 | /// Extract first identifier | |
94 | return ID0(GetUniqueID()); | |
95 | } | |
96 | ||
97 | //_____________________________________________________________________________ | |
98 | Int_t | |
99 | AliMUONVCalibParam::ID1(UInt_t uniqueID) | |
100 | { | |
101 | /// Extract id1 from uniqueID | |
102 | return ( uniqueID & 0xFFFF0000 ) >> 16; | |
103 | } | |
104 | ||
105 | //_____________________________________________________________________________ | |
106 | Int_t | |
107 | AliMUONVCalibParam::ID1() const | |
108 | { | |
109 | /// Extract second identifier | |
110 | return ID1(GetUniqueID()); | |
111 | } | |
112 | ||
113 | //_____________________________________________________________________________ | |
114 | const char* | |
115 | AliMUONVCalibParam::GetName() const | |
116 | { | |
117 | /// Build a name for this object | |
118 | 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 | AliFatal("Not implemented"); | |
127 | } | |
128 | ||
4db2bfee | 129 | //_____________________________________________________________________________ |
130 | void | |
131 | AliMUONVCalibParam::SetValueAsDoubleFast(Int_t, Int_t, Double_t) | |
132 | { | |
133 | /// By default, this one does not exist | |
134 | AliFatal("Not implemented"); | |
135 | } | |
136 | ||
a1546c3a | 137 | //_____________________________________________________________________________ |
138 | Double_t | |
139 | AliMUONVCalibParam::ValueAsDouble(Int_t , Int_t ) const | |
140 | { | |
141 | /// By default, this one does not exist | |
142 | AliFatal("Not implemented"); | |
143 | return 0; | |
144 | } | |
145 | ||
4db2bfee | 146 | //_____________________________________________________________________________ |
147 | Double_t | |
148 | AliMUONVCalibParam::ValueAsDoubleFast(Int_t , Int_t ) const | |
149 | { | |
150 | /// By default, this one does not exist | |
151 | AliFatal("Not implemented"); | |
152 | return 0; | |
153 | } | |
154 | ||
ff496840 | 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 | const AliMUONVCalibParam* param = static_cast<const AliMUONVCalibParam*>(object); | |
163 | ||
164 | if ( ID0() == param->ID0() ) | |
165 | { | |
166 | if ( ID1() == param->ID1() ) | |
167 | { | |
168 | return 0; | |
169 | } | |
170 | else | |
171 | return (ID1() >= param->ID1()) ? 1 : -1; | |
172 | } | |
173 | else | |
174 | return ( ID0() >= param->ID0()) ? 1 : -1; | |
175 | } | |
176 | ||
177 |