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