Line data Source code
1 : #ifndef ALIMUONTRACKERDATA_H
2 : #define ALIMUONTRACKERDATA_H
3 :
4 : /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 : * See cxx source for full Copyright notice */
6 :
7 : // $Id$
8 :
9 : /// \ingroup calib
10 : /// \class AliMUONTrackerData
11 : /// \brief Implementation of AliMUONVTrackerData
12 : ///
13 : // Author Laurent Aphecetche, Subatech
14 :
15 : #ifndef ALIMUONVTRACKERDATA_H
16 : # include "AliMUONVTrackerData.h"
17 : #endif
18 :
19 : class AliMUONSparseHisto;
20 : class AliMUONVCalibParam;
21 : class AliMUONVStore;
22 : class AliMpDetElement;
23 : class AliMUONRejectList;
24 :
25 : class AliMUONTrackerData : public AliMUONVTrackerData
26 : {
27 : public:
28 : AliMUONTrackerData(const char* name="", const char* title="",
29 : Int_t dimension=0,
30 : Bool_t issingleevent=kFALSE);
31 :
32 : AliMUONTrackerData(const char* name, const char* title,
33 : const AliMUONVStore& manuValues);
34 :
35 : AliMUONTrackerData(const char* name, const char* title,
36 : const AliMUONVStore& deOrBpValues, Int_t val);
37 :
38 : AliMUONTrackerData(const char* name, const char* title,
39 : const AliMUONRejectList& rejectList);
40 :
41 : virtual ~AliMUONTrackerData();
42 :
43 : Bool_t Add(const AliMUONTrackerData& data);
44 :
45 : virtual Bool_t Add(const AliMUONVStore& channelValues, TArrayI* nofEventsPerDDL=0x0);
46 :
47 : virtual Bool_t Replace(const AliMUONVStore& channelValues);
48 :
49 : virtual Double_t BusPatch(Int_t busPatchId, Int_t dim=0) const;
50 :
51 : virtual Double_t Chamber(Int_t chamberId, Int_t dim=0) const;
52 :
53 : virtual Double_t Channel(Int_t detElemId, Int_t manuId, Int_t manuChannel,
54 : Int_t dim=0) const;
55 :
56 : virtual void Clear(Option_t* opt="");
57 :
58 : enum EDiffType
59 : {
60 : kDifference = 1, ///< D1-D2
61 : kAbsoluteDifference = 2 , ///< |D1-D2|
62 : kRelativeDifference = 3, ///< (D1-D2)/D1
63 : kAbsoluteRelativeDifference = 4, ///< | (D1-D2) | / | D1 |
64 : kAll = 5 ///< All four differences at once
65 : };
66 :
67 : static AliMUONVTrackerData* CompareData(const AliMUONVTrackerData& d1,
68 : const AliMUONVTrackerData& d2,
69 : const char* outname,
70 : Double_t(*diff)(Double_t,Double_t));
71 :
72 : static AliMUONVTrackerData* CompareData(const AliMUONVTrackerData& d1,
73 : const AliMUONVTrackerData& d2,
74 : const char* outnamebase,
75 : AliMUONTrackerData::EDiffType diffType);
76 :
77 : virtual Double_t Count(Int_t detElemId, Int_t manuId, Int_t manuChannel) const;
78 :
79 : virtual Double_t DetectionElement(Int_t detElemId, Int_t dim=0) const;
80 :
81 : virtual TString DimensionName(Int_t dim) const;
82 :
83 : virtual TString ExternalDimensionName(Int_t dim) const;
84 :
85 : virtual Bool_t HasChamber(Int_t chamberId) const;
86 :
87 : virtual Bool_t HasBusPatch(Int_t busPatchId) const;
88 :
89 : virtual Bool_t HasDetectionElement(Int_t detElemId) const;
90 :
91 : virtual Bool_t HasManu(Int_t detElemId, Int_t manuId) const;
92 :
93 : virtual Bool_t HasPCB(Int_t detElemId, Int_t pcbIndex) const;
94 :
95 : /// Whether we can be run
96 4 : virtual Bool_t IsSingleEvent() const { return fIsSingleEvent; }
97 :
98 : virtual Double_t Manu(Int_t detElemId, Int_t manuId, Int_t dim=0) const;
99 :
100 : /// Returns the number of dimensions (i.e. the number of values) each element has
101 : virtual Int_t NumberOfDimensions() const;
102 :
103 : /// The number of values we are inputting
104 0 : virtual Int_t ExternalDimension() const { return fExternalDimension; }
105 :
106 : /// Convert from internal to external dimension
107 0 : virtual Int_t InternalToExternal(Int_t dim) const { return dim/2; }
108 :
109 : /// Returns the number of events we have seen so far
110 : virtual Int_t NumberOfEvents(Int_t ddlNumber) const;
111 :
112 : virtual Double_t PCB(Int_t detElemId, Int_t pcbIndex, Int_t dim=0) const;
113 :
114 : using TObject::Print;
115 :
116 : /// Print, with option, all objects whose name matches wildcard
117 : virtual void Print(Option_t* wildcard, Option_t* opt) const;
118 :
119 : virtual void SetDimensionName(Int_t index, const char* value);
120 :
121 0 : Bool_t CanHistogram() const { return kTRUE; }
122 :
123 : void MakeHistogramForDimension(Int_t index, Bool_t value, Double_t xmin=0.0, Double_t xmax=4096.0);
124 :
125 0 : virtual void HistogramRange(Double_t& xmin, Double_t& xmax) const { xmin = fXmin; xmax = fXmax; }
126 :
127 : AliMUONSparseHisto* GetManuSparseHisto(Int_t detElemId, Int_t manuId,
128 : Int_t dim=0);
129 :
130 : AliMUONSparseHisto* GetManuSparseHisto(Int_t detElemId, Int_t manuId,
131 : Int_t dim=0) const;
132 :
133 : AliMUONSparseHisto* GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
134 : Int_t manuChannel, Int_t dim=0);
135 :
136 : virtual AliMUONSparseHisto* GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
137 : Int_t manuChannel, Int_t dim=0) const;
138 :
139 : /// Disable storing values at the channel level
140 : virtual void DisableChannelLevel();
141 :
142 : /// Whether we store values at the channel level or not
143 0 : virtual Bool_t IsChannelLevelEnabled() const { return fIsChannelLevelEnabled; }
144 :
145 : /// Disable storing values at the manu level
146 : virtual void DisableManuLevel();
147 :
148 : /// Whether we store values at the manu level or not
149 0 : virtual Bool_t IsManuLevelEnabled() const { return fIsManuLevelEnabled; }
150 :
151 : /// Whether we store values at the bus patch level or not
152 0 : virtual Bool_t IsBusPatchLevelEnabled() const { return fIsBustPatchLevelEnabled; }
153 :
154 : /// Whether we store values at the PCB level or not
155 0 : virtual Bool_t IsPCBLevelEnabled() const { return fIsPCBLevelEnabled; }
156 :
157 : /// To allow merging of different objects
158 : virtual Long64_t Merge(TCollection* list);
159 :
160 : Bool_t ExportAsASCIIOccupancyFile(const char* filename, Int_t runNumber) const;
161 :
162 : private:
163 :
164 : void BuildFromDEStore(const AliMUONVStore& deStore);
165 :
166 : void BuildFromBPStore(const AliMUONVStore& bpStore);
167 :
168 : void FillHisto(Int_t detElemId, Int_t manuId, Int_t manuChannel,
169 : Int_t dim, Double_t value);
170 :
171 : AliMUONVCalibParam* BusPatchParam(Int_t busPatch, Bool_t create=kFALSE) const;
172 :
173 : AliMUONVCalibParam* CreateBusPatchParam(Int_t busPatch) const;
174 :
175 : AliMUONVCalibParam* ChamberParam(Int_t chamberId, Bool_t create=kFALSE) const;
176 :
177 : AliMUONVCalibParam* CreateChamberParam(Int_t chamberId) const;
178 :
179 : AliMUONVCalibParam* ChannelParam(Int_t detElemId, Int_t manuId,
180 : const AliMUONVCalibParam* external=0x0) const;
181 :
182 : AliMUONVCalibParam* DetectionElementParam(Int_t detElemId, Bool_t create=kFALSE) const;
183 :
184 : AliMUONVCalibParam* CreateDetectionElementParam(Int_t detElemId) const;
185 :
186 : AliMUONVCalibParam* ManuParam(Int_t detElemId, Int_t manuId, Bool_t create=kFALSE) const;
187 :
188 : AliMUONVCalibParam* CreateManuParam(Int_t detElemInd, Int_t manuId) const;
189 :
190 : AliMUONVCalibParam* PCBParam(Int_t detElemId, Int_t pcbIndex, Bool_t create=kFALSE) const;
191 :
192 : AliMUONVCalibParam* CreatePCBParam(Int_t detElemId, Int_t pcbIndex) const;
193 :
194 : /// Index of the dimension containing the number of time an item was hit
195 610028 : virtual Int_t IndexOfNumberDimension() const { return fDimension - 1; }
196 :
197 : /// Index of the dimension containing the occupancy number
198 403876 : virtual Int_t IndexOfOccupancyDimension() const { return fDimension - 2; }
199 :
200 : /// Whether we have histograms for a given dimension, or not
201 0 : virtual Bool_t IsHistogrammed(Int_t dim) const { return ( fHistogramming[dim] > 0 ); }
202 :
203 : Int_t DdlIdFromBusPatchId(Int_t buspatchid) const;
204 : Int_t DdlIdFromDetElemId(Int_t detelemid) const;
205 : Int_t DdlIdFromChamberId(Int_t chamberid) const;
206 :
207 : /// Not implemented
208 : AliMUONTrackerData(const AliMUONTrackerData& rhs);
209 : /// Not implemented
210 : AliMUONTrackerData& operator=(const AliMUONTrackerData& rhs);
211 :
212 : AliMUONVCalibParam* CreateDouble(const AliMUONVCalibParam& param, Int_t detElemId, Int_t manuId) const;
213 :
214 : Int_t GetParts(AliMUONVCalibParam* external,
215 : AliMUONVCalibParam*& chamber,
216 : AliMUONVCalibParam*& de,
217 : AliMUONVCalibParam*& busPatch,
218 : AliMUONVCalibParam*& pcb,
219 : AliMUONVCalibParam*& manu,
220 : AliMUONVCalibParam*& channel,
221 : AliMpDetElement*& mpde);
222 :
223 : /// Convert from external to internal index
224 : Int_t External2Internal(Int_t index) const;
225 :
226 : void SetInternalDimensionName(Int_t index, const char* value);
227 :
228 : void SetExternalDimensionName(Int_t index, const char* value);
229 :
230 : Double_t Value(const AliMUONVCalibParam& param, Int_t i, Int_t dim, Int_t ddlId) const;
231 :
232 : /// The number of values we actually *store* for each item
233 73928 : Int_t Dimension() const { return fDimension; }
234 :
235 : Bool_t InternalAdd(const AliMUONVStore& store, TArrayI* nevents);
236 :
237 : void GetDEManu(const AliMUONVCalibParam& param,
238 : Int_t& detElemId, Int_t& manuId) const;
239 :
240 : void AddCalibParams(const AliMUONVCalibParam& src, AliMUONVCalibParam& dest) const;
241 :
242 : void Add2D(const AliMUONVStore& src, AliMUONVStore& dest) const;
243 :
244 : void Add1D(const AliMUONVStore& src, AliMUONVStore& dest) const;
245 :
246 : void AssertStores();
247 :
248 : Bool_t UpdateNumberOfEvents(TArrayI* nevents);
249 :
250 : static void DispatchValue(AliMUONVCalibParam& param, Int_t index, Double_t y, Double_t ey, Int_t nchannels);
251 :
252 : private:
253 :
254 : Bool_t fIsSingleEvent; ///< whether we can deal with more than one event
255 : AliMUONVStore* fChannelValues; ///< the channel store
256 : AliMUONVStore* fManuValues; ///< the manu store
257 : AliMUONVStore* fBusPatchValues; ///< the bus patch store
258 : AliMUONVStore* fDEValues; ///< the detection element store
259 : AliMUONVStore* fChamberValues; ///< the chamber store
260 : AliMUONVStore* fPCBValues; ///< the pcb store
261 : Int_t fDimension; ///< the dimension of the data
262 : Int_t fNevents; ///< the number of events treated
263 : TObjArray* fDimensionNames; ///< the names of the (internal) dimensions
264 : TObjArray* fExternalDimensionNames; ///< the names of the external (i.e. original) dimensions
265 : Int_t fExternalDimension; ///< number of interface values per item
266 : /// whether we should histogram the dimension(s)
267 : Int_t* fHistogramming; //[fExternalDimension] whether we should histogram the dimension(s)
268 : AliMUONVStore* fHistos; ///< the lowest histograms we have
269 : Double_t fXmin; ///< min x value for histograms
270 : Double_t fXmax; ///< max x value for histograms
271 : static const Int_t fgkExtraDimension; ///< to hold extra information
272 : static const Int_t fgkVirtualExtraDimension; ///< to give access to information not stored, but computed on the fly
273 : Bool_t fIsChannelLevelEnabled; ///< whether we allow storing of channel (fChannelValues) values
274 : Bool_t fIsManuLevelEnabled; ///< whether we allow storing of manu (fManuValues) values
275 : Bool_t fIsBustPatchLevelEnabled; ///< whether we allow storing of bus patches (fBusPatchValues) values
276 : Bool_t fIsPCBLevelEnabled; ///< whether we allow storing of PCB values (fPCBValues)
277 : Int_t fNofDDLs; ///< nof of DDLs we're dealing with
278 : /// the number of events treated (per DDL)
279 : Int_t* fNofEventsPerDDL; //[fNofDDLs] the number of events treated (per DDL)
280 :
281 73954 : ClassDef(AliMUONTrackerData,8) // Implementation of AliMUONVTrackerData
282 : };
283 :
284 : #endif
|