]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSv5.cxx
Change location of figures
[u/mrichter/AliRoot.git] / ITS / AliITSv5.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Inner Traking System version 5 //
4// This class contains the base procedures for the Inner Tracking System //
5// //
58005f18 6// Authors: R. Barbera, B. S. Nilsen.
7// version 5.
8// Created September 17 1999.
fe4da5cc 9// //
10///////////////////////////////////////////////////////////////////////////////
11
58005f18 12#include <stdio.h>
13#include <stdlib.h>
fe4da5cc 14#include <TMath.h>
58005f18 15
fe4da5cc 16#include "AliRun.h"
fe4da5cc 17#include "TSystem.h"
58005f18 18#include "AliITShit.h"
19#include "AliITS.h"
20#include "AliITSv5.h"
21#include "AliITSgeom.h"
fe4da5cc 22
23ClassImp(AliITSv5)
24
25//_____________________________________________________________________________
58005f18 26AliITSv5::AliITSv5() : AliITS(){
27 //
28 // Standard constructor for the ITS
29 //
30 fId5N = 5;
31 fId5Name = new char*[fId5N];
32 fId5Name[0] = "ITS1";
33 fId5Name[1] = "ITS2";
34 fId5Name[2] = "ITS3";
35 fId5Name[3] = "ITS4";
36 fId5Name[4] = "ITS5";
37 fId5Name[5] = "ITS6";
fe4da5cc 38}
fe4da5cc 39//_____________________________________________________________________________
58005f18 40AliITSv5::AliITSv5(const char *name, const char *title) : AliITS(name, title){
41 //
42 // Standard constructor for the ITS
43 //
44 fId5N = 6;
45 fId5Name = new char*[fId5N];
46 fId5Name[0] = "ITS1";
47 fId5Name[1] = "ITS2";
48 fId5Name[2] = "ITS3";
49 fId5Name[3] = "ITS4";
50 fId5Name[4] = "ITS5";
51 fId5Name[5] = "ITS6";
52
53 fEuclidMaterial = "$ALICE_ROOT/Euclid/ITSgeometry_5.tme";
54 fEuclidGeometry = "$ALICE_ROOT/Euclid/ITSgeometry_5.euc";
fe4da5cc 55}
56
57
58//_____________________________________________________________________________
58005f18 59void AliITSv5::CreateMaterials(){
fe4da5cc 60 //
61 // Read materials for the ITS
62 //
58005f18 63 char *filtmp;
64//
65 filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
66// FILE *file = fopen(fEuclidMaterial.Data(),"r");
1808a5a2 67 FILE *file = fopen(filtmp,"r");
fe4da5cc 68 if(file) {
69 fclose(file);
58005f18 70// gAlice->ReadEuclidMedia(fEuclidMaterial.Data(),this);
71 gAlice->ReadEuclidMedia(filtmp,this);
fe4da5cc 72 } else {
58005f18 73 Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
74// fEuclidMaterial.Data());
75 filtmp);
fe4da5cc 76 exit(1);
58005f18 77 } // end if(file)
fe4da5cc 78}
79
80//_____________________________________________________________________________
58005f18 81void AliITSv5::CreateGeometry(){
82//////////////////////////////////////////////////////////////////////
83// This is the geometry used for the ITS Pre-TDR and comes from an
84// Euclid to Geant conversion. The only difference
85// is in the details of the ITS supports. The detectors elements,
86// detector numbering, and local and global reference frames are shown in
87// the following figures.
88//Begin_Html
89/*
a92b2b7d 90<img src="picts/ITS/its1+2_convention_front_5.gif">
58005f18 91</pre>
92<br clear=left>
93<font size=+2 color=red>
94<p>This shows the front view of the SPDs.
95</font>
96<pre>
a92b2b7d 97<img src="picts/ITS/its1+2_convention_side_5.gif">
58005f18 98</pre>
99<br clear=left>
100<font size=+2 color=red>
101<p>This shows the perspective view of the SPDs.
102</font>
a92b2b7d 103<img src="picts/ITS/its1+2_tree.gif">
58005f18 104</pre>
105<br clear=left>
106<font size=+2 color=red>
107<p>This shows the geometry Tree for the SPDs.
108</font>
109<pre>
110
111<pre>
a92b2b7d 112<img src="picts/ITS/its3+4_convention_front_5.gif">
58005f18 113</pre>
114<br clear=left>
115<font size=+2 color=red>
116<p>This shows the front view of the SDDs.
117</font>
118<pre>
a92b2b7d 119<img src="picts/ITS/its3+4_convention_side_5.gif">
58005f18 120</pre>
121<br clear=left>
122<font size=+2 color=red>
123<p>This shows the perspective view of the SDDs.
124</font>
a92b2b7d 125<img src="picts/ITS/its3+4_tree.gif">
58005f18 126</pre>
127<br clear=left>
128<font size=+2 color=red>
129<p>This shows the geometry Tree for the SDDs.
130</font>
131<pre>
fe4da5cc 132
58005f18 133<pre>
a92b2b7d 134<img src="picts/ITS/its5+6_convention_front_5.gif">
58005f18 135</pre>
136<br clear=left>
137<font size=+2 color=red>
138<p>This shows the front view of the SSDs.
139</font>
140<pre>
a92b2b7d 141<img src="picts/ITS/its5+6_convention_side_5.gif">
58005f18 142</pre>
143<br clear=left>
144<font size=+2 color=red>
145<p>This shows the perspective view of the SSDs.
146</font>
147<pre>
a92b2b7d 148<img src="picts/ITS/its5+6_tree.gif">
58005f18 149</pre>
150<br clear=left>
151<font size=+2 color=red>
152<p>This shows the geometry Tree for the SSDs.
153</font>
154<pre>
155
156
a92b2b7d 157<img src="picts/ITS/its_layer1-6_2.gif">
58005f18 158</pre>
159<br clear=left>
160<font size=+2 color=red>
161<p>This shows the front view of the whole ITS..
162</font>
163<pre>
164
a92b2b7d 165<img src="picts/ITS/its_layer1-6_1.gif">
58005f18 166</pre>
167<br clear=left>
168<font size=+2 color=red>
169<p>This shows the perspective view of the whole ITS..
170</font>
171<pre>
172
a92b2b7d 173<img src="picts/ITS/its1-6_tree.gif">
58005f18 174</pre>
175<br clear=left>
176<font size=+2 color=red>
177<p>This shows the geometry Tree for the whole ITS.
178</font>
179<pre>
180*/
181//End_Html
182//
fe4da5cc 183//
58005f18 184// Here are shown the details of the ITS support cones and services.
185// First is a GEANT tree showing the organization of all of the volumes
186// that make up the ITS supports and services.
187//Begin_Html
188/*
a92b2b7d 189<img src="picts/ITS/supports_tree.gif">
58005f18 190 */
191//End_Html
192// What follows are a number of figures showing what these support
193// structures look like.
194//Begin_Html
195/*
196
a92b2b7d 197<img src="picts/ITS/supports_3.gif">
58005f18 198</pre>
199<br clear=left>
200<font size=+2 color=red>
201<p>This shows the geometry of the supports for the Drift and Strip layers only.
202</font>
203<pre>
204
a92b2b7d 205<img src="picts/ITS/supports_2.gif">
58005f18 206</pre>
207<br clear=left>
208<font size=+2 color=red>
209<p>This shows the geometry of the supports for the Drift and Strip layers in front cut out.
210</font>
211<pre>
212
a92b2b7d 213<img src="picts/ITS/supports_1.gif">
58005f18 214</pre>
215<br clear=left>
216<font size=+2 color=red>
217<p>This shows the geometry of the supports for the Drift and Strip layers in a back cut out..
218</font>
219<pre>
220
a92b2b7d 221<img src="picts/ITS/suppssd.gif">
58005f18 222</pre>
223<br clear=left>
224<font size=+2 color=red>
225<p>This shows the geometry for the Strip layers supports.
226</font>
227<pre>
228
a92b2b7d 229<img src="picts/ITS/suppsdd.gif">
58005f18 230</pre>
231<br clear=left>
232<font size=+2 color=red>
233<p>This shows the geometry for the Drift layers supports.
234</font>
235<pre>
236 */
237//End_Html
238////////////////////////////////////////////////////////////////////////
239// Read geometry for the ITS
240//
241
242 Int_t size;
243 char topvol[5];
244 char *filtmp;
245//
246 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
fe4da5cc 247 FILE *file = fopen(filtmp,"r");
248 delete [] filtmp;
249 if(file) {
250 fclose(file);
58005f18 251 printf("Ready to read Euclid geometry file\n");
02ca2762 252 gAlice->ReadEuclid(fEuclidGeometry.Data(),this,topvol);
58005f18 253 printf("Read in euclid geometries\n");
fe4da5cc 254 } else {
58005f18 255 Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
256 fEuclidGeometry.Data());
fe4da5cc 257 exit(1);
58005f18 258 } // end if(file)
fe4da5cc 259 //
58005f18 260 //---Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
fe4da5cc 261 // invisible
262 //
cfce8870 263 gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
fe4da5cc 264 //
58005f18 265 //---Outputs the geometry tree in the EUCLID/CAD format
fe4da5cc 266
267 if (fEuclidOut) {
cfce8870 268 gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
58005f18 269 } // end if (fEuclidOut)
270
271 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
272 size = strlen(filtmp);
273 if(size>4){
274 filtmp[size-3] = 'd'; // change from .euc to .det
275 filtmp[size-2] = 'e';
276 filtmp[size-1] = 't';
277 file = fopen(filtmp,"r");
278 if(file){ // if file exists use it to fill AliITSgeom structure.
279 fclose(file);
280 printf("ready to read .det file %s\n",filtmp);
281 fITSgeom = new AliITSgeom(filtmp);
282 }else{
283 fITSgeom = 0;
284 // fill AliITSgeom structure from geant structure just filled above
285 }// end if(file)
286 delete [] filtmp;
287 }// end if(size>4)
288 printf("finished with euclid geometrys\n");
fe4da5cc 289}
290
291//_____________________________________________________________________________
58005f18 292void AliITSv5::Init(){
293 //
294 // Initialise the ITS after it has been created
295 //
296 Int_t i,j,l;
297
298 fIdN = fId5N;
299 fIdName = new char*[fId5N];
300 fIdSens = new Int_t[fId5N];
301 for(i=0;i<fId5N;i++) {
302 l = strlen(fId5Name[i]);
303 fIdName[i] = new char[l+1];
304 for(j=0;j<l;j++) fIdName[i][j] = fId5Name[i][j];
305 fIdName[i][l] = '\0'; // Null terminate this string.
306 } // end for i
307
308 AliITS::Init();
fe4da5cc 309}
310
311//_____________________________________________________________________________
58005f18 312void AliITSv5::StepManager(){
fe4da5cc 313 //
314 // Called for every step in the ITS
315 //
58005f18 316 Int_t copy, id;
317 Int_t copy1,copy2;
318 Float_t hits[8];
319 Int_t vol[4];
0a6d8768 320 TLorentzVector position, momentum;
58005f18 321 TClonesArray &lhits = *fHits;
fe4da5cc 322 //
58005f18 323 // Track status
324 vol[3] = 0;
325 if(gMC->IsTrackInside()) vol[3] += 1;
326 if(gMC->IsTrackEntering()) vol[3] += 2;
327 if(gMC->IsTrackExiting()) vol[3] += 4;
328 if(gMC->IsTrackOut()) vol[3] += 8;
329 if(gMC->IsTrackDisappeared()) vol[3] += 16;
330 if(gMC->IsTrackStop()) vol[3] += 32;
331 if(gMC->IsTrackAlive()) vol[3] += 64;
332 //
333 // Fill hit structure.
334 if(!(gMC->TrackCharge())) return;
335 //
336 // Only entering charged tracks
337 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
338 vol[0] = 1;
339 id = gMC->CurrentVolOffID(0,copy);
340 //detector copy in the ladder = 1<->4 (ITS1)
341 vol[1] = copy;
342 gMC->CurrentVolOffID(1,copy1);
343 //ladder copy in the module = 1<->2 (I186)
344 gMC->CurrentVolOffID(2,copy2);
345 //module copy in the layer = 1<->10 (I132)
346 vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
347 } else if(id == fIdSens[1]){
348 vol[0] = 2;
349 id = gMC->CurrentVolOffID(0,copy);
350 //detector copy in the ladder = 1<->4 (ITS2)
351 vol[1] = copy;
352 gMC->CurrentVolOffID(1,copy1);
353 //ladder copy in the module = 1<->4 (I131)
354 gMC->CurrentVolOffID(2,copy2);
355 //module copy in the layer = 1<->10 (I132)
356 vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
357 } else if(id == fIdSens[2]){
358 vol[0] = 3;
359 id = gMC->CurrentVolOffID(1,copy);
360 //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
361 vol[1] = copy;
362 id = gMC->CurrentVolOffID(2,copy);
363 //ladder copy in the layer = 1<->12 (I316)
364 vol[2] = copy;
365 } else if(id == fIdSens[3]){
366 vol[0] = 4;
367 id = gMC->CurrentVolOffID(1,copy);
368 //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
369 vol[1] = copy;
370 id = gMC->CurrentVolOffID(2,copy);
371 //ladder copy in the layer = 1<->22 (I417)
372 vol[2] = copy;
373 }else if(id == fIdSens[4]){
374 vol[0] = 5;
375 id = gMC->CurrentVolOffID(1,copy);
376 //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
377 vol[1] = copy;
378 id = gMC->CurrentVolOffID(2,copy);
379 //ladder copy in the layer = 1<->34 (I565)
380 vol[2] = copy;
381 }else if(id == fIdSens[5]){
382 vol[0] = 6;
383 id = gMC->CurrentVolOffID(1,copy);
384 //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
385 vol[1] = copy;
386 id = gMC->CurrentVolOffID(2,copy);
387 //ladder copy in the layer = 1<->38 (I569)
388 vol[2] = copy;
389 } else {
390 return; // not an ITS volume?
391 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
392//
393 gMC->TrackPosition(position);
394 gMC->TrackMomentum(momentum);
395 hits[0]=position[0];
396 hits[1]=position[1];
397 hits[2]=position[2];
398 hits[3]=momentum[0];
399 hits[4]=momentum[1];
400 hits[5]=momentum[2];
401 hits[6]=gMC->Edep();
402 hits[7]=gMC->TrackTime();
403 // Fill hit structure with this new hit.
404 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
405 return;
fe4da5cc 406}
58005f18 407//____________________________________________________________________________
408void AliITSv5::Streamer(TBuffer &R__b)
409{
410 // Stream an object of class AliITSv5.
411
412 if (R__b.IsReading()) {
413 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
414 AliITS::Streamer(R__b);
415 // This information does not need to be read. It is "hard wired"
416 // into this class via its creators.
417 //R__b >> fId5N;
418 //R__b.ReadArray(fId5Name);
419 } else {
420 R__b.WriteVersion(AliITSv5::IsA());
421 AliITS::Streamer(R__b);
422 // This information does not need to be saved. It is "hard wired"
423 // into this class via its creators.
424 //R__b << fId5N;
425 //R__b.WriteArray(fId5Name, __COUNTER__);
426 }
427}
428