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