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