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