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