]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDGeometryBuilderSimple.cxx
TPC ALTRO mapping class
[u/mrichter/AliRoot.git] / FMD / AliFMDGeometryBuilderSimple.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 //____________________________________________________________________
19 //                                                                          
20 // Forward Multiplicity Detector based on Silicon wafers. This class
21 // contains the base procedures for the Forward Multiplicity detector
22 // Detector consists of 3 sub-detectors FMD1, FMD2, and FMD3, each of
23 // which has 1 or 2 rings of silicon sensors. 
24 //                                                       
25 // This is the base class for all FMD manager classes. 
26 //                    
27 // The actual code is done by various separate classes.   Below is
28 // diagram showing the relationship between the various FMD classes
29 // that handles the simulation
30 //
31 //      +--------+ 1     +-----------------------+ 
32 //      | AliFMD |<>-----| AliFMDGeometryBuilder |
33 //      +--------+       +-----------------------+
34 //                               ^              
35 //                               |
36 //                    +-----------------------------+
37 //                    | AliFMDGeometryBuilderSimple |
38 //                    +-----------------------------+
39 //                     
40 //
41 // *  AliFMD 
42 //    This defines the interface for the various parts of AliROOT that
43 //    uses the FMD, AliFMDDigitizer, AliFMDReconstructor, and so on. 
44 //
45 // *  AliFMDGeometryBuilder
46 //    This is the base class for the FMD geometry builder tasks. The
47 //    builder tasks are responsible to implment the geoemtry. This
48 //    defines the active volume as an ONLY XTRU shape with a divided
49 //    MANY TUBS shape inside to implement the particular shape of the
50 //    silicon sensors. 
51 //                                                                          
52 // *  AliFMDGeometryBuilderSimple
53 //    This is a concrete implementation of the AliFMDGeometryBuilder,
54 //    that defines the active elements as sections of a TUBE. 
55 //
56 #include "AliFMDGeometryBuilderSimple.h" // ALIFMDG3OLDSIMULATOR_H
57 #include "AliFMDGeometry.h"     // ALIFMDGEOMETRY_H
58 #include "AliFMDDetector.h"     // ALIFMDDETECTOR_H
59 #include "AliFMDRing.h"         // ALIFMDRING_H
60 #include "AliFMD1.h"            // ALIFMD1_H
61 #include "AliFMD2.h"            // ALIFMD2_H
62 #include "AliFMD3.h"            // ALIFMD3_H
63 #include "AliFMD.h"             // ALIFMD_H
64 #include <AliLog.h>             // ALILOG_H
65 #include <TVector2.h>           // ROOT_TVector2
66 #include <TVirtualMC.h>         // ROOT_TVirtualMC
67 #include <TArrayI.h>            // ROOT_TArrayI
68 #include <TGeoVolume.h>         // ROOT_TGeoVolume
69 #include <TGeoTube.h>           // ROOT_TGeoTube
70 #include <TGeoMatrix.h>         // ROOT_TGeoMatrix
71 #include <cmath>                // __CMATH__  
72  
73 //====================================================================
74 ClassImp(AliFMDGeometryBuilderSimple)
75 #if 0
76   ; // This is here to keep Emacs for indenting the next line
77 #endif
78
79 //____________________________________________________________________
80 AliFMDGeometryBuilderSimple::AliFMDGeometryBuilderSimple() 
81 {
82   // Default constructor
83 }
84
85 //____________________________________________________________________
86 AliFMDGeometryBuilderSimple::AliFMDGeometryBuilderSimple(Bool_t detailed) 
87   : AliFMDGeometryBuilder(detailed)
88 {
89   // Normal constructor
90   // 
91   // Parameters: 
92   // 
93   //      fmd           Pointer to AliFMD object 
94   //      detailed      Whether to make a detailed simulation or not 
95   // 
96 }
97
98 //____________________________________________________________________
99 TGeoVolume*
100 AliFMDGeometryBuilderSimple::RingGeometry(AliFMDRing* r) 
101 {
102   // Setup the geometry of a ring.    The defined TGeoVolume is
103   // returned, and should be used when setting up the rest of the
104   // volumes. 
105   // 
106   // Parameters:
107   //
108   //     r              Pointer to ring geometry object 
109   // 
110   // Returns:
111   //    true on success 
112   //
113   if (!r) { 
114     AliError("Didn't get a ring object");
115     return 0;
116   }
117   Char_t      id          = r->GetId();
118   Double_t    siThick     = r->GetSiThickness();
119   // const Int_t nv       = r->GetNVerticies();
120   //TVector2*   a           = r->GetVertex(5);
121   TVector2*   b           = r->GetVertex(3);
122   //TVector2*   c           = r->GetVertex(4);
123   Double_t    theta       = r->GetTheta();
124   //Double_t    off         = (TMath::Tan(TMath::Pi() * theta / 180) 
125   //                         * r->GetBondingWidth());
126   Double_t    rmax        = b->Mod();
127   Double_t    rmin        = r->GetLowR();
128   Double_t    pcbThick    = r->GetPrintboardThickness();
129   Double_t    copperThick = r->GetCopperThickness(); // .01;
130   Double_t    chipThick   = r->GetChipThickness(); // .01;
131   //Double_t    modSpace    = r->GetModuleSpacing();
132   //Double_t    legr        = r->GetLegRadius();
133   //Double_t    legl        = r->GetLegLength();
134   //Double_t    legoff      = r->GetLegOffset();
135   Int_t       ns          = r->GetNStrips();
136   Int_t       nsec        = Int_t(360 / theta);
137   Double_t    space       = r->GetSpacing();
138   //Double_t    stripoff    = a->Mod();
139   //Double_t    dstrip      = (rmax - stripoff) / ns;
140   TString     name;
141   TString     name2;
142   
143   Double_t ringWidth = (siThick + 2 * (pcbThick + copperThick + chipThick));
144   // Virtual volume shape to divide - This volume is only defined if
145   // the geometry is set to be detailed. 
146   // Ring mother volume 
147   TGeoShape* ringShape   = new TGeoTube(rmin, rmax, ringWidth / 2);
148   name                   =  Form(fgkRingName, id);
149   TGeoVolume* ringVolume = new TGeoVolume(name.Data(), ringShape, fAir);
150
151   TGeoShape* activeShape   = new TGeoTube(rmin, rmax, siThick / 2);
152   name                     = Form(fgkActiveName, id);
153   Double_t z               = - ringWidth / 2 + siThick / 2;
154   TGeoVolume* activeVolume = new TGeoVolume(name.Data(), activeShape, fSi);
155   ringVolume->AddNode(activeVolume, 1, new TGeoTranslation(0, 0, z));
156   
157   fSectorOff   = -1;
158   fModuleOff   = -1;
159   fRingOff     = 1;
160   fDetectorOff = 2;
161   Int_t sid = activeVolume->GetNumber();
162   if (fDetailed) {
163     fSectorOff   = 1;
164     fRingOff     = 3;
165     fDetectorOff = 4;
166     name                     = Form(fgkSectorName, id);
167     TGeoVolume* sectorVolume = activeVolume->Divide(name.Data(), 2, nsec,
168                                                     0, 0, 0, "N");
169     
170     name                     = Form(fgkStripName, id);
171     TGeoVolume* stripVolume  = sectorVolume->Divide(name.Data(), 1, ns,
172                                                     0, 0, 0, "N");
173     sid                      = stripVolume->GetNumber();
174     AliDebug(10, Form("Got volume id %d for volume %s", sid, name.Data()));
175   }
176   switch (id) {
177   case 'i':
178   case 'I': fActiveId[0] = sid; break;
179   case 'o':
180   case 'O': fActiveId[1] = sid; break;
181   }
182
183   // Shape of Printed circuit Board 
184   Double_t boardThick = (pcbThick + copperThick + chipThick);
185   TGeoShape*  boardShape  =  new TGeoTube(rmin+.1, rmax-.1, boardThick/ 2);
186   name                    =  Form(fgkPCBName, id, 'B');
187   TGeoVolume* boardVolume =  new TGeoVolume(name.Data(), boardShape, fAir);
188   z                       += siThick / 2 + space + boardThick / 2;
189   ringVolume->AddNode(boardVolume,  0, new TGeoTranslation(0, 0, z));
190   ringVolume->AddNode(boardVolume,  1, new TGeoTranslation(0,0,z+boardThick));
191
192   // PCB
193   TGeoShape*  pcbShape    = new TGeoTube(rmin+.1,rmax-.1, pcbThick / 2);
194   name                    =  Form("F%cPC", id);
195   z                       =  -boardThick / 2 + pcbThick / 2;
196   TGeoVolume* pcbVolume   = new TGeoVolume(name.Data(), pcbShape, fPCB);
197   boardVolume->AddNode(pcbVolume, 0, new TGeoTranslation(0, 0, z));
198
199   // Copper
200   TGeoShape*  cuShape     =  new TGeoTube(rmin+.1, rmax-.1, copperThick / 2);
201   name                    =  Form("F%cCO", id);
202   z                       += pcbThick / 2 + copperThick / 2;
203   TGeoVolume* cuVolume    =  new TGeoVolume(name.Data(), cuShape, fCopper);
204   boardVolume->AddNode(cuVolume, 0, new TGeoTranslation(0, 0, z));
205
206   // Chip
207   TGeoShape*  chipShape   = new TGeoTube(rmin+.1, rmax-.1, chipThick / 2);
208   name                    =  Form("F%cCH", id);
209   z                       += copperThick / 2 + chipThick / 2;
210   TGeoVolume* chipVolume  = new TGeoVolume(name.Data(), chipShape, fChip);
211   boardVolume->AddNode(chipVolume, 0, new TGeoTranslation(0, 0, z));
212
213   return ringVolume;
214 }
215
216 //____________________________________________________________________
217 //
218 // EOF
219 //