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