]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/AliITSv11GeometryUpgrade.cxx
adding debug info on vertex selection
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSv11GeometryUpgrade.cxx
CommitLineData
29998a6e 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//*************************************************************************
17// This class Defines the Geometry for the ITS Upgrade using TGeo
18// This is a work class used to study different configurations
19// during the development of the new ITS structure.
20//
21// Mario Sitta <sitta@to.infn.it>
22//*************************************************************************
23
24
25/* $Id: AliITSv11GeometryUpgrade.cxx */
26// General Root includes
27#include <TMath.h>
28// Root Geometry includes
29//#include <AliLog.h>
30#include <TGeoManager.h>
31#include <TGeoVolume.h>
32#include <TGeoPcon.h>
33#include <TGeoCone.h>
34#include <TGeoTube.h> // contaings TGeoTubeSeg
35#include <TGeoArb8.h>
36#include <TGeoXtru.h>
37#include <TGeoCompositeShape.h>
38#include <TGeoMatrix.h>
39#include "AliITSv11GeometryUpgrade.h"
40
41const Double_t AliITSv11GeometryUpgrade::fgkDefaultSensorThick = 300*fgkmicron;
42const Double_t AliITSv11GeometryUpgrade::fgkDefaultLadderThick = 1*fgkcm;
43
44ClassImp(AliITSv11GeometryUpgrade)
45
46#define SQ(A) (A)*(A)
47
48//________________________________________________________________________
49AliITSv11GeometryUpgrade::AliITSv11GeometryUpgrade():
50 AliITSv11Geometry(),
51 fLayerNumber(0),
52 fLayRadius(0),
53 fZLength(0),
54 fSensorThick(0),
55 fLadderThick(0),
56 fLadderWidth(0),
57 fLadderTilt(0),
58 fNLadders(0),
59 fNModules(0),
60 fIsTurbo(0)
61{
62 //
63 // Standard constructor
64 //
65}
66
67//________________________________________________________________________
68AliITSv11GeometryUpgrade::AliITSv11GeometryUpgrade(Int_t debug):
69 AliITSv11Geometry(debug),
70 fLayerNumber(0),
71 fLayRadius(0),
72 fZLength(0),
73 fSensorThick(0),
74 fLadderThick(0),
75 fLadderWidth(0),
76 fLadderTilt(0),
77 fNLadders(0),
78 fNModules(0),
79 fIsTurbo(0)
80{
81 //
82 // Constructor setting debugging level
83 //
84}
85
86//________________________________________________________________________
87AliITSv11GeometryUpgrade::AliITSv11GeometryUpgrade(Int_t lay, Int_t debug):
88 AliITSv11Geometry(debug),
89 fLayerNumber(lay),
90 fLayRadius(0),
91 fZLength(0),
92 fSensorThick(0),
93 fLadderThick(0),
94 fLadderWidth(0),
95 fLadderTilt(0),
96 fNLadders(0),
97 fNModules(0),
98 fIsTurbo(0)
99{
100 //
101 // Constructor setting layer number and debugging level
102 //
103}
104
105//________________________________________________________________________
106AliITSv11GeometryUpgrade::AliITSv11GeometryUpgrade(Int_t lay, Bool_t turbo, Int_t debug):
107 AliITSv11Geometry(debug),
108 fLayerNumber(lay),
109 fLayRadius(0),
110 fZLength(0),
111 fSensorThick(0),
112 fLadderThick(0),
113 fLadderWidth(0),
114 fLadderTilt(0),
115 fNLadders(0),
116 fNModules(0),
117 fIsTurbo(turbo)
118{
119 //
120 // Constructor setting layer number and debugging level
121 // for a "turbo" layer (i.e. where ladders overlap in phi)
122 //
123}
124
125//________________________________________________________________________
126AliITSv11GeometryUpgrade::AliITSv11GeometryUpgrade(const AliITSv11GeometryUpgrade &s):
127 AliITSv11Geometry(s.GetDebug()),
128 fLayerNumber(s.fLayerNumber),
129 fLayRadius(s.fLayRadius),
130 fZLength(s.fZLength),
131 fSensorThick(s.fSensorThick),
132 fLadderThick(s.fLadderThick),
133 fLadderWidth(s.fLadderWidth),
134 fLadderTilt(s.fLadderTilt),
135 fNLadders(s.fNLadders),
136 fNModules(s.fNModules),
137 fIsTurbo(s.fIsTurbo)
138{
139 //
140 // Copy constructor
141 //
142}
143
144//________________________________________________________________________
145AliITSv11GeometryUpgrade& AliITSv11GeometryUpgrade::operator=(const AliITSv11GeometryUpgrade &s)
146{
147 //
148 // Assignment operator
149 //
150 if(&s == this) return *this;
151
152 fLayerNumber = s.fLayerNumber;
153 fLayRadius = s.fLayRadius;
154 fZLength = s.fZLength;
155 fSensorThick = s.fSensorThick;
156 fLadderThick = s.fLadderThick;
157 fLadderWidth = s.fLadderWidth;
158 fLadderTilt = s.fLadderTilt;
159 fNLadders = s.fNLadders;
160 fNModules = s.fNModules;
161 fIsTurbo = s.fIsTurbo;
162
163 return *this;
164}
165
166//________________________________________________________________________
167AliITSv11GeometryUpgrade::~AliITSv11GeometryUpgrade() {
168 //
169 // Destructor
170 //
171}
172
173//________________________________________________________________________
174void AliITSv11GeometryUpgrade::CreateLayer(TGeoVolume *moth,
175 const TGeoManager *mgr){
176//
177// Creates the actual Layer and places inside its mother volume
178//
179// Input:
180// moth : the TGeoVolume owing the volume structure
181// mgr : the GeoManager (used only to get the proper material)
182//
183// Output:
184//
185// Return:
186//
187// Created: 17 Jun 2011 Mario Sitta
188// Updated: 08 Jul 2011 Mario Sitta
189//
190
191
192 // Local variables
193 char volname[30];
194 Double_t rmin, rmax;
195 Double_t xpos, ypos, zpos;
196 Double_t alpha;
197
198
199 // Check if the user set the proper parameters
200 if (fLayRadius <= 0) AliFatal(Form("Wrong layer radius (%f)",fLayRadius));
201 if (fZLength <= 0) AliFatal(Form("Wrong layer length (%f)",fZLength));
202 if (fNLadders <= 0) AliFatal(Form("Wrong number of ladders (%d)",fNLadders));
203 if (fNModules <= 0) AliFatal(Form("Wrong number of modules (%d)",fNModules));
204
205 if (fLadderThick <= 0) {
206 AliInfo(Form("Ladder thickness wrong or not set (%f), using default (%f)",
207 fLadderThick,fgkDefaultLadderThick));
208 fLadderThick = fgkDefaultLadderThick;
209 }
210
211 if (fSensorThick <= 0) {
212 AliInfo(Form("Sensor thickness wrong or not set (%f), using default (%f)",
213 fSensorThick,fgkDefaultSensorThick));
214 fSensorThick = fgkDefaultSensorThick;
215 }
216
217 if (fSensorThick > fLadderThick) {
218 AliWarning(Form("Sensor thickness (%f) is greater than ladder thickness (%f), fixing",
219 fSensorThick,fLadderThick));
220 fSensorThick = fLadderThick;
221 }
222
223
224 // If a Turbo layer is requested, do it and exit
225 if (fIsTurbo) {
226 CreateLayerTurbo(moth, mgr);
227 return;
228 }
229
230
231 // First create the ladder container
232 alpha = (360./(2*fNLadders))*TMath::DegToRad();
233 fLadderWidth = fLayRadius*TMath::Tan(alpha);
234
235 rmin = 0.98*fLayRadius;
236 rmax = 1.02*TMath::Sqrt( fLadderWidth*fLadderWidth +
237 (rmin+fLadderThick)*(rmin+fLadderThick) );
238
239 TGeoTube *layer = new TGeoTube(rmin, rmax, 0.5*fZLength);
240
241
242 // We have all shapes: now create the real volumes
243 TGeoMedium *medAir = mgr->GetMedium("ITS_AIR$");
244
245 snprintf(volname, 30, "ITSupgLayer%d", fLayerNumber);
246 TGeoVolume *layVol = new TGeoVolume(volname, layer, medAir);
247
248// layVol->SetVisibility(kFALSE);
249 layVol->SetVisibility(kTRUE);
250 layVol->SetLineColor(1);
251
252 TGeoVolume *laddVol = CreateLadder();
253
254
255 // Now build up the layer
256 alpha = 360./fNLadders;
257 Double_t r = fLayRadius + ((TGeoBBox*)laddVol->GetShape())->GetDY();
258 for (Int_t j=0; j<fNLadders; j++) {
259 Double_t theta = j*alpha;
260 xpos = r*SinD(theta);
261 ypos = r*CosD(theta);
262 zpos = 0.;
263 layVol->AddNode(laddVol, j+1, new TGeoCombiTrans( xpos, ypos, zpos,
264 new TGeoRotation("",-theta,0,0)));
265 }
266
267
268 // Finally put everything in the mother volume
269 moth->AddNode(layVol, 1, 0);
270
271
272 // Upgrade geometry is served
273 return;
274}
275
276//________________________________________________________________________
277void AliITSv11GeometryUpgrade::CreateLayerTurbo(TGeoVolume *moth,
278 const TGeoManager *mgr){
279//
280// Creates the actual Layer and places inside its mother volume
281// A so-called "turbo" layer is a layer where ladders overlap in phi
282// User can set width and tilt angle, no check is performed here
283// to avoid volume overlaps
284//
285// Input:
286// moth : the TGeoVolume owing the volume structure
287// mgr : the GeoManager (used only to get the proper material)
288//
289// Output:
290//
291// Return:
292//
293// Created: 08 Jul 2011 Mario Sitta
294//
295
296
297 // Local variables
298 char volname[30];
299 Double_t rmin, rmax, rladd, d;
300 Double_t xpos, ypos, zpos;
301 Double_t alpha, gamma;
302
303
304 // Check if the user set the proper (remaining) parameters
305 if (fLadderWidth <= 0)
306 AliFatal(Form("Wrong ladder width (%f)",fLadderWidth));
307 if (TMath::Abs(fLadderTilt) > 45)
308 AliWarning(Form("Ladder tilt angle (%f) greater than 45deg",fLadderTilt));
309
310
311 // First create the ladder container
312 // d is half the diagonal of the ladder section
313 // rladd is the radius at the ladder's center-of-gravity
314 // alpha here is the angle between the diagonal and the ladder basis
315 d = 0.5*TMath::Sqrt(fLadderThick*fLadderThick + fLadderWidth*fLadderWidth);
316 alpha = TMath::ACos(0.5*fLadderThick/d)*TMath::RadToDeg();
317 gamma = 90. - alpha - fLadderTilt;
318 rladd = fLayRadius + 0.5*fLadderThick;
319
320 rmin = 0.98*TMath::Sqrt( rladd*rladd + d*d - 2*rladd*d*CosD(gamma) );
321 rmax = 1.02*TMath::Sqrt( rladd*rladd + d*d + 2*rladd*d*CosD(gamma) );
322
323 TGeoTube *layer = new TGeoTube(rmin, rmax, 0.5*fZLength);
324
325
326 // We have all shapes: now create the real volumes
327 TGeoMedium *medAir = mgr->GetMedium("ITS_AIR$");
328
329 snprintf(volname, 30, "ITSupgLayer%d", fLayerNumber);
330 TGeoVolume *layVol = new TGeoVolume(volname, layer, medAir);
331
332// layVol->SetVisibility(kFALSE);
333 layVol->SetVisibility(kTRUE);
334 layVol->SetLineColor(1);
335
336 TGeoVolume *laddVol = CreateLadder();
337
338
339 // Now build up the layer
340
341
342 // Now build up the layer
343 alpha = 360./fNLadders;
344 Double_t r = fLayRadius + ((TGeoBBox*)laddVol->GetShape())->GetDY();
345 for (Int_t j=0; j<fNLadders; j++) {
346 Double_t theta = j*alpha;
347 xpos = r*SinD(theta);
348 ypos = r*CosD(theta);
349 zpos = 0.;
350 layVol->AddNode(laddVol, j+1, new TGeoCombiTrans( xpos, ypos, zpos,
351 new TGeoRotation("",-theta+fLadderTilt,0,0)));
352 }
353
354
355 // Finally put everything in the mother volume
356 moth->AddNode(layVol, 1, 0);
357
358 return;
359}
360
361//________________________________________________________________________
362TGeoVolume* AliITSv11GeometryUpgrade::CreateLadder(const TGeoManager *mgr){
363//
364// Creates the actual Ladder
365//
366// Input:
367// mgr : the GeoManager (used only to get the proper material)
368//
369// Output:
370//
371// Return:
372//
373// Created: 22 Jun 2011 Mario Sitta
374//
375
376 char volname[30];
377 Double_t xlen, ylen, zlen;
378 Double_t xpos, ypos, zpos, zmod;
379 Double_t alpha;
380
381
382 // First create all needed shapes
383 alpha = (360./(2*fNLadders))*TMath::DegToRad();
384
385 // The ladder
386 xlen = fLayRadius*TMath::Tan(alpha);
387 ylen = 0.5*fLadderThick;
388 zlen = 0.5*fZLength;
389
390 TGeoBBox *ladder = new TGeoBBox(xlen, ylen, zlen);
391
392
393 // We have all shapes: now create the real volumes
394 TGeoMedium *medAir = mgr->GetMedium("ITS_AIR$");
395
396 snprintf(volname, 30, "ITSupgLadder%d", fLayerNumber);
397 TGeoVolume *laddVol = new TGeoVolume(volname, ladder, medAir);
398
399// laddVol->SetVisibility(kFALSE);
400 laddVol->SetVisibility(kTRUE);
401 laddVol->SetLineColor(2);
402
403 TGeoVolume *modVol = CreateModule(ladder->GetDX(), ladder->GetDY(),
404 ladder->GetDZ());
405
406
407 // Now build up the ladder
408 zmod = ((TGeoBBox*)modVol->GetShape())->GetDZ();
409 for (Int_t j=0; j<fNModules; j++) {
410 xpos = 0.;
411 ypos = 0.;
412 zpos = -ladder->GetDZ() + j*2*zmod + zmod;
413 laddVol->AddNode(modVol, j+1, new TGeoTranslation(xpos, ypos, zpos));
414 }
415
416
417 // Done, return the ladder
418 return laddVol;
419}
420
421//________________________________________________________________________
422TGeoVolume* AliITSv11GeometryUpgrade::CreateModule(const Double_t xlad,
423 const Double_t ylad,
424 const Double_t zlad,
425 const TGeoManager *mgr){
426//
427// Creates the actual Module
428//
429// Input:
430// xlad,ylad,zlad : the ladder dimensions
431// mgr : the GeoManager (used only to get the proper material)
432//
433// Output:
434//
435// Return:
436//
437// Created: 22 Jun 2011 Mario Sitta
438//
439
440 char volname[30];
441 Double_t xlen, ylen, zlen;
442 Double_t xpos, ypos, zpos;
443
444
445 // First create all needed shapes
446
447 // The module
448 TGeoBBox *module = new TGeoBBox(xlad, ylad, zlad/fNModules);
449
450 // The sensor
451 xlen = module->GetDX();
452 ylen = 0.5*fSensorThick;
453 zlen = module->GetDZ();
454 TGeoBBox *sensor = new TGeoBBox(xlen, ylen, zlen);
455
456
457 // We have all shapes: now create the real volumes
458 TGeoMedium *medAir = mgr->GetMedium("ITS_AIR$");
459 TGeoMedium *medSi = mgr->GetMedium("ITS_SI$");
460
461 snprintf(volname, 30, "ITSupgModule%d", fLayerNumber);
462 TGeoVolume *modVol = new TGeoVolume(volname, module, medAir);
463
464 modVol->SetVisibility(kFALSE);
465 modVol->SetLineColor(1);
466
467 snprintf(volname, 30, "ITSupgSensor%d", fLayerNumber);
468 TGeoVolume *sensVol = new TGeoVolume(volname, sensor, medSi);
469
470 sensVol->SetVisibility(kTRUE);
471 sensVol->SetLineColor(8);
472 sensVol->SetLineWidth(1);
473 sensVol->SetFillColor(sensVol->GetLineColor());
474 sensVol->SetFillStyle(4000); // 0% transparent
475
476
477 // Now build up the module
478 xpos = 0.;
479 ypos = -module->GetDY() + sensor->GetDY();
480 zpos = 0.;
481
482 modVol->AddNode(sensVol, 1, new TGeoTranslation(xpos, ypos, zpos));
483
484
485 // Done, return the module
486 return modVol;
487}
488
489//________________________________________________________________________
490void AliITSv11GeometryUpgrade::SetLadderTilt(const Double_t t){
491//
492// Sets the Ladder tilt angle (for turbo layers only)
493//
494// Input:
495// t : the ladder tilt angle
496//
497// Output:
498//
499// Return:
500//
501// Created: 08 Jul 2011 Mario Sitta
502//
503
504 if (fIsTurbo)
505 fLadderTilt = t;
506 else
507 AliError("Not a Turbo layer");
508
509}
510
511//________________________________________________________________________
512void AliITSv11GeometryUpgrade::SetLadderWidth(const Double_t w){
513//
514// Sets the Ladder width (for turbo layers only)
515//
516// Input:
517// w : the ladder width
518//
519// Output:
520//
521// Return:
522//
523// Created: 08 Jul 2011 Mario Sitta
524//
525
526 if (fIsTurbo)
527 fLadderWidth = w;
528 else
529 AliError("Not a Turbo layer");
530
531}