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