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