]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSv11GeometrySPD.h
SPD RecPoints QA (M. Nicassio)
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeometrySPD.h
1 #ifndef ALIITSV11GEOMETRYSPD_H
2 #define ALIITSV11GEOMETRYSPD_H
3
4 /* 
5  * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved.
6  * See cxx source for full Copyright notice.
7  */
8   
9  // Implementation of the SPD v11 central geometry.
10  // Contains also:
11  //  - the materials/media used for its volumes;
12  //  - settings for the related transport parameters
13  //   (GEANT3 types for the moment).
14  //
15
16 /*
17  * $Id$
18  */
19
20 #include <TGeoManager.h>
21 #include <TVirtualMC.h>
22 #include <TString.h>
23 #include <TArrayI.h>
24 #include <TPolyLine.h>
25 #include <TPolyMarker.h>
26 #include <AliITSv11Geometry.h>
27
28 class TGeoVolume;
29 class TGeoCompositeShape;
30
31 class AliITSv11GeometrySPD : public AliITSv11Geometry
32 {
33  public:
34     // Default constructor
35     AliITSv11GeometrySPD(/*Double_t gap = 0.0075*/);
36     // Standard Constructor
37     AliITSv11GeometrySPD(Int_t debug/*, Double_t gap = 0.0075*/);
38     // Copy constructor
39     AliITSv11GeometrySPD(const AliITSv11GeometrySPD &s);
40     // Assignment operator
41     AliITSv11GeometrySPD& operator=(const AliITSv11GeometrySPD &s);
42     // Destructor
43     virtual ~AliITSv11GeometrySPD() {};
44
45     /* Settings */
46
47     // define/create materials
48     virtual Int_t CreateSPDCentralMaterials(Int_t &medOffset,
49                                             Int_t &matOffset) const;
50     // set SPD Central, GEANT3 type, tracking parameters
51     virtual void InitSPDCentral(Int_t offset, TVirtualMC *mc = gMC) const;
52
53     /* Monitoring */
54
55     // creates standard figures for the documentation of this class
56     virtual void CreateFigure0(const Char_t *path = "",
57                                const Char_t *type = "gif",
58                                TGeoManager *mgr = gGeoManager) const;
59     // fill TPolylines with crossections of the SPD Carbon fiber sectors.
60     Bool_t Make2DCrossSections(TPolyLine &a0, TPolyLine &a1, TPolyLine &b0,
61                                TPolyLine &b1, TPolyMarker &p) const;
62
63     /* Services */
64
65     // get names
66     virtual const char *GetSenstiveVolumeName1() const 
67         {return "ITSSPDlay1-sensor";}
68     virtual const char *GetSenstiveVolumeName2() const 
69         {return "ITSSPDlay2-sensor";}
70     virtual const char *GetSenstiveVolumeName(Int_t lay) const
71         {return (lay==1) ? GetSenstiveVolumeName1():GetSenstiveVolumeName2();}
72     // get medium
73     virtual TGeoMedium* GetMedium(const char* mediumName,
74                                   TGeoManager *mgr = gGeoManager) const;
75     // retrieve the mounting location and rotation needed to mount an SPD stave
76     virtual Bool_t GetSectorMountingPoints(Int_t index, Double_t &x0,
77                                Double_t &y0, Double_t &x1, Double_t &y1) const;
78     // displace the staves on the carbon fiber sector
79     virtual void StavesInSector(TGeoVolume *moth,TGeoManager *mgr=gGeoManager);
80     // (debug purposes) define which staves to put in the sector
81     virtual void SetAddStave(Bool_t *mask);
82     // print class in ascii form to stream
83     virtual void PrintAscii(ostream *os) const;
84     // read in class in ascii form from stream
85     virtual void ReadAscii(istream *is);         
86
87     /* Parts of the geometry */
88
89     // a single ladder (= 1 detector + 5 chips)
90     virtual TGeoVolume* CreateLadder(Int_t layer, TArrayD &sizes,
91                                      TGeoManager *mgr = gGeoManager) const;
92     // a clip on the central ladders
93     virtual TGeoVolume* CreateClip(TArrayD &sizes,Bool_t isDummy,
94                                    TGeoManager *mgr = gGeoManager) const;
95     // the grounding foil (splitted in many components)
96     //virtual TGeoVolumeAssembly* CreateGroundingFoilSingle(Int_t type,
97     //                 TArrayD &sizes, TGeoManager *mgr = gGeoManager) const;
98     virtual  TGeoCompositeShape* CreateGroundingFoilShape(Int_t itype,
99         Double_t &length,Double_t &width,Double_t thickness,TArrayD &sizes);
100     virtual TGeoVolume* CreateGroundingFoil(Bool_t isRight, TArrayD &sizes,
101                                         TGeoManager *mgr = gGeoManager);
102     // the MCM (thin part + thick part with chips inside)
103     virtual TGeoVolumeAssembly* CreateMCM(Bool_t isRight, TArrayD &sizes,
104                                        TGeoManager *mgr = gGeoManager) const;
105     // the pixel bus (flat part + pt1000s + large capacitors/resistors)
106     virtual TGeoVolumeAssembly* CreatePixelBus(Bool_t isRight, TArrayD &sizes,
107                                         TGeoManager *mgr = gGeoManager) const;
108     // the extender complicated geometry
109     virtual TGeoVolume* CreateExtender(const Double_t *params,
110                               const TGeoMedium *medium, TArrayD &sizes) const;
111     // the Pixel Bus & extenders (old method which will be removed)
112     virtual TGeoVolumeAssembly* CreatePixelBusAndExtensions(Bool_t zpos=kTRUE,
113                                         TGeoManager *mgr = gGeoManager) const;
114     // a half-stave (put together ladders + MCM + bus, and add clips 
115     // if requested)
116     virtual TGeoVolumeAssembly* CreateHalfStave(Bool_t isRight, Int_t layer,
117                  Int_t idxCentral, Int_t idxSide,TArrayD &sizes/*,
118               Bool_t addClips = kFALSE*/, TGeoManager *mgr = gGeoManager);
119     // the whole stave (2 half-staves of different orientation)
120     virtual TGeoVolumeAssembly* CreateStave(Int_t layer, TArrayD &sizes,
121              /*Bool_t addClips = kFALSE,*/TGeoManager *mgr = gGeoManager);
122     // the complete Carbon Fiber sector (support + staves)
123     virtual void CarbonFiberSector(TGeoVolume *moth, Double_t &xAAtubeCenter0,
124                      Double_t &yAAtubeCenter0, TGeoManager *mgr = gGeoManager);
125     // the whole SPD barrel (the 10 sectors at once)
126     virtual void SPDSector(TGeoVolume *moth, TGeoManager *mgr = gGeoManager);
127     // Returns the location of the SPD cooling tube ends. RB26 (muon absober
128     // side) and RB24 (open side). Staves number 0,1 inner Staves, 2-5 outer
129     // staves. Sectors numbers 0-9.
130     virtual void GetSPDCoolingTubeRB26(Int_t sector,Int_t stave,
131                                  Double_t &x,Double_t &y,Double_t &z)const{
132                             x = fTubeEndSector[sector][1][stave][0];
133                             y = fTubeEndSector[sector][1][stave][1];
134                             z = fTubeEndSector[sector][1][stave][2];return;};
135     virtual void GetSPDCoolingTubeRB24(Int_t sector,Int_t stave,
136                                  Double_t &x,Double_t &y,Double_t &z)const{
137                             x = fTubeEndSector[sector][0][stave][0];
138                             y = fTubeEndSector[sector][0][stave][1];
139                             z = fTubeEndSector[sector][0][stave][2];return;};
140  private:
141     // NOTE:
142     // all of the member functions which define a component of the final SPD
143     // will need to be defined as private once the design is fixed and 
144     // does not need any longer to be checked and debugged.
145
146     /* Service methods for internal use only */
147
148     // compute shape of the SPD Sector given specific inputs 
149     void SPDsectorShape(Int_t n,const Double_t *xc, const Double_t *yc,
150                         const Double_t *r,const Double_t *ths,
151                         const Double_t *the, Int_t npr,Int_t &m, 
152                         Double_t **xp, Double_t **yp) const;
153     // compute a point o a line parallel to a given direction
154     // and with a fixed distance from it
155     void ParallelPosition(Double_t dist1, Double_t dist2, Double_t phi,
156                           Double_t &x, Double_t &y) const;
157     // comutes the radial translation of a sector to give the
158     // proper distance between SPD detectors and the beam pipe.
159     Double_t GetSPDSectorTranslation(Double_t x0,Double_t y0,Double_t x1,
160                                      Double_t y1,Double_t r)const;
161     Bool_t CFHolePoints(Double_t s,Double_t r1,Double_t r2,Double_t l,
162                         Double_t &x,Double_t &y)const;
163
164     /* Data members */
165
166     static const Double_t fgkGapLadder;// thicknes of the empty (air) gap left 
167                                // between the ladder and the grounding 
168                                // foil for alignment
169     static const Double_t fgkGapHalfStave;//thickness of the empty (air) gap
170                                           // left between HS and Carbon Suport
171     Bool_t  fAddStave[6];      // [DEBUG] must be TRUE for all staves
172                                // which will be mounted in the sector 
173                                // (used to check overlaps)              
174     TArrayD fSPDsectorX0;      // X of first edge of sector plane for stave
175     TArrayD fSPDsectorY0;      // Y of first edge of sector plane for stave
176     TArrayD fSPDsectorX1;      // X of second edge of sector plane for stave
177     TArrayD fSPDsectorY1;      // Y of second edge of sector plane for stave
178     //
179     Double_t fTubeEndSector[10][2][6][3]; // Location of tube end in sector
180     /* ROOT dictionary */
181
182     ClassDef(AliITSv11GeometrySPD,2) // ITS v11 Central SPD geometry
183 };
184
185 // Input and output function for standard C++ input/output.
186 ostream &operator<<(ostream &os, const AliITSv11GeometrySPD &s);
187 istream &operator>>(istream &is, AliITSv11GeometrySPD &s);
188
189 #endif