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