]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCv2.cxx
par file fix
[u/mrichter/AliRoot.git] / TPC / AliTPCv2.cxx
CommitLineData
4c039060 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
88cb7938 16/* $Id$ */
4c039060 17
73042f01 18//
fe4da5cc 19///////////////////////////////////////////////////////////////////////////////
20// //
21// Time Projection Chamber version 2 -- detailed TPC and slow simulation //
22// //
23//Begin_Html
24/*
1439f98e 25<img src="picts/AliTPCv2Class.gif">
fe4da5cc 26*/
27//End_Html
28// //
29// //
30///////////////////////////////////////////////////////////////////////////////
116cbefd 31
d899e254 32//#include <stdlib.h>
fe4da5cc 33
88cb7938 34#include <TLorentzVector.h>
116cbefd 35#include <TPDGCode.h>
d9e80aca 36#include <TString.h>
f77f13c8 37#include "AliLog.h"
b40afa5e 38#include "AliMathBase.h"
e6add757 39#include "AliTrackReference.h"
73042f01 40#include "AliTPCParam.h"
4ed5dced 41#include "AliTPCTrackHitsV2.h"
116cbefd 42#include "AliTPCv2.h"
cdf69b9a 43#include "AliGeomManager.h"
c1637e41 44#include "TGeoVolume.h"
45#include "TGeoPcon.h"
46#include "TGeoTube.h"
c5d5037c 47#include "TGeoCone.h"
c1637e41 48#include "TGeoPgon.h"
49#include "TGeoTrd1.h"
50#include "TGeoCompositeShape.h"
51#include "TGeoPara.h"
1ac29fc4 52#include "TGeoPhysicalNode.h"
0f788f87 53#include "TGeoHalfSpace.h"
0f2ff24c 54#include "TTreeStream.h"
1ac29fc4 55
c1637e41 56ClassImp(AliTPCv2)
57
58//_____________________________________________________________________________
59AliTPCv2::AliTPCv2(const char *name, const char *title) :
e046d791 60 AliTPC(name, title),
61 fIdSens(0),
62 fIDrift(0),
63 fSecOld(0)
c1637e41 64{
65 //
66 // Standard constructor for Time Projection Chamber version 2
67 //
6a905708 68
37831078 69
c1637e41 70 SetBufferSize(128000);
79575d04 71
79575d04 72
db2fdcfb 73// if (fTPCParam)
74// fTPCParam->Write(fTPCParam->GetTitle());
c1637e41 75}
76
77//_____________________________________________________________________________
78void AliTPCv2::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
37831078 93
94 //----------------------------------------------------------
c1637e41 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
37831078 98 //----------------------------------------------------------
c1637e41 99 //
100 // tpc - this will be the mother volume
101 //
37831078 102
c1637e41 103 //
104 // here I define a volume TPC
105 // retrive the medium name with "TPC_" as a leading string
106 //
24c46a8e 107 TGeoPcon *tpc = new TGeoPcon(0.,360.,30); //30 sections
c1637e41 108 //
24c46a8e 109 tpc->DefineSection(0,-289.6,77.,278.);
110 tpc->DefineSection(1,-262.1,77.,278.);
c1637e41 111 //
24c46a8e 112 tpc->DefineSection(2,-262.1,83.1,278.);
113 tpc->DefineSection(3,-260.,83.1,278.);
c1637e41 114 //
24c46a8e 115 tpc->DefineSection(4,-260.,70.,278.);
116 tpc->DefineSection(5,-259.6,70.,278.);
c1637e41 117 //
24c46a8e 118 tpc->DefineSection(6,-259.6,68.1,278.);
119 tpc->DefineSection(7,-253.6,68.1,278.);
c1637e41 120 //
c5d5037c 121 tpc->DefineSection(8,-253.6,67.88,278.);//hs
122 tpc->DefineSection(9,-74.0,60.68,278.);// hs
c1637e41 123 //
24c46a8e 124 tpc->DefineSection(10,-74.0,60.1,278.);
125 tpc->DefineSection(11,-73.3,60.1,278.);
c1637e41 126 //
24c46a8e 127 tpc->DefineSection(12,-73.3,56.9,278.);
128 tpc->DefineSection(13,-68.5,56.9,278.);
c1637e41 129 //
24c46a8e 130 tpc->DefineSection(14,-68.5,60.,278.);
131 tpc->DefineSection(15,-64.7,60.,278.);
78134e48 132 //
24c46a8e 133 tpc->DefineSection(16,-64.7,56.9,278.);
134 tpc->DefineSection(17,73.3,56.9,278.);
78134e48 135 //
24c46a8e 136 tpc->DefineSection(18,73.3,60.1,278.);
137 tpc->DefineSection(19,74.0,60.1,278.);
efe14311 138 //
c5d5037c 139 tpc->DefineSection(20,74.0,60.68,278.);// hs
140 tpc->DefineSection(21,253.6,65.38,278.);// hs
efe14311 141 //
24c46a8e 142 tpc->DefineSection(22,253.6,65.6,278.);
143 tpc->DefineSection(23,259.6,65.6,278.);
4fb9bd37 144 //
24c46a8e 145 tpc->DefineSection(24,259.6,70.0,278.);
146 tpc->DefineSection(25,260.,70.0,278.);
4fb9bd37 147 //
24c46a8e 148 tpc->DefineSection(26,260.,83.1,278.);
149 tpc->DefineSection(27,262.1,83.1,278.);
150 //
151 tpc->DefineSection(28,262.1,77.,278);
152 tpc->DefineSection(29,289.6,77.,278.);
c1637e41 153 //
154 TGeoMedium *m1 = gGeoManager->GetMedium("TPC_Air");
155 TGeoVolume *v1 = new TGeoVolume("TPC_M",tpc,m1);
156 //
157 // drift volume - sensitive volume, extended beyond the
158 // endcaps, because of the alignment
159 //
160 TGeoPcon *dvol = new TGeoPcon(0.,360.,6);
161 dvol->DefineSection(0,-260.,74.5,264.4);
162 dvol->DefineSection(1,-253.6,74.5,264.4);
163 //
164 dvol->DefineSection(2,-253.6,76.6774,258.);
165 dvol->DefineSection(3,253.6,76.6774,258.);
166 //
167 dvol->DefineSection(4,253.6,74.5,264.4);
168 dvol->DefineSection(5,260.,74.5,264.4);
169 //
f3d601a5 170 TGeoMedium *m5 = gGeoManager->GetMedium("TPC_Ne-CO2-2");
c1637e41 171 TGeoVolume *v9 = new TGeoVolume("TPC_Drift",dvol,m5);
172 //
173 v1->AddNode(v9,1);
174 //
175 // outer insulator
176 //
177 TGeoPcon *tpco = new TGeoPcon(0.,360.,6); //insulator
178 //
179 tpco->DefineSection(0,-256.6,264.8,278.);
180 tpco->DefineSection(1,-253.6,264.8,278.);
181 //
182 tpco->DefineSection(2,-253.6,258.,278.);
183 tpco->DefineSection(3,250.6,258.,278.);
184 //
185 tpco->DefineSection(4,250.6,258.,275.5);
186 tpco->DefineSection(5,253.6,258.,275.5);
187 //
188 TGeoMedium *m2 = gGeoManager->GetMedium("TPC_CO2");
189 TGeoVolume *v2 = new TGeoVolume("TPC_OI",tpco,m2);
190 //
c449e944 191 TGeoRotation *segrot;//segment rotations
192 //
c1637e41 193 // outer containment vessel
194 //
195 TGeoPcon *tocv = new TGeoPcon(0.,360.,6); // containment vessel
196 //
197 tocv->DefineSection(0,-256.6,264.8,278.);
198 tocv->DefineSection(1,-253.6,264.8,278.);
199 //
200 tocv->DefineSection(2,-253.6,274.8124,278.);
201 tocv->DefineSection(3,247.6,274.8124,278.);
202 //
203 tocv->DefineSection(4,247.6,270.4,278.);
204 tocv->DefineSection(5,250.6,270.4,278.);
205 //
206 TGeoMedium *m3 = gGeoManager->GetMedium("TPC_Al");
207 TGeoVolume *v3 = new TGeoVolume("TPC_OCV",tocv,m3);
208 //
c449e944 209 TGeoTubeSeg *to1 = new TGeoTubeSeg(274.8174,277.995,252.1,0.,59.9); //epoxy
210 TGeoTubeSeg *to2 = new TGeoTubeSeg(274.8274,277.985,252.1,0.,59.9); //tedlar
211 TGeoTubeSeg *to3 = new TGeoTubeSeg(274.8312,277.9812,252.1,0.,59.9);//prepreg2
212 TGeoTubeSeg *to4 = new TGeoTubeSeg(274.9062,277.9062,252.1,0.,59.9);//nomex
213 TGeoTubeSeg *tog5 = new TGeoTubeSeg(274.8174,277.995,252.1,59.9,60.);//epoxy
c1637e41 214 //
215 TGeoMedium *sm1 = gGeoManager->GetMedium("TPC_Epoxy");
216 TGeoMedium *sm2 = gGeoManager->GetMedium("TPC_Tedlar");
217 TGeoMedium *sm3 = gGeoManager->GetMedium("TPC_Prepreg2");
218 TGeoMedium *sm4 = gGeoManager->GetMedium("TPC_Nomex");
219 //
220 TGeoVolume *tov1 = new TGeoVolume("TPC_OCV1",to1,sm1);
221 TGeoVolume *tov2 = new TGeoVolume("TPC_OCV2",to2,sm2);
222 TGeoVolume *tov3 = new TGeoVolume("TPC_OCV3",to3,sm3);
223 TGeoVolume *tov4 = new TGeoVolume("TPC_OCV4",to4,sm4);
c449e944 224 TGeoVolume *togv5 = new TGeoVolume("TPC_OCVG5",tog5,sm1);
c5d5037c 225 //
226 TGeoMedium *mhs = gGeoManager->GetMedium("TPC_Steel");
227 TGeoMedium *m12 = gGeoManager->GetMedium("TPC_Water");
c449e944 228 //-------------------------------------------------------
c1637e41 229 // Tpc Outer Field Cage
230 // daughters - composite (sandwich)
231 //-------------------------------------------------------
37831078 232
c1637e41 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
c449e944 246 TGeoTubeSeg *tf1 = new TGeoTubeSeg(258.0,260.0676,252.1,0.,59.9); //tedlar
247 TGeoTubeSeg *tf2 = new TGeoTubeSeg(258.0038,260.0638,252.1,0.,59.9); //prepreg3
248 TGeoTubeSeg *tf3 = new TGeoTubeSeg(258.0338,260.0338,252.1,0.,59.9);//nomex
249 TGeoTubeSeg *tfg4 = new TGeoTubeSeg(258.0,260.0676,252.1,59.9,60.); //epoxy glue
c1637e41 250 //
251 TGeoMedium *sm5 = gGeoManager->GetMedium("TPC_Prepreg3");
252 //
253 TGeoVolume *tf1v = new TGeoVolume("TPC_OFC1",tf1,sm2);
254 TGeoVolume *tf2v = new TGeoVolume("TPC_OFC2",tf2,sm5);
255 TGeoVolume *tf3v = new TGeoVolume("TPC_OFC3",tf3,sm4);
c449e944 256 TGeoVolume *tfg4v = new TGeoVolume("TPC_OFCG4",tfg4,sm1);
c1637e41 257 //
258 // outer part - positioning
259 //
c449e944 260 tov1->AddNode(tov2,1); tov2->AddNode(tov3,1); tov3->AddNode(tov4,1);//ocv
261 //
262 tf1v->AddNode(tf2v,1); tf2v->AddNode(tf3v,1);//ofc
c1637e41 263 //
c449e944 264 TGeoVolumeAssembly *t200 = new TGeoVolumeAssembly("TPC_OCVSEG");
265 TGeoVolumeAssembly *t300 = new TGeoVolumeAssembly("TPC_OFCSEG");
c1637e41 266 //
c449e944 267 // assembly OCV and OFC
268 //
269 // 1st - no rotation
270 t200->AddNode(tov1,1); t200->AddNode(togv5,1);
271 t300->AddNode(tf1v,1); t300->AddNode(tfg4v,1);
272 // 2nd - rotation 60 deg
273 segrot = new TGeoRotation();
274 segrot->RotateZ(60.);
275 t200->AddNode(tov1,2,segrot); t200->AddNode(togv5,2,segrot);
276 t300->AddNode(tf1v,2,segrot); t300->AddNode(tfg4v,2,segrot);
277 // 3rd rotation 120 deg
278 segrot = new TGeoRotation();
279 segrot->RotateZ(120.);
280 t200->AddNode(tov1,3,segrot); t200->AddNode(togv5,3,segrot);
281 t300->AddNode(tf1v,3,segrot); t300->AddNode(tfg4v,3,segrot);
282 //4th rotation 180 deg
283 segrot = new TGeoRotation();
284 segrot->RotateZ(180.);
285 t200->AddNode(tov1,4,segrot); t200->AddNode(togv5,4,segrot);
286 t300->AddNode(tf1v,4,segrot); t300->AddNode(tfg4v,4,segrot);
287 //5th rotation 240 deg
288 segrot = new TGeoRotation();
289 segrot->RotateZ(240.);
290 t200->AddNode(tov1,5,segrot); t200->AddNode(togv5,5,segrot);
291 t300->AddNode(tf1v,5,segrot); t300->AddNode(tfg4v,5,segrot);
292 //6th rotation 300 deg
293 segrot = new TGeoRotation();
294 segrot->RotateZ(300.);
295 t200->AddNode(tov1,6,segrot); t200->AddNode(togv5,6,segrot);
296 t300->AddNode(tf1v,6,segrot); t300->AddNode(tfg4v,6,segrot);
297 //
298 v3->AddNode(t200,1,new TGeoTranslation(0.,0.,-1.5)); v4->AddNode(t300,1);
c1637e41 299 //
300 v2->AddNode(v3,1); v2->AddNode(v4,1);
301 //
302 v1->AddNode(v2,1);
303 //--------------------------------------------------------------------
304 // Tpc Inner INsulator (CO2)
305 // the cones, the central drum and the inner f.c. sandwich with a piece
306 // of the flane will be placed in the TPC
307 //--------------------------------------------------------------------
308 TGeoPcon *tpci = new TGeoPcon(0.,360.,4);
309 //
310 tpci->DefineSection(0,-253.6,68.4,76.6774);
311 tpci->DefineSection(1,-74.0,61.2,76.6774);
312 //
313 tpci->DefineSection(2,74.0,61.2,76.6774);
314 //
315 tpci->DefineSection(3,253.6,65.9,76.6774);
316 //
317 TGeoVolume *v5 = new TGeoVolume("TPC_INI",tpci,m2);
318 //
319 // now the inner field cage - only part of flanges (2 copies)
320 //
321 TGeoTube *tif1 = new TGeoTube(69.9,76.6774,1.5);
322 TGeoVolume *v6 = new TGeoVolume("TPC_IFC1",tif1,m3);
323 //
324 //---------------------------------------------------------
325 // Tpc Inner Containment vessel - Muon side
326 //---------------------------------------------------------
327 TGeoPcon *tcms = new TGeoPcon(0.,360.,10);
328 //
329 tcms->DefineSection(0,-259.1,68.1,74.2);
330 tcms->DefineSection(1,-253.6,68.1,74.2);
331 //
332 tcms->DefineSection(2,-253.6,68.1,68.4);
333 tcms->DefineSection(3,-74.0,60.9,61.2);
334 //
335 tcms->DefineSection(4,-74.0,60.1,61.2);
336 tcms->DefineSection(5,-73.3,60.1,61.2);
337 //
338 tcms->DefineSection(6,-73.3,56.9,61.2);
339 tcms->DefineSection(7,-73.0,56.9,61.2);
340 //
341 tcms->DefineSection(8,-73.0,56.9,58.8);
342 tcms->DefineSection(9,-71.3,56.9,58.8);
343 //
344 TGeoVolume *v7 = new TGeoVolume("TPC_ICVM",tcms,m3);
c5d5037c 345 //------------------------------------------------
346 // Heat screen muon side
347 //------------------------------------------------
348
349 TGeoCone *thsm = new TGeoCone(89.8,67.88,68.1,60.68,60.9);
350 TGeoCone *thsmw = new TGeoCone(89.8,67.94,68.04,60.74,60.84);
351 TGeoVolume *hvsm = new TGeoVolume("TPC_HSM",thsm,mhs); //steel
352 TGeoVolume *hvsmw = new TGeoVolume("TPC_HSMW",thsmw,m12); //water
353 // assembly heat screen muon
354 hvsm->AddNode(hvsmw,1);
c1637e41 355 //-----------------------------------------------
356 // inner containment vessel - shaft side
357 //-----------------------------------------------
358 TGeoPcon *tcss = new TGeoPcon(0.,360.,10);
359 //
360 tcss->DefineSection(0,71.3,56.9,58.8);
361 tcss->DefineSection(1,73.0,56.9,58.8);
362 //
363 tcss->DefineSection(2,73.0,56.9,61.2);
364 tcss->DefineSection(3,73.3,56.9,61.2);
365 //
366 tcss->DefineSection(4,73.3,60.1,61.2);
367 tcss->DefineSection(5,74.0,60.1,61.2);
368 //
369 tcss->DefineSection(6,74.0,60.9,61.2);
370 tcss->DefineSection(7,253.6,65.6,65.9);
371 //
372 tcss->DefineSection(8,253.6,65.6,74.2);
373 tcss->DefineSection(9,258.1,65.6,74.2);
374 //
375 TGeoVolume *v8 = new TGeoVolume("TPC_ICVS",tcss,m3);
c5d5037c 376 //-------------------------------------------------
377 // Heat screen shaft side
378 //--------------------------------------------------
379 TGeoCone *thss = new TGeoCone(89.8,60.68,60.9,65.38,65.6);
380 TGeoCone *thssw = new TGeoCone(89.8,60.74,60.84,65.44,65.54);
381 TGeoVolume *hvss = new TGeoVolume("TPC_HSS",thss,mhs); //steel
382 TGeoVolume *hvssw = new TGeoVolume("TPC_HSSW",thssw,m12); //water
383 //assembly heat screen shaft
384 hvss->AddNode(hvssw,1);
c1637e41 385 //-----------------------------------------------
386 // Inner field cage
387 // define 4 parts and make an assembly
388 //-----------------------------------------------
389 // part1 - Al - 2 copies
390 TGeoTube *t1 = new TGeoTube(76.6774,78.845,0.75);
391 TGeoVolume *tv1 = new TGeoVolume("TPC_IFC2",t1,m3);
392 // sandwich - outermost parts - 2 copies
c1637e41 393 //
878dd3f2 394 // segment outermost
395 //
d56d7df1 396 TGeoTubeSeg *t2 = new TGeoTubeSeg(76.6774,78.845,74.175,350.,109.4); // tedlar 38 microns
397 TGeoTubeSeg *t3 = new TGeoTubeSeg(76.6812,78.8412,74.175,350.,109.4); // prepreg2 500 microns
398 TGeoTubeSeg *t4 = new TGeoTubeSeg(76.7312,78.7912,74.175,350.,109.4); // prepreg3 300 microns
399 TGeoTubeSeg *t5 = new TGeoTubeSeg(76.7612,78.7612,74.175,350.,109.4); // nomex 2 cm
400 TGeoTubeSeg *tepox1 = new TGeoTubeSeg(76.6774,78.845,74.175,109.4,110.);//epoxy
e079adac 401 TGeoTubeSeg *tpr1 = new TGeoTubeSeg(78.845,78.885,74.175,109.,111.);
878dd3f2 402
403 // volumes for the outer part
c1637e41 404 TGeoVolume *tv2 = new TGeoVolume("TPC_IFC3",t2,sm2);
405 TGeoVolume *tv3 = new TGeoVolume("TPC_IFC4",t3,sm3);
406 TGeoVolume *tv4 = new TGeoVolume("TPC_IFC5",t4,sm5);
407 TGeoVolume *tv5 = new TGeoVolume("TPC_IFC6",t5,sm4);
878dd3f2 408 TGeoVolume *tvep1 = new TGeoVolume("TPC_IFEPOX1",tepox1,sm1);
409 TGeoVolume *tvpr1 = new TGeoVolume("TPC_PRSTR1",tpr1,sm2);
c1637e41 410 //
411 // middle parts - 2 copies
c1637e41 412 //
878dd3f2 413 // segment middle
414 //
d56d7df1 415 TGeoTubeSeg *t6 = new TGeoTubeSeg(76.6774,78.795,5.,350.,109.4); // tedlar 38 microns
416 TGeoTubeSeg *t7 = new TGeoTubeSeg(76.6812,78.7912,5.,350.,109.4); // prepreg2 250 microns
417 TGeoTubeSeg *t8 = new TGeoTubeSeg(76.7062,78.7662,5.,350.,109.4); // prepreg3 300 microns
418 TGeoTubeSeg *t9 = new TGeoTubeSeg(76.7362,78.7362,5.,350.,109.4); // nomex 2 cm
419 TGeoTubeSeg *tepox2 = new TGeoTubeSeg(76.6774,78.795,5.,109.4,110.);//epoxy
e079adac 420 TGeoTubeSeg *tpr2 = new TGeoTubeSeg(78.795,78.835,5.,109.,111.);
878dd3f2 421 // volumes for the middle part
c1637e41 422 TGeoVolume *tv6 = new TGeoVolume("TPC_IFC7",t6,sm2);
423 TGeoVolume *tv7 = new TGeoVolume("TPC_IFC8",t7,sm3);
424 TGeoVolume *tv8 = new TGeoVolume("TPC_IFC9",t8,sm5);
425 TGeoVolume *tv9 = new TGeoVolume("TPC_IFC10",t9,sm4);
878dd3f2 426 TGeoVolume *tvep2 = new TGeoVolume("TPC_IFEPOX2",tepox2,sm1);
427 TGeoVolume *tvpr2 = new TGeoVolume("TPC_PRSTR2",tpr2,sm2);
c1637e41 428 // central part - 1 copy
878dd3f2 429 //
430 // segment central part
431 //
d56d7df1 432 TGeoTubeSeg *t10 = new TGeoTubeSeg(76.6774,78.785,93.75,350.,109.4); // tedlar 38 microns
433 TGeoTubeSeg *t11 = new TGeoTubeSeg(76.6812,78.7812,93.75,350.,109.4); // prepreg3 500 microns
434 TGeoTubeSeg *t12 = new TGeoTubeSeg(76.7312,78.7312,93.75,350.,109.4); // nomex 2 cm
435 TGeoTubeSeg *tepox3 = new TGeoTubeSeg(76.6774,78.785,93.75,109.4,110.);//epoxy
e079adac 436 TGeoTubeSeg *tpr3 = new TGeoTubeSeg(78.785,78.825,93.75,109.,111.);
878dd3f2 437 // volumes for the central part
c1637e41 438 TGeoVolume *tv10 = new TGeoVolume("TPC_IFC11",t10,sm2);
439 TGeoVolume *tv11 = new TGeoVolume("TPC_IFC12",t11,sm5);
440 TGeoVolume *tv12 = new TGeoVolume("TPC_IFC13",t12,sm4);
878dd3f2 441 TGeoVolume *tvep3 = new TGeoVolume("TPC_IFEPOX3",tepox3,sm1);
442 TGeoVolume *tvpr3 = new TGeoVolume("TPC_PRSTR3",tpr3,sm2);
c1637e41 443 //
878dd3f2 444 // creating a sandwich for the outer par,t tv2 is the mother
c1637e41 445 //
c1637e41 446 tv2->AddNode(tv3,1); tv3->AddNode(tv4,1); tv4->AddNode(tv5,1);
447 //
878dd3f2 448 // creating a sandwich for the middle part, tv6 is the mother
449 //
c1637e41 450 tv6->AddNode(tv7,1); tv7->AddNode(tv8,1); tv8->AddNode(tv9,1);
451 //
878dd3f2 452 // creating a sandwich for the central part, tv10 is the mother
453 //
c1637e41 454 tv10->AddNode(tv11,1); tv11->AddNode(tv12,1);
455 //
878dd3f2 456 TGeoVolumeAssembly *tv100 = new TGeoVolumeAssembly("TPC_IFC"); // ifc itself - 3 segments
878dd3f2 457
c1637e41 458 //
878dd3f2 459 // first segment - no rotation
460 //
461 // central
462 tv100->AddNode(tv10,1); //sandwich
463 tv100->AddNode(tvep3,1);//epoxy
464 tv100->AddNode(tvpr3,1);//prepreg strip
465 // middle
466 tv100->AddNode(tv6,1,new TGeoTranslation(0.,0.,-98.75)); //sandwich1
467 tv100->AddNode(tv6,2,new TGeoTranslation(0.,0.,98.75)); // sandwich2
468 tv100->AddNode(tvep2,1,new TGeoTranslation(0.,0.,-98.75)); //epoxy
469 tv100->AddNode(tvep2,2,new TGeoTranslation(0.,0.,98.75)); //epoxy
470 tv100->AddNode(tvpr2,1,new TGeoTranslation(0.,0.,-98.75));//prepreg strip
471 tv100->AddNode(tvpr2,2,new TGeoTranslation(0.,0.,98.75));
472 // outer
473 tv100->AddNode(tv2,1,new TGeoTranslation(0.,0.,-177.925)); //sandwich
c1637e41 474 tv100->AddNode(tv2,2,new TGeoTranslation(0.,0.,177.925));
878dd3f2 475 tv100->AddNode(tvep1,1,new TGeoTranslation(0.,0.,-177.925)); //epoxy
476 tv100->AddNode(tvep1,2,new TGeoTranslation(0.,0.,177.925));
477 tv100->AddNode(tvpr1,1,new TGeoTranslation(0.,0.,-177.925));//prepreg strip
478 tv100->AddNode(tvpr1,2,new TGeoTranslation(0.,0.,-177.925));
479 //
480 // second segment - rotation 120 deg.
481 //
482 segrot = new TGeoRotation();
483 segrot->RotateZ(120.);
484 //
485 // central
486 tv100->AddNode(tv10,2,segrot); //sandwich
487 tv100->AddNode(tvep3,2,segrot);//epoxy
488 tv100->AddNode(tvpr3,2,segrot);//prepreg strip
489 // middle
490 tv100->AddNode(tv6,3,new TGeoCombiTrans(0.,0.,-98.75,segrot)); //sandwich1
491 tv100->AddNode(tv6,4,new TGeoCombiTrans(0.,0.,98.75,segrot)); // sandwich2
492 tv100->AddNode(tvep2,3,new TGeoCombiTrans(0.,0.,-98.75,segrot)); //epoxy
493 tv100->AddNode(tvep2,4,new TGeoCombiTrans(0.,0.,98.75,segrot)); //epoxy
494 tv100->AddNode(tvpr2,3,new TGeoCombiTrans(0.,0.,-98.75,segrot));//prepreg strip
495 tv100->AddNode(tvpr2,4,new TGeoCombiTrans(0.,0.,98.75,segrot));
496 //outer
497 tv100->AddNode(tv2,3,new TGeoCombiTrans(0.,0.,-177.925,segrot));//sandwich
498 tv100->AddNode(tv2,4,new TGeoCombiTrans(0.,0.,177.925,segrot));
499 tv100->AddNode(tvep1,3,new TGeoCombiTrans(0.,0.,-177.925,segrot));//epoxy
500 tv100->AddNode(tvep1,4,new TGeoCombiTrans(0.,0.,177.925,segrot));
501 tv100->AddNode(tvpr1,3,new TGeoCombiTrans(0.,0.,-177.925,segrot));//prepreg strip
502 tv100->AddNode(tvpr1,4,new TGeoCombiTrans(0.,0.,177.925,segrot));
503 //
504 // third segment - rotation 240 deg.
505 //
506 segrot = new TGeoRotation();
507 segrot->RotateZ(240.);
508 //
509 // central
510 tv100->AddNode(tv10,3,segrot); //sandwich
511 tv100->AddNode(tvep3,3,segrot);//epoxy
512 tv100->AddNode(tvpr3,3,segrot);//prepreg strip
513 // middle
514 tv100->AddNode(tv6,5,new TGeoCombiTrans(0.,0.,-98.75,segrot)); //sandwich1
515 tv100->AddNode(tv6,6,new TGeoCombiTrans(0.,0.,98.75,segrot)); // sandwich2
516 tv100->AddNode(tvep2,5,new TGeoCombiTrans(0.,0.,-98.75,segrot)); //epoxy
517 tv100->AddNode(tvep2,6,new TGeoCombiTrans(0.,0.,98.75,segrot)); //epoxy
518 tv100->AddNode(tvpr2,5,new TGeoCombiTrans(0.,0.,-98.75,segrot));//prepreg strip
519 tv100->AddNode(tvpr2,6,new TGeoCombiTrans(0.,0.,98.75,segrot));
520 //outer
521 tv100->AddNode(tv2,5,new TGeoCombiTrans(0.,0.,-177.925,segrot));//sandwich
522 tv100->AddNode(tv2,6,new TGeoCombiTrans(0.,0.,177.925,segrot));
523 tv100->AddNode(tvep1,5,new TGeoCombiTrans(0.,0.,-177.925,segrot));//epoxy
524 tv100->AddNode(tvep1,6,new TGeoCombiTrans(0.,0.,177.925,segrot));
525 tv100->AddNode(tvpr1,5,new TGeoCombiTrans(0.,0.,-177.925,segrot));//prepreg strip
526 tv100->AddNode(tvpr1,6,new TGeoCombiTrans(0.,0.,177.925,segrot));
527 // Al parts - rings
c1637e41 528 tv100->AddNode(tv1,1,new TGeoTranslation(0.,0.,-252.85));
529 tv100->AddNode(tv1,2,new TGeoTranslation(0.,0.,252.85));
530 //
531 v5->AddNode(v6,1, new TGeoTranslation(0.,0.,-252.1));
532 v5->AddNode(v6,2, new TGeoTranslation(0.,0.,252.1));
533 v1->AddNode(v5,1); v1->AddNode(v7,1); v1->AddNode(v8,1);
c5d5037c 534 v1->AddNode(hvsm,1,new TGeoTranslation(0.,0.,-163.8));
535 v1->AddNode(hvss,1,new TGeoTranslation(0.,0.,163.8));
c1637e41 536 v9->AddNode(tv100,1);
537 //
538 // central drum
539 //
540 // flange + sandwich
541 //
542 TGeoPcon *cfl = new TGeoPcon(0.,360.,6);
543 cfl->DefineSection(0,-71.1,59.7,61.2);
544 cfl->DefineSection(1,-68.6,59.7,61.2);
545 //
efbf94c5 546 cfl->DefineSection(2,-68.6,60.6124,61.2);
547 cfl->DefineSection(3,68.6,60.6124,61.2);
c1637e41 548 //
549 cfl->DefineSection(4,68.6,59.7,61.2);
550 cfl->DefineSection(5,71.1,59.7,61.2);
551 //
552 TGeoVolume *cflv = new TGeoVolume("TPC_CDR",cfl,m3);
553 // sandwich
d56d7df1 554 TGeoTubeSeg *cd1 = new TGeoTubeSeg(60.6224,61.19,71.1,0.1,119.9);
555 TGeoTubeSeg *cd2 = new TGeoTubeSeg(60.6262,61.1862,71.1,0.1,119.9);
556 TGeoTubeSeg *cd3 = new TGeoTubeSeg(60.6462,61.1662,71.1,0.1,119.9);
557 TGeoTubeSeg *cd4 = new TGeoTubeSeg(60.6562,61.1562,71.1,0.1,119.9);
558 TGeoTubeSeg *tepox4 = new TGeoTubeSeg(60.6224,61.19,71.1,359.9,0.1);
559 // TGeoTube *cd1 = new TGeoTube(60.6224,61.19,71.1);
560 // TGeoTube *cd2 = new TGeoTube(60.6262,61.1862,71.1);
561 // TGeoTube *cd3 = new TGeoTube(60.6462,61.1662,71.1);
562 // TGeoTube *cd4 = new TGeoTube(60.6562,61.1562,71.1);
c1637e41 563 //
564 TGeoMedium *sm6 = gGeoManager->GetMedium("TPC_Prepreg1");
efbf94c5 565 TGeoMedium *sm8 = gGeoManager->GetMedium("TPC_Epoxyfm");
c1637e41 566 TGeoVolume *cd1v = new TGeoVolume("TPC_CDR1",cd1,sm2); //tedlar
567 TGeoVolume *cd2v = new TGeoVolume("TPC_CDR2",cd2,sm6);// prepreg1
efbf94c5 568 TGeoVolume *cd3v = new TGeoVolume("TPC_CDR3",cd3,sm8); //epoxy film
569 TGeoVolume *cd4v = new TGeoVolume("TPC_CDR4",cd4,sm4); //nomex
d56d7df1 570 TGeoVolume *tvep4 = new TGeoVolume("TPC_IFEPOX4",tepox4,sm1);
efbf94c5 571
c1637e41 572 //
573 // seals for central drum 2 copies
574 //
575 TGeoTube *cs = new TGeoTube(56.9,61.2,0.1);
576 TGeoMedium *sm7 = gGeoManager->GetMedium("TPC_Mylar");
577 TGeoVolume *csv = new TGeoVolume("TPC_CDRS",cs,sm7);
3378c058 578 v1->AddNode(csv,1,new TGeoTranslation(0.,0.,-71.2));
579 v1->AddNode(csv,2,new TGeoTranslation(0.,0.,71.2));
c1637e41 580 //
581 // seal collars
582 TGeoPcon *se = new TGeoPcon(0.,360.,6);
583 se->DefineSection(0,-72.8,59.7,61.2);
584 se->DefineSection(1,-72.3,59.7,61.2);
585 //
586 se->DefineSection(2,-72.3,58.85,61.2);
587 se->DefineSection(3,-71.6,58.85,61.2);
588 //
589 se->DefineSection(4,-71.6,59.7,61.2);
590 se->DefineSection(5,-71.3,59.7,61.2);
591 //
592 TGeoVolume *sev = new TGeoVolume("TPC_CDCE",se,m3);
593 //
594 TGeoTube *si = new TGeoTube(56.9,58.8,1.);
595 TGeoVolume *siv = new TGeoVolume("TPC_CDCI",si,m3);
596 //
597 // define reflection matrix
598 //
4fa47888 599 TGeoRotation *ref = new TGeoRotation("ref",90.,0.,90.,90.,180.,0.);
c1637e41 600 //
d56d7df1 601 cd1v->AddNode(cd2v,1); cd2v->AddNode(cd3v,1); cd3v->AddNode(cd4v,1); //sandwich
602 // first segment
603 cflv->AddNode(cd1v,1); cflv->AddNode(tvep4,1);
604 // second segment
605 segrot = new TGeoRotation();
606 segrot->RotateZ(120.);
607 cflv->AddNode(cd1v,2,segrot); cflv->AddNode(tvep4,2,segrot);
608 // third segment
609 segrot = new TGeoRotation();
610 segrot->RotateZ(240.);
611 cflv->AddNode(cd1v,3,segrot); cflv->AddNode(tvep4,3,segrot);
c1637e41 612 //
a1ec4d07 613 v1->AddNode(siv,1,new TGeoTranslation(0.,0.,-69.9));
614 v1->AddNode(siv,2,new TGeoTranslation(0.,0.,69.9));
c1637e41 615 v1->AddNode(sev,1); v1->AddNode(sev,2,ref); v1->AddNode(cflv,1);
616 //
617 // central membrane - 2 rings and a mylar membrane - assembly
618 //
cf84f9b1 619 TGeoTube *ih = new TGeoTube(81.05,84.05,0.3);
620 TGeoTube *oh = new TGeoTube(250.,256.,0.5);
4236db1b 621 TGeoTube *mem = new TGeoTube(84.05,250.,0.00115);
c449e944 622
623 //
624 TGeoMedium *m4 = gGeoManager->GetMedium("TPC_G10");
625 //
c1637e41 626 TGeoVolume *ihv = new TGeoVolume("TPC_IHVH",ih,m3);
627 TGeoVolume *ohv = new TGeoVolume("TPC_OHVH",oh,m3);
c449e944 628
c1637e41 629 TGeoVolume *memv = new TGeoVolume("TPC_HV",mem,sm7);
630 //
631 TGeoVolumeAssembly *cm = new TGeoVolumeAssembly("TPC_HVMEM");
632 cm->AddNode(ihv,1);
633 cm->AddNode(ohv,1);
634 cm->AddNode(memv,1);
c449e944 635
c1637e41 636 v9->AddNode(cm,1);
637 //
638 // end caps - they are make as an assembly of single segments
639 // containing both readout chambers
640 //
d899e254 641 Double_t openingAngle = 10.*TMath::DegToRad();
c1637e41 642 Double_t thick=1.5; // rib
d899e254 643 Double_t shift = thick/TMath::Sin(openingAngle);
c1637e41 644 //
d899e254 645 Double_t lowEdge = 86.3; // hole in the wheel
646 Double_t upEdge = 240.4; // hole in the wheel
c1637e41 647 //
648 new TGeoTubeSeg("sec",74.5,264.4,3.,0.,20.);
649 //
650 TGeoPgon *hole = new TGeoPgon("hole",0.,20.,1,4);
651 //
d899e254 652 hole->DefineSection(0,-3.5,lowEdge-shift,upEdge-shift);
653 hole->DefineSection(1,-1.5,lowEdge-shift,upEdge-shift);
c1637e41 654 //
d899e254 655 hole->DefineSection(2,-1.5,lowEdge-shift,upEdge+3.-shift);
656 hole->DefineSection(3,3.5,lowEdge-shift,upEdge+3.-shift);
c1637e41 657 //
d899e254 658 Double_t ys = shift*TMath::Sin(openingAngle);
659 Double_t xs = shift*TMath::Cos(openingAngle);
c1637e41 660 TGeoTranslation *tr = new TGeoTranslation("tr",xs,ys,0.);
661 tr->RegisterYourself();
662 TGeoCompositeShape *chamber = new TGeoCompositeShape("sec-hole:tr");
663 TGeoVolume *sv = new TGeoVolume("TPC_WSEG",chamber,m3);
664 TGeoPgon *bar = new TGeoPgon("bar",0.,20.,1,2);
665 bar->DefineSection(0,-3.,131.5-shift,136.5-shift);
666 bar->DefineSection(1,1.5,131.5-shift,136.5-shift);
667 TGeoVolume *barv = new TGeoVolume("TPC_WBAR",bar,m3);
668 TGeoVolumeAssembly *ch = new TGeoVolumeAssembly("TPC_WCH");//empty segment
669 //
670 ch->AddNode(sv,1); ch->AddNode(barv,1,tr);
671 //
672 // readout chambers
673 //
674 // IROC first
675 //
676 TGeoTrd1 *ibody = new TGeoTrd1(13.8742,21.3328,4.29,21.15);
677 TGeoVolume *ibdv = new TGeoVolume("TPC_IROCB",ibody,m3);
678 // empty space
679 TGeoTrd1 *emp = new TGeoTrd1(12.3742,19.8328,3.99,19.65);
680 TGeoVolume *empv = new TGeoVolume("TPC_IROCE",emp,m1);
681 ibdv->AddNode(empv,1,new TGeoTranslation(0.,-0.3,0.));
682 //bars
683 Double_t tga = (19.8328-12.3742)/39.3;
684 Double_t xmin,xmax;
685 xmin = 9.55*tga+12.3742;
686 xmax = 9.95*tga+12.3742;
687 TGeoTrd1 *ib1 = new TGeoTrd1(xmin,xmax,3.29,0.2);
688 TGeoVolume *ib1v = new TGeoVolume("TPC_IRB1",ib1,m3);
689 empv->AddNode(ib1v,1,new TGeoTranslation("tt1",0.,0.7,-9.9));
690 xmin=19.4*tga+12.3742;
691 xmax=19.9*tga+12.3742;
692 TGeoTrd1 *ib2 = new TGeoTrd1(xmin,xmax,3.29,0.25);
693 TGeoVolume *ib2v = new TGeoVolume("TPC_TRB2",ib2,m3);
694 empv->AddNode(ib2v,1,new TGeoTranslation(0.,0.7,0.));
695 xmin=29.35*tga+12.3742;
696 xmax=29.75*tga+12.3742;
697 TGeoTrd1 *ib3 = new TGeoTrd1(xmin,xmax,3.29,0.2);
698 TGeoVolume *ib3v = new TGeoVolume("TPC_IRB3",ib3,m3);
699 empv->AddNode(ib3v,1,new TGeoTranslation(0.,0.7,9.9));
700 //
701 // holes for connectors
702 //
703 TGeoBBox *conn = new TGeoBBox(0.4,0.3,4.675); // identical for iroc and oroc
704 TGeoVolume *connv = new TGeoVolume("TPC_RCCON",conn,m1);
d9e80aca 705 TString fileName(gSystem->Getenv("ALICE_ROOT"));
706 fileName += "/TPC/conn_iroc.dat";
c1637e41 707 ifstream in;
d9e80aca 708 in.open(fileName.Data(), ios_base::in); // asci file
2d1d58a6 709 TGeoRotation *rrr[86];
c1637e41 710 for(Int_t i =0;i<86;i++){
456cb019 711 Double_t y = 3.99;
c1637e41 712 Double_t x,z,ang;
713 in>>x>>z>>ang;
456cb019 714 z-=26.5;
2d1d58a6 715 rrr[i]= new TGeoRotation();
716 rrr[i]->RotateY(ang);
717 ibdv->AddNode(connv,i+1,new TGeoCombiTrans(x,y,z,rrr[i]));
c1637e41 718 }
719 in.close();
720 // "cap"
721 new TGeoTrd1("icap",14.5974,23.3521,1.19,24.825);
722 // "hole"
723 new TGeoTrd1("ihole",13.8742,21.3328,1.2,21.15);
724 TGeoTranslation *tr1 = new TGeoTranslation("tr1",0.,0.,1.725);
725 tr1->RegisterYourself();
726 TGeoCompositeShape *ic = new TGeoCompositeShape("icap-ihole:tr1");
727 TGeoVolume *icv = new TGeoVolume("TPC_IRCAP",ic,m3);
728 //
729 // pad plane and wire fixations
730 //
731 TGeoTrd1 *pp = new TGeoTrd1(14.5974,23.3521,0.3,24.825); //pad+iso
c1637e41 732 TGeoVolume *ppv = new TGeoVolume("TPC_IRPP",pp,m4);
733 TGeoPara *f1 = new TGeoPara(.6,.5,24.825,0.,-10.,0.);
734 TGeoVolume *f1v = new TGeoVolume("TPC_IRF1",f1,m4);
735 TGeoPara *f2 = new TGeoPara(.6,.5,24.825,0.,10.,0.);
736 TGeoVolume *f2v = new TGeoVolume("TPC_IRF2",f2,m4);
737 //
738 TGeoVolumeAssembly *iroc = new TGeoVolumeAssembly("TPC_IROC");
739 //
740 iroc->AddNode(ibdv,1);
741 iroc->AddNode(icv,1,new TGeoTranslation(0.,3.1,-1.725));
742 iroc->AddNode(ppv,1,new TGeoTranslation(0.,4.59,-1.725));
743 tga =(23.3521-14.5974)/49.65;
744 Double_t xx = 24.825*tga+14.5974-0.6;
745 iroc->AddNode(f1v,1,new TGeoTranslation(-xx,5.39,-1.725));
746 iroc->AddNode(f2v,1,new TGeoTranslation(xx,5.39,-1.725));
747 //
748 // OROC
749 //
750 TGeoTrd1 *obody = new TGeoTrd1(22.2938,40.5084,4.19,51.65);
751 TGeoVolume *obdv = new TGeoVolume("TPC_OROCB",obody,m3);
752 TGeoTrd1 *oemp = new TGeoTrd1(20.2938,38.5084,3.89,49.65);
753 TGeoVolume *oempv = new TGeoVolume("TPC_OROCE",oemp,m1);
754 obdv->AddNode(oempv,1,new TGeoTranslation(0.,-0.3,0.));
755 //horizontal bars
756 tga=(38.5084-20.2938)/99.3;
757 xmin=tga*10.2+20.2938;
758 xmax=tga*10.6+20.2938;
759 TGeoTrd1 *ob1 = new TGeoTrd1(xmin,xmax,2.915,0.2);
760 TGeoVolume *ob1v = new TGeoVolume("TPC_ORB1",ob1,m3);
761 //
762 xmin=22.55*tga+20.2938;
763 xmax=24.15*tga+20.2938;
764 TGeoTrd1 *ob2 = new TGeoTrd1(xmin,xmax,2.915,0.8);
765 TGeoVolume *ob2v = new TGeoVolume("TPC_ORB2",ob2,m3);
766 //
767 xmin=36.1*tga+20.2938;
768 xmax=36.5*tga+20.2938;
769 TGeoTrd1 *ob3 = new TGeoTrd1(xmin,xmax,2.915,0.2);
770 TGeoVolume *ob3v = new TGeoVolume("TPC_ORB3",ob3,m3);
771 //
772 xmin=49.0*tga+20.2938;
773 xmax=50.6*tga+20.2938;
774 TGeoTrd1 *ob4 = new TGeoTrd1(xmin,xmax,2.915,0.8);
775 TGeoVolume *ob4v = new TGeoVolume("TPC_ORB4",ob4,m3);
776 //
777 xmin=63.6*tga+20.2938;
778 xmax=64.0*tga+20.2938;
779 TGeoTrd1 *ob5 = new TGeoTrd1(xmin,xmax,2.915,0.2);
780 TGeoVolume *ob5v = new TGeoVolume("TPC_ORB5",ob5,m3);
781 //
782 xmin=75.5*tga+20.2938;
783 xmax=77.15*tga+20.2938;
784 TGeoTrd1 *ob6 = new TGeoTrd1(xmin,xmax,2.915,0.8);
785 TGeoVolume *ob6v = new TGeoVolume("TPC_ORB6",ob6,m3);
786 //
787 xmin=88.7*tga+20.2938;
788 xmax=89.1*tga+20.2938;
789 TGeoTrd1 *ob7 = new TGeoTrd1(xmin,xmax,2.915,0.2);
790 TGeoVolume *ob7v = new TGeoVolume("TPC_ORB7",ob7,m3);
791 //
792 oempv->AddNode(ob1v,1,new TGeoTranslation(0.,0.975,-39.25));
793 oempv->AddNode(ob2v,1,new TGeoTranslation(0.,0.975,-26.3));
794 oempv->AddNode(ob3v,1,new TGeoTranslation(0.,0.975,-13.35));
795 oempv->AddNode(ob4v,1,new TGeoTranslation(0.,0.975,0.15));
796 oempv->AddNode(ob5v,1,new TGeoTranslation(0.,0.975,14.15));
797 oempv->AddNode(ob6v,1,new TGeoTranslation(0.,0.975,26.7));
798 oempv->AddNode(ob7v,1,new TGeoTranslation(0.,0.975,39.25));
799 // vertical bars
800 TGeoBBox *ob8 = new TGeoBBox(0.8,2.915,5.1);
801 TGeoBBox *ob9 = new TGeoBBox(0.8,2.915,5.975);
802 TGeoBBox *ob10 = new TGeoBBox(0.8,2.915,5.775);
803 TGeoBBox *ob11 = new TGeoBBox(0.8,2.915,6.25);
804 TGeoBBox *ob12 = new TGeoBBox(0.8,2.915,6.5);
805 //
806 TGeoVolume *ob8v = new TGeoVolume("TPC_ORB8",ob8,m3);
807 TGeoVolume *ob9v = new TGeoVolume("TPC_ORB9",ob9,m3);
808 TGeoVolume *ob10v = new TGeoVolume("TPC_ORB10",ob10,m3);
809 TGeoVolume *ob11v = new TGeoVolume("TPC_ORB11",ob11,m3);
810 TGeoVolume *ob12v = new TGeoVolume("TPC_ORB12",ob12,m3);
811 //
812 oempv->AddNode(ob8v,1,new TGeoTranslation(0.,0.975,-44.55));
813 oempv->AddNode(ob8v,2,new TGeoTranslation(0.,0.975,44.55));
814 oempv->AddNode(ob9v,1,new TGeoTranslation(0.,0.975,-33.075));
815 oempv->AddNode(ob9v,2,new TGeoTranslation(0.,0.975,-19.525));
816 oempv->AddNode(ob10v,1,new TGeoTranslation(0.,0.975,20.125));
817 oempv->AddNode(ob10v,2,new TGeoTranslation(0.,0.975,33.275));
818 oempv->AddNode(ob11v,1,new TGeoTranslation(0.,0.975,-6.9));
819 oempv->AddNode(ob12v,1,new TGeoTranslation(0.,0.975,7.45));
820 //
821 // holes for connectors
822 //
d9e80aca 823 fileName = gSystem->Getenv("ALICE_ROOT");
824 fileName += "/TPC/conn_oroc.dat";
825 in.open(fileName.Data(), ios_base::in); // asci file
2d1d58a6 826 TGeoRotation *rr[78];
c1637e41 827 for(Int_t i =0;i<78;i++){
828 Double_t y =3.89;
829 Double_t x,z,ang;
830 Double_t x1,z1,x2,z2;
831 in>>x>>z>>ang;
832 Double_t xr = 4.7*TMath::Sin(ang*TMath::DegToRad());
833 Double_t zr = 4.7*TMath::Cos(ang*TMath::DegToRad());
834 //
835 x1=xr+x; x2=-xr+x; z1=zr+z; z2 = -zr+z;
836 //
2d1d58a6 837 rr[i]= new TGeoRotation();
838 rr[i]->RotateY(ang);
c1637e41 839 z1-=54.95;
840 z2-=54.95;
5f174279 841 //
2d1d58a6 842 obdv->AddNode(connv,i+1,new TGeoCombiTrans(x1,y,z1,rr[i]));
843 obdv->AddNode(connv,i+79,new TGeoCombiTrans(x2,y,z2,rr[i]));
c1637e41 844 }
845 in.close();
846 // cap
847 new TGeoTrd1("ocap",23.3874,43.5239,1.09,57.1);
848 new TGeoTrd1("ohole",22.2938,40.5084,1.09,51.65);
849 TGeoTranslation *tr5 = new TGeoTranslation("tr5",0.,0.,-2.15);
850 tr5->RegisterYourself();
851 TGeoCompositeShape *oc = new TGeoCompositeShape("ocap-ohole:tr5");
852 TGeoVolume *ocv = new TGeoVolume("TPC_ORCAP",oc,m3);
853 //
854 // pad plane and wire fixations
855 //
856 TGeoTrd1 *opp = new TGeoTrd1(23.3874,43.5239,0.3,57.1);
857 TGeoVolume *oppv = new TGeoVolume("TPC_ORPP",opp,m4);
858 //
859 tga=(43.5239-23.3874)/114.2;
860 TGeoPara *f3 = new TGeoPara(.7,.6,57.1,0.,-10.,0.);
861 TGeoPara *f4 = new TGeoPara(.7,.6,57.1,0.,10.,0.);
862 xx = 57.1*tga+23.3874-0.7;
863 TGeoVolume *f3v = new TGeoVolume("TPC_ORF1",f3,m4);
864 TGeoVolume *f4v = new TGeoVolume("TPC_ORF2",f4,m4);
865 //
866 TGeoVolumeAssembly *oroc = new TGeoVolumeAssembly("TPC_OROC");
867 //
868 oroc->AddNode(obdv,1);
869 oroc->AddNode(ocv,1,new TGeoTranslation(0.,3.1,2.15));
870 oroc->AddNode(oppv,1,new TGeoTranslation(0.,4.49,2.15));
871 oroc->AddNode(f3v,1,new TGeoTranslation(-xx,5.39,2.15));
872 oroc->AddNode(f4v,1,new TGeoTranslation(xx,5.39,2.15));
873 //
874 // now iroc and oroc are placed into a sector...
875 //
a1ec4d07 876 TGeoVolumeAssembly *secta = new TGeoVolumeAssembly("TPC_SECT"); // a-side
877 TGeoVolumeAssembly *sectc = new TGeoVolumeAssembly("TPC_SECT"); // c-side
c1637e41 878 TGeoRotation rot1("rot1",90.,90.,0.);
879 TGeoRotation rot2("rot2");
880 rot2.RotateY(10.);
881 TGeoRotation *rot = new TGeoRotation("rot");
882 *rot=rot1*rot2;
883 //
884 Double_t x0,y0;
d899e254 885 x0=110.2*TMath::Cos(openingAngle);
886 y0=110.2*TMath::Sin(openingAngle);
1bae4c82 887 TGeoCombiTrans *combi1a = new TGeoCombiTrans("combi1",x0,y0,1.09+0.195,rot); //a-side
888 TGeoCombiTrans *combi1c = new TGeoCombiTrans("combi1",x0,y0,1.09+0.222,rot); //c-side
d899e254 889 x0=188.45*TMath::Cos(openingAngle);
890 y0=188.45*TMath::Sin(openingAngle);
1bae4c82 891 TGeoCombiTrans *combi2a = new TGeoCombiTrans("combi2",x0,y0,0.99+0.195,rot); //a-side
892 TGeoCombiTrans *combi2c = new TGeoCombiTrans("combi2",x0,y0,0.99+0.222,rot); //c-side
c1637e41 893 //
c1637e41 894 //
a1ec4d07 895 // A-side
c1637e41 896 //
a1ec4d07 897 secta->AddNode(ch,1);
898 secta->AddNode(iroc,1,combi1a);
899 secta->AddNode(oroc,1,combi2a);
900 //
901 // C-side
902 //
903 sectc->AddNode(ch,1);
904 sectc->AddNode(iroc,1,combi1c);
905 sectc->AddNode(oroc,1,combi2c);
906 //
907 // now I try to make wheels...
908 //
909 TGeoVolumeAssembly *wheela = new TGeoVolumeAssembly("TPC_ENDCAP");
910 TGeoVolumeAssembly *wheelc = new TGeoVolumeAssembly("TPC_ENDCAP");
c1637e41 911 //
5f174279 912 TGeoRotation *rwh[18];
c1637e41 913 for(Int_t i =0;i<18;i++){
914 Double_t phi = (20.*i);
5f174279 915 rwh[i]=new TGeoRotation();
916 rwh[i]->RotateZ(phi);
917 wheela->AddNode(secta,i+1,rwh[i]);
918 wheelc->AddNode(sectc,i+1,rwh[i]);
79575d04 919
c1637e41 920 }
4fa47888 921 // wheels in the drift volume!
a1ec4d07 922
c1637e41 923 TGeoCombiTrans *combi3 = new TGeoCombiTrans("combi3",0.,0.,256.6,ref);
a1ec4d07 924 v9->AddNode(wheela,1,combi3);
925 v9->AddNode(wheelc,2,new TGeoTranslation(0.,0.,-256.6));
c1637e41 926 //_____________________________________________________________
927 // service support wheel
928 //_____________________________________________________________
929 TGeoPgon *sw = new TGeoPgon(0.,20.,1,2);
930 sw->DefineSection(0,-4.,80.5,251.75);
931 sw->DefineSection(1,4.,80.5,251.75);
932 TGeoVolume *swv = new TGeoVolume("TPC_SWSEG",sw,m3); //Al
933 //
934 thick=1.;
d899e254 935 shift = thick/TMath::Sin(openingAngle);
c1637e41 936 TGeoPgon *sh = new TGeoPgon(0.,20.,1,2);
937 sh->DefineSection(0,-4.,81.5-shift,250.75-shift);
938 sh->DefineSection(1,4.,81.5-shift,250.75-shift);
939 TGeoVolume *shv = new TGeoVolume("TPC_SWS1",sh,m1); //Air
940 //
74518339 941 TGeoMedium *m9 = gGeoManager->GetMedium("TPC_Si");
942 TGeoPgon *el = new TGeoPgon(0.,20.,1,2);
943 el->DefineSection(0,-1.872,81.5-shift,250.75-shift);
944 el->DefineSection(1,1.872,81.5-shift,250.75-shift);
945 TGeoVolume *elv = new TGeoVolume("TPC_ELEC",el,m9); //Si
946 //
947 shv->AddNode(elv,1);
948 //
949 //
d899e254 950 ys = shift*TMath::Sin(openingAngle);
951 xs = shift*TMath::Cos(openingAngle);
c1637e41 952 swv->AddNode(shv,1,new TGeoTranslation(xs,ys,0.));
953 // cover
954 TGeoPgon *co = new TGeoPgon(0.,20.,1,2);
955 co->DefineSection(0,-0.5,77.,255.25);
956 co->DefineSection(1,0.5,77.,255.25);
957 TGeoVolume *cov = new TGeoVolume("TPC_SWC1",co,m3);//Al
958 // hole in a cover
959 TGeoPgon *coh = new TGeoPgon(0.,20.,1,2);
d899e254 960 shift=4./TMath::Sin(openingAngle);
c1637e41 961 coh->DefineSection(0,-0.5,85.-shift,247.25-shift);
962 coh->DefineSection(1,0.5,85.-shift,247.25-shift);
963 //
964 TGeoVolume *cohv = new TGeoVolume("TPC_SWC2",coh,m1);
965 //
d899e254 966 ys = shift*TMath::Sin(openingAngle);
967 xs = shift*TMath::Cos(openingAngle);
c1637e41 968 cov->AddNode(cohv,1,new TGeoTranslation(xs,ys,0.));
969 //
970 // Sector as an Assembly
971 //
972 TGeoVolumeAssembly *swhs = new TGeoVolumeAssembly("TPC_SSWSEC");
973 swhs->AddNode(swv,1);
974 swhs->AddNode(cov,1,new TGeoTranslation(0.,0.,-4.5));
975 swhs->AddNode(cov,2,new TGeoTranslation(0.,0.,4.5));
976 //
977 // SSW as an Assembly of sectors
978 //
5f174279 979 TGeoRotation *rsw[18];
980 TGeoVolumeAssembly *swheel = new TGeoVolumeAssembly("TPC_SSWHEEL");
c1637e41 981 for(Int_t i =0;i<18;i++){
982 Double_t phi = (20.*i);
5f174279 983 rsw[i] = new TGeoRotation();
984 rsw[i]->RotateZ(phi);
985 swheel->AddNode(swhs,i+1,rsw[i]);
c1637e41 986 }
987 v1->AddNode(swheel,1,new TGeoTranslation(0.,0.,-284.6));
988 v1->AddNode(swheel,2,new TGeoTranslation(0.,0.,284.6));
989
990 // sensitive strips - strip "0" is always set
991 // conditional
992 Int_t totrows;
993 totrows = fTPCParam->GetNRowLow() + fTPCParam->GetNRowUp();
994 Double_t *upar;
995 upar=NULL;
996 gGeoManager->Volume("TPC_Strip","PGON",m5->GetId(),upar);
997 upar=new Double_t [10];
998 upar[0]=0.;
999 upar[1]=360.;
1000 upar[2]=18.;
1001 upar[3]=2.;
1002 //
1003 upar[4]=-124.8;
1004 upar[7]=124.8;
1005
1006 Double_t rlow=fTPCParam->GetPadRowRadiiLow(0);
1007
1008 upar[5]=rlow;
1009 upar[6]=rlow+.01;
1010 upar[8]=upar[5];
1011 upar[9]=upar[6];
1012 //
1013 gGeoManager->Node("TPC_Strip",1,"TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
1014 gGeoManager->Node("TPC_Strip",totrows+1,
1015 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
1016 //
1017 // now, strips optionally
1018 //
1019 if(fSens){
1020 //lower sectors
1021 for(Int_t i=2;i<fTPCParam->GetNRowLow()+1;i++){
1022 rlow=fTPCParam->GetPadRowRadiiLow(i-1);
1023 upar[5]=rlow;
1024 upar[6]=rlow+.01;
1025 upar[8]=upar[5];
1026 upar[9]=upar[6];
1027 gGeoManager->Node("TPC_Strip",i,
1028 "TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
1029 gGeoManager->Node("TPC_Strip",totrows+i,
1030 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
1031 }
1032 //upper sectors
1033 for(Int_t i=1;i<fTPCParam->GetNRowUp()+1;i++){
1034 rlow=fTPCParam->GetPadRowRadiiUp(i-1);
1035 upar[5]=rlow;
1036 upar[6]=rlow+.01;
1037 upar[8]=upar[5];
1038 upar[9]=upar[6];
1039 gGeoManager->Node("TPC_Strip",i+fTPCParam->GetNRowLow(),
1040 "TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
1041 gGeoManager->Node("TPC_Strip",totrows+i+fTPCParam->GetNRowLow(),
1042 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
1043 }
1044 }//strips
37831078 1045 //----------------------------------------------------------
0f788f87 1046 // TPC Support Rods - MAKROLON
37831078 1047 //----------------------------------------------------------
c1637e41 1048 TGeoMedium *m6=gGeoManager->GetMedium("TPC_Makrolon");
1049 TGeoMedium *m7=gGeoManager->GetMedium("TPC_Cu");
78134e48 1050 TGeoMedium *m10 = gGeoManager->GetMedium("TPC_Alumina");
c5d5037c 1051 TGeoMedium *m11 = gGeoManager->GetMedium("TPC_Peek");;
0f788f87 1052 TGeoMedium *m13 = gGeoManager->GetMedium("TPC_Brass");
1053 //
1054 // tpc rod is an assembly of 10 long parts and 2 short parts
1055 // connected with alu rings and plagged on both sides.
79575d04 1056 //
c1637e41 1057 //
0f788f87 1058// tpc rod long
1059//
1060 TGeoPcon *rod = new TGeoPcon("rod",0.,360.,6);
1061 rod->DefineSection(0,-10.43,1.92,2.08);
1062 rod->DefineSection(1,-9.75,1.92,2.08);
1063
1064 rod->DefineSection(2,-9.75,1.8,2.2);
1065 rod->DefineSection(3,9.75,1.8,2.2);
1066
1067 rod->DefineSection(4,9.75,1.92,2.08);
1068 rod->DefineSection(5,10.43,1.92,2.08);
1069 //
1070 TGeoVolume *mrodl = new TGeoVolume("TPC_mrodl",rod,m6);
1071 //
1072 // tpc rod short
1073 //
1074 TGeoPcon *rod1 = new TGeoPcon("rod1",0.,360.,6);
1075 rod1->DefineSection(0,-8.93,1.92,2.08);
1076 rod1->DefineSection(1,-8.25,1.92,2.08);
1077
1078 rod1->DefineSection(2,-8.25,1.8,2.2);
1079 rod1->DefineSection(3,8.25,1.8,2.2);
1080
1081 rod1->DefineSection(4,8.25,1.92,2.08);
1082 rod1->DefineSection(5,8.93,1.92,2.08);
1083 //
1084 TGeoVolume *mrods = new TGeoVolume("TPC_mrods",rod1,m6);
1085 //
1086 // below is for the resistor rod
1087 //
1088 // hole for the brass connectors
1089 //
1090
1091 new TGeoTube("hhole",0.,0.3,0.3);
1092 //
1093 //transformations for holes - initialy they
1094 // are placed at x=0 and negative y
1095 //
1096 TGeoRotation *rhole = new TGeoRotation();
1097 rhole->RotateX(90.);
1098 TGeoCombiTrans *transf[13];
1099 Char_t name[30];
1100 for(Int_t i=0;i<13;i++){
94e6c6f4 1101 //sprintf(name,"transf%d",i);
1102 snprintf(name,30,"transf%d",i);
0f788f87 1103 transf[i]= new TGeoCombiTrans(name,0.,-2.,-9.+i*1.5,rhole);
1104 transf[i]->RegisterYourself();
1105 }
1106 // union expression for holes
1107 TString operl("hhole:transf0");
1108 for (Int_t i=1;i<13;i++){
94e6c6f4 1109 //sprintf(name,"+hhole:transf%d",i);
1110 snprintf(name,30,"+hhole:transf%d",i);
0f788f87 1111 operl.Append(name);
1112 }
78134e48 1113 //
0f788f87 1114 TString opers("hhole:transf1");
1115 for (Int_t i=2;i<12;i++){
94e6c6f4 1116 //sprintf(name,"+hhole:transf%d",i);
1117 snprintf(name,30,"+hhole:transf%d",i);
0f788f87 1118 opers.Append(name);
1119 }
1120 //union of holes
1121 new TGeoCompositeShape("hlv",operl.Data());
1122 new TGeoCompositeShape("hsv",opers.Data());
1123 //
1124 TGeoCompositeShape *rodl = new TGeoCompositeShape("rodl","rod-hlv");
1125 TGeoCompositeShape *rods = new TGeoCompositeShape("rods","rod1-hsv");
1126 //rods - volumes - makrolon rods with holes
1127 TGeoVolume *rodlv = new TGeoVolume("TPC_rodl",rodl,m6);
1128 TGeoVolume *rodsv = new TGeoVolume("TPC_rods",rods,m6);
1129 //brass connectors
1130 //connectors
1131 TGeoTube *bcon = new TGeoTube(0.,0.3,0.3);//connectors
1132 TGeoVolume *bconv = new TGeoVolume("TPC_bcon",bcon,m13);
1133 //
1134 // hooks holding strips
1135 //
1136 new TGeoBBox("hk1",0.625,0.015,0.75);
1137 new TGeoBBox("hk2",0.625,0.015,0.15);
1138 TGeoTranslation *tr21 = new TGeoTranslation("tr21",0.,-0.03,-0.6);
1139 TGeoTranslation *tr12 = new TGeoTranslation("tr12",0.,-0.03,0.6);
1140 tr21->RegisterYourself();
1141 tr12->RegisterYourself();
1142
1143 TGeoCompositeShape *hook = new TGeoCompositeShape("hook","hk1+hk2:tr21+hk2:tr12");
1144 TGeoVolume *hookv = new TGeoVolume("TPC_hook",hook,m13);
1145 //
1146 // assembly of the short rod with connectors and hooks
1147 //
1148 //
1149 // short rod
1150 //
1151 TGeoVolumeAssembly *spart = new TGeoVolumeAssembly("TPC_spart");
1152 //
1153 spart->AddNode( rodsv,1);
1154 for(Int_t i=1;i<12;i++){
1155 spart->AddNode(bconv,i,transf[i]);
1156 }
1157 for(Int_t i =0;i<11;i++){
ceb660a9 1158 spart->AddNode(hookv,i+1,new TGeoTranslation(0.,-2.315,-7.5+i*1.5));
0f788f87 1159 }
1160 //
1161 // long rod
1162 //
1163 TGeoVolumeAssembly *lpart = new TGeoVolumeAssembly("TPC_lpart");
1164 //
1165 lpart->AddNode( rodlv,1);
1166 for(Int_t i=0;i<13;i++){
ceb660a9 1167 lpart->AddNode(bconv,i+12,transf[i]);
0f788f87 1168 }
1169 for(Int_t i =0;i<13;i++){
ceb660a9 1170 lpart->AddNode(hookv,i+12,new TGeoTranslation(0.,-2.315,-9.+i*1.5));
0f788f87 1171 }
1172 //
1173 // alu ring
1174 //
1175 new TGeoTube("ring1",2.1075,2.235,0.53);
1176 new TGeoTube("ring2",1.7925,1.89,0.43);
1177 new TGeoTube("ring3",1.89,2.1075,0.05);
1178 TGeoCompositeShape *ring = new TGeoCompositeShape("ring","ring1+ring2+ring3");
1179 TGeoVolume *ringv = new TGeoVolume("TPC_ring",ring,m3);
1180 //
1181 // rod assembly
1182 //
ceb660a9 1183 TGeoVolumeAssembly *tpcrrod = new TGeoVolumeAssembly("TPC_rrod");//rrod
0f788f87 1184 TGeoVolumeAssembly *tpcmrod = new TGeoVolumeAssembly("TPC_mrod");//makrolon rod
1185 //long pieces
1186 for(Int_t i=0;i<11;i++){
ceb660a9 1187 tpcrrod->AddNode(ringv,i+1,new TGeoTranslation(0.,0.,-105.+i*21));
0f788f87 1188 tpcmrod->AddNode(ringv,i+12,new TGeoTranslation(0.,0.,-105.+i*21));
1189 }
1190 for(Int_t i=0;i<10;i++){
ceb660a9 1191 tpcrrod->AddNode(lpart,i+1,new TGeoTranslation(0.,0.,-94.5+i*21));
0f788f87 1192 tpcmrod->AddNode(mrodl,i+1,new TGeoTranslation(0.,0.,-94.5+i*21));
1193 }
78134e48 1194 //
0f788f87 1195 // short pieces
78134e48 1196 //
ceb660a9 1197 tpcrrod->AddNode(spart,1,new TGeoTranslation(0.,0.,-114.));
1198 tpcrrod->AddNode(spart,2,new TGeoTranslation(0.,0.,114.));
1199 tpcrrod->AddNode(ringv,23,new TGeoTranslation(0.,0.,-123.));
1200 tpcrrod->AddNode(ringv,24,new TGeoTranslation(0.,0.,123.));
78134e48 1201 //
0f788f87 1202 tpcmrod->AddNode(mrods,1,new TGeoTranslation(0.,0.,-114.));
1203 tpcmrod->AddNode(mrods,2,new TGeoTranslation(0.,0.,114.));
1204 tpcmrod->AddNode(ringv,25,new TGeoTranslation(0.,0.,-123.));
1205 tpcmrod->AddNode(ringv,26,new TGeoTranslation(0.,0.,123.));
1206 //
1207 // left plaque
78134e48 1208 //
0f788f87 1209 TGeoPcon *lp = new TGeoPcon(0.,360.,4);
78134e48 1210 //
0f788f87 1211 lp->DefineSection(0,-125.8,1.92,2.235);
1212 lp->DefineSection(1,-124.8,1.92,2.235);
78134e48 1213 //
0f788f87 1214 lp->DefineSection(2,-124.8,1.92,2.08);
1215 lp->DefineSection(3,-123.1,1.92,2.08);
78134e48 1216 //
0f788f87 1217 TGeoVolume *lpv1 = new TGeoVolume("TPC_lpv1",lp,m6);
1218 TGeoVolume *lpv2 = new TGeoVolume("TPC_lpv2",lp,m6);
1219 // left ring
1220 TGeoTube *lr = new TGeoTube(2.1075,2.235,0.5);
1221 TGeoVolume *lrv = new TGeoVolume("TPC_lrv",lr,m3);
78134e48 1222 //
0f788f87 1223 lpv2->AddNode(lrv,1,new TGeoTranslation(0.,0.,-125.3));
78134e48 1224 //
ceb660a9 1225 tpcrrod->AddNode(lpv2,1);
0f788f87 1226 tpcmrod->AddNode(lpv1,1);
78134e48 1227 //
0f788f87 1228 // right plaque
78134e48 1229 //
f1447ab6 1230 TGeoTube *rp = new TGeoTube(1.92,2.08,2.025);
0f788f87 1231 TGeoVolume *rpv = new TGeoVolume("TPC_rpv",rp,m6);
f1447ab6 1232 tpcrrod->AddNode(rpv,1, new TGeoTranslation(0.,0.,125.125));
1233 tpcmrod->AddNode(rpv,2,new TGeoTranslation(0.,0.,125.125));
78134e48 1234 //
a3d2be59 1235 //
0f788f87 1236 //HV rods - makrolon + 0.58cm (diameter) Cu
cf84f9b1 1237 TGeoTube *hvr = new TGeoTube(0.,1.465,126.5);
1238 TGeoTube *hvc = new TGeoTube(0.,0.29,126.5);
0f788f87 1239 //
1240 TGeoVolume *hvrv = new TGeoVolume("TPC_HV_Rod",hvr,m6);
1241 TGeoVolume *hvcv = new TGeoVolume("TPC_HV_Cable",hvc,m7);
1242 hvrv->AddNode(hvcv,1);
78134e48 1243 //
0f788f87 1244 //resistor rod
1245 //
ceb660a9 1246 TGeoTube *cr = new TGeoTube(0.,0.45,126.2);
1247 TGeoTube *cw = new TGeoTube(0.,0.15,126.2);
0f788f87 1248 TGeoVolume *crv = new TGeoVolume("TPC_CR",cr,m10);
ceb660a9 1249 TGeoVolume *cwv = new TGeoVolume("TPC_W",cw,m12);
0f788f87 1250 //
1251 // ceramic rod with water
1252 //
1253 crv->AddNode(cwv,1);
1254 //
1255 //peek rod
1256 //
ceb660a9 1257 TGeoTube *pr =new TGeoTube(0.2,0.35,126.2);
1258 TGeoVolume *prv = new TGeoVolume("TPC_PR",pr,m11);
0f788f87 1259 //
1260 // copper plates with connectors
1261 //
1262 new TGeoTube("tub",0.,1.7,0.025);
1263 //
1264 // half space - points on the plane and a normal vector
1265 //
1266 Double_t n[3],p[3];
1267 Double_t slope = TMath::Tan(22.*TMath::DegToRad());
1268 Double_t intp = 1.245;
1269 //
1270 Double_t b = slope*slope+1.;
1271 p[0]=intp*slope/b;
1272 p[1]=-intp/b;
1273 p[2]=0.;
1274 //
1275 n[0]=-p[0];
1276 n[1]=-p[1];
1277 n[2]=0.;
1278 Double_t norm;
1279 norm=TMath::Sqrt(n[0]*n[0]+n[1]*n[1]);
1280 n[0] /= norm;
1281 n[1] /=norm;
1282 //
1283 new TGeoHalfSpace("sp1",p,n);
1284 //
1285 slope = -slope;
1286 //
1287 p[0]=intp*slope/b;
1288 p[1]=-intp/b;
1289 //
1290 n[0]=-p[0];
1291 n[1]=-p[1];
1292 norm=TMath::Sqrt(n[0]*n[0]+n[1]*n[1]);
1293 n[0] /= norm;
1294 n[1] /=norm;
1295 //
1296 new TGeoHalfSpace("sp2",p,n);
1297 // holes for rods
1298 //holes
1299 new TGeoTube("h1",0.,0.5,0.025);
1300 new TGeoTube("h2",0.,0.35,0.025);
1301 //translations:
1302 TGeoTranslation *ttr11 = new TGeoTranslation("ttr11",-0.866,0.5,0.);
1303 TGeoTranslation *ttr22 = new TGeoTranslation("ttr22",0.866,0.5,0.);
1304 ttr11->RegisterYourself();
1305 ttr22->RegisterYourself();
1306 // elastic connector
1307 new TGeoBBox("elcon",0.72,0.005,0.3);
1308 TGeoRotation *crr1 = new TGeoRotation();
1309 crr1->RotateZ(-22.);
1310TGeoCombiTrans *ctr1 = new TGeoCombiTrans("ctr1",-0.36011, -1.09951,-0.325,crr1);
1311ctr1->RegisterYourself();
1312 TGeoCompositeShape *cs1 = new TGeoCompositeShape("cs1",
1313"(((((tub-h1:ttr11)-h1:ttr22)-sp1)-sp2)-h2)+elcon:ctr1");
1314 //
1315 TGeoVolume *csvv = new TGeoVolume("TPC_RR_CU",cs1,m7);
1316 //
1317 // resistor rod assembly 2 ceramic rods, peak rod, Cu plates
1318 // and resistors
1319 //
ceb660a9 1320 TGeoVolumeAssembly *rrod = new TGeoVolumeAssembly("TPC_RRIN");
0f788f87 1321 // rods
1322 rrod->AddNode(crv,1,ttr11);
1323 rrod->AddNode(crv,2,ttr22);
1324 rrod->AddNode(prv,1);
1325 //Cu plates
1326 for(Int_t i=0;i<165;i++){
1327 rrod->AddNode(csvv,i+1,new TGeoTranslation(0.,0.,-122.675+i*1.5));
1328 }
1329 //resistors
1330 TGeoTube *res = new TGeoTube(0.,0.15,0.5);
1331 TGeoVolume *resv = new TGeoVolume("TPC_RES",res,m10);
1332 TGeoVolumeAssembly *ress = new TGeoVolumeAssembly("TPC_RES_CH");
1333 ress->AddNode(resv,1,new TGeoTranslation(0.2,0.,0.));
1334 ress->AddNode(resv,2,new TGeoTranslation(-0.2,0.,0.));
1335 //
1336 TGeoRotation *crr2 = new TGeoRotation();
1337 crr2->RotateY(30.);
1338 TGeoRotation *crr3 = new TGeoRotation();
1339 crr3->RotateY(-30.);
1340 //
1341 for(Int_t i=0;i<164;i+=2){
1342 rrod->AddNode(ress,i+1, new TGeoCombiTrans(0.,1.2,-121.925+i*1.5,crr2));
1343 rrod->AddNode(ress,i+2, new TGeoCombiTrans(0.,1.2,-121.925+(i+1)*1.5,crr3));
1344 }
ceb660a9 1345
d00b3fc6 1346 tpcrrod->AddNode(rrod,1,new TGeoCombiTrans(0.,0.,0.5,crr1));
7f96259a 1347 //
1348 // guard ring resistor chain
1349 //
232c5b28 1350
1351 TGeoTube *gres1 = new TGeoTube(0.,0.375,125.);// inside ifc
7f96259a 1352 //
1353 TGeoVolume *vgres1 = new TGeoVolume("TPC_GRES1",gres1,m10);
232c5b28 1354
7f96259a 1355 //
1356 Double_t xrc,yrc;
1357 //
7f96259a 1358 xrc=79.3*TMath::Cos(350.*TMath::DegToRad());
1359 yrc=79.3*TMath::Sin(350.*TMath::DegToRad());
1360 //
232c5b28 1361 v9->AddNode(vgres1,1,new TGeoTranslation(xrc,yrc,126.9));
1362 v9->AddNode(vgres1,2,new TGeoTranslation(xrc,yrc,-126.9));
1363 //
e079adac 1364 xrc=79.3*TMath::Cos(190.*TMath::DegToRad());
1365 yrc=79.3*TMath::Sin(190.*TMath::DegToRad());
232c5b28 1366 //
1367 v9->AddNode(vgres1,3,new TGeoTranslation(xrc,yrc,126.9));
1368 v9->AddNode(vgres1,4,new TGeoTranslation(xrc,yrc,-126.9));
0f788f87 1369 //------------------------------------------------------------------
1370 TGeoRotation refl("refl",90.,0.,90.,90.,180.,0.);
1371 TGeoRotation rotrod("rotrod");
0f788f87 1372 //
2d1d58a6 1373 TGeoRotation *rotpos[2];
1374 //
1375 TGeoRotation *rotrod1[2];
c449e944 1376 TGeoTubeSeg *irh = new TGeoTubeSeg(78.825,79.25,1.5,358.5,1.5);
1377 TGeoTubeSeg *orh = new TGeoTubeSeg(256.5,257.95,1.5,359.5,0.5);
1378 TGeoTubeSeg *ohh = new TGeoTubeSeg(256.5,257.95,1.5,9.5,10.5);
1379 TGeoVolume *irhv = new TGeoVolume("TPC_IRHH",irh,m4);
1380 TGeoVolume *orhv = new TGeoVolume("TPC_ORHH",orh,m4);
1381 TGeoVolume *ohhv = new TGeoVolume("TPC_OHVHH",ohh,m4);
0f788f87 1382
1383 //v9 - drift gas
1384
7281dc07 1385 for(Int_t i=0;i<18;i++){
c1637e41 1386 Double_t angle,x,y;
1387 Double_t z,r;
1388 angle=TMath::DegToRad()*20.*(Double_t)i;
c449e944 1389 TGeoRotation *roth = new TGeoRotation(); //rotation for rod holders
1390 roth->RotateZ(angle);
0f788f87 1391 //inner rods
c1637e41 1392 r=81.5;
1393 x=r * TMath::Cos(angle);
1394 y=r * TMath::Sin(angle);
cf84f9b1 1395 z = 126.1;
78134e48 1396 //
c449e944 1397 v9->AddNode(irhv,i+1,roth);
1398 v9->AddNode(orhv,i+1,roth);
1399 v9->AddNode(ohhv,i+1,roth);
1400 //
0f788f87 1401 if(i==11){//resistor rod inner
1402 rotrod.RotateZ(-90.+angle);
2d1d58a6 1403 rotrod1[0]= new TGeoRotation();
1404 rotpos[0]= new TGeoRotation();
1405 //
1406 rotrod1[0]->RotateZ(-90.+angle);
1407 *rotpos[0] = refl*rotrod; //rotation+reflection
ceb660a9 1408 v9->AddNode(tpcrrod,1,new TGeoCombiTrans(x,y, z, rotrod1[0])); //A
1409 v9->AddNode(tpcrrod,2,new TGeoCombiTrans(x,y,-z, rotpos[0])); //C
78134e48 1410 }
1411 else {
0f788f87 1412 v9->AddNode(tpcmrod,i+1,new TGeoTranslation(x,y,z));//shaft
1413 v9->AddNode(tpcmrod,i+19,new TGeoCombiTrans(x,y,-z,ref));//muon
c1637e41 1414 }
0f788f87 1415 // outer rods
c1637e41 1416 r=254.25;
1417 x=r * TMath::Cos(angle);
1418 y=r * TMath::Sin(angle);
cf84f9b1 1419 z=126.3;
78134e48 1420 //
0f788f87 1421 if(i==3){//resistor rod outer
1422 rotrod.RotateZ(90.+angle);
2d1d58a6 1423 rotrod1[1]= new TGeoRotation();
1424 rotpos[1]= new TGeoRotation();
1425 rotrod1[1]->RotateZ(90.+angle);
1426 *rotpos[1] = refl*rotrod;//rotation+reflection
ceb660a9 1427 v9->AddNode(tpcrrod,3,new TGeoCombiTrans(x,y, z, rotrod1[1])); //A
1428 v9->AddNode(tpcrrod,4,new TGeoCombiTrans(x,y, -z, rotpos[1])); //C
78134e48 1429 }
0f788f87 1430 else {
1431 v9->AddNode(tpcmrod,i+37,new TGeoTranslation(x,y,z));//shaft
1432 v9->AddNode(tpcmrod,i+55,new TGeoCombiTrans(x,y,-z,ref));//muon
78134e48 1433 }
0f788f87 1434 if(i==15){
cf84f9b1 1435 v9->AddNode(hvrv,1,new TGeoTranslation(x,y,z+0.7)); //hv->A-side only
78134e48 1436 }
0f788f87 1437 } //end of rods positioning
69776907 1438
bde68ab0 1439 TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
1440 alice->AddNode(v1,1);
c1637e41 1441
37831078 1442} // end of function
1443
ac81c411 1444//_____________________________________________________________________________
1445void AliTPCv2::AddAlignableVolumes() const
1446{
1447 //
1448 // Create entries for alignable volumes associating the symbolic volume
1449 // name with the corresponding volume path. Needs to be syncronized with
1450 // eventual changes in the geometry.
1451 //
1452 SetInnerChambersAlignable();
1453 SetOuterChambersAlignable();
1454}
1455
1456//_____________________________________________________________________________
1457void AliTPCv2::SetInnerChambersAlignable() const
1458{
1459 //
cdf69b9a 1460 AliGeomManager::ELayerID idTPC1 = AliGeomManager::kTPC1;
1461 Int_t modUID, modnum = 0;
d899e254 1462 TString vpstr1 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_1/TPC_SECT_";
1463 TString vpstr2 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_2/TPC_SECT_";
1464 TString vpappend = "/TPC_IROC_1";
1465 TString snstr1="TPC/EndcapA/Sector";
1466 TString snstr2="TPC/EndcapC/Sector";
1467 TString snappend="/InnerChamber";
ac81c411 1468 TString volpath, symname;
1469
1ac29fc4 1470 for(Int_t cnt=1; cnt<=18; cnt++){
cdf69b9a 1471 modUID = AliGeomManager::LayerToVolUID(idTPC1,modnum++);
1ac29fc4 1472 volpath = vpstr1;
1473 volpath += cnt;
1474 volpath += vpappend;
1475 symname = snstr1;
1476 symname += cnt;
1477 symname += snappend;
cdf69b9a 1478 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
84cbbd90 1479 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
cdf69b9a 1480 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID);
1481 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
1ac29fc4 1482 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,cnt-1);
1483 alignableEntry->SetMatrix(matTtoL);
1ac29fc4 1484 }
65293f49 1485
ac81c411 1486 for(Int_t cnt=1; cnt<=18; cnt++){
cdf69b9a 1487 modUID = AliGeomManager::LayerToVolUID(idTPC1,modnum++);
d899e254 1488 volpath = vpstr2;
ac81c411 1489 volpath += cnt;
d899e254 1490 volpath += vpappend;
1491 symname = snstr2;
ac81c411 1492 symname += cnt;
d899e254 1493 symname += snappend;
cdf69b9a 1494 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
84cbbd90 1495 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
cdf69b9a 1496 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID);
1497 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
1ac29fc4 1498 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,18+cnt-1);
1499 alignableEntry->SetMatrix(matTtoL);
ac81c411 1500 }
1501}
1502
ac81c411 1503//_____________________________________________________________________________
1504void AliTPCv2::SetOuterChambersAlignable() const
1505{
1506 //
cdf69b9a 1507 AliGeomManager::ELayerID idTPC2 = AliGeomManager::kTPC2;
1508 Int_t modUID, modnum = 0;
d899e254 1509 TString vpstr1 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_1/TPC_SECT_";
1510 TString vpstr2 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_2/TPC_SECT_";
1511 TString vpappend = "/TPC_OROC_1";
1512 TString snstr1="TPC/EndcapA/Sector";
1513 TString snstr2="TPC/EndcapC/Sector";
1514 TString snappend="/OuterChamber";
ac81c411 1515 TString volpath, symname;
1516
1517 for(Int_t cnt=1; cnt<=18; cnt++){
cdf69b9a 1518 modUID = AliGeomManager::LayerToVolUID(idTPC2,modnum++);
d899e254 1519 volpath = vpstr1;
ac81c411 1520 volpath += cnt;
d899e254 1521 volpath += vpappend;
1522 symname = snstr1;
ac81c411 1523 symname += cnt;
d899e254 1524 symname += snappend;
cdf69b9a 1525 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
84cbbd90 1526 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
cdf69b9a 1527 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID);
1528 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
1ac29fc4 1529 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,36+cnt-1);
1530 alignableEntry->SetMatrix(matTtoL);
ac81c411 1531 }
84cbbd90 1532
ac81c411 1533 for(Int_t cnt=1; cnt<=18; cnt++){
cdf69b9a 1534 modUID = AliGeomManager::LayerToVolUID(idTPC2,modnum++);
d899e254 1535 volpath = vpstr2;
ac81c411 1536 volpath += cnt;
d899e254 1537 volpath += vpappend;
1538 symname = snstr2;
ac81c411 1539 symname += cnt;
d899e254 1540 symname += snappend;
cdf69b9a 1541 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
84cbbd90 1542 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
cdf69b9a 1543 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID);
1544 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
1ac29fc4 1545 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,36+18+cnt-1);
1546 alignableEntry->SetMatrix(matTtoL);
ac81c411 1547 }
1548}
1549
37831078 1550
1551//_____________________________________________________________________________
1552void AliTPCv2::CreateMaterials()
1553{
1554 //
1555 // Define materials for version 2 of the Time Projection Chamber
1556 //
1557
1558 AliTPC::CreateMaterials();
1559}
1560
1561//_____________________________________________________________________________
1562void AliTPCv2::Init()
1563{
1564 //
1565 // Initialises version 2 of the TPC after that it has been built
1566 //
1567
1568 Int_t *idtmed = fIdtmed->GetArray();
1569
1570 AliTPC::Init();
d4c354b9 1571
c1637e41 1572
1573 fIdSens=gMC->VolId("TPC_Strip"); // one strip is always selected...
d4c354b9 1574
c1637e41 1575 fIDrift=gMC->VolId("TPC_Drift");
1576 fSecOld=-100; // fake number
37831078 1577
d9888f70 1578 gMC->SetMaxNStep(-30000); // max. number of steps increased
37831078 1579
4481461d 1580 if (fPrimaryIonisation) {
098dfc1a 1581 // for FLUKA
4481461d 1582 gMC->Gstpar(idtmed[2],"PRIMIO_E", 20.77); // 1st ionisation potential
1583
1584 gMC->Gstpar(idtmed[2],"PRIMIO_N", 14.35);
1585 gMC->Gstpar(idtmed[2],"LOSS", 14); // specific energy loss
8143dfb2 1586 gMC->Gstpar(idtmed[2],"STRA",4);
098dfc1a 1587 }
1588 // specific energy loss for geant3 is now defined in galice.cuts
4481461d 1589
37831078 1590
a9d15241 1591 AliDebug(1,"*** TPC version 2 initialized ***");
1592 AliDebug(1,Form("Maximum number of steps = %d",gMC->GetMaxNStep()));
37831078 1593
1594 //
fe4da5cc 1595
1596}
1597
1598//_____________________________________________________________________________
1599void AliTPCv2::StepManager()
1600{
1601 //
1602 // Called for every step in the Time Projection Chamber
1603 //
1604
1605 //
1606 // parameters used for the energy loss calculations
1607 //
73042f01 1608 const Float_t kprim = 14.35; // number of primary collisions per 1 cm
1609 const Float_t kpoti = 20.77e-9; // first ionization potential for Ne/CO2
1610 const Float_t kwIon = 35.97e-9; // energy for the ion-electron pair creation
ec6ac410 1611 const Int_t kMaxDistRef =15; // maximal difference between 2 stored references
fe4da5cc 1612
73042f01 1613 const Float_t kbig = 1.e10;
fe4da5cc 1614
1615 Int_t id,copy;
e61fd20d 1616 Float_t hits[5];
fe4da5cc 1617 Int_t vol[2];
37831078 1618 TLorentzVector p;
fe4da5cc 1619
37831078 1620 vol[1]=0; // preset row number to 0
fe4da5cc 1621 //
f6a67d69 1622 if (!fPrimaryIonisation) gMC->SetMaxStep(kbig);
fe4da5cc 1623
0a6d8768 1624 if(!gMC->IsTrackAlive()) return; // particle has disappeared
fe4da5cc 1625
cfce8870 1626 Float_t charge = gMC->TrackCharge();
fe4da5cc 1627
1628 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1629
37831078 1630 // check the sensitive volume
1631
c1637e41 1632 id = gMC->CurrentVolID(copy); // vol ID and copy number (starts from 1!)
1633 if(id != fIDrift && id != fIdSens) return; // not in the sensitive folume
da33556f 1634
2ddbb964 1635 if ( fPrimaryIonisation && id == fIDrift ) {
1636 Double_t rnd = gMC->GetRandom()->Rndm();
1637 gMC->SetMaxStep(0.2+(2.*rnd-1.)*0.05); // 2 mm +- rndm*0.5mm step
1638 }
1639
1640 //if ( fPrimaryIonisation && id == fIDrift && gMC->IsTrackEntering()) {
1641 // gMC->SetMaxStep(0.2); // 2 mm
1642 //}
1643
c1637e41 1644 gMC->TrackPosition(p);
1645 Double_t r = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
1646 //
1647
1648 //
1649 Double_t angle = TMath::ACos(p[0]/r);
1650 angle = (p[1]<0.) ? TMath::TwoPi()-angle : angle;
1651 //
1652 // angular segment, it is not a real sector number...
1653 //
1654 Int_t sector=TMath::Nint((angle-fTPCParam->GetInnerAngleShift())/
1655 fTPCParam->GetInnerAngle());
1656 // rotate to segment "0"
1657 Float_t cos,sin;
1658 fTPCParam->AdjustCosSin(sector,cos,sin);
1659 Float_t x1=p[0]*cos + p[1]*sin;
1660 // check if within sector's limits
5bd5dbc4 1661 if((x1>=fTPCParam->GetInnerRadiusLow()&&x1<=fTPCParam->GetInnerRadiusUp())
1662 ||(x1>=fTPCParam->GetOuterRadiusLow()&&x1<=fTPCParam->GetOuterRadiusUp())){
c1637e41 1663 // calculate real sector number...
1664 if (x1>fTPCParam->GetOuterRadiusLow()){
1665 sector = TMath::Nint((angle-fTPCParam->GetOuterAngleShift())/
1666 fTPCParam->GetOuterAngle())+fTPCParam->GetNInnerSector();
1667 if (p[2]<0) sector+=(fTPCParam->GetNOuterSector()>>1);
37831078 1668 }
c1637e41 1669 else
1670 if (p[2]<0) sector+=(fTPCParam->GetNInnerSector()>>1);
1671 //
1672 // here I have a sector number
1673 //
37831078 1674
c1637e41 1675 vol[0]=sector;
ec6ac410 1676
1677 static Double_t lastReferenceR=0;
1678 if (TMath::Abs(lastReferenceR-r)>kMaxDistRef){
1679 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kTPC);
1680 lastReferenceR = r;
1681 }
1682
c1637e41 1683 // check if change of sector
1684 if(sector != fSecOld){
1685 fSecOld=sector;
1686 // add track reference
e6add757 1687 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kTPC);
c1637e41 1688 }
1689 // track is in the sensitive strip
1690 if(id == fIdSens){
1691 // track is entering the strip
1692 if (gMC->IsTrackEntering()){
1693 Int_t totrows = fTPCParam->GetNRowLow()+fTPCParam->GetNRowUp();
1694 vol[1] = (copy<=totrows) ? copy-1 : copy-1-totrows;
1695 // row numbers are autonomous for lower and upper sectors
1696 if(vol[0] > fTPCParam->GetNInnerSector()) {
1697 vol[1] -= fTPCParam->GetNRowLow();
1698 }
1699 //
1700 if(vol[0]<fTPCParam->GetNInnerSector()&&vol[1] == 0){
37831078 1701
c1637e41 1702 // lower sector, row 0, because Jouri wants to have this
37831078 1703
c1637e41 1704 gMC->TrackMomentum(p);
1705 hits[0]=p[0];
1706 hits[1]=p[1];
1707 hits[2]=p[2];
1708 hits[3]=0.; // this hit has no energy loss
1709 // Get also the track time for pileup simulation
1710 hits[4]=gMC->TrackTime();
6a905708 1711
c1637e41 1712 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
1713 }
1714 //
e61fd20d 1715
c1637e41 1716 gMC->TrackPosition(p);
1717 hits[0]=p[0];
1718 hits[1]=p[1];
1719 hits[2]=p[2];
1720 hits[3]=0.; // this hit has no energy loss
1721 // Get also the track time for pileup simulation
1722 hits[4]=gMC->TrackTime();
930ee558 1723
c1637e41 1724 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
37831078 1725
c1637e41 1726 }
1727 else return;
1728 }
37831078 1729 //-----------------------------------------------------------------
c1637e41 1730 // charged particle is in the sensitive drift volume
37831078 1731 //-----------------------------------------------------------------
cfce8870 1732 if(gMC->TrackStep() > 0) {
b97617a6 1733 Int_t nel=0;
1734 if (!fPrimaryIonisation) {
1735 nel = (Int_t)(((gMC->Edep())-kpoti)/kwIon) + 1;
1736 }
1737 else {
63414189 1738 static Double_t deForNextStep = 0.;
1739 // Geant4 (the meaning of Edep as in Geant3) - wrong
1740 //nel = (Int_t)(((gMC->Edep())-kpoti)/kwIon) + 1;
1741
1742 // Geant4 (the meaning of Edep as in Geant3) - NEW
1743 Double_t eAvailable = gMC->Edep() + deForNextStep;
1744 nel = (Int_t)(eAvailable/kwIon);
1745 deForNextStep = eAvailable - nel*kwIon;
b97617a6 1746 }
fe4da5cc 1747 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
c1637e41 1748 //
37831078 1749 gMC->TrackPosition(p);
1750 hits[0]=p[0];
1751 hits[1]=p[1];
1752 hits[2]=p[2];
fe4da5cc 1753 hits[3]=(Float_t)nel;
c1637e41 1754
fe4da5cc 1755 // Add this hit
c1637e41 1756
97d77e7a 1757 // if (fHitType&&2){
1758 if(fHitType){
6a905708 1759 gMC->TrackMomentum(p);
1760 Float_t momentum = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
1761 Float_t precision = (momentum>0.1) ? 0.002 :0.01;
1762 fTrackHits->SetHitPrecision(precision);
1763 }
e61fd20d 1764
1765 // Get also the track time for pileup simulation
1766 hits[4]=gMC->TrackTime();
c1637e41 1767
1768 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
0f2ff24c 1769 if (fDebugStreamer){
1770 // You can dump here what you need
1771 // function CreateDebugStremer() to be called in the Config.C macro
1772 // if you want to enable it
1773 // By default debug streaemer is OFF
1774 Float_t edep = gMC->Edep();
1775 Float_t tstep = gMC->TrackStep();
1776 Int_t pid=gMC->TrackPid();
1777 (*fDebugStreamer)<<"hit"<<
1778 "x="<<hits[0]<< // hit position
1779 "y="<<hits[1]<<
1780 "z="<<hits[2]<<
1781 "nel="<<hits[3]<< // number of electorns
1782 "tof="<<hits[4]<< // hit TOF
1783 "edep="<<edep<< // energy deposit
1784 "pid="<<pid<< // pid
1785 "step="<<tstep<<
1786 "p.="<<&p<<
1787 "\n";
1788 }
1789
c1637e41 1790 } // step>0
1791 } //within sector's limits
fe4da5cc 1792 // Stemax calculation for the next step
1793
1794 Float_t pp;
0a6d8768 1795 TLorentzVector mom;
b97617a6 1796 // below is valid only for Geant3 (fPromaryIonisation not set)
1797 if(!fPrimaryIonisation){
1798 gMC->TrackMomentum(mom);
1799 Float_t ptot=mom.Rho();
1800 Float_t betaGamma = ptot/gMC->TrackMass();
595bf2c3 1801
b97617a6 1802 Int_t pid=gMC->TrackPid();
1803 if((pid==kElectron || pid==kPositron) && ptot > 0.002)
1804 {
1805 pp = kprim*1.58; // electrons above 20 MeV/c are on the plateau!
1806 }
1807 else
1808 {
1809
1810 betaGamma = TMath::Max(betaGamma,(Float_t)7.e-3); // protection against too small bg
b40afa5e 1811 pp=kprim*AliMathBase::BetheBlochAleph(betaGamma);
595bf2c3 1812
fe4da5cc 1813 }
1814
b97617a6 1815 Double_t rnd = gMC->GetRandom()->Rndm();
fe4da5cc 1816
b97617a6 1817 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
1818 }
c1637e41 1819
fe4da5cc 1820}
1821
73042f01 1822