]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCv4.cxx
In AddTaskPHOSPi0Flow.C set Cent. Bin past event buffers/lists,
[u/mrichter/AliRoot.git] / TPC / 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"
57
a11596ad 58using std::ifstream;
59using std::ios_base;
457e2170 60ClassImp(AliTPCv4)
61
62//_____________________________________________________________________________
63AliTPCv4::AliTPCv4(const char *name, const char *title) :
64 AliTPC(name, title),
65 fIdSens(0),
66 fIDrift(0),
67 fSecOld(0)
68{
69 //
70 // Standard constructor for Time Projection Chamber version 2
71 //
72
73
74 SetBufferSize(128000);
75
76
77 if (fTPCParam)
78 fTPCParam->Write(fTPCParam->GetTitle());
79}
80
81//_____________________________________________________________________________
82void AliTPCv4::CreateGeometry()
83{
84 //
85 // Create the geometry of Time Projection Chamber version 2
86 //
87 //Begin_Html
88 /*
89 <img src="picts/AliTPC.gif">
90 */
91 //End_Html
92 //Begin_Html
93 /*
94 <img src="picts/AliTPCv2Tree.gif">
95 */
96 //End_Html
97
98 //----------------------------------------------------------
99 // This geometry is written using TGeo class
100 // Firstly the shapes are defined, and only then the volumes
101 // What is recognized by the MC are volumes
102 //----------------------------------------------------------
103 //
104 // tpc - this will be the mother volume
105 //
106
107 //
108 // here I define a volume TPC
109 // retrive the medium name with "TPC_" as a leading string
110 //
8ad31ee5 111 TGeoPcon *tpc = new TGeoPcon(0.,360.,30); //30 sections
457e2170 112 //
8ad31ee5 113 tpc->DefineSection(0,-289.6,77.,278.);
114 tpc->DefineSection(1,-262.1,77.,278.);
457e2170 115 //
8ad31ee5 116 tpc->DefineSection(2,-262.1,83.1,278.);
117 tpc->DefineSection(3,-260.,83.1,278.);
457e2170 118 //
8ad31ee5 119 tpc->DefineSection(4,-260.,70.,278.);
120 tpc->DefineSection(5,-259.6,70.,278.);
457e2170 121 //
8ad31ee5 122 tpc->DefineSection(6,-259.6,68.1,278.);
123 tpc->DefineSection(7,-253.6,68.1,278.);
457e2170 124 //
c5d5037c 125 tpc->DefineSection(8,-253.6,67.88,278.);//hs
126 tpc->DefineSection(9,-74.0,60.68,278.);// hs
457e2170 127 //
8ad31ee5 128 tpc->DefineSection(10,-74.0,60.1,278.);
129 tpc->DefineSection(11,-73.3,60.1,278.);
457e2170 130 //
8ad31ee5 131 tpc->DefineSection(12,-73.3,56.9,278.);
132 tpc->DefineSection(13,-68.5,56.9,278.);
457e2170 133 //
8ad31ee5 134 tpc->DefineSection(14,-68.5,60.,278.);
135 tpc->DefineSection(15,-64.7,60.,278.);
78134e48 136 //
8ad31ee5 137 tpc->DefineSection(16,-64.7,56.9,278.);
138 tpc->DefineSection(17,73.3,56.9,278.);
78134e48 139 //
8ad31ee5 140 tpc->DefineSection(18,73.3,60.1,278.);
141 tpc->DefineSection(19,74.0,60.1,278.);
4fb9bd37 142 //
c5d5037c 143 tpc->DefineSection(20,74.0,60.68,278.);// hs
144 tpc->DefineSection(21,253.6,65.38,278.);// hs
4fb9bd37 145 //
8ad31ee5 146 tpc->DefineSection(22,253.6,65.6,278.);
147 tpc->DefineSection(23,259.6,65.6,278.);
4fb9bd37 148 //
8ad31ee5 149 tpc->DefineSection(24,259.6,70.0,278.);
150 tpc->DefineSection(25,260.,70.0,278.);
151 //
152 tpc->DefineSection(26,260.,83.1,278.);
153 tpc->DefineSection(27,262.1,83.1,278.);
154 //
155 tpc->DefineSection(28,262.1,77.,278);
156 tpc->DefineSection(29,289.6,77.,278.);
157
457e2170 158 //
159 TGeoMedium *m1 = gGeoManager->GetMedium("TPC_Air");
160 TGeoVolume *v1 = new TGeoVolume("TPC_M",tpc,m1);
161 //
162 // drift volume - sensitive volume, extended beyond the
163 // endcaps, because of the alignment
164 //
165 TGeoPcon *dvol = new TGeoPcon(0.,360.,6);
166 dvol->DefineSection(0,-260.,74.5,264.4);
167 dvol->DefineSection(1,-253.6,74.5,264.4);
168 //
169 dvol->DefineSection(2,-253.6,76.6774,258.);
170 dvol->DefineSection(3,253.6,76.6774,258.);
171 //
172 dvol->DefineSection(4,253.6,74.5,264.4);
173 dvol->DefineSection(5,260.,74.5,264.4);
174 //
a964d561 175 TGeoMedium *m5 = gGeoManager->GetMedium("TPC_DriftGas3");
457e2170 176 TGeoVolume *v9 = new TGeoVolume("TPC_Drift",dvol,m5);
177 //
178 v1->AddNode(v9,1);
179 //
180 // outer insulator
181 //
182 TGeoPcon *tpco = new TGeoPcon(0.,360.,6); //insulator
183 //
184 tpco->DefineSection(0,-256.6,264.8,278.);
185 tpco->DefineSection(1,-253.6,264.8,278.);
186 //
187 tpco->DefineSection(2,-253.6,258.,278.);
188 tpco->DefineSection(3,250.6,258.,278.);
189 //
190 tpco->DefineSection(4,250.6,258.,275.5);
191 tpco->DefineSection(5,253.6,258.,275.5);
192 //
193 TGeoMedium *m2 = gGeoManager->GetMedium("TPC_CO2");
194 TGeoVolume *v2 = new TGeoVolume("TPC_OI",tpco,m2);
195 //
196 // outer containment vessel
197 //
198 TGeoPcon *tocv = new TGeoPcon(0.,360.,6); // containment vessel
199 //
200 tocv->DefineSection(0,-256.6,264.8,278.);
201 tocv->DefineSection(1,-253.6,264.8,278.);
202 //
203 tocv->DefineSection(2,-253.6,274.8124,278.);
204 tocv->DefineSection(3,247.6,274.8124,278.);
205 //
206 tocv->DefineSection(4,247.6,270.4,278.);
207 tocv->DefineSection(5,250.6,270.4,278.);
208 //
209 TGeoMedium *m3 = gGeoManager->GetMedium("TPC_Al");
210 TGeoVolume *v3 = new TGeoVolume("TPC_OCV",tocv,m3);
211 //
212 TGeoTube *to1 = new TGeoTube(274.8174,277.995,252.1); //epoxy
213 TGeoTube *to2 = new TGeoTube(274.8274,277.985,252.1); //tedlar
214 TGeoTube *to3 = new TGeoTube(274.8312,277.9812,252.1);//prepreg2
215 TGeoTube *to4 = new TGeoTube(274.9062,277.9062,252.1);//nomex
216 //
217 TGeoMedium *sm1 = gGeoManager->GetMedium("TPC_Epoxy");
218 TGeoMedium *sm2 = gGeoManager->GetMedium("TPC_Tedlar");
219 TGeoMedium *sm3 = gGeoManager->GetMedium("TPC_Prepreg2");
220 TGeoMedium *sm4 = gGeoManager->GetMedium("TPC_Nomex");
221 //
222 TGeoVolume *tov1 = new TGeoVolume("TPC_OCV1",to1,sm1);
223 TGeoVolume *tov2 = new TGeoVolume("TPC_OCV2",to2,sm2);
224 TGeoVolume *tov3 = new TGeoVolume("TPC_OCV3",to3,sm3);
225 TGeoVolume *tov4 = new TGeoVolume("TPC_OCV4",to4,sm4);
c5d5037c 226 TGeoMedium *mhs = gGeoManager->GetMedium("TPC_Steel");
227 TGeoMedium *m12 = gGeoManager->GetMedium("TPC_Water");
457e2170 228 //-------------------------------------------------------
229 // Tpc Outer Field Cage
230 // daughters - composite (sandwich)
231 //-------------------------------------------------------
232
233 TGeoPcon *tofc = new TGeoPcon(0.,360.,6);
234 //
235 tofc->DefineSection(0,-253.6,258.,269.6);
236 tofc->DefineSection(1,-250.6,258.,269.6);
237 //
238 tofc->DefineSection(2,-250.6,258.,260.0676);
239 tofc->DefineSection(3,250.6,258.,260.0676);
240 //
241 tofc->DefineSection(4,250.6,258.,275.5);
242 tofc->DefineSection(5,253.6,258.,275.5);
243 //
244 TGeoVolume *v4 = new TGeoVolume("TPC_TOFC",tofc,m3);
245 //sandwich
246 TGeoTube *tf1 = new TGeoTube(258.0,260.0676,252.1); //tedlar
247 TGeoTube *tf2 = new TGeoTube(258.0038,260.0638,252.1); //prepreg3
248 TGeoTube *tf3 = new TGeoTube(258.0338,260.0338,252.1);//nomex
249 //
250 TGeoMedium *sm5 = gGeoManager->GetMedium("TPC_Prepreg3");
251 //
252 TGeoVolume *tf1v = new TGeoVolume("TPC_OFC1",tf1,sm2);
253 TGeoVolume *tf2v = new TGeoVolume("TPC_OFC2",tf2,sm5);
254 TGeoVolume *tf3v = new TGeoVolume("TPC_OFC3",tf3,sm4);
255 //
256 // outer part - positioning
257 //
258 tov1->AddNode(tov2,1); tov2->AddNode(tov3,1); tov3->AddNode(tov4,1);
259 //
260 tf1v->AddNode(tf2v,1); tf2v->AddNode(tf3v,1);
261 //
262 v3->AddNode(tov1,1,new TGeoTranslation(0.,0.,-1.5)); v4->AddNode(tf1v,1);
263 //
264 v2->AddNode(v3,1); v2->AddNode(v4,1);
265 //
266 v1->AddNode(v2,1);
267 //--------------------------------------------------------------------
268 // Tpc Inner INsulator (CO2)
269 // the cones, the central drum and the inner f.c. sandwich with a piece
270 // of the flane will be placed in the TPC
271 //--------------------------------------------------------------------
272 TGeoPcon *tpci = new TGeoPcon(0.,360.,4);
273 //
274 tpci->DefineSection(0,-253.6,68.4,76.6774);
275 tpci->DefineSection(1,-74.0,61.2,76.6774);
276 //
277 tpci->DefineSection(2,74.0,61.2,76.6774);
278 //
279 tpci->DefineSection(3,253.6,65.9,76.6774);
280 //
281 TGeoVolume *v5 = new TGeoVolume("TPC_INI",tpci,m2);
282 //
283 // now the inner field cage - only part of flanges (2 copies)
284 //
285 TGeoTube *tif1 = new TGeoTube(69.9,76.6774,1.5);
286 TGeoVolume *v6 = new TGeoVolume("TPC_IFC1",tif1,m3);
287 //
288 //---------------------------------------------------------
289 // Tpc Inner Containment vessel - Muon side
290 //---------------------------------------------------------
291 TGeoPcon *tcms = new TGeoPcon(0.,360.,10);
292 //
293 tcms->DefineSection(0,-259.1,68.1,74.2);
294 tcms->DefineSection(1,-253.6,68.1,74.2);
295 //
296 tcms->DefineSection(2,-253.6,68.1,68.4);
297 tcms->DefineSection(3,-74.0,60.9,61.2);
298 //
299 tcms->DefineSection(4,-74.0,60.1,61.2);
300 tcms->DefineSection(5,-73.3,60.1,61.2);
301 //
302 tcms->DefineSection(6,-73.3,56.9,61.2);
303 tcms->DefineSection(7,-73.0,56.9,61.2);
304 //
305 tcms->DefineSection(8,-73.0,56.9,58.8);
306 tcms->DefineSection(9,-71.3,56.9,58.8);
307 //
308 TGeoVolume *v7 = new TGeoVolume("TPC_ICVM",tcms,m3);
c5d5037c 309 //------------------------------------------------
310 // Heat screen muon side
311 //------------------------------------------------
312
313 TGeoCone *thsm = new TGeoCone(89.8,67.88,68.1,60.68,60.9);
314 TGeoCone *thsmw = new TGeoCone(89.8,67.94,68.04,60.74,60.84);
315 TGeoVolume *hvsm = new TGeoVolume("TPC_HSM",thsm,mhs); //steel
316 TGeoVolume *hvsmw = new TGeoVolume("TPC_HSMW",thsmw,m12); //water
317 // assembly heat screen muon
318 hvsm->AddNode(hvsmw,1);
457e2170 319 //-----------------------------------------------
320 // inner containment vessel - shaft side
321 //-----------------------------------------------
322 TGeoPcon *tcss = new TGeoPcon(0.,360.,10);
323 //
324 tcss->DefineSection(0,71.3,56.9,58.8);
325 tcss->DefineSection(1,73.0,56.9,58.8);
326 //
327 tcss->DefineSection(2,73.0,56.9,61.2);
328 tcss->DefineSection(3,73.3,56.9,61.2);
329 //
330 tcss->DefineSection(4,73.3,60.1,61.2);
331 tcss->DefineSection(5,74.0,60.1,61.2);
332 //
333 tcss->DefineSection(6,74.0,60.9,61.2);
334 tcss->DefineSection(7,253.6,65.6,65.9);
335 //
336 tcss->DefineSection(8,253.6,65.6,74.2);
337 tcss->DefineSection(9,258.1,65.6,74.2);
338 //
339 TGeoVolume *v8 = new TGeoVolume("TPC_ICVS",tcss,m3);
c5d5037c 340 //-------------------------------------------------
341 // Heat screen shaft side
342 //--------------------------------------------------
343 TGeoCone *thss = new TGeoCone(89.8,60.68,60.9,65.38,65.6);
344 TGeoCone *thssw = new TGeoCone(89.8,60.74,60.84,65.44,65.54);
345 TGeoVolume *hvss = new TGeoVolume("TPC_HSS",thss,mhs); //steel
346 TGeoVolume *hvssw = new TGeoVolume("TPC_HSSW",thssw,m12); //water
347 //assembly heat screen shaft
348 hvss->AddNode(hvssw,1);
457e2170 349 //-----------------------------------------------
350 // Inner field cage
351 // define 4 parts and make an assembly
352 //-----------------------------------------------
353 // part1 - Al - 2 copies
354 TGeoTube *t1 = new TGeoTube(76.6774,78.845,0.75);
355 TGeoVolume *tv1 = new TGeoVolume("TPC_IFC2",t1,m3);
356 // sandwich - outermost parts - 2 copies
357 TGeoTube *t2 = new TGeoTube(76.6774,78.845,74.175); // tedlar 38 microns
358 TGeoTube *t3 = new TGeoTube(76.6812,78.8412,74.175); // prepreg2 500 microns
359 TGeoTube *t4 = new TGeoTube(76.7312,78.7912,74.175); // prepreg3 300 microns
360 TGeoTube *t5 = new TGeoTube(76.7612,78.7612,74.175); // nomex 2 cm
361 //
362 TGeoVolume *tv2 = new TGeoVolume("TPC_IFC3",t2,sm2);
363 TGeoVolume *tv3 = new TGeoVolume("TPC_IFC4",t3,sm3);
364 TGeoVolume *tv4 = new TGeoVolume("TPC_IFC5",t4,sm5);
365 TGeoVolume *tv5 = new TGeoVolume("TPC_IFC6",t5,sm4);
366 //
367 // middle parts - 2 copies
368 TGeoTube *t6 = new TGeoTube(76.6774,78.795,5.); // tedlar 38 microns
369 TGeoTube *t7 = new TGeoTube(76.6812,78.7912,5.); // prepreg2 250 microns
370 TGeoTube *t8 = new TGeoTube(76.7062,78.7662,5.); // prepreg3 300 microns
371 TGeoTube *t9 = new TGeoTube(76.7362,78.7362,5.); // nomex 2 cm
372 //
373 TGeoVolume *tv6 = new TGeoVolume("TPC_IFC7",t6,sm2);
374 TGeoVolume *tv7 = new TGeoVolume("TPC_IFC8",t7,sm3);
375 TGeoVolume *tv8 = new TGeoVolume("TPC_IFC9",t8,sm5);
376 TGeoVolume *tv9 = new TGeoVolume("TPC_IFC10",t9,sm4);
377 // central part - 1 copy
378 TGeoTube *t10 = new TGeoTube(76.6774,78.745,93.75); // tedlar 38 microns
379 TGeoTube *t11 = new TGeoTube(76.6812,78.7412,93.75); // prepreg3 300 microns
380 TGeoTube *t12 = new TGeoTube(76.7112,78.7112,93.75); // nomex 2 cm
381 //
382 TGeoVolume *tv10 = new TGeoVolume("TPC_IFC11",t10,sm2);
383 TGeoVolume *tv11 = new TGeoVolume("TPC_IFC12",t11,sm5);
384 TGeoVolume *tv12 = new TGeoVolume("TPC_IFC13",t12,sm4);
385 //
386 // inner part - positioning
387 //
388 // creating a sandwich
389 tv2->AddNode(tv3,1); tv3->AddNode(tv4,1); tv4->AddNode(tv5,1);
390 //
391 tv6->AddNode(tv7,1); tv7->AddNode(tv8,1); tv8->AddNode(tv9,1);
392 //
393 tv10->AddNode(tv11,1); tv11->AddNode(tv12,1);
394 //
395 TGeoVolumeAssembly *tv100 = new TGeoVolumeAssembly("TPC_IFC");
396 //
397 tv100->AddNode(tv10,1);
398 tv100->AddNode(tv6,1,new TGeoTranslation(0.,0.,-98.75));
399 tv100->AddNode(tv6,2,new TGeoTranslation(0.,0.,98.75));
400 tv100->AddNode(tv2,1,new TGeoTranslation(0.,0.,-177.925));
401 tv100->AddNode(tv2,2,new TGeoTranslation(0.,0.,177.925));
402 tv100->AddNode(tv1,1,new TGeoTranslation(0.,0.,-252.85));
403 tv100->AddNode(tv1,2,new TGeoTranslation(0.,0.,252.85));
404 //
405 v5->AddNode(v6,1, new TGeoTranslation(0.,0.,-252.1));
406 v5->AddNode(v6,2, new TGeoTranslation(0.,0.,252.1));
407 v1->AddNode(v5,1); v1->AddNode(v7,1); v1->AddNode(v8,1);
c5d5037c 408 v1->AddNode(hvsm,1,new TGeoTranslation(0.,0.,-163.8));
409 v1->AddNode(hvss,1,new TGeoTranslation(0.,0.,163.8));
457e2170 410 v9->AddNode(tv100,1);
411 //
412 // central drum
413 //
414 // flange + sandwich
415 //
416 TGeoPcon *cfl = new TGeoPcon(0.,360.,6);
417 cfl->DefineSection(0,-71.1,59.7,61.2);
418 cfl->DefineSection(1,-68.6,59.7,61.2);
419 //
420 cfl->DefineSection(2,-68.6,60.6324,61.2);
421 cfl->DefineSection(3,68.6,60.6324,61.2);
422 //
423 cfl->DefineSection(4,68.6,59.7,61.2);
424 cfl->DefineSection(5,71.1,59.7,61.2);
425 //
426 TGeoVolume *cflv = new TGeoVolume("TPC_CDR",cfl,m3);
427 // sandwich
428 TGeoTube *cd1 = new TGeoTube(60.6424,61.19,71.1);
429 TGeoTube *cd2 = new TGeoTube(60.6462,61.1862,71.1);
430 TGeoTube *cd3 = new TGeoTube(60.6662,61.1662,71.1);
431 //
432 TGeoMedium *sm6 = gGeoManager->GetMedium("TPC_Prepreg1");
433 TGeoVolume *cd1v = new TGeoVolume("TPC_CDR1",cd1,sm2); //tedlar
434 TGeoVolume *cd2v = new TGeoVolume("TPC_CDR2",cd2,sm6);// prepreg1
435 TGeoVolume *cd3v = new TGeoVolume("TPC_CDR3",cd3,sm4); //nomex
436 //
437 // seals for central drum 2 copies
438 //
439 TGeoTube *cs = new TGeoTube(56.9,61.2,0.1);
440 TGeoMedium *sm7 = gGeoManager->GetMedium("TPC_Mylar");
441 TGeoVolume *csv = new TGeoVolume("TPC_CDRS",cs,sm7);
78134e48 442 v1->AddNode(csv,1,new TGeoTranslation(0.,0.,-71.2));
443 v1->AddNode(csv,2,new TGeoTranslation(0.,0.,71.2));
457e2170 444 //
445 // seal collars
446 TGeoPcon *se = new TGeoPcon(0.,360.,6);
447 se->DefineSection(0,-72.8,59.7,61.2);
448 se->DefineSection(1,-72.3,59.7,61.2);
449 //
450 se->DefineSection(2,-72.3,58.85,61.2);
451 se->DefineSection(3,-71.6,58.85,61.2);
452 //
453 se->DefineSection(4,-71.6,59.7,61.2);
454 se->DefineSection(5,-71.3,59.7,61.2);
455 //
456 TGeoVolume *sev = new TGeoVolume("TPC_CDCE",se,m3);
457 //
458 TGeoTube *si = new TGeoTube(56.9,58.8,1.);
459 TGeoVolume *siv = new TGeoVolume("TPC_CDCI",si,m3);
460 //
461 // define reflection matrix
462 //
463 TGeoRotation *ref = new TGeoRotation("ref",90.,0.,90.,90.,180.,0.);
464 //
465 cd1v->AddNode(cd2v,1); cd2v->AddNode(cd3v,1); cflv->AddNode(cd1v,1);
466 //
467 v1->AddNode(siv,1,new TGeoTranslation(0.,0.,-69.9));
468 v1->AddNode(siv,2,new TGeoTranslation(0.,0.,69.9));
469 v1->AddNode(sev,1); v1->AddNode(sev,2,ref); v1->AddNode(cflv,1);
470 //
471 // central membrane - 2 rings and a mylar membrane - assembly
472 //
473 TGeoTube *ih = new TGeoTube(81.05,84.05,0.3);
474 TGeoTube *oh = new TGeoTube(250.,256.,.5);
475 TGeoTube *mem = new TGeoTube(84.05,250,0.01);
476 TGeoVolume *ihv = new TGeoVolume("TPC_IHVH",ih,m3);
477 TGeoVolume *ohv = new TGeoVolume("TPC_OHVH",oh,m3);
478 TGeoVolume *memv = new TGeoVolume("TPC_HV",mem,sm7);
479 //
480 TGeoVolumeAssembly *cm = new TGeoVolumeAssembly("TPC_HVMEM");
481 cm->AddNode(ihv,1);
482 cm->AddNode(ohv,1);
483 cm->AddNode(memv,1);
484 v9->AddNode(cm,1);
485 //
486 // end caps - they are make as an assembly of single segments
487 // containing both readout chambers
488 //
489 Double_t openingAngle = 10.*TMath::DegToRad();
490 Double_t thick=1.5; // rib
491 Double_t shift = thick/TMath::Sin(openingAngle);
492 //
493 Double_t lowEdge = 86.3; // hole in the wheel
494 Double_t upEdge = 240.4; // hole in the wheel
495 //
496 new TGeoTubeSeg("sec",74.5,264.4,3.,0.,20.);
497 //
498 TGeoPgon *hole = new TGeoPgon("hole",0.,20.,1,4);
499 //
500 hole->DefineSection(0,-3.5,lowEdge-shift,upEdge-shift);
501 hole->DefineSection(1,-1.5,lowEdge-shift,upEdge-shift);
502 //
503 hole->DefineSection(2,-1.5,lowEdge-shift,upEdge+3.-shift);
504 hole->DefineSection(3,3.5,lowEdge-shift,upEdge+3.-shift);
505 //
506 Double_t ys = shift*TMath::Sin(openingAngle);
507 Double_t xs = shift*TMath::Cos(openingAngle);
508 TGeoTranslation *tr = new TGeoTranslation("tr",xs,ys,0.);
509 tr->RegisterYourself();
510 TGeoCompositeShape *chamber = new TGeoCompositeShape("sec-hole:tr");
511 TGeoVolume *sv = new TGeoVolume("TPC_WSEG",chamber,m3);
512 TGeoPgon *bar = new TGeoPgon("bar",0.,20.,1,2);
513 bar->DefineSection(0,-3.,131.5-shift,136.5-shift);
514 bar->DefineSection(1,1.5,131.5-shift,136.5-shift);
515 TGeoVolume *barv = new TGeoVolume("TPC_WBAR",bar,m3);
516 TGeoVolumeAssembly *ch = new TGeoVolumeAssembly("TPC_WCH");//empty segment
517 //
518 ch->AddNode(sv,1); ch->AddNode(barv,1,tr);
519 //
520 // readout chambers
521 //
522 // IROC first
523 //
524 TGeoTrd1 *ibody = new TGeoTrd1(13.8742,21.3328,4.29,21.15);
525 TGeoVolume *ibdv = new TGeoVolume("TPC_IROCB",ibody,m3);
526 // empty space
527 TGeoTrd1 *emp = new TGeoTrd1(12.3742,19.8328,3.99,19.65);
528 TGeoVolume *empv = new TGeoVolume("TPC_IROCE",emp,m1);
529 ibdv->AddNode(empv,1,new TGeoTranslation(0.,-0.3,0.));
530 //bars
531 Double_t tga = (19.8328-12.3742)/39.3;
532 Double_t xmin,xmax;
533 xmin = 9.55*tga+12.3742;
534 xmax = 9.95*tga+12.3742;
535 TGeoTrd1 *ib1 = new TGeoTrd1(xmin,xmax,3.29,0.2);
536 TGeoVolume *ib1v = new TGeoVolume("TPC_IRB1",ib1,m3);
537 empv->AddNode(ib1v,1,new TGeoTranslation("tt1",0.,0.7,-9.9));
538 xmin=19.4*tga+12.3742;
539 xmax=19.9*tga+12.3742;
540 TGeoTrd1 *ib2 = new TGeoTrd1(xmin,xmax,3.29,0.25);
541 TGeoVolume *ib2v = new TGeoVolume("TPC_TRB2",ib2,m3);
542 empv->AddNode(ib2v,1,new TGeoTranslation(0.,0.7,0.));
543 xmin=29.35*tga+12.3742;
544 xmax=29.75*tga+12.3742;
545 TGeoTrd1 *ib3 = new TGeoTrd1(xmin,xmax,3.29,0.2);
546 TGeoVolume *ib3v = new TGeoVolume("TPC_IRB3",ib3,m3);
547 empv->AddNode(ib3v,1,new TGeoTranslation(0.,0.7,9.9));
548 //
549 // holes for connectors
550 //
551 TGeoBBox *conn = new TGeoBBox(0.4,0.3,4.675); // identical for iroc and oroc
552 TGeoVolume *connv = new TGeoVolume("TPC_RCCON",conn,m1);
553 TString fileName(gSystem->Getenv("ALICE_ROOT"));
554 fileName += "/TPC/conn_iroc.dat";
555 ifstream in;
556 in.open(fileName.Data(), ios_base::in); // asci file
557 for(Int_t i =0;i<86;i++){
558 Double_t y = 3.99;
559 Double_t x,z,ang;
560 in>>x>>z>>ang;
561 z-=26.5;
562 TGeoRotation *rrr = new TGeoRotation();
563 rrr->RotateY(ang);
564 TGeoCombiTrans *trans = new TGeoCombiTrans("trans",x,y,z,rrr);
565 ibdv->AddNode(connv,i+1,trans);
566 }
567 in.close();
568 // "cap"
569 new TGeoTrd1("icap",14.5974,23.3521,1.19,24.825);
570 // "hole"
571 new TGeoTrd1("ihole",13.8742,21.3328,1.2,21.15);
572 TGeoTranslation *tr1 = new TGeoTranslation("tr1",0.,0.,1.725);
573 tr1->RegisterYourself();
574 TGeoCompositeShape *ic = new TGeoCompositeShape("icap-ihole:tr1");
575 TGeoVolume *icv = new TGeoVolume("TPC_IRCAP",ic,m3);
576 //
577 // pad plane and wire fixations
578 //
579 TGeoTrd1 *pp = new TGeoTrd1(14.5974,23.3521,0.3,24.825); //pad+iso
580 TGeoMedium *m4 = gGeoManager->GetMedium("TPC_G10");
581 TGeoVolume *ppv = new TGeoVolume("TPC_IRPP",pp,m4);
582 TGeoPara *f1 = new TGeoPara(.6,.5,24.825,0.,-10.,0.);
583 TGeoVolume *f1v = new TGeoVolume("TPC_IRF1",f1,m4);
584 TGeoPara *f2 = new TGeoPara(.6,.5,24.825,0.,10.,0.);
585 TGeoVolume *f2v = new TGeoVolume("TPC_IRF2",f2,m4);
586 //
587 TGeoVolumeAssembly *iroc = new TGeoVolumeAssembly("TPC_IROC");
588 //
589 iroc->AddNode(ibdv,1);
590 iroc->AddNode(icv,1,new TGeoTranslation(0.,3.1,-1.725));
591 iroc->AddNode(ppv,1,new TGeoTranslation(0.,4.59,-1.725));
592 tga =(23.3521-14.5974)/49.65;
593 Double_t xx = 24.825*tga+14.5974-0.6;
594 iroc->AddNode(f1v,1,new TGeoTranslation(-xx,5.39,-1.725));
595 iroc->AddNode(f2v,1,new TGeoTranslation(xx,5.39,-1.725));
596 //
597 // OROC
598 //
599 TGeoTrd1 *obody = new TGeoTrd1(22.2938,40.5084,4.19,51.65);
600 TGeoVolume *obdv = new TGeoVolume("TPC_OROCB",obody,m3);
601 TGeoTrd1 *oemp = new TGeoTrd1(20.2938,38.5084,3.89,49.65);
602 TGeoVolume *oempv = new TGeoVolume("TPC_OROCE",oemp,m1);
603 obdv->AddNode(oempv,1,new TGeoTranslation(0.,-0.3,0.));
604 //horizontal bars
605 tga=(38.5084-20.2938)/99.3;
606 xmin=tga*10.2+20.2938;
607 xmax=tga*10.6+20.2938;
608 TGeoTrd1 *ob1 = new TGeoTrd1(xmin,xmax,2.915,0.2);
609 TGeoVolume *ob1v = new TGeoVolume("TPC_ORB1",ob1,m3);
610 //
611 xmin=22.55*tga+20.2938;
612 xmax=24.15*tga+20.2938;
613 TGeoTrd1 *ob2 = new TGeoTrd1(xmin,xmax,2.915,0.8);
614 TGeoVolume *ob2v = new TGeoVolume("TPC_ORB2",ob2,m3);
615 //
616 xmin=36.1*tga+20.2938;
617 xmax=36.5*tga+20.2938;
618 TGeoTrd1 *ob3 = new TGeoTrd1(xmin,xmax,2.915,0.2);
619 TGeoVolume *ob3v = new TGeoVolume("TPC_ORB3",ob3,m3);
620 //
621 xmin=49.0*tga+20.2938;
622 xmax=50.6*tga+20.2938;
623 TGeoTrd1 *ob4 = new TGeoTrd1(xmin,xmax,2.915,0.8);
624 TGeoVolume *ob4v = new TGeoVolume("TPC_ORB4",ob4,m3);
625 //
626 xmin=63.6*tga+20.2938;
627 xmax=64.0*tga+20.2938;
628 TGeoTrd1 *ob5 = new TGeoTrd1(xmin,xmax,2.915,0.2);
629 TGeoVolume *ob5v = new TGeoVolume("TPC_ORB5",ob5,m3);
630 //
631 xmin=75.5*tga+20.2938;
632 xmax=77.15*tga+20.2938;
633 TGeoTrd1 *ob6 = new TGeoTrd1(xmin,xmax,2.915,0.8);
634 TGeoVolume *ob6v = new TGeoVolume("TPC_ORB6",ob6,m3);
635 //
636 xmin=88.7*tga+20.2938;
637 xmax=89.1*tga+20.2938;
638 TGeoTrd1 *ob7 = new TGeoTrd1(xmin,xmax,2.915,0.2);
639 TGeoVolume *ob7v = new TGeoVolume("TPC_ORB7",ob7,m3);
640 //
641 oempv->AddNode(ob1v,1,new TGeoTranslation(0.,0.975,-39.25));
642 oempv->AddNode(ob2v,1,new TGeoTranslation(0.,0.975,-26.3));
643 oempv->AddNode(ob3v,1,new TGeoTranslation(0.,0.975,-13.35));
644 oempv->AddNode(ob4v,1,new TGeoTranslation(0.,0.975,0.15));
645 oempv->AddNode(ob5v,1,new TGeoTranslation(0.,0.975,14.15));
646 oempv->AddNode(ob6v,1,new TGeoTranslation(0.,0.975,26.7));
647 oempv->AddNode(ob7v,1,new TGeoTranslation(0.,0.975,39.25));
648 // vertical bars
649 TGeoBBox *ob8 = new TGeoBBox(0.8,2.915,5.1);
650 TGeoBBox *ob9 = new TGeoBBox(0.8,2.915,5.975);
651 TGeoBBox *ob10 = new TGeoBBox(0.8,2.915,5.775);
652 TGeoBBox *ob11 = new TGeoBBox(0.8,2.915,6.25);
653 TGeoBBox *ob12 = new TGeoBBox(0.8,2.915,6.5);
654 //
655 TGeoVolume *ob8v = new TGeoVolume("TPC_ORB8",ob8,m3);
656 TGeoVolume *ob9v = new TGeoVolume("TPC_ORB9",ob9,m3);
657 TGeoVolume *ob10v = new TGeoVolume("TPC_ORB10",ob10,m3);
658 TGeoVolume *ob11v = new TGeoVolume("TPC_ORB11",ob11,m3);
659 TGeoVolume *ob12v = new TGeoVolume("TPC_ORB12",ob12,m3);
660 //
661 oempv->AddNode(ob8v,1,new TGeoTranslation(0.,0.975,-44.55));
662 oempv->AddNode(ob8v,2,new TGeoTranslation(0.,0.975,44.55));
663 oempv->AddNode(ob9v,1,new TGeoTranslation(0.,0.975,-33.075));
664 oempv->AddNode(ob9v,2,new TGeoTranslation(0.,0.975,-19.525));
665 oempv->AddNode(ob10v,1,new TGeoTranslation(0.,0.975,20.125));
666 oempv->AddNode(ob10v,2,new TGeoTranslation(0.,0.975,33.275));
667 oempv->AddNode(ob11v,1,new TGeoTranslation(0.,0.975,-6.9));
668 oempv->AddNode(ob12v,1,new TGeoTranslation(0.,0.975,7.45));
669 //
670 // holes for connectors
671 //
672 fileName = gSystem->Getenv("ALICE_ROOT");
673 fileName += "/TPC/conn_oroc.dat";
674 in.open(fileName.Data(), ios_base::in); // asci file
675 for(Int_t i =0;i<78;i++){
676 Double_t y =3.89;
677 Double_t x,z,ang;
678 Double_t x1,z1,x2,z2;
679 in>>x>>z>>ang;
680 Double_t xr = 4.7*TMath::Sin(ang*TMath::DegToRad());
681 Double_t zr = 4.7*TMath::Cos(ang*TMath::DegToRad());
682 //
683 x1=xr+x; x2=-xr+x; z1=zr+z; z2 = -zr+z;
684 //
685 TGeoRotation *rr = new TGeoRotation();
686 rr->RotateY(ang);
687 z1-=54.95;
688 z2-=54.95;
689 TGeoCombiTrans *trans1 = new TGeoCombiTrans("trans1",x1,y,z1,rr);
690 TGeoCombiTrans *trans2 = new TGeoCombiTrans("trans2",x2,y,z2,rr);
691 obdv->AddNode(connv,i+1,trans1);
692 obdv->AddNode(connv,i+79,trans2);
693 }
694 in.close();
695 // cap
696 new TGeoTrd1("ocap",23.3874,43.5239,1.09,57.1);
697 new TGeoTrd1("ohole",22.2938,40.5084,1.09,51.65);
698 TGeoTranslation *tr5 = new TGeoTranslation("tr5",0.,0.,-2.15);
699 tr5->RegisterYourself();
700 TGeoCompositeShape *oc = new TGeoCompositeShape("ocap-ohole:tr5");
701 TGeoVolume *ocv = new TGeoVolume("TPC_ORCAP",oc,m3);
702 //
703 // pad plane and wire fixations
704 //
705 TGeoTrd1 *opp = new TGeoTrd1(23.3874,43.5239,0.3,57.1);
706 TGeoVolume *oppv = new TGeoVolume("TPC_ORPP",opp,m4);
707 //
708 tga=(43.5239-23.3874)/114.2;
709 TGeoPara *f3 = new TGeoPara(.7,.6,57.1,0.,-10.,0.);
710 TGeoPara *f4 = new TGeoPara(.7,.6,57.1,0.,10.,0.);
711 xx = 57.1*tga+23.3874-0.7;
712 TGeoVolume *f3v = new TGeoVolume("TPC_ORF1",f3,m4);
713 TGeoVolume *f4v = new TGeoVolume("TPC_ORF2",f4,m4);
714 //
715 TGeoVolumeAssembly *oroc = new TGeoVolumeAssembly("TPC_OROC");
716 //
717 oroc->AddNode(obdv,1);
718 oroc->AddNode(ocv,1,new TGeoTranslation(0.,3.1,2.15));
719 oroc->AddNode(oppv,1,new TGeoTranslation(0.,4.49,2.15));
720 oroc->AddNode(f3v,1,new TGeoTranslation(-xx,5.39,2.15));
721 oroc->AddNode(f4v,1,new TGeoTranslation(xx,5.39,2.15));
722 //
723 // now iroc and oroc are placed into a sector...
724 //
725 TGeoVolumeAssembly *secta = new TGeoVolumeAssembly("TPC_SECT"); // a-side
726 TGeoVolumeAssembly *sectc = new TGeoVolumeAssembly("TPC_SECT"); // c-side
727 TGeoRotation rot1("rot1",90.,90.,0.);
728 TGeoRotation rot2("rot2");
729 rot2.RotateY(10.);
730 TGeoRotation *rot = new TGeoRotation("rot");
731 *rot=rot1*rot2;
732 //
733 Double_t x0,y0;
734 x0=110.2*TMath::Cos(openingAngle);
735 y0=110.2*TMath::Sin(openingAngle);
20527578 736 TGeoCombiTrans *combi1a = new TGeoCombiTrans("combi1",x0,y0,1.09+0.195,rot); //a-side
737 TGeoCombiTrans *combi1c = new TGeoCombiTrans("combi1",x0,y0,1.09+0.222,rot); //c-side
457e2170 738 x0=188.45*TMath::Cos(openingAngle);
739 y0=188.45*TMath::Sin(openingAngle);
20527578 740 TGeoCombiTrans *combi2a = new TGeoCombiTrans("combi2",x0,y0,0.99+0.195,rot); //a-side
741 TGeoCombiTrans *combi2c = new TGeoCombiTrans("combi2",x0,y0,0.99+0.222,rot); //c-side
457e2170 742 //
743 //
744 // A-side
745 //
746 secta->AddNode(ch,1);
747 secta->AddNode(iroc,1,combi1a);
748 secta->AddNode(oroc,1,combi2a);
749 //
750 // C-side
751 //
752 sectc->AddNode(ch,1);
753 sectc->AddNode(iroc,1,combi1c);
754 sectc->AddNode(oroc,1,combi2c);
755 //
756 // now I try to make wheels...
757 //
758 TGeoVolumeAssembly *wheela = new TGeoVolumeAssembly("TPC_ENDCAP");
759 TGeoVolumeAssembly *wheelc = new TGeoVolumeAssembly("TPC_ENDCAP");
760 //
761 for(Int_t i =0;i<18;i++){
762 Double_t phi = (20.*i);
763 TGeoRotation *r = new TGeoRotation();
764 r->RotateZ(phi);
765 wheela->AddNode(secta,i+1,r);
766 wheelc->AddNode(sectc,i+1,r);
767
768 }
769 // wheels in the drift volume!
770
771 TGeoCombiTrans *combi3 = new TGeoCombiTrans("combi3",0.,0.,256.6,ref);
772 v9->AddNode(wheela,1,combi3);
773 v9->AddNode(wheelc,2,new TGeoTranslation(0.,0.,-256.6));
774 //_____________________________________________________________
775 // service support wheel
776 //_____________________________________________________________
777 TGeoPgon *sw = new TGeoPgon(0.,20.,1,2);
778 sw->DefineSection(0,-4.,80.5,251.75);
779 sw->DefineSection(1,4.,80.5,251.75);
780 TGeoVolume *swv = new TGeoVolume("TPC_SWSEG",sw,m3); //Al
781 //
782 thick=1.;
783 shift = thick/TMath::Sin(openingAngle);
784 TGeoPgon *sh = new TGeoPgon(0.,20.,1,2);
785 sh->DefineSection(0,-4.,81.5-shift,250.75-shift);
786 sh->DefineSection(1,4.,81.5-shift,250.75-shift);
787 TGeoVolume *shv = new TGeoVolume("TPC_SWS1",sh,m1); //Air
788 //
789 TGeoMedium *m9 = gGeoManager->GetMedium("TPC_Si");
790 TGeoPgon *el = new TGeoPgon(0.,20.,1,2);
791 el->DefineSection(0,-1.872,81.5-shift,250.75-shift);
792 el->DefineSection(1,1.872,81.5-shift,250.75-shift);
793 TGeoVolume *elv = new TGeoVolume("TPC_ELEC",el,m9); //Si
794 //
795 shv->AddNode(elv,1);
796 //
797 //
798 ys = shift*TMath::Sin(openingAngle);
799 xs = shift*TMath::Cos(openingAngle);
800 swv->AddNode(shv,1,new TGeoTranslation(xs,ys,0.));
801 // cover
802 TGeoPgon *co = new TGeoPgon(0.,20.,1,2);
803 co->DefineSection(0,-0.5,77.,255.25);
804 co->DefineSection(1,0.5,77.,255.25);
805 TGeoVolume *cov = new TGeoVolume("TPC_SWC1",co,m3);//Al
806 // hole in a cover
807 TGeoPgon *coh = new TGeoPgon(0.,20.,1,2);
808 shift=4./TMath::Sin(openingAngle);
809 coh->DefineSection(0,-0.5,85.-shift,247.25-shift);
810 coh->DefineSection(1,0.5,85.-shift,247.25-shift);
811 //
812 TGeoVolume *cohv = new TGeoVolume("TPC_SWC2",coh,m1);
813 //
814 ys = shift*TMath::Sin(openingAngle);
815 xs = shift*TMath::Cos(openingAngle);
816 cov->AddNode(cohv,1,new TGeoTranslation(xs,ys,0.));
817 //
818 // Sector as an Assembly
819 //
820 TGeoVolumeAssembly *swhs = new TGeoVolumeAssembly("TPC_SSWSEC");
821 swhs->AddNode(swv,1);
822 swhs->AddNode(cov,1,new TGeoTranslation(0.,0.,-4.5));
823 swhs->AddNode(cov,2,new TGeoTranslation(0.,0.,4.5));
824 //
825 // SSW as an Assembly of sectors
826 //
827 TGeoVolumeAssembly *swheel = new TGeoVolumeAssembly("TPC_SSWHEEL");
828 for(Int_t i =0;i<18;i++){
829 Double_t phi = (20.*i);
830 TGeoRotation *r = new TGeoRotation();
831 r->RotateZ(phi);
832 swheel->AddNode(swhs,i+1,r);
833 }
834 v1->AddNode(swheel,1,new TGeoTranslation(0.,0.,-284.6));
835 v1->AddNode(swheel,2,new TGeoTranslation(0.,0.,284.6));
836
837 // sensitive strips - strip "0" is always set
838 // conditional
839 Int_t totrows;
840 totrows = fTPCParam->GetNRowLow() + fTPCParam->GetNRowUp();
841 Double_t *upar;
842 upar=NULL;
843 gGeoManager->Volume("TPC_Strip","PGON",m5->GetId(),upar);
844 upar=new Double_t [10];
845 upar[0]=0.;
846 upar[1]=360.;
847 upar[2]=18.;
848 upar[3]=2.;
849 //
850 upar[4]=-124.8;
851 upar[7]=124.8;
852
853 Double_t rlow=fTPCParam->GetPadRowRadiiLow(0);
854
855 upar[5]=rlow;
856 upar[6]=rlow+.01;
857 upar[8]=upar[5];
858 upar[9]=upar[6];
859 //
860 gGeoManager->Node("TPC_Strip",1,"TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
861 gGeoManager->Node("TPC_Strip",totrows+1,
862 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
863 //
864 // now, strips optionally
865 //
866 if(fSens){
867 //lower sectors
868 for(Int_t i=2;i<fTPCParam->GetNRowLow()+1;i++){
869 rlow=fTPCParam->GetPadRowRadiiLow(i-1);
870 upar[5]=rlow;
871 upar[6]=rlow+.01;
872 upar[8]=upar[5];
873 upar[9]=upar[6];
874 gGeoManager->Node("TPC_Strip",i,
875 "TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
876 gGeoManager->Node("TPC_Strip",totrows+i,
877 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
878 }
879 //upper sectors
880 for(Int_t i=1;i<fTPCParam->GetNRowUp()+1;i++){
881 rlow=fTPCParam->GetPadRowRadiiUp(i-1);
882 upar[5]=rlow;
883 upar[6]=rlow+.01;
884 upar[8]=upar[5];
885 upar[9]=upar[6];
886 gGeoManager->Node("TPC_Strip",i+fTPCParam->GetNRowLow(),
887 "TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
888 gGeoManager->Node("TPC_Strip",totrows+i+fTPCParam->GetNRowLow(),
889 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
890 }
891 }//strips
892 //----------------------------------------------------------
893 // TPc Support Rods - MAKROLON
894 //----------------------------------------------------------
895 TGeoMedium *m6=gGeoManager->GetMedium("TPC_Makrolon");
896 TGeoMedium *m7=gGeoManager->GetMedium("TPC_Cu");
78134e48 897 TGeoMedium *m10 = gGeoManager->GetMedium("TPC_Alumina");
898 TGeoMedium *m11 = gGeoManager->GetMedium("TPC_Peek");
c5d5037c 899
457e2170 900 // upper and lower rods differ in length!
901 delete [] upar;
902 upar=NULL;
903 gGeoManager->Volume("TPC_Rod","TUBE",m6->GetId(),upar);
904 upar=new Double_t [3];
905 upar[0]=1.8;
906 upar[1]=2.2;
907
908 //
909 //HV rods - makrolon + 0.58cm (diameter) Cu
910 TGeoTube *hvr = new TGeoTube(0.,2.2,126.64);
911 TGeoTube *hvc = new TGeoTube(0.,0.29,126.64);
912 //
913 TGeoVolume *hvrv = new TGeoVolume("TPC_HV_Rod",hvr,m6);
914 TGeoVolume *hvcv = new TGeoVolume("TPC_HV_Cable",hvc,m7);
915 hvrv->AddNode(hvcv,1);
78134e48 916 //
917 // resistor rods
918 //
919 TGeoTube *cri = new TGeoTube(0.,0.45,126.64); //inner
920 TGeoTube *cro = new TGeoTube(0.,0.45,126.54); //outer
921 TGeoTube *cwi = new TGeoTube(0.,0.15,126.64); // water inner
922 TGeoTube *cwo = new TGeoTube(0.,0.15,126.54); // water outer
923 //
924 TGeoVolume *criv = new TGeoVolume("TPC_CR_I",cri,m10);
925 TGeoVolume *crov = new TGeoVolume("TPC_CR_O",cro,m10);
926 TGeoVolume *cwiv = new TGeoVolume("TPC_W_I",cwi,m11);
927 TGeoVolume *cwov = new TGeoVolume("TPC_W_O",cwo,m11);
928 //
929 // ceramic rod with water
930 //
931 criv->AddNode(cwiv,1);
932 crov->AddNode(cwov,1);
933 //
934 TGeoTube *pri =new TGeoTube(0.2,0.35,126.64); //inner
935 TGeoTube *pro = new TGeoTube(0.2,0.35,126.54); //outer
936 //
937 // peek rod
938 //
939 TGeoVolume *priv = new TGeoVolume("TPC_PR_I",pri,m12);
940 TGeoVolume *prov = new TGeoVolume("TPC_PR_O",pro,m12);
941 //
942 // resistor rods assembly
943 //
be53328e 944 TGeoRotation *rotr = new TGeoRotation("rotr");
945 rotr->RotateZ(-21.);
78134e48 946 //
947 TGeoTube *rri = new TGeoTube(1.8,2.2,126.64);//inner
948 TGeoTube *rro = new TGeoTube(1.8,2.2,126.54);//inner
949 //
950 TGeoVolume *rriv = new TGeoVolume("TPC_RR_I",rri,m6);
951 TGeoVolume *rrov = new TGeoVolume("TPC_RR_O",rro,m6);
952 //
a3d2be59 953 TGeoVolumeAssembly *rrin = new TGeoVolumeAssembly("TPC_RROD_I");
954 TGeoVolumeAssembly *rrou = new TGeoVolumeAssembly("TPC_RROD_O");
955 rrin->AddNode(rriv,1);
956 rrin->AddNode(criv,1,new TGeoTranslation(0.5,0.866, 0.));
957 rrin->AddNode(criv,2,new TGeoTranslation(0.5,-0.866, 0.));
958 rrin->AddNode(priv,1);
959 //
960 rrou->AddNode(rrov,1);
961 rrou->AddNode(crov,1,new TGeoTranslation(0.5,0.866, 0.));
962 rrou->AddNode(crov,2,new TGeoTranslation(0.5,-0.866, 0.));
963 rrou->AddNode(prov,1);
457e2170 964 for(Int_t i=0;i<18;i++){
965 Double_t angle,x,y;
966 Double_t z,r;
967 angle=TMath::DegToRad()*20.*(Double_t)i;
968 r=81.5;
969 x=r * TMath::Cos(angle);
970 y=r * TMath::Sin(angle);
971 upar[2]=126.64; //lower
972 z= 126.96;
78134e48 973 //
974 if(i==3){
be53328e 975 v9->AddNode(rrin,1,new TGeoCombiTrans(x,y,z,rotr)); //A
976 v9->AddNode(rrin,2,new TGeoCombiTrans(x,y,-z,rotr)); //C
78134e48 977 }
978 else {
979 gGeoManager->Node("TPC_Rod",i+1,"TPC_Drift",x,y,z,0,kTRUE,upar,3);//shaft
980 gGeoManager->Node("TPC_Rod",i+19,"TPC_Drift",x,y,-z,0,kTRUE,upar,3);//muon
457e2170 981 }
78134e48 982
983
984 //
457e2170 985 r=254.25;
986 x=r * TMath::Cos(angle);
987 y=r * TMath::Sin(angle);
988 upar[2]=126.54; //upper
989 z=127.06;
78134e48 990 if(i==15){
39ae7605 991 //v9->AddNode(hvrv,1,new TGeoTranslation(x,y,z));//A-side only
992 v9->AddNode(hvrv,1,new TGeoTranslation(x,y,127.14));//A-side only
78134e48 993 gGeoManager->Node("TPC_Rod",i+55,"TPC_Drift",x,y,-z,0,kTRUE,upar,3);
994 }
995 else if(i==11){
be53328e 996 v9->AddNode(rrou,1,new TGeoCombiTrans(x,y,z,rotr)); //A
997 v9->AddNode(rrou,2,new TGeoCombiTrans(x,y,-z,rotr)); //C
78134e48 998 }
999 else{
1000 //
1001 gGeoManager->Node("TPC_Rod",i+37,"TPC_Drift",x,y,z,0,kTRUE,upar,3);
1002 gGeoManager->Node("TPC_Rod",i+55,"TPC_Drift",x,y,-z,0,kTRUE,upar,3);
1003 }
457e2170 1004 }
1005
1006 TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
1007 alice->AddNode(v1,1);
1008
1009} // end of function
1010
1011//_____________________________________________________________________________
1012void AliTPCv4::AddAlignableVolumes() const
1013{
1014 //
1015 // Create entries for alignable volumes associating the symbolic volume
1016 // name with the corresponding volume path. Needs to be syncronized with
1017 // eventual changes in the geometry.
1018 //
1019 SetInnerChambersAlignable();
1020 SetOuterChambersAlignable();
1021}
1022
1023//_____________________________________________________________________________
1024void AliTPCv4::SetInnerChambersAlignable() const
1025{
1026 //
1027 Int_t modnum = 0;
1028 TString vpstr1 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_1/TPC_SECT_";
1029 TString vpstr2 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_2/TPC_SECT_";
1030 TString vpappend = "/TPC_IROC_1";
1031 TString snstr1="TPC/EndcapA/Sector";
1032 TString snstr2="TPC/EndcapC/Sector";
1033 TString snappend="/InnerChamber";
1034 TString volpath, symname;
1035
1036 for(Int_t cnt=1; cnt<=18; cnt++){
1037 volpath = vpstr1;
1038 volpath += cnt;
1039 volpath += vpappend;
1040 symname = snstr1;
1041 symname += cnt;
1042 symname += snappend;
1043 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1044 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
1045 //
1046 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data());
1047 const char *path = alignableEntry->GetTitle();
1048 if (!gGeoManager->cd(path))
1049 AliFatal(Form("Volume path %s not valid!",path));
1050 TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
1051 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,cnt-1);
1052 alignableEntry->SetMatrix(matTtoL);
1053 modnum++;
1054 }
1055
1056 for(Int_t cnt=1; cnt<=18; cnt++){
1057 volpath = vpstr2;
1058 volpath += cnt;
1059 volpath += vpappend;
1060 symname = snstr2;
1061 symname += cnt;
1062 symname += snappend;
1063 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1064 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
1065 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data());
1066 const char *path = alignableEntry->GetTitle();
1067 if (!gGeoManager->cd(path))
1068 AliFatal(Form("Volume path %s not valid!",path));
1069 TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
1070 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,18+cnt-1);
1071 alignableEntry->SetMatrix(matTtoL);
1072 modnum++;
1073 }
1074}
1075
1076//_____________________________________________________________________________
1077void AliTPCv4::SetOuterChambersAlignable() const
1078{
1079 //
1080 Int_t modnum = 0;
1081 TString vpstr1 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_1/TPC_SECT_";
1082 TString vpstr2 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_2/TPC_SECT_";
1083 TString vpappend = "/TPC_OROC_1";
1084 TString snstr1="TPC/EndcapA/Sector";
1085 TString snstr2="TPC/EndcapC/Sector";
1086 TString snappend="/OuterChamber";
1087 TString volpath, symname;
1088
1089 for(Int_t cnt=1; cnt<=18; cnt++){
1090 volpath = vpstr1;
1091 volpath += cnt;
1092 volpath += vpappend;
1093 symname = snstr1;
1094 symname += cnt;
1095 symname += snappend;
1096 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1097 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
1098 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data());
1099 const char *path = alignableEntry->GetTitle();
1100 if (!gGeoManager->cd(path))
1101 AliFatal(Form("Volume path %s not valid!",path));
1102 TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
1103 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,36+cnt-1);
1104 alignableEntry->SetMatrix(matTtoL);
1105 modnum++;
1106 }
1107
1108 for(Int_t cnt=1; cnt<=18; cnt++){
1109 volpath = vpstr2;
1110 volpath += cnt;
1111 volpath += vpappend;
1112 symname = snstr2;
1113 symname += cnt;
1114 symname += snappend;
1115 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1116 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
1117 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data());
1118 const char *path = alignableEntry->GetTitle();
1119 if (!gGeoManager->cd(path))
1120 AliFatal(Form("Volume path %s not valid!",path));
1121 TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
1122 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,36+18+cnt-1);
1123 alignableEntry->SetMatrix(matTtoL);
1124 modnum++;
1125 }
1126}
1127
457e2170 1128
1129//_____________________________________________________________________________
1130void AliTPCv4::CreateMaterials()
1131{
1132 //
1133 // Define materials for version 2 of the Time Projection Chamber
1134 //
1135
1136 AliTPC::CreateMaterials();
1137}
1138
1139//_____________________________________________________________________________
1140void AliTPCv4::Init()
1141{
1142 //
1143 // Initialises version 2 of the TPC after that it has been built
1144 //
1145
8d888a91 1146 //Int_t *idtmed = fIdtmed->GetArray();
457e2170 1147
1148 AliTPC::Init();
1149
1150
1151 fIdSens=gMC->VolId("TPC_Strip"); // one strip is always selected...
1152
1153 fIDrift=gMC->VolId("TPC_Drift");
1154 fSecOld=-100; // fake number
1155
d9888f70 1156 gMC->SetMaxNStep(-30000); // max. number of steps increased
457e2170 1157
098dfc1a 1158 // specific energy loss set in galice.cuts
457e2170 1159
1160 AliInfo("*** TPC version 4 initialized ***");
1161 AliInfo(Form("Maximum number of steps = %d",gMC->GetMaxNStep()));
1162
1163 //
1164
1165}
1166
1167//_____________________________________________________________________________
1168void AliTPCv4::StepManager()
1169{
1170 //
1171 // Called for every step in the Time Projection Chamber
1172 //
1173
1174 //
1175 // parameters used for the energy loss calculations
1176 //
1177 const Float_t kprim = 14.35; // number of primary collisions per 1 cm
1178 const Float_t kpoti = 20.77e-9; // first ionization potential for Ne/CO2
1179 const Float_t kwIon = 35.97e-9; // energy for the ion-electron pair creation
1180
1181
1182 const Float_t kbig = 1.e10;
1183
1184 Int_t id,copy;
1185 Float_t hits[5];
1186 Int_t vol[2];
1187 TLorentzVector p;
1188
1189 vol[1]=0; // preset row number to 0
1190 //
1191 gMC->SetMaxStep(kbig);
1192
1193
1194
1195 Float_t charge = gMC->TrackCharge();
1196
1197 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1198
1199 // check the sensitive volume
1200
1201 id = gMC->CurrentVolID(copy); // vol ID and copy number (starts from 1!)
1202 if(id != fIDrift && id != fIdSens) return; // not in the sensitive folume
1203
1204 gMC->TrackPosition(p);
1205 Double_t r = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
1206 //
1207
1208 //
1209 Double_t angle = TMath::ACos(p[0]/r);
1210 angle = (p[1]<0.) ? TMath::TwoPi()-angle : angle;
1211 //
1212 // angular segment, it is not a real sector number...
1213 //
1214 Int_t sector=TMath::Nint((angle-fTPCParam->GetInnerAngleShift())/
1215 fTPCParam->GetInnerAngle());
1216 // rotate to segment "0"
1217 Float_t cos,sin;
1218 fTPCParam->AdjustCosSin(sector,cos,sin);
1219 Float_t x1=p[0]*cos + p[1]*sin;
1220 // check if within sector's limits
5bd5dbc4 1221 if((x1>=fTPCParam->GetInnerRadiusLow()&&x1<=fTPCParam->GetInnerRadiusUp())
1222 ||(x1>=fTPCParam->GetOuterRadiusLow()&&x1<=fTPCParam->GetOuterRadiusUp())){
457e2170 1223 // calculate real sector number...
1224 if (x1>fTPCParam->GetOuterRadiusLow()){
1225 sector = TMath::Nint((angle-fTPCParam->GetOuterAngleShift())/
1226 fTPCParam->GetOuterAngle())+fTPCParam->GetNInnerSector();
1227 if (p[2]<0) sector+=(fTPCParam->GetNOuterSector()>>1);
1228 }
1229 else
1230 if (p[2]<0) sector+=(fTPCParam->GetNInnerSector()>>1);
1231 //
1232 // here I have a sector number
1233 //
1234
1235 vol[0]=sector;
1236 // check if change of sector
1237 if(sector != fSecOld){
1238 fSecOld=sector;
1239 // add track reference
20527578 1240 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
457e2170 1241 }
1242 // track is in the sensitive strip
1243 if(id == fIdSens){
1244 // track is entering the strip
1245 if (gMC->IsTrackEntering()){
1246 Int_t totrows = fTPCParam->GetNRowLow()+fTPCParam->GetNRowUp();
1247 vol[1] = (copy<=totrows) ? copy-1 : copy-1-totrows;
1248 // row numbers are autonomous for lower and upper sectors
1249 if(vol[0] > fTPCParam->GetNInnerSector()) {
1250 vol[1] -= fTPCParam->GetNRowLow();
1251 }
1252 //
1253 if(vol[0]<fTPCParam->GetNInnerSector()&&vol[1] == 0){
1254
1255 // lower sector, row 0, because Jouri wants to have this
1256
1257 gMC->TrackMomentum(p);
1258 hits[0]=p[0];
1259 hits[1]=p[1];
1260 hits[2]=p[2];
1261 hits[3]=0.; // this hit has no energy loss
1262 // Get also the track time for pileup simulation
1263 hits[4]=gMC->TrackTime();
1264
1265 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
1266 }
1267 //
1268
1269 gMC->TrackPosition(p);
1270 hits[0]=p[0];
1271 hits[1]=p[1];
1272 hits[2]=p[2];
1273 hits[3]=0.; // this hit has no energy loss
1274 // Get also the track time for pileup simulation
1275 hits[4]=gMC->TrackTime();
1276
1277 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
1278
1279 }
1280 else return;
1281 }
1282 //-----------------------------------------------------------------
1283 // charged particle is in the sensitive drift volume
1284 //-----------------------------------------------------------------
1285
1286 if(gMC->TrackStep() > 0){
1287
1288 Int_t nel = (Int_t)(((gMC->Edep())-kpoti)/kwIon) + 1;
20527578 1289 nel=TMath::Min(nel,30); // 30 electrons corresponds to 1 keV
457e2170 1290 //
1291 gMC->TrackPosition(p);
1292 hits[0]=p[0];
1293 hits[1]=p[1];
1294 hits[2]=p[2];
1295 hits[3]=(Float_t)nel;
1296
1297 // Add this hit
1298
97d77e7a 1299 //if (fHitType&&2){
1300 if(fHitType){
457e2170 1301 gMC->TrackMomentum(p);
1302 Float_t momentum = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
1303 Float_t precision = (momentum>0.1) ? 0.002 :0.01;
1304 fTrackHits->SetHitPrecision(precision);
1305 }
1306
1307 // Get also the track time for pileup simulation
1308 hits[4]=gMC->TrackTime();
1309
1310 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
1311
1312 } // step>0
1313 } //within sector's limits
1314 // Stemax calculation for the next step
1315 if(!gMC->IsTrackAlive()) return; // particle has disappeared
1316 Float_t pp;
1317 TLorentzVector mom;
1318 gMC->TrackMomentum(mom);
1319 Float_t ptot=mom.Rho();
1320 Float_t betaGamma = ptot/gMC->TrackMass();
1321
1322 Int_t pid=gMC->TrackPid();
1323 if((pid==kElectron || pid==kPositron) && ptot > 0.002)
1324 {
1325 pp = kprim*1.58; // electrons above 20 MeV/c are on the plateau!
1326 }
1327 else
1328 {
1329
1330 betaGamma = TMath::Max(betaGamma,(Float_t)7.e-3); // protection against too small bg
b40afa5e 1331 pp=kprim*AliMathBase::BetheBlochAleph(betaGamma);
457e2170 1332
1333 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
1334 }
1335
1336 Double_t rnd = gMC->GetRandom()->Rndm();
1337
1338 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
1339
1340
1341}
1342