1 #ifndef ALIMUONTRACKERDATA_H
2 #define ALIMUONTRACKERDATA_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
10 /// \class AliMUONTrackerData
11 /// \brief Implementation of AliMUONVTrackerData
13 // Author Laurent Aphecetche, Subatech
15 #ifndef ALIMUONVTRACKERDATA_H
16 # include "AliMUONVTrackerData.h"
19 class AliMUONSparseHisto;
20 class AliMUONVCalibParam;
22 class AliMpDetElement;
23 class AliMUONRejectList;
25 class AliMUONTrackerData : public AliMUONVTrackerData
28 AliMUONTrackerData(const char* name="", const char* title="",
30 Bool_t issingleevent=kFALSE);
32 AliMUONTrackerData(const char* name, const char* title,
33 const AliMUONVStore& manuValues);
35 AliMUONTrackerData(const char* name, const char* title,
36 const AliMUONVStore& deOrBpValues, Int_t val);
38 AliMUONTrackerData(const char* name, const char* title,
39 const AliMUONRejectList& rejectList);
41 virtual ~AliMUONTrackerData();
43 Bool_t Add(const AliMUONTrackerData& data);
45 virtual Bool_t Add(const AliMUONVStore& channelValues, TArrayI* nofEventsPerDDL=0x0);
47 virtual Bool_t Replace(const AliMUONVStore& channelValues);
49 virtual Double_t BusPatch(Int_t busPatchId, Int_t dim=0) const;
51 virtual Double_t Chamber(Int_t chamberId, Int_t dim=0) const;
53 virtual Double_t Channel(Int_t detElemId, Int_t manuId, Int_t manuChannel,
56 virtual void Clear(Option_t* opt="");
58 virtual Double_t Count(Int_t detElemId, Int_t manuId, Int_t manuChannel) const;
60 virtual Double_t DetectionElement(Int_t detElemId, Int_t dim=0) const;
62 virtual TString DimensionName(Int_t dim) const;
64 virtual TString ExternalDimensionName(Int_t dim) const;
66 virtual Bool_t HasChamber(Int_t chamberId) const;
68 virtual Bool_t HasBusPatch(Int_t busPatchId) const;
70 virtual Bool_t HasDetectionElement(Int_t detElemId) const;
72 virtual Bool_t HasManu(Int_t detElemId, Int_t manuId) const;
74 virtual Bool_t HasPCB(Int_t detElemId, Int_t pcbIndex) const;
76 /// Whether we can be run
77 virtual Bool_t IsSingleEvent() const { return fIsSingleEvent; }
79 virtual Double_t Manu(Int_t detElemId, Int_t manuId, Int_t dim=0) const;
81 /// Returns the number of dimensions (i.e. the number of values) each element has
82 virtual Int_t NumberOfDimensions() const;
84 /// The number of values we are inputting
85 virtual Int_t ExternalDimension() const { return fExternalDimension; }
87 /// Convert from internal to external dimension
88 virtual Int_t InternalToExternal(Int_t dim) const { return dim/2; }
90 /// Returns the number of events we have seen so far
91 virtual Int_t NumberOfEvents(Int_t ddlNumber) const;
93 virtual Double_t PCB(Int_t detElemId, Int_t pcbIndex, Int_t dim=0) const;
97 /// Print, with option, all objects whose name matches wildcard
98 virtual void Print(Option_t* wildcard, Option_t* opt) const;
100 virtual void SetDimensionName(Int_t index, const char* value);
102 Bool_t CanHistogram() const { return kTRUE; }
104 void MakeHistogramForDimension(Int_t index, Bool_t value, Double_t xmin=0.0, Double_t xmax=4096.0);
106 virtual void HistogramRange(Double_t& xmin, Double_t& xmax) const { xmin = fXmin; xmax = fXmax; }
108 AliMUONSparseHisto* GetManuSparseHisto(Int_t detElemId, Int_t manuId,
111 AliMUONSparseHisto* GetManuSparseHisto(Int_t detElemId, Int_t manuId,
114 AliMUONSparseHisto* GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
115 Int_t manuChannel, Int_t dim=0);
117 virtual AliMUONSparseHisto* GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
118 Int_t manuChannel, Int_t dim=0) const;
120 /// Disable storing values at the channel level
121 virtual void DisableChannelLevel();
123 /// Whether we store values at the channel level or not
124 virtual Bool_t IsChannelLevelEnabled() const { return fIsChannelLevelEnabled; }
126 /// Disable storing values at the manu level
127 virtual void DisableManuLevel();
129 /// Whether we store values at the manu level or not
130 virtual Bool_t IsManuLevelEnabled() const { return fIsManuLevelEnabled; }
132 /// Whether we store values at the bus patch level or not
133 virtual Bool_t IsBusPatchLevelEnabled() const { return fIsBustPatchLevelEnabled; }
135 /// Whether we store values at the PCB level or not
136 virtual Bool_t IsPCBLevelEnabled() const { return fIsPCBLevelEnabled; }
138 /// To allow merging of different objects
139 virtual Long64_t Merge(TCollection* list);
141 Bool_t ExportAsASCIIOccupancyFile(const char* filename, Int_t runNumber) const;
145 void BuildFromDEStore(const AliMUONVStore& deStore);
147 void BuildFromBPStore(const AliMUONVStore& bpStore);
149 void FillHisto(Int_t detElemId, Int_t manuId, Int_t manuChannel,
150 Int_t dim, Double_t value);
152 AliMUONVCalibParam* BusPatchParam(Int_t busPatch, Bool_t create=kFALSE) const;
154 AliMUONVCalibParam* CreateBusPatchParam(Int_t busPatch) const;
156 AliMUONVCalibParam* ChamberParam(Int_t chamberId, Bool_t create=kFALSE) const;
158 AliMUONVCalibParam* CreateChamberParam(Int_t chamberId) const;
160 AliMUONVCalibParam* ChannelParam(Int_t detElemId, Int_t manuId,
161 const AliMUONVCalibParam* external=0x0) const;
163 AliMUONVCalibParam* DetectionElementParam(Int_t detElemId, Bool_t create=kFALSE) const;
165 AliMUONVCalibParam* CreateDetectionElementParam(Int_t detElemId) const;
167 AliMUONVCalibParam* ManuParam(Int_t detElemId, Int_t manuId, Bool_t create=kFALSE) const;
169 AliMUONVCalibParam* CreateManuParam(Int_t detElemInd, Int_t manuId) const;
171 AliMUONVCalibParam* PCBParam(Int_t detElemId, Int_t pcbIndex, Bool_t create=kFALSE) const;
173 AliMUONVCalibParam* CreatePCBParam(Int_t detElemId, Int_t pcbIndex) const;
175 /// Index of the dimension containing the number of time an item was hit
176 virtual Int_t IndexOfNumberDimension() const { return fDimension - 1; }
178 /// Index of the dimension containing the occupancy number
179 virtual Int_t IndexOfOccupancyDimension() const { return fDimension - 2; }
181 /// Whether we have histograms for a given dimension, or not
182 virtual Bool_t IsHistogrammed(Int_t dim) const { return ( fHistogramming[dim] > 0 ); }
184 Int_t DdlIdFromBusPatchId(Int_t buspatchid) const;
185 Int_t DdlIdFromDetElemId(Int_t detelemid) const;
186 Int_t DdlIdFromChamberId(Int_t chamberid) const;
189 AliMUONTrackerData(const AliMUONTrackerData& rhs);
191 AliMUONTrackerData& operator=(const AliMUONTrackerData& rhs);
193 AliMUONVCalibParam* CreateDouble(const AliMUONVCalibParam& param, Int_t detElemId, Int_t manuId) const;
195 Int_t GetParts(AliMUONVCalibParam* external,
196 AliMUONVCalibParam*& chamber,
197 AliMUONVCalibParam*& de,
198 AliMUONVCalibParam*& busPatch,
199 AliMUONVCalibParam*& pcb,
200 AliMUONVCalibParam*& manu,
201 AliMUONVCalibParam*& channel,
202 AliMpDetElement*& mpde);
204 /// Convert from external to internal index
205 Int_t External2Internal(Int_t index) const;
207 void SetInternalDimensionName(Int_t index, const char* value);
209 void SetExternalDimensionName(Int_t index, const char* value);
211 Double_t Value(const AliMUONVCalibParam& param, Int_t i, Int_t dim, Int_t ddlId) const;
213 /// The number of values we actually *store* for each item
214 Int_t Dimension() const { return fDimension; }
216 Bool_t InternalAdd(const AliMUONVStore& store, TArrayI* nevents, Bool_t replace);
218 void GetDEManu(const AliMUONVCalibParam& param,
219 Int_t& detElemId, Int_t& manuId) const;
221 void AddCalibParams(const AliMUONVCalibParam& src, AliMUONVCalibParam& dest) const;
223 void Add2D(const AliMUONVStore& src, AliMUONVStore& dest) const;
225 void Add1D(const AliMUONVStore& src, AliMUONVStore& dest) const;
229 Bool_t UpdateNumberOfEvents(TArrayI* nevents);
231 static void DispatchValue(AliMUONVCalibParam& param, Int_t index, Double_t y, Double_t ey, Int_t nchannels);
235 Bool_t fIsSingleEvent; ///< whether we can deal with more than one event
236 AliMUONVStore* fChannelValues; ///< the channel store
237 AliMUONVStore* fManuValues; ///< the manu store
238 AliMUONVStore* fBusPatchValues; ///< the bus patch store
239 AliMUONVStore* fDEValues; ///< the detection element store
240 AliMUONVStore* fChamberValues; ///< the chamber store
241 AliMUONVStore* fPCBValues; ///< the pcb store
242 Int_t fDimension; ///< the dimension of the data
243 Int_t fNevents; ///< the number of events treated
244 TObjArray* fDimensionNames; ///< the names of the (internal) dimensions
245 TObjArray* fExternalDimensionNames; ///< the names of the external (i.e. original) dimensions
246 Int_t fExternalDimension; ///< number of interface values per item
247 /// whether we should histogram the dimension(s)
248 Int_t* fHistogramming; //[fExternalDimension] whether we should histogram the dimension(s)
249 AliMUONVStore* fHistos; ///< the lowest histograms we have
250 Double_t fXmin; ///< min x value for histograms
251 Double_t fXmax; ///< max x value for histograms
252 static const Int_t fgkExtraDimension; ///< to hold extra information
253 static const Int_t fgkVirtualExtraDimension; ///< to give access to information not stored, but computed on the fly
254 Bool_t fIsChannelLevelEnabled; ///< whether we allow storing of channel (fChannelValues) values
255 Bool_t fIsManuLevelEnabled; ///< whether we allow storing of manu (fManuValues) values
256 Bool_t fIsBustPatchLevelEnabled; ///< whether we allow storing of bus patches (fBusPatchValues) values
257 Bool_t fIsPCBLevelEnabled; ///< whether we allow storing of PCB values (fPCBValues)
258 Int_t fNofDDLs; ///< nof of DDLs we're dealing with
259 /// the number of events treated (per DDL)
260 Int_t* fNofEventsPerDDL; //[fNofDDLs] the number of events treated (per DDL)
262 ClassDef(AliMUONTrackerData,8) // Implementation of AliMUONVTrackerData