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