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