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