Updated SOD to take into account ADD detector + error removal in DA
[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
c1637e41 512 for(Int_t i =0;i<86;i++){
456cb019 513 Double_t y = 3.99;
c1637e41 514 Double_t x,z,ang;
515 in>>x>>z>>ang;
456cb019 516 z-=26.5;
c1637e41 517 TGeoRotation *rrr = new TGeoRotation();
518 rrr->RotateY(ang);
519 TGeoCombiTrans *trans = new TGeoCombiTrans("trans",x,y,z,rrr);
520 ibdv->AddNode(connv,i+1,trans);
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
c1637e41 630 for(Int_t i =0;i<78;i++){
631 Double_t y =3.89;
632 Double_t x,z,ang;
633 Double_t x1,z1,x2,z2;
634 in>>x>>z>>ang;
635 Double_t xr = 4.7*TMath::Sin(ang*TMath::DegToRad());
636 Double_t zr = 4.7*TMath::Cos(ang*TMath::DegToRad());
637 //
638 x1=xr+x; x2=-xr+x; z1=zr+z; z2 = -zr+z;
639 //
640 TGeoRotation *rr = new TGeoRotation();
641 rr->RotateY(ang);
642 z1-=54.95;
643 z2-=54.95;
644 TGeoCombiTrans *trans1 = new TGeoCombiTrans("trans1",x1,y,z1,rr);
645 TGeoCombiTrans *trans2 = new TGeoCombiTrans("trans2",x2,y,z2,rr);
646 obdv->AddNode(connv,i+1,trans1);
647 obdv->AddNode(connv,i+79,trans2);
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 //
716 for(Int_t i =0;i<18;i++){
717 Double_t phi = (20.*i);
718 TGeoRotation *r = new TGeoRotation();
719 r->RotateZ(phi);
a1ec4d07 720 wheela->AddNode(secta,i+1,r);
721 wheelc->AddNode(sectc,i+1,r);
c1637e41 722
723 }
4fa47888 724 // wheels in the drift volume!
a1ec4d07 725
c1637e41 726 TGeoCombiTrans *combi3 = new TGeoCombiTrans("combi3",0.,0.,256.6,ref);
a1ec4d07 727 v9->AddNode(wheela,1,combi3);
728 v9->AddNode(wheelc,2,new TGeoTranslation(0.,0.,-256.6));
c1637e41 729 //_____________________________________________________________
730 // service support wheel
731 //_____________________________________________________________
732 TGeoPgon *sw = new TGeoPgon(0.,20.,1,2);
733 sw->DefineSection(0,-4.,80.5,251.75);
734 sw->DefineSection(1,4.,80.5,251.75);
735 TGeoVolume *swv = new TGeoVolume("TPC_SWSEG",sw,m3); //Al
736 //
737 thick=1.;
d899e254 738 shift = thick/TMath::Sin(openingAngle);
c1637e41 739 TGeoPgon *sh = new TGeoPgon(0.,20.,1,2);
740 sh->DefineSection(0,-4.,81.5-shift,250.75-shift);
741 sh->DefineSection(1,4.,81.5-shift,250.75-shift);
742 TGeoVolume *shv = new TGeoVolume("TPC_SWS1",sh,m1); //Air
743 //
74518339 744 TGeoMedium *m9 = gGeoManager->GetMedium("TPC_Si");
745 TGeoPgon *el = new TGeoPgon(0.,20.,1,2);
746 el->DefineSection(0,-1.872,81.5-shift,250.75-shift);
747 el->DefineSection(1,1.872,81.5-shift,250.75-shift);
748 TGeoVolume *elv = new TGeoVolume("TPC_ELEC",el,m9); //Si
749 //
750 shv->AddNode(elv,1);
751 //
752 //
d899e254 753 ys = shift*TMath::Sin(openingAngle);
754 xs = shift*TMath::Cos(openingAngle);
c1637e41 755 swv->AddNode(shv,1,new TGeoTranslation(xs,ys,0.));
756 // cover
757 TGeoPgon *co = new TGeoPgon(0.,20.,1,2);
758 co->DefineSection(0,-0.5,77.,255.25);
759 co->DefineSection(1,0.5,77.,255.25);
760 TGeoVolume *cov = new TGeoVolume("TPC_SWC1",co,m3);//Al
761 // hole in a cover
762 TGeoPgon *coh = new TGeoPgon(0.,20.,1,2);
d899e254 763 shift=4./TMath::Sin(openingAngle);
c1637e41 764 coh->DefineSection(0,-0.5,85.-shift,247.25-shift);
765 coh->DefineSection(1,0.5,85.-shift,247.25-shift);
766 //
767 TGeoVolume *cohv = new TGeoVolume("TPC_SWC2",coh,m1);
768 //
d899e254 769 ys = shift*TMath::Sin(openingAngle);
770 xs = shift*TMath::Cos(openingAngle);
c1637e41 771 cov->AddNode(cohv,1,new TGeoTranslation(xs,ys,0.));
772 //
773 // Sector as an Assembly
774 //
775 TGeoVolumeAssembly *swhs = new TGeoVolumeAssembly("TPC_SSWSEC");
776 swhs->AddNode(swv,1);
777 swhs->AddNode(cov,1,new TGeoTranslation(0.,0.,-4.5));
778 swhs->AddNode(cov,2,new TGeoTranslation(0.,0.,4.5));
779 //
780 // SSW as an Assembly of sectors
781 //
782 TGeoVolumeAssembly *swheel = new TGeoVolumeAssembly("TPC_SSWHEEL");
783 for(Int_t i =0;i<18;i++){
784 Double_t phi = (20.*i);
785 TGeoRotation *r = new TGeoRotation();
786 r->RotateZ(phi);
787 swheel->AddNode(swhs,i+1,r);
788 }
789 v1->AddNode(swheel,1,new TGeoTranslation(0.,0.,-284.6));
790 v1->AddNode(swheel,2,new TGeoTranslation(0.,0.,284.6));
791
792 // sensitive strips - strip "0" is always set
793 // conditional
794 Int_t totrows;
795 totrows = fTPCParam->GetNRowLow() + fTPCParam->GetNRowUp();
796 Double_t *upar;
797 upar=NULL;
798 gGeoManager->Volume("TPC_Strip","PGON",m5->GetId(),upar);
799 upar=new Double_t [10];
800 upar[0]=0.;
801 upar[1]=360.;
802 upar[2]=18.;
803 upar[3]=2.;
804 //
805 upar[4]=-124.8;
806 upar[7]=124.8;
807
808 Double_t rlow=fTPCParam->GetPadRowRadiiLow(0);
809
810 upar[5]=rlow;
811 upar[6]=rlow+.01;
812 upar[8]=upar[5];
813 upar[9]=upar[6];
814 //
815 gGeoManager->Node("TPC_Strip",1,"TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
816 gGeoManager->Node("TPC_Strip",totrows+1,
817 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
818 //
819 // now, strips optionally
820 //
821 if(fSens){
822 //lower sectors
823 for(Int_t i=2;i<fTPCParam->GetNRowLow()+1;i++){
824 rlow=fTPCParam->GetPadRowRadiiLow(i-1);
825 upar[5]=rlow;
826 upar[6]=rlow+.01;
827 upar[8]=upar[5];
828 upar[9]=upar[6];
829 gGeoManager->Node("TPC_Strip",i,
830 "TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
831 gGeoManager->Node("TPC_Strip",totrows+i,
832 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
833 }
834 //upper sectors
835 for(Int_t i=1;i<fTPCParam->GetNRowUp()+1;i++){
836 rlow=fTPCParam->GetPadRowRadiiUp(i-1);
837 upar[5]=rlow;
838 upar[6]=rlow+.01;
839 upar[8]=upar[5];
840 upar[9]=upar[6];
841 gGeoManager->Node("TPC_Strip",i+fTPCParam->GetNRowLow(),
842 "TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
843 gGeoManager->Node("TPC_Strip",totrows+i+fTPCParam->GetNRowLow(),
844 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
845 }
846 }//strips
37831078 847 //----------------------------------------------------------
0f788f87 848 // TPC Support Rods - MAKROLON
37831078 849 //----------------------------------------------------------
c1637e41 850 TGeoMedium *m6=gGeoManager->GetMedium("TPC_Makrolon");
851 TGeoMedium *m7=gGeoManager->GetMedium("TPC_Cu");
78134e48 852 TGeoMedium *m10 = gGeoManager->GetMedium("TPC_Alumina");
853 TGeoMedium *m11 = gGeoManager->GetMedium("TPC_Peek");
854 TGeoMedium *m12 = gGeoManager->GetMedium("TPC_Water");
0f788f87 855 TGeoMedium *m13 = gGeoManager->GetMedium("TPC_Brass");
856 //
857 // tpc rod is an assembly of 10 long parts and 2 short parts
858 // connected with alu rings and plagged on both sides.
c1637e41 859 //
c1637e41 860 //
0f788f87 861// tpc rod long
862//
863 TGeoPcon *rod = new TGeoPcon("rod",0.,360.,6);
864 rod->DefineSection(0,-10.43,1.92,2.08);
865 rod->DefineSection(1,-9.75,1.92,2.08);
866
867 rod->DefineSection(2,-9.75,1.8,2.2);
868 rod->DefineSection(3,9.75,1.8,2.2);
869
870 rod->DefineSection(4,9.75,1.92,2.08);
871 rod->DefineSection(5,10.43,1.92,2.08);
872 //
873 TGeoVolume *mrodl = new TGeoVolume("TPC_mrodl",rod,m6);
874 //
875 // tpc rod short
876 //
877 TGeoPcon *rod1 = new TGeoPcon("rod1",0.,360.,6);
878 rod1->DefineSection(0,-8.93,1.92,2.08);
879 rod1->DefineSection(1,-8.25,1.92,2.08);
880
881 rod1->DefineSection(2,-8.25,1.8,2.2);
882 rod1->DefineSection(3,8.25,1.8,2.2);
883
884 rod1->DefineSection(4,8.25,1.92,2.08);
885 rod1->DefineSection(5,8.93,1.92,2.08);
886 //
887 TGeoVolume *mrods = new TGeoVolume("TPC_mrods",rod1,m6);
888 //
889 // below is for the resistor rod
890 //
891 // hole for the brass connectors
892 //
893
894 new TGeoTube("hhole",0.,0.3,0.3);
895 //
896 //transformations for holes - initialy they
897 // are placed at x=0 and negative y
898 //
899 TGeoRotation *rhole = new TGeoRotation();
900 rhole->RotateX(90.);
901 TGeoCombiTrans *transf[13];
902 Char_t name[30];
903 for(Int_t i=0;i<13;i++){
904 sprintf(name,"transf%d",i);
905 transf[i]= new TGeoCombiTrans(name,0.,-2.,-9.+i*1.5,rhole);
906 transf[i]->RegisterYourself();
907 }
908 // union expression for holes
909 TString operl("hhole:transf0");
910 for (Int_t i=1;i<13;i++){
911 sprintf(name,"+hhole:transf%d",i);
912 operl.Append(name);
913 }
78134e48 914 //
0f788f87 915 TString opers("hhole:transf1");
916 for (Int_t i=2;i<12;i++){
917 sprintf(name,"+hhole:transf%d",i);
918 opers.Append(name);
919 }
920 //union of holes
921 new TGeoCompositeShape("hlv",operl.Data());
922 new TGeoCompositeShape("hsv",opers.Data());
923 //
924 TGeoCompositeShape *rodl = new TGeoCompositeShape("rodl","rod-hlv");
925 TGeoCompositeShape *rods = new TGeoCompositeShape("rods","rod1-hsv");
926 //rods - volumes - makrolon rods with holes
927 TGeoVolume *rodlv = new TGeoVolume("TPC_rodl",rodl,m6);
928 TGeoVolume *rodsv = new TGeoVolume("TPC_rods",rods,m6);
929 //brass connectors
930 //connectors
931 TGeoTube *bcon = new TGeoTube(0.,0.3,0.3);//connectors
932 TGeoVolume *bconv = new TGeoVolume("TPC_bcon",bcon,m13);
933 //
934 // hooks holding strips
935 //
936 new TGeoBBox("hk1",0.625,0.015,0.75);
937 new TGeoBBox("hk2",0.625,0.015,0.15);
938 TGeoTranslation *tr21 = new TGeoTranslation("tr21",0.,-0.03,-0.6);
939 TGeoTranslation *tr12 = new TGeoTranslation("tr12",0.,-0.03,0.6);
940 tr21->RegisterYourself();
941 tr12->RegisterYourself();
942
943 TGeoCompositeShape *hook = new TGeoCompositeShape("hook","hk1+hk2:tr21+hk2:tr12");
944 TGeoVolume *hookv = new TGeoVolume("TPC_hook",hook,m13);
945 //
946 // assembly of the short rod with connectors and hooks
947 //
948 //
949 // short rod
950 //
951 TGeoVolumeAssembly *spart = new TGeoVolumeAssembly("TPC_spart");
952 //
953 spart->AddNode( rodsv,1);
954 for(Int_t i=1;i<12;i++){
955 spart->AddNode(bconv,i,transf[i]);
956 }
957 for(Int_t i =0;i<11;i++){
958 spart->AddNode(hookv,i+1,new TGeoTranslation(0.,-2.3,-7.5+i*1.5));
959 }
960 //
961 // long rod
962 //
963 TGeoVolumeAssembly *lpart = new TGeoVolumeAssembly("TPC_lpart");
964 //
965 lpart->AddNode( rodlv,1);
966 for(Int_t i=0;i<13;i++){
967 lpart->AddNode(bconv,i,transf[i]);
968 }
969 for(Int_t i =0;i<13;i++){
970 lpart->AddNode(hookv,i+1,new TGeoTranslation(0.,-2.3,-9.+i*1.5));
971 }
972 //
973 // alu ring
974 //
975 new TGeoTube("ring1",2.1075,2.235,0.53);
976 new TGeoTube("ring2",1.7925,1.89,0.43);
977 new TGeoTube("ring3",1.89,2.1075,0.05);
978 TGeoCompositeShape *ring = new TGeoCompositeShape("ring","ring1+ring2+ring3");
979 TGeoVolume *ringv = new TGeoVolume("TPC_ring",ring,m3);
980 //
981 // rod assembly
982 //
983 TGeoVolumeAssembly *tpcrod = new TGeoVolumeAssembly("TPC_rod");//rrod
984 TGeoVolumeAssembly *tpcmrod = new TGeoVolumeAssembly("TPC_mrod");//makrolon rod
985 //long pieces
986 for(Int_t i=0;i<11;i++){
987 tpcrod->AddNode(ringv,i+1,new TGeoTranslation(0.,0.,-105.+i*21));
988 tpcmrod->AddNode(ringv,i+12,new TGeoTranslation(0.,0.,-105.+i*21));
989 }
990 for(Int_t i=0;i<10;i++){
991 tpcrod->AddNode(lpart,i+1,new TGeoTranslation(0.,0.,-94.5+i*21));
992 tpcmrod->AddNode(mrodl,i+1,new TGeoTranslation(0.,0.,-94.5+i*21));
993 }
78134e48 994 //
0f788f87 995 // short pieces
78134e48 996 //
0f788f87 997 tpcrod->AddNode(spart,1,new TGeoTranslation(0.,0.,-114.));
998 tpcrod->AddNode(spart,2,new TGeoTranslation(0.,0.,114.));
999 tpcrod->AddNode(ringv,23,new TGeoTranslation(0.,0.,-123.));
1000 tpcrod->AddNode(ringv,24,new TGeoTranslation(0.,0.,123.));
78134e48 1001 //
0f788f87 1002 tpcmrod->AddNode(mrods,1,new TGeoTranslation(0.,0.,-114.));
1003 tpcmrod->AddNode(mrods,2,new TGeoTranslation(0.,0.,114.));
1004 tpcmrod->AddNode(ringv,25,new TGeoTranslation(0.,0.,-123.));
1005 tpcmrod->AddNode(ringv,26,new TGeoTranslation(0.,0.,123.));
1006 //
1007 // left plaque
78134e48 1008 //
0f788f87 1009 TGeoPcon *lp = new TGeoPcon(0.,360.,4);
78134e48 1010 //
0f788f87 1011 lp->DefineSection(0,-125.8,1.92,2.235);
1012 lp->DefineSection(1,-124.8,1.92,2.235);
78134e48 1013 //
0f788f87 1014 lp->DefineSection(2,-124.8,1.92,2.08);
1015 lp->DefineSection(3,-123.1,1.92,2.08);
78134e48 1016 //
0f788f87 1017 TGeoVolume *lpv1 = new TGeoVolume("TPC_lpv1",lp,m6);
1018 TGeoVolume *lpv2 = new TGeoVolume("TPC_lpv2",lp,m6);
1019 // left ring
1020 TGeoTube *lr = new TGeoTube(2.1075,2.235,0.5);
1021 TGeoVolume *lrv = new TGeoVolume("TPC_lrv",lr,m3);
78134e48 1022 //
0f788f87 1023 lpv2->AddNode(lrv,1,new TGeoTranslation(0.,0.,-125.3));
78134e48 1024 //
0f788f87 1025 tpcrod->AddNode(lpv2,1);
1026 tpcmrod->AddNode(lpv1,1);
78134e48 1027 //
0f788f87 1028 // right plaque
78134e48 1029 //
0f788f87 1030 TGeoTube *rp = new TGeoTube(1.92,2.08,2.25);
1031 TGeoVolume *rpv = new TGeoVolume("TPC_rpv",rp,m6);
1032 tpcrod->AddNode(rpv,1, new TGeoTranslation(0.,0.,125.35));
1033 tpcmrod->AddNode(rpv,2,new TGeoTranslation(0.,0.,125.35));
78134e48 1034 //
a3d2be59 1035 //
0f788f87 1036 //HV rods - makrolon + 0.58cm (diameter) Cu
1037 TGeoTube *hvr = new TGeoTube(0.,1.465,126.7);
1038 TGeoTube *hvc = new TGeoTube(0.,0.29,126.7);
1039 //
1040 TGeoVolume *hvrv = new TGeoVolume("TPC_HV_Rod",hvr,m6);
1041 TGeoVolume *hvcv = new TGeoVolume("TPC_HV_Cable",hvc,m7);
1042 hvrv->AddNode(hvcv,1);
78134e48 1043 //
0f788f87 1044 //resistor rod
1045 //
1046 TGeoTube *cr = new TGeoTube(0.,0.45,126.7);
1047 TGeoTube *cw = new TGeoTube(0.,0.15,126.7);
1048 TGeoVolume *crv = new TGeoVolume("TPC_CR",cr,m10);
1049 TGeoVolume *cwv = new TGeoVolume("TPC_W",cw,m11);
1050 //
1051 // ceramic rod with water
1052 //
1053 crv->AddNode(cwv,1);
1054 //
1055 //peek rod
1056 //
1057 TGeoTube *pr =new TGeoTube(0.2,0.35,126.7);
1058 TGeoVolume *prv = new TGeoVolume("TPC_PR",pr,m12);
1059 //
1060 // copper plates with connectors
1061 //
1062 new TGeoTube("tub",0.,1.7,0.025);
1063 //
1064 // half space - points on the plane and a normal vector
1065 //
1066 Double_t n[3],p[3];
1067 Double_t slope = TMath::Tan(22.*TMath::DegToRad());
1068 Double_t intp = 1.245;
1069 //
1070 Double_t b = slope*slope+1.;
1071 p[0]=intp*slope/b;
1072 p[1]=-intp/b;
1073 p[2]=0.;
1074 //
1075 n[0]=-p[0];
1076 n[1]=-p[1];
1077 n[2]=0.;
1078 Double_t norm;
1079 norm=TMath::Sqrt(n[0]*n[0]+n[1]*n[1]);
1080 n[0] /= norm;
1081 n[1] /=norm;
1082 //
1083 new TGeoHalfSpace("sp1",p,n);
1084 //
1085 slope = -slope;
1086 //
1087 p[0]=intp*slope/b;
1088 p[1]=-intp/b;
1089 //
1090 n[0]=-p[0];
1091 n[1]=-p[1];
1092 norm=TMath::Sqrt(n[0]*n[0]+n[1]*n[1]);
1093 n[0] /= norm;
1094 n[1] /=norm;
1095 //
1096 new TGeoHalfSpace("sp2",p,n);
1097 // holes for rods
1098 //holes
1099 new TGeoTube("h1",0.,0.5,0.025);
1100 new TGeoTube("h2",0.,0.35,0.025);
1101 //translations:
1102 TGeoTranslation *ttr11 = new TGeoTranslation("ttr11",-0.866,0.5,0.);
1103 TGeoTranslation *ttr22 = new TGeoTranslation("ttr22",0.866,0.5,0.);
1104 ttr11->RegisterYourself();
1105 ttr22->RegisterYourself();
1106 // elastic connector
1107 new TGeoBBox("elcon",0.72,0.005,0.3);
1108 TGeoRotation *crr1 = new TGeoRotation();
1109 crr1->RotateZ(-22.);
1110TGeoCombiTrans *ctr1 = new TGeoCombiTrans("ctr1",-0.36011, -1.09951,-0.325,crr1);
1111ctr1->RegisterYourself();
1112 TGeoCompositeShape *cs1 = new TGeoCompositeShape("cs1",
1113"(((((tub-h1:ttr11)-h1:ttr22)-sp1)-sp2)-h2)+elcon:ctr1");
1114 //
1115 TGeoVolume *csvv = new TGeoVolume("TPC_RR_CU",cs1,m7);
1116 //
1117 // resistor rod assembly 2 ceramic rods, peak rod, Cu plates
1118 // and resistors
1119 //
1120 TGeoVolumeAssembly *rrod = new TGeoVolumeAssembly("TPC_RROD");
1121 // rods
1122 rrod->AddNode(crv,1,ttr11);
1123 rrod->AddNode(crv,2,ttr22);
1124 rrod->AddNode(prv,1);
1125 //Cu plates
1126 for(Int_t i=0;i<165;i++){
1127 rrod->AddNode(csvv,i+1,new TGeoTranslation(0.,0.,-122.675+i*1.5));
1128 }
1129 //resistors
1130 TGeoTube *res = new TGeoTube(0.,0.15,0.5);
1131 TGeoVolume *resv = new TGeoVolume("TPC_RES",res,m10);
1132 TGeoVolumeAssembly *ress = new TGeoVolumeAssembly("TPC_RES_CH");
1133 ress->AddNode(resv,1,new TGeoTranslation(0.2,0.,0.));
1134 ress->AddNode(resv,2,new TGeoTranslation(-0.2,0.,0.));
1135 //
1136 TGeoRotation *crr2 = new TGeoRotation();
1137 crr2->RotateY(30.);
1138 TGeoRotation *crr3 = new TGeoRotation();
1139 crr3->RotateY(-30.);
1140 //
1141 for(Int_t i=0;i<164;i+=2){
1142 rrod->AddNode(ress,i+1, new TGeoCombiTrans(0.,1.2,-121.925+i*1.5,crr2));
1143 rrod->AddNode(ress,i+2, new TGeoCombiTrans(0.,1.2,-121.925+(i+1)*1.5,crr3));
1144 }
1145 rrod->AddNode(tpcrod,1,new TGeoCombiTrans(0.,0.,0.9,crr1));
1146
1147 //------------------------------------------------------------------
1148 TGeoRotation refl("refl",90.,0.,90.,90.,180.,0.);
1149 TGeoRotation rotrod("rotrod");
1150 TGeoRotation *rotpos = new TGeoRotation("rotpos");
1151 //
1152 TGeoRotation *rotrod1 = new TGeoRotation("rotrod1");
1153
1154 //v9 - drift gas
1155
7281dc07 1156 for(Int_t i=0;i<18;i++){
c1637e41 1157 Double_t angle,x,y;
1158 Double_t z,r;
1159 angle=TMath::DegToRad()*20.*(Double_t)i;
0f788f87 1160 //inner rods
c1637e41 1161 r=81.5;
1162 x=r * TMath::Cos(angle);
1163 y=r * TMath::Sin(angle);
0f788f87 1164 z = 126.;
78134e48 1165 //
0f788f87 1166 if(i==11){//resistor rod inner
1167 rotrod.RotateZ(-90.+angle);
1168 rotrod1->RotateZ(-90.+angle);
1169 *rotpos = refl*rotrod; //rotation+reflection
1170 v9->AddNode(rrod,1,new TGeoCombiTrans(x,y, z, rotrod1)); //A
1171 v9->AddNode(rrod,2,new TGeoCombiTrans(x,y,-z, rotpos)); //C
78134e48 1172 }
1173 else {
0f788f87 1174 v9->AddNode(tpcmrod,i+1,new TGeoTranslation(x,y,z));//shaft
1175 v9->AddNode(tpcmrod,i+19,new TGeoCombiTrans(x,y,-z,ref));//muon
37831078 1176 }
0f788f87 1177 // outer rods
c1637e41 1178 r=254.25;
1179 x=r * TMath::Cos(angle);
1180 y=r * TMath::Sin(angle);
0f788f87 1181 z=126.;
1182 rotrod.RotateZ(90.+angle);
1183 rotrod1->RotateZ(90.+angle);
1184 *rotpos = refl*rotrod;//rotation+reflection
78134e48 1185 //
0f788f87 1186 if(i==3){//resistor rod outer
1187 rotrod.RotateZ(90.+angle);
1188 rotrod1->RotateZ(90.+angle);
1189 *rotpos = refl*rotrod;//rotation+reflection
1190 v9->AddNode(rrod,3,new TGeoCombiTrans(x,y, z, rotrod1)); //A
1191 v9->AddNode(rrod,4,new TGeoCombiTrans(x,y, -z, rotpos)); //C
78134e48 1192 }
0f788f87 1193 else {
1194 v9->AddNode(tpcmrod,i+37,new TGeoTranslation(x,y,z));//shaft
1195 v9->AddNode(tpcmrod,i+55,new TGeoCombiTrans(x,y,-z,ref));//muon
78134e48 1196 }
0f788f87 1197 if(i==15){
1198 v9->AddNode(hvrv,1,new TGeoTranslation(x,y,z)); //hv->A-side only
78134e48 1199 }
0f788f87 1200 } //end of rods positioning
69776907 1201
bde68ab0 1202 TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
1203 alice->AddNode(v1,1);
c1637e41 1204
1283eee5 1205} // end of function
fe4da5cc 1206
1207//_____________________________________________________________________________
ac81c411 1208void AliTPCv2::AddAlignableVolumes() const
1209{
1210 //
1211 // Create entries for alignable volumes associating the symbolic volume
1212 // name with the corresponding volume path. Needs to be syncronized with
1213 // eventual changes in the geometry.
1214 //
1215 SetInnerChambersAlignable();
1216 SetOuterChambersAlignable();
1217}
1218
1219//_____________________________________________________________________________
1220void AliTPCv2::SetInnerChambersAlignable() const
1221{
1222 //
cdf69b9a 1223 AliGeomManager::ELayerID idTPC1 = AliGeomManager::kTPC1;
1224 Int_t modUID, modnum = 0;
d899e254 1225 TString vpstr1 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_1/TPC_SECT_";
1226 TString vpstr2 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_2/TPC_SECT_";
1227 TString vpappend = "/TPC_IROC_1";
1228 TString snstr1="TPC/EndcapA/Sector";
1229 TString snstr2="TPC/EndcapC/Sector";
1230 TString snappend="/InnerChamber";
ac81c411 1231 TString volpath, symname;
1232
1ac29fc4 1233 for(Int_t cnt=1; cnt<=18; cnt++){
cdf69b9a 1234 modUID = AliGeomManager::LayerToVolUID(idTPC1,modnum++);
1ac29fc4 1235 volpath = vpstr1;
1236 volpath += cnt;
1237 volpath += vpappend;
1238 symname = snstr1;
1239 symname += cnt;
1240 symname += snappend;
cdf69b9a 1241 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
84cbbd90 1242 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
cdf69b9a 1243 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID);
1244 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
1ac29fc4 1245 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,cnt-1);
1246 alignableEntry->SetMatrix(matTtoL);
1ac29fc4 1247 }
65293f49 1248
ac81c411 1249 for(Int_t cnt=1; cnt<=18; cnt++){
cdf69b9a 1250 modUID = AliGeomManager::LayerToVolUID(idTPC1,modnum++);
d899e254 1251 volpath = vpstr2;
ac81c411 1252 volpath += cnt;
d899e254 1253 volpath += vpappend;
1254 symname = snstr2;
ac81c411 1255 symname += cnt;
d899e254 1256 symname += snappend;
cdf69b9a 1257 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
84cbbd90 1258 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
cdf69b9a 1259 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID);
1260 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
1ac29fc4 1261 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,18+cnt-1);
1262 alignableEntry->SetMatrix(matTtoL);
ac81c411 1263 }
1264}
1265
ac81c411 1266//_____________________________________________________________________________
1267void AliTPCv2::SetOuterChambersAlignable() const
1268{
1269 //
cdf69b9a 1270 AliGeomManager::ELayerID idTPC2 = AliGeomManager::kTPC2;
1271 Int_t modUID, modnum = 0;
d899e254 1272 TString vpstr1 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_1/TPC_SECT_";
1273 TString vpstr2 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_2/TPC_SECT_";
1274 TString vpappend = "/TPC_OROC_1";
1275 TString snstr1="TPC/EndcapA/Sector";
1276 TString snstr2="TPC/EndcapC/Sector";
1277 TString snappend="/OuterChamber";
ac81c411 1278 TString volpath, symname;
1279
1280 for(Int_t cnt=1; cnt<=18; cnt++){
cdf69b9a 1281 modUID = AliGeomManager::LayerToVolUID(idTPC2,modnum++);
d899e254 1282 volpath = vpstr1;
ac81c411 1283 volpath += cnt;
d899e254 1284 volpath += vpappend;
1285 symname = snstr1;
ac81c411 1286 symname += cnt;
d899e254 1287 symname += snappend;
cdf69b9a 1288 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
84cbbd90 1289 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
cdf69b9a 1290 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID);
1291 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
1ac29fc4 1292 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,36+cnt-1);
1293 alignableEntry->SetMatrix(matTtoL);
ac81c411 1294 }
84cbbd90 1295
ac81c411 1296 for(Int_t cnt=1; cnt<=18; cnt++){
cdf69b9a 1297 modUID = AliGeomManager::LayerToVolUID(idTPC2,modnum++);
d899e254 1298 volpath = vpstr2;
ac81c411 1299 volpath += cnt;
d899e254 1300 volpath += vpappend;
1301 symname = snstr2;
ac81c411 1302 symname += cnt;
d899e254 1303 symname += snappend;
cdf69b9a 1304 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
84cbbd90 1305 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
cdf69b9a 1306 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID);
1307 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
1ac29fc4 1308 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,36+18+cnt-1);
1309 alignableEntry->SetMatrix(matTtoL);
ac81c411 1310 }
1311}
1312
1313//_____________________________________________________________________________
d899e254 1314void AliTPCv2::DrawDetector() const
fe4da5cc 1315{
1316 //
1317 // Draw a shaded view of the Time Projection Chamber version 1
1318 //
1319
fe4da5cc 1320 // Set everything unseen
cfce8870 1321 gMC->Gsatt("*", "seen", -1);
fe4da5cc 1322 //
1323 // Set ALIC mother transparent
cfce8870 1324 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 1325 //
1326 // Set the volumes visible
37831078 1327 //
1328
1329 gMC->Gsatt("TPC ","SEEN",0);
1330 gMC->Gsatt("TOIN","SEEN",1);
1331 gMC->Gsatt("TOIN","COLO",7);
37831078 1332 gMC->Gsatt("TOCV","SEEN",1);
1333 gMC->Gsatt("TOCV","COLO",4);
1334 gMC->Gsatt("TSA1","SEEN",0);
1335 gMC->Gsatt("TSA2","SEEN",0);
1336 gMC->Gsatt("TSA3","SEEN",0);
79575d04 1337 gMC->Gsatt("TSA4","SEEN",0);
1338 gMC->Gsatt("TSA5","SEEN",0);
37831078 1339 gMC->Gsatt("TOFC","SEEN",1);
1340 gMC->Gsatt("TOFC","COLO",4);
37831078 1341 gMC->Gsatt("TSA6","SEEN",0);
1342 gMC->Gsatt("TSA7","SEEN",0);
79575d04 1343 gMC->Gsatt("TSA8","SEEN",0);
37831078 1344 gMC->Gsatt("TIIN","SEEN",1);
79575d04 1345 gMC->Gsatt("TIIN","COLO",7);
1346 gMC->Gsatt("TII1","SEEN",0);
1347 gMC->Gsatt("TIFC","SEEN",1);
1348 gMC->Gsatt("TIFC","COLO",4);
1349 gMC->Gsatt("TSA9","SEEN",0);
37831078 1350 gMC->Gsatt("TS10","SEEN",0);
1351 gMC->Gsatt("TS11","SEEN",0);
1352 gMC->Gsatt("TS12","SEEN",0);
37831078 1353 gMC->Gsatt("TS13","SEEN",0);
1354 gMC->Gsatt("TS14","SEEN",0);
79575d04 1355 gMC->Gsatt("TICC","SEEN",0);
1356 gMC->Gsatt("TICM","SEEN",0);
37831078 1357 gMC->Gsatt("TS15","SEEN",0);
1358 gMC->Gsatt("TS16","SEEN",0);
37831078 1359 gMC->Gsatt("TS17","SEEN",0);
79575d04 1360 gMC->Gsatt("TS18","SEEN",0);
1361 gMC->Gsatt("TS19","SEEN",0);
1362 gMC->Gsatt("TPJ1","SEEN",0);
1363 gMC->Gsatt("TPJ2","SEEN",0);
1364 gMC->Gsatt("TICS","SEEN",0);
1365 gMC->Gsatt("TDGN","SEEN",0);
37831078 1366 gMC->Gsatt("TIRC","SEEN",0);
1367 gMC->Gsatt("TIC1","SEEN",1);
1368 gMC->Gsatt("TIPP","SEEN",0);
1369 gMC->Gsatt("TIC3","SEEN",0);
1370 gMC->Gsatt("TRCE","SEEN",0);
1371 gMC->Gsatt("TPSC","SEEN",0);
79575d04 1372 gMC->Gsatt("TPCC","SEEN",0);
37831078 1373 gMC->Gsatt("TORC","SEEN",0);
1374 gMC->Gsatt("TOPP","SEEN",0);
1375 gMC->Gsatt("TOC3","SEEN",0);
1376 gMC->Gsatt("TOC1","SEEN",1);
1377 gMC->Gsatt("TSSW","SEEN",1);
1378 gMC->Gsatt("TSWC","SEEN",1);
37831078 1379 gMC->Gsatt("TSSW","COLO",3);
1380 gMC->Gsatt("TSWC","COLO",3);
1381 gMC->Gsatt("TSCE","COLO",6);
79575d04 1382 gMC->Gsatt("TSCE","SEEN",1);
37831078 1383 gMC->Gsatt("TWES","SEEN",0);
1384 gMC->Gsatt("TSWB","SEEN",0);
1385 gMC->Gsatt("TPEL","SEEN",0);
1386 gMC->Gsatt("TPMW","SEEN",1);
37831078 1387 gMC->Gsatt("TESR","SEEN",1);
1388 gMC->Gsatt("TPMW","COLO",12);
37831078 1389 gMC->Gsatt("TIC1","COLO",5);
79575d04 1390 gMC->Gsatt("TOC1","COLO",5);
37831078 1391 gMC->Gsatt("TESB","SEEN",0);
37831078 1392 gMC->Gsatt("THVM","SEEN",1);
1393 gMC->Gsatt("THVM","COLO",11);
79575d04 1394 gMC->Gsatt("THVH","SEEN",0);
1395 gMC->Gsatt("TPSR","SEEN",0);
37831078 1396 gMC->Gsatt("THVL","SEEN",0);
79575d04 1397 gMC->Gsatt("THVC","SEEN",0);
37831078 1398 gMC->Gsatt("THVE","SEEN",0);
1399 gMC->Gsatt("THVR","SEEN",0);
79575d04 1400 gMC->Gsatt("TPSS","SEEN",0);
1401 gMC->Gsatt("TPUS","SEEN",0);
1402 gMC->Gsatt("TPLS","SEEN",0);
37831078 1403
fe4da5cc 1404 //
cfce8870 1405 gMC->Gdopt("hide", "on");
1406 gMC->Gdopt("shad", "on");
1407 gMC->Gsatt("*", "fill", 7);
1408 gMC->SetClipBox(".");
37831078 1409 gMC->SetClipBox("TPMW",-300,300,-300,300,254.,270.);
1410 gMC->SetClipBox("TESR",-300,300,-300,300,254.,270.);
1411 gMC->SetClipBox("TSSW",-300,300,-300,300,283.,284.);
1412 gMC->SetClipBox("TSWC",-300,300,-300,300,283.,284.);
1413 gMC->SetClipBox("*", 0, 300, -300, 300, -290, 290);
cfce8870 1414 gMC->DefaultRange();
1415 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
1416 gMC->Gdhead(1111, "Time Projection Chamber");
1417 gMC->Gdman(18, 4, "MAN");
1418 gMC->Gdopt("hide","off");
fe4da5cc 1419}
1420
1421//_____________________________________________________________________________
1422void AliTPCv2::CreateMaterials()
1423{
1424 //
1425 // Define materials for version 2 of the Time Projection Chamber
1426 //
37831078 1427
fe4da5cc 1428 AliTPC::CreateMaterials();
1429}
1430
1431//_____________________________________________________________________________
1432void AliTPCv2::Init()
1433{
1434 //
1435 // Initialises version 2 of the TPC after that it has been built
1436 //
37831078 1437
1438 Int_t *idtmed = fIdtmed->GetArray();
1439
fe4da5cc 1440 AliTPC::Init();
d4c354b9 1441
c1637e41 1442
1443 fIdSens=gMC->VolId("TPC_Strip"); // one strip is always selected...
d4c354b9 1444
c1637e41 1445 fIDrift=gMC->VolId("TPC_Drift");
1446 fSecOld=-100; // fake number
fe4da5cc 1447
d9888f70 1448 gMC->SetMaxNStep(-30000); // max. number of steps increased
fe4da5cc 1449
4481461d 1450 if (fPrimaryIonisation) {
1451 gMC->Gstpar(idtmed[2],"PRIMIO_E", 20.77); // 1st ionisation potential
1452
1453 gMC->Gstpar(idtmed[2],"PRIMIO_N", 14.35);
1454 gMC->Gstpar(idtmed[2],"LOSS", 14); // specific energy loss
8143dfb2 1455 gMC->Gstpar(idtmed[2],"STRA",4);
4481461d 1456 } else {
1457 gMC->Gstpar(idtmed[2],"LOSS", 5); // specific energy loss
1458 }
1459
fe4da5cc 1460
a9d15241 1461 AliDebug(1,"*** TPC version 2 initialized ***");
1462 AliDebug(1,Form("Maximum number of steps = %d",gMC->GetMaxNStep()));
fe4da5cc 1463
1464 //
1465
1466}
1467
1468//_____________________________________________________________________________
1469void AliTPCv2::StepManager()
1470{
1471 //
1472 // Called for every step in the Time Projection Chamber
1473 //
1474
1475 //
1476 // parameters used for the energy loss calculations
1477 //
73042f01 1478 const Float_t kprim = 14.35; // number of primary collisions per 1 cm
1479 const Float_t kpoti = 20.77e-9; // first ionization potential for Ne/CO2
1480 const Float_t kwIon = 35.97e-9; // energy for the ion-electron pair creation
ec6ac410 1481 const Int_t kMaxDistRef =15; // maximal difference between 2 stored references
fe4da5cc 1482
73042f01 1483 const Float_t kbig = 1.e10;
fe4da5cc 1484
1485 Int_t id,copy;
e61fd20d 1486 Float_t hits[5];
fe4da5cc 1487 Int_t vol[2];
37831078 1488 TLorentzVector p;
fe4da5cc 1489
37831078 1490 vol[1]=0; // preset row number to 0
fe4da5cc 1491 //
b97617a6 1492 if (fPrimaryIonisation) gMC->SetMaxStep(kbig);
fe4da5cc 1493
0a6d8768 1494 if(!gMC->IsTrackAlive()) return; // particle has disappeared
fe4da5cc 1495
cfce8870 1496 Float_t charge = gMC->TrackCharge();
fe4da5cc 1497
1498 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1499
37831078 1500 // check the sensitive volume
1501
c1637e41 1502 id = gMC->CurrentVolID(copy); // vol ID and copy number (starts from 1!)
1503 if(id != fIDrift && id != fIdSens) return; // not in the sensitive folume
da33556f 1504
c1637e41 1505 gMC->TrackPosition(p);
1506 Double_t r = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
1507 //
1508
1509 //
1510 Double_t angle = TMath::ACos(p[0]/r);
1511 angle = (p[1]<0.) ? TMath::TwoPi()-angle : angle;
1512 //
1513 // angular segment, it is not a real sector number...
1514 //
1515 Int_t sector=TMath::Nint((angle-fTPCParam->GetInnerAngleShift())/
1516 fTPCParam->GetInnerAngle());
1517 // rotate to segment "0"
1518 Float_t cos,sin;
1519 fTPCParam->AdjustCosSin(sector,cos,sin);
1520 Float_t x1=p[0]*cos + p[1]*sin;
1521 // check if within sector's limits
5bd5dbc4 1522 if((x1>=fTPCParam->GetInnerRadiusLow()&&x1<=fTPCParam->GetInnerRadiusUp())
1523 ||(x1>=fTPCParam->GetOuterRadiusLow()&&x1<=fTPCParam->GetOuterRadiusUp())){
c1637e41 1524 // calculate real sector number...
1525 if (x1>fTPCParam->GetOuterRadiusLow()){
1526 sector = TMath::Nint((angle-fTPCParam->GetOuterAngleShift())/
1527 fTPCParam->GetOuterAngle())+fTPCParam->GetNInnerSector();
1528 if (p[2]<0) sector+=(fTPCParam->GetNOuterSector()>>1);
37831078 1529 }
c1637e41 1530 else
1531 if (p[2]<0) sector+=(fTPCParam->GetNInnerSector()>>1);
1532 //
1533 // here I have a sector number
1534 //
37831078 1535
c1637e41 1536 vol[0]=sector;
ec6ac410 1537
1538 static Double_t lastReferenceR=0;
1539 if (TMath::Abs(lastReferenceR-r)>kMaxDistRef){
1540 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kTPC);
1541 lastReferenceR = r;
1542 }
1543
c1637e41 1544 // check if change of sector
1545 if(sector != fSecOld){
1546 fSecOld=sector;
1547 // add track reference
e6add757 1548 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kTPC);
c1637e41 1549 }
1550 // track is in the sensitive strip
1551 if(id == fIdSens){
1552 // track is entering the strip
1553 if (gMC->IsTrackEntering()){
1554 Int_t totrows = fTPCParam->GetNRowLow()+fTPCParam->GetNRowUp();
1555 vol[1] = (copy<=totrows) ? copy-1 : copy-1-totrows;
1556 // row numbers are autonomous for lower and upper sectors
1557 if(vol[0] > fTPCParam->GetNInnerSector()) {
1558 vol[1] -= fTPCParam->GetNRowLow();
1559 }
1560 //
1561 if(vol[0]<fTPCParam->GetNInnerSector()&&vol[1] == 0){
37831078 1562
c1637e41 1563 // lower sector, row 0, because Jouri wants to have this
6a905708 1564
c1637e41 1565 gMC->TrackMomentum(p);
1566 hits[0]=p[0];
1567 hits[1]=p[1];
1568 hits[2]=p[2];
1569 hits[3]=0.; // this hit has no energy loss
1570 // Get also the track time for pileup simulation
1571 hits[4]=gMC->TrackTime();
e61fd20d 1572
c1637e41 1573 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
1574 }
1575 //
e61fd20d 1576
c1637e41 1577 gMC->TrackPosition(p);
1578 hits[0]=p[0];
1579 hits[1]=p[1];
1580 hits[2]=p[2];
1581 hits[3]=0.; // this hit has no energy loss
1582 // Get also the track time for pileup simulation
1583 hits[4]=gMC->TrackTime();
930ee558 1584
c1637e41 1585 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
37831078 1586
c1637e41 1587 }
1588 else return;
1589 }
37831078 1590 //-----------------------------------------------------------------
c1637e41 1591 // charged particle is in the sensitive drift volume
37831078 1592 //-----------------------------------------------------------------
cfce8870 1593 if(gMC->TrackStep() > 0) {
b97617a6 1594 Int_t nel=0;
1595 if (!fPrimaryIonisation) {
1596 nel = (Int_t)(((gMC->Edep())-kpoti)/kwIon) + 1;
1597 }
1598 else {
1599 Float_t edep = gMC->Edep();
1600 if (edep > 0.) nel = (Int_t)((gMC->Edep()*1.5)/kwIon) + 1;
1601 }
fe4da5cc 1602 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
c1637e41 1603 //
37831078 1604 gMC->TrackPosition(p);
1605 hits[0]=p[0];
1606 hits[1]=p[1];
1607 hits[2]=p[2];
fe4da5cc 1608 hits[3]=(Float_t)nel;
c1637e41 1609
fe4da5cc 1610 // Add this hit
c1637e41 1611
6a905708 1612 if (fHitType&&2){
1613 gMC->TrackMomentum(p);
1614 Float_t momentum = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
1615 Float_t precision = (momentum>0.1) ? 0.002 :0.01;
1616 fTrackHits->SetHitPrecision(precision);
1617 }
e61fd20d 1618
1619 // Get also the track time for pileup simulation
1620 hits[4]=gMC->TrackTime();
c1637e41 1621
1622 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
e61fd20d 1623
c1637e41 1624 } // step>0
1625 } //within sector's limits
fe4da5cc 1626 // Stemax calculation for the next step
1627
1628 Float_t pp;
0a6d8768 1629 TLorentzVector mom;
b97617a6 1630 // below is valid only for Geant3 (fPromaryIonisation not set)
1631 if(!fPrimaryIonisation){
1632 gMC->TrackMomentum(mom);
1633 Float_t ptot=mom.Rho();
1634 Float_t betaGamma = ptot/gMC->TrackMass();
595bf2c3 1635
b97617a6 1636 Int_t pid=gMC->TrackPid();
1637 if((pid==kElectron || pid==kPositron) && ptot > 0.002)
1638 {
1639 pp = kprim*1.58; // electrons above 20 MeV/c are on the plateau!
1640 }
1641 else
1642 {
1643
1644 betaGamma = TMath::Max(betaGamma,(Float_t)7.e-3); // protection against too small bg
b40afa5e 1645 pp=kprim*AliMathBase::BetheBlochAleph(betaGamma);
595bf2c3 1646
fe4da5cc 1647 }
1648
b97617a6 1649 Double_t rnd = gMC->GetRandom()->Rndm();
fe4da5cc 1650
b97617a6 1651 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
1652 }
c1637e41 1653
fe4da5cc 1654}
1655
73042f01 1656