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