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