]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALSpaceFrame.cxx
f9b859a5a8384359a46fe3f3cd6c96cbe24c9a83
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALSpaceFrame.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 #include <TVirtualMC.h>
17 #include <TGeoManager.h>
18 #include <TGeoVolume.h>
19 #include <TGeoMedium.h>
20 #include <TGeoMatrix.h>
21 #include <TGeoVolume.h>
22 #include <TGeoTube.h>
23 #include <TGeoCone.h>
24 #include <TGeoPcon.h>
25 #include <TGeoCompositeShape.h>
26
27 #include "AliConst.h"
28 #include "AliEMCALSpaceFrame.h"
29 #include "AliMagF.h"
30 #include "AliRun.h"
31 #include "AliLog.h"
32  
33 ClassImp(AliEMCALSpaceFrame)
34  
35 //_____________________________________________________________________________
36 AliEMCALSpaceFrame::AliEMCALSpaceFrame() 
37   : TNamed("EMCALSpaceFrame","Steel Space Frame that supports EMCAL"),
38     fNumCross(0),
39     fNumSubSets(0),
40     fTotalHalfWidth(0.),
41     fBeginPhi(0.),
42     fEndPhi(0.),
43     fTotalPhi(0.),
44     fBeginRadius(0.),
45     fHalfFrameTrans(0.),
46     fFlangeHeight(0.),
47     fFlangeWidth(0.),
48     fRibHeight(0.),
49     fRibWidth(0.),
50     fCrossBottomWidth(0.),
51     fCrossTopWidth(0.),
52     fCrossBottomHeight(0.),
53     fCrossBottomRadThick(0.),
54     fCrossBeamArcLength(0.),
55     fCrossBottomStartRadius(0.),
56     fCrossTopHeight(0.),
57     fCrossTopRadThick(0.),
58     fCrossTopStart(0.),
59     fEndRadius(0.),
60     fEndBeamRadThick(0),
61     fEndBeamBeginRadius(0)
62 {
63   // default constructor for EMCAL Space Frame
64   //initialize parameters
65   fNumCross = 12; 
66   fNumSubSets = 3;
67   fTotalHalfWidth = 152.3;   // Half Width of a Half Frame
68                              // (CalFrame comes in 2 sections) 
69   fBeginPhi = 76.8;
70   fEndPhi = 193.03;
71   fBeginRadius = 490.;
72   
73   fHalfFrameTrans = fTotalHalfWidth+57.2/2.;  // Half Frame Connector is 57.2cm wide,
74                             // Supermodule is 340cm wide
75                             // Sources: HALF-FRAME-CONNECTOR-27E226A.pdf
76                             // provided by LBL
77
78   fFlangeWidth = 15.2;
79   fRibWidth = 1.5;
80   fCrossBottomHeight = 15.2;
81   fCrossBottomRadThick = 1.5;
82   fCrossTopHeight = 1.5;
83   fCrossTopRadThick = 35./2.;
84
85   fTotalPhi = fEndPhi - fBeginPhi;
86   fFlangeHeight = fBeginRadius + 3.;
87   fRibHeight = fFlangeHeight + 35;
88   fCrossBottomWidth = 0.5/(Double_t)fNumSubSets * (2.*fTotalHalfWidth - 8. * fFlangeWidth);
89   fCrossTopWidth = fCrossBottomWidth; // fCrossBottomWidth + fFlangeWidth - fRibWidth;
90                                       // for future release pending
91                                       // overlap correction - new TGeoVolume creation
92
93   fCrossBeamArcLength = (112.62597)/(fNumCross-1)-.001; // To account for shape of TGeoBBox
94   fCrossBottomStartRadius = fBeginRadius + fCrossBottomRadThick;
95   fCrossTopStart = fBeginRadius + 2.*fCrossBottomRadThick + fCrossTopRadThick+0.015; // 0.015 is a 
96                                                                                      // bubblegum and duct tape
97                                                                                      // fix for an overlap problem
98                                                                                      // will be worked out in future releases 
99   fEndRadius = fRibHeight+1.15;
100   fEndBeamRadThick = fCrossBottomRadThick+fCrossTopRadThick;
101   fEndBeamBeginRadius = fBeginRadius + fEndBeamRadThick;
102 }
103
104 //_____________________________________________________________________________
105 AliEMCALSpaceFrame::AliEMCALSpaceFrame(const AliEMCALSpaceFrame &frame) 
106   : TNamed(frame.GetName(),frame.GetTitle()),
107     fNumCross(frame.fNumCross),
108     fNumSubSets(frame.fNumSubSets),
109     fTotalHalfWidth(frame.fTotalHalfWidth),
110     fBeginPhi(frame.fBeginPhi),
111     fEndPhi(frame.fEndPhi),
112     fTotalPhi(frame.fTotalPhi),
113     fBeginRadius(frame.fBeginRadius),
114     fHalfFrameTrans(frame.fHalfFrameTrans),
115     fFlangeHeight(frame.fFlangeHeight),
116     fFlangeWidth(frame.fFlangeWidth),
117     fRibHeight(frame.fRibHeight),
118     fRibWidth(frame.fRibWidth),
119     fCrossBottomWidth(frame.fCrossBottomWidth),
120     fCrossTopWidth(frame.fCrossTopWidth),
121     fCrossBottomHeight(frame.fCrossBottomHeight),
122     fCrossBottomRadThick(frame.fCrossBottomRadThick),
123     fCrossBeamArcLength(frame.fCrossBeamArcLength),
124     fCrossBottomStartRadius(frame.fCrossBottomStartRadius),
125     fCrossTopHeight(frame.fCrossTopHeight),
126     fCrossTopRadThick(frame.fCrossTopRadThick),
127     fCrossTopStart(frame.fCrossTopStart),
128     fEndRadius(frame.fEndRadius),
129     fEndBeamRadThick(frame.fEndBeamRadThick),
130     fEndBeamBeginRadius(frame.fEndBeamBeginRadius)
131 {
132   // copy constructor for EMCAL Space Frame
133
134 }
135
136 //_____________________________________________________________________________
137 void AliEMCALSpaceFrame::CreateGeometry()
138 {
139   // create geometry
140   
141   AliDebug(1,"Create CalFrame Geometry");
142   //////////////////////////////////////Setup/////////////////////////////////////////
143   TGeoVolume* top = gGeoManager->GetVolume("ALIC");
144   TGeoMedium *steel = gGeoManager->GetMedium("EMCAL_S steel$");
145   TGeoMedium *air = gGeoManager->GetMedium("EMCAL_Air$");
146
147         
148   //////////////////////////////////// Volumes ///////////////////////////////////////  
149   TGeoVolume *calFrameMO = 
150     gGeoManager->MakeTubs("CalFrame", air, fBeginRadius-2.1,fEndRadius,
151                           fTotalHalfWidth*3,fBeginPhi-3,fEndPhi+3);     // Mother Volume
152
153   calFrameMO->SetVisibility(kFALSE);
154
155   // Half Frame Mother Volume
156   TGeoVolume *calHalfFrameMO = 
157     gGeoManager->MakeTubs("HalfFrame", air, fBeginRadius-2,fEndRadius,
158                           fTotalHalfWidth,fBeginPhi-2.9,fEndPhi+2.9);
159
160   calHalfFrameMO->SetVisibility(kFALSE);
161
162   TGeoVolume *endBeams = 
163     gGeoManager->MakeBox("End Beams", steel, fEndBeamRadThick, fCrossTopHeight, fTotalHalfWidth); // End Beams
164
165   TGeoVolume *skin = 
166     gGeoManager->MakeTubs("skin", steel, fRibHeight+0.15, fEndRadius, 
167                           fTotalHalfWidth, fBeginPhi, fEndPhi);// back frame
168
169   TGeoVolume *flangeVolume = 
170     gGeoManager->MakeTubs("supportBottom", steel, fBeginRadius, fFlangeHeight, 
171                           fFlangeWidth, fBeginPhi, fEndPhi);            // FlangeVolume Beams
172
173   TGeoVolume *ribVolume = 
174     gGeoManager->MakeTubs("RibVolume", steel, fFlangeHeight, fRibHeight, fRibWidth, fBeginPhi, fEndPhi);
175
176   TGeoVolume *subSetCross = 
177     gGeoManager->MakeTubs("subSetCross", air, fBeginRadius-1,  fBeginRadius+2*fCrossBottomRadThick+
178                           2*fCrossTopRadThick+0.15, fCrossBottomWidth, fBeginPhi, fEndPhi);             // Cross Beam Containers
179   subSetCross->SetVisibility(kFALSE);
180   /*                                            // Obsolete for now
181   TGeoVolume *subSetCrossTop = 
182     gGeoManager->MakeTubs("SubSetCrossTop", air, fBeginRadius+2*fCrossBottomRadThick-1, fBeginRadius+2*fCrossBottomRadThick+
183                           2*fCrossTopRadThick+1, fCrossTopWidth, fBeginPhi, fEndPhi);   // Cross 
184   subSetCrossTop->SetVisibility(kFALSE);
185   */                    
186   TGeoVolume *crossBottomBeams = 
187     gGeoManager->MakeBox("crossBottom", steel, fCrossBottomRadThick, fCrossBottomHeight, fCrossBottomWidth); // Cross Beams
188
189   TGeoVolume *crossTopBeams = 
190     gGeoManager->MakeBox("crossTop", steel, fCrossTopRadThick, fCrossTopHeight, fCrossTopWidth); // Cross Beams
191   
192   TGeoTranslation *trTEST = new TGeoTranslation();
193   TGeoRotation *rotTEST = new TGeoRotation();
194   
195   Double_t conv = TMath::Pi()/180.;
196   Double_t radAngle = 0;
197   Double_t endBeamParam=.4;
198   //cout<<"\nfCrossBottomStartRadius: "<<fCrossBottomStartRadius<<"\n";
199   
200   for(Int_t i = 0; i < fNumCross; i++){
201     
202     Double_t loopPhi = fBeginPhi + 1.8;
203
204     // Cross Bottom Beams
205     
206     radAngle = (loopPhi + i*fCrossBeamArcLength)*conv; 
207     
208     rotTEST->SetAngles(fBeginPhi + i*fCrossBeamArcLength, 0, 0); //  SetTranslation(Double_t dx, Double_t dy, Double_t dz);
209     trTEST->SetTranslation(cos(radAngle)*fCrossBottomStartRadius, sin(radAngle)*fCrossBottomStartRadius,0);
210
211     TGeoCombiTrans *combo = new TGeoCombiTrans(*trTEST, *rotTEST);      // TGeoTranslation &tr, const TGeoRotation &rot);
212     combo->RegisterYourself();
213     crossBottomBeams->SetVisibility(1);
214     subSetCross->AddNode(crossBottomBeams, i+1, combo);
215     if (i != 0 && i!=fNumCross-1){
216     // Cross Bottom Beams
217     rotTEST->SetAngles(fBeginPhi + i*fCrossBeamArcLength, 0, 0); //  SetTranslation(Double_t dx, Double_t dy, Double_t dz);
218     trTEST->SetTranslation(cos(radAngle)*fCrossTopStart, sin(radAngle)*fCrossTopStart,0);
219     crossTopBeams->SetVisibility(1);
220     subSetCross->AddNode(crossTopBeams, i+1,  new TGeoCombiTrans(*trTEST, *rotTEST));
221     }
222     
223
224     else if(i ==0){
225                 rotTEST->SetAngles(fBeginPhi + i*fCrossBeamArcLength, 0, 0); //  SetTranslation(Double_t dx, Double_t dy, Double_t dz);
226     trTEST->SetTranslation(cos((77-endBeamParam)*conv)*(fEndBeamBeginRadius), sin((77-endBeamParam)*conv)*(fEndBeamBeginRadius),0);
227     endBeams->SetVisibility(1);
228     calHalfFrameMO->AddNode(endBeams, 1,  new TGeoCombiTrans(*trTEST, *rotTEST));
229     }
230     else{
231     rotTEST->SetAngles(193.03, 0, 0); //  SetTranslation(Double_t dx, Double_t dy, Double_t dz);
232     trTEST->SetTranslation(cos((193.03+endBeamParam)*conv)*(fEndBeamBeginRadius)/*more duct tape*/, sin((193.03+endBeamParam)*conv)*(fEndBeamBeginRadius),0);
233     endBeams->SetVisibility(1);
234     calHalfFrameMO->AddNode(endBeams, 2,  new TGeoCombiTrans(*trTEST, *rotTEST));
235     }  
236   }
237   
238   //Beam Containers
239
240   // Translations 
241
242   TGeoTranslation *origin1 = new TGeoTranslation(0,0,0); // Equivalent to gGeoIdentity
243   TGeoTranslation *origin2 = new TGeoTranslation(0,0,2*(fCrossBottomWidth+fFlangeWidth));
244   TGeoTranslation *origin3 = new TGeoTranslation(0,0,-2*(fCrossBottomWidth+fFlangeWidth));
245
246   // FlangeVolume translations  
247   TGeoTranslation *str1 = new TGeoTranslation(0,0,-3*(fCrossBottomWidth+fFlangeWidth));
248   TGeoTranslation *str2 = new TGeoTranslation(0,0,-(fCrossBottomWidth+fFlangeWidth));
249   TGeoTranslation *str3 = new TGeoTranslation(0,0,(fCrossBottomWidth+fFlangeWidth));
250   TGeoTranslation *str4 = new TGeoTranslation(0,0,3*(fCrossBottomWidth+fFlangeWidth));
251
252   // Half Frame Translations
253   TGeoTranslation *halfTrans1 =  new TGeoTranslation(0,0,fHalfFrameTrans);
254   TGeoTranslation *halfTrans2 =  new TGeoTranslation(0,0,-fHalfFrameTrans);
255
256   // Beams Volume 
257   calHalfFrameMO->AddNode(flangeVolume, 1, str1);
258   calHalfFrameMO->AddNode(flangeVolume, 2, str2);
259   calHalfFrameMO->AddNode(flangeVolume, 3, str3);
260   calHalfFrameMO->AddNode(flangeVolume, 4, str4);
261   
262   calHalfFrameMO->AddNode(ribVolume, 1, str1);
263   calHalfFrameMO->AddNode(ribVolume, 2, str2);
264   calHalfFrameMO->AddNode(ribVolume, 3, str3);
265   calHalfFrameMO->AddNode(ribVolume, 4, str4);
266   
267   // Cross Beams  
268   calHalfFrameMO->AddNode(subSetCross, 1, origin1);
269   calHalfFrameMO->AddNode(subSetCross, 2, origin2);
270   calHalfFrameMO->AddNode(subSetCross, 3, origin3);
271 /*                                      // Obsolete for now
272   calHalfFrameMO->AddNode(subSetCrossTop, 1, origin1);
273   calHalfFrameMO->AddNode(subSetCrossTop, 2, origin2);
274   calHalfFrameMO->AddNode(subSetCrossTop, 3, origin3);
275 */
276
277   calHalfFrameMO->AddNode(skin, 1, gGeoIdentity);
278   
279   calFrameMO->AddNode(calHalfFrameMO, 1, halfTrans1);
280   calFrameMO->AddNode(calHalfFrameMO, 2, halfTrans2);
281  
282   top->AddNode(calFrameMO,1,gGeoIdentity);
283 //  cout<<"**********************************\nfEndRadius:\t"<<fEndRadius;
284 }
285