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