- Adding check and flagging for HG present
[u/mrichter/AliRoot.git] / MUON / AliMUONTrackerData.h
CommitLineData
0145e89a 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
e41c38cf 9/// \ingroup calib
0145e89a 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
8741815f 19class AliMUONSparseHisto;
0145e89a 20class AliMUONVCalibParam;
21class AliMUONVStore;
8741815f 22class AliMpDetElement;
0145e89a 23
24class AliMUONTrackerData : public AliMUONVTrackerData
25{
26public:
27 AliMUONTrackerData(const char* name="", const char* title="",
28 Int_t dimension=0,
49419555 29 Bool_t issingleevent=kFALSE);
7eafe398 30
31 AliMUONTrackerData(const char* name, const char* title,
32 const AliMUONVStore& manuValues);
33
0145e89a 34 virtual ~AliMUONTrackerData();
35
e83120bd 36 Bool_t Add(const AliMUONTrackerData& data);
37
38 virtual Bool_t Add(const AliMUONVStore& channelValues, TArrayI* nofEventsPerDDL=0x0);
1ffbeb9d 39
40 virtual Bool_t Replace(const AliMUONVStore& channelValues);
41
0145e89a 42 virtual Double_t BusPatch(Int_t busPatchId, Int_t dim=0) const;
43
44 virtual Double_t Chamber(Int_t chamberId, Int_t dim=0) const;
45
46 virtual Double_t Channel(Int_t detElemId, Int_t manuId, Int_t manuChannel,
47 Int_t dim=0) const;
48
49 virtual void Clear(Option_t* opt="");
50
51 virtual Double_t Count(Int_t detElemId, Int_t manuId, Int_t manuChannel) const;
52
53 virtual Double_t DetectionElement(Int_t detElemId, Int_t dim=0) const;
54
55 virtual TString DimensionName(Int_t dim) const;
8741815f 56
57 virtual TString ExternalDimensionName(Int_t dim) const;
0145e89a 58
59 virtual Bool_t HasChamber(Int_t chamberId) const;
60
61 virtual Bool_t HasBusPatch(Int_t busPatchId) const;
62
63 virtual Bool_t HasDetectionElement(Int_t detElemId) const;
64
65 virtual Bool_t HasManu(Int_t detElemId, Int_t manuId) const;
66
67 virtual Bool_t HasPCB(Int_t detElemId, Int_t pcbIndex) const;
68
9016a84e 69 /// Whether we can be run
49419555 70 virtual Bool_t IsSingleEvent() const { return fIsSingleEvent; }
0145e89a 71
72 virtual Double_t Manu(Int_t detElemId, Int_t manuId, Int_t dim=0) const;
73
74 /// Returns the number of dimensions (i.e. the number of values) each element has
75 virtual Int_t NumberOfDimensions() const;
76
10eb3d17 77 /// The number of values we are inputting
78 virtual Int_t ExternalDimension() const { return fExternalDimension; }
79
80 /// Convert from internal to external dimension
81 virtual Int_t InternalToExternal(Int_t dim) const { return dim/2; }
82
0145e89a 83 /// Returns the number of events we have seen so far
e83120bd 84 virtual Int_t NumberOfEvents(Int_t ddlNumber) const;
0145e89a 85
86 virtual Double_t PCB(Int_t detElemId, Int_t pcbIndex, Int_t dim=0) const;
87
88 using TObject::Print;
89
90 /// Print, with option, all objects whose name matches wildcard
91 virtual void Print(Option_t* wildcard, Option_t* opt) const;
92
93 virtual void SetDimensionName(Int_t index, const char* value);
94
8741815f 95 Bool_t CanHistogram() const { return kTRUE; }
96
10eb3d17 97 void MakeHistogramForDimension(Int_t index, Bool_t value, Double_t xmin=0.0, Double_t xmax=4096.0);
8741815f 98
10eb3d17 99 virtual void HistogramRange(Double_t& xmin, Double_t& xmax) const { xmin = fXmin; xmax = fXmax; }
8741815f 100
0edb62c4 101 AliMUONSparseHisto* GetManuSparseHisto(Int_t detElemId, Int_t manuId,
102 Int_t dim=0);
103
104 AliMUONSparseHisto* GetManuSparseHisto(Int_t detElemId, Int_t manuId,
105 Int_t dim=0) const;
106
10eb3d17 107 AliMUONSparseHisto* GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
108 Int_t manuChannel, Int_t dim=0);
8741815f 109
10eb3d17 110 virtual AliMUONSparseHisto* GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
111 Int_t manuChannel, Int_t dim=0) const;
8741815f 112
e13620cd 113 /// Disable storing values at the channel level
114 virtual void DisableChannelLevel();
115
116 /// Whether we store values at the channel level or not
117 virtual Bool_t IsChannelLevelEnabled() const { return fIsChannelLevelEnabled; }
118
0edb62c4 119 /// Disable storing values at the manu level
120 virtual void DisableManuLevel();
121
122 /// Whether we store values at the manu level or not
123 virtual Bool_t IsManuLevelEnabled() const { return fIsManuLevelEnabled; }
124
6c35944e 125 /// To allow merging of different objects
126 virtual Long64_t Merge(TCollection* list);
127
7eafe398 128 Bool_t ExportAsASCIIOccupancyFile(const char* filename, Int_t runNumber) const;
129
8741815f 130private:
131
0edb62c4 132 void FillHisto(Int_t detElemId, Int_t manuId, Int_t manuChannel,
133 Int_t dim, Double_t value);
8741815f 134
8741815f 135 AliMUONVCalibParam* BusPatchParam(Int_t busPatch, Bool_t create=kFALSE) const;
136
137 AliMUONVCalibParam* CreateBusPatchParam(Int_t busPatch) const;
138
139 AliMUONVCalibParam* ChamberParam(Int_t chamberId, Bool_t create=kFALSE) const;
140
141 AliMUONVCalibParam* CreateChamberParam(Int_t chamberId) const;
142
143 AliMUONVCalibParam* ChannelParam(Int_t detElemId, Int_t manuId,
57e2ad1a 144 const AliMUONVCalibParam* external=0x0) const;
0145e89a 145
8741815f 146 AliMUONVCalibParam* DetectionElementParam(Int_t detElemId, Bool_t create=kFALSE) const;
0145e89a 147
8741815f 148 AliMUONVCalibParam* CreateDetectionElementParam(Int_t detElemId) const;
0145e89a 149
8741815f 150 AliMUONVCalibParam* ManuParam(Int_t detElemId, Int_t manuId, Bool_t create=kFALSE) const;
0145e89a 151
8741815f 152 AliMUONVCalibParam* CreateManuParam(Int_t detElemInd, Int_t manuId) const;
0145e89a 153
8741815f 154 AliMUONVCalibParam* PCBParam(Int_t detElemId, Int_t pcbIndex, Bool_t create=kFALSE) const;
0145e89a 155
8741815f 156 AliMUONVCalibParam* CreatePCBParam(Int_t detElemId, Int_t pcbIndex) const;
0145e89a 157
9016a84e 158 /// Index of the dimension containing the number of time an item was hit
0145e89a 159 virtual Int_t IndexOfNumberDimension() const { return fDimension - 1; }
160
9016a84e 161 /// Index of the dimension containing the occupancy number
0145e89a 162 virtual Int_t IndexOfOccupancyDimension() const { return fDimension - 2; }
163
10eb3d17 164 /// Whether we have histograms for a given dimension, or not
165 virtual Bool_t IsHistogrammed(Int_t dim) const { return ( fHistogramming[dim] > 0 ); }
166
e83120bd 167 Int_t DdlIdFromBusPatchId(Int_t buspatchid) const;
168 Int_t DdlIdFromDetElemId(Int_t detelemid) const;
169 Int_t DdlIdFromChamberId(Int_t chamberid) const;
170
0145e89a 171 /// Not implemented
172 AliMUONTrackerData(const AliMUONTrackerData& rhs);
173 /// Not implemented
174 AliMUONTrackerData& operator=(const AliMUONTrackerData& rhs);
175
7b6684fe 176 AliMUONVCalibParam* CreateDouble(const AliMUONVCalibParam& param, Int_t detElemId, Int_t manuId) const;
0145e89a 177
8741815f 178 Int_t GetParts(AliMUONVCalibParam* external,
179 AliMUONVCalibParam*& chamber,
180 AliMUONVCalibParam*& de,
181 AliMUONVCalibParam*& busPatch,
182 AliMUONVCalibParam*& pcb,
183 AliMUONVCalibParam*& manu,
184 AliMUONVCalibParam*& channel,
185 AliMpDetElement*& mpde);
186
0145e89a 187 /// Convert from external to internal index
49419555 188 Int_t External2Internal(Int_t index) const;
0145e89a 189
0145e89a 190 void SetInternalDimensionName(Int_t index, const char* value);
191
8741815f 192 void SetExternalDimensionName(Int_t index, const char* value);
193
e83120bd 194 Double_t Value(const AliMUONVCalibParam& param, Int_t i, Int_t dim, Int_t ddlId) const;
8741815f 195
196 /// The number of values we actually *store* for each item
197 Int_t Dimension() const { return fDimension; }
10eb3d17 198
e83120bd 199 Bool_t InternalAdd(const AliMUONVStore& store, TArrayI* nevents, Bool_t replace);
200
201 void GetDEManu(const AliMUONVCalibParam& param,
202 Int_t& detElemId, Int_t& manuId) const;
203
204 void AddCalibParams(const AliMUONVCalibParam& src, AliMUONVCalibParam& dest) const;
205
206 void Add2D(const AliMUONVStore& src, AliMUONVStore& dest) const;
207
208 void Add1D(const AliMUONVStore& src, AliMUONVStore& dest) const;
209
7eafe398 210 void AssertStores();
211
212 Bool_t UpdateNumberOfEvents(TArrayI* nevents);
213
0145e89a 214private:
1ffbeb9d 215
49419555 216 Bool_t fIsSingleEvent; ///< whether we can deal with more than one event
0145e89a 217 AliMUONVStore* fChannelValues; ///< the channel store
218 AliMUONVStore* fManuValues; ///< the manu store
219 AliMUONVStore* fBusPatchValues; ///< the bus patch store
220 AliMUONVStore* fDEValues; ///< the detection element store
221 AliMUONVStore* fChamberValues; ///< the chamber store
222 AliMUONVStore* fPCBValues; ///< the pcb store
223 Int_t fDimension; ///< the dimension of the data
224 Int_t fNevents; ///< the number of events treated
8741815f 225 TObjArray* fDimensionNames; ///< the names of the (internal) dimensions
226 TObjArray* fExternalDimensionNames; ///< the names of the external (i.e. original) dimensions
0145e89a 227 Int_t fExternalDimension; ///< number of interface values per item
8741815f 228 /// whether we should histogram the dimension(s)
229 Int_t* fHistogramming; //[fExternalDimension] whether we should histogram the dimension(s)
0edb62c4 230 AliMUONVStore* fHistos; ///< the lowest histograms we have
10eb3d17 231 Double_t fXmin; ///< min x value for histograms
232 Double_t fXmax; ///< max x value for histograms
0145e89a 233 static const Int_t fgkExtraDimension; ///< to hold extra information
234 static const Int_t fgkVirtualExtraDimension; ///< to give access to information not stored, but computed on the fly
113ad708 235 Bool_t fIsChannelLevelEnabled; ///< whether we allow storing of channel (fChannelValues) values
236 Bool_t fIsManuLevelEnabled; ///< whether we allow storing of manu (fManuValues) values
e83120bd 237 Int_t fNofDDLs; ///< nof of DDLs we're dealing with
ea49e931 238 /// the number of events treated (per DDL)
e83120bd 239 Int_t* fNofEventsPerDDL; //[fNofDDLs] the number of events treated (per DDL)
240
241 ClassDef(AliMUONTrackerData,7) // Implementation of AliMUONVTrackerData
0145e89a 242};
243
244#endif