]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONGeometrySegmentation.h
Refactoring of geometry & segmenation classes:
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometrySegmentation.h
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2  * See cxx source for full Copyright notice                               */
3
4 /* $Id$ */
5
6 /// \ingroup geometry
7 /// \class AliMUONGeometrySegmentation
8 /// \brief Segmentation for a geometry module 
9 /// 
10 /// New class for the geometry segmentation 
11 /// composed of the segmentations of detection elements.
12 /// Applies transformations defined in geometry.
13 ///
14 /// Author:Ivana Hrivnacova, IPN Orsay
15
16 #ifndef ALI_MUON_GEOMETRY_SEGMENTATION_H
17 #define ALI_MUON_GEOMETRY_SEGMENTATION_H
18
19 #include <TObject.h>
20
21 #include "AliMUONGeometryDirection.h"
22
23 class TObjArray;
24 class TF1;
25
26 class AliMUONGeometryModuleTransformer;
27 class AliMUONGeometryStore;
28 class AliMUONGeometryDetElement;
29 class AliMUONVGeometryDESegmentation;
30 class AliMUONSegmentManuIndex;
31
32 class AliMUONGeometrySegmentation : public TObject
33 {
34   public:
35     AliMUONGeometrySegmentation(
36            const AliMUONGeometryModuleTransformer* geometry);
37     AliMUONGeometrySegmentation();
38     virtual ~AliMUONGeometrySegmentation();
39
40     // Methods
41     //
42     void Add(Int_t detElemId, const TString& detElemName,
43              AliMUONVGeometryDESegmentation* segmentation); 
44  
45     // Get methods
46     //
47     const AliMUONGeometryModuleTransformer* GetTransformer() const;
48                        // Geometry transformer        
49  
50     const AliMUONVGeometryDESegmentation* GetDESegmentation(
51                                             Int_t detElemId) const;
52                        // DE segmentation
53     
54     AliMUONGeometryDirection GetDirection(Int_t detElemId) const;
55                        // Direction with a constant pad size  
56                        // (Direction or coordinate where the resolution is the best)
57     
58     TString GetDEName(Int_t detElemId) const;                  
59                        // DE name
60
61     // Redefined methods from AliSegmentation interface
62     // 
63
64     // Set Chamber Segmentation Parameters
65     //
66     virtual void SetPadSize(Float_t p1, Float_t p2);
67                        // Pad size Dx*Dy 
68     virtual void SetDAnod(Float_t D);
69                        // Anode Pitch
70
71     // Transform from pad (wire) to real coordinates and vice versa
72     //
73     virtual Float_t GetAnod(Int_t detElemId, Float_t xlhit) const;
74                        // Anode wire coordinate closest to xhit
75     virtual Bool_t  GetPadI(Int_t detElemId,
76                           Float_t xg, Float_t yg, Float_t  zg, 
77                           Int_t& ix, Int_t& iy);
78                        // Transform from pad to real coordinates
79     virtual Bool_t  GetPadC(Int_t detElemId,
80                           Int_t ix, Int_t iy,
81                           Float_t& x, Float_t& y, Float_t& z);
82                        // Transform from real to pad coordinates
83
84     virtual Bool_t HasPad(Int_t detElemId, Int_t ix, Int_t iy);
85   
86     // Initialisation
87     //
88     virtual void Init(Int_t chamber);
89  
90     // Get member data
91     //
92     virtual Float_t Dpx(Int_t detElemId) const;
93     virtual Float_t Dpy(Int_t detElemId) const ;
94                       // Pad size in x, y 
95     virtual Float_t Dpx(Int_t detElemId, Int_t isector) const;
96     virtual Float_t Dpy(Int_t detElemId, Int_t isector) const;
97                       // Pad size in x, y by Sector 
98     virtual Int_t   Npx(Int_t detElemId) const;
99     virtual Int_t   Npy(Int_t detElemId) const;
100                       // Maximum number of Pads in y
101
102     virtual void  SetPad(Int_t detElemId, Int_t ix, Int_t iy);
103                       // Set pad position
104     virtual void  SetHit(Int_t detElemId, Float_t xghit, Float_t yghit, Float_t zghit);
105                       // Set hit position
106     
107     // Iterate over pads
108     //    
109     virtual void  FirstPad(Int_t detElemId, 
110                            Float_t xghit, Float_t yghit, Float_t zghit, 
111                            Float_t dx, Float_t dy);
112     virtual void  NextPad(Int_t detElemId);
113     virtual Int_t MorePads(Int_t detElemId);
114
115     virtual Float_t Distance2AndOffset(Int_t detElemId,
116                            Int_t ix, Int_t iy, 
117                            Float_t xg, Float_t yg, Float_t zg, 
118                            Int_t* dummy);
119                       // Distance between 1 pad and a position
120     virtual void GetNParallelAndOffset(Int_t detElemId,
121                            Int_t ix, Int_t iy,
122                            Int_t* nparallel, Int_t* offset);
123                       // Number of pads read in parallel and offset to add to x 
124                       // (specific to LYON, but mandatory for display)
125     virtual void Neighbours(Int_t detElemId,
126                             Int_t ix, Int_t iy,
127                             Int_t* nlist, Int_t xlist[10], Int_t ylist[10]);
128                       // Get next neighbours 
129
130     // Current values
131     //
132     virtual Int_t  Ix();
133     virtual Int_t  Iy();
134     virtual Int_t  DetElemId();
135                      // Current pad cursor during disintegration
136                      // x, y-coordinate
137     virtual Int_t  ISector();
138                     // current sector
139
140     virtual Int_t  Sector(Int_t detElemId,
141                           Int_t ix, Int_t iy);
142     virtual Int_t  Sector(Int_t detElemId,
143                           Float_t xg, Float_t yg, Float_t zg);
144                     // calculate sector from pad coordinates
145
146     virtual void  IntegrationLimits(Int_t detElemId,
147                           Float_t& x1, Float_t& x2,
148                           Float_t& y1, Float_t& y2);
149                    // Current integration limits 
150
151     // Signal Generation
152     //
153     virtual Int_t SigGenCond(Int_t detElemId,
154                           Float_t xg, Float_t yg, Float_t zg);
155                     // Signal Generation Condition during Stepping
156     virtual void  SigGenInit(Int_t detElemId,
157                           Float_t xg, Float_t yg, Float_t zg);
158                     // Initialise signal generation at coord (x,y,z)
159                     
160     
161     virtual void GiveTestPoints(Int_t detElemId,
162                           Int_t& n, Float_t* xg, Float_t* yg) const;
163                    // Test points for auto calibration
164     virtual void Draw(const char *opt = "");
165     virtual void Draw(Int_t detElemId, const char *opt = "");
166                    // Draw the segmentation zones
167
168     // Function for systematic corrections
169     //
170     virtual void SetCorrFunc(Int_t detElemId,
171                           Int_t isec,  TF1* func);
172                    // Set the correction function
173     virtual TF1* CorrFunc(Int_t detElemId, Int_t isec) const;
174                    // Get the correction Function
175     // Printing
176     //
177     virtual void Print(Option_t* opt = "") const;
178         
179   protected:
180     AliMUONGeometrySegmentation(const AliMUONGeometrySegmentation& rhs);
181   
182     // operators
183     AliMUONGeometrySegmentation& operator=(const AliMUONGeometrySegmentation & rhs);
184
185   private:
186     // methods
187     Bool_t OwnNotify(Int_t detElemId) const;
188
189     // static data members
190     static  const Float_t  fgkMaxDistance; // the big value passed to pad coordinates
191                                            // if pad does not exist
192   
193     // data members
194     mutable  Int_t                           fCurrentDetElemId;   // current DE ID 
195     mutable  AliMUONGeometryDetElement*      fCurrentDetElement;  // current detection element 
196     mutable  AliMUONVGeometryDESegmentation* fCurrentSegmentation;// current DE segmentation
197    
198     const AliMUONGeometryModuleTransformer*  fkModuleTransformer; // associated geometry transformer
199     AliMUONGeometryStore*        fDESegmentations;// DE segmentations
200     AliMUONGeometryStore*        fDENames;        // DE names
201     
202  
203    ClassDef(AliMUONGeometrySegmentation,2) // Geometry segmentation
204 };
205
206 // inline functions
207
208 inline 
209 const AliMUONGeometryModuleTransformer* 
210 AliMUONGeometrySegmentation::GetTransformer() const
211 { return fkModuleTransformer; }       
212
213 #endif //ALI_MUON_GEOMETRY_SEGMENTATION_H
214
215
216
217
218
219
220
221