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