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