Loading some of the OCDB entries only on request.
[u/mrichter/AliRoot.git] / TPC / AliTPCv2.cxx
CommitLineData
4c039060 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
88cb7938 16/* $Id$ */
4c039060 17
73042f01 18//
fe4da5cc 19///////////////////////////////////////////////////////////////////////////////
20// //
21// Time Projection Chamber version 2 -- detailed TPC and slow simulation //
22// //
23//Begin_Html
24/*
1439f98e 25<img src="picts/AliTPCv2Class.gif">
fe4da5cc 26*/
27//End_Html
28// //
29// //
30///////////////////////////////////////////////////////////////////////////////
116cbefd 31
d899e254 32//#include <stdlib.h>
fe4da5cc 33
88cb7938 34#include <TLorentzVector.h>
116cbefd 35#include <TPDGCode.h>
d9e80aca 36#include <TString.h>
f77f13c8 37#include "AliLog.h"
b40afa5e 38#include "AliMathBase.h"
e6add757 39#include "AliTrackReference.h"
73042f01 40#include "AliTPCParam.h"
4ed5dced 41#include "AliTPCTrackHitsV2.h"
116cbefd 42#include "AliTPCv2.h"
cdf69b9a 43#include "AliGeomManager.h"
c1637e41 44#include "TGeoVolume.h"
45#include "TGeoPcon.h"
46#include "TGeoTube.h"
47#include "TGeoPgon.h"
48#include "TGeoTrd1.h"
49#include "TGeoCompositeShape.h"
50#include "TGeoPara.h"
1ac29fc4 51#include "TGeoPhysicalNode.h"
0f788f87 52#include "TGeoHalfSpace.h"
1ac29fc4 53
fe4da5cc 54ClassImp(AliTPCv2)
55
56//_____________________________________________________________________________
57AliTPCv2::AliTPCv2(const char *name, const char *title) :
e046d791 58 AliTPC(name, title),
59 fIdSens(0),
60 fIDrift(0),
61 fSecOld(0)
fe4da5cc 62{
63 //
64 // Standard constructor for Time Projection Chamber version 2
65 //
37831078 66
73042f01 67
c1637e41 68 SetBufferSize(128000);
73042f01 69
73042f01 70
db2fdcfb 71// if (fTPCParam)
72// fTPCParam->Write(fTPCParam->GetTitle());
fe4da5cc 73}
74
75//_____________________________________________________________________________
76void AliTPCv2::CreateGeometry()
77{
78 //
79 // Create the geometry of Time Projection Chamber version 2
80 //
81 //Begin_Html
82 /*
37831078 83 <img src="picts/AliTPC.gif">
fe4da5cc 84 */
85 //End_Html
86 //Begin_Html
87 /*
1439f98e 88 <img src="picts/AliTPCv2Tree.gif">
fe4da5cc 89 */
90 //End_Html
91
c1637e41 92 //----------------------------------------------------------
93 // This geometry is written using TGeo class
94 // Firstly the shapes are defined, and only then the volumes
95 // What is recognized by the MC are volumes
96 //----------------------------------------------------------
37831078 97 //
c1637e41 98 // tpc - this will be the mother volume
37831078 99 //
79575d04 100
37831078 101 //
c1637e41 102 // here I define a volume TPC
103 // retrive the medium name with "TPC_" as a leading string
37831078 104 //
78134e48 105 TGeoPcon *tpc = new TGeoPcon(0.,360.,20); //20 sections
37831078 106 //
78134e48 107 tpc->DefineSection(0,-291.,77.,278.);
108 tpc->DefineSection(1,-270,77.,278.);
37831078 109 //
78134e48 110 tpc->DefineSection(2,-270.,77.,278.);
111 tpc->DefineSection(3,-259.6,70.,278.);
37831078 112 //
78134e48 113 tpc->DefineSection(4,-259.6,68.1,278.);
114 tpc->DefineSection(5,-253.6,68.1,278.);
37831078 115 //
78134e48 116 tpc->DefineSection(6,-253.6,68.,278.);
117 tpc->DefineSection(7,-74.0,60.8,278.);
37831078 118 //
78134e48 119 tpc->DefineSection(8,-74.0,60.1,278.);
120 tpc->DefineSection(9,-73.3,60.1,278.);
37831078 121 //
78134e48 122 tpc->DefineSection(10,-73.3,56.9,278.);
123 tpc->DefineSection(11,73.3,56.9,278.);
37831078 124 //
78134e48 125 tpc->DefineSection(12,73.3,60.1,278.);
126 tpc->DefineSection(13,74.0,60.1,278.);
37831078 127 //
78134e48 128 tpc->DefineSection(14,74.0,60.8,278.);
129 tpc->DefineSection(15,253.6,65.5,278.);
130 //
131 tpc->DefineSection(16,253.6,65.6,278.);
132 tpc->DefineSection(17,259.6,65.6,278.);
133 //
134 tpc->DefineSection(18,259.6,70.0,278.);
135 tpc->DefineSection(19,291.,77.,278.);
37831078 136 //
c1637e41 137 TGeoMedium *m1 = gGeoManager->GetMedium("TPC_Air");
138 TGeoVolume *v1 = new TGeoVolume("TPC_M",tpc,m1);
79575d04 139 //
c1637e41 140 // drift volume - sensitive volume, extended beyond the
141 // endcaps, because of the alignment
37831078 142 //
c1637e41 143 TGeoPcon *dvol = new TGeoPcon(0.,360.,6);
144 dvol->DefineSection(0,-260.,74.5,264.4);
145 dvol->DefineSection(1,-253.6,74.5,264.4);
37831078 146 //
c1637e41 147 dvol->DefineSection(2,-253.6,76.6774,258.);
148 dvol->DefineSection(3,253.6,76.6774,258.);
37831078 149 //
c1637e41 150 dvol->DefineSection(4,253.6,74.5,264.4);
151 dvol->DefineSection(5,260.,74.5,264.4);
37831078 152 //
c1637e41 153 TGeoMedium *m5 = gGeoManager->GetMedium("TPC_Ne-CO2-N-2");
154 TGeoVolume *v9 = new TGeoVolume("TPC_Drift",dvol,m5);
37831078 155 //
c1637e41 156 v1->AddNode(v9,1);
37831078 157 //
c1637e41 158 // outer insulator
720b23b8 159 //
c1637e41 160 TGeoPcon *tpco = new TGeoPcon(0.,360.,6); //insulator
79575d04 161 //
c1637e41 162 tpco->DefineSection(0,-256.6,264.8,278.);
163 tpco->DefineSection(1,-253.6,264.8,278.);
164 //
165 tpco->DefineSection(2,-253.6,258.,278.);
166 tpco->DefineSection(3,250.6,258.,278.);
167 //
168 tpco->DefineSection(4,250.6,258.,275.5);
169 tpco->DefineSection(5,253.6,258.,275.5);
170 //
171 TGeoMedium *m2 = gGeoManager->GetMedium("TPC_CO2");
172 TGeoVolume *v2 = new TGeoVolume("TPC_OI",tpco,m2);
173 //
174 // outer containment vessel
175 //
176 TGeoPcon *tocv = new TGeoPcon(0.,360.,6); // containment vessel
177 //
178 tocv->DefineSection(0,-256.6,264.8,278.);
179 tocv->DefineSection(1,-253.6,264.8,278.);
180 //
181 tocv->DefineSection(2,-253.6,274.8124,278.);
182 tocv->DefineSection(3,247.6,274.8124,278.);
183 //
184 tocv->DefineSection(4,247.6,270.4,278.);
185 tocv->DefineSection(5,250.6,270.4,278.);
186 //
187 TGeoMedium *m3 = gGeoManager->GetMedium("TPC_Al");
188 TGeoVolume *v3 = new TGeoVolume("TPC_OCV",tocv,m3);
189 //
190 TGeoTube *to1 = new TGeoTube(274.8174,277.995,252.1); //epoxy
191 TGeoTube *to2 = new TGeoTube(274.8274,277.985,252.1); //tedlar
192 TGeoTube *to3 = new TGeoTube(274.8312,277.9812,252.1);//prepreg2
193 TGeoTube *to4 = new TGeoTube(274.9062,277.9062,252.1);//nomex
194 //
195 TGeoMedium *sm1 = gGeoManager->GetMedium("TPC_Epoxy");
196 TGeoMedium *sm2 = gGeoManager->GetMedium("TPC_Tedlar");
197 TGeoMedium *sm3 = gGeoManager->GetMedium("TPC_Prepreg2");
198 TGeoMedium *sm4 = gGeoManager->GetMedium("TPC_Nomex");
199 //
200 TGeoVolume *tov1 = new TGeoVolume("TPC_OCV1",to1,sm1);
201 TGeoVolume *tov2 = new TGeoVolume("TPC_OCV2",to2,sm2);
202 TGeoVolume *tov3 = new TGeoVolume("TPC_OCV3",to3,sm3);
203 TGeoVolume *tov4 = new TGeoVolume("TPC_OCV4",to4,sm4);
204 //-------------------------------------------------------
37831078 205 // Tpc Outer Field Cage
c1637e41 206 // daughters - composite (sandwich)
37831078 207 //-------------------------------------------------------
1283eee5 208
c1637e41 209 TGeoPcon *tofc = new TGeoPcon(0.,360.,6);
79575d04 210 //
c1637e41 211 tofc->DefineSection(0,-253.6,258.,269.6);
212 tofc->DefineSection(1,-250.6,258.,269.6);
37831078 213 //
c1637e41 214 tofc->DefineSection(2,-250.6,258.,260.0676);
215 tofc->DefineSection(3,250.6,258.,260.0676);
37831078 216 //
c1637e41 217 tofc->DefineSection(4,250.6,258.,275.5);
218 tofc->DefineSection(5,253.6,258.,275.5);
37831078 219 //
c1637e41 220 TGeoVolume *v4 = new TGeoVolume("TPC_TOFC",tofc,m3);
221 //sandwich
222 TGeoTube *tf1 = new TGeoTube(258.0,260.0676,252.1); //tedlar
223 TGeoTube *tf2 = new TGeoTube(258.0038,260.0638,252.1); //prepreg3
224 TGeoTube *tf3 = new TGeoTube(258.0338,260.0338,252.1);//nomex
37831078 225 //
c1637e41 226 TGeoMedium *sm5 = gGeoManager->GetMedium("TPC_Prepreg3");
37831078 227 //
c1637e41 228 TGeoVolume *tf1v = new TGeoVolume("TPC_OFC1",tf1,sm2);
229 TGeoVolume *tf2v = new TGeoVolume("TPC_OFC2",tf2,sm5);
230 TGeoVolume *tf3v = new TGeoVolume("TPC_OFC3",tf3,sm4);
37831078 231 //
c1637e41 232 // outer part - positioning
37831078 233 //
c1637e41 234 tov1->AddNode(tov2,1); tov2->AddNode(tov3,1); tov3->AddNode(tov4,1);
37831078 235 //
c1637e41 236 tf1v->AddNode(tf2v,1); tf2v->AddNode(tf3v,1);
37831078 237 //
456cb019 238 v3->AddNode(tov1,1,new TGeoTranslation(0.,0.,-1.5)); v4->AddNode(tf1v,1);
37831078 239 //
c1637e41 240 v2->AddNode(v3,1); v2->AddNode(v4,1);
37831078 241 //
c1637e41 242 v1->AddNode(v2,1);
243 //--------------------------------------------------------------------
244 // Tpc Inner INsulator (CO2)
245 // the cones, the central drum and the inner f.c. sandwich with a piece
246 // of the flane will be placed in the TPC
247 //--------------------------------------------------------------------
248 TGeoPcon *tpci = new TGeoPcon(0.,360.,4);
37831078 249 //
c1637e41 250 tpci->DefineSection(0,-253.6,68.4,76.6774);
251 tpci->DefineSection(1,-74.0,61.2,76.6774);
37831078 252 //
c1637e41 253 tpci->DefineSection(2,74.0,61.2,76.6774);
37831078 254 //
c1637e41 255 tpci->DefineSection(3,253.6,65.9,76.6774);
37831078 256 //
c1637e41 257 TGeoVolume *v5 = new TGeoVolume("TPC_INI",tpci,m2);
37831078 258 //
c1637e41 259 // now the inner field cage - only part of flanges (2 copies)
37831078 260 //
c1637e41 261 TGeoTube *tif1 = new TGeoTube(69.9,76.6774,1.5);
262 TGeoVolume *v6 = new TGeoVolume("TPC_IFC1",tif1,m3);
37831078 263 //
c1637e41 264 //---------------------------------------------------------
265 // Tpc Inner Containment vessel - Muon side
79575d04 266 //---------------------------------------------------------
c1637e41 267 TGeoPcon *tcms = new TGeoPcon(0.,360.,10);
37831078 268 //
c1637e41 269 tcms->DefineSection(0,-259.1,68.1,74.2);
270 tcms->DefineSection(1,-253.6,68.1,74.2);
37831078 271 //
c1637e41 272 tcms->DefineSection(2,-253.6,68.1,68.4);
273 tcms->DefineSection(3,-74.0,60.9,61.2);
37831078 274 //
c1637e41 275 tcms->DefineSection(4,-74.0,60.1,61.2);
276 tcms->DefineSection(5,-73.3,60.1,61.2);
37831078 277 //
c1637e41 278 tcms->DefineSection(6,-73.3,56.9,61.2);
279 tcms->DefineSection(7,-73.0,56.9,61.2);
37831078 280 //
c1637e41 281 tcms->DefineSection(8,-73.0,56.9,58.8);
282 tcms->DefineSection(9,-71.3,56.9,58.8);
37831078 283 //
c1637e41 284 TGeoVolume *v7 = new TGeoVolume("TPC_ICVM",tcms,m3);
285 //-----------------------------------------------
286 // inner containment vessel - shaft side
287 //-----------------------------------------------
288 TGeoPcon *tcss = new TGeoPcon(0.,360.,10);
37831078 289 //
c1637e41 290 tcss->DefineSection(0,71.3,56.9,58.8);
291 tcss->DefineSection(1,73.0,56.9,58.8);
1283eee5 292 //
c1637e41 293 tcss->DefineSection(2,73.0,56.9,61.2);
294 tcss->DefineSection(3,73.3,56.9,61.2);
295 //
296 tcss->DefineSection(4,73.3,60.1,61.2);
297 tcss->DefineSection(5,74.0,60.1,61.2);
1283eee5 298 //
c1637e41 299 tcss->DefineSection(6,74.0,60.9,61.2);
300 tcss->DefineSection(7,253.6,65.6,65.9);
37831078 301 //
c1637e41 302 tcss->DefineSection(8,253.6,65.6,74.2);
303 tcss->DefineSection(9,258.1,65.6,74.2);
1283eee5 304 //
c1637e41 305 TGeoVolume *v8 = new TGeoVolume("TPC_ICVS",tcss,m3);
306 //-----------------------------------------------
307 // Inner field cage
308 // define 4 parts and make an assembly
309 //-----------------------------------------------
310 // part1 - Al - 2 copies
311 TGeoTube *t1 = new TGeoTube(76.6774,78.845,0.75);
312 TGeoVolume *tv1 = new TGeoVolume("TPC_IFC2",t1,m3);
313 // sandwich - outermost parts - 2 copies
314 TGeoTube *t2 = new TGeoTube(76.6774,78.845,74.175); // tedlar 38 microns
315 TGeoTube *t3 = new TGeoTube(76.6812,78.8412,74.175); // prepreg2 500 microns
316 TGeoTube *t4 = new TGeoTube(76.7312,78.7912,74.175); // prepreg3 300 microns
317 TGeoTube *t5 = new TGeoTube(76.7612,78.7612,74.175); // nomex 2 cm
1283eee5 318 //
c1637e41 319 TGeoVolume *tv2 = new TGeoVolume("TPC_IFC3",t2,sm2);
320 TGeoVolume *tv3 = new TGeoVolume("TPC_IFC4",t3,sm3);
321 TGeoVolume *tv4 = new TGeoVolume("TPC_IFC5",t4,sm5);
322 TGeoVolume *tv5 = new TGeoVolume("TPC_IFC6",t5,sm4);
37831078 323 //
c1637e41 324 // middle parts - 2 copies
325 TGeoTube *t6 = new TGeoTube(76.6774,78.795,5.); // tedlar 38 microns
326 TGeoTube *t7 = new TGeoTube(76.6812,78.7912,5.); // prepreg2 250 microns
327 TGeoTube *t8 = new TGeoTube(76.7062,78.7662,5.); // prepreg3 300 microns
328 TGeoTube *t9 = new TGeoTube(76.7362,78.7362,5.); // nomex 2 cm
79575d04 329 //
c1637e41 330 TGeoVolume *tv6 = new TGeoVolume("TPC_IFC7",t6,sm2);
331 TGeoVolume *tv7 = new TGeoVolume("TPC_IFC8",t7,sm3);
332 TGeoVolume *tv8 = new TGeoVolume("TPC_IFC9",t8,sm5);
333 TGeoVolume *tv9 = new TGeoVolume("TPC_IFC10",t9,sm4);
334 // central part - 1 copy
335 TGeoTube *t10 = new TGeoTube(76.6774,78.745,93.75); // tedlar 38 microns
336 TGeoTube *t11 = new TGeoTube(76.6812,78.7412,93.75); // prepreg3 300 microns
337 TGeoTube *t12 = new TGeoTube(76.7112,78.7112,93.75); // nomex 2 cm
79575d04 338 //
c1637e41 339 TGeoVolume *tv10 = new TGeoVolume("TPC_IFC11",t10,sm2);
340 TGeoVolume *tv11 = new TGeoVolume("TPC_IFC12",t11,sm5);
341 TGeoVolume *tv12 = new TGeoVolume("TPC_IFC13",t12,sm4);
79575d04 342 //
c1637e41 343 // inner part - positioning
79575d04 344 //
c1637e41 345 // creating a sandwich
346 tv2->AddNode(tv3,1); tv3->AddNode(tv4,1); tv4->AddNode(tv5,1);
79575d04 347 //
c1637e41 348 tv6->AddNode(tv7,1); tv7->AddNode(tv8,1); tv8->AddNode(tv9,1);
79575d04 349 //
c1637e41 350 tv10->AddNode(tv11,1); tv11->AddNode(tv12,1);
37831078 351 //
c1637e41 352 TGeoVolumeAssembly *tv100 = new TGeoVolumeAssembly("TPC_IFC");
37831078 353 //
c1637e41 354 tv100->AddNode(tv10,1);
355 tv100->AddNode(tv6,1,new TGeoTranslation(0.,0.,-98.75));
356 tv100->AddNode(tv6,2,new TGeoTranslation(0.,0.,98.75));
357 tv100->AddNode(tv2,1,new TGeoTranslation(0.,0.,-177.925));
358 tv100->AddNode(tv2,2,new TGeoTranslation(0.,0.,177.925));
359 tv100->AddNode(tv1,1,new TGeoTranslation(0.,0.,-252.85));
360 tv100->AddNode(tv1,2,new TGeoTranslation(0.,0.,252.85));
361 //
362 v5->AddNode(v6,1, new TGeoTranslation(0.,0.,-252.1));
363 v5->AddNode(v6,2, new TGeoTranslation(0.,0.,252.1));
364 v1->AddNode(v5,1); v1->AddNode(v7,1); v1->AddNode(v8,1);
365 v9->AddNode(tv100,1);
366 //
367 // central drum
368 //
369 // flange + sandwich
370 //
371 TGeoPcon *cfl = new TGeoPcon(0.,360.,6);
372 cfl->DefineSection(0,-71.1,59.7,61.2);
373 cfl->DefineSection(1,-68.6,59.7,61.2);
374 //
375 cfl->DefineSection(2,-68.6,60.6324,61.2);
376 cfl->DefineSection(3,68.6,60.6324,61.2);
377 //
378 cfl->DefineSection(4,68.6,59.7,61.2);
379 cfl->DefineSection(5,71.1,59.7,61.2);
380 //
381 TGeoVolume *cflv = new TGeoVolume("TPC_CDR",cfl,m3);
382 // sandwich
383 TGeoTube *cd1 = new TGeoTube(60.6424,61.19,71.1);
384 TGeoTube *cd2 = new TGeoTube(60.6462,61.1862,71.1);
385 TGeoTube *cd3 = new TGeoTube(60.6662,61.1662,71.1);
386 //
387 TGeoMedium *sm6 = gGeoManager->GetMedium("TPC_Prepreg1");
388 TGeoVolume *cd1v = new TGeoVolume("TPC_CDR1",cd1,sm2); //tedlar
389 TGeoVolume *cd2v = new TGeoVolume("TPC_CDR2",cd2,sm6);// prepreg1
390 TGeoVolume *cd3v = new TGeoVolume("TPC_CDR3",cd3,sm4); //nomex
391 //
392 // seals for central drum 2 copies
393 //
394 TGeoTube *cs = new TGeoTube(56.9,61.2,0.1);
395 TGeoMedium *sm7 = gGeoManager->GetMedium("TPC_Mylar");
396 TGeoVolume *csv = new TGeoVolume("TPC_CDRS",cs,sm7);
3378c058 397 v1->AddNode(csv,1,new TGeoTranslation(0.,0.,-71.2));
398 v1->AddNode(csv,2,new TGeoTranslation(0.,0.,71.2));
c1637e41 399 //
400 // seal collars
401 TGeoPcon *se = new TGeoPcon(0.,360.,6);
402 se->DefineSection(0,-72.8,59.7,61.2);
403 se->DefineSection(1,-72.3,59.7,61.2);
404 //
405 se->DefineSection(2,-72.3,58.85,61.2);
406 se->DefineSection(3,-71.6,58.85,61.2);
407 //
408 se->DefineSection(4,-71.6,59.7,61.2);
409 se->DefineSection(5,-71.3,59.7,61.2);
410 //
411 TGeoVolume *sev = new TGeoVolume("TPC_CDCE",se,m3);
412 //
413 TGeoTube *si = new TGeoTube(56.9,58.8,1.);
414 TGeoVolume *siv = new TGeoVolume("TPC_CDCI",si,m3);
415 //
416 // define reflection matrix
417 //
4fa47888 418 TGeoRotation *ref = new TGeoRotation("ref",90.,0.,90.,90.,180.,0.);
c1637e41 419 //
420 cd1v->AddNode(cd2v,1); cd2v->AddNode(cd3v,1); cflv->AddNode(cd1v,1);
421 //
a1ec4d07 422 v1->AddNode(siv,1,new TGeoTranslation(0.,0.,-69.9));
423 v1->AddNode(siv,2,new TGeoTranslation(0.,0.,69.9));
c1637e41 424 v1->AddNode(sev,1); v1->AddNode(sev,2,ref); v1->AddNode(cflv,1);
425 //
426 // central membrane - 2 rings and a mylar membrane - assembly
427 //
0f788f87 428 TGeoTube *ih = new TGeoTube(80.1,84.1,0.2);
429 TGeoTube *oh = new TGeoTube(250.,265.,0.2);
c1637e41 430 TGeoTube *mem = new TGeoTube(84.05,250,0.01);
431 TGeoVolume *ihv = new TGeoVolume("TPC_IHVH",ih,m3);
432 TGeoVolume *ohv = new TGeoVolume("TPC_OHVH",oh,m3);
433 TGeoVolume *memv = new TGeoVolume("TPC_HV",mem,sm7);
434 //
435 TGeoVolumeAssembly *cm = new TGeoVolumeAssembly("TPC_HVMEM");
436 cm->AddNode(ihv,1);
437 cm->AddNode(ohv,1);
438 cm->AddNode(memv,1);
439 v9->AddNode(cm,1);
440 //
441 // end caps - they are make as an assembly of single segments
442 // containing both readout chambers
443 //
d899e254 444 Double_t openingAngle = 10.*TMath::DegToRad();
c1637e41 445 Double_t thick=1.5; // rib
d899e254 446 Double_t shift = thick/TMath::Sin(openingAngle);
c1637e41 447 //
d899e254 448 Double_t lowEdge = 86.3; // hole in the wheel
449 Double_t upEdge = 240.4; // hole in the wheel
c1637e41 450 //
451 new TGeoTubeSeg("sec",74.5,264.4,3.,0.,20.);
452 //
453 TGeoPgon *hole = new TGeoPgon("hole",0.,20.,1,4);
454 //
d899e254 455 hole->DefineSection(0,-3.5,lowEdge-shift,upEdge-shift);
456 hole->DefineSection(1,-1.5,lowEdge-shift,upEdge-shift);
c1637e41 457 //
d899e254 458 hole->DefineSection(2,-1.5,lowEdge-shift,upEdge+3.-shift);
459 hole->DefineSection(3,3.5,lowEdge-shift,upEdge+3.-shift);
c1637e41 460 //
d899e254 461 Double_t ys = shift*TMath::Sin(openingAngle);
462 Double_t xs = shift*TMath::Cos(openingAngle);
c1637e41 463 TGeoTranslation *tr = new TGeoTranslation("tr",xs,ys,0.);
464 tr->RegisterYourself();
465 TGeoCompositeShape *chamber = new TGeoCompositeShape("sec-hole:tr");
466 TGeoVolume *sv = new TGeoVolume("TPC_WSEG",chamber,m3);
467 TGeoPgon *bar = new TGeoPgon("bar",0.,20.,1,2);
468 bar->DefineSection(0,-3.,131.5-shift,136.5-shift);
469 bar->DefineSection(1,1.5,131.5-shift,136.5-shift);
470 TGeoVolume *barv = new TGeoVolume("TPC_WBAR",bar,m3);
471 TGeoVolumeAssembly *ch = new TGeoVolumeAssembly("TPC_WCH");//empty segment
472 //
473 ch->AddNode(sv,1); ch->AddNode(barv,1,tr);
474 //
475 // readout chambers
476 //
477 // IROC first
478 //
479 TGeoTrd1 *ibody = new TGeoTrd1(13.8742,21.3328,4.29,21.15);
480 TGeoVolume *ibdv = new TGeoVolume("TPC_IROCB",ibody,m3);
37831078 481 // empty space
c1637e41 482 TGeoTrd1 *emp = new TGeoTrd1(12.3742,19.8328,3.99,19.65);
483 TGeoVolume *empv = new TGeoVolume("TPC_IROCE",emp,m1);
484 ibdv->AddNode(empv,1,new TGeoTranslation(0.,-0.3,0.));
485 //bars
486 Double_t tga = (19.8328-12.3742)/39.3;
487 Double_t xmin,xmax;
488 xmin = 9.55*tga+12.3742;
489 xmax = 9.95*tga+12.3742;
490 TGeoTrd1 *ib1 = new TGeoTrd1(xmin,xmax,3.29,0.2);
491 TGeoVolume *ib1v = new TGeoVolume("TPC_IRB1",ib1,m3);
492 empv->AddNode(ib1v,1,new TGeoTranslation("tt1",0.,0.7,-9.9));
493 xmin=19.4*tga+12.3742;
494 xmax=19.9*tga+12.3742;
495 TGeoTrd1 *ib2 = new TGeoTrd1(xmin,xmax,3.29,0.25);
496 TGeoVolume *ib2v = new TGeoVolume("TPC_TRB2",ib2,m3);
497 empv->AddNode(ib2v,1,new TGeoTranslation(0.,0.7,0.));
498 xmin=29.35*tga+12.3742;
499 xmax=29.75*tga+12.3742;
500 TGeoTrd1 *ib3 = new TGeoTrd1(xmin,xmax,3.29,0.2);
501 TGeoVolume *ib3v = new TGeoVolume("TPC_IRB3",ib3,m3);
502 empv->AddNode(ib3v,1,new TGeoTranslation(0.,0.7,9.9));
503 //
504 // holes for connectors
505 //
506 TGeoBBox *conn = new TGeoBBox(0.4,0.3,4.675); // identical for iroc and oroc
507 TGeoVolume *connv = new TGeoVolume("TPC_RCCON",conn,m1);
d9e80aca 508 TString fileName(gSystem->Getenv("ALICE_ROOT"));
509 fileName += "/TPC/conn_iroc.dat";
c1637e41 510 ifstream in;
d9e80aca 511 in.open(fileName.Data(), ios_base::in); // asci file
2d1d58a6 512 TGeoRotation *rrr[86];
c1637e41 513 for(Int_t i =0;i<86;i++){
456cb019 514 Double_t y = 3.99;
c1637e41 515 Double_t x,z,ang;
516 in>>x>>z>>ang;
456cb019 517 z-=26.5;
2d1d58a6 518 rrr[i]= new TGeoRotation();
519 rrr[i]->RotateY(ang);
520 ibdv->AddNode(connv,i+1,new TGeoCombiTrans(x,y,z,rrr[i]));
c1637e41 521 }
522 in.close();
523 // "cap"
524 new TGeoTrd1("icap",14.5974,23.3521,1.19,24.825);
525 // "hole"
526 new TGeoTrd1("ihole",13.8742,21.3328,1.2,21.15);
527 TGeoTranslation *tr1 = new TGeoTranslation("tr1",0.,0.,1.725);
528 tr1->RegisterYourself();
529 TGeoCompositeShape *ic = new TGeoCompositeShape("icap-ihole:tr1");
530 TGeoVolume *icv = new TGeoVolume("TPC_IRCAP",ic,m3);
531 //
532 // pad plane and wire fixations
533 //
534 TGeoTrd1 *pp = new TGeoTrd1(14.5974,23.3521,0.3,24.825); //pad+iso
535 TGeoMedium *m4 = gGeoManager->GetMedium("TPC_G10");
536 TGeoVolume *ppv = new TGeoVolume("TPC_IRPP",pp,m4);
537 TGeoPara *f1 = new TGeoPara(.6,.5,24.825,0.,-10.,0.);
538 TGeoVolume *f1v = new TGeoVolume("TPC_IRF1",f1,m4);
539 TGeoPara *f2 = new TGeoPara(.6,.5,24.825,0.,10.,0.);
540 TGeoVolume *f2v = new TGeoVolume("TPC_IRF2",f2,m4);
541 //
542 TGeoVolumeAssembly *iroc = new TGeoVolumeAssembly("TPC_IROC");
543 //
544 iroc->AddNode(ibdv,1);
545 iroc->AddNode(icv,1,new TGeoTranslation(0.,3.1,-1.725));
546 iroc->AddNode(ppv,1,new TGeoTranslation(0.,4.59,-1.725));
547 tga =(23.3521-14.5974)/49.65;
548 Double_t xx = 24.825*tga+14.5974-0.6;
549 iroc->AddNode(f1v,1,new TGeoTranslation(-xx,5.39,-1.725));
550 iroc->AddNode(f2v,1,new TGeoTranslation(xx,5.39,-1.725));
551 //
552 // OROC
553 //
554 TGeoTrd1 *obody = new TGeoTrd1(22.2938,40.5084,4.19,51.65);
555 TGeoVolume *obdv = new TGeoVolume("TPC_OROCB",obody,m3);
556 TGeoTrd1 *oemp = new TGeoTrd1(20.2938,38.5084,3.89,49.65);
557 TGeoVolume *oempv = new TGeoVolume("TPC_OROCE",oemp,m1);
558 obdv->AddNode(oempv,1,new TGeoTranslation(0.,-0.3,0.));
559 //horizontal bars
560 tga=(38.5084-20.2938)/99.3;
561 xmin=tga*10.2+20.2938;
562 xmax=tga*10.6+20.2938;
563 TGeoTrd1 *ob1 = new TGeoTrd1(xmin,xmax,2.915,0.2);
564 TGeoVolume *ob1v = new TGeoVolume("TPC_ORB1",ob1,m3);
565 //
566 xmin=22.55*tga+20.2938;
567 xmax=24.15*tga+20.2938;
568 TGeoTrd1 *ob2 = new TGeoTrd1(xmin,xmax,2.915,0.8);
569 TGeoVolume *ob2v = new TGeoVolume("TPC_ORB2",ob2,m3);
570 //
571 xmin=36.1*tga+20.2938;
572 xmax=36.5*tga+20.2938;
573 TGeoTrd1 *ob3 = new TGeoTrd1(xmin,xmax,2.915,0.2);
574 TGeoVolume *ob3v = new TGeoVolume("TPC_ORB3",ob3,m3);
575 //
576 xmin=49.0*tga+20.2938;
577 xmax=50.6*tga+20.2938;
578 TGeoTrd1 *ob4 = new TGeoTrd1(xmin,xmax,2.915,0.8);
579 TGeoVolume *ob4v = new TGeoVolume("TPC_ORB4",ob4,m3);
580 //
581 xmin=63.6*tga+20.2938;
582 xmax=64.0*tga+20.2938;
583 TGeoTrd1 *ob5 = new TGeoTrd1(xmin,xmax,2.915,0.2);
584 TGeoVolume *ob5v = new TGeoVolume("TPC_ORB5",ob5,m3);
585 //
586 xmin=75.5*tga+20.2938;
587 xmax=77.15*tga+20.2938;
588 TGeoTrd1 *ob6 = new TGeoTrd1(xmin,xmax,2.915,0.8);
589 TGeoVolume *ob6v = new TGeoVolume("TPC_ORB6",ob6,m3);
590 //
591 xmin=88.7*tga+20.2938;
592 xmax=89.1*tga+20.2938;
593 TGeoTrd1 *ob7 = new TGeoTrd1(xmin,xmax,2.915,0.2);
594 TGeoVolume *ob7v = new TGeoVolume("TPC_ORB7",ob7,m3);
595 //
596 oempv->AddNode(ob1v,1,new TGeoTranslation(0.,0.975,-39.25));
597 oempv->AddNode(ob2v,1,new TGeoTranslation(0.,0.975,-26.3));
598 oempv->AddNode(ob3v,1,new TGeoTranslation(0.,0.975,-13.35));
599 oempv->AddNode(ob4v,1,new TGeoTranslation(0.,0.975,0.15));
600 oempv->AddNode(ob5v,1,new TGeoTranslation(0.,0.975,14.15));
601 oempv->AddNode(ob6v,1,new TGeoTranslation(0.,0.975,26.7));
602 oempv->AddNode(ob7v,1,new TGeoTranslation(0.,0.975,39.25));
603 // vertical bars
604 TGeoBBox *ob8 = new TGeoBBox(0.8,2.915,5.1);
605 TGeoBBox *ob9 = new TGeoBBox(0.8,2.915,5.975);
606 TGeoBBox *ob10 = new TGeoBBox(0.8,2.915,5.775);
607 TGeoBBox *ob11 = new TGeoBBox(0.8,2.915,6.25);
608 TGeoBBox *ob12 = new TGeoBBox(0.8,2.915,6.5);
609 //
610 TGeoVolume *ob8v = new TGeoVolume("TPC_ORB8",ob8,m3);
611 TGeoVolume *ob9v = new TGeoVolume("TPC_ORB9",ob9,m3);
612 TGeoVolume *ob10v = new TGeoVolume("TPC_ORB10",ob10,m3);
613 TGeoVolume *ob11v = new TGeoVolume("TPC_ORB11",ob11,m3);
614 TGeoVolume *ob12v = new TGeoVolume("TPC_ORB12",ob12,m3);
615 //
616 oempv->AddNode(ob8v,1,new TGeoTranslation(0.,0.975,-44.55));
617 oempv->AddNode(ob8v,2,new TGeoTranslation(0.,0.975,44.55));
618 oempv->AddNode(ob9v,1,new TGeoTranslation(0.,0.975,-33.075));
619 oempv->AddNode(ob9v,2,new TGeoTranslation(0.,0.975,-19.525));
620 oempv->AddNode(ob10v,1,new TGeoTranslation(0.,0.975,20.125));
621 oempv->AddNode(ob10v,2,new TGeoTranslation(0.,0.975,33.275));
622 oempv->AddNode(ob11v,1,new TGeoTranslation(0.,0.975,-6.9));
623 oempv->AddNode(ob12v,1,new TGeoTranslation(0.,0.975,7.45));
624 //
625 // holes for connectors
626 //
d9e80aca 627 fileName = gSystem->Getenv("ALICE_ROOT");
628 fileName += "/TPC/conn_oroc.dat";
629 in.open(fileName.Data(), ios_base::in); // asci file
2d1d58a6 630 TGeoRotation *rr[78];
c1637e41 631 for(Int_t i =0;i<78;i++){
632 Double_t y =3.89;
633 Double_t x,z,ang;
634 Double_t x1,z1,x2,z2;
635 in>>x>>z>>ang;
636 Double_t xr = 4.7*TMath::Sin(ang*TMath::DegToRad());
637 Double_t zr = 4.7*TMath::Cos(ang*TMath::DegToRad());
638 //
639 x1=xr+x; x2=-xr+x; z1=zr+z; z2 = -zr+z;
640 //
2d1d58a6 641 rr[i]= new TGeoRotation();
642 rr[i]->RotateY(ang);
c1637e41 643 z1-=54.95;
644 z2-=54.95;
5f174279 645 //
2d1d58a6 646 obdv->AddNode(connv,i+1,new TGeoCombiTrans(x1,y,z1,rr[i]));
647 obdv->AddNode(connv,i+79,new TGeoCombiTrans(x2,y,z2,rr[i]));
c1637e41 648 }
649 in.close();
650 // cap
651 new TGeoTrd1("ocap",23.3874,43.5239,1.09,57.1);
652 new TGeoTrd1("ohole",22.2938,40.5084,1.09,51.65);
653 TGeoTranslation *tr5 = new TGeoTranslation("tr5",0.,0.,-2.15);
654 tr5->RegisterYourself();
655 TGeoCompositeShape *oc = new TGeoCompositeShape("ocap-ohole:tr5");
656 TGeoVolume *ocv = new TGeoVolume("TPC_ORCAP",oc,m3);
657 //
658 // pad plane and wire fixations
659 //
660 TGeoTrd1 *opp = new TGeoTrd1(23.3874,43.5239,0.3,57.1);
661 TGeoVolume *oppv = new TGeoVolume("TPC_ORPP",opp,m4);
662 //
663 tga=(43.5239-23.3874)/114.2;
664 TGeoPara *f3 = new TGeoPara(.7,.6,57.1,0.,-10.,0.);
665 TGeoPara *f4 = new TGeoPara(.7,.6,57.1,0.,10.,0.);
666 xx = 57.1*tga+23.3874-0.7;
667 TGeoVolume *f3v = new TGeoVolume("TPC_ORF1",f3,m4);
668 TGeoVolume *f4v = new TGeoVolume("TPC_ORF2",f4,m4);
669 //
670 TGeoVolumeAssembly *oroc = new TGeoVolumeAssembly("TPC_OROC");
671 //
672 oroc->AddNode(obdv,1);
673 oroc->AddNode(ocv,1,new TGeoTranslation(0.,3.1,2.15));
674 oroc->AddNode(oppv,1,new TGeoTranslation(0.,4.49,2.15));
675 oroc->AddNode(f3v,1,new TGeoTranslation(-xx,5.39,2.15));
676 oroc->AddNode(f4v,1,new TGeoTranslation(xx,5.39,2.15));
677 //
678 // now iroc and oroc are placed into a sector...
679 //
a1ec4d07 680 TGeoVolumeAssembly *secta = new TGeoVolumeAssembly("TPC_SECT"); // a-side
681 TGeoVolumeAssembly *sectc = new TGeoVolumeAssembly("TPC_SECT"); // c-side
c1637e41 682 TGeoRotation rot1("rot1",90.,90.,0.);
683 TGeoRotation rot2("rot2");
684 rot2.RotateY(10.);
685 TGeoRotation *rot = new TGeoRotation("rot");
686 *rot=rot1*rot2;
687 //
688 Double_t x0,y0;
d899e254 689 x0=110.2*TMath::Cos(openingAngle);
690 y0=110.2*TMath::Sin(openingAngle);
1bae4c82 691 TGeoCombiTrans *combi1a = new TGeoCombiTrans("combi1",x0,y0,1.09+0.195,rot); //a-side
692 TGeoCombiTrans *combi1c = new TGeoCombiTrans("combi1",x0,y0,1.09+0.222,rot); //c-side
d899e254 693 x0=188.45*TMath::Cos(openingAngle);
694 y0=188.45*TMath::Sin(openingAngle);
1bae4c82 695 TGeoCombiTrans *combi2a = new TGeoCombiTrans("combi2",x0,y0,0.99+0.195,rot); //a-side
696 TGeoCombiTrans *combi2c = new TGeoCombiTrans("combi2",x0,y0,0.99+0.222,rot); //c-side
c1637e41 697 //
c1637e41 698 //
a1ec4d07 699 // A-side
c1637e41 700 //
a1ec4d07 701 secta->AddNode(ch,1);
702 secta->AddNode(iroc,1,combi1a);
703 secta->AddNode(oroc,1,combi2a);
704 //
705 // C-side
706 //
707 sectc->AddNode(ch,1);
708 sectc->AddNode(iroc,1,combi1c);
709 sectc->AddNode(oroc,1,combi2c);
710 //
711 // now I try to make wheels...
712 //
713 TGeoVolumeAssembly *wheela = new TGeoVolumeAssembly("TPC_ENDCAP");
714 TGeoVolumeAssembly *wheelc = new TGeoVolumeAssembly("TPC_ENDCAP");
c1637e41 715 //
5f174279 716 TGeoRotation *rwh[18];
c1637e41 717 for(Int_t i =0;i<18;i++){
718 Double_t phi = (20.*i);
5f174279 719 rwh[i]=new TGeoRotation();
720 rwh[i]->RotateZ(phi);
721 wheela->AddNode(secta,i+1,rwh[i]);
722 wheelc->AddNode(sectc,i+1,rwh[i]);
c1637e41 723
724 }
4fa47888 725 // wheels in the drift volume!
a1ec4d07 726
c1637e41 727 TGeoCombiTrans *combi3 = new TGeoCombiTrans("combi3",0.,0.,256.6,ref);
a1ec4d07 728 v9->AddNode(wheela,1,combi3);
729 v9->AddNode(wheelc,2,new TGeoTranslation(0.,0.,-256.6));
c1637e41 730 //_____________________________________________________________
731 // service support wheel
732 //_____________________________________________________________
733 TGeoPgon *sw = new TGeoPgon(0.,20.,1,2);
734 sw->DefineSection(0,-4.,80.5,251.75);
735 sw->DefineSection(1,4.,80.5,251.75);
736 TGeoVolume *swv = new TGeoVolume("TPC_SWSEG",sw,m3); //Al
737 //
738 thick=1.;
d899e254 739 shift = thick/TMath::Sin(openingAngle);
c1637e41 740 TGeoPgon *sh = new TGeoPgon(0.,20.,1,2);
741 sh->DefineSection(0,-4.,81.5-shift,250.75-shift);
742 sh->DefineSection(1,4.,81.5-shift,250.75-shift);
743 TGeoVolume *shv = new TGeoVolume("TPC_SWS1",sh,m1); //Air
744 //
74518339 745 TGeoMedium *m9 = gGeoManager->GetMedium("TPC_Si");
746 TGeoPgon *el = new TGeoPgon(0.,20.,1,2);
747 el->DefineSection(0,-1.872,81.5-shift,250.75-shift);
748 el->DefineSection(1,1.872,81.5-shift,250.75-shift);
749 TGeoVolume *elv = new TGeoVolume("TPC_ELEC",el,m9); //Si
750 //
751 shv->AddNode(elv,1);
752 //
753 //
d899e254 754 ys = shift*TMath::Sin(openingAngle);
755 xs = shift*TMath::Cos(openingAngle);
c1637e41 756 swv->AddNode(shv,1,new TGeoTranslation(xs,ys,0.));
757 // cover
758 TGeoPgon *co = new TGeoPgon(0.,20.,1,2);
759 co->DefineSection(0,-0.5,77.,255.25);
760 co->DefineSection(1,0.5,77.,255.25);
761 TGeoVolume *cov = new TGeoVolume("TPC_SWC1",co,m3);//Al
762 // hole in a cover
763 TGeoPgon *coh = new TGeoPgon(0.,20.,1,2);
d899e254 764 shift=4./TMath::Sin(openingAngle);
c1637e41 765 coh->DefineSection(0,-0.5,85.-shift,247.25-shift);
766 coh->DefineSection(1,0.5,85.-shift,247.25-shift);
767 //
768 TGeoVolume *cohv = new TGeoVolume("TPC_SWC2",coh,m1);
769 //
d899e254 770 ys = shift*TMath::Sin(openingAngle);
771 xs = shift*TMath::Cos(openingAngle);
c1637e41 772 cov->AddNode(cohv,1,new TGeoTranslation(xs,ys,0.));
773 //
774 // Sector as an Assembly
775 //
776 TGeoVolumeAssembly *swhs = new TGeoVolumeAssembly("TPC_SSWSEC");
777 swhs->AddNode(swv,1);
778 swhs->AddNode(cov,1,new TGeoTranslation(0.,0.,-4.5));
779 swhs->AddNode(cov,2,new TGeoTranslation(0.,0.,4.5));
780 //
781 // SSW as an Assembly of sectors
782 //
5f174279 783 TGeoRotation *rsw[18];
784 TGeoVolumeAssembly *swheel = new TGeoVolumeAssembly("TPC_SSWHEEL");
c1637e41 785 for(Int_t i =0;i<18;i++){
786 Double_t phi = (20.*i);
5f174279 787 rsw[i] = new TGeoRotation();
788 rsw[i]->RotateZ(phi);
789 swheel->AddNode(swhs,i+1,rsw[i]);
c1637e41 790 }
791 v1->AddNode(swheel,1,new TGeoTranslation(0.,0.,-284.6));
792 v1->AddNode(swheel,2,new TGeoTranslation(0.,0.,284.6));
793
794 // sensitive strips - strip "0" is always set
795 // conditional
796 Int_t totrows;
797 totrows = fTPCParam->GetNRowLow() + fTPCParam->GetNRowUp();
798 Double_t *upar;
799 upar=NULL;
800 gGeoManager->Volume("TPC_Strip","PGON",m5->GetId(),upar);
801 upar=new Double_t [10];
802 upar[0]=0.;
803 upar[1]=360.;
804 upar[2]=18.;
805 upar[3]=2.;
806 //
807 upar[4]=-124.8;
808 upar[7]=124.8;
809
810 Double_t rlow=fTPCParam->GetPadRowRadiiLow(0);
811
812 upar[5]=rlow;
813 upar[6]=rlow+.01;
814 upar[8]=upar[5];
815 upar[9]=upar[6];
816 //
817 gGeoManager->Node("TPC_Strip",1,"TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
818 gGeoManager->Node("TPC_Strip",totrows+1,
819 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
820 //
821 // now, strips optionally
822 //
823 if(fSens){
824 //lower sectors
825 for(Int_t i=2;i<fTPCParam->GetNRowLow()+1;i++){
826 rlow=fTPCParam->GetPadRowRadiiLow(i-1);
827 upar[5]=rlow;
828 upar[6]=rlow+.01;
829 upar[8]=upar[5];
830 upar[9]=upar[6];
831 gGeoManager->Node("TPC_Strip",i,
832 "TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
833 gGeoManager->Node("TPC_Strip",totrows+i,
834 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
835 }
836 //upper sectors
837 for(Int_t i=1;i<fTPCParam->GetNRowUp()+1;i++){
838 rlow=fTPCParam->GetPadRowRadiiUp(i-1);
839 upar[5]=rlow;
840 upar[6]=rlow+.01;
841 upar[8]=upar[5];
842 upar[9]=upar[6];
843 gGeoManager->Node("TPC_Strip",i+fTPCParam->GetNRowLow(),
844 "TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
845 gGeoManager->Node("TPC_Strip",totrows+i+fTPCParam->GetNRowLow(),
846 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
847 }
848 }//strips
37831078 849 //----------------------------------------------------------
0f788f87 850 // TPC Support Rods - MAKROLON
37831078 851 //----------------------------------------------------------
c1637e41 852 TGeoMedium *m6=gGeoManager->GetMedium("TPC_Makrolon");
853 TGeoMedium *m7=gGeoManager->GetMedium("TPC_Cu");
78134e48 854 TGeoMedium *m10 = gGeoManager->GetMedium("TPC_Alumina");
855 TGeoMedium *m11 = gGeoManager->GetMedium("TPC_Peek");
856 TGeoMedium *m12 = gGeoManager->GetMedium("TPC_Water");
0f788f87 857 TGeoMedium *m13 = gGeoManager->GetMedium("TPC_Brass");
858 //
859 // tpc rod is an assembly of 10 long parts and 2 short parts
860 // connected with alu rings and plagged on both sides.
c1637e41 861 //
c1637e41 862 //
0f788f87 863// tpc rod long
864//
865 TGeoPcon *rod = new TGeoPcon("rod",0.,360.,6);
866 rod->DefineSection(0,-10.43,1.92,2.08);
867 rod->DefineSection(1,-9.75,1.92,2.08);
868
869 rod->DefineSection(2,-9.75,1.8,2.2);
870 rod->DefineSection(3,9.75,1.8,2.2);
871
872 rod->DefineSection(4,9.75,1.92,2.08);
873 rod->DefineSection(5,10.43,1.92,2.08);
874 //
875 TGeoVolume *mrodl = new TGeoVolume("TPC_mrodl",rod,m6);
876 //
877 // tpc rod short
878 //
879 TGeoPcon *rod1 = new TGeoPcon("rod1",0.,360.,6);
880 rod1->DefineSection(0,-8.93,1.92,2.08);
881 rod1->DefineSection(1,-8.25,1.92,2.08);
882
883 rod1->DefineSection(2,-8.25,1.8,2.2);
884 rod1->DefineSection(3,8.25,1.8,2.2);
885
886 rod1->DefineSection(4,8.25,1.92,2.08);
887 rod1->DefineSection(5,8.93,1.92,2.08);
888 //
889 TGeoVolume *mrods = new TGeoVolume("TPC_mrods",rod1,m6);
890 //
891 // below is for the resistor rod
892 //
893 // hole for the brass connectors
894 //
895
896 new TGeoTube("hhole",0.,0.3,0.3);
897 //
898 //transformations for holes - initialy they
899 // are placed at x=0 and negative y
900 //
901 TGeoRotation *rhole = new TGeoRotation();
902 rhole->RotateX(90.);
903 TGeoCombiTrans *transf[13];
904 Char_t name[30];
905 for(Int_t i=0;i<13;i++){
906 sprintf(name,"transf%d",i);
907 transf[i]= new TGeoCombiTrans(name,0.,-2.,-9.+i*1.5,rhole);
908 transf[i]->RegisterYourself();
909 }
910 // union expression for holes
911 TString operl("hhole:transf0");
912 for (Int_t i=1;i<13;i++){
913 sprintf(name,"+hhole:transf%d",i);
914 operl.Append(name);
915 }
78134e48 916 //
0f788f87 917 TString opers("hhole:transf1");
918 for (Int_t i=2;i<12;i++){
919 sprintf(name,"+hhole:transf%d",i);
920 opers.Append(name);
921 }
922 //union of holes
923 new TGeoCompositeShape("hlv",operl.Data());
924 new TGeoCompositeShape("hsv",opers.Data());
925 //
926 TGeoCompositeShape *rodl = new TGeoCompositeShape("rodl","rod-hlv");
927 TGeoCompositeShape *rods = new TGeoCompositeShape("rods","rod1-hsv");
928 //rods - volumes - makrolon rods with holes
929 TGeoVolume *rodlv = new TGeoVolume("TPC_rodl",rodl,m6);
930 TGeoVolume *rodsv = new TGeoVolume("TPC_rods",rods,m6);
931 //brass connectors
932 //connectors
933 TGeoTube *bcon = new TGeoTube(0.,0.3,0.3);//connectors
934 TGeoVolume *bconv = new TGeoVolume("TPC_bcon",bcon,m13);
935 //
936 // hooks holding strips
937 //
938 new TGeoBBox("hk1",0.625,0.015,0.75);
939 new TGeoBBox("hk2",0.625,0.015,0.15);
940 TGeoTranslation *tr21 = new TGeoTranslation("tr21",0.,-0.03,-0.6);
941 TGeoTranslation *tr12 = new TGeoTranslation("tr12",0.,-0.03,0.6);
942 tr21->RegisterYourself();
943 tr12->RegisterYourself();
944
945 TGeoCompositeShape *hook = new TGeoCompositeShape("hook","hk1+hk2:tr21+hk2:tr12");
946 TGeoVolume *hookv = new TGeoVolume("TPC_hook",hook,m13);
947 //
948 // assembly of the short rod with connectors and hooks
949 //
950 //
951 // short rod
952 //
953 TGeoVolumeAssembly *spart = new TGeoVolumeAssembly("TPC_spart");
954 //
955 spart->AddNode( rodsv,1);
956 for(Int_t i=1;i<12;i++){
957 spart->AddNode(bconv,i,transf[i]);
958 }
959 for(Int_t i =0;i<11;i++){
960 spart->AddNode(hookv,i+1,new TGeoTranslation(0.,-2.3,-7.5+i*1.5));
961 }
962 //
963 // long rod
964 //
965 TGeoVolumeAssembly *lpart = new TGeoVolumeAssembly("TPC_lpart");
966 //
967 lpart->AddNode( rodlv,1);
968 for(Int_t i=0;i<13;i++){
969 lpart->AddNode(bconv,i,transf[i]);
970 }
971 for(Int_t i =0;i<13;i++){
972 lpart->AddNode(hookv,i+1,new TGeoTranslation(0.,-2.3,-9.+i*1.5));
973 }
974 //
975 // alu ring
976 //
977 new TGeoTube("ring1",2.1075,2.235,0.53);
978 new TGeoTube("ring2",1.7925,1.89,0.43);
979 new TGeoTube("ring3",1.89,2.1075,0.05);
980 TGeoCompositeShape *ring = new TGeoCompositeShape("ring","ring1+ring2+ring3");
981 TGeoVolume *ringv = new TGeoVolume("TPC_ring",ring,m3);
982 //
983 // rod assembly
984 //
985 TGeoVolumeAssembly *tpcrod = new TGeoVolumeAssembly("TPC_rod");//rrod
986 TGeoVolumeAssembly *tpcmrod = new TGeoVolumeAssembly("TPC_mrod");//makrolon rod
987 //long pieces
988 for(Int_t i=0;i<11;i++){
989 tpcrod->AddNode(ringv,i+1,new TGeoTranslation(0.,0.,-105.+i*21));
990 tpcmrod->AddNode(ringv,i+12,new TGeoTranslation(0.,0.,-105.+i*21));
991 }
992 for(Int_t i=0;i<10;i++){
993 tpcrod->AddNode(lpart,i+1,new TGeoTranslation(0.,0.,-94.5+i*21));
994 tpcmrod->AddNode(mrodl,i+1,new TGeoTranslation(0.,0.,-94.5+i*21));
995 }
78134e48 996 //
0f788f87 997 // short pieces
78134e48 998 //
0f788f87 999 tpcrod->AddNode(spart,1,new TGeoTranslation(0.,0.,-114.));
1000 tpcrod->AddNode(spart,2,new TGeoTranslation(0.,0.,114.));
1001 tpcrod->AddNode(ringv,23,new TGeoTranslation(0.,0.,-123.));
1002 tpcrod->AddNode(ringv,24,new TGeoTranslation(0.,0.,123.));
78134e48 1003 //
0f788f87 1004 tpcmrod->AddNode(mrods,1,new TGeoTranslation(0.,0.,-114.));
1005 tpcmrod->AddNode(mrods,2,new TGeoTranslation(0.,0.,114.));
1006 tpcmrod->AddNode(ringv,25,new TGeoTranslation(0.,0.,-123.));
1007 tpcmrod->AddNode(ringv,26,new TGeoTranslation(0.,0.,123.));
1008 //
1009 // left plaque
78134e48 1010 //
0f788f87 1011 TGeoPcon *lp = new TGeoPcon(0.,360.,4);
78134e48 1012 //
0f788f87 1013 lp->DefineSection(0,-125.8,1.92,2.235);
1014 lp->DefineSection(1,-124.8,1.92,2.235);
78134e48 1015 //
0f788f87 1016 lp->DefineSection(2,-124.8,1.92,2.08);
1017 lp->DefineSection(3,-123.1,1.92,2.08);
78134e48 1018 //
0f788f87 1019 TGeoVolume *lpv1 = new TGeoVolume("TPC_lpv1",lp,m6);
1020 TGeoVolume *lpv2 = new TGeoVolume("TPC_lpv2",lp,m6);
1021 // left ring
1022 TGeoTube *lr = new TGeoTube(2.1075,2.235,0.5);
1023 TGeoVolume *lrv = new TGeoVolume("TPC_lrv",lr,m3);
78134e48 1024 //
0f788f87 1025 lpv2->AddNode(lrv,1,new TGeoTranslation(0.,0.,-125.3));
78134e48 1026 //
0f788f87 1027 tpcrod->AddNode(lpv2,1);
1028 tpcmrod->AddNode(lpv1,1);
78134e48 1029 //
0f788f87 1030 // right plaque
78134e48 1031 //
0f788f87 1032 TGeoTube *rp = new TGeoTube(1.92,2.08,2.25);
1033 TGeoVolume *rpv = new TGeoVolume("TPC_rpv",rp,m6);
1034 tpcrod->AddNode(rpv,1, new TGeoTranslation(0.,0.,125.35));
1035 tpcmrod->AddNode(rpv,2,new TGeoTranslation(0.,0.,125.35));
78134e48 1036 //
a3d2be59 1037 //
0f788f87 1038 //HV rods - makrolon + 0.58cm (diameter) Cu
1039 TGeoTube *hvr = new TGeoTube(0.,1.465,126.7);
1040 TGeoTube *hvc = new TGeoTube(0.,0.29,126.7);
1041 //
1042 TGeoVolume *hvrv = new TGeoVolume("TPC_HV_Rod",hvr,m6);
1043 TGeoVolume *hvcv = new TGeoVolume("TPC_HV_Cable",hvc,m7);
1044 hvrv->AddNode(hvcv,1);
78134e48 1045 //
0f788f87 1046 //resistor rod
1047 //
1048 TGeoTube *cr = new TGeoTube(0.,0.45,126.7);
1049 TGeoTube *cw = new TGeoTube(0.,0.15,126.7);
1050 TGeoVolume *crv = new TGeoVolume("TPC_CR",cr,m10);
1051 TGeoVolume *cwv = new TGeoVolume("TPC_W",cw,m11);
1052 //
1053 // ceramic rod with water
1054 //
1055 crv->AddNode(cwv,1);
1056 //
1057 //peek rod
1058 //
1059 TGeoTube *pr =new TGeoTube(0.2,0.35,126.7);
1060 TGeoVolume *prv = new TGeoVolume("TPC_PR",pr,m12);
1061 //
1062 // copper plates with connectors
1063 //
1064 new TGeoTube("tub",0.,1.7,0.025);
1065 //
1066 // half space - points on the plane and a normal vector
1067 //
1068 Double_t n[3],p[3];
1069 Double_t slope = TMath::Tan(22.*TMath::DegToRad());
1070 Double_t intp = 1.245;
1071 //
1072 Double_t b = slope*slope+1.;
1073 p[0]=intp*slope/b;
1074 p[1]=-intp/b;
1075 p[2]=0.;
1076 //
1077 n[0]=-p[0];
1078 n[1]=-p[1];
1079 n[2]=0.;
1080 Double_t norm;
1081 norm=TMath::Sqrt(n[0]*n[0]+n[1]*n[1]);
1082 n[0] /= norm;
1083 n[1] /=norm;
1084 //
1085 new TGeoHalfSpace("sp1",p,n);
1086 //
1087 slope = -slope;
1088 //
1089 p[0]=intp*slope/b;
1090 p[1]=-intp/b;
1091 //
1092 n[0]=-p[0];
1093 n[1]=-p[1];
1094 norm=TMath::Sqrt(n[0]*n[0]+n[1]*n[1]);
1095 n[0] /= norm;
1096 n[1] /=norm;
1097 //
1098 new TGeoHalfSpace("sp2",p,n);
1099 // holes for rods
1100 //holes
1101 new TGeoTube("h1",0.,0.5,0.025);
1102 new TGeoTube("h2",0.,0.35,0.025);
1103 //translations:
1104 TGeoTranslation *ttr11 = new TGeoTranslation("ttr11",-0.866,0.5,0.);
1105 TGeoTranslation *ttr22 = new TGeoTranslation("ttr22",0.866,0.5,0.);
1106 ttr11->RegisterYourself();
1107 ttr22->RegisterYourself();
1108 // elastic connector
1109 new TGeoBBox("elcon",0.72,0.005,0.3);
1110 TGeoRotation *crr1 = new TGeoRotation();
1111 crr1->RotateZ(-22.);
1112TGeoCombiTrans *ctr1 = new TGeoCombiTrans("ctr1",-0.36011, -1.09951,-0.325,crr1);
1113ctr1->RegisterYourself();
1114 TGeoCompositeShape *cs1 = new TGeoCompositeShape("cs1",
1115"(((((tub-h1:ttr11)-h1:ttr22)-sp1)-sp2)-h2)+elcon:ctr1");
1116 //
1117 TGeoVolume *csvv = new TGeoVolume("TPC_RR_CU",cs1,m7);
1118 //
1119 // resistor rod assembly 2 ceramic rods, peak rod, Cu plates
1120 // and resistors
1121 //
1122 TGeoVolumeAssembly *rrod = new TGeoVolumeAssembly("TPC_RROD");
1123 // rods
1124 rrod->AddNode(crv,1,ttr11);
1125 rrod->AddNode(crv,2,ttr22);
1126 rrod->AddNode(prv,1);
1127 //Cu plates
1128 for(Int_t i=0;i<165;i++){
1129 rrod->AddNode(csvv,i+1,new TGeoTranslation(0.,0.,-122.675+i*1.5));
1130 }
1131 //resistors
1132 TGeoTube *res = new TGeoTube(0.,0.15,0.5);
1133 TGeoVolume *resv = new TGeoVolume("TPC_RES",res,m10);
1134 TGeoVolumeAssembly *ress = new TGeoVolumeAssembly("TPC_RES_CH");
1135 ress->AddNode(resv,1,new TGeoTranslation(0.2,0.,0.));
1136 ress->AddNode(resv,2,new TGeoTranslation(-0.2,0.,0.));
1137 //
1138 TGeoRotation *crr2 = new TGeoRotation();
1139 crr2->RotateY(30.);
1140 TGeoRotation *crr3 = new TGeoRotation();
1141 crr3->RotateY(-30.);
1142 //
1143 for(Int_t i=0;i<164;i+=2){
1144 rrod->AddNode(ress,i+1, new TGeoCombiTrans(0.,1.2,-121.925+i*1.5,crr2));
1145 rrod->AddNode(ress,i+2, new TGeoCombiTrans(0.,1.2,-121.925+(i+1)*1.5,crr3));
1146 }
1147 rrod->AddNode(tpcrod,1,new TGeoCombiTrans(0.,0.,0.9,crr1));
1148
1149 //------------------------------------------------------------------
1150 TGeoRotation refl("refl",90.,0.,90.,90.,180.,0.);
1151 TGeoRotation rotrod("rotrod");
0f788f87 1152 //
2d1d58a6 1153 TGeoRotation *rotpos[2];
1154 //
1155 TGeoRotation *rotrod1[2];
0f788f87 1156
1157 //v9 - drift gas
1158
7281dc07 1159 for(Int_t i=0;i<18;i++){
c1637e41 1160 Double_t angle,x,y;
1161 Double_t z,r;
1162 angle=TMath::DegToRad()*20.*(Double_t)i;
0f788f87 1163 //inner rods
c1637e41 1164 r=81.5;
1165 x=r * TMath::Cos(angle);
1166 y=r * TMath::Sin(angle);
0f788f87 1167 z = 126.;
78134e48 1168 //
0f788f87 1169 if(i==11){//resistor rod inner
1170 rotrod.RotateZ(-90.+angle);
2d1d58a6 1171 rotrod1[0]= new TGeoRotation();
1172 rotpos[0]= new TGeoRotation();
1173 //
1174 rotrod1[0]->RotateZ(-90.+angle);
1175 *rotpos[0] = refl*rotrod; //rotation+reflection
1176 v9->AddNode(rrod,1,new TGeoCombiTrans(x,y, z, rotrod1[0])); //A
1177 v9->AddNode(rrod,2,new TGeoCombiTrans(x,y,-z, rotpos[0])); //C
78134e48 1178 }
1179 else {
0f788f87 1180 v9->AddNode(tpcmrod,i+1,new TGeoTranslation(x,y,z));//shaft
1181 v9->AddNode(tpcmrod,i+19,new TGeoCombiTrans(x,y,-z,ref));//muon
37831078 1182 }
0f788f87 1183 // outer rods
c1637e41 1184 r=254.25;
1185 x=r * TMath::Cos(angle);
1186 y=r * TMath::Sin(angle);
0f788f87 1187 z=126.;
78134e48 1188 //
0f788f87 1189 if(i==3){//resistor rod outer
1190 rotrod.RotateZ(90.+angle);
2d1d58a6 1191 rotrod1[1]= new TGeoRotation();
1192 rotpos[1]= new TGeoRotation();
1193 rotrod1[1]->RotateZ(90.+angle);
1194 *rotpos[1] = refl*rotrod;//rotation+reflection
1195 v9->AddNode(rrod,3,new TGeoCombiTrans(x,y, z, rotrod1[1])); //A
1196 v9->AddNode(rrod,4,new TGeoCombiTrans(x,y, -z, rotpos[1])); //C
78134e48 1197 }
0f788f87 1198 else {
1199 v9->AddNode(tpcmrod,i+37,new TGeoTranslation(x,y,z));//shaft
1200 v9->AddNode(tpcmrod,i+55,new TGeoCombiTrans(x,y,-z,ref));//muon
78134e48 1201 }
0f788f87 1202 if(i==15){
1203 v9->AddNode(hvrv,1,new TGeoTranslation(x,y,z)); //hv->A-side only
78134e48 1204 }
0f788f87 1205 } //end of rods positioning
69776907 1206
bde68ab0 1207 TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
1208 alice->AddNode(v1,1);
c1637e41 1209
1283eee5 1210} // end of function
fe4da5cc 1211
1212//_____________________________________________________________________________
ac81c411 1213void AliTPCv2::AddAlignableVolumes() const
1214{
1215 //
1216 // Create entries for alignable volumes associating the symbolic volume
1217 // name with the corresponding volume path. Needs to be syncronized with
1218 // eventual changes in the geometry.
1219 //
1220 SetInnerChambersAlignable();
1221 SetOuterChambersAlignable();
1222}
1223
1224//_____________________________________________________________________________
1225void AliTPCv2::SetInnerChambersAlignable() const
1226{
1227 //
cdf69b9a 1228 AliGeomManager::ELayerID idTPC1 = AliGeomManager::kTPC1;
1229 Int_t modUID, modnum = 0;
d899e254 1230 TString vpstr1 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_1/TPC_SECT_";
1231 TString vpstr2 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_2/TPC_SECT_";
1232 TString vpappend = "/TPC_IROC_1";
1233 TString snstr1="TPC/EndcapA/Sector";
1234 TString snstr2="TPC/EndcapC/Sector";
1235 TString snappend="/InnerChamber";
ac81c411 1236 TString volpath, symname;
1237
1ac29fc4 1238 for(Int_t cnt=1; cnt<=18; cnt++){
cdf69b9a 1239 modUID = AliGeomManager::LayerToVolUID(idTPC1,modnum++);
1ac29fc4 1240 volpath = vpstr1;
1241 volpath += cnt;
1242 volpath += vpappend;
1243 symname = snstr1;
1244 symname += cnt;
1245 symname += snappend;
cdf69b9a 1246 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
84cbbd90 1247 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
cdf69b9a 1248 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID);
1249 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
1ac29fc4 1250 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,cnt-1);
1251 alignableEntry->SetMatrix(matTtoL);
1ac29fc4 1252 }
65293f49 1253
ac81c411 1254 for(Int_t cnt=1; cnt<=18; cnt++){
cdf69b9a 1255 modUID = AliGeomManager::LayerToVolUID(idTPC1,modnum++);
d899e254 1256 volpath = vpstr2;
ac81c411 1257 volpath += cnt;
d899e254 1258 volpath += vpappend;
1259 symname = snstr2;
ac81c411 1260 symname += cnt;
d899e254 1261 symname += snappend;
cdf69b9a 1262 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
84cbbd90 1263 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
cdf69b9a 1264 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID);
1265 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
1ac29fc4 1266 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,18+cnt-1);
1267 alignableEntry->SetMatrix(matTtoL);
ac81c411 1268 }
1269}
1270
ac81c411 1271//_____________________________________________________________________________
1272void AliTPCv2::SetOuterChambersAlignable() const
1273{
1274 //
cdf69b9a 1275 AliGeomManager::ELayerID idTPC2 = AliGeomManager::kTPC2;
1276 Int_t modUID, modnum = 0;
d899e254 1277 TString vpstr1 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_1/TPC_SECT_";
1278 TString vpstr2 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_2/TPC_SECT_";
1279 TString vpappend = "/TPC_OROC_1";
1280 TString snstr1="TPC/EndcapA/Sector";
1281 TString snstr2="TPC/EndcapC/Sector";
1282 TString snappend="/OuterChamber";
ac81c411 1283 TString volpath, symname;
1284
1285 for(Int_t cnt=1; cnt<=18; cnt++){
cdf69b9a 1286 modUID = AliGeomManager::LayerToVolUID(idTPC2,modnum++);
d899e254 1287 volpath = vpstr1;
ac81c411 1288 volpath += cnt;
d899e254 1289 volpath += vpappend;
1290 symname = snstr1;
ac81c411 1291 symname += cnt;
d899e254 1292 symname += snappend;
cdf69b9a 1293 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
84cbbd90 1294 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
cdf69b9a 1295 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID);
1296 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
1ac29fc4 1297 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,36+cnt-1);
1298 alignableEntry->SetMatrix(matTtoL);
ac81c411 1299 }
84cbbd90 1300
ac81c411 1301 for(Int_t cnt=1; cnt<=18; cnt++){
cdf69b9a 1302 modUID = AliGeomManager::LayerToVolUID(idTPC2,modnum++);
d899e254 1303 volpath = vpstr2;
ac81c411 1304 volpath += cnt;
d899e254 1305 volpath += vpappend;
1306 symname = snstr2;
ac81c411 1307 symname += cnt;
d899e254 1308 symname += snappend;
cdf69b9a 1309 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
84cbbd90 1310 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
cdf69b9a 1311 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID);
1312 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
1ac29fc4 1313 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,36+18+cnt-1);
1314 alignableEntry->SetMatrix(matTtoL);
ac81c411 1315 }
1316}
1317
1318//_____________________________________________________________________________
d899e254 1319void AliTPCv2::DrawDetector() const
fe4da5cc 1320{
1321 //
1322 // Draw a shaded view of the Time Projection Chamber version 1
1323 //
1324
fe4da5cc 1325 // Set everything unseen
cfce8870 1326 gMC->Gsatt("*", "seen", -1);
fe4da5cc 1327 //
1328 // Set ALIC mother transparent
cfce8870 1329 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 1330 //
1331 // Set the volumes visible
37831078 1332 //
1333
1334 gMC->Gsatt("TPC ","SEEN",0);
1335 gMC->Gsatt("TOIN","SEEN",1);
1336 gMC->Gsatt("TOIN","COLO",7);
37831078 1337 gMC->Gsatt("TOCV","SEEN",1);
1338 gMC->Gsatt("TOCV","COLO",4);
1339 gMC->Gsatt("TSA1","SEEN",0);
1340 gMC->Gsatt("TSA2","SEEN",0);
1341 gMC->Gsatt("TSA3","SEEN",0);
79575d04 1342 gMC->Gsatt("TSA4","SEEN",0);
1343 gMC->Gsatt("TSA5","SEEN",0);
37831078 1344 gMC->Gsatt("TOFC","SEEN",1);
1345 gMC->Gsatt("TOFC","COLO",4);
37831078 1346 gMC->Gsatt("TSA6","SEEN",0);
1347 gMC->Gsatt("TSA7","SEEN",0);
79575d04 1348 gMC->Gsatt("TSA8","SEEN",0);
37831078 1349 gMC->Gsatt("TIIN","SEEN",1);
79575d04 1350 gMC->Gsatt("TIIN","COLO",7);
1351 gMC->Gsatt("TII1","SEEN",0);
1352 gMC->Gsatt("TIFC","SEEN",1);
1353 gMC->Gsatt("TIFC","COLO",4);
1354 gMC->Gsatt("TSA9","SEEN",0);
37831078 1355 gMC->Gsatt("TS10","SEEN",0);
1356 gMC->Gsatt("TS11","SEEN",0);
1357 gMC->Gsatt("TS12","SEEN",0);
37831078 1358 gMC->Gsatt("TS13","SEEN",0);
1359 gMC->Gsatt("TS14","SEEN",0);
79575d04 1360 gMC->Gsatt("TICC","SEEN",0);
1361 gMC->Gsatt("TICM","SEEN",0);
37831078 1362 gMC->Gsatt("TS15","SEEN",0);
1363 gMC->Gsatt("TS16","SEEN",0);
37831078 1364 gMC->Gsatt("TS17","SEEN",0);
79575d04 1365 gMC->Gsatt("TS18","SEEN",0);
1366 gMC->Gsatt("TS19","SEEN",0);
1367 gMC->Gsatt("TPJ1","SEEN",0);
1368 gMC->Gsatt("TPJ2","SEEN",0);
1369 gMC->Gsatt("TICS","SEEN",0);
1370 gMC->Gsatt("TDGN","SEEN",0);
37831078 1371 gMC->Gsatt("TIRC","SEEN",0);
1372 gMC->Gsatt("TIC1","SEEN",1);
1373 gMC->Gsatt("TIPP","SEEN",0);
1374 gMC->Gsatt("TIC3","SEEN",0);
1375 gMC->Gsatt("TRCE","SEEN",0);
1376 gMC->Gsatt("TPSC","SEEN",0);
79575d04 1377 gMC->Gsatt("TPCC","SEEN",0);
37831078 1378 gMC->Gsatt("TORC","SEEN",0);
1379 gMC->Gsatt("TOPP","SEEN",0);
1380 gMC->Gsatt("TOC3","SEEN",0);
1381 gMC->Gsatt("TOC1","SEEN",1);
1382 gMC->Gsatt("TSSW","SEEN",1);
1383 gMC->Gsatt("TSWC","SEEN",1);
37831078 1384 gMC->Gsatt("TSSW","COLO",3);
1385 gMC->Gsatt("TSWC","COLO",3);
1386 gMC->Gsatt("TSCE","COLO",6);
79575d04 1387 gMC->Gsatt("TSCE","SEEN",1);
37831078 1388 gMC->Gsatt("TWES","SEEN",0);
1389 gMC->Gsatt("TSWB","SEEN",0);
1390 gMC->Gsatt("TPEL","SEEN",0);
1391 gMC->Gsatt("TPMW","SEEN",1);
37831078 1392 gMC->Gsatt("TESR","SEEN",1);
1393 gMC->Gsatt("TPMW","COLO",12);
37831078 1394 gMC->Gsatt("TIC1","COLO",5);
79575d04 1395 gMC->Gsatt("TOC1","COLO",5);
37831078 1396 gMC->Gsatt("TESB","SEEN",0);
37831078 1397 gMC->Gsatt("THVM","SEEN",1);
1398 gMC->Gsatt("THVM","COLO",11);
79575d04 1399 gMC->Gsatt("THVH","SEEN",0);
1400 gMC->Gsatt("TPSR","SEEN",0);
37831078 1401 gMC->Gsatt("THVL","SEEN",0);
79575d04 1402 gMC->Gsatt("THVC","SEEN",0);
37831078 1403 gMC->Gsatt("THVE","SEEN",0);
1404 gMC->Gsatt("THVR","SEEN",0);
79575d04 1405 gMC->Gsatt("TPSS","SEEN",0);
1406 gMC->Gsatt("TPUS","SEEN",0);
1407 gMC->Gsatt("TPLS","SEEN",0);
37831078 1408
fe4da5cc 1409 //
cfce8870 1410 gMC->Gdopt("hide", "on");
1411 gMC->Gdopt("shad", "on");
1412 gMC->Gsatt("*", "fill", 7);
1413 gMC->SetClipBox(".");
37831078 1414 gMC->SetClipBox("TPMW",-300,300,-300,300,254.,270.);
1415 gMC->SetClipBox("TESR",-300,300,-300,300,254.,270.);
1416 gMC->SetClipBox("TSSW",-300,300,-300,300,283.,284.);
1417 gMC->SetClipBox("TSWC",-300,300,-300,300,283.,284.);
1418 gMC->SetClipBox("*", 0, 300, -300, 300, -290, 290);
cfce8870 1419 gMC->DefaultRange();
1420 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
1421 gMC->Gdhead(1111, "Time Projection Chamber");
1422 gMC->Gdman(18, 4, "MAN");
1423 gMC->Gdopt("hide","off");
fe4da5cc 1424}
1425
1426//_____________________________________________________________________________
1427void AliTPCv2::CreateMaterials()
1428{
1429 //
1430 // Define materials for version 2 of the Time Projection Chamber
1431 //
37831078 1432
fe4da5cc 1433 AliTPC::CreateMaterials();
1434}
1435
1436//_____________________________________________________________________________
1437void AliTPCv2::Init()
1438{
1439 //
1440 // Initialises version 2 of the TPC after that it has been built
1441 //
37831078 1442
1443 Int_t *idtmed = fIdtmed->GetArray();
1444
fe4da5cc 1445 AliTPC::Init();
d4c354b9 1446
c1637e41 1447
1448 fIdSens=gMC->VolId("TPC_Strip"); // one strip is always selected...
d4c354b9 1449
c1637e41 1450 fIDrift=gMC->VolId("TPC_Drift");
1451 fSecOld=-100; // fake number
fe4da5cc 1452
d9888f70 1453 gMC->SetMaxNStep(-30000); // max. number of steps increased
fe4da5cc 1454
4481461d 1455 if (fPrimaryIonisation) {
1456 gMC->Gstpar(idtmed[2],"PRIMIO_E", 20.77); // 1st ionisation potential
1457
1458 gMC->Gstpar(idtmed[2],"PRIMIO_N", 14.35);
1459 gMC->Gstpar(idtmed[2],"LOSS", 14); // specific energy loss
8143dfb2 1460 gMC->Gstpar(idtmed[2],"STRA",4);
4481461d 1461 } else {
1462 gMC->Gstpar(idtmed[2],"LOSS", 5); // specific energy loss
1463 }
1464
fe4da5cc 1465
a9d15241 1466 AliDebug(1,"*** TPC version 2 initialized ***");
1467 AliDebug(1,Form("Maximum number of steps = %d",gMC->GetMaxNStep()));
fe4da5cc 1468
1469 //
1470
1471}
1472
1473//_____________________________________________________________________________
1474void AliTPCv2::StepManager()
1475{
1476 //
1477 // Called for every step in the Time Projection Chamber
1478 //
1479
1480 //
1481 // parameters used for the energy loss calculations
1482 //
73042f01 1483 const Float_t kprim = 14.35; // number of primary collisions per 1 cm
1484 const Float_t kpoti = 20.77e-9; // first ionization potential for Ne/CO2
1485 const Float_t kwIon = 35.97e-9; // energy for the ion-electron pair creation
ec6ac410 1486 const Int_t kMaxDistRef =15; // maximal difference between 2 stored references
fe4da5cc 1487
73042f01 1488 const Float_t kbig = 1.e10;
fe4da5cc 1489
1490 Int_t id,copy;
e61fd20d 1491 Float_t hits[5];
fe4da5cc 1492 Int_t vol[2];
37831078 1493 TLorentzVector p;
fe4da5cc 1494
37831078 1495 vol[1]=0; // preset row number to 0
fe4da5cc 1496 //
b97617a6 1497 if (fPrimaryIonisation) gMC->SetMaxStep(kbig);
fe4da5cc 1498
0a6d8768 1499 if(!gMC->IsTrackAlive()) return; // particle has disappeared
fe4da5cc 1500
cfce8870 1501 Float_t charge = gMC->TrackCharge();
fe4da5cc 1502
1503 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1504
37831078 1505 // check the sensitive volume
1506
c1637e41 1507 id = gMC->CurrentVolID(copy); // vol ID and copy number (starts from 1!)
1508 if(id != fIDrift && id != fIdSens) return; // not in the sensitive folume
da33556f 1509
c1637e41 1510 gMC->TrackPosition(p);
1511 Double_t r = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
1512 //
1513
1514 //
1515 Double_t angle = TMath::ACos(p[0]/r);
1516 angle = (p[1]<0.) ? TMath::TwoPi()-angle : angle;
1517 //
1518 // angular segment, it is not a real sector number...
1519 //
1520 Int_t sector=TMath::Nint((angle-fTPCParam->GetInnerAngleShift())/
1521 fTPCParam->GetInnerAngle());
1522 // rotate to segment "0"
1523 Float_t cos,sin;
1524 fTPCParam->AdjustCosSin(sector,cos,sin);
1525 Float_t x1=p[0]*cos + p[1]*sin;
1526 // check if within sector's limits
5bd5dbc4 1527 if((x1>=fTPCParam->GetInnerRadiusLow()&&x1<=fTPCParam->GetInnerRadiusUp())
1528 ||(x1>=fTPCParam->GetOuterRadiusLow()&&x1<=fTPCParam->GetOuterRadiusUp())){
c1637e41 1529 // calculate real sector number...
1530 if (x1>fTPCParam->GetOuterRadiusLow()){
1531 sector = TMath::Nint((angle-fTPCParam->GetOuterAngleShift())/
1532 fTPCParam->GetOuterAngle())+fTPCParam->GetNInnerSector();
1533 if (p[2]<0) sector+=(fTPCParam->GetNOuterSector()>>1);
37831078 1534 }
c1637e41 1535 else
1536 if (p[2]<0) sector+=(fTPCParam->GetNInnerSector()>>1);
1537 //
1538 // here I have a sector number
1539 //
37831078 1540
c1637e41 1541 vol[0]=sector;
ec6ac410 1542
1543 static Double_t lastReferenceR=0;
1544 if (TMath::Abs(lastReferenceR-r)>kMaxDistRef){
1545 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kTPC);
1546 lastReferenceR = r;
1547 }
1548
c1637e41 1549 // check if change of sector
1550 if(sector != fSecOld){
1551 fSecOld=sector;
1552 // add track reference
e6add757 1553 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kTPC);
c1637e41 1554 }
1555 // track is in the sensitive strip
1556 if(id == fIdSens){
1557 // track is entering the strip
1558 if (gMC->IsTrackEntering()){
1559 Int_t totrows = fTPCParam->GetNRowLow()+fTPCParam->GetNRowUp();
1560 vol[1] = (copy<=totrows) ? copy-1 : copy-1-totrows;
1561 // row numbers are autonomous for lower and upper sectors
1562 if(vol[0] > fTPCParam->GetNInnerSector()) {
1563 vol[1] -= fTPCParam->GetNRowLow();
1564 }
1565 //
1566 if(vol[0]<fTPCParam->GetNInnerSector()&&vol[1] == 0){
37831078 1567
c1637e41 1568 // lower sector, row 0, because Jouri wants to have this
6a905708 1569
c1637e41 1570 gMC->TrackMomentum(p);
1571 hits[0]=p[0];
1572 hits[1]=p[1];
1573 hits[2]=p[2];
1574 hits[3]=0.; // this hit has no energy loss
1575 // Get also the track time for pileup simulation
1576 hits[4]=gMC->TrackTime();
e61fd20d 1577
c1637e41 1578 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
1579 }
1580 //
e61fd20d 1581
c1637e41 1582 gMC->TrackPosition(p);
1583 hits[0]=p[0];
1584 hits[1]=p[1];
1585 hits[2]=p[2];
1586 hits[3]=0.; // this hit has no energy loss
1587 // Get also the track time for pileup simulation
1588 hits[4]=gMC->TrackTime();
930ee558 1589
c1637e41 1590 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
37831078 1591
c1637e41 1592 }
1593 else return;
1594 }
37831078 1595 //-----------------------------------------------------------------
c1637e41 1596 // charged particle is in the sensitive drift volume
37831078 1597 //-----------------------------------------------------------------
cfce8870 1598 if(gMC->TrackStep() > 0) {
b97617a6 1599 Int_t nel=0;
1600 if (!fPrimaryIonisation) {
1601 nel = (Int_t)(((gMC->Edep())-kpoti)/kwIon) + 1;
1602 }
1603 else {
1604 Float_t edep = gMC->Edep();
1605 if (edep > 0.) nel = (Int_t)((gMC->Edep()*1.5)/kwIon) + 1;
1606 }
fe4da5cc 1607 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
c1637e41 1608 //
37831078 1609 gMC->TrackPosition(p);
1610 hits[0]=p[0];
1611 hits[1]=p[1];
1612 hits[2]=p[2];
fe4da5cc 1613 hits[3]=(Float_t)nel;
c1637e41 1614
fe4da5cc 1615 // Add this hit
c1637e41 1616
6a905708 1617 if (fHitType&&2){
1618 gMC->TrackMomentum(p);
1619 Float_t momentum = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
1620 Float_t precision = (momentum>0.1) ? 0.002 :0.01;
1621 fTrackHits->SetHitPrecision(precision);
1622 }
e61fd20d 1623
1624 // Get also the track time for pileup simulation
1625 hits[4]=gMC->TrackTime();
c1637e41 1626
1627 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
e61fd20d 1628
c1637e41 1629 } // step>0
1630 } //within sector's limits
fe4da5cc 1631 // Stemax calculation for the next step
1632
1633 Float_t pp;
0a6d8768 1634 TLorentzVector mom;
b97617a6 1635 // below is valid only for Geant3 (fPromaryIonisation not set)
1636 if(!fPrimaryIonisation){
1637 gMC->TrackMomentum(mom);
1638 Float_t ptot=mom.Rho();
1639 Float_t betaGamma = ptot/gMC->TrackMass();
595bf2c3 1640
b97617a6 1641 Int_t pid=gMC->TrackPid();
1642 if((pid==kElectron || pid==kPositron) && ptot > 0.002)
1643 {
1644 pp = kprim*1.58; // electrons above 20 MeV/c are on the plateau!
1645 }
1646 else
1647 {
1648
1649 betaGamma = TMath::Max(betaGamma,(Float_t)7.e-3); // protection against too small bg
b40afa5e 1650 pp=kprim*AliMathBase::BetheBlochAleph(betaGamma);
595bf2c3 1651
fe4da5cc 1652 }
1653
b97617a6 1654 Double_t rnd = gMC->GetRandom()->Rndm();
fe4da5cc 1655
b97617a6 1656 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
1657 }
c1637e41 1658
fe4da5cc 1659}
1660
73042f01 1661