Corrected bug in the inner containment vessel geometry.
[u/mrichter/AliRoot.git] / TPC / AliTPCv0.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.18  2000/11/02 07:24:11  kowal2
19 Correction in the TPC geometry.
20 Changes due to the new hit structure.
21
22 Revision 1.17  2000/07/10 20:57:39  hristov
23 Update of TPC code and macros by M.Kowalski
24
25 Revision 1.16  2000/06/30 12:07:50  kowal2
26 Updated from the TPC-PreRelease branch
27
28 Revision 1.15.2.4  2000/06/26 07:39:42  kowal2
29 Changes to obey the coding rules
30
31 Revision 1.15.2.3  2000/06/25 08:38:41  kowal2
32 Splitted from AliTPCtracking
33
34 Revision 1.15.2.2  2000/06/16 12:58:13  kowal2
35 Changed parameter settings
36
37 Revision 1.15.2.1  2000/06/09 07:15:07  kowal2
38
39 Defaults loaded automatically (hard-wired)
40 Optional parameters can be set via macro called in the constructor
41
42 Revision 1.15  2000/05/15 10:00:30  kowal2
43 Corrected bug in the TPC geometry, thanks to Ivana Hrivnacova
44
45 Revision 1.14  2000/04/17 09:37:33  kowal2
46 removed obsolete AliTPCDigitsDisplay.C
47
48 Revision 1.13.8.2  2000/04/10 08:33:44  kowal2
49
50 Updated readout chambers
51
52 Revision 1.13.8.1  2000/04/10 07:56:53  kowal2
53 Not used anymore - removed
54
55 Revision 1.13  1999/11/04 17:28:06  fca
56 Correct barrel part of HV Degrader
57
58 Revision 1.12  1999/10/08 06:27:23  fca
59 Corrected bug in the HV degrader geometry, thanks to G.Tabary
60
61 Revision 1.11  1999/10/04 13:39:54  fca
62 Correct array index problem
63
64 Revision 1.10  1999/09/29 09:24:34  fca
65 Introduction of the Copyright and cvs Log
66
67 */
68 //
69
70 ///////////////////////////////////////////////////////////////////////////////
71 //                                                                           //
72 //  Time Projection Chamber version 0 -- "coarse" TPC                        //
73 //                                                                           //
74 //Begin_Html
75 /*
76 <img src="picts/AliTPCv0Class.gif">
77 */
78 //End_Html
79 //                                                                           //
80 //                                                                           //
81 ///////////////////////////////////////////////////////////////////////////////
82
83 #include <TMath.h>
84 #include <TGeometry.h>
85 #include <TNode.h>
86 #include <TTUBE.h>
87 #include "AliTPCv0.h"
88 #include "AliRun.h"
89 #include <iostream.h>
90 #include <fstream.h>
91 #include "AliMC.h"
92 #include "AliConst.h"
93
94 #include "AliTPCParamSR.h"
95 #include "AliTPCDigitsArray.h"
96
97 ClassImp(AliTPCv0)
98  
99 //_____________________________________________________________________________
100 AliTPCv0::AliTPCv0(const char *name, const char *title) 
101          :AliTPC(name, title)
102 {
103   //
104   // Standard creator for TPC version 0
105   //
106
107   SetGasMixt(2,20,10,-1,0.9,0.1,0.);
108
109   if (fTPCParam)
110      fTPCParam->Write(fTPCParam->GetTitle());
111 }
112
113 //_____________________________________________________________________________
114 void AliTPCv0::CreateGeometry()
115 {
116   //
117   // Creation of the TPC version 0, i.e. no sensitive volumes,
118   // only the material distribution
119   //
120   //Begin_Html
121   /*
122     <img src="picts/AliTPC.gif">
123   */
124   //End_Html
125   //Begin_Html
126   /*
127     <img src="picts/AliTPCv0Tree.gif">
128   */
129   //End_Html
130
131   //---------------------------------------------------------------
132   //  TPC geometry
133   //
134   //  Origin: Marek Kowalski, INP Cracow
135   //  Marek.Kowalski@ifj.edu.pl
136   //---------------------------------------------------------------
137
138   Float_t dm[50];
139
140   Int_t *idtmed = fIdtmed->GetArray(); // TPC media
141
142   Int_t idrotm[120]; // rotation matrices
143
144   Int_t nRotMat = 0; // actual number of rotation matrices
145
146
147   //
148   //  Mother volume (Air) - all volumes will be positioned in it
149   //
150   
151   dm[0]=0.;
152   dm[1]=360.;
153   dm[2]=12.;
154
155   //
156  
157   dm[3]= -283.7;
158   dm[4]= 66.2;
159   dm[5]= 277.95;
160
161   //
162
163   dm[6]= -255.6;
164   dm[7]= 66.2;
165   dm[8]= 277.95;
166
167   //
168
169   dm[9]= -73.3;
170   dm[10]= 59.0;
171   dm[11]= 277.95;
172
173   //
174
175   dm[12]= -73.3;
176   dm[13]= 56.9;
177   dm[14]= 277.95;
178
179   //
180
181   dm[15]= -72.1;
182   dm[16]= 56.9;
183   dm[17]= 277.95;
184
185   //
186
187   dm[18]= -72.1;
188   dm[19]= 60.65;
189   dm[20]= 277.95;
190
191   //
192
193   dm[21]= 72.1;
194   dm[22]= 60.65;
195   dm[23]= 277.95;  
196
197   //
198
199   dm[24]= 72.1;
200   dm[25]= 56.9;
201   dm[26]= 277.95;
202
203   //
204
205   dm[27]= 73.3;
206   dm[28]= 56.9;
207   dm[29]= 277.95;
208
209   //
210
211   dm[30]= 73.3;
212   dm[31]= 60.65;
213   dm[32]= 277.95;
214
215   //
216
217   dm[33]= 250.4;
218   dm[34]= 66.0;
219   dm[35]= 277.95;
220
221   //
222
223   dm[36]= 283.7;
224   dm[37]= 66.0;
225   dm[38]= 277.95;
226
227
228   gMC->Gsvolu("TPC ","PCON",idtmed[0],dm,39);
229
230
231   //-------------------------------------------------------------------
232   //  Tpc Outer INsulator (CO2)
233   //-------------------------------------------------------------------
234
235   dm[0]= 0.;
236   dm[1]= 360.;
237   dm[2]= 6.;
238
239   //
240  
241   dm[3]= -253.6;
242   dm[4]= 258.;
243   dm[5]= 266.65;
244
245   //
246
247   dm[6]= -253.;
248   dm[7]= 258.;
249   dm[8]= 266.65;
250
251   dm[9]= -253.;
252   dm[10]= 258.;
253   dm[11]= 277.97;
254
255   dm[12]= 253.6;
256   dm[13]= 258.;
257   dm[14]= 277.97;
258
259   //
260
261   dm[15]= 253.6;
262   dm[16]= 265.2;
263   dm[17]= 277.95;
264
265   //
266
267   dm[18]= 255.6;
268   dm[19]= 265.2;
269   dm[20]= 277.95;
270
271
272   gMC->Gsvolu("TOIN","PCON",idtmed[3],dm,21);
273
274   //---------------------------------------------------------------
275   // shreds (G10) - TPC Rings
276   //---------------------------------------------------------------
277
278   gMC->Gsvolu("TPCR","TUBE",idtmed[12],dm,0);
279
280   dm[0]= 258.;
281   dm[1]= 266.65;
282   dm[2]= 0.3;
283
284   gMC->Gsposp("TPCR",1,"TOIN",0.,0.,-253.3,0,"ONLY",dm,3); // left bottom
285
286   //
287
288   dm[0]= 258.;
289   dm[1]= 270.9;
290   dm[2]= 0.3;
291
292   gMC->Gsposp("TPCR",2,"TOIN",0.,0.,253.3,0,"ONLY",dm,3); // right
293
294   //
295
296   dm[0]= 272.2;
297   dm[1]= 277.95;
298   dm[2]= 0.3;
299
300   gMC->Gsposp("TPCR",3,"TOIN",0.,0.,-250.7,0,"ONLY",dm,3); // left top
301
302   //----------------------------------------------------------------
303   // Tpc Outer Contaiment Vessel  
304   //  mother volume - Al, daughters - composite (sandwich)
305   //----------------------------------------------------------------
306   
307   dm[0]= 0.;
308   dm[1]= 360.;
309   dm[2]=5.;
310
311   //
312
313   dm[3]= -250.4;
314   dm[4]= 272.2;
315   dm[5]= 277.95;
316
317   //
318
319   dm[6]= -248.4;
320   dm[7]= 272.2;
321   dm[8]= 277.95;
322
323   //
324
325   dm[9]= 253.6;
326   dm[10]= 272.2;
327   dm[11]= 277.95;
328
329   //
330
331   dm[12]= 253.6;
332   dm[13]= 265.2;
333   dm[14]= 277.95;
334
335   // 
336
337   dm[15]= 255.6;
338   dm[16]= 265.2;
339   dm[17]= 277.95;
340
341   gMC->Gsvolu("TOCV","PCON",idtmed[4],dm,18);
342
343   // Daughter volumes
344
345   // Tpc SAndwich 1 - Al
346  
347   dm[0]= 274.81;
348   dm[1]= 277.95;
349   dm[2]= 251.7;
350
351   gMC->Gsvolu("TSA1","TUBE",idtmed[4],dm,3);
352
353   // Tpc SAndwich 2 - Tedlar
354
355   dm[0] += 5.e-3;
356   dm[1] -= 5.e-3;
357   
358   gMC->Gsvolu("TSA2","TUBE",idtmed[9],dm,3);
359
360   // Tpc SAndwich 3 - Kevlar
361
362   dm[0] += 5e-3;
363   dm[1] -= 5.e-3;
364
365   gMC->Gsvolu("TSA3","TUBE",idtmed[5],dm,3);
366
367   // Tpc SAndwich 4 - NOMEX honeycomb
368
369   dm[0] += 0.06;
370   dm[1] -= 0.06;
371
372   gMC->Gsvolu("TSA4","TUBE",idtmed[5],dm,3);  
373   
374   // 4->3->2->1->TOCV
375
376   gMC->Gspos("TSA4",1,"TSA3",0.,0.,0.,0,"ONLY");
377   gMC->Gspos("TSA3",1,"TSA2",0.,0.,0.,0,"ONLY");
378   gMC->Gspos("TSA2",1,"TSA1",0.,0.,0.,0,"ONLY");
379
380   gMC->Gspos("TSA1",1,"TOCV",0.,0.,2.6,0,"ONLY");
381
382   // TCOV-> TOIN
383
384   gMC->Gspos("TOCV",1,"TOIN",0.,0.,0.,0,"ONLY");
385
386   //-------------------------------------------------------
387   //  Tpc Outer Field Cage
388   //  mother volume - Al, daughters - composite (sandwich)
389   //-------------------------------------------------------
390
391   dm[0]=0.;
392   dm[1]=360.;
393   dm[2]=6.;
394
395   dm[3]= -253.;
396   dm[4]= 258.;
397   dm[5]= 277.95;
398
399   //
400
401   dm[6]= -251.;
402   dm[7]= 258.;
403   dm[8]= 277.95;
404
405   //
406  
407   dm[9]= -251.;
408   dm[10]= 258.;
409   dm[11]= 260.05;
410
411   //
412
413   dm[12]= 251.;
414   dm[13]= 258.;
415   dm[14]= 260.05;
416
417   //
418
419   dm[15]= 251.;
420   dm[16]= 258.;
421   dm[17]= 260.05;
422
423   //
424
425   dm[18]= 253.;
426   dm[19]= 258.;
427   dm[20]= 270.9;
428
429   gMC->Gsvolu("TOFC","PCON",idtmed[4],dm,21);  
430
431   // Daughter volumes 
432
433   // Tpc SAndwich 5 - Tedlar
434
435   dm[0]= 258.;
436   dm[1]= 260.05;
437   dm[2]= 251.7;
438
439   gMC->Gsvolu("TSA5","TUBE",idtmed[9],dm,3);
440
441   // Tpc SAndwich 6 - Kevlar
442
443   dm[0] += 5.e-3;
444   dm[1] -= 5.e-3;
445
446   gMC->Gsvolu("TSA6","TUBE",idtmed[5],dm,3);
447
448
449   // Tpc SAndwich 7 - NOMEX
450
451   dm[0] += 0.02;
452   dm[1] -= 0.02;
453
454   gMC->Gsvolu("TSA7","TUBE",idtmed[6],dm,3);    
455
456   // 7->6->5->TOFC
457
458   gMC->Gspos("TSA7",1,"TSA6",0.,0.,0.,0,"ONLY");
459   gMC->Gspos("TSA6",1,"TSA5",0.,0.,0.,0,"ONLY"); 
460
461   gMC->Gspos("TSA5",1,"TOFC",0.,0.,0.,0,"ONLY");
462
463   // TOFC->TOIN
464
465   gMC->Gspos("TOFC",1,"TOIN",0.,0.,0.,0,"ONLY"); 
466
467   // TOIN->TPC
468
469   gMC->Gspos("TOIN",1,"TPC ",0.,0.,0.,0,"ONLY");
470
471   //--------------------------------------------------------------------
472   // Tpc Inner INsulator (CO2)
473   //--------------------------------------------------------------------
474
475
476   dm[0]=0.;
477   dm[1]= 360.;
478   dm[2]= 15.;
479
480   //
481
482   dm[3]= -255.6;
483   dm[4]= 66.2;
484   dm[5]= 74.8;
485
486   //
487
488   Float_t tanL = (66.2-59.0)/(255.6-73.3); // tangent of the left cone part
489
490   dm[6]= -253.6;
491   dm[7]= 59.0+ (253.6-73.3)*tanL;
492   dm[8]= 74.8;
493
494   //
495
496   dm[9]= -253.6;
497   dm[10]= dm[7];
498   dm[11]= 79.2;
499
500   //
501
502   dm[12]= -73.3;
503   dm[13]= 59.0;
504   dm[14]= 79.2;
505
506   //
507
508   dm[15]= -73.3;
509   dm[16]= 56.9;
510   dm[17]= 79.2;
511
512   //
513
514   dm[18]= -72.1;
515   dm[19]= 59.6;
516   dm[20]= 79.2;
517
518   //
519
520   dm[21]= -72.1;
521   dm[22]= 60.65;
522   dm[23]= 79.2;
523
524   //
525
526   dm[24]= 72.1;
527   dm[25]= 60.65;
528   dm[26]= 79.2;  
529
530   //
531
532   dm[27]= 72.1;
533   dm[28]= 59.6;
534   dm[29]= 79.2;
535
536   //
537
538   dm[30]= 73.3;
539   dm[31]= 56.9;
540   dm[32]= 79.2;
541
542   //
543
544   dm[33]= 73.3;
545   dm[34]= 59.0;
546   dm[35]= 79.2;
547
548   //
549
550   dm[36]= 250.4;
551   dm[37]= 66.0;
552   dm[38]= 79.2;
553
554   //
555   
556   dm[39]= 253.0;
557   dm[40]= 66.0;
558   dm[41]= 79.2;
559
560   //
561
562   dm[42]= 253.0;
563   dm[43]= 75.3;
564   dm[44]= 79.2;
565
566   //
567
568   dm[45]= 253.6;
569   dm[46]= 75.3;
570   dm[47]= 79.2;
571
572   gMC->Gsvolu("TIIN","PCON",idtmed[3],dm,48);
573
574
575   //--------------------------------------------------------------------
576   //  Tpc Inner Containment vessel, Left part
577   //  mother volume - Al, daughter - composite (sandwich)
578   //--------------------------------------------------------------------
579
580   dm[0]= 0.;
581   dm[1]= 360.;
582   dm[2]= 8.;
583
584   //
585
586   dm[3]= -255.6;
587   dm[4]= 66.2;
588   dm[5]= 74.8;
589
590   //
591
592   Float_t cosL = 1./TMath::Sqrt(1.+tanL*tanL);
593   Float_t sandThick = 2.14; // cone composite thickness
594
595
596   //
597
598   dm[6]= -253.6;
599   dm[7]= 59.0 + (253.6-73.3)*tanL;
600   dm[8]= 74.8;
601
602   //
603
604   dm[9]= -253.6;
605   dm[10]= dm[7];
606   dm[11]= dm[7]+sandThick/cosL;
607
608   //
609
610   dm[12]= -75.6;
611   dm[13]= 59.0+(75.6-73.3)*tanL;
612   dm[14]= dm[13]+sandThick/cosL;
613
614   //
615
616   dm[15]= -75.6;
617   dm[16]= dm[13];
618   dm[17]= 60.65;
619
620   //
621
622   dm[18]= -73.3;
623   dm[19]= 59.0;
624   dm[20]= 60.65;
625
626   //
627
628   dm[21]= -73.3;
629   dm[22]= 56.9;
630   dm[23]= 60.65;
631
632   //
633
634   dm[24]= -72.1;
635   dm[25]= 56.9;
636   dm[26]= 60.65;
637
638   gMC->Gsvolu("TICL","PCON",idtmed[4],dm,27);
639
640   // Daughter volumes 
641
642   // Tpc SAndwich 9 - Al
643
644   dm[0]= 0.;
645   dm[1]= 360.;
646   dm[2]= 2.;
647
648   //
649
650   dm[3]= - 254.3;
651   dm[4]= 59.0+(254.3-73.3)*tanL;
652   dm[5]= dm[4]+sandThick/cosL;
653
654   //
655
656   dm[6]= -78.3;
657   dm[7]= 59.0+(78.3-73.3)*tanL;
658   dm[8]= dm[7]+sandThick/cosL;
659
660   //
661
662   gMC->Gsvolu("TSA9","PCON",idtmed[4],dm,9);
663
664   // Tpc SAndwich 10 - Tedlar
665
666   dm[4]+= 5.e-3/cosL;
667   dm[5]-= 5.e-3/cosL;
668
669   //
670
671   dm[7]+= 5.e-3/cosL;
672   dm[8]+= 5.e-3/cosL;
673
674   gMC->Gsvolu("TS10","PCON",idtmed[9],dm,9); 
675
676   // Tpc SAndwich 11 - Kevlar
677
678   dm[4]+= 5.e-3/cosL;
679   dm[5]-= 5.e-3/cosL;
680
681   //
682
683   dm[7]+= 5.e-3/cosL;
684   dm[8]+= 5.e-3/cosL;
685
686   gMC->Gsvolu("TS11","PCON",idtmed[5],dm,9); 
687
688   // Tpc SAndwich 12 - NOMEX
689
690   dm[4]+= 0.06/cosL;
691   dm[5]-= 0.06/cosL;
692
693   //
694
695   dm[7]+= 0.06/cosL;
696   dm[8]+= 0.06/cosL;
697
698   gMC->Gsvolu("TS12","PCON",idtmed[6],dm,9);   
699
700   // 12->11->10->9
701
702   gMC->Gspos("TS12",1,"TS11",0.,0.,0.,0,"ONLY");
703   gMC->Gspos("TS11",1,"TS10",0.,0.,0.,0,"ONLY");
704   gMC->Gspos("TS10",1,"TSA9",0.,0.,0.,0,"ONLY");
705
706   // TSA9->TICL
707
708   gMC->Gspos("TSA9",1,"TICL",0.,0.,0.,0,"ONLY");
709  
710   //--------------------------------------------------------------------
711   //  Tpc Inner Containment vessel, Right part
712   //  mother volume - Al, daughter - composite (sandwich)
713   //--------------------------------------------------------------------
714
715   dm[0]= 0.;
716   dm[1]= 360.;
717   dm[2]=8.;
718
719   //
720
721   dm[3]= 72.1;
722   dm[4]= 56.9;
723   dm[5]= 60.65;
724
725   //
726
727   dm[6]= 73.3;
728   dm[7]= 56.9;
729   dm[8]= 60.65;
730
731   //
732
733   dm[9]= 73.3;
734   dm[10]= 59.0;
735   dm[11]= 60.65;
736
737   //
738
739   Float_t tanR = (66.0-59.0)/(250.5-73.3); // to avoid accuracy problems
740   Float_t cosR = 1./TMath::Sqrt(1.+tanR*tanR); //as above
741
742   //
743
744   dm[12]= 75.6;
745   dm[13]= 59.0+(75.6-73.3)*tanR;
746   dm[14]= 60.65;
747
748   //
749
750   dm[15]= 75.6;
751   dm[16]= dm[13];
752   dm[17]= dm[16]+sandThick/cosR;
753
754   //
755
756   dm[18]= 248.4;
757   dm[19]= 59.0+(248.4-73.3)*tanR;
758   dm[20]= dm[19]+sandThick/cosR;
759
760   //
761
762   dm[21]= 248.4;
763   dm[22]= dm[19];
764   dm[23]= 70.2;
765
766   //
767
768   dm[24]= 250.4;
769   dm[25]= 66.0;
770   dm[26]= 70.2;
771
772   gMC->Gsvolu("TICR","PCON",idtmed[4],dm,27);
773
774
775
776   // Daughter volumes 
777
778   // Tpc SAndwich 13 - Al
779
780   dm[0]= 0.;
781   dm[1]= 360.;
782   dm[2]= 2.;
783
784   //
785
786   dm[3]= 78.3;
787   dm[4]= 59.0+(78.3-73.3)*tanR;
788   dm[5]= dm[4]+sandThick/cosR;
789
790   //
791
792   dm[6]= 249.1;
793   dm[7]= 59.0+(249.1-73.3)*tanR;
794   dm[8]= dm[7]+sandThick/cosR;
795
796   //
797
798   gMC->Gsvolu("TS13","PCON",idtmed[4],dm,9);
799
800   // Tpc SAndwich 14 - Tedlar
801
802   dm[4]+= 5.e-3/cosR;
803   dm[5]-= 5.e-3/cosR;
804
805   //
806
807   dm[7]+= 5.e-3/cosR;
808   dm[8]+= 5.e-3/cosR;
809
810   gMC->Gsvolu("TS14","PCON",idtmed[9],dm,9); 
811
812   // Tpc SAndwich 15 - Kevlar
813
814   dm[4]+= 5.e-3/cosR;
815   dm[5]-= 5.e-3/cosR;
816
817   //
818
819   dm[7]+= 5.e-3/cosR;
820   dm[8]+= 5.e-3/cosR;
821
822   gMC->Gsvolu("TS15","PCON",idtmed[5],dm,9); 
823
824   // Tpc SAndwich 16 - NOMEX
825
826   dm[4]+= 0.06/cosR;
827   dm[5]-= 0.06/cosR;
828
829   //
830
831   dm[7]+= 0.06/cosR;
832   dm[8]+= 0.06/cosR;
833
834   gMC->Gsvolu("TS16","PCON",idtmed[6],dm,9);   
835
836   // 16->15->14->13
837
838   gMC->Gspos("TS16",1,"TS15",0.,0.,0.,0,"ONLY");
839   gMC->Gspos("TS15",1,"TS14",0.,0.,0.,0,"ONLY");
840   gMC->Gspos("TS14",1,"TS13",0.,0.,0.,0,"ONLY");
841
842   // TS12->TICR
843
844   gMC->Gspos("TS13",1,"TICR",0.,0.,0.,0,"ONLY");
845
846   //------------------------------------------------------
847   // Tpc Inner Field Cage
848   // mother volume - Al, daughters - composite (sandwich)
849   //------------------------------------------------------
850
851   dm[0]= 0.;
852   dm[1]= 360.;
853   dm[2]=6.;
854
855   //
856
857   dm[3]= -253.0;
858   dm[4]= 70.7;
859   dm[5]= 79.2;
860
861   //
862
863   dm[6]= -251.0;
864   dm[7]= 70.7;
865   dm[8]= 79.2;
866
867   //
868
869   dm[9]= -251.0;
870   dm[10]= 77.15;
871   dm[11]= 79.2;
872
873   //
874   
875   dm[12]= 251.0;
876   dm[13]= 77.15;
877   dm[14]= 79.2;
878
879   //
880
881   dm[15]= 251.0;
882   dm[16]= 66.0;
883   dm[17]= 79.2;
884
885   //
886
887   dm[18]= 253.0;
888   dm[19]= 66.0;
889   dm[20]= 79.2;
890
891   gMC->Gsvolu("TIFC","PCON",idtmed[4],dm,21);
892
893   // Daughter volumes
894
895   // Tpc Sandwich 17 - Tedlar
896
897   dm[0]= 77.15;
898   dm[1]= 79.2;
899   dm[2]= 251.7;
900
901   gMC->Gsvolu("TS17","TUBE",idtmed[9],dm,3);
902
903   // Tpc Sandwich 18 - Kevlar
904
905   dm[0]+= 5.e-3;
906   dm[1]-= 5.e-3;
907
908   gMC->Gsvolu("TS18","TUBE",idtmed[5],dm,3);
909
910
911   // Tpc Sandwich 19 - NOMEX
912
913   dm[0]+= 0.02;
914   dm[1]-= 0.02;
915
916   gMC->Gsvolu("TS19","TUBE",idtmed[6],dm,3);
917
918   // 19->18->17
919
920   gMC->Gspos("TS19",1,"TS18",0.,0.,0.,0,"ONLY");
921   gMC->Gspos("TS18",1,"TS17",0.,0.,0.,0,"ONLY");
922
923   // TS17->TIFC
924
925   gMC->Gspos("TS17",1,"TIFC",0.,0.,0.,0,"ONLY");
926
927   // TPC Rings
928
929   dm[0]= 70.7;
930   dm[1]= 79.2;
931   dm[2]= 0.3;
932
933   gMC->Gsposp("TPCR",4,"TIIN",0.,0.,-253.3,0,"ONLY",dm,3);
934
935   dm[0]= 66.0;
936   dm[1]= 70.2;  
937
938   gMC->Gsposp("TPCR",5,"TIIN",0.,0.,250.7,0,"ONLY",dm,3);
939
940   dm[0]= 75.3;
941   dm[1]= 79.2;  
942
943   gMC->Gsposp("TPCR",6,"TIIN",0.,0.,253.3,0,"ONLY",dm,3);  
944
945   // TICL->TIIN
946
947   gMC->Gspos("TICL",1,"TIIN",0.,0.,0.,0,"ONLY");
948
949   // TICR->TIIN
950
951   gMC->Gspos("TICR",1,"TIIN",0.,0.,0.,0,"ONLY");
952
953   // TIFC->TIIN
954
955   gMC->Gspos("TIFC",1,"TIIN",0.,0.,0.,0,"ONLY");
956
957   // Tpc Sandwich 21 - Al (central barrel)
958
959   dm[0]= 60.65;
960   dm[1]= 61.21;
961   dm[2]= 75.2;
962
963   gMC->Gsvolu("TS21","TUBE",idtmed[4],dm,3);
964
965   // Tpc Sandwich 22 - Tedlar (central barrel) 
966
967   dm[0]+= 5.e-3;
968   dm[1]-= 5.e-3;
969
970   gMC->Gsvolu("TS22","TUBE",idtmed[9],dm,3); 
971
972   // Tpc Sandwich 23 - Kevlar (central barrel) 
973
974   dm[0]+= 5.e-3;
975   dm[1]-= 5.e-3;
976
977   gMC->Gsvolu("TS23","TUBE",idtmed[5],dm,3); 
978
979   // Tpc Sandwich 24 - NOMEX (central barrel) 
980
981   dm[0]+= 0.02;
982   dm[1]-= 0.02;
983
984   gMC->Gsvolu("TS24","TUBE",idtmed[6],dm,3); 
985
986   // 24->23->22->21
987
988   gMC->Gspos("TS24",1,"TS23",0.,0.,0.,0,"ONLY");
989   gMC->Gspos("TS23",1,"TS22",0.,0.,0.,0,"ONLY");
990   gMC->Gspos("TS22",1,"TS21",0.,0.,0.,0,"ONLY");
991
992   gMC->Gspos("TS21",1,"TIIN",0.,0.,0.,0,"ONLY");
993
994   // put everything into the TPC 
995
996   gMC->Gspos("TIIN",1,"TPC ",0.,0.,0.,0,"ONLY");
997
998
999   //---------------------------------------------------------
1000   //  Tpc Dift Gas volume Nonsensitive (Ne-CO2 90/10)
1001   //  and its daughters (HV membrane, rods, readout chambers)
1002   //---------------------------------------------------------
1003
1004   dm[0]= 79.2;
1005   dm[1]= 258.0;
1006   dm[2]= 253.6;
1007
1008   gMC->Gsvolu("TDGN","TUBE",idtmed[1],dm,3);  
1009
1010   // sector opening angles
1011
1012   Float_t innerOpenAngle = fTPCParam->GetInnerAngle();
1013
1014   // sector angle shift
1015
1016   Float_t innerAngleShift = fTPCParam->GetInnerAngleShift();
1017
1018   // number of sectors
1019
1020   Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
1021   Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
1022
1023   // All above parameters are identical for inner and outer
1024   // sectors. The distinction is kept for the historical reasons
1025   // and eventually will disappear.
1026
1027   Float_t tanAlpha = TMath::Tan(0.5*innerOpenAngle);
1028   Float_t cosAlpha = TMath::Sqrt(1.+tanAlpha*tanAlpha);
1029   Float_t space;
1030
1031   //-------------------------------------------------------------------------
1032   //   Tpc Inner Readout Chambers 
1033   //-------------------------------------------------------------------------
1034
1035   dm[0]= 14.483;
1036   dm[1]= 23.3345; 
1037   dm[2]= 1.6; // thickness
1038   dm[3]= 25.1;
1039
1040   gMC->Gsvolu("TIRC","TRD1",idtmed[4],dm,4);
1041
1042   // this volume will be positioned in the empty space
1043   // of the end-cap to avoid overlaps
1044
1045   dm[0]= 13.7305;
1046   dm[1]= 21.1895;
1047   dm[2]= 2.25;
1048   dm[3]= 21.15;
1049
1050   gMC->Gsvolu("TIC1","TRD1",idtmed[4],dm,4);
1051
1052
1053   //------------------------------------------------
1054   // Tpc Inner readout chamber Pad Plane
1055   //------------------------------------------------
1056
1057   dm[0]= 14.483;
1058   dm[1]= 23.3345;
1059   dm[2]= 0.5;
1060   dm[3]= 25.1;
1061
1062   gMC->Gsvolu("TIPP","TRD1",idtmed[12],dm,4);
1063
1064   // 
1065
1066   dm[0] -= 1.218511934;
1067   dm[1] -= 1.218511934;
1068   dm[2] = 0.35;
1069
1070   gMC->Gsvolu("TIC3","TRD1",idtmed[1],dm,4);
1071
1072   gMC->Gspos("TIC3",1,"TIPP",0.,0.15,0.,0,"ONLY");
1073
1074   gMC->Gspos("TIPP",1,"TIRC",0.,1.1,0.,0,"ONLY");
1075
1076
1077   //----------------------------------------------
1078   // Tpc Readout Chambers Empty spaces - for both
1079   // inner and outer sectors
1080   //----------------------------------------------
1081
1082   gMC->Gsvolu("TRCE","TRD1",idtmed[0],dm,0);
1083
1084   // Inner sector - 4 spaces
1085
1086
1087   dm[3] = 4.7625;
1088   dm[0] = 12.472;
1089
1090   Float_t rr = 90.52;
1091   Float_t zz;
1092
1093   zz= -12.7875;
1094   
1095   space = rr*tanAlpha-dm[0];
1096
1097   for(Int_t nsLow=0;nsLow<4;nsLow++){
1098
1099     rr += 9.525;
1100     dm[1]= rr*tanAlpha - space;  
1101
1102     dm[2]=0.8;
1103
1104     gMC->Gsposp("TRCE",nsLow+1,"TIRC",0.,-0.8,zz,0,"ONLY",dm,4);
1105
1106     //
1107
1108     dm[2] = 1.2;
1109
1110     gMC->Gsposp("TRCE",nsLow+5,"TIC1",0.,1.05,zz-2.1,0,"ONLY",dm,4);
1111
1112     rr += 0.4;
1113     dm[0] = rr*tanAlpha - space;
1114     zz += (0.4+9.525); 
1115
1116   }
1117
1118   dm[0]= 12.472;
1119   // dm[1] - this is the dm[1] from the previous TRCE
1120   dm[2]= 1.05;
1121   dm[3]= 19.65;
1122
1123   gMC->Gsposp("TRCE",9,"TIC1",0.,-1.2,0.,0,"ONLY",dm,4);   
1124
1125   //
1126   // TPc Space for Connectors
1127   //
1128
1129   dm[0]= .3;
1130   dm[1]= .3;
1131   dm[2]= 4.5;
1132
1133   gMC->Gsvolu("TPSC","BOX ",idtmed[0],dm,3);
1134
1135   // TPC Connectors
1136
1137   dm[0]= .25;
1138   dm[1]= .15;
1139   dm[2]= 3.75;
1140
1141   gMC->Gsvolu("TPCC","BOX ",idtmed[13],dm,3); 
1142
1143   gMC->Gspos("TPCC",1,"TPSC",0.,0.15,0.,0,"ONLY");
1144
1145   zz = -12.7875;
1146
1147
1148   Float_t alpha;
1149   Float_t astep;
1150
1151   Float_t phi1,phi2,phi3,theta1,theta2,theta3; // rotation angles
1152
1153   // inner part of the inner sector - 2 x 20 holes
1154   
1155   astep = 20.00096874/19.;
1156
1157   alpha = 10.00048437-astep;
1158
1159   Float_t x1,x2;
1160
1161     x1 = 13.31175725;
1162     x1 -= 0.996357832; 
1163
1164     x2 = 15.06180253;
1165     x2 -= 1.163028812;
1166
1167   Int_t ncon;
1168
1169   for(ncon=0;ncon<20;ncon++){
1170
1171     phi1 = 0.;
1172     theta1 = 90.+alpha;
1173     phi2=90.;
1174     theta2 = 90.;
1175     phi3 = (alpha>0) ? 0. : 180.;
1176     theta3 = TMath::Abs(alpha);
1177
1178     AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
1179
1180  
1181
1182     gMC->Gspos("TPSC",ncon+1,"TIRC",x1,0.3,-12.7875,idrotm[nRotMat],"ONLY");
1183     gMC->Gspos("TPSC",ncon+21,"TIRC",x2,0.3,-2.8625,idrotm[nRotMat],"ONLY");
1184
1185
1186     x1 -= 1.296357833;
1187     x2 -= 1.463028812;
1188
1189     alpha -= astep;   
1190     nRotMat++; 
1191
1192   }
1193
1194   // outer part of the inner sector - 2 x 25 holes
1195
1196    astep = 20.00096874/24.; 
1197    alpha = 10.00048437-astep;
1198
1199    x1 = 16.81184781;
1200    x1 -= 1.016295986;
1201
1202    x2 = 18.5618931;
1203    x2 -= 1.150914854;
1204
1205   for(ncon=0;ncon<25;ncon++){
1206
1207     phi1 = 0.;
1208     theta1 = 90.+alpha;
1209     phi2=90.;
1210     theta2 = 90.;
1211     phi3 = (alpha>0) ? 0. : 180.;
1212     theta3 = TMath::Abs(alpha);
1213
1214     AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
1215
1216  
1217
1218     gMC->Gspos("TPSC",ncon+41,"TIRC",x1,0.3,7.0625,idrotm[nRotMat],"ONLY");
1219     gMC->Gspos("TPSC",ncon+66,"TIRC",x2,0.3,16.9875,idrotm[nRotMat],"ONLY");
1220
1221
1222     x1 -= 1.316295986;
1223     x2 -= 1.450914854;
1224
1225     alpha -= astep;   
1226     nRotMat++; 
1227
1228   }  
1229
1230   //--------------------------------------------------------------------------
1231   //  TPC Outer Readout Chambers
1232   //  this is NOT a final design
1233   //--------------------------------------------------------------------------
1234
1235   dm[0]= 23.3875;
1236   dm[1]= 43.524;
1237   dm[2]= 1.5; //thickness
1238   dm[3]= 57.1;
1239
1240   gMC->Gsvolu("TORC","TRD1",idtmed[4],dm,4);
1241
1242   //------------------------------------------------
1243   // Tpc Outer readout chamber Pad Plane
1244   //------------------------------------------------
1245
1246   dm[2]= 0.5;
1247
1248   gMC->Gsvolu("TOPP","TRD1",idtmed[12],dm,4);
1249
1250   dm[0] -= 1.218511934;
1251   dm[1] -= 1.218511934;
1252   dm[2] = 0.35;
1253
1254   gMC->Gsvolu("TOC3","TRD1",idtmed[1],dm,4);
1255
1256   gMC->Gspos("TOC3",1,"TOPP",0.,0.15,0.,0,"ONLY");
1257
1258   gMC->Gspos("TOPP",1,"TORC",0.,1.0,0.,0,"ONLY");
1259
1260   // empty space
1261
1262   dm[0]= 21.035;
1263   dm[1]= 38.7205;
1264   dm[2]= 0.7; 
1265   dm[3]= 50.15;
1266
1267   gMC->Gsposp("TRCE",10,"TORC",0.,-0.8,-2.15,0,"ONLY",dm,4);  
1268
1269   dm[0]= 22.2935;
1270   dm[1]= 40.5085;
1271   dm[2]= 2.25;
1272   dm[3]= 51.65;
1273
1274   gMC->Gsvolu("TOC1","TRD1",idtmed[4],dm,4);
1275
1276   dm[0]= 21.35;
1277   dm[1]= 38.7205;
1278   dm[2]= 2.25;
1279   dm[3]= 50.15;
1280
1281   gMC->Gsposp("TRCE",11,"TOC1",0.,0.,0.,0,"ONLY",dm,4); 
1282
1283   //-----------------------------------------------
1284   // Tpc Services Support Wheel
1285   //-----------------------------------------------
1286
1287   dm[0]=0.;
1288   dm[1]=360.;
1289   dm[2]=18.;
1290   dm[3]=2.;
1291
1292   dm[4]= -5.;
1293   dm[5]= 77.017;
1294   dm[6]= 255.267;
1295
1296   dm[7]= 5.;
1297   dm[8]= dm[5];
1298   dm[9]= dm[6];
1299
1300   gMC->Gsvolu("TSSW","PGON",idtmed[4],dm,10);
1301
1302   // Tpc Services Wheel Cover
1303
1304   dm[4]= -0.5;
1305   dm[7]= 0.5;
1306
1307   gMC->Gsvolu("TSWC","PGON",idtmed[4],dm,10);
1308
1309   // Tpc Service wheel Cover Empty space
1310    
1311   dm[0]= 10.99;
1312   dm[1]= 39.599;
1313   dm[2]= .5;
1314   dm[3]= 81.125;
1315
1316   gMC->Gsvolu("TSCE","TRD1",idtmed[0],dm,4);
1317
1318   // Tpc services Wheel Empty Spaces
1319
1320   dm[0]= 13.18017507;
1321   dm[1]= 44.61045938;
1322   dm[2]= 4.;
1323   dm[3]= 89.125;
1324
1325   gMC->Gsvolu("TWES","TRD1",idtmed[0],dm,4);
1326
1327   // Tpc Services Wheel Bars
1328
1329   gMC->Gsvolu("TSWB","TRD1",idtmed[4],dm,0);
1330
1331   // bars-> TWES
1332
1333   dm[2]= 4.;
1334   dm[3]= .4;
1335
1336   dm[0]= 13.8149522;
1337   dm[1]= 13.95601379;
1338   
1339   gMC->Gsposp("TSWB",1,"TWES",0.,0.,-85.125,0,"ONLY",dm,4);
1340
1341   dm[0]= 43.83462067; 
1342   dm[1]= 43.97568225;
1343
1344   gMC->Gsposp("TSWB",2,"TWES",0.,0.,85.125,0,"ONLY",dm,4);
1345
1346   // TPc ELectronics - right now 30% X0 Si
1347
1348   dm[0]= 14.03813696;
1349   dm[1]= 43.3524075;
1350   dm[2]= 1.404;
1351   dm[3]= 83.125;
1352
1353   gMC->Gsvolu("TPEL","TRD1",idtmed[11],dm,4);
1354   gMC->Gspos("TPEL",1,"TWES",0.,0.,0.,0,"ONLY");
1355
1356   //--------------------------------------------------------------------------
1357   //  End caps
1358   //--------------------------------------------------------------------------
1359
1360   // TPc Main Wheel - Al
1361
1362   dm[0]= 75.3;
1363   dm[1]= 264.8;
1364   dm[2]= 3.0;
1365
1366   gMC->Gsvolu("TPMW","TUBE",idtmed[4],dm,3);
1367
1368   // TPc Extra Wheel (to avoid overlapping) - Al
1369
1370   dm[0]= 264.8;
1371   dm[1]= 277.0;
1372   dm[2]= 1.95;
1373
1374   gMC->Gsvolu("TPEW","TUBE",idtmed[4],dm,3);
1375
1376   //--------------------------------------------------------------------------
1377   //  Tpc Empty Space for the Readout chambers
1378   //--------------------------------------------------------------------------  
1379
1380   Float_t rLow= 86.2;
1381   Float_t rUp= 243.5;
1382   Float_t dR = 0.5*(rUp-rLow);
1383
1384   space= 1.4/cosAlpha; // wheel ribs are 2.8 cm wide
1385
1386   dm[0]= rLow*tanAlpha-space;
1387   dm[1]= rUp*tanAlpha-space;
1388   dm[2] = 3.0;
1389   dm[3]= dR;
1390
1391   gMC->Gsvolu("TESR","TRD1",idtmed[0],dm,4);
1392
1393   // TIC1->TESR
1394
1395   gMC->Gspos("TIC1",1,"TESR",0.,0.75,-dR+23.97,0,"ONLY");
1396
1397   // TOC1->TESR
1398
1399   gMC->Gspos("TOC1",1,"TESR",0.,0.75,dR-55.02,0,"ONLY");
1400
1401   // Tpc Empty Space Bars - Al (daughters of TESR)
1402
1403   Float_t zBar;
1404
1405   gMC->Gsvolu("TESB","TRD1",idtmed[4],dm,0);
1406
1407   // lower bar
1408
1409   dm[0]= rLow*tanAlpha-space;
1410   dm[1]= 88.7*tanAlpha-space;
1411   dm[2]= 0.95;
1412   dm[3]= 1.275;
1413
1414   zBar = -dR+dm[3];
1415
1416   gMC->Gsposp("TESB",1,"TESR",0.,2.05,zBar,0,"ONLY",dm,4);
1417
1418   // middle bar
1419
1420   dm[0]= 131.65*tanAlpha-space;
1421   dm[1]= 136.5*tanAlpha-space;
1422   dm[3]= 2.425;
1423
1424   zBar = -dR +131.65+dm[3]-rLow;
1425
1426   gMC->Gsposp("TESB",2,"TESR",0.,2.05,zBar,0,"ONLY",dm,4);
1427
1428   // upper bar
1429
1430   dm[0]= 240.4*tanAlpha-space;
1431   dm[1]= rUp*tanAlpha-space;
1432   dm[3]= 1.55;
1433
1434   zBar = dR-dm[3];
1435
1436   gMC->Gsposp("TESB",3,"TESR",0.,2.05,zBar,0,"ONLY",dm,4);
1437
1438   //  positioning of the empty spaces into the main wheel
1439
1440
1441
1442   Float_t rCenter,xc,yc;
1443   Float_t rInner,rOuter; // center of the inner and outer chamber
1444
1445   rCenter = rLow+dR;
1446
1447   rInner = 108.07;
1448   rOuter = 190.68;
1449
1450
1451   for(Int_t ns=0; ns<nInnerSector;ns++){
1452
1453     phi1 = ns * innerOpenAngle + innerAngleShift;
1454     phi1 *= kRaddeg; // in degrees
1455
1456     phi1 = (Float_t)TMath::Nint(phi1) + 270.;
1457
1458     if (phi1 > 360.) phi1 -= 360.;
1459
1460     theta1 = 90.;
1461     phi2   = 90.;
1462     theta2 = 180.;
1463     phi3   = ns * innerOpenAngle + innerAngleShift;
1464     phi3 *= kRaddeg; // in degrees
1465
1466     phi3 = (Float_t)TMath::Nint(phi3);
1467       
1468     if(phi3 > 360.) phi3 -= 360.;
1469
1470     theta3 = 90.;
1471
1472     // "holes"->End plate
1473
1474     xc = rCenter*TMath::Cos(phi3*kDegrad);
1475     yc = rCenter*TMath::Sin(phi3*kDegrad);
1476
1477     AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
1478
1479     gMC->Gspos("TESR",ns+1,"TPMW",xc,yc,0.,idrotm[nRotMat],"ONLY");
1480
1481     // TSCE->TSWC (services wheel volumes)
1482
1483     xc = 166.142*TMath::Cos(phi3*kDegrad);
1484     yc = 166.142*TMath::Sin(phi3*kDegrad);
1485
1486     gMC->Gspos("TSCE",ns+1,"TSWC",xc,yc,0.,idrotm[nRotMat],"ONLY");
1487     gMC->Gspos("TWES",ns+1,"TSSW",xc,yc,0.,idrotm[nRotMat],"ONLY");
1488
1489
1490     // readout chambers->TDGN (drift gas)
1491
1492     xc = rInner*TMath::Cos(phi3*kDegrad);
1493     yc = rInner*TMath::Sin(phi3*kDegrad);
1494
1495     gMC->Gspos("TIRC",ns+1,"TDGN",xc,yc,252.,idrotm[nRotMat],"ONLY");
1496      
1497     xc = rOuter*TMath::Cos(phi3*kDegrad);
1498     yc = rOuter*TMath::Sin(phi3*kDegrad);
1499
1500     gMC->Gspos("TORC",ns+1,"TDGN",xc,yc,252.1,idrotm[nRotMat],"ONLY");
1501
1502     nRotMat++;
1503
1504     theta2 = 0.; // reflection
1505
1506     AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
1507
1508     xc = rInner*TMath::Cos(phi3*kDegrad);
1509     yc = rInner*TMath::Sin(phi3*kDegrad);
1510
1511     gMC->Gspos("TIRC",ns+nInnerSector+1,"TDGN",xc,yc,-252.,idrotm[nRotMat],"ONLY");
1512
1513     xc = rOuter*TMath::Cos(phi3*kDegrad);
1514     yc = rOuter*TMath::Sin(phi3*kDegrad);
1515
1516     gMC->Gspos("TORC",ns+nOuterSector+1,"TDGN",xc,yc,-252.1,idrotm[nRotMat],"ONLY");
1517
1518     nRotMat++;
1519
1520   } 
1521
1522   // reflection matrix
1523
1524   theta1 = 90.;
1525   phi1   = 0.;
1526   theta2 = 90.;
1527   phi2   = 270.;
1528   theta3 = 180.;
1529   phi3   = 0.;
1530
1531   AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
1532
1533
1534   // TPMW->TPC
1535
1536   gMC->Gspos("TPMW",1,"TPC ",0.,0.,256.6,0,"ONLY");
1537   gMC->Gspos("TPMW",2,"TPC ",0.,0.,-256.6,idrotm[nRotMat],"ONLY");
1538   gMC->Gspos("TPEW",1,"TPC ",0.,0.,257.65,0,"ONLY");
1539   gMC->Gspos("TPEW",2,"TPC ",0.,0.,-257.65,0,"ONLY");
1540
1541
1542
1543   //-------------------------------------------------------
1544   // Tpc High Voltage Membrane - NOMEX honeycomb
1545   //-------------------------------------------------------
1546
1547   dm[0]=0.,
1548   dm[1]=360.;
1549   dm[2]=18.;
1550   dm[3]=2.;
1551
1552   //
1553
1554   dm[4]= -0.3;
1555   dm[5]= 81.156;
1556   dm[6]= 253.386;
1557
1558   //
1559
1560   dm[7]= 0.3;
1561   dm[8]= dm[5];
1562   dm[9]= dm[6];
1563
1564   gMC->Gsvolu("THVM","PGON",idtmed[6],dm,10);
1565
1566   gMC->Gspos("THVM",1,"TDGN",0.,0.,0.,0,"ONLY");
1567
1568   //----------------------------------------------------------
1569   // TPc Support Rods - MAKROLON
1570   //----------------------------------------------------------
1571
1572   dm[0]= 0.9;
1573   dm[1]= 1.2;
1574   dm[2]= 126.65;
1575
1576   gMC->Gsvolu("TPSR","TUBE",idtmed[7],dm,3);
1577
1578   for(Int_t nrod=1;nrod<18;nrod++){
1579     Float_t angle=innerOpenAngle*(Float_t)nrod;
1580
1581     xc=82.4*TMath::Cos(angle);
1582     yc=82.4*TMath::Sin(angle);
1583
1584     gMC->Gspos("TPSR",nrod,"TDGN",xc,yc,126.95,0,"ONLY");
1585     gMC->Gspos("TPSR",nrod+17,"TDGN",xc,yc,-126.95,0,"ONLY");
1586
1587     xc=254.2*TMath::Cos(angle);
1588     yc=254.2*TMath::Sin(angle);
1589
1590     gMC->Gspos("TPSR",nrod+34,"TDGN",xc,yc,126.95,0,"ONLY");
1591     gMC->Gspos("TPSR",nrod+51,"TDGN",xc,yc,-126.95,0,"ONLY");    
1592
1593   }
1594
1595   //----------------------------------------------------------
1596   // Tpc High Voltage rod - MAKROLON + Copper cable
1597   //----------------------------------------------------------
1598
1599   // rod with cable (Left)
1600
1601   dm[0]=0.;
1602   dm[1]=2.25;
1603   dm[2]=126.65;
1604
1605   gMC->Gsvolu("THVL","TUBE",idtmed[7],dm,3);
1606
1607   // HV cable
1608  
1609   dm[0]=0.;
1610   dm[1]=0.3;
1611   dm[2]=126.65;
1612
1613   gMC->Gsvolu("THVC","TUBE",idtmed[10],dm,3);
1614
1615   // empty space
1616
1617   dm[0]=0.3;
1618   dm[1]=1.;
1619   dm[2]=126.65;
1620
1621   gMC->Gsvolu("THVE","TUBE",idtmed[1],dm,3);
1622
1623   gMC->Gspos("THVC",1,"THVL",0.,0.,0.,0,"ONLY");
1624   gMC->Gspos("THVE",1,"THVL",0.,0.,0.,0,"ONLY");
1625
1626   // rod without cable
1627
1628   dm[0]=1.8;
1629   dm[1]=2.25;
1630   dm[2]=126.65;
1631
1632   gMC->Gsvolu("THVR","TUBE",idtmed[7],dm,3);
1633
1634   
1635   
1636   gMC->Gspos("THVL",1,"TDGN",82.4,0.,-126.95,0,"ONLY");
1637   gMC->Gspos("THVL",2,"TDGN",254.2,0.,-126.95,0,"ONLY");
1638
1639   gMC->Gspos("THVR",1,"TDGN",82.4,0.,126.95,0,"ONLY");
1640   gMC->Gspos("THVR",2,"TDGN",254.2,0.,126.95,0,"ONLY");  
1641   
1642
1643
1644   gMC->Gspos("TDGN",1,"TPC ",0.,0.,0.,0,"ONLY"); 
1645
1646
1647   // services wheel cover -> wheel
1648
1649
1650   gMC->Gspos("TSWC",1,"TSSW",0.,0.,4.5,0,"ONLY");
1651   gMC->Gspos("TSWC",2,"TSSW",0.,0.,-4.5,0,"ONLY");
1652
1653
1654   // put the wheel into the TPC
1655
1656   gMC->Gspos("TSSW",1,"TPC ",0.,0.,278.7,0,"ONLY");
1657   gMC->Gspos("TSSW",2,"TPC ",0.,0.,-278.7,0,"ONLY");
1658
1659   //
1660
1661   gMC->Gsord("TPMW",6);
1662   gMC->Gsord("TSSW",6);
1663   gMC->Gsord("TSWC",6);
1664
1665   // put the TPC into ALIC (main mother volume)
1666
1667   gMC->Gspos("TPC ",1,"ALIC",0.,0.,0.,0,"ONLY");
1668  
1669 } // end of function
1670
1671
1672 //_____________________________________________________________________________
1673 void AliTPCv0::CreateMaterials()
1674 {
1675   //
1676   // Define materials for the TPC
1677   //
1678   AliTPC::CreateMaterials();
1679 }
1680
1681 //_____________________________________________________________________________
1682 void AliTPCv0::DrawDetector()
1683 {
1684   //
1685   // Draw a shaded view of the Time Projection Chamber version 0
1686   //
1687
1688   // Set everything unseen
1689   gMC->Gsatt("*", "seen", -1);
1690   // 
1691   // Set ALIC mother transparent
1692   gMC->Gsatt("ALIC","SEEN",0);
1693   //
1694   // Set the volumes visible
1695   gMC->Gsatt("TPC ","SEEN",0);
1696   gMC->Gsatt("TOIN","SEEN",1);
1697   gMC->Gsatt("TOIN","COLO",7);
1698   gMC->Gsatt("TPCR","SEEN",0);
1699   gMC->Gsatt("TOCV","SEEN",1);
1700   gMC->Gsatt("TOCV","COLO",4);
1701   gMC->Gsatt("TSA1","SEEN",0);
1702   gMC->Gsatt("TSA2","SEEN",0);
1703   gMC->Gsatt("TSA3","SEEN",0);
1704   gMC->Gsatt("TSA4","SEEN",0);
1705   gMC->Gsatt("TOFC","SEEN",1);
1706   gMC->Gsatt("TOFC","COLO",4);
1707   gMC->Gsatt("TSA5","SEEN",0);
1708   gMC->Gsatt("TSA6","SEEN",0);
1709   gMC->Gsatt("TSA7","SEEN",0);
1710   gMC->Gsatt("TIIN","COLO",7);
1711   gMC->Gsatt("TIIN","SEEN",1);
1712   gMC->Gsatt("TICL","SEEN",0);
1713   gMC->Gsatt("TSA9","SEEN",0);
1714   gMC->Gsatt("TS10","SEEN",0);
1715   gMC->Gsatt("TS11","SEEN",0);
1716   gMC->Gsatt("TS12","SEEN",0);
1717   gMC->Gsatt("TICR","SEEN",0); 
1718   gMC->Gsatt("TS13","SEEN",0);
1719   gMC->Gsatt("TS14","SEEN",0);
1720   gMC->Gsatt("TS15","SEEN",0);
1721   gMC->Gsatt("TS16","SEEN",0);
1722   gMC->Gsatt("TIFC","SEEN",1);
1723   gMC->Gsatt("TIFC","COLO",4); 
1724   gMC->Gsatt("TS17","SEEN",0);
1725   gMC->Gsatt("TS18","SEEN",0);
1726   gMC->Gsatt("TS19","SEEN",0);
1727   gMC->Gsatt("TS21","SEEN",0);
1728   gMC->Gsatt("TS22","SEEN",0);
1729   gMC->Gsatt("TS23","SEEN",0);
1730   gMC->Gsatt("TS24","SEEN",0);
1731   gMC->Gsatt("TDGN","SEEN",0);
1732   gMC->Gsatt("TIRC","SEEN",0);
1733   gMC->Gsatt("TIC1","SEEN",1);
1734   gMC->Gsatt("TIPP","SEEN",0);
1735   gMC->Gsatt("TIC3","SEEN",0);
1736   gMC->Gsatt("TRCE","SEEN",0);
1737   gMC->Gsatt("TPSC","SEEN",0);
1738   gMC->Gsatt("TPCC","SEEN",0);
1739   gMC->Gsatt("TORC","SEEN",0);
1740   gMC->Gsatt("TOPP","SEEN",0);
1741   gMC->Gsatt("TOC3","SEEN",0);
1742   gMC->Gsatt("TOC1","SEEN",1);
1743   gMC->Gsatt("TSSW","SEEN",1);
1744   gMC->Gsatt("TSWC","SEEN",1);
1745   gMC->Gsatt("TSCE","SEEN",1); 
1746   gMC->Gsatt("TSSW","COLO",3);
1747   gMC->Gsatt("TSWC","COLO",3);
1748   gMC->Gsatt("TSCE","COLO",6);
1749   gMC->Gsatt("TWES","SEEN",0);
1750   gMC->Gsatt("TSWB","SEEN",0);
1751   gMC->Gsatt("TPEL","SEEN",0);
1752   gMC->Gsatt("TPMW","SEEN",1);
1753   gMC->Gsatt("TPEW","SEEN",1);
1754   gMC->Gsatt("TESR","SEEN",1);
1755   gMC->Gsatt("TPMW","COLO",12);
1756   gMC->Gsatt("TPEW","COLO",12);
1757   gMC->Gsatt("TWES","COLO",5);
1758   gMC->Gsatt("TIC1","COLO",5);
1759   gMC->Gsatt("TOC1","COLO",5);  
1760   gMC->Gsatt("TESB","SEEN",0);
1761   gMC->Gsatt("THVM","SEEN",1);
1762   gMC->Gsatt("THVM","COLO",11);
1763   gMC->Gsatt("TPSR","SEEN",0);
1764   gMC->Gsatt("THVL","SEEN",0);
1765   gMC->Gsatt("THVC","SEEN",0);
1766   gMC->Gsatt("THVE","SEEN",0);
1767   gMC->Gsatt("THVR","SEEN",0);
1768   //
1769   gMC->Gdopt("hide", "on");
1770   gMC->Gdopt("shad", "on");
1771   gMC->Gsatt("*", "fill", 7);
1772   gMC->SetClipBox(".");
1773   gMC->SetClipBox("TPMW",-300,300,-300,300,254.,270.);
1774   gMC->SetClipBox("TESR",-300,300,-300,300,254.,270.);
1775   gMC->SetClipBox("TSSW",-300,300,-300,300,283.,284.);
1776   gMC->SetClipBox("TSWC",-300,300,-300,300,283.,284.);
1777   gMC->SetClipBox("*", 0, 300, -300, 300, -290, 290);
1778   gMC->DefaultRange();
1779   gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
1780   gMC->Gdhead(1111, "Time Projection Chamber");
1781   gMC->Gdman(18, 4, "MAN");
1782   gMC->Gdopt("hide","off");
1783 }
1784
1785 //_____________________________________________________________________________
1786 void AliTPCv0::Init()
1787 {
1788   //
1789   // Initialise Time Projection Chamber version 0
1790   //
1791   printf("TPC version 0 initialized\n");
1792 }
1793
1794 //_____________________________________________________________________________
1795 void AliTPCv0::StepManager()
1796 {
1797   //
1798   // Procedure called at each step in the TPC
1799   //
1800 }