]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCv0.cxx
Updated list of libraries
[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 /* $Id$ */
17 //
18
19 ///////////////////////////////////////////////////////////////////////////////
20 //                                                                           //
21 //  Time Projection Chamber version 0 -- "coarse" TPC                        //
22 //                                                                           //
23 //Begin_Html
24 /*
25 <img src="picts/AliTPCv0Class.gif">
26 */
27 //End_Html
28 //                                                                           //
29 //                                                                           //
30 ///////////////////////////////////////////////////////////////////////////////
31
32 #include <Riostream.h>
33
34 #include <TMath.h>
35 #include <TVirtualMC.h>
36 #include <TString.h>
37 #include <TSystem.h>
38
39 #include "AliConst.h"
40 #include "AliRun.h"
41 #include "AliTPCDigitsArray.h"
42 #include "AliTPCParamSR.h"
43 #include "AliTPCv0.h"
44 #include "TGeoManager.h"
45 #include "TGeoVolume.h"
46 #include "TGeoPcon.h"
47 #include "TGeoCone.h"
48 #include "TGeoTube.h"
49 #include "TGeoPgon.h"
50 #include "TGeoTrd1.h"
51 #include "TGeoCompositeShape.h"
52 #include "TGeoPara.h"
53 #include "TGeoPhysicalNode.h"
54 #include "TGeoHalfSpace.h"
55 #include "TTreeStream.h"
56 #include "TGeoArb8.h"
57 using std::ifstream;
58 using std::ios_base;
59 ClassImp(AliTPCv0)
60  
61 //_____________________________________________________________________________
62 AliTPCv0::AliTPCv0(const char *name, const char *title) 
63          :AliTPC(name, title)
64 {
65   //
66   // Standard creator for TPC version 0
67   //
68
69
70   if (fTPCParam)
71      fTPCParam->Write(fTPCParam->GetTitle());
72 }
73
74 //_____________________________________________________________________________
75
76 void AliTPCv0::CreateGeometry()
77 {
78
79   //
80   // Creation of the TPC version 0, i.e. no sensitive volumes,
81   // only the material distribution
82   //
83   //Begin_Html
84   /*
85     <img src="picts/AliTPC.gif">
86   */
87   //End_Html
88   //Begin_Html
89   /*
90     <img src="picts/AliTPCv0Tree.gif">
91   */
92   //End_Html
93
94  //----------------------------------------------------------
95   // This geometry is written using TGeo class
96   // Firstly the shapes are defined, and only then the volumes
97   // What is recognized by the MC are volumes
98   //----------------------------------------------------------
99   //
100   //  tpc - this will be the mother volume
101   //
102
103   //
104   // here I define a volume TPC
105   // retrive the medium name with "TPC_" as a leading string
106   //
107   TGeoPcon *tpc = new TGeoPcon(0.,360.,30); //30 sections
108   //
109   tpc->DefineSection(0,-289.6,77.,278.);
110   tpc->DefineSection(1,-262.1,77.,278.);
111   //
112   tpc->DefineSection(2,-262.1,83.1,278.);
113   tpc->DefineSection(3,-260.,83.1,278.);
114   //
115   tpc->DefineSection(4,-260.,70.,278.);    
116   tpc->DefineSection(5,-259.6,70.,278.);
117   //
118   tpc->DefineSection(6,-259.6,68.1,278.);
119   tpc->DefineSection(7,-253.6,68.1,278.);
120   //
121   tpc->DefineSection(8,-253.6,67.88,278.);//hs
122   tpc->DefineSection(9,-74.0,60.68,278.);// hs
123   //
124   tpc->DefineSection(10,-74.0,60.1,278.);
125   tpc->DefineSection(11,-73.3,60.1,278.);
126   //
127   tpc->DefineSection(12,-73.3,56.9,278.); 
128   tpc->DefineSection(13,-68.5,56.9,278.);
129   //
130   tpc->DefineSection(14,-68.5,60.,278.);
131   tpc->DefineSection(15,-64.7,60.,278.);
132   //
133   tpc->DefineSection(16,-64.7,56.9,278.); 
134   tpc->DefineSection(17,73.3,56.9,278.);
135   //
136   tpc->DefineSection(18,73.3,60.1,278.);
137   tpc->DefineSection(19,74.0,60.1,278.);
138   //
139   tpc->DefineSection(20,74.0,60.68,278.);// hs
140   tpc->DefineSection(21,253.6,65.38,278.);// hs
141   //
142   tpc->DefineSection(22,253.6,65.6,278.);
143   tpc->DefineSection(23,259.6,65.6,278.);
144   //
145   tpc->DefineSection(24,259.6,70.0,278.);
146   tpc->DefineSection(25,260.,70.0,278.);
147   //
148   tpc->DefineSection(26,260.,83.1,278.);
149   tpc->DefineSection(27,262.1,83.1,278.);
150   //
151   tpc->DefineSection(28,262.1,77.,278);
152   tpc->DefineSection(29,289.6,77.,278.);
153   //
154   TGeoMedium *m1 = gGeoManager->GetMedium("TPC_Air");
155   TGeoVolume *v1 = new TGeoVolume("TPC_M",tpc,m1);
156   //
157   // drift volume - sensitive volume, extended beyond the
158   // endcaps, because of the alignment
159   //
160   TGeoPcon *dvol = new TGeoPcon(0.,360.,6);
161   dvol->DefineSection(0,-260.,74.5,264.4);
162   dvol->DefineSection(1,-253.6,74.5,264.4);
163   //
164   dvol->DefineSection(2,-253.6,76.6774,258.);
165   dvol->DefineSection(3,253.6,76.6774,258.); 
166   //
167   dvol->DefineSection(4,253.6,74.5,264.4);
168   dvol->DefineSection(5,260.,74.5,264.4);
169   //
170   TGeoMedium *m5 = gGeoManager->GetMedium("TPC_DriftGasS1");
171   TGeoVolume *v9 = new TGeoVolume("TPC_Drift",dvol,m5);
172   //
173   v1->AddNode(v9,1);
174   //
175   // outer insulator
176   //
177   TGeoPcon *tpco = new TGeoPcon(0.,360.,6); //insulator
178   //
179   tpco->DefineSection(0,-256.6,264.8,278.);
180   tpco->DefineSection(1,-253.6,264.8,278.);
181   //
182   tpco->DefineSection(2,-253.6,258.,278.);
183   tpco->DefineSection(3,250.6,258.,278.);
184   //
185   tpco->DefineSection(4,250.6,258.,275.5);
186   tpco->DefineSection(5,253.6,258.,275.5);
187   //
188   TGeoMedium *m2 = gGeoManager->GetMedium("TPC_CO2");
189   TGeoVolume *v2 = new TGeoVolume("TPC_OI",tpco,m2);
190   //
191   // outer containment vessel
192   //
193   TGeoPcon *tocv = new TGeoPcon(0.,360.,6);  // containment vessel
194   //
195   tocv->DefineSection(0,-256.6,264.8,278.);
196   tocv->DefineSection(1,-253.6,264.8,278.);
197   //
198   tocv->DefineSection(2,-253.6,274.8124,278.);
199   tocv->DefineSection(3,247.6,274.8124,278.);  
200   //
201   tocv->DefineSection(4,247.6,270.4,278.);
202   tocv->DefineSection(5,250.6,270.4,278.);
203   //
204   TGeoMedium *m3 = gGeoManager->GetMedium("TPC_Al");
205   TGeoVolume *v3 = new TGeoVolume("TPC_OCV",tocv,m3); 
206   //
207   TGeoTube *to1 = new TGeoTube(274.8174,277.995,252.1); //epoxy
208   TGeoTube *to2 = new TGeoTube(274.8274,277.985,252.1); //tedlar
209   TGeoTube *to3 = new TGeoTube(274.8312,277.9812,252.1);//prepreg2
210   TGeoTube *to4 = new TGeoTube(274.9062,277.9062,252.1);//nomex
211   //
212   TGeoMedium *sm1 = gGeoManager->GetMedium("TPC_Epoxy");
213   TGeoMedium *sm2 = gGeoManager->GetMedium("TPC_Tedlar");
214   TGeoMedium *sm3 = gGeoManager->GetMedium("TPC_Prepreg2");
215   TGeoMedium *sm4 = gGeoManager->GetMedium("TPC_Nomex");
216   //
217   //
218   TGeoVolume *tov1 = new TGeoVolume("TPC_OCV1",to1,sm1);
219   TGeoVolume *tov2 = new TGeoVolume("TPC_OCV2",to2,sm2);
220   TGeoVolume *tov3 = new TGeoVolume("TPC_OCV3",to3,sm3);
221   TGeoVolume *tov4 = new TGeoVolume("TPC_OCV4",to4,sm4);
222   TGeoMedium *mhs = gGeoManager->GetMedium("TPC_Steel");
223   TGeoMedium *m12 =  gGeoManager->GetMedium("TPC_Water");
224   //-------------------------------------------------------
225   //  Tpc Outer Field Cage
226   //  daughters - composite (sandwich)
227   //-------------------------------------------------------
228
229   TGeoPcon *tofc = new TGeoPcon(0.,360.,6);
230   //
231   tofc->DefineSection(0,-253.6,258.,269.6);
232   tofc->DefineSection(1,-250.6,258.,269.6);
233   //
234   tofc->DefineSection(2,-250.6,258.,260.0676); 
235   tofc->DefineSection(3,250.6,258.,260.0676);
236   //
237   tofc->DefineSection(4,250.6,258.,275.5);
238   tofc->DefineSection(5,253.6,258.,275.5);
239   //
240   TGeoVolume *v4 = new TGeoVolume("TPC_TOFC",tofc,m3); 
241   //sandwich
242   TGeoTube *tf1 = new TGeoTube(258.0,260.0676,252.1); //tedlar
243   TGeoTube *tf2 = new TGeoTube(258.0038,260.0638,252.1); //prepreg3
244   TGeoTube *tf3 = new TGeoTube(258.0338,260.0338,252.1);//nomex
245   //
246   TGeoMedium *sm5 = gGeoManager->GetMedium("TPC_Prepreg3");
247   //
248   TGeoVolume *tf1v = new TGeoVolume("TPC_OFC1",tf1,sm2);
249   TGeoVolume *tf2v = new TGeoVolume("TPC_OFC2",tf2,sm5);
250   TGeoVolume *tf3v = new TGeoVolume("TPC_OFC3",tf3,sm4);
251   //
252   // outer part - positioning
253   //
254   tov1->AddNode(tov2,1); tov2->AddNode(tov3,1); tov3->AddNode(tov4,1);
255   //
256   tf1v->AddNode(tf2v,1); tf2v->AddNode(tf3v,1);
257   //
258   v3->AddNode(tov1,1,new TGeoTranslation(0.,0.,-1.5)); v4->AddNode(tf1v,1);
259   //
260   v2->AddNode(v3,1); v2->AddNode(v4,1); 
261   //
262   v1->AddNode(v2,1);
263   //-----------------------------------------------------------
264   //--------------------------------------------------------------------
265   // Tpc Inner INsulator (CO2) 
266   // the cones, the central drum and the inner f.c. sandwich with a piece
267   // of the flane will be placed in the TPC
268   //--------------------------------------------------------------------
269   TGeoPcon *tpci = new TGeoPcon(0.,360.,4);
270   //
271   tpci->DefineSection(0,-253.6,68.4,76.6774);
272   tpci->DefineSection(1,-74.0,61.2,76.6774);
273   //
274   tpci->DefineSection(2,74.0,61.2,76.6774);  
275   //
276   tpci->DefineSection(3,253.6,65.9,76.6774);
277   //
278   TGeoVolume *v5 = new TGeoVolume("TPC_INI",tpci,m2);
279   //
280   // now the inner field cage - only part of flanges (2 copies)
281   //
282   TGeoTube *tif1 = new TGeoTube(69.9,76.6774,1.5); 
283   TGeoVolume *v6 = new TGeoVolume("TPC_IFC1",tif1,m3);
284   //
285  //---------------------------------------------------------
286   // Tpc Inner Containment vessel - Muon side
287   //---------------------------------------------------------
288   TGeoPcon *tcms = new TGeoPcon(0.,360.,10);
289   //
290   tcms->DefineSection(0,-259.1,68.1,74.2);
291   tcms->DefineSection(1,-253.6,68.1,74.2);
292   //
293   tcms->DefineSection(2,-253.6,68.1,68.4);
294   tcms->DefineSection(3,-74.0,60.9,61.2);
295   //
296   tcms->DefineSection(4,-74.0,60.1,61.2);
297   tcms->DefineSection(5,-73.3,60.1,61.2);
298   //
299   tcms->DefineSection(6,-73.3,56.9,61.2);
300   tcms->DefineSection(7,-73.0,56.9,61.2);
301   //
302   tcms->DefineSection(8,-73.0,56.9,58.8);
303   tcms->DefineSection(9,-71.3,56.9,58.8);
304   //
305   TGeoVolume *v7 = new TGeoVolume("TPC_ICVM",tcms,m3);
306   //------------------------------------------------
307   //  Heat screen muon side
308   //------------------------------------------------
309  
310   TGeoCone *thsm = new TGeoCone(89.8,67.88,68.1,60.68,60.9);
311   TGeoCone *thsmw = new TGeoCone(89.8,67.94,68.04,60.74,60.84);
312   TGeoVolume *hvsm = new TGeoVolume("TPC_HSM",thsm,mhs); //steel
313   TGeoVolume *hvsmw = new TGeoVolume("TPC_HSMW",thsmw,m12); //water 
314   // assembly heat screen muon
315   hvsm->AddNode(hvsmw,1);
316   //-----------------------------------------------
317   // inner containment vessel - shaft side
318   //-----------------------------------------------
319   TGeoPcon *tcss = new TGeoPcon(0.,360.,10);
320   //
321   tcss->DefineSection(0,71.3,56.9,58.8);
322   tcss->DefineSection(1,73.0,56.9,58.8);
323   //
324   tcss->DefineSection(2,73.0,56.9,61.2);
325   tcss->DefineSection(3,73.3,56.9,61.2);
326   //  
327   tcss->DefineSection(4,73.3,60.1,61.2);
328   tcss->DefineSection(5,74.0,60.1,61.2);
329   //
330   tcss->DefineSection(6,74.0,60.9,61.2);
331   tcss->DefineSection(7,253.6,65.6,65.9);
332   //
333   tcss->DefineSection(8,253.6,65.6,74.2);
334   tcss->DefineSection(9,258.1,65.6,74.2);
335   //
336   TGeoVolume *v8 = new TGeoVolume("TPC_ICVS",tcss,m3);
337   //-------------------------------------------------
338   //  Heat screen shaft side
339   //--------------------------------------------------
340   TGeoCone *thss = new TGeoCone(89.8,60.68,60.9,65.38,65.6);       
341   TGeoCone *thssw = new TGeoCone(89.8,60.74,60.84,65.44,65.54);     
342   TGeoVolume *hvss = new TGeoVolume("TPC_HSS",thss,mhs); //steel
343   TGeoVolume *hvssw = new TGeoVolume("TPC_HSSW",thssw,m12); //water 
344   //assembly heat screen shaft
345   hvss->AddNode(hvssw,1);
346   //-----------------------------------------------
347   //  Inner field cage
348   //  define 4 parts and make an assembly
349   //-----------------------------------------------
350   // part1 - Al - 2 copies
351   TGeoTube *t1 = new TGeoTube(76.6774,78.845,0.75);
352   TGeoVolume *tv1 = new TGeoVolume("TPC_IFC2",t1,m3);
353   // sandwich - outermost parts - 2 copies
354   TGeoTube *t2 = new TGeoTube(76.6774,78.845,74.175); // tedlar 38 microns
355   TGeoTube *t3 = new TGeoTube(76.6812,78.8412,74.175); // prepreg2 500 microns
356   TGeoTube *t4 = new TGeoTube(76.7312,78.7912,74.175); // prepreg3 300 microns
357   TGeoTube *t5 = new TGeoTube(76.7612,78.7612,74.175); // nomex 2 cm
358   //
359   TGeoVolume *tv2 = new TGeoVolume("TPC_IFC3",t2,sm2);
360   TGeoVolume *tv3 = new TGeoVolume("TPC_IFC4",t3,sm3);
361   TGeoVolume *tv4 = new TGeoVolume("TPC_IFC5",t4,sm5);
362   TGeoVolume *tv5 = new TGeoVolume("TPC_IFC6",t5,sm4);
363   //
364   // middle parts - 2 copies
365   TGeoTube *t6 = new TGeoTube(76.6774,78.795,5.); // tedlar 38 microns
366   TGeoTube *t7 = new TGeoTube(76.6812,78.7912,5.); // prepreg2 250 microns
367   TGeoTube *t8 = new TGeoTube(76.7062,78.7662,5.); // prepreg3 300 microns
368   TGeoTube *t9 = new TGeoTube(76.7362,78.7362,5.); // nomex 2 cm
369   //
370   TGeoVolume *tv6 = new TGeoVolume("TPC_IFC7",t6,sm2);
371   TGeoVolume *tv7 = new TGeoVolume("TPC_IFC8",t7,sm3);
372   TGeoVolume *tv8 = new TGeoVolume("TPC_IFC9",t8,sm5);
373   TGeoVolume *tv9 = new TGeoVolume("TPC_IFC10",t9,sm4);
374   // central part - 1 copy
375   TGeoTube *t10 = new TGeoTube(76.6774,78.745,93.75); // tedlar 38 microns 
376   TGeoTube *t11 = new TGeoTube(76.6812,78.7412,93.75); // prepreg3 300 microns
377   TGeoTube *t12 = new TGeoTube(76.7112,78.7112,93.75); // nomex 2 cm
378   //
379   TGeoVolume *tv10 = new TGeoVolume("TPC_IFC11",t10,sm2);
380   TGeoVolume *tv11 = new TGeoVolume("TPC_IFC12",t11,sm5);
381   TGeoVolume *tv12 = new TGeoVolume("TPC_IFC13",t12,sm4);
382   //
383   // inner part - positioning
384   //
385   // creating a sandwich
386   tv2->AddNode(tv3,1); tv3->AddNode(tv4,1); tv4->AddNode(tv5,1);
387   //
388   tv6->AddNode(tv7,1); tv7->AddNode(tv8,1); tv8->AddNode(tv9,1);
389   //
390   tv10->AddNode(tv11,1); tv11->AddNode(tv12,1);
391   //
392   TGeoVolumeAssembly *tv100 = new TGeoVolumeAssembly("TPC_IFC");
393   //
394   tv100->AddNode(tv10,1);
395   tv100->AddNode(tv6,1,new TGeoTranslation(0.,0.,-98.75));
396   tv100->AddNode(tv6,2,new TGeoTranslation(0.,0.,98.75));
397   tv100->AddNode(tv2,1,new TGeoTranslation(0.,0.,-177.925));
398   tv100->AddNode(tv2,2,new TGeoTranslation(0.,0.,177.925));
399   tv100->AddNode(tv1,1,new TGeoTranslation(0.,0.,-252.85));
400   tv100->AddNode(tv1,2,new TGeoTranslation(0.,0.,252.85));
401   //
402   v5->AddNode(v6,1, new TGeoTranslation(0.,0.,-252.1));
403   v5->AddNode(v6,2, new TGeoTranslation(0.,0.,252.1));
404   v1->AddNode(v5,1); v1->AddNode(v7,1); v1->AddNode(v8,1); 
405   v1->AddNode(hvsm,1,new TGeoTranslation(0.,0.,-163.8)); 
406   v1->AddNode(hvss,1,new TGeoTranslation(0.,0.,163.8)); 
407   v9->AddNode(tv100,1);
408   //
409   // central drum 
410   //
411   // flange + sandwich
412   //
413   TGeoPcon *cfl = new TGeoPcon(0.,360.,6);
414   cfl->DefineSection(0,-71.1,59.7,61.2);
415   cfl->DefineSection(1,-68.6,59.7,61.2);
416   //
417   cfl->DefineSection(2,-68.6,60.6324,61.2);
418   cfl->DefineSection(3,68.6,60.6324,61.2); 
419   //
420   cfl->DefineSection(4,68.6,59.7,61.2);
421   cfl->DefineSection(5,71.1,59.7,61.2);  
422   //
423   TGeoVolume *cflv = new TGeoVolume("TPC_CDR",cfl,m3);
424   // sandwich
425   TGeoTube *cd1 = new TGeoTube(60.6424,61.19,71.1);
426   TGeoTube *cd2 = new TGeoTube(60.6462,61.1862,71.1);
427   TGeoTube *cd3 = new TGeoTube(60.6662,61.1662,71.1);  
428   //
429   TGeoMedium *sm6 = gGeoManager->GetMedium("TPC_Prepreg1");
430   TGeoVolume *cd1v = new TGeoVolume("TPC_CDR1",cd1,sm2); //tedlar
431   TGeoVolume *cd2v = new TGeoVolume("TPC_CDR2",cd2,sm6);// prepreg1
432   TGeoVolume *cd3v = new TGeoVolume("TPC_CDR3",cd3,sm4); //nomex
433   //
434   // seals for central drum 2 copies
435   //
436   TGeoTube *cs = new TGeoTube(56.9,61.2,0.1);
437   TGeoMedium *sm7 = gGeoManager->GetMedium("TPC_Mylar");
438   TGeoVolume *csv = new TGeoVolume("TPC_CDRS",cs,sm7);
439   v1->AddNode(csv,1,new TGeoTranslation(0.,0.,-71.2));
440   v1->AddNode(csv,2,new TGeoTranslation(0.,0.,71.2));
441   //
442   // seal collars 
443   TGeoPcon *se = new TGeoPcon(0.,360.,6);
444   se->DefineSection(0,-72.8,59.7,61.2);
445   se->DefineSection(1,-72.3,59.7,61.2);
446   //
447   se->DefineSection(2,-72.3,58.85,61.2);
448   se->DefineSection(3,-71.6,58.85,61.2); 
449   //
450   se->DefineSection(4,-71.6,59.7,61.2);
451   se->DefineSection(5,-71.3,59.7,61.2);  
452   //
453   TGeoVolume *sev = new TGeoVolume("TPC_CDCE",se,m3);
454   //
455   TGeoTube *si = new TGeoTube(56.9,58.8,1.); 
456   TGeoVolume *siv = new TGeoVolume("TPC_CDCI",si,m3);
457   //
458   // define reflection matrix 
459   //
460   TGeoRotation *ref = new TGeoRotation("ref",90.,0.,90.,90.,180.,0.);
461   //
462   cd1v->AddNode(cd2v,1); cd2v->AddNode(cd3v,1); cflv->AddNode(cd1v,1);
463   //
464   v1->AddNode(siv,1,new TGeoTranslation(0.,0.,-69.9));
465   v1->AddNode(siv,2,new TGeoTranslation(0.,0.,69.9));
466   v1->AddNode(sev,1); v1->AddNode(sev,2,ref); v1->AddNode(cflv,1);
467   //
468   // central membrane - 2 rings and a mylar membrane - assembly
469   //
470   TGeoTube *ih = new TGeoTube(81.05,84.05,0.3);
471   TGeoTube *oh = new TGeoTube(250.,256.,.5);
472   TGeoTube *mem = new TGeoTube(84.05,250,0.01);
473   TGeoVolume *ihv = new TGeoVolume("TPC_IHVH",ih,m3);
474   TGeoVolume *ohv = new TGeoVolume("TPC_OHVH",oh,m3);
475   TGeoVolume *memv = new TGeoVolume("TPC_HV",mem,sm7);
476   //
477   TGeoVolumeAssembly *cm = new TGeoVolumeAssembly("TPC_HVMEM");
478   cm->AddNode(ihv,1);
479   cm->AddNode(ohv,1);
480   cm->AddNode(memv,1);
481   v9->AddNode(cm,1);
482   //
483   // end caps - they are make as an assembly of single segments
484   // containing both readout chambers
485   //
486   Double_t openingAngle = 10.*TMath::DegToRad();
487   Double_t thick=1.5; // rib
488   Double_t shift = thick/TMath::Sin(openingAngle);
489   //
490   Double_t lowEdge = 86.3; // hole in the wheel
491   Double_t upEdge = 240.4; // hole in the wheel
492   //
493   new TGeoTubeSeg("sec",74.5,264.4,3.,0.,20.);
494   //
495   TGeoPgon *hole = new TGeoPgon("hole",0.,20.,1,4);
496   //
497   hole->DefineSection(0,-3.5,lowEdge-shift,upEdge-shift);
498   hole->DefineSection(1,-1.5,lowEdge-shift,upEdge-shift);
499   //
500   hole->DefineSection(2,-1.5,lowEdge-shift,upEdge+3.-shift);
501   hole->DefineSection(3,3.5,lowEdge-shift,upEdge+3.-shift);
502   //
503   Double_t ys = shift*TMath::Sin(openingAngle); 
504   Double_t xs = shift*TMath::Cos(openingAngle);
505   TGeoTranslation *tr = new TGeoTranslation("tr",xs,ys,0.);  
506   tr->RegisterYourself();
507   TGeoCompositeShape *chamber = new TGeoCompositeShape("sec-hole:tr");
508   TGeoVolume *sv = new TGeoVolume("TPC_WSEG",chamber,m3);
509   TGeoPgon *bar = new TGeoPgon("bar",0.,20.,1,2);
510   bar->DefineSection(0,-3.,131.5-shift,136.5-shift);
511   bar->DefineSection(1,1.5,131.5-shift,136.5-shift);
512   TGeoVolume *barv = new TGeoVolume("TPC_WBAR",bar,m3);
513   TGeoVolumeAssembly *ch = new TGeoVolumeAssembly("TPC_WCH");//empty segment
514   //
515   ch->AddNode(sv,1); ch->AddNode(barv,1,tr);
516   //
517   // readout chambers
518   //
519   // IROC first
520   //
521    TGeoTrd1 *ibody = new TGeoTrd1(13.8742,21.3328,4.29,21.15);
522    TGeoVolume *ibdv = new TGeoVolume("TPC_IROCB",ibody,m3);
523   // empty space
524    TGeoTrd1 *emp = new TGeoTrd1(12.3742,19.8328,3.99,19.65);
525    TGeoVolume *empv = new TGeoVolume("TPC_IROCE",emp,m1);
526    ibdv->AddNode(empv,1,new TGeoTranslation(0.,-0.3,0.));
527    //bars
528    Double_t tga = (19.8328-12.3742)/39.3;
529    Double_t xmin,xmax;
530    xmin = 9.55*tga+12.3742;
531    xmax = 9.95*tga+12.3742;
532    TGeoTrd1 *ib1 = new TGeoTrd1(xmin,xmax,3.29,0.2);
533    TGeoVolume *ib1v = new TGeoVolume("TPC_IRB1",ib1,m3);
534    empv->AddNode(ib1v,1,new TGeoTranslation("tt1",0.,0.7,-9.9));
535    xmin=19.4*tga+12.3742;
536    xmax=19.9*tga+12.3742;
537    TGeoTrd1 *ib2 = new TGeoTrd1(xmin,xmax,3.29,0.25);
538    TGeoVolume *ib2v = new TGeoVolume("TPC_TRB2",ib2,m3);
539    empv->AddNode(ib2v,1,new TGeoTranslation(0.,0.7,0.));
540    xmin=29.35*tga+12.3742;
541    xmax=29.75*tga+12.3742;
542    TGeoTrd1 *ib3 = new TGeoTrd1(xmin,xmax,3.29,0.2); 
543    TGeoVolume *ib3v = new TGeoVolume("TPC_IRB3",ib3,m3);    
544    empv->AddNode(ib3v,1,new TGeoTranslation(0.,0.7,9.9));
545    //
546    // holes for connectors
547    //
548    TGeoBBox *conn = new TGeoBBox(0.4,0.3,4.675); // identical for iroc and oroc
549    TGeoVolume *connv = new TGeoVolume("TPC_RCCON",conn,m1);
550    TString fileName(gSystem->Getenv("ALICE_ROOT"));
551    fileName += "/TPC/conn_iroc.dat";
552    ifstream in;
553    in.open(fileName.Data(), ios_base::in); // asci file
554    for(Int_t i =0;i<86;i++){
555       Double_t y = 3.99;
556       Double_t x,z,ang;
557       in>>x>>z>>ang;
558       z-=26.5;
559       TGeoRotation *rrr = new TGeoRotation();
560       rrr->RotateY(ang);
561       TGeoCombiTrans *trans = new TGeoCombiTrans("trans",x,y,z,rrr);
562       ibdv->AddNode(connv,i+1,trans);
563    }
564    in.close();
565    // "cap"
566    new TGeoTrd1("icap",14.5974,23.3521,1.19,24.825);
567    // "hole"
568    new TGeoTrd1("ihole",13.8742,21.3328,1.2,21.15);
569    TGeoTranslation *tr1 = new TGeoTranslation("tr1",0.,0.,1.725);  
570    tr1->RegisterYourself();
571    TGeoCompositeShape *ic = new TGeoCompositeShape("icap-ihole:tr1");
572    TGeoVolume *icv = new TGeoVolume("TPC_IRCAP",ic,m3);
573    //
574    // pad plane and wire fixations
575    //
576    TGeoTrd1 *pp = new TGeoTrd1(14.5974,23.3521,0.3,24.825); //pad+iso
577    TGeoMedium *m4 = gGeoManager->GetMedium("TPC_G10");
578    TGeoVolume *ppv = new TGeoVolume("TPC_IRPP",pp,m4);
579    TGeoPara *f1 = new TGeoPara(.6,.5,24.825,0.,-10.,0.);
580    TGeoVolume *f1v = new TGeoVolume("TPC_IRF1",f1,m4);
581    TGeoPara *f2 = new TGeoPara(.6,.5,24.825,0.,10.,0.);
582    TGeoVolume *f2v = new TGeoVolume("TPC_IRF2",f2,m4);
583    //
584    TGeoVolumeAssembly *iroc = new TGeoVolumeAssembly("TPC_IROC");
585    //
586    iroc->AddNode(ibdv,1);
587    iroc->AddNode(icv,1,new TGeoTranslation(0.,3.1,-1.725));
588    iroc->AddNode(ppv,1,new TGeoTranslation(0.,4.59,-1.725));
589    tga =(23.3521-14.5974)/49.65; 
590    Double_t xx = 24.825*tga+14.5974-0.6;
591    iroc->AddNode(f1v,1,new TGeoTranslation(-xx,5.39,-1.725));
592    iroc->AddNode(f2v,1,new TGeoTranslation(xx,5.39,-1.725));
593    //
594    // OROC
595    //
596    TGeoTrd1 *obody = new TGeoTrd1(22.2938,40.5084,4.19,51.65);
597    TGeoVolume *obdv = new TGeoVolume("TPC_OROCB",obody,m3);
598    TGeoTrd1 *oemp = new TGeoTrd1(20.2938,38.5084,3.89,49.65);
599    TGeoVolume *oempv = new TGeoVolume("TPC_OROCE",oemp,m1);
600    obdv->AddNode(oempv,1,new TGeoTranslation(0.,-0.3,0.));
601    //horizontal bars
602    tga=(38.5084-20.2938)/99.3;
603    xmin=tga*10.2+20.2938;
604    xmax=tga*10.6+20.2938;
605    TGeoTrd1 *ob1 = new TGeoTrd1(xmin,xmax,2.915,0.2);
606    TGeoVolume *ob1v = new TGeoVolume("TPC_ORB1",ob1,m3);
607    //
608    xmin=22.55*tga+20.2938;
609    xmax=24.15*tga+20.2938;
610    TGeoTrd1 *ob2 = new TGeoTrd1(xmin,xmax,2.915,0.8);
611    TGeoVolume *ob2v = new TGeoVolume("TPC_ORB2",ob2,m3);
612    //
613    xmin=36.1*tga+20.2938;
614    xmax=36.5*tga+20.2938;
615    TGeoTrd1 *ob3 = new TGeoTrd1(xmin,xmax,2.915,0.2);
616    TGeoVolume *ob3v = new TGeoVolume("TPC_ORB3",ob3,m3);
617    //
618    xmin=49.0*tga+20.2938;
619    xmax=50.6*tga+20.2938;   
620    TGeoTrd1 *ob4 = new TGeoTrd1(xmin,xmax,2.915,0.8);
621    TGeoVolume *ob4v = new TGeoVolume("TPC_ORB4",ob4,m3);
622    //
623    xmin=63.6*tga+20.2938;
624    xmax=64.0*tga+20.2938;
625    TGeoTrd1 *ob5 = new TGeoTrd1(xmin,xmax,2.915,0.2);
626    TGeoVolume *ob5v = new TGeoVolume("TPC_ORB5",ob5,m3);
627    //
628    xmin=75.5*tga+20.2938;
629    xmax=77.15*tga+20.2938;
630    TGeoTrd1 *ob6 = new TGeoTrd1(xmin,xmax,2.915,0.8);
631    TGeoVolume *ob6v = new TGeoVolume("TPC_ORB6",ob6,m3);
632    //
633    xmin=88.7*tga+20.2938;
634    xmax=89.1*tga+20.2938;
635    TGeoTrd1 *ob7 = new TGeoTrd1(xmin,xmax,2.915,0.2);
636    TGeoVolume *ob7v = new TGeoVolume("TPC_ORB7",ob7,m3);
637    //
638    oempv->AddNode(ob1v,1,new TGeoTranslation(0.,0.975,-39.25));
639    oempv->AddNode(ob2v,1,new TGeoTranslation(0.,0.975,-26.3));
640    oempv->AddNode(ob3v,1,new TGeoTranslation(0.,0.975,-13.35));
641    oempv->AddNode(ob4v,1,new TGeoTranslation(0.,0.975,0.15));
642    oempv->AddNode(ob5v,1,new TGeoTranslation(0.,0.975,14.15));
643    oempv->AddNode(ob6v,1,new TGeoTranslation(0.,0.975,26.7));
644    oempv->AddNode(ob7v,1,new TGeoTranslation(0.,0.975,39.25));
645    // vertical bars
646    TGeoBBox *ob8 = new TGeoBBox(0.8,2.915,5.1); 
647    TGeoBBox *ob9 = new TGeoBBox(0.8,2.915,5.975);
648    TGeoBBox *ob10 = new TGeoBBox(0.8,2.915,5.775);
649    TGeoBBox *ob11 = new TGeoBBox(0.8,2.915,6.25);
650    TGeoBBox *ob12 = new TGeoBBox(0.8,2.915,6.5);
651    //
652    TGeoVolume *ob8v = new TGeoVolume("TPC_ORB8",ob8,m3);
653    TGeoVolume *ob9v = new TGeoVolume("TPC_ORB9",ob9,m3);
654    TGeoVolume *ob10v = new TGeoVolume("TPC_ORB10",ob10,m3);
655    TGeoVolume *ob11v = new TGeoVolume("TPC_ORB11",ob11,m3);
656    TGeoVolume *ob12v = new TGeoVolume("TPC_ORB12",ob12,m3);
657    //
658    oempv->AddNode(ob8v,1,new TGeoTranslation(0.,0.975,-44.55));
659    oempv->AddNode(ob8v,2,new TGeoTranslation(0.,0.975,44.55));
660    oempv->AddNode(ob9v,1,new TGeoTranslation(0.,0.975,-33.075));
661    oempv->AddNode(ob9v,2,new TGeoTranslation(0.,0.975,-19.525));
662    oempv->AddNode(ob10v,1,new TGeoTranslation(0.,0.975,20.125));
663    oempv->AddNode(ob10v,2,new TGeoTranslation(0.,0.975,33.275));
664    oempv->AddNode(ob11v,1,new TGeoTranslation(0.,0.975,-6.9));
665    oempv->AddNode(ob12v,1,new TGeoTranslation(0.,0.975,7.45));
666    //
667    // holes for connectors
668    //
669    fileName = gSystem->Getenv("ALICE_ROOT");
670    fileName += "/TPC/conn_oroc.dat";
671    in.open(fileName.Data(), ios_base::in); // asci file
672    for(Int_t i =0;i<78;i++){
673       Double_t y =3.89;
674       Double_t x,z,ang;
675       Double_t x1,z1,x2,z2;
676       in>>x>>z>>ang;        
677       Double_t xr = 4.7*TMath::Sin(ang*TMath::DegToRad());
678       Double_t zr = 4.7*TMath::Cos(ang*TMath::DegToRad());
679       //
680       x1=xr+x; x2=-xr+x; z1=zr+z; z2 = -zr+z;      
681       //
682       TGeoRotation *rr = new TGeoRotation();
683       rr->RotateY(ang); 
684       z1-=54.95;
685       z2-=54.95;
686       TGeoCombiTrans *trans1 = new TGeoCombiTrans("trans1",x1,y,z1,rr);
687       TGeoCombiTrans *trans2 = new TGeoCombiTrans("trans2",x2,y,z2,rr);
688       obdv->AddNode(connv,i+1,trans1);
689       obdv->AddNode(connv,i+79,trans2);
690    }
691    in.close();
692    // cap
693    new TGeoTrd1("ocap",23.3874,43.5239,1.09,57.1);
694    new TGeoTrd1("ohole",22.2938,40.5084,1.09,51.65);
695    TGeoTranslation *tr5 = new TGeoTranslation("tr5",0.,0.,-2.15);
696    tr5->RegisterYourself();
697    TGeoCompositeShape *oc = new TGeoCompositeShape("ocap-ohole:tr5");
698    TGeoVolume *ocv = new TGeoVolume("TPC_ORCAP",oc,m3);
699    //
700    // pad plane and wire fixations
701    //
702    TGeoTrd1 *opp = new TGeoTrd1(23.3874,43.5239,0.3,57.1);
703    TGeoVolume *oppv = new TGeoVolume("TPC_ORPP",opp,m4);
704    //
705    tga=(43.5239-23.3874)/114.2;
706    TGeoPara *f3 = new TGeoPara(.7,.6,57.1,0.,-10.,0.);
707    TGeoPara *f4 = new TGeoPara(.7,.6,57.1,0.,10.,0.);  
708    xx = 57.1*tga+23.3874-0.7;
709    TGeoVolume *f3v = new TGeoVolume("TPC_ORF1",f3,m4);
710    TGeoVolume *f4v = new TGeoVolume("TPC_ORF2",f4,m4);
711    //
712    TGeoVolumeAssembly *oroc = new TGeoVolumeAssembly("TPC_OROC");
713    //
714    oroc->AddNode(obdv,1);
715    oroc->AddNode(ocv,1,new TGeoTranslation(0.,3.1,2.15));
716    oroc->AddNode(oppv,1,new TGeoTranslation(0.,4.49,2.15));
717    oroc->AddNode(f3v,1,new TGeoTranslation(-xx,5.39,2.15));
718    oroc->AddNode(f4v,1,new TGeoTranslation(xx,5.39,2.15));
719    // 
720    // now iroc and oroc are placed into a sector...
721    //
722    TGeoVolumeAssembly *secta = new TGeoVolumeAssembly("TPC_SECT"); // a-side
723    TGeoVolumeAssembly *sectc = new TGeoVolumeAssembly("TPC_SECT"); // c-side
724    //
725
726    TGeoRotation rot1("rot1",90.,90.,0.);
727    TGeoRotation rot2("rot2");
728    rot2.RotateY(10.);
729    TGeoRotation *rot = new TGeoRotation("rot");
730    *rot=rot1*rot2;
731    //
732    Double_t x0,y0;
733    x0=110.2*TMath::Cos(openingAngle);
734    y0=110.2*TMath::Sin(openingAngle);
735    TGeoCombiTrans *combi1a = new TGeoCombiTrans("combi1",x0,y0,1.09+0.195,rot); //a-side 
736    TGeoCombiTrans *combi1c = new TGeoCombiTrans("combi1",x0,y0,1.09+0.222,rot); //c-side
737    x0=188.45*TMath::Cos(openingAngle);
738    y0=188.45*TMath::Sin(openingAngle);
739    TGeoCombiTrans *combi2a = new TGeoCombiTrans("combi2",x0,y0,0.99+0.195,rot); //a-side
740    TGeoCombiTrans *combi2c = new TGeoCombiTrans("combi2",x0,y0,0.99+0.222,rot); //c-side
741    //
742    // A-side
743    //
744    secta->AddNode(ch,1);
745    secta->AddNode(iroc,1,combi1a);
746    secta->AddNode(oroc,1,combi2a);
747    //
748    // C-side
749    //
750    sectc->AddNode(ch,1);
751    sectc->AddNode(iroc,1,combi1c);
752    sectc->AddNode(oroc,1,combi2c);
753    //
754    // now I try to make  wheels...
755    //
756    TGeoVolumeAssembly *wheela = new TGeoVolumeAssembly("TPC_ENDCAP");
757    TGeoVolumeAssembly *wheelc = new TGeoVolumeAssembly("TPC_ENDCAP");
758    //
759    for(Int_t i =0;i<18;i++){
760      Double_t phi = (20.*i);
761      TGeoRotation *r = new TGeoRotation();
762      r->RotateZ(phi);
763      wheela->AddNode(secta,i+1,r);
764      wheelc->AddNode(sectc,i+1,r);    
765    }
766    // wheels in the drift volume!
767    TGeoCombiTrans *combi3 = new TGeoCombiTrans("combi3",0.,0.,256.6,ref);
768    v9->AddNode(wheela,1,combi3);
769    v9->AddNode(wheelc,2,new TGeoTranslation(0.,0.,-256.6));
770    //_____________________________________________________________
771    // service support wheel
772    //_____________________________________________________________
773   TGeoPgon *sw = new TGeoPgon(0.,20.,1,2);
774   sw->DefineSection(0,-4.,80.5,251.75);
775   sw->DefineSection(1,4.,80.5,251.75); 
776   TGeoVolume *swv = new TGeoVolume("TPC_SWSEG",sw,m3); //Al
777   //
778   thick=1.;
779   shift = thick/TMath::Sin(openingAngle);
780   TGeoPgon *sh = new TGeoPgon(0.,20.,1,2);
781   sh->DefineSection(0,-4.,81.5-shift,250.75-shift);
782   sh->DefineSection(1,4.,81.5-shift,250.75-shift);
783   TGeoVolume *shv = new TGeoVolume("TPC_SWS1",sh,m1); //Air
784   //
785   TGeoMedium *m9 =  gGeoManager->GetMedium("TPC_Si"); 
786   TGeoPgon *el = new TGeoPgon(0.,20.,1,2);
787   el->DefineSection(0,-1.872,81.5-shift,250.75-shift);
788   el->DefineSection(1,1.872,81.5-shift,250.75-shift);
789   TGeoVolume *elv = new TGeoVolume("TPC_ELEC",el,m9); //Si 
790   //
791   shv->AddNode(elv,1);
792   //
793   //
794   ys = shift*TMath::Sin(openingAngle);
795   xs = shift*TMath::Cos(openingAngle);
796   swv->AddNode(shv,1,new TGeoTranslation(xs,ys,0.));
797   // cover
798   TGeoPgon *co = new TGeoPgon(0.,20.,1,2);
799   co->DefineSection(0,-0.5,77.,255.25);
800   co->DefineSection(1,0.5,77.,255.25);
801   TGeoVolume *cov = new TGeoVolume("TPC_SWC1",co,m3);//Al
802   // hole in a cover
803   TGeoPgon *coh = new TGeoPgon(0.,20.,1,2);
804   shift=4./TMath::Sin(openingAngle);
805   coh->DefineSection(0,-0.5,85.-shift,247.25-shift);
806   coh->DefineSection(1,0.5,85.-shift,247.25-shift);  
807   //
808   TGeoVolume *cohv = new TGeoVolume("TPC_SWC2",coh,m1);
809   //
810   ys = shift*TMath::Sin(openingAngle);
811   xs = shift*TMath::Cos(openingAngle);  
812   cov->AddNode(cohv,1,new TGeoTranslation(xs,ys,0.));
813   //
814   // Sector as an Assembly
815   //
816   TGeoVolumeAssembly *swhs = new TGeoVolumeAssembly("TPC_SSWSEC");
817   swhs->AddNode(swv,1);
818   swhs->AddNode(cov,1,new TGeoTranslation(0.,0.,-4.5));
819   swhs->AddNode(cov,2,new TGeoTranslation(0.,0.,4.5));
820   //
821   // SSW as an Assembly of sectors
822   //
823  TGeoVolumeAssembly *swheel = new TGeoVolumeAssembly("TPC_SSWHEEL");
824    for(Int_t i =0;i<18;i++){
825      Double_t phi = (20.*i);
826      TGeoRotation *r = new TGeoRotation();
827      r->RotateZ(phi);
828      swheel->AddNode(swhs,i+1,r);   
829    }
830    v1->AddNode(swheel,1,new TGeoTranslation(0.,0.,-284.6));
831    v1->AddNode(swheel,2,new TGeoTranslation(0.,0.,284.6));
832    //
833   //----------------------------------------------------------
834   // TPc Support Rods - MAKROLON
835   //----------------------------------------------------------
836   TGeoMedium *m6=gGeoManager->GetMedium("TPC_Makrolon");
837   TGeoMedium *m7=gGeoManager->GetMedium("TPC_Cu");
838   TGeoMedium *m10 =  gGeoManager->GetMedium("TPC_Alumina");
839   TGeoMedium *m11 =  gGeoManager->GetMedium("TPC_Peek");
840   TGeoMedium *m13 = gGeoManager->GetMedium("TPC_Brass");
841   // 
842   // tpc rod is an assembly of 10 long parts and 2 short parts
843   // connected with alu rings and plagged on both sides.
844   //
845   //
846 // tpc rod long
847 //
848   TGeoPcon *rod = new TGeoPcon("rod",0.,360.,6);
849  rod->DefineSection(0,-10.43,1.92,2.08);
850  rod->DefineSection(1,-9.75,1.92,2.08);
851
852  rod->DefineSection(2,-9.75,1.8,2.2);
853  rod->DefineSection(3,9.75,1.8,2.2);
854
855  rod->DefineSection(4,9.75,1.92,2.08);
856  rod->DefineSection(5,10.43,1.92,2.08);
857  //
858  TGeoVolume *mrodl = new TGeoVolume("TPC_mrodl",rod,m6);
859  //
860  // tpc rod short 
861  //
862  TGeoPcon *rod1 = new TGeoPcon("rod1",0.,360.,6);
863  rod1->DefineSection(0,-8.93,1.92,2.08);
864  rod1->DefineSection(1,-8.25,1.92,2.08);
865
866  rod1->DefineSection(2,-8.25,1.8,2.2);
867  rod1->DefineSection(3,8.25,1.8,2.2);
868
869  rod1->DefineSection(4,8.25,1.92,2.08);
870  rod1->DefineSection(5,8.93,1.92,2.08);
871  //
872  TGeoVolume *mrods = new TGeoVolume("TPC_mrods",rod1,m6);
873  //
874  // below is for the resistor rod
875  //
876  // hole for the brass connectors
877  //
878
879  new TGeoTube("hhole",0.,0.3,0.3);
880  //
881  //transformations for holes - initialy they
882  // are placed at x=0 and negative y
883  //
884   TGeoRotation *rhole = new TGeoRotation();
885   rhole->RotateX(90.);
886   TGeoCombiTrans *transf[13];
887   Char_t name[30];
888   for(Int_t i=0;i<13;i++){
889     //sprintf(name,"transf%d",i);
890     snprintf(name,30,"transf%d",i);
891     transf[i]= new TGeoCombiTrans(name,0.,-2.,-9.+i*1.5,rhole);
892     transf[i]->RegisterYourself();
893   }
894   // union expression for holes
895   TString operl("hhole:transf0");
896   for (Int_t i=1;i<13;i++){
897     //sprintf(name,"+hhole:transf%d",i);
898     snprintf(name,30,"+hhole:transf%d",i);
899     operl.Append(name);   
900   }
901   //
902  TString opers("hhole:transf1");
903   for (Int_t i=2;i<12;i++){
904     //sprintf(name,"+hhole:transf%d",i);
905     snprintf(name,30,"+hhole:transf%d",i); 
906     opers.Append(name);   
907   }
908   //union of holes
909   new TGeoCompositeShape("hlv",operl.Data());
910   new TGeoCompositeShape("hsv",opers.Data());
911   //
912   TGeoCompositeShape *rodl = new TGeoCompositeShape("rodl","rod-hlv");
913   TGeoCompositeShape *rods = new TGeoCompositeShape("rods","rod1-hsv");
914  //rods - volumes - makrolon rods with holes
915   TGeoVolume *rodlv = new TGeoVolume("TPC_rodl",rodl,m6);
916   TGeoVolume *rodsv = new TGeoVolume("TPC_rods",rods,m6);
917   //brass connectors
918  //connectors
919   TGeoTube *bcon = new TGeoTube(0.,0.3,0.3);//connectors
920   TGeoVolume *bconv = new TGeoVolume("TPC_bcon",bcon,m13);
921  //
922  // hooks holding strips
923  //
924  new TGeoBBox("hk1",0.625,0.015,0.75);
925  new TGeoBBox("hk2",0.625,0.015,0.15);
926  TGeoTranslation *tr21 = new TGeoTranslation("tr21",0.,-0.03,-0.6);
927  TGeoTranslation *tr12 = new TGeoTranslation("tr12",0.,-0.03,0.6);
928  tr21->RegisterYourself();
929  tr12->RegisterYourself();
930  
931  TGeoCompositeShape *hook = new TGeoCompositeShape("hook","hk1+hk2:tr21+hk2:tr12");
932  TGeoVolume *hookv = new TGeoVolume("TPC_hook",hook,m13);
933  //
934  // assembly of the short rod with connectors and hooks
935  //
936  //
937  // short rod
938  //
939   TGeoVolumeAssembly *spart = new TGeoVolumeAssembly("TPC_spart");
940   //
941   spart->AddNode( rodsv,1);
942   for(Int_t i=1;i<12;i++){
943   spart->AddNode(bconv,i,transf[i]);
944   }
945   for(Int_t i =0;i<11;i++){
946     spart->AddNode(hookv,i+1,new TGeoTranslation(0.,-2.315,-7.5+i*1.5));
947   } 
948  //
949  // long rod
950  //
951   TGeoVolumeAssembly *lpart = new TGeoVolumeAssembly("TPC_lpart");
952   //
953   lpart->AddNode( rodlv,1);
954   for(Int_t i=0;i<13;i++){
955   lpart->AddNode(bconv,i+12,transf[i]);
956   }
957   for(Int_t i =0;i<13;i++){
958     lpart->AddNode(hookv,i+12,new TGeoTranslation(0.,-2.315,-9.+i*1.5));
959   }   
960   //
961   // alu ring
962   //
963   new TGeoTube("ring1",2.1075,2.235,0.53);
964   new TGeoTube("ring2",1.7925,1.89,0.43);
965   new TGeoTube("ring3",1.89,2.1075,0.05);
966   TGeoCompositeShape *ring = new TGeoCompositeShape("ring","ring1+ring2+ring3");
967   TGeoVolume *ringv = new TGeoVolume("TPC_ring",ring,m3);
968   //
969   // rod assembly
970   //
971   TGeoVolumeAssembly *tpcrrod = new TGeoVolumeAssembly("TPC_rrod");//rrod
972   TGeoVolumeAssembly *tpcmrod = new TGeoVolumeAssembly("TPC_mrod");//makrolon rod  
973   //long pieces
974   for(Int_t i=0;i<11;i++){
975     tpcrrod->AddNode(ringv,i+1,new TGeoTranslation(0.,0.,-105.+i*21));
976     tpcmrod->AddNode(ringv,i+12,new TGeoTranslation(0.,0.,-105.+i*21));
977   }
978   for(Int_t i=0;i<10;i++){
979     tpcrrod->AddNode(lpart,i+1,new TGeoTranslation(0.,0.,-94.5+i*21));//resistor rod
980     tpcmrod->AddNode(mrodl,i+1,new TGeoTranslation(0.,0.,-94.5+i*21));//makrolon rod        
981   }
982   //
983   // right plug - identical for all rods
984   //
985   TGeoPcon *tpcrp = new TGeoPcon(0.,360.,6);
986   //
987   tpcrp->DefineSection(0,123.05,1.89,2.1075);
988   tpcrp->DefineSection(1,123.59,1.89,2.1075);
989   //
990   tpcrp->DefineSection(2,123.59,1.8,2.2);
991   tpcrp->DefineSection(3,127.,1.8,2.2);
992   //
993   tpcrp->DefineSection(4,127.,0.,2.2);
994   tpcrp->DefineSection(5,127.5,0.,2.2);
995   //
996   TGeoVolume *tpcrpv = new TGeoVolume("TPC_RP",tpcrp,m6);
997   //
998   // adding short pieces and right plug
999   //
1000   tpcrrod->AddNode(spart,1,new TGeoTranslation(0.,0.,-114.));
1001   tpcrrod->AddNode(spart,2,new TGeoTranslation(0.,0.,114.)); 
1002   tpcrrod->AddNode(ringv,23,new TGeoTranslation(0.,0.,-123.));
1003   tpcrrod->AddNode(ringv,24,new TGeoTranslation(0.,0.,123.));
1004   tpcrrod->AddNode(tpcrpv,1);
1005   //
1006   tpcmrod->AddNode(mrods,1,new TGeoTranslation(0.,0.,-114.));
1007   tpcmrod->AddNode(mrods,2,new TGeoTranslation(0.,0.,114.)); 
1008   tpcmrod->AddNode(ringv,25,new TGeoTranslation(0.,0.,-123.));
1009   tpcmrod->AddNode(ringv,26,new TGeoTranslation(0.,0.,123.));
1010   tpcmrod->AddNode(tpcrpv,2);
1011   //
1012   // from the ringv position to the CM is 3.0 cm!
1013   //----------------------------------------
1014   //
1015   //
1016   //HV rods - makrolon + 0.58cm (diameter) Cu ->check the length
1017   TGeoTube *hvr = new TGeoTube(0.,1.465,123.);
1018   TGeoTube *hvc = new TGeoTube(0.,0.29,123.);
1019   //
1020   TGeoVolume *hvrv = new TGeoVolume("TPC_HV_Rod",hvr,m6);
1021   TGeoVolume *hvcv = new TGeoVolume("TPC_HV_Cable",hvc,m7);
1022   hvrv->AddNode(hvcv,1);
1023   //
1024   //resistor rod
1025   //
1026   TGeoTube *cr = new TGeoTube(0.,0.45,123.);   
1027   TGeoTube *cw = new TGeoTube(0.,0.15,123.);  
1028   TGeoVolume *crv = new TGeoVolume("TPC_CR",cr,m10);
1029   TGeoVolume *cwv = new TGeoVolume("TPC_W",cw,m12);   
1030   //
1031   // ceramic rod with water
1032   //
1033   crv->AddNode(cwv,1);
1034   //
1035   //peek rod
1036   //
1037   TGeoTube *pr =new TGeoTube(0.2,0.35,123.);  
1038   TGeoVolume *prv = new TGeoVolume("TPC_PR",pr,m11); 
1039   //
1040   // copper plates with connectors
1041   //
1042   new TGeoTube("tub",0.,1.7,0.025);
1043   //
1044   // half space - points on the plane and a normal vector
1045   //
1046   Double_t n[3],p[3];
1047   Double_t slope = TMath::Tan(22.*TMath::DegToRad());
1048   Double_t intp = 1.245;
1049   //
1050   Double_t b = slope*slope+1.;
1051   p[0]=intp*slope/b;
1052   p[1]=-intp/b;
1053   p[2]=0.;
1054   //
1055   n[0]=-p[0];
1056   n[1]=-p[1];
1057   n[2]=0.;
1058   Double_t norm;
1059   norm=TMath::Sqrt(n[0]*n[0]+n[1]*n[1]);
1060   n[0] /= norm;
1061   n[1] /=norm;
1062   //
1063   new TGeoHalfSpace("sp1",p,n);
1064   //
1065   slope = -slope; 
1066   //
1067   p[0]=intp*slope/b;
1068   p[1]=-intp/b;
1069   //
1070   n[0]=-p[0];
1071   n[1]=-p[1];
1072   norm=TMath::Sqrt(n[0]*n[0]+n[1]*n[1]);
1073   n[0] /= norm;
1074   n[1] /=norm;
1075   //
1076   new TGeoHalfSpace("sp2",p,n);
1077   // holes for rods
1078  //holes
1079  new TGeoTube("h1",0.,0.5,0.025);
1080  new TGeoTube("h2",0.,0.35,0.025);
1081  //translations:
1082  TGeoTranslation *ttr11 = new TGeoTranslation("ttr11",-0.866,0.5,0.);
1083  TGeoTranslation *ttr22 = new TGeoTranslation("ttr22",0.866,0.5,0.);
1084  ttr11->RegisterYourself();
1085  ttr22->RegisterYourself();
1086  // elastic connector
1087  new TGeoBBox("elcon",0.72,0.005,0.3);
1088  TGeoRotation *crr1 = new TGeoRotation();
1089  crr1->RotateZ(-22.);
1090 TGeoCombiTrans *ctr1 = new TGeoCombiTrans("ctr1",-0.36011, -1.09951,-0.325,crr1);
1091 ctr1->RegisterYourself();
1092  TGeoCompositeShape *cs1 = new TGeoCompositeShape("cs1",
1093 "(((((tub-h1:ttr11)-h1:ttr22)-sp1)-sp2)-h2)+elcon:ctr1");
1094  //
1095  TGeoVolume *csvv = new TGeoVolume("TPC_RR_CU",cs1,m7);
1096  //
1097  // resistor rod assembly 2 ceramic rods, peak rod, Cu plates
1098  // and resistors
1099  //
1100  TGeoVolumeAssembly *rrod = new TGeoVolumeAssembly("TPC_RRIN");
1101  // rods
1102  rrod->AddNode(crv,1,ttr11);
1103  rrod->AddNode(crv,2,ttr22); 
1104  rrod->AddNode(prv,1);
1105  //Cu plates
1106  for(Int_t i=0;i<165;i++){
1107    rrod->AddNode(csvv,i+1,new TGeoTranslation(0.,0.,-122.675+i*1.5));
1108  }
1109  //resistors
1110  TGeoTube *res = new TGeoTube(0.,0.15,0.5);
1111  TGeoVolume *resv = new TGeoVolume("TPC_RES",res,m10);
1112  TGeoVolumeAssembly *ress = new TGeoVolumeAssembly("TPC_RES_CH");
1113  ress->AddNode(resv,1,new TGeoTranslation(0.2,0.,0.));
1114  ress->AddNode(resv,2,new TGeoTranslation(-0.2,0.,0.));
1115  //
1116  TGeoRotation *crr2 = new TGeoRotation();
1117  crr2->RotateY(30.);
1118  TGeoRotation *crr3 = new TGeoRotation();
1119  crr3->RotateY(-30.); 
1120  //
1121  for(Int_t i=0;i<164;i+=2){
1122    rrod->AddNode(ress,i+1, new TGeoCombiTrans(0.,1.2,-121.925+i*1.5,crr2));
1123    rrod->AddNode(ress,i+2, new TGeoCombiTrans(0.,1.2,-121.925+(i+1)*1.5,crr3));
1124  }
1125
1126  tpcrrod->AddNode(rrod,1,new TGeoCombiTrans(0.,0.,0.5,crr1));
1127  //
1128  // rod left head with holders - inner
1129  //
1130  // first element - support for inner holder  TPC_IHS
1131  Double_t shift1[3] = {0.0,-0.175,0.0};
1132
1133 new TGeoBBox("tpcihs1", 4.7, 0.66, 2.35);               
1134 new TGeoBBox("tpcihs2", 4.7, 0.485, 1.0, shift1);
1135 new TGeoBBox("tpcihs3", 1.5, 0.485, 2.35, shift1);
1136 new TGeoTube("tpcihs4", 0.0, 2.38, 0.1);
1137 //
1138 Double_t pointstrap[16];    
1139 pointstrap[0]= 0.0;
1140 pointstrap[1]= 0.0;
1141 pointstrap[2]= 0.0;
1142 pointstrap[3]= 1.08;
1143 pointstrap[4]= 2.3;
1144 pointstrap[5]= 1.08;
1145 pointstrap[6]= 3.38;
1146 pointstrap[7]= 0.0;
1147 pointstrap[8]= 0.0;
1148 pointstrap[9]= 0.0;
1149 pointstrap[10]= 0.0;
1150 pointstrap[11]= 1.08;
1151 pointstrap[12]= 2.3;
1152 pointstrap[13]= 1.08;
1153 pointstrap[14]= 3.38;
1154 pointstrap[15]= 0.0;
1155 //
1156 TGeoArb8 *tpcihs5 = new TGeoArb8("tpcihs5", 0.6, pointstrap);
1157 //
1158 //  half space - cutting "legs"
1159 // 
1160  p[0]=0.0;
1161  p[1]=0.105;
1162  p[2]=0.0;
1163  //       
1164 n[0] = 0.0;
1165 n[1] = 1.0;
1166 n[2] = 0.0;
1167
1168 new TGeoHalfSpace("cutil1", p, n);
1169
1170 //
1171 // transformations
1172 //
1173 TGeoTranslation *trans2 = new TGeoTranslation("trans2", 0.0, 2.84, 2.25);
1174 trans2->RegisterYourself();
1175 TGeoTranslation*trans3= new TGeoTranslation("trans3", 0.0, 2.84, -2.25);
1176 trans3->RegisterYourself();
1177 //support - composite volume
1178 //
1179 TGeoCompositeShape *tpcihs6 = new TGeoCompositeShape("tpcihs6", "tpcihs1-(tpcihs2+tpcihs3)-(tpcihs4:trans2)-(tpcihs4:trans3)-cutil1");
1180 //
1181 // volumes - all makrolon
1182 //  
1183  TGeoVolume *tpcihss = new TGeoVolume("TPC_IHSS", tpcihs6, m6); //support
1184  TGeoVolume *tpcihst = new TGeoVolume("TPC_IHSTR",tpcihs5 , m6); //trapesoid
1185  //now assembly
1186 TGeoRotation *rot111 = new TGeoRotation(); 
1187 rot111->RotateY(180.0);
1188 //
1189 TGeoVolumeAssembly *tpcihs = new TGeoVolumeAssembly("TPC_IHS");    // assembly of the support
1190 tpcihs->AddNode(tpcihss, 1);
1191 tpcihs->AddNode(tpcihst, 1, new TGeoTranslation(-4.7, 0.66, 0.0));
1192 tpcihs->AddNode(tpcihst, 2, new TGeoCombiTrans(4.7, 0.66, 0.0, rot111));
1193 //
1194 // two rod holders (TPC_IRH) assembled with the support
1195 //
1196 new TGeoBBox("tpcirh1", 4.7, 1.33, 0.5);
1197  shift1[0]=-3.65;
1198  shift1[1]=0.53;
1199  shift1[2]=0.;
1200 new TGeoBBox("tpcirh2", 1.05, 0.8, 0.5, shift1);
1201  shift1[0]=3.65;
1202  shift1[1]=0.53;
1203  shift1[2]=0.;
1204 new TGeoBBox("tpcirh3", 1.05, 0.8, 0.5, shift1);
1205  shift1[0]=0.0;
1206  shift1[1]=1.08;
1207  shift1[2]=0.;
1208 new TGeoBBox("tpcirh4", 1.9, 0.25, 0.5, shift1);
1209 new TGeoTube("tpcirh5", 0, 1.9, 5);
1210 //
1211 TGeoTranslation *trans4 = new TGeoTranslation("trans4", 0, 0.83, 0.0); 
1212 trans4->RegisterYourself();
1213 //
1214 TGeoCompositeShape *tpcirh6 = new TGeoCompositeShape("tpcirh6", "tpcirh1-tpcirh2-tpcirh3-(tpcirh5:trans4)-tpcirh4");
1215 //
1216 // now volume
1217 //
1218 TGeoVolume *tpcirh = new TGeoVolume("TPC_IRH", tpcirh6, m6);   
1219 //
1220 // and all together...
1221 //
1222 TGeoVolume *tpciclamp = new TGeoVolumeAssembly("TPC_ICLP");
1223 tpciclamp->AddNode(tpcihs, 1);
1224 tpciclamp->AddNode(tpcirh, 1, new TGeoTranslation(0, 1.99, 1.1));
1225 tpciclamp->AddNode(tpcirh, 2, new TGeoTranslation(0, 1.99, -1.1));
1226 //
1227 // and now left inner "head"
1228 //
1229 TGeoPcon *inplug = new TGeoPcon("inplug", 0.0, 360.0, 14); 
1230
1231 inplug->DefineSection(0, 0.3, 0.0, 2.2);
1232 inplug->DefineSection(1, 0.6, 0.0, 2.2);
1233
1234 inplug->DefineSection(2, 0.6, 0.0, 1.75);
1235 inplug->DefineSection(3, 0.7, 0.0, 1.75);
1236
1237 inplug->DefineSection(4, 0.7, 1.55, 1.75);
1238 inplug->DefineSection(5, 1.6, 1.55, 1.75);
1239
1240 inplug->DefineSection(6, 1.6, 1.55, 2.2);
1241 inplug->DefineSection(7, 1.875, 1.55, 2.2);
1242
1243 inplug->DefineSection(8, 1.875, 1.55, 2.2);
1244 inplug->DefineSection(9, 2.47, 1.75, 2.2);
1245
1246 inplug->DefineSection(10, 2.47, 1.75, 2.08);
1247 inplug->DefineSection(11, 2.57, 1.8, 2.08);
1248
1249 inplug->DefineSection(12, 2.57, 1.92, 2.08);
1250 inplug->DefineSection(13, 2.95, 1.92, 2.08);
1251 //
1252  shift1[0]=0.0;
1253  shift1[1]=-2.09;
1254  shift1[2]=1.075;
1255  //
1256 new TGeoBBox("pcuti", 1.5, 0.11, 1.075, shift1);
1257 //
1258 TGeoCompositeShape *inplleft = new TGeoCompositeShape("inplleft", "inplug-pcuti");
1259 TGeoVolume *tpcinlplug = new TGeoVolume("TPC_INPLL", inplleft, m6);   
1260 //
1261 //  holder + plugs
1262 //
1263  TGeoVolume *tpcihpl = new TGeoVolumeAssembly("TPC_IHPL"); //holder+2 plugs (reflected)
1264  tpcihpl->AddNode(tpcinlplug, 1);
1265  tpcihpl->AddNode(tpcinlplug, 2,ref);
1266  tpcihpl->AddNode(tpciclamp,1,new TGeoTranslation(0.0, -2.765, 0.0)); 
1267  //
1268  // outer holders and clamps
1269  //
1270
1271  // outer membrane holder (between rods)  
1272 pointstrap[0]= 0.0;
1273 pointstrap[1]= 0.0;
1274 pointstrap[2]= 0.0;
1275 pointstrap[3]= 2.8;
1276 pointstrap[4]= 3.1;
1277 pointstrap[5]= 2.8-3.1*TMath::Tan(15.*TMath::DegToRad());
1278 pointstrap[6]= 3.1;
1279 pointstrap[7]= 0.0;
1280 pointstrap[8]= 0.0;
1281 pointstrap[9]= 0.0;
1282 pointstrap[10]= 0.0;
1283 pointstrap[11]= 2.8;
1284 pointstrap[12]= 3.1;
1285 pointstrap[13]= 2.8-3.1*TMath::Tan(15.*TMath::DegToRad());
1286 pointstrap[14]= 3.1;
1287 pointstrap[15]= 0.0;
1288 //
1289 TGeoArb8 *tpcomh1 = new TGeoArb8("tpcomh1", 1.05, pointstrap);   
1290 TGeoBBox *tpcomh2 = new TGeoBBox("tpcomh2", 0.8, 1.4, 6);
1291 //
1292 TGeoVolume *tpcomh1v = new TGeoVolume("TPC_OMH1", tpcomh1, m7);    
1293 TGeoVolume *tpcomh2v = new TGeoVolume("TPC_OMH2", tpcomh2, m7);
1294 //
1295 TGeoVolume *tpcomh3v = new TGeoVolumeAssembly("TPC_OMH3");    // assembly1
1296 tpcomh3v->AddNode(tpcomh1v, 1, new TGeoTranslation(0.8, -1.4, 4.95));
1297  tpcomh3v->AddNode(tpcomh1v, 2, new TGeoTranslation(0.8, -1.4, -4.95));
1298 tpcomh3v->AddNode(tpcomh2v, 1);
1299 //
1300 shift1[0] = 0.9;
1301 shift1[1] = -1.85;
1302 shift1[2] = 0.0;
1303 //
1304 new TGeoBBox("tpcomh3", 1.65, 1.15, 3.4);
1305 TGeoBBox *tpcomh4 = new TGeoBBox("tpcomh4", 0.75, 0.7, 3.4, shift1);
1306 //
1307 // halfspace 1
1308 //
1309 p[0] = 0.0;
1310 p[1] = -1.05;   
1311 p[2] = -3.4;
1312 //
1313 n[0] = 0.0;
1314 n[1] = -1.0*TMath::Tan(30.*TMath::DegToRad());
1315 n[2] = 1.0;
1316 //
1317 new TGeoHalfSpace("cutomh1", p, n); 
1318 //
1319 // halfspace 2
1320 //
1321 p[0] = 0.0;
1322 p[1] = -1.05;   
1323 p[2] = 3.4;
1324 //
1325 n[0] = 0.0;
1326 n[1] = -1.0*TMath::Tan(30.*TMath::DegToRad());
1327 n[2] = -1.0;
1328 //
1329 new TGeoHalfSpace("cutomh2", p, n);
1330 //
1331 // halfspace 3
1332 //
1333 p[0] = -1.65;
1334 p[1] = 0.0;     
1335 p[2] = -0.9;
1336 //
1337 n[0] = 1.0*TMath::Tan(75.*TMath::DegToRad());
1338 n[1] = 0.0;
1339 n[2] = 1.0;
1340 //
1341 new TGeoHalfSpace("cutomh3", p, n);   
1342 //
1343 // halfspace 4
1344 //
1345 p[0] = -1.65;
1346 p[1] = 0.0;      
1347 p[2] = 0.9;
1348 //
1349 n[0] = 1.0*TMath::Tan(75*TMath::DegToRad());
1350 n[1] = 0.0;
1351 n[2] = -1.0;
1352 //
1353 new TGeoHalfSpace("cutomh4", p, n); 
1354 //
1355 // halsfspace 5
1356 //
1357 p[0] = 1.65;
1358 p[1] = -1.05;      
1359 p[2] = 0.0;  
1360 //
1361 n[0] = -1.0;
1362 n[1] = -1.0*TMath::Tan(20.*TMath::DegToRad());
1363 n[2] = 0.0;
1364 //
1365 new TGeoHalfSpace("cutomh5", p, n); 
1366 //  
1367 TGeoCompositeShape *tpcomh5 = new TGeoCompositeShape("tpcomh5", "tpcomh3-cutomh1-cutomh2-cutomh3-cutomh4-cutomh5"); 
1368 //
1369  TGeoVolume *tpcomh5v = new TGeoVolume("TPC_OMH5",tpcomh5,m6);
1370  TGeoVolume *tpcomh4v = new TGeoVolume("TPC_OMH6",tpcomh4,m6);
1371  //
1372  TGeoVolumeAssembly *tpcomh7v = new TGeoVolumeAssembly("TPC_OMH7");
1373  tpcomh7v->AddNode(tpcomh5v,1);
1374  tpcomh7v->AddNode(tpcomh4v,1);
1375  //
1376  // full membrane holder - tpcomh3v + tpcomh7v
1377  //
1378  TGeoVolumeAssembly *tpcomh = new TGeoVolumeAssembly("TPC_OMH");
1379  tpcomh->AddNode(tpcomh3v,1,new TGeoTranslation(1.5,0.,0.));
1380  tpcomh->AddNode(tpcomh3v,2,new TGeoCombiTrans(-1.5,0.,0.,rot111));
1381  tpcomh->AddNode(tpcomh7v,1,new TGeoTranslation(0.65+1.5, 2.55, 0.0));
1382  tpcomh->AddNode(tpcomh7v,2,new TGeoCombiTrans(-0.65-1.5, 2.55, 0.0,rot111)); 
1383  //
1384  //  outer rod holder support
1385  //
1386 new TGeoBBox("tpcohs1", 3.8, 0.675, 2.35); 
1387 //
1388 shift1[0] = 0.0;
1389 shift1[1] = 0.175;
1390 shift1[2] = 0.0;
1391 //
1392 new TGeoBBox("tpcohs2", 1.5, 0.5, 2.35, shift1);
1393 new TGeoBBox("tpcohs3", 3.8, 0.5, 0.85, shift1);
1394 //
1395 shift1[0] = 0.0;
1396 shift1[1] = -1.175;
1397 shift1[2] = 0.0;
1398 //
1399 TGeoBBox *tpcohs4 = new TGeoBBox("tpsohs4", 3.1, 0.5, 0.7, shift1);
1400 //
1401 TGeoVolume *tpcohs4v = new TGeoVolume("TPC_OHS4", tpcohs4, m6);
1402 //
1403 p[0] = 0.0;
1404 p[1] = -0.186;   
1405 p[2] = 0.0;
1406 //
1407 n[0] = 0.0;
1408 n[1] = -1.0;
1409 n[2] = 0.0;
1410 //
1411 new TGeoHalfSpace("cutohs1", p, n);
1412 //
1413 TGeoCompositeShape *tpcohs5 = new TGeoCompositeShape("tpcohs5", "tpcohs1-tpcohs2-tpcohs3-cutohs1"); 
1414 TGeoVolume *tpcohs5v = new TGeoVolume("TPC_OHS5", tpcohs5, m6); 
1415 //
1416 TGeoVolumeAssembly *tpcohs = new TGeoVolumeAssembly("TPC_OHS");    
1417 tpcohs->AddNode(tpcohs5v, 1);
1418 tpcohs->AddNode(tpcohs4v, 1); 
1419 //
1420 // outer rod holder itself
1421 //
1422 shift1[0] = 0.0;
1423 shift1[1] = 1.325;
1424 shift1[2] = 0.0;
1425  new TGeoBBox("tpcorh1", 3.1, 1.825, 0.55); //from this box we cut pieces...
1426  //
1427 shift1[0] = -3.1;       
1428 shift1[1] = -0.5;       
1429 shift1[2] = 0.0;
1430 //
1431 new TGeoBBox("tpcorh2", 0.5, 2.75, 1.1, shift1);
1432 //
1433 shift1[0] = 3.1;        
1434 shift1[1] = -0.5;       
1435 shift1[2] = 0.0;
1436 //
1437 new TGeoBBox("tpcorh3", 0.5, 2.75, 1.1, shift1);
1438 //
1439 shift1[0] = 0.0;
1440 shift1[1] = -0.5;       
1441 shift1[2] = -0.95;
1442 //
1443 new TGeoBBox("tpcorh4", 3.9, 2.75, 0.5, shift1);
1444 //
1445 shift1[0] = 0.0;
1446 shift1[1] = -0.5;
1447 shift1[2] = 0.0;
1448 //
1449 new TGeoBBox("tpcorh5", 1.95, 0.5, 1.1, shift1);
1450 //
1451 shift1[0] = 0.0;
1452 shift1[1] = -0.5;
1453 shift1[2] = 0.55;
1454 //
1455 new TGeoBBox("tpcorh6", 2.4, 0.5, 0.6, shift1);
1456 //
1457 new TGeoTube("tpcorh7", 0, 1.95, 0.85);
1458 new TGeoTube("tpcorh8", 0, 2.4, 0.6);
1459 //
1460 TGeoTranslation *trans33 = new TGeoTranslation("trans33", 0.0, 0.0, 0.55); 
1461 trans33->RegisterYourself();
1462 //
1463 TGeoCompositeShape *tpcorh9 = new TGeoCompositeShape("tpcorh9", "tpcorh1-tpcorh2-tpcorh3-tpcorh4-tpcorh5-tpcorh6-(tpcorh8:trans33)-tpcorh7");
1464 //
1465  TGeoVolume *tpcorh9v = new TGeoVolume("TPC_ORH",tpcorh9,m6); //outer rod holder 
1466  //
1467  // now 2 holders together
1468  //
1469  TGeoVolumeAssembly *tpcorh = new TGeoVolumeAssembly("TPC_ORH2");
1470  //
1471  tpcorh->AddNode(tpcorh9v,1,new TGeoTranslation(0.0, 0.0, 1.25));
1472  tpcorh->AddNode(tpcorh9v,2,new TGeoCombiTrans(0.0, 0.0, -1.25,rot111));
1473 //
1474 // outer rod plug left
1475 //
1476 TGeoPcon *outplug = new TGeoPcon("outplug", 0.0, 360.0, 14); 
1477
1478 outplug->DefineSection(0, 0.5, 0.0, 2.2);
1479 outplug->DefineSection(1, 0.7, 0.0, 2.2);
1480
1481 outplug->DefineSection(2, 0.7, 1.55, 2.2);
1482 outplug->DefineSection(3, 0.8, 1.55, 2.2);
1483
1484 outplug->DefineSection(4, 0.8, 1.55, 1.75);
1485 outplug->DefineSection(5, 1.2, 1.55, 1.75);
1486
1487 outplug->DefineSection(6, 1.2, 1.55, 2.2);
1488 outplug->DefineSection(7, 1.875, 1.55, 2.2);
1489
1490 outplug->DefineSection(8, 1.875, 1.55, 2.2);
1491 outplug->DefineSection(9, 2.47, 1.75, 2.2);
1492
1493 outplug->DefineSection(10, 2.47, 1.75, 2.08);
1494 outplug->DefineSection(11, 2.57, 1.8, 2.08);
1495
1496 outplug->DefineSection(12, 2.57, 1.92, 2.08);
1497 outplug->DefineSection(13, 2.95, 1.92, 2.08);
1498 //
1499 shift1[0] = 0.0;
1500 shift1[1] = 2.09;
1501 shift1[2] = 1.01;
1502
1503 new TGeoBBox("cutout", 2.5, 0.11, 1.01, shift1);
1504 //
1505
1506 TGeoCompositeShape *outplleft = new TGeoCompositeShape("outplleft", "outplug-cutout");    
1507 TGeoVolume *outplleftv = new TGeoVolume("TPC_OPLL", outplleft, m6); 
1508 //
1509 //  support + holder + plug
1510 //
1511
1512  
1513  TGeoVolumeAssembly *tpcohpl = new TGeoVolumeAssembly("TPC_OHPL"); 
1514  //
1515  tpcohpl->AddNode(outplleftv,1); //plug
1516  tpcohpl->AddNode(outplleftv,2,ref); //plug reflected
1517  tpcohpl->AddNode(tpcorh,1); //rod holder
1518  tpcohpl->AddNode(tpcohs,1,new TGeoTranslation(0.0, 3.925, 0)); // support
1519  //
1520
1521  //
1522  // main membrane holder
1523  //           
1524 pointstrap[0]= 0.0;
1525 pointstrap[1]= 0.0;
1526 pointstrap[2]= 0.0;
1527 pointstrap[3]= 2.8;
1528 pointstrap[4]= 3.1;
1529 pointstrap[5]= 1.96;
1530 pointstrap[6]= 3.1;
1531 pointstrap[7]= 0.0;
1532 pointstrap[8]= 0.0;
1533 pointstrap[9]= 0.0;
1534 pointstrap[10]= 0.0;
1535 pointstrap[11]= 2.8;
1536 pointstrap[12]= 3.1;
1537 pointstrap[13]= 1.96;
1538 pointstrap[14]= 3.1;
1539 pointstrap[15]= 0.0; 
1540 //
1541 TGeoArb8 *tpcmmh1 = new TGeoArb8("tpcmmh1", 1.75, pointstrap);
1542 TGeoBBox *tpcmmh2 = new TGeoBBox("tpcmmh2", 0.8, 1.4, 12.5); 
1543 //
1544 TGeoVolume *tpcmmh1v = new TGeoVolume("TPC_MMH1", tpcmmh1, m6);   
1545 TGeoVolume *tpcmmh2v = new TGeoVolume("TPC_MMH2", tpcmmh2, m6);
1546 //
1547  TGeoVolumeAssembly *tpcmmhs = new TGeoVolumeAssembly("TPC_MMHS");
1548  tpcmmhs->AddNode(tpcmmh1v,1,new TGeoTranslation(0.8, -1.4, 10.75));
1549  tpcmmhs->AddNode(tpcmmh1v,2,new TGeoTranslation(0.8, -1.4, -10.75));
1550  tpcmmhs->AddNode(tpcmmh2v,1);
1551  //
1552  // main membrahe holder clamp
1553  //
1554 shift1[0] = -0.75;
1555 shift1[1] = -1.15;
1556 shift1[2] = 0.0;
1557 //
1558 new TGeoBBox("tpcmmhc1", 1.65, 1.85, 8.9); 
1559 new TGeoBBox("tpcmmhc2", 0.9, 0.7, 8.9, shift1);
1560 //
1561 // half spaces  - cuts
1562 //
1563 p[0] = -1.65;
1564 p[1] = 0.0;   
1565 p[2] = -0.9;
1566 //
1567 n[0] = 8.0;
1568 n[1] = 0.0;
1569 n[2] = 8.0*TMath::Tan(13.*TMath::DegToRad());
1570 //
1571 new TGeoHalfSpace("cutmmh1", p, n);
1572 //
1573 p[0] = -1.65;
1574 p[1] = 0.0;   
1575 p[2] = 0.9;
1576 //
1577 n[0] = 8.0;
1578 n[1] = 0.0;
1579 n[2] = -8.0*TMath::Tan(13.*TMath::DegToRad());
1580 //
1581 new TGeoHalfSpace("cutmmh2", p, n);
1582 //
1583 p[0] = 0.0;
1584 p[1] = 1.85;   
1585 p[2] = -2.8;
1586 //
1587 n[0] = 0.0;
1588 n[1] = -6.1;
1589 n[2] = 6.1*TMath::Tan(20.*TMath::DegToRad());
1590 //
1591 new TGeoHalfSpace("cutmmh3", p, n);
1592 //
1593 p[0] = 0.0;
1594 p[1] = 1.85;      
1595 p[2] = 2.8;
1596 //
1597 n[0] = 0.0;
1598 n[1] = -6.1;
1599 n[2] = -6.1*TMath::Tan(20*TMath::DegToRad());
1600 //
1601 new TGeoHalfSpace("cutmmh4", p, n);
1602 //
1603 p[0] = 0.75;
1604 p[1] = 0.0; 
1605 p[2] = -8.9;
1606 //
1607 n[0] = 2.4*TMath::Tan(30*TMath::DegToRad());
1608 n[1] = 0.0;
1609 n[2] = 2.4;
1610 //
1611  new TGeoHalfSpace("cutmmh5", p, n);
1612 //
1613 p[0] = 0.75;
1614 p[1] = 0.0;
1615 p[2] = 8.9;
1616 //
1617 n[0] = 2.4*TMath::Tan(30*TMath::DegToRad());
1618 n[1] = 0.0;
1619 n[2] = -2.4;
1620 //
1621 new TGeoHalfSpace("cutmmh6", p, n);
1622
1623 TGeoCompositeShape *tpcmmhc = new TGeoCompositeShape("TPC_MMHC", "tpcmmhc1-tpcmmhc2-cutmmh1-cutmmh2-cutmmh3-cutmmh4-cutmmh5-cutmmh6"); 
1624
1625  TGeoVolume *tpcmmhcv = new TGeoVolume("TPC_MMHC",tpcmmhc,m6);
1626  //
1627 TGeoVolume *tpcmmh = new TGeoVolumeAssembly("TPC_MMH");
1628 //
1629  tpcmmh->AddNode(tpcmmhcv,1,new TGeoTranslation(0.65+1.5, 1.85, 0.0));
1630  tpcmmh->AddNode(tpcmmhcv,2,new TGeoCombiTrans(-0.65-1.5, 1.85, 0.0,rot111));
1631  tpcmmh->AddNode(tpcmmhs,1,new TGeoTranslation(1.5, 0.0, 0.0));
1632  tpcmmh->AddNode(tpcmmhs,2,new TGeoCombiTrans(-1.5, 0.0, 0.0,rot111));
1633  //
1634  
1635  //
1636
1637 //--------------------------------------------
1638  //
1639  // guard ring resistor chain
1640  //
1641
1642  TGeoTube *gres1 = new TGeoTube(0.,0.375,125.);// inside ifc
1643  //
1644  TGeoVolume *vgres1 = new TGeoVolume("TPC_GRES1",gres1,m10);
1645
1646  //
1647  Double_t xrc,yrc;
1648  //
1649  xrc=79.3*TMath::Cos(350.*TMath::DegToRad());
1650  yrc=79.3*TMath::Sin(350.*TMath::DegToRad());
1651  //
1652  v9->AddNode(vgres1,1,new TGeoTranslation(xrc,yrc,126.9));
1653  v9->AddNode(vgres1,2,new TGeoTranslation(xrc,yrc,-126.9));
1654  //
1655  xrc=79.3*TMath::Cos(190.*TMath::DegToRad());
1656  yrc=79.3*TMath::Sin(190.*TMath::DegToRad()); 
1657  //
1658  v9->AddNode(vgres1,3,new TGeoTranslation(xrc,yrc,126.9));
1659  v9->AddNode(vgres1,4,new TGeoTranslation(xrc,yrc,-126.9));
1660  //------------------------------------------------------------------
1661  TGeoRotation refl("refl",90.,0.,90.,90.,180.,0.);
1662  TGeoRotation rotrod("rotrod");
1663  //
1664  TGeoRotation *rotpos[2]; 
1665  //
1666  TGeoRotation *rotrod1[2]; 
1667
1668   
1669  //v9 - drift gas
1670
1671     TGeoRotation rot102("rot102");
1672     rot102.RotateY(-90.);
1673
1674   for(Int_t i=0;i<18;i++){
1675     Double_t angle,x,y;
1676     Double_t z,r; 
1677     angle=TMath::DegToRad()*20.*(Double_t)i;
1678     //inner rods
1679     r=81.5;
1680     x=r * TMath::Cos(angle);
1681     y=r * TMath::Sin(angle);
1682     z = 126.;
1683     TGeoRotation *rot12 = new TGeoRotation();
1684     rot12->RotateZ(-90.0+i*20.);
1685     v9->AddNode(tpcihpl,i+1,new TGeoCombiTrans(x, y, 0., rot12));
1686     //
1687     if(i==11){//resistor rod inner
1688        rotrod.RotateZ(-90.+angle);
1689        rotrod1[0]= new TGeoRotation();
1690        rotpos[0]= new TGeoRotation();
1691        //
1692        rotrod1[0]->RotateZ(-90.+angle);
1693        *rotpos[0] = refl*rotrod; //rotation+reflection
1694         v9->AddNode(tpcrrod,1,new TGeoCombiTrans(x,y, z, rotrod1[0])); //A
1695         v9->AddNode(tpcrrod,2,new TGeoCombiTrans(x,y,-z, rotpos[0])); //C      
1696     } 
1697     else { 
1698       v9->AddNode(tpcmrod,i+1,new TGeoTranslation(x,y,z));//shaft
1699       v9->AddNode(tpcmrod,i+19,new TGeoCombiTrans(x,y,-z,ref));//muon
1700     }
1701     // outer rods
1702     r=254.25;
1703     x=r * TMath::Cos(angle);
1704     y=r * TMath::Sin(angle);
1705     z=126.;
1706     //
1707     // outer rod holder + outer left plug
1708     //
1709     TGeoRotation *rot33 = new TGeoRotation();
1710     rot33->RotateZ(-90+i*20.);
1711     //
1712     v9->AddNode(tpcohpl,i+1,new TGeoCombiTrans(x, y, 0., rot33));
1713     //
1714     Double_t xxx = 256.297*TMath::Cos((i*20.+10.)*TMath::DegToRad());
1715     Double_t yyy = 256.297*TMath::Sin((i*20.+10.)*TMath::DegToRad());
1716     //
1717     TGeoRotation rot101("rot101");
1718     rot101.RotateZ(90.+i*20.+10.);
1719     TGeoRotation *rot103 = new TGeoRotation("rot103");
1720     *rot103 = rot101*rot102;
1721     //
1722     TGeoCombiTrans *trh100 = new TGeoCombiTrans(xxx,yyy,0.,rot103);
1723     //
1724     if(i==2) {
1725       //main membrane holder
1726       v9->AddNode(tpcmmh,1,trh100);
1727     }
1728     else{
1729       // "normal" membrane holder
1730       v9->AddNode(tpcomh,i+1,trh100);      
1731     }
1732
1733     //
1734     if(i==3){//resistor rod outer
1735       rotrod.RotateZ(90.+angle);
1736       rotrod1[1]= new TGeoRotation();
1737       rotpos[1]= new TGeoRotation();
1738       rotrod1[1]->RotateZ(90.+angle);
1739       *rotpos[1] = refl*rotrod;//rotation+reflection
1740       v9->AddNode(tpcrrod,3,new TGeoCombiTrans(x,y, z, rotrod1[1])); //A 
1741       v9->AddNode(tpcrrod,4,new TGeoCombiTrans(x,y, -z, rotpos[1])); //C
1742     }
1743     else {
1744       v9->AddNode(tpcmrod,i+37,new TGeoTranslation(x,y,z));//shaft
1745       v9->AddNode(tpcmrod,i+55,new TGeoCombiTrans(x,y,-z,ref));//muon      
1746     }
1747     if(i==15){
1748       v9->AddNode(hvrv,1,new TGeoTranslation(x,y,z+0.7)); //hv->A-side only      
1749
1750
1751     }
1752   } //end of rods positioning
1753
1754   TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
1755   alice->AddNode(v1,1);
1756   
1757
1758 } // end of function
1759
1760
1761
1762 //_____________________________________________________________________________
1763 void AliTPCv0::CreateMaterials()
1764 {
1765   //
1766   // Define materials for the TPC
1767   //
1768   AliTPC::CreateMaterials();
1769 }
1770
1771
1772 //_____________________________________________________________________________
1773 void AliTPCv0::Init()
1774 {
1775   //
1776   // Initialise Time Projection Chamber version 0
1777   //
1778  
1779   printf("%s: *** TPC version 0 initialized***\n",ClassName()); 
1780
1781   //  printf("TPC version 0 initialized\n");
1782 }
1783
1784 //_____________________________________________________________________________
1785 void AliTPCv0::StepManager()
1786 {
1787   //
1788   // Procedure called at each step in the TPC
1789   //
1790 }