Correct sign for calculated b_y (outside measured region).
[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"
73042f01 38#include "AliTPCParam.h"
4ed5dced 39#include "AliTPCTrackHitsV2.h"
116cbefd 40#include "AliTPCv2.h"
c1637e41 41#include "TGeoVolume.h"
42#include "TGeoPcon.h"
43#include "TGeoTube.h"
44#include "TGeoPgon.h"
45#include "TGeoTrd1.h"
46#include "TGeoCompositeShape.h"
47#include "TGeoPara.h"
1ac29fc4 48#include "TGeoPhysicalNode.h"
49
fe4da5cc 50ClassImp(AliTPCv2)
51
52//_____________________________________________________________________________
53AliTPCv2::AliTPCv2(const char *name, const char *title) :
e046d791 54 AliTPC(name, title),
55 fIdSens(0),
56 fIDrift(0),
57 fSecOld(0)
fe4da5cc 58{
59 //
60 // Standard constructor for Time Projection Chamber version 2
61 //
37831078 62
73042f01 63
c1637e41 64 SetBufferSize(128000);
73042f01 65
73042f01 66
67 if (fTPCParam)
68 fTPCParam->Write(fTPCParam->GetTitle());
fe4da5cc 69}
70
71//_____________________________________________________________________________
72void AliTPCv2::CreateGeometry()
73{
74 //
75 // Create the geometry of Time Projection Chamber version 2
76 //
77 //Begin_Html
78 /*
37831078 79 <img src="picts/AliTPC.gif">
fe4da5cc 80 */
81 //End_Html
82 //Begin_Html
83 /*
1439f98e 84 <img src="picts/AliTPCv2Tree.gif">
fe4da5cc 85 */
86 //End_Html
87
c1637e41 88 //----------------------------------------------------------
89 // This geometry is written using TGeo class
90 // Firstly the shapes are defined, and only then the volumes
91 // What is recognized by the MC are volumes
92 //----------------------------------------------------------
37831078 93 //
c1637e41 94 // tpc - this will be the mother volume
37831078 95 //
79575d04 96
37831078 97 //
c1637e41 98 // here I define a volume TPC
99 // retrive the medium name with "TPC_" as a leading string
37831078 100 //
c1637e41 101 TGeoPcon *tpc = new TGeoPcon(0.,360.,18); //18 sections
102 tpc->DefineSection(0,-290.,77.,278.);
456cb019 103 tpc->DefineSection(1,-259.6,70.,278.);
37831078 104 //
c1637e41 105 tpc->DefineSection(2,-259.6,68.1,278.);
106 tpc->DefineSection(3,-253.6,68.1,278.);
37831078 107 //
c1637e41 108 tpc->DefineSection(4,-253.6,68.,278.);
109 tpc->DefineSection(5,-74.0,60.8,278.);
37831078 110 //
c1637e41 111 tpc->DefineSection(6,-74.0,60.1,278.);
112 tpc->DefineSection(7,-73.3,60.1,278.);
37831078 113 //
c1637e41 114 tpc->DefineSection(8,-73.3,56.9,278.);
115 tpc->DefineSection(9,73.3,56.9,278.);
37831078 116 //
c1637e41 117 tpc->DefineSection(10,73.3,60.1,278.);
118 tpc->DefineSection(11,74.0,60.1,278.);
37831078 119 //
c1637e41 120 tpc->DefineSection(12,74.0,60.8,278.);
121 tpc->DefineSection(13,253.6,65.5,278.);
37831078 122 //
c1637e41 123 tpc->DefineSection(14,253.6,65.6,278.);
124 tpc->DefineSection(15,259.6,65.6,278.);
37831078 125 //
456cb019 126 tpc->DefineSection(16,259.6,70.0,278.);
c1637e41 127 tpc->DefineSection(17,290.,77.,278.);
37831078 128 //
c1637e41 129 TGeoMedium *m1 = gGeoManager->GetMedium("TPC_Air");
130 TGeoVolume *v1 = new TGeoVolume("TPC_M",tpc,m1);
79575d04 131 //
c1637e41 132 // drift volume - sensitive volume, extended beyond the
133 // endcaps, because of the alignment
37831078 134 //
c1637e41 135 TGeoPcon *dvol = new TGeoPcon(0.,360.,6);
136 dvol->DefineSection(0,-260.,74.5,264.4);
137 dvol->DefineSection(1,-253.6,74.5,264.4);
37831078 138 //
c1637e41 139 dvol->DefineSection(2,-253.6,76.6774,258.);
140 dvol->DefineSection(3,253.6,76.6774,258.);
37831078 141 //
c1637e41 142 dvol->DefineSection(4,253.6,74.5,264.4);
143 dvol->DefineSection(5,260.,74.5,264.4);
37831078 144 //
c1637e41 145 TGeoMedium *m5 = gGeoManager->GetMedium("TPC_Ne-CO2-N-2");
146 TGeoVolume *v9 = new TGeoVolume("TPC_Drift",dvol,m5);
37831078 147 //
c1637e41 148 v1->AddNode(v9,1);
37831078 149 //
c1637e41 150 // outer insulator
720b23b8 151 //
c1637e41 152 TGeoPcon *tpco = new TGeoPcon(0.,360.,6); //insulator
79575d04 153 //
c1637e41 154 tpco->DefineSection(0,-256.6,264.8,278.);
155 tpco->DefineSection(1,-253.6,264.8,278.);
156 //
157 tpco->DefineSection(2,-253.6,258.,278.);
158 tpco->DefineSection(3,250.6,258.,278.);
159 //
160 tpco->DefineSection(4,250.6,258.,275.5);
161 tpco->DefineSection(5,253.6,258.,275.5);
162 //
163 TGeoMedium *m2 = gGeoManager->GetMedium("TPC_CO2");
164 TGeoVolume *v2 = new TGeoVolume("TPC_OI",tpco,m2);
165 //
166 // outer containment vessel
167 //
168 TGeoPcon *tocv = new TGeoPcon(0.,360.,6); // containment vessel
169 //
170 tocv->DefineSection(0,-256.6,264.8,278.);
171 tocv->DefineSection(1,-253.6,264.8,278.);
172 //
173 tocv->DefineSection(2,-253.6,274.8124,278.);
174 tocv->DefineSection(3,247.6,274.8124,278.);
175 //
176 tocv->DefineSection(4,247.6,270.4,278.);
177 tocv->DefineSection(5,250.6,270.4,278.);
178 //
179 TGeoMedium *m3 = gGeoManager->GetMedium("TPC_Al");
180 TGeoVolume *v3 = new TGeoVolume("TPC_OCV",tocv,m3);
181 //
182 TGeoTube *to1 = new TGeoTube(274.8174,277.995,252.1); //epoxy
183 TGeoTube *to2 = new TGeoTube(274.8274,277.985,252.1); //tedlar
184 TGeoTube *to3 = new TGeoTube(274.8312,277.9812,252.1);//prepreg2
185 TGeoTube *to4 = new TGeoTube(274.9062,277.9062,252.1);//nomex
186 //
187 TGeoMedium *sm1 = gGeoManager->GetMedium("TPC_Epoxy");
188 TGeoMedium *sm2 = gGeoManager->GetMedium("TPC_Tedlar");
189 TGeoMedium *sm3 = gGeoManager->GetMedium("TPC_Prepreg2");
190 TGeoMedium *sm4 = gGeoManager->GetMedium("TPC_Nomex");
191 //
192 TGeoVolume *tov1 = new TGeoVolume("TPC_OCV1",to1,sm1);
193 TGeoVolume *tov2 = new TGeoVolume("TPC_OCV2",to2,sm2);
194 TGeoVolume *tov3 = new TGeoVolume("TPC_OCV3",to3,sm3);
195 TGeoVolume *tov4 = new TGeoVolume("TPC_OCV4",to4,sm4);
196 //-------------------------------------------------------
37831078 197 // Tpc Outer Field Cage
c1637e41 198 // daughters - composite (sandwich)
37831078 199 //-------------------------------------------------------
1283eee5 200
c1637e41 201 TGeoPcon *tofc = new TGeoPcon(0.,360.,6);
79575d04 202 //
c1637e41 203 tofc->DefineSection(0,-253.6,258.,269.6);
204 tofc->DefineSection(1,-250.6,258.,269.6);
37831078 205 //
c1637e41 206 tofc->DefineSection(2,-250.6,258.,260.0676);
207 tofc->DefineSection(3,250.6,258.,260.0676);
37831078 208 //
c1637e41 209 tofc->DefineSection(4,250.6,258.,275.5);
210 tofc->DefineSection(5,253.6,258.,275.5);
37831078 211 //
c1637e41 212 TGeoVolume *v4 = new TGeoVolume("TPC_TOFC",tofc,m3);
213 //sandwich
214 TGeoTube *tf1 = new TGeoTube(258.0,260.0676,252.1); //tedlar
215 TGeoTube *tf2 = new TGeoTube(258.0038,260.0638,252.1); //prepreg3
216 TGeoTube *tf3 = new TGeoTube(258.0338,260.0338,252.1);//nomex
37831078 217 //
c1637e41 218 TGeoMedium *sm5 = gGeoManager->GetMedium("TPC_Prepreg3");
37831078 219 //
c1637e41 220 TGeoVolume *tf1v = new TGeoVolume("TPC_OFC1",tf1,sm2);
221 TGeoVolume *tf2v = new TGeoVolume("TPC_OFC2",tf2,sm5);
222 TGeoVolume *tf3v = new TGeoVolume("TPC_OFC3",tf3,sm4);
37831078 223 //
c1637e41 224 // outer part - positioning
37831078 225 //
c1637e41 226 tov1->AddNode(tov2,1); tov2->AddNode(tov3,1); tov3->AddNode(tov4,1);
37831078 227 //
c1637e41 228 tf1v->AddNode(tf2v,1); tf2v->AddNode(tf3v,1);
37831078 229 //
456cb019 230 v3->AddNode(tov1,1,new TGeoTranslation(0.,0.,-1.5)); v4->AddNode(tf1v,1);
37831078 231 //
c1637e41 232 v2->AddNode(v3,1); v2->AddNode(v4,1);
37831078 233 //
c1637e41 234 v1->AddNode(v2,1);
235 //--------------------------------------------------------------------
236 // Tpc Inner INsulator (CO2)
237 // the cones, the central drum and the inner f.c. sandwich with a piece
238 // of the flane will be placed in the TPC
239 //--------------------------------------------------------------------
240 TGeoPcon *tpci = new TGeoPcon(0.,360.,4);
37831078 241 //
c1637e41 242 tpci->DefineSection(0,-253.6,68.4,76.6774);
243 tpci->DefineSection(1,-74.0,61.2,76.6774);
37831078 244 //
c1637e41 245 tpci->DefineSection(2,74.0,61.2,76.6774);
37831078 246 //
c1637e41 247 tpci->DefineSection(3,253.6,65.9,76.6774);
37831078 248 //
c1637e41 249 TGeoVolume *v5 = new TGeoVolume("TPC_INI",tpci,m2);
37831078 250 //
c1637e41 251 // now the inner field cage - only part of flanges (2 copies)
37831078 252 //
c1637e41 253 TGeoTube *tif1 = new TGeoTube(69.9,76.6774,1.5);
254 TGeoVolume *v6 = new TGeoVolume("TPC_IFC1",tif1,m3);
37831078 255 //
c1637e41 256 //---------------------------------------------------------
257 // Tpc Inner Containment vessel - Muon side
79575d04 258 //---------------------------------------------------------
c1637e41 259 TGeoPcon *tcms = new TGeoPcon(0.,360.,10);
37831078 260 //
c1637e41 261 tcms->DefineSection(0,-259.1,68.1,74.2);
262 tcms->DefineSection(1,-253.6,68.1,74.2);
37831078 263 //
c1637e41 264 tcms->DefineSection(2,-253.6,68.1,68.4);
265 tcms->DefineSection(3,-74.0,60.9,61.2);
37831078 266 //
c1637e41 267 tcms->DefineSection(4,-74.0,60.1,61.2);
268 tcms->DefineSection(5,-73.3,60.1,61.2);
37831078 269 //
c1637e41 270 tcms->DefineSection(6,-73.3,56.9,61.2);
271 tcms->DefineSection(7,-73.0,56.9,61.2);
37831078 272 //
c1637e41 273 tcms->DefineSection(8,-73.0,56.9,58.8);
274 tcms->DefineSection(9,-71.3,56.9,58.8);
37831078 275 //
c1637e41 276 TGeoVolume *v7 = new TGeoVolume("TPC_ICVM",tcms,m3);
277 //-----------------------------------------------
278 // inner containment vessel - shaft side
279 //-----------------------------------------------
280 TGeoPcon *tcss = new TGeoPcon(0.,360.,10);
37831078 281 //
c1637e41 282 tcss->DefineSection(0,71.3,56.9,58.8);
283 tcss->DefineSection(1,73.0,56.9,58.8);
1283eee5 284 //
c1637e41 285 tcss->DefineSection(2,73.0,56.9,61.2);
286 tcss->DefineSection(3,73.3,56.9,61.2);
287 //
288 tcss->DefineSection(4,73.3,60.1,61.2);
289 tcss->DefineSection(5,74.0,60.1,61.2);
1283eee5 290 //
c1637e41 291 tcss->DefineSection(6,74.0,60.9,61.2);
292 tcss->DefineSection(7,253.6,65.6,65.9);
37831078 293 //
c1637e41 294 tcss->DefineSection(8,253.6,65.6,74.2);
295 tcss->DefineSection(9,258.1,65.6,74.2);
1283eee5 296 //
c1637e41 297 TGeoVolume *v8 = new TGeoVolume("TPC_ICVS",tcss,m3);
298 //-----------------------------------------------
299 // Inner field cage
300 // define 4 parts and make an assembly
301 //-----------------------------------------------
302 // part1 - Al - 2 copies
303 TGeoTube *t1 = new TGeoTube(76.6774,78.845,0.75);
304 TGeoVolume *tv1 = new TGeoVolume("TPC_IFC2",t1,m3);
305 // sandwich - outermost parts - 2 copies
306 TGeoTube *t2 = new TGeoTube(76.6774,78.845,74.175); // tedlar 38 microns
307 TGeoTube *t3 = new TGeoTube(76.6812,78.8412,74.175); // prepreg2 500 microns
308 TGeoTube *t4 = new TGeoTube(76.7312,78.7912,74.175); // prepreg3 300 microns
309 TGeoTube *t5 = new TGeoTube(76.7612,78.7612,74.175); // nomex 2 cm
1283eee5 310 //
c1637e41 311 TGeoVolume *tv2 = new TGeoVolume("TPC_IFC3",t2,sm2);
312 TGeoVolume *tv3 = new TGeoVolume("TPC_IFC4",t3,sm3);
313 TGeoVolume *tv4 = new TGeoVolume("TPC_IFC5",t4,sm5);
314 TGeoVolume *tv5 = new TGeoVolume("TPC_IFC6",t5,sm4);
37831078 315 //
c1637e41 316 // middle parts - 2 copies
317 TGeoTube *t6 = new TGeoTube(76.6774,78.795,5.); // tedlar 38 microns
318 TGeoTube *t7 = new TGeoTube(76.6812,78.7912,5.); // prepreg2 250 microns
319 TGeoTube *t8 = new TGeoTube(76.7062,78.7662,5.); // prepreg3 300 microns
320 TGeoTube *t9 = new TGeoTube(76.7362,78.7362,5.); // nomex 2 cm
79575d04 321 //
c1637e41 322 TGeoVolume *tv6 = new TGeoVolume("TPC_IFC7",t6,sm2);
323 TGeoVolume *tv7 = new TGeoVolume("TPC_IFC8",t7,sm3);
324 TGeoVolume *tv8 = new TGeoVolume("TPC_IFC9",t8,sm5);
325 TGeoVolume *tv9 = new TGeoVolume("TPC_IFC10",t9,sm4);
326 // central part - 1 copy
327 TGeoTube *t10 = new TGeoTube(76.6774,78.745,93.75); // tedlar 38 microns
328 TGeoTube *t11 = new TGeoTube(76.6812,78.7412,93.75); // prepreg3 300 microns
329 TGeoTube *t12 = new TGeoTube(76.7112,78.7112,93.75); // nomex 2 cm
79575d04 330 //
c1637e41 331 TGeoVolume *tv10 = new TGeoVolume("TPC_IFC11",t10,sm2);
332 TGeoVolume *tv11 = new TGeoVolume("TPC_IFC12",t11,sm5);
333 TGeoVolume *tv12 = new TGeoVolume("TPC_IFC13",t12,sm4);
79575d04 334 //
c1637e41 335 // inner part - positioning
79575d04 336 //
c1637e41 337 // creating a sandwich
338 tv2->AddNode(tv3,1); tv3->AddNode(tv4,1); tv4->AddNode(tv5,1);
79575d04 339 //
c1637e41 340 tv6->AddNode(tv7,1); tv7->AddNode(tv8,1); tv8->AddNode(tv9,1);
79575d04 341 //
c1637e41 342 tv10->AddNode(tv11,1); tv11->AddNode(tv12,1);
37831078 343 //
c1637e41 344 TGeoVolumeAssembly *tv100 = new TGeoVolumeAssembly("TPC_IFC");
37831078 345 //
c1637e41 346 tv100->AddNode(tv10,1);
347 tv100->AddNode(tv6,1,new TGeoTranslation(0.,0.,-98.75));
348 tv100->AddNode(tv6,2,new TGeoTranslation(0.,0.,98.75));
349 tv100->AddNode(tv2,1,new TGeoTranslation(0.,0.,-177.925));
350 tv100->AddNode(tv2,2,new TGeoTranslation(0.,0.,177.925));
351 tv100->AddNode(tv1,1,new TGeoTranslation(0.,0.,-252.85));
352 tv100->AddNode(tv1,2,new TGeoTranslation(0.,0.,252.85));
353 //
354 v5->AddNode(v6,1, new TGeoTranslation(0.,0.,-252.1));
355 v5->AddNode(v6,2, new TGeoTranslation(0.,0.,252.1));
356 v1->AddNode(v5,1); v1->AddNode(v7,1); v1->AddNode(v8,1);
357 v9->AddNode(tv100,1);
358 //
359 // central drum
360 //
361 // flange + sandwich
362 //
363 TGeoPcon *cfl = new TGeoPcon(0.,360.,6);
364 cfl->DefineSection(0,-71.1,59.7,61.2);
365 cfl->DefineSection(1,-68.6,59.7,61.2);
366 //
367 cfl->DefineSection(2,-68.6,60.6324,61.2);
368 cfl->DefineSection(3,68.6,60.6324,61.2);
369 //
370 cfl->DefineSection(4,68.6,59.7,61.2);
371 cfl->DefineSection(5,71.1,59.7,61.2);
372 //
373 TGeoVolume *cflv = new TGeoVolume("TPC_CDR",cfl,m3);
374 // sandwich
375 TGeoTube *cd1 = new TGeoTube(60.6424,61.19,71.1);
376 TGeoTube *cd2 = new TGeoTube(60.6462,61.1862,71.1);
377 TGeoTube *cd3 = new TGeoTube(60.6662,61.1662,71.1);
378 //
379 TGeoMedium *sm6 = gGeoManager->GetMedium("TPC_Prepreg1");
380 TGeoVolume *cd1v = new TGeoVolume("TPC_CDR1",cd1,sm2); //tedlar
381 TGeoVolume *cd2v = new TGeoVolume("TPC_CDR2",cd2,sm6);// prepreg1
382 TGeoVolume *cd3v = new TGeoVolume("TPC_CDR3",cd3,sm4); //nomex
383 //
384 // seals for central drum 2 copies
385 //
386 TGeoTube *cs = new TGeoTube(56.9,61.2,0.1);
387 TGeoMedium *sm7 = gGeoManager->GetMedium("TPC_Mylar");
388 TGeoVolume *csv = new TGeoVolume("TPC_CDRS",cs,sm7);
389 v1->AddNode(csv,1,new TGeoTranslation(0.,0.,-71.));
390 v1->AddNode(csv,2,new TGeoTranslation(0.,0.,71.));
391 //
392 // seal collars
393 TGeoPcon *se = new TGeoPcon(0.,360.,6);
394 se->DefineSection(0,-72.8,59.7,61.2);
395 se->DefineSection(1,-72.3,59.7,61.2);
396 //
397 se->DefineSection(2,-72.3,58.85,61.2);
398 se->DefineSection(3,-71.6,58.85,61.2);
399 //
400 se->DefineSection(4,-71.6,59.7,61.2);
401 se->DefineSection(5,-71.3,59.7,61.2);
402 //
403 TGeoVolume *sev = new TGeoVolume("TPC_CDCE",se,m3);
404 //
405 TGeoTube *si = new TGeoTube(56.9,58.8,1.);
406 TGeoVolume *siv = new TGeoVolume("TPC_CDCI",si,m3);
407 //
408 // define reflection matrix
409 //
4fa47888 410 TGeoRotation *ref = new TGeoRotation("ref",90.,0.,90.,90.,180.,0.);
c1637e41 411 //
412 cd1v->AddNode(cd2v,1); cd2v->AddNode(cd3v,1); cflv->AddNode(cd1v,1);
413 //
a1ec4d07 414 v1->AddNode(siv,1,new TGeoTranslation(0.,0.,-69.9));
415 v1->AddNode(siv,2,new TGeoTranslation(0.,0.,69.9));
c1637e41 416 v1->AddNode(sev,1); v1->AddNode(sev,2,ref); v1->AddNode(cflv,1);
417 //
418 // central membrane - 2 rings and a mylar membrane - assembly
419 //
420 TGeoTube *ih = new TGeoTube(81.05,84.05,0.3);
421 TGeoTube *oh = new TGeoTube(250.,256.,.5);
422 TGeoTube *mem = new TGeoTube(84.05,250,0.01);
423 TGeoVolume *ihv = new TGeoVolume("TPC_IHVH",ih,m3);
424 TGeoVolume *ohv = new TGeoVolume("TPC_OHVH",oh,m3);
425 TGeoVolume *memv = new TGeoVolume("TPC_HV",mem,sm7);
426 //
427 TGeoVolumeAssembly *cm = new TGeoVolumeAssembly("TPC_HVMEM");
428 cm->AddNode(ihv,1);
429 cm->AddNode(ohv,1);
430 cm->AddNode(memv,1);
431 v9->AddNode(cm,1);
432 //
433 // end caps - they are make as an assembly of single segments
434 // containing both readout chambers
435 //
d899e254 436 Double_t openingAngle = 10.*TMath::DegToRad();
c1637e41 437 Double_t thick=1.5; // rib
d899e254 438 Double_t shift = thick/TMath::Sin(openingAngle);
c1637e41 439 //
d899e254 440 Double_t lowEdge = 86.3; // hole in the wheel
441 Double_t upEdge = 240.4; // hole in the wheel
c1637e41 442 //
443 new TGeoTubeSeg("sec",74.5,264.4,3.,0.,20.);
444 //
445 TGeoPgon *hole = new TGeoPgon("hole",0.,20.,1,4);
446 //
d899e254 447 hole->DefineSection(0,-3.5,lowEdge-shift,upEdge-shift);
448 hole->DefineSection(1,-1.5,lowEdge-shift,upEdge-shift);
c1637e41 449 //
d899e254 450 hole->DefineSection(2,-1.5,lowEdge-shift,upEdge+3.-shift);
451 hole->DefineSection(3,3.5,lowEdge-shift,upEdge+3.-shift);
c1637e41 452 //
d899e254 453 Double_t ys = shift*TMath::Sin(openingAngle);
454 Double_t xs = shift*TMath::Cos(openingAngle);
c1637e41 455 TGeoTranslation *tr = new TGeoTranslation("tr",xs,ys,0.);
456 tr->RegisterYourself();
457 TGeoCompositeShape *chamber = new TGeoCompositeShape("sec-hole:tr");
458 TGeoVolume *sv = new TGeoVolume("TPC_WSEG",chamber,m3);
459 TGeoPgon *bar = new TGeoPgon("bar",0.,20.,1,2);
460 bar->DefineSection(0,-3.,131.5-shift,136.5-shift);
461 bar->DefineSection(1,1.5,131.5-shift,136.5-shift);
462 TGeoVolume *barv = new TGeoVolume("TPC_WBAR",bar,m3);
463 TGeoVolumeAssembly *ch = new TGeoVolumeAssembly("TPC_WCH");//empty segment
464 //
465 ch->AddNode(sv,1); ch->AddNode(barv,1,tr);
466 //
467 // readout chambers
468 //
469 // IROC first
470 //
471 TGeoTrd1 *ibody = new TGeoTrd1(13.8742,21.3328,4.29,21.15);
472 TGeoVolume *ibdv = new TGeoVolume("TPC_IROCB",ibody,m3);
37831078 473 // empty space
c1637e41 474 TGeoTrd1 *emp = new TGeoTrd1(12.3742,19.8328,3.99,19.65);
475 TGeoVolume *empv = new TGeoVolume("TPC_IROCE",emp,m1);
476 ibdv->AddNode(empv,1,new TGeoTranslation(0.,-0.3,0.));
477 //bars
478 Double_t tga = (19.8328-12.3742)/39.3;
479 Double_t xmin,xmax;
480 xmin = 9.55*tga+12.3742;
481 xmax = 9.95*tga+12.3742;
482 TGeoTrd1 *ib1 = new TGeoTrd1(xmin,xmax,3.29,0.2);
483 TGeoVolume *ib1v = new TGeoVolume("TPC_IRB1",ib1,m3);
484 empv->AddNode(ib1v,1,new TGeoTranslation("tt1",0.,0.7,-9.9));
485 xmin=19.4*tga+12.3742;
486 xmax=19.9*tga+12.3742;
487 TGeoTrd1 *ib2 = new TGeoTrd1(xmin,xmax,3.29,0.25);
488 TGeoVolume *ib2v = new TGeoVolume("TPC_TRB2",ib2,m3);
489 empv->AddNode(ib2v,1,new TGeoTranslation(0.,0.7,0.));
490 xmin=29.35*tga+12.3742;
491 xmax=29.75*tga+12.3742;
492 TGeoTrd1 *ib3 = new TGeoTrd1(xmin,xmax,3.29,0.2);
493 TGeoVolume *ib3v = new TGeoVolume("TPC_IRB3",ib3,m3);
494 empv->AddNode(ib3v,1,new TGeoTranslation(0.,0.7,9.9));
495 //
496 // holes for connectors
497 //
498 TGeoBBox *conn = new TGeoBBox(0.4,0.3,4.675); // identical for iroc and oroc
499 TGeoVolume *connv = new TGeoVolume("TPC_RCCON",conn,m1);
d9e80aca 500 TString fileName(gSystem->Getenv("ALICE_ROOT"));
501 fileName += "/TPC/conn_iroc.dat";
c1637e41 502 ifstream in;
d9e80aca 503 in.open(fileName.Data(), ios_base::in); // asci file
c1637e41 504 for(Int_t i =0;i<86;i++){
456cb019 505 Double_t y = 3.99;
c1637e41 506 Double_t x,z,ang;
507 in>>x>>z>>ang;
456cb019 508 z-=26.5;
c1637e41 509 TGeoRotation *rrr = new TGeoRotation();
510 rrr->RotateY(ang);
511 TGeoCombiTrans *trans = new TGeoCombiTrans("trans",x,y,z,rrr);
512 ibdv->AddNode(connv,i+1,trans);
513 }
514 in.close();
515 // "cap"
516 new TGeoTrd1("icap",14.5974,23.3521,1.19,24.825);
517 // "hole"
518 new TGeoTrd1("ihole",13.8742,21.3328,1.2,21.15);
519 TGeoTranslation *tr1 = new TGeoTranslation("tr1",0.,0.,1.725);
520 tr1->RegisterYourself();
521 TGeoCompositeShape *ic = new TGeoCompositeShape("icap-ihole:tr1");
522 TGeoVolume *icv = new TGeoVolume("TPC_IRCAP",ic,m3);
523 //
524 // pad plane and wire fixations
525 //
526 TGeoTrd1 *pp = new TGeoTrd1(14.5974,23.3521,0.3,24.825); //pad+iso
527 TGeoMedium *m4 = gGeoManager->GetMedium("TPC_G10");
528 TGeoVolume *ppv = new TGeoVolume("TPC_IRPP",pp,m4);
529 TGeoPara *f1 = new TGeoPara(.6,.5,24.825,0.,-10.,0.);
530 TGeoVolume *f1v = new TGeoVolume("TPC_IRF1",f1,m4);
531 TGeoPara *f2 = new TGeoPara(.6,.5,24.825,0.,10.,0.);
532 TGeoVolume *f2v = new TGeoVolume("TPC_IRF2",f2,m4);
533 //
534 TGeoVolumeAssembly *iroc = new TGeoVolumeAssembly("TPC_IROC");
535 //
536 iroc->AddNode(ibdv,1);
537 iroc->AddNode(icv,1,new TGeoTranslation(0.,3.1,-1.725));
538 iroc->AddNode(ppv,1,new TGeoTranslation(0.,4.59,-1.725));
539 tga =(23.3521-14.5974)/49.65;
540 Double_t xx = 24.825*tga+14.5974-0.6;
541 iroc->AddNode(f1v,1,new TGeoTranslation(-xx,5.39,-1.725));
542 iroc->AddNode(f2v,1,new TGeoTranslation(xx,5.39,-1.725));
543 //
544 // OROC
545 //
546 TGeoTrd1 *obody = new TGeoTrd1(22.2938,40.5084,4.19,51.65);
547 TGeoVolume *obdv = new TGeoVolume("TPC_OROCB",obody,m3);
548 TGeoTrd1 *oemp = new TGeoTrd1(20.2938,38.5084,3.89,49.65);
549 TGeoVolume *oempv = new TGeoVolume("TPC_OROCE",oemp,m1);
550 obdv->AddNode(oempv,1,new TGeoTranslation(0.,-0.3,0.));
551 //horizontal bars
552 tga=(38.5084-20.2938)/99.3;
553 xmin=tga*10.2+20.2938;
554 xmax=tga*10.6+20.2938;
555 TGeoTrd1 *ob1 = new TGeoTrd1(xmin,xmax,2.915,0.2);
556 TGeoVolume *ob1v = new TGeoVolume("TPC_ORB1",ob1,m3);
557 //
558 xmin=22.55*tga+20.2938;
559 xmax=24.15*tga+20.2938;
560 TGeoTrd1 *ob2 = new TGeoTrd1(xmin,xmax,2.915,0.8);
561 TGeoVolume *ob2v = new TGeoVolume("TPC_ORB2",ob2,m3);
562 //
563 xmin=36.1*tga+20.2938;
564 xmax=36.5*tga+20.2938;
565 TGeoTrd1 *ob3 = new TGeoTrd1(xmin,xmax,2.915,0.2);
566 TGeoVolume *ob3v = new TGeoVolume("TPC_ORB3",ob3,m3);
567 //
568 xmin=49.0*tga+20.2938;
569 xmax=50.6*tga+20.2938;
570 TGeoTrd1 *ob4 = new TGeoTrd1(xmin,xmax,2.915,0.8);
571 TGeoVolume *ob4v = new TGeoVolume("TPC_ORB4",ob4,m3);
572 //
573 xmin=63.6*tga+20.2938;
574 xmax=64.0*tga+20.2938;
575 TGeoTrd1 *ob5 = new TGeoTrd1(xmin,xmax,2.915,0.2);
576 TGeoVolume *ob5v = new TGeoVolume("TPC_ORB5",ob5,m3);
577 //
578 xmin=75.5*tga+20.2938;
579 xmax=77.15*tga+20.2938;
580 TGeoTrd1 *ob6 = new TGeoTrd1(xmin,xmax,2.915,0.8);
581 TGeoVolume *ob6v = new TGeoVolume("TPC_ORB6",ob6,m3);
582 //
583 xmin=88.7*tga+20.2938;
584 xmax=89.1*tga+20.2938;
585 TGeoTrd1 *ob7 = new TGeoTrd1(xmin,xmax,2.915,0.2);
586 TGeoVolume *ob7v = new TGeoVolume("TPC_ORB7",ob7,m3);
587 //
588 oempv->AddNode(ob1v,1,new TGeoTranslation(0.,0.975,-39.25));
589 oempv->AddNode(ob2v,1,new TGeoTranslation(0.,0.975,-26.3));
590 oempv->AddNode(ob3v,1,new TGeoTranslation(0.,0.975,-13.35));
591 oempv->AddNode(ob4v,1,new TGeoTranslation(0.,0.975,0.15));
592 oempv->AddNode(ob5v,1,new TGeoTranslation(0.,0.975,14.15));
593 oempv->AddNode(ob6v,1,new TGeoTranslation(0.,0.975,26.7));
594 oempv->AddNode(ob7v,1,new TGeoTranslation(0.,0.975,39.25));
595 // vertical bars
596 TGeoBBox *ob8 = new TGeoBBox(0.8,2.915,5.1);
597 TGeoBBox *ob9 = new TGeoBBox(0.8,2.915,5.975);
598 TGeoBBox *ob10 = new TGeoBBox(0.8,2.915,5.775);
599 TGeoBBox *ob11 = new TGeoBBox(0.8,2.915,6.25);
600 TGeoBBox *ob12 = new TGeoBBox(0.8,2.915,6.5);
601 //
602 TGeoVolume *ob8v = new TGeoVolume("TPC_ORB8",ob8,m3);
603 TGeoVolume *ob9v = new TGeoVolume("TPC_ORB9",ob9,m3);
604 TGeoVolume *ob10v = new TGeoVolume("TPC_ORB10",ob10,m3);
605 TGeoVolume *ob11v = new TGeoVolume("TPC_ORB11",ob11,m3);
606 TGeoVolume *ob12v = new TGeoVolume("TPC_ORB12",ob12,m3);
607 //
608 oempv->AddNode(ob8v,1,new TGeoTranslation(0.,0.975,-44.55));
609 oempv->AddNode(ob8v,2,new TGeoTranslation(0.,0.975,44.55));
610 oempv->AddNode(ob9v,1,new TGeoTranslation(0.,0.975,-33.075));
611 oempv->AddNode(ob9v,2,new TGeoTranslation(0.,0.975,-19.525));
612 oempv->AddNode(ob10v,1,new TGeoTranslation(0.,0.975,20.125));
613 oempv->AddNode(ob10v,2,new TGeoTranslation(0.,0.975,33.275));
614 oempv->AddNode(ob11v,1,new TGeoTranslation(0.,0.975,-6.9));
615 oempv->AddNode(ob12v,1,new TGeoTranslation(0.,0.975,7.45));
616 //
617 // holes for connectors
618 //
d9e80aca 619 fileName = gSystem->Getenv("ALICE_ROOT");
620 fileName += "/TPC/conn_oroc.dat";
621 in.open(fileName.Data(), ios_base::in); // asci file
c1637e41 622 for(Int_t i =0;i<78;i++){
623 Double_t y =3.89;
624 Double_t x,z,ang;
625 Double_t x1,z1,x2,z2;
626 in>>x>>z>>ang;
627 Double_t xr = 4.7*TMath::Sin(ang*TMath::DegToRad());
628 Double_t zr = 4.7*TMath::Cos(ang*TMath::DegToRad());
629 //
630 x1=xr+x; x2=-xr+x; z1=zr+z; z2 = -zr+z;
631 //
632 TGeoRotation *rr = new TGeoRotation();
633 rr->RotateY(ang);
634 z1-=54.95;
635 z2-=54.95;
636 TGeoCombiTrans *trans1 = new TGeoCombiTrans("trans1",x1,y,z1,rr);
637 TGeoCombiTrans *trans2 = new TGeoCombiTrans("trans2",x2,y,z2,rr);
638 obdv->AddNode(connv,i+1,trans1);
639 obdv->AddNode(connv,i+79,trans2);
640 }
641 in.close();
642 // cap
643 new TGeoTrd1("ocap",23.3874,43.5239,1.09,57.1);
644 new TGeoTrd1("ohole",22.2938,40.5084,1.09,51.65);
645 TGeoTranslation *tr5 = new TGeoTranslation("tr5",0.,0.,-2.15);
646 tr5->RegisterYourself();
647 TGeoCompositeShape *oc = new TGeoCompositeShape("ocap-ohole:tr5");
648 TGeoVolume *ocv = new TGeoVolume("TPC_ORCAP",oc,m3);
649 //
650 // pad plane and wire fixations
651 //
652 TGeoTrd1 *opp = new TGeoTrd1(23.3874,43.5239,0.3,57.1);
653 TGeoVolume *oppv = new TGeoVolume("TPC_ORPP",opp,m4);
654 //
655 tga=(43.5239-23.3874)/114.2;
656 TGeoPara *f3 = new TGeoPara(.7,.6,57.1,0.,-10.,0.);
657 TGeoPara *f4 = new TGeoPara(.7,.6,57.1,0.,10.,0.);
658 xx = 57.1*tga+23.3874-0.7;
659 TGeoVolume *f3v = new TGeoVolume("TPC_ORF1",f3,m4);
660 TGeoVolume *f4v = new TGeoVolume("TPC_ORF2",f4,m4);
661 //
662 TGeoVolumeAssembly *oroc = new TGeoVolumeAssembly("TPC_OROC");
663 //
664 oroc->AddNode(obdv,1);
665 oroc->AddNode(ocv,1,new TGeoTranslation(0.,3.1,2.15));
666 oroc->AddNode(oppv,1,new TGeoTranslation(0.,4.49,2.15));
667 oroc->AddNode(f3v,1,new TGeoTranslation(-xx,5.39,2.15));
668 oroc->AddNode(f4v,1,new TGeoTranslation(xx,5.39,2.15));
669 //
670 // now iroc and oroc are placed into a sector...
671 //
a1ec4d07 672 TGeoVolumeAssembly *secta = new TGeoVolumeAssembly("TPC_SECT"); // a-side
673 TGeoVolumeAssembly *sectc = new TGeoVolumeAssembly("TPC_SECT"); // c-side
c1637e41 674 TGeoRotation rot1("rot1",90.,90.,0.);
675 TGeoRotation rot2("rot2");
676 rot2.RotateY(10.);
677 TGeoRotation *rot = new TGeoRotation("rot");
678 *rot=rot1*rot2;
679 //
680 Double_t x0,y0;
d899e254 681 x0=110.2*TMath::Cos(openingAngle);
682 y0=110.2*TMath::Sin(openingAngle);
a1ec4d07 683 TGeoCombiTrans *combi1a = new TGeoCombiTrans("combi1",x0,y0,1.09+0.222,rot); //a-side
684 TGeoCombiTrans *combi1c = new TGeoCombiTrans("combi1",x0,y0,1.09+0.195,rot); //c-side
d899e254 685 x0=188.45*TMath::Cos(openingAngle);
686 y0=188.45*TMath::Sin(openingAngle);
a1ec4d07 687 TGeoCombiTrans *combi2a = new TGeoCombiTrans("combi2",x0,y0,0.99+0.222,rot); //a-side
688 TGeoCombiTrans *combi2c = new TGeoCombiTrans("combi2",x0,y0,0.99+0.195,rot); //c-side
c1637e41 689 //
c1637e41 690 //
a1ec4d07 691 // A-side
c1637e41 692 //
a1ec4d07 693 secta->AddNode(ch,1);
694 secta->AddNode(iroc,1,combi1a);
695 secta->AddNode(oroc,1,combi2a);
696 //
697 // C-side
698 //
699 sectc->AddNode(ch,1);
700 sectc->AddNode(iroc,1,combi1c);
701 sectc->AddNode(oroc,1,combi2c);
702 //
703 // now I try to make wheels...
704 //
705 TGeoVolumeAssembly *wheela = new TGeoVolumeAssembly("TPC_ENDCAP");
706 TGeoVolumeAssembly *wheelc = new TGeoVolumeAssembly("TPC_ENDCAP");
c1637e41 707 //
708 for(Int_t i =0;i<18;i++){
709 Double_t phi = (20.*i);
710 TGeoRotation *r = new TGeoRotation();
711 r->RotateZ(phi);
a1ec4d07 712 wheela->AddNode(secta,i+1,r);
713 wheelc->AddNode(sectc,i+1,r);
c1637e41 714
715 }
4fa47888 716 // wheels in the drift volume!
a1ec4d07 717
c1637e41 718 TGeoCombiTrans *combi3 = new TGeoCombiTrans("combi3",0.,0.,256.6,ref);
a1ec4d07 719 v9->AddNode(wheela,1,combi3);
720 v9->AddNode(wheelc,2,new TGeoTranslation(0.,0.,-256.6));
c1637e41 721 //_____________________________________________________________
722 // service support wheel
723 //_____________________________________________________________
724 TGeoPgon *sw = new TGeoPgon(0.,20.,1,2);
725 sw->DefineSection(0,-4.,80.5,251.75);
726 sw->DefineSection(1,4.,80.5,251.75);
727 TGeoVolume *swv = new TGeoVolume("TPC_SWSEG",sw,m3); //Al
728 //
729 thick=1.;
d899e254 730 shift = thick/TMath::Sin(openingAngle);
c1637e41 731 TGeoPgon *sh = new TGeoPgon(0.,20.,1,2);
732 sh->DefineSection(0,-4.,81.5-shift,250.75-shift);
733 sh->DefineSection(1,4.,81.5-shift,250.75-shift);
734 TGeoVolume *shv = new TGeoVolume("TPC_SWS1",sh,m1); //Air
735 //
74518339 736 TGeoMedium *m9 = gGeoManager->GetMedium("TPC_Si");
737 TGeoPgon *el = new TGeoPgon(0.,20.,1,2);
738 el->DefineSection(0,-1.872,81.5-shift,250.75-shift);
739 el->DefineSection(1,1.872,81.5-shift,250.75-shift);
740 TGeoVolume *elv = new TGeoVolume("TPC_ELEC",el,m9); //Si
741 //
742 shv->AddNode(elv,1);
743 //
744 //
d899e254 745 ys = shift*TMath::Sin(openingAngle);
746 xs = shift*TMath::Cos(openingAngle);
c1637e41 747 swv->AddNode(shv,1,new TGeoTranslation(xs,ys,0.));
748 // cover
749 TGeoPgon *co = new TGeoPgon(0.,20.,1,2);
750 co->DefineSection(0,-0.5,77.,255.25);
751 co->DefineSection(1,0.5,77.,255.25);
752 TGeoVolume *cov = new TGeoVolume("TPC_SWC1",co,m3);//Al
753 // hole in a cover
754 TGeoPgon *coh = new TGeoPgon(0.,20.,1,2);
d899e254 755 shift=4./TMath::Sin(openingAngle);
c1637e41 756 coh->DefineSection(0,-0.5,85.-shift,247.25-shift);
757 coh->DefineSection(1,0.5,85.-shift,247.25-shift);
758 //
759 TGeoVolume *cohv = new TGeoVolume("TPC_SWC2",coh,m1);
760 //
d899e254 761 ys = shift*TMath::Sin(openingAngle);
762 xs = shift*TMath::Cos(openingAngle);
c1637e41 763 cov->AddNode(cohv,1,new TGeoTranslation(xs,ys,0.));
764 //
765 // Sector as an Assembly
766 //
767 TGeoVolumeAssembly *swhs = new TGeoVolumeAssembly("TPC_SSWSEC");
768 swhs->AddNode(swv,1);
769 swhs->AddNode(cov,1,new TGeoTranslation(0.,0.,-4.5));
770 swhs->AddNode(cov,2,new TGeoTranslation(0.,0.,4.5));
771 //
772 // SSW as an Assembly of sectors
773 //
774 TGeoVolumeAssembly *swheel = new TGeoVolumeAssembly("TPC_SSWHEEL");
775 for(Int_t i =0;i<18;i++){
776 Double_t phi = (20.*i);
777 TGeoRotation *r = new TGeoRotation();
778 r->RotateZ(phi);
779 swheel->AddNode(swhs,i+1,r);
780 }
781 v1->AddNode(swheel,1,new TGeoTranslation(0.,0.,-284.6));
782 v1->AddNode(swheel,2,new TGeoTranslation(0.,0.,284.6));
783
784 // sensitive strips - strip "0" is always set
785 // conditional
786 Int_t totrows;
787 totrows = fTPCParam->GetNRowLow() + fTPCParam->GetNRowUp();
788 Double_t *upar;
789 upar=NULL;
790 gGeoManager->Volume("TPC_Strip","PGON",m5->GetId(),upar);
791 upar=new Double_t [10];
792 upar[0]=0.;
793 upar[1]=360.;
794 upar[2]=18.;
795 upar[3]=2.;
796 //
797 upar[4]=-124.8;
798 upar[7]=124.8;
799
800 Double_t rlow=fTPCParam->GetPadRowRadiiLow(0);
801
802 upar[5]=rlow;
803 upar[6]=rlow+.01;
804 upar[8]=upar[5];
805 upar[9]=upar[6];
806 //
807 gGeoManager->Node("TPC_Strip",1,"TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
808 gGeoManager->Node("TPC_Strip",totrows+1,
809 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
810 //
811 // now, strips optionally
812 //
813 if(fSens){
814 //lower sectors
815 for(Int_t i=2;i<fTPCParam->GetNRowLow()+1;i++){
816 rlow=fTPCParam->GetPadRowRadiiLow(i-1);
817 upar[5]=rlow;
818 upar[6]=rlow+.01;
819 upar[8]=upar[5];
820 upar[9]=upar[6];
821 gGeoManager->Node("TPC_Strip",i,
822 "TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
823 gGeoManager->Node("TPC_Strip",totrows+i,
824 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
825 }
826 //upper sectors
827 for(Int_t i=1;i<fTPCParam->GetNRowUp()+1;i++){
828 rlow=fTPCParam->GetPadRowRadiiUp(i-1);
829 upar[5]=rlow;
830 upar[6]=rlow+.01;
831 upar[8]=upar[5];
832 upar[9]=upar[6];
833 gGeoManager->Node("TPC_Strip",i+fTPCParam->GetNRowLow(),
834 "TPC_Drift",0.,0.,124.82,0,kTRUE,upar,10);
835 gGeoManager->Node("TPC_Strip",totrows+i+fTPCParam->GetNRowLow(),
836 "TPC_Drift",0.,0.,-124.82,0,kTRUE,upar,10);
837 }
838 }//strips
37831078 839 //----------------------------------------------------------
c1637e41 840 // TPc Support Rods - MAKROLON
37831078 841 //----------------------------------------------------------
c1637e41 842 TGeoMedium *m6=gGeoManager->GetMedium("TPC_Makrolon");
843 TGeoMedium *m7=gGeoManager->GetMedium("TPC_Cu");
844 // upper and lower rods differ in length!
845 delete [] upar;
846 upar=NULL;
847 gGeoManager->Volume("TPC_Rod","TUBE",m6->GetId(),upar);
848 upar=new Double_t [3];
849 upar[0]=1.8;
850 upar[1]=2.2;
1283eee5 851
c1637e41 852 //
853 //HV rods - makrolon + 0.58cm (diameter) Cu
ae4806ca 854 TGeoTube *hvr = new TGeoTube(0.,2.2,126.64);
c1637e41 855 TGeoTube *hvc = new TGeoTube(0.,0.29,126.64);
856 //
857 TGeoVolume *hvrv = new TGeoVolume("TPC_HV_Rod",hvr,m6);
858 TGeoVolume *hvcv = new TGeoVolume("TPC_HV_Cable",hvc,m7);
859 hvrv->AddNode(hvcv,1);
860
7281dc07 861 for(Int_t i=0;i<18;i++){
c1637e41 862 Double_t angle,x,y;
863 Double_t z,r;
864 angle=TMath::DegToRad()*20.*(Double_t)i;
865 r=81.5;
866 x=r * TMath::Cos(angle);
867 y=r * TMath::Sin(angle);
868 upar[2]=126.64; //lower
869 z= 126.96;
870 if(i==15){
871 v9->AddNode(hvrv,1,new TGeoTranslation(x,y,z));
872 v9->AddNode(hvrv,2,new TGeoTranslation(x,y,-z));
37831078 873 }
874 else{
c1637e41 875 gGeoManager->Node("TPC_Rod",i+1,"TPC_Drift",x,y,z,0,kTRUE,upar,3);//shaft
0079eac0 876 gGeoManager->Node("TPC_Rod",i+19,"TPC_Drift",x,y,-z,0,kTRUE,upar,3);//muon
37831078 877 }
c1637e41 878 r=254.25;
879 x=r * TMath::Cos(angle);
880 y=r * TMath::Sin(angle);
881 upar[2]=126.54; //upper
882 z=127.06;
0079eac0 883 gGeoManager->Node("TPC_Rod",i+37,"TPC_Drift",x,y,z,0,kTRUE,upar,3);
884 gGeoManager->Node("TPC_Rod",i+55,"TPC_Drift",x,y,-z,0,kTRUE,upar,3);
37831078 885 }
1283eee5 886
bde68ab0 887 TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
888 alice->AddNode(v1,1);
c1637e41 889
1283eee5 890} // end of function
fe4da5cc 891
892//_____________________________________________________________________________
ac81c411 893void AliTPCv2::AddAlignableVolumes() const
894{
895 //
896 // Create entries for alignable volumes associating the symbolic volume
897 // name with the corresponding volume path. Needs to be syncronized with
898 // eventual changes in the geometry.
899 //
900 SetInnerChambersAlignable();
901 SetOuterChambersAlignable();
902}
903
904//_____________________________________________________________________________
905void AliTPCv2::SetInnerChambersAlignable() const
906{
907 //
908 Int_t modnum = 0;
d899e254 909 TString vpstr1 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_1/TPC_SECT_";
910 TString vpstr2 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_2/TPC_SECT_";
911 TString vpappend = "/TPC_IROC_1";
912 TString snstr1="TPC/EndcapA/Sector";
913 TString snstr2="TPC/EndcapC/Sector";
914 TString snappend="/InnerChamber";
ac81c411 915 TString volpath, symname;
916
1ac29fc4 917 for(Int_t cnt=1; cnt<=18; cnt++){
918 volpath = vpstr1;
919 volpath += cnt;
920 volpath += vpappend;
921 symname = snstr1;
922 symname += cnt;
923 symname += snappend;
84cbbd90 924 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
925 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
1ac29fc4 926 //
927 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data());
928 const char *path = alignableEntry->GetTitle();
929 if (!gGeoManager->cd(path))
930 AliFatal(Form("Volume path %s not valid!",path));
931 TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
932 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,cnt-1);
933 alignableEntry->SetMatrix(matTtoL);
934 modnum++;
935 }
65293f49 936
ac81c411 937 for(Int_t cnt=1; cnt<=18; cnt++){
d899e254 938 volpath = vpstr2;
ac81c411 939 volpath += cnt;
d899e254 940 volpath += vpappend;
941 symname = snstr2;
ac81c411 942 symname += cnt;
d899e254 943 symname += snappend;
84cbbd90 944 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
945 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
1ac29fc4 946 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data());
947 const char *path = alignableEntry->GetTitle();
948 if (!gGeoManager->cd(path))
949 AliFatal(Form("Volume path %s not valid!",path));
950 TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
951 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,18+cnt-1);
952 alignableEntry->SetMatrix(matTtoL);
ac81c411 953 modnum++;
954 }
955}
956
ac81c411 957//_____________________________________________________________________________
958void AliTPCv2::SetOuterChambersAlignable() const
959{
960 //
961 Int_t modnum = 0;
d899e254 962 TString vpstr1 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_1/TPC_SECT_";
963 TString vpstr2 = "ALIC_1/TPC_M_1/TPC_Drift_1/TPC_ENDCAP_2/TPC_SECT_";
964 TString vpappend = "/TPC_OROC_1";
965 TString snstr1="TPC/EndcapA/Sector";
966 TString snstr2="TPC/EndcapC/Sector";
967 TString snappend="/OuterChamber";
ac81c411 968 TString volpath, symname;
969
970 for(Int_t cnt=1; cnt<=18; cnt++){
d899e254 971 volpath = vpstr1;
ac81c411 972 volpath += cnt;
d899e254 973 volpath += vpappend;
974 symname = snstr1;
ac81c411 975 symname += cnt;
d899e254 976 symname += snappend;
84cbbd90 977 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
978 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
1ac29fc4 979 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data());
980 const char *path = alignableEntry->GetTitle();
981 if (!gGeoManager->cd(path))
982 AliFatal(Form("Volume path %s not valid!",path));
983 TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
984 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,36+cnt-1);
985 alignableEntry->SetMatrix(matTtoL);
ac81c411 986 modnum++;
987 }
84cbbd90 988
ac81c411 989 for(Int_t cnt=1; cnt<=18; cnt++){
d899e254 990 volpath = vpstr2;
ac81c411 991 volpath += cnt;
d899e254 992 volpath += vpappend;
993 symname = snstr2;
ac81c411 994 symname += cnt;
d899e254 995 symname += snappend;
84cbbd90 996 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
997 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
1ac29fc4 998 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data());
999 const char *path = alignableEntry->GetTitle();
1000 if (!gGeoManager->cd(path))
1001 AliFatal(Form("Volume path %s not valid!",path));
1002 TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
1003 TGeoHMatrix* matTtoL = fTPCParam->Tracking2LocalMatrix(globMatrix,36+18+cnt-1);
1004 alignableEntry->SetMatrix(matTtoL);
ac81c411 1005 modnum++;
1006 }
1007}
1008
1009//_____________________________________________________________________________
d899e254 1010void AliTPCv2::DrawDetector() const
fe4da5cc 1011{
1012 //
1013 // Draw a shaded view of the Time Projection Chamber version 1
1014 //
1015
fe4da5cc 1016 // Set everything unseen
cfce8870 1017 gMC->Gsatt("*", "seen", -1);
fe4da5cc 1018 //
1019 // Set ALIC mother transparent
cfce8870 1020 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 1021 //
1022 // Set the volumes visible
37831078 1023 //
1024
1025 gMC->Gsatt("TPC ","SEEN",0);
1026 gMC->Gsatt("TOIN","SEEN",1);
1027 gMC->Gsatt("TOIN","COLO",7);
37831078 1028 gMC->Gsatt("TOCV","SEEN",1);
1029 gMC->Gsatt("TOCV","COLO",4);
1030 gMC->Gsatt("TSA1","SEEN",0);
1031 gMC->Gsatt("TSA2","SEEN",0);
1032 gMC->Gsatt("TSA3","SEEN",0);
79575d04 1033 gMC->Gsatt("TSA4","SEEN",0);
1034 gMC->Gsatt("TSA5","SEEN",0);
37831078 1035 gMC->Gsatt("TOFC","SEEN",1);
1036 gMC->Gsatt("TOFC","COLO",4);
37831078 1037 gMC->Gsatt("TSA6","SEEN",0);
1038 gMC->Gsatt("TSA7","SEEN",0);
79575d04 1039 gMC->Gsatt("TSA8","SEEN",0);
37831078 1040 gMC->Gsatt("TIIN","SEEN",1);
79575d04 1041 gMC->Gsatt("TIIN","COLO",7);
1042 gMC->Gsatt("TII1","SEEN",0);
1043 gMC->Gsatt("TIFC","SEEN",1);
1044 gMC->Gsatt("TIFC","COLO",4);
1045 gMC->Gsatt("TSA9","SEEN",0);
37831078 1046 gMC->Gsatt("TS10","SEEN",0);
1047 gMC->Gsatt("TS11","SEEN",0);
1048 gMC->Gsatt("TS12","SEEN",0);
37831078 1049 gMC->Gsatt("TS13","SEEN",0);
1050 gMC->Gsatt("TS14","SEEN",0);
79575d04 1051 gMC->Gsatt("TICC","SEEN",0);
1052 gMC->Gsatt("TICM","SEEN",0);
37831078 1053 gMC->Gsatt("TS15","SEEN",0);
1054 gMC->Gsatt("TS16","SEEN",0);
37831078 1055 gMC->Gsatt("TS17","SEEN",0);
79575d04 1056 gMC->Gsatt("TS18","SEEN",0);
1057 gMC->Gsatt("TS19","SEEN",0);
1058 gMC->Gsatt("TPJ1","SEEN",0);
1059 gMC->Gsatt("TPJ2","SEEN",0);
1060 gMC->Gsatt("TICS","SEEN",0);
1061 gMC->Gsatt("TDGN","SEEN",0);
37831078 1062 gMC->Gsatt("TIRC","SEEN",0);
1063 gMC->Gsatt("TIC1","SEEN",1);
1064 gMC->Gsatt("TIPP","SEEN",0);
1065 gMC->Gsatt("TIC3","SEEN",0);
1066 gMC->Gsatt("TRCE","SEEN",0);
1067 gMC->Gsatt("TPSC","SEEN",0);
79575d04 1068 gMC->Gsatt("TPCC","SEEN",0);
37831078 1069 gMC->Gsatt("TORC","SEEN",0);
1070 gMC->Gsatt("TOPP","SEEN",0);
1071 gMC->Gsatt("TOC3","SEEN",0);
1072 gMC->Gsatt("TOC1","SEEN",1);
1073 gMC->Gsatt("TSSW","SEEN",1);
1074 gMC->Gsatt("TSWC","SEEN",1);
37831078 1075 gMC->Gsatt("TSSW","COLO",3);
1076 gMC->Gsatt("TSWC","COLO",3);
1077 gMC->Gsatt("TSCE","COLO",6);
79575d04 1078 gMC->Gsatt("TSCE","SEEN",1);
37831078 1079 gMC->Gsatt("TWES","SEEN",0);
1080 gMC->Gsatt("TSWB","SEEN",0);
1081 gMC->Gsatt("TPEL","SEEN",0);
1082 gMC->Gsatt("TPMW","SEEN",1);
37831078 1083 gMC->Gsatt("TESR","SEEN",1);
1084 gMC->Gsatt("TPMW","COLO",12);
37831078 1085 gMC->Gsatt("TIC1","COLO",5);
79575d04 1086 gMC->Gsatt("TOC1","COLO",5);
37831078 1087 gMC->Gsatt("TESB","SEEN",0);
37831078 1088 gMC->Gsatt("THVM","SEEN",1);
1089 gMC->Gsatt("THVM","COLO",11);
79575d04 1090 gMC->Gsatt("THVH","SEEN",0);
1091 gMC->Gsatt("TPSR","SEEN",0);
37831078 1092 gMC->Gsatt("THVL","SEEN",0);
79575d04 1093 gMC->Gsatt("THVC","SEEN",0);
37831078 1094 gMC->Gsatt("THVE","SEEN",0);
1095 gMC->Gsatt("THVR","SEEN",0);
79575d04 1096 gMC->Gsatt("TPSS","SEEN",0);
1097 gMC->Gsatt("TPUS","SEEN",0);
1098 gMC->Gsatt("TPLS","SEEN",0);
37831078 1099
fe4da5cc 1100 //
cfce8870 1101 gMC->Gdopt("hide", "on");
1102 gMC->Gdopt("shad", "on");
1103 gMC->Gsatt("*", "fill", 7);
1104 gMC->SetClipBox(".");
37831078 1105 gMC->SetClipBox("TPMW",-300,300,-300,300,254.,270.);
1106 gMC->SetClipBox("TESR",-300,300,-300,300,254.,270.);
1107 gMC->SetClipBox("TSSW",-300,300,-300,300,283.,284.);
1108 gMC->SetClipBox("TSWC",-300,300,-300,300,283.,284.);
1109 gMC->SetClipBox("*", 0, 300, -300, 300, -290, 290);
cfce8870 1110 gMC->DefaultRange();
1111 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
1112 gMC->Gdhead(1111, "Time Projection Chamber");
1113 gMC->Gdman(18, 4, "MAN");
1114 gMC->Gdopt("hide","off");
fe4da5cc 1115}
1116
1117//_____________________________________________________________________________
1118void AliTPCv2::CreateMaterials()
1119{
1120 //
1121 // Define materials for version 2 of the Time Projection Chamber
1122 //
37831078 1123
fe4da5cc 1124 AliTPC::CreateMaterials();
1125}
1126
1127//_____________________________________________________________________________
1128void AliTPCv2::Init()
1129{
1130 //
1131 // Initialises version 2 of the TPC after that it has been built
1132 //
37831078 1133
1134 Int_t *idtmed = fIdtmed->GetArray();
1135
fe4da5cc 1136 AliTPC::Init();
d4c354b9 1137
c1637e41 1138
1139 fIdSens=gMC->VolId("TPC_Strip"); // one strip is always selected...
d4c354b9 1140
c1637e41 1141 fIDrift=gMC->VolId("TPC_Drift");
1142 fSecOld=-100; // fake number
fe4da5cc 1143
cfce8870 1144 gMC->SetMaxNStep(30000); // max. number of steps increased
fe4da5cc 1145
37831078 1146 gMC->Gstpar(idtmed[2],"LOSS",5); // specific energy loss
fe4da5cc 1147
f77f13c8 1148 AliInfo("*** TPC version 2 initialized ***");
1149 AliInfo(Form("Maximum number of steps = %d",gMC->GetMaxNStep()));
fe4da5cc 1150
1151 //
1152
1153}
1154
1155//_____________________________________________________________________________
1156void AliTPCv2::StepManager()
1157{
1158 //
1159 // Called for every step in the Time Projection Chamber
1160 //
1161
1162 //
1163 // parameters used for the energy loss calculations
1164 //
73042f01 1165 const Float_t kprim = 14.35; // number of primary collisions per 1 cm
1166 const Float_t kpoti = 20.77e-9; // first ionization potential for Ne/CO2
1167 const Float_t kwIon = 35.97e-9; // energy for the ion-electron pair creation
fe4da5cc 1168
1169
73042f01 1170 const Float_t kbig = 1.e10;
fe4da5cc 1171
1172 Int_t id,copy;
e61fd20d 1173 Float_t hits[5];
fe4da5cc 1174 Int_t vol[2];
37831078 1175 TLorentzVector p;
fe4da5cc 1176
37831078 1177 vol[1]=0; // preset row number to 0
fe4da5cc 1178 //
73042f01 1179 gMC->SetMaxStep(kbig);
fe4da5cc 1180
0a6d8768 1181 if(!gMC->IsTrackAlive()) return; // particle has disappeared
fe4da5cc 1182
cfce8870 1183 Float_t charge = gMC->TrackCharge();
fe4da5cc 1184
1185 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1186
37831078 1187 // check the sensitive volume
1188
c1637e41 1189 id = gMC->CurrentVolID(copy); // vol ID and copy number (starts from 1!)
1190 if(id != fIDrift && id != fIdSens) return; // not in the sensitive folume
da33556f 1191
c1637e41 1192 gMC->TrackPosition(p);
1193 Double_t r = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
1194 //
1195
1196 //
1197 Double_t angle = TMath::ACos(p[0]/r);
1198 angle = (p[1]<0.) ? TMath::TwoPi()-angle : angle;
1199 //
1200 // angular segment, it is not a real sector number...
1201 //
1202 Int_t sector=TMath::Nint((angle-fTPCParam->GetInnerAngleShift())/
1203 fTPCParam->GetInnerAngle());
1204 // rotate to segment "0"
1205 Float_t cos,sin;
1206 fTPCParam->AdjustCosSin(sector,cos,sin);
1207 Float_t x1=p[0]*cos + p[1]*sin;
1208 // check if within sector's limits
1209 if(x1>=fTPCParam->GetInnerRadiusLow()&&x1<=fTPCParam->GetInnerRadiusUp()
1210 ||x1>=fTPCParam->GetOuterRadiusLow()&&x1<=fTPCParam->GetOuterRadiusUp()){
1211 // calculate real sector number...
1212 if (x1>fTPCParam->GetOuterRadiusLow()){
1213 sector = TMath::Nint((angle-fTPCParam->GetOuterAngleShift())/
1214 fTPCParam->GetOuterAngle())+fTPCParam->GetNInnerSector();
1215 if (p[2]<0) sector+=(fTPCParam->GetNOuterSector()>>1);
37831078 1216 }
c1637e41 1217 else
1218 if (p[2]<0) sector+=(fTPCParam->GetNInnerSector()>>1);
1219 //
1220 // here I have a sector number
1221 //
37831078 1222
c1637e41 1223 vol[0]=sector;
1224 // check if change of sector
1225 if(sector != fSecOld){
1226 fSecOld=sector;
1227 // add track reference
1228 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
1229 }
1230 // track is in the sensitive strip
1231 if(id == fIdSens){
1232 // track is entering the strip
1233 if (gMC->IsTrackEntering()){
1234 Int_t totrows = fTPCParam->GetNRowLow()+fTPCParam->GetNRowUp();
1235 vol[1] = (copy<=totrows) ? copy-1 : copy-1-totrows;
1236 // row numbers are autonomous for lower and upper sectors
1237 if(vol[0] > fTPCParam->GetNInnerSector()) {
1238 vol[1] -= fTPCParam->GetNRowLow();
1239 }
1240 //
1241 if(vol[0]<fTPCParam->GetNInnerSector()&&vol[1] == 0){
37831078 1242
c1637e41 1243 // lower sector, row 0, because Jouri wants to have this
6a905708 1244
c1637e41 1245 gMC->TrackMomentum(p);
1246 hits[0]=p[0];
1247 hits[1]=p[1];
1248 hits[2]=p[2];
1249 hits[3]=0.; // this hit has no energy loss
1250 // Get also the track time for pileup simulation
1251 hits[4]=gMC->TrackTime();
e61fd20d 1252
c1637e41 1253 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
1254 }
1255 //
e61fd20d 1256
c1637e41 1257 gMC->TrackPosition(p);
1258 hits[0]=p[0];
1259 hits[1]=p[1];
1260 hits[2]=p[2];
1261 hits[3]=0.; // this hit has no energy loss
1262 // Get also the track time for pileup simulation
1263 hits[4]=gMC->TrackTime();
930ee558 1264
c1637e41 1265 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
37831078 1266
c1637e41 1267 }
1268 else return;
1269 }
37831078 1270 //-----------------------------------------------------------------
c1637e41 1271 // charged particle is in the sensitive drift volume
37831078 1272 //-----------------------------------------------------------------
cfce8870 1273 if(gMC->TrackStep() > 0) {
c1637e41 1274
73042f01 1275 Int_t nel = (Int_t)(((gMC->Edep())-kpoti)/kwIon) + 1;
fe4da5cc 1276 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
c1637e41 1277 //
37831078 1278 gMC->TrackPosition(p);
1279 hits[0]=p[0];
1280 hits[1]=p[1];
1281 hits[2]=p[2];
fe4da5cc 1282 hits[3]=(Float_t)nel;
c1637e41 1283
fe4da5cc 1284 // Add this hit
c1637e41 1285
6a905708 1286 if (fHitType&&2){
1287 gMC->TrackMomentum(p);
1288 Float_t momentum = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
1289 Float_t precision = (momentum>0.1) ? 0.002 :0.01;
1290 fTrackHits->SetHitPrecision(precision);
1291 }
e61fd20d 1292
1293 // Get also the track time for pileup simulation
1294 hits[4]=gMC->TrackTime();
c1637e41 1295
1296 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
e61fd20d 1297
c1637e41 1298 } // step>0
1299 } //within sector's limits
fe4da5cc 1300 // Stemax calculation for the next step
1301
1302 Float_t pp;
0a6d8768 1303 TLorentzVector mom;
1304 gMC->TrackMomentum(mom);
1305 Float_t ptot=mom.Rho();
73042f01 1306 Float_t betaGamma = ptot/gMC->TrackMass();
fe4da5cc 1307
69e40cce 1308 Int_t pid=gMC->TrackPid();
cc80f89e 1309 if((pid==kElectron || pid==kPositron) && ptot > 0.002)
fe4da5cc 1310 {
73042f01 1311 pp = kprim*1.58; // electrons above 20 MeV/c are on the plateau!
fe4da5cc 1312 }
1313 else
1314 {
595bf2c3 1315
07521998 1316 betaGamma = TMath::Max(betaGamma,(Float_t)7.e-3); // protection against too small bg
595bf2c3 1317 pp=kprim*BetheBloch(betaGamma);
1318
fe4da5cc 1319 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
1320 }
1321
b9d0a01d 1322 Double_t rnd = gMC->GetRandom()->Rndm();
fe4da5cc 1323
cfce8870 1324 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
fe4da5cc 1325
c1637e41 1326
fe4da5cc 1327}
1328
1329//_____________________________________________________________________________
1330Float_t AliTPCv2::BetheBloch(Float_t bg)
1331{
1332 //
1333 // Bethe-Bloch energy loss formula
1334 //
73042f01 1335 const Double_t kp1=0.76176e-1;
1336 const Double_t kp2=10.632;
1337 const Double_t kp3=0.13279e-4;
1338 const Double_t kp4=1.8631;
1339 const Double_t kp5=1.9479;
fe4da5cc 1340
1341 Double_t dbg = (Double_t) bg;
1342
1343 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1344
73042f01 1345 Double_t aa = TMath::Power(beta,kp4);
1346 Double_t bb = TMath::Power(1./dbg,kp5);
fe4da5cc 1347
73042f01 1348 bb=TMath::Log(kp3+bb);
fe4da5cc 1349
73042f01 1350 return ((Float_t)((kp2-aa-bb)*kp1/aa));
fe4da5cc 1351}
73042f01 1352
1353