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