1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.14 1999/10/22 08:16:49 fca
19 Correct destructors, thanks to I.Hrivnacova
21 Revision 1.13 1999/10/06 10:15:19 fca
22 Correct bug in allocation of layer name and add destructor
24 Revision 1.12 1999/10/05 08:05:09 fca
25 Minor corrections for uninitialised variables.
27 Revision 1.11 1999/09/29 09:24:20 fca
28 Introduction of the Copyright and cvs Log
32 ///////////////////////////////////////////////////////////////////////////////
34 // Inner Traking System version 5 //
35 // This class contains the base procedures for the Inner Tracking System //
37 // Authors: R. Barbera, B. S. Nilsen.
39 // Created September 17 1999.
41 ///////////////////////////////////////////////////////////////////////////////
49 #include "AliITShit.h"
52 #include "AliITSgeom.h"
56 //_____________________________________________________________________________
57 AliITSv5::AliITSv5() {
59 // Standard constructor for the ITS
62 fId5Name = new char*[fId5N];
70 //_____________________________________________________________________________
71 AliITSv5::~AliITSv5() {
73 // Standard destructor for the ITS
77 //_____________________________________________________________________________
78 AliITSv5::AliITSv5(const char *name, const char *title) : AliITS(name, title){
80 // Standard constructor for the ITS
83 fId5Name = new char*[fId5N];
91 fEuclidMaterial = "$ALICE_ROOT/Euclid/ITSgeometry_5.tme";
92 fEuclidGeometry = "$ALICE_ROOT/Euclid/ITSgeometry_5.euc";
96 //_____________________________________________________________________________
97 void AliITSv5::CreateMaterials(){
99 // Read materials for the ITS
103 filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
104 // FILE *file = fopen(fEuclidMaterial.Data(),"r");
105 FILE *file = fopen(filtmp,"r");
108 // ReadEuclidMedia(fEuclidMaterial.Data());
109 ReadEuclidMedia(filtmp);
111 Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
112 // fEuclidMaterial.Data());
118 //_____________________________________________________________________________
119 void AliITSv5::CreateGeometry(){
120 //////////////////////////////////////////////////////////////////////
121 // This is the geometry used for the ITS Pre-TDR and comes from an
122 // Euclid to Geant conversion. The only difference
123 // is in the details of the ITS supports. The detectors elements,
124 // detector numbering, and local and global reference frames are shown in
125 // the following figures.
128 <img src="picts/ITS/its1+2_convention_front_5.gif">
131 <font size=+2 color=red>
132 <p>This shows the front view of the SPDs.
135 <img src="picts/ITS/its1+2_convention_side_5.gif">
138 <font size=+2 color=red>
139 <p>This shows the perspective view of the SPDs.
141 <img src="picts/ITS/its1+2_tree.gif">
144 <font size=+2 color=red>
145 <p>This shows the geometry Tree for the SPDs.
150 <img src="picts/ITS/its3+4_convention_front_5.gif">
153 <font size=+2 color=red>
154 <p>This shows the front view of the SDDs.
157 <img src="picts/ITS/its3+4_convention_side_5.gif">
160 <font size=+2 color=red>
161 <p>This shows the perspective view of the SDDs.
163 <img src="picts/ITS/its3+4_tree.gif">
166 <font size=+2 color=red>
167 <p>This shows the geometry Tree for the SDDs.
172 <img src="picts/ITS/its5+6_convention_front_5.gif">
175 <font size=+2 color=red>
176 <p>This shows the front view of the SSDs.
179 <img src="picts/ITS/its5+6_convention_side_5.gif">
182 <font size=+2 color=red>
183 <p>This shows the perspective view of the SSDs.
186 <img src="picts/ITS/its5+6_tree.gif">
189 <font size=+2 color=red>
190 <p>This shows the geometry Tree for the SSDs.
195 <img src="picts/ITS/its_layer1-6_2.gif">
198 <font size=+2 color=red>
199 <p>This shows the front view of the whole ITS..
203 <img src="picts/ITS/its_layer1-6_1.gif">
206 <font size=+2 color=red>
207 <p>This shows the perspective view of the whole ITS..
211 <img src="picts/ITS/its1-6_tree.gif">
214 <font size=+2 color=red>
215 <p>This shows the geometry Tree for the whole ITS.
222 // Here are shown the details of the ITS support cones and services.
223 // First is a GEANT tree showing the organization of all of the volumes
224 // that make up the ITS supports and services.
227 <img src="picts/ITS/supports_tree.gif">
230 // What follows are a number of figures showing what these support
231 // structures look like.
235 <img src="picts/ITS/supports_3.gif">
238 <font size=+2 color=red>
239 <p>This shows the geometry of the supports for the Drift and Strip layers only.
243 <img src="picts/ITS/supports_2.gif">
246 <font size=+2 color=red>
247 <p>This shows the geometry of the supports for the Drift and Strip layers in front cut out.
251 <img src="picts/ITS/supports_1.gif">
254 <font size=+2 color=red>
255 <p>This shows the geometry of the supports for the Drift and Strip layers in a back cut out..
259 <img src="picts/ITS/suppssd.gif">
262 <font size=+2 color=red>
263 <p>This shows the geometry for the Strip layers supports.
267 <img src="picts/ITS/suppsdd.gif">
270 <font size=+2 color=red>
271 <p>This shows the geometry for the Drift layers supports.
276 ////////////////////////////////////////////////////////////////////////
277 // Read geometry for the ITS
284 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
285 FILE *file = fopen(filtmp,"r");
289 printf("Ready to read Euclid geometry file\n");
290 ReadEuclid(fEuclidGeometry.Data(),topvol);
291 printf("Read in euclid geometries\n");
293 Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
294 fEuclidGeometry.Data());
298 //---Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
301 gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
303 //---Outputs the geometry tree in the EUCLID/CAD format
306 gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
307 } // end if (fEuclidOut)
309 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
310 size = strlen(filtmp);
312 filtmp[size-3] = 'd'; // change from .euc to .det
313 filtmp[size-2] = 'e';
314 filtmp[size-1] = 't';
315 file = fopen(filtmp,"r");
316 if(file){ // if file exists use it to fill AliITSgeom structure.
318 printf("ready to read .det file %s\n",filtmp);
319 fITSgeom = new AliITSgeom(filtmp);
322 // fill AliITSgeom structure from geant structure just filled above
326 printf("finished with euclid geometrys\n");
329 //_____________________________________________________________________________
330 void AliITSv5::Init(){
332 // Initialise the ITS after it has been created
337 fIdName = new char*[fId5N];
338 fIdSens = new Int_t[fId5N];
339 for(i=0;i<fId5N;i++) {
340 l = strlen(fId5Name[i]);
341 fIdName[i] = new char[l+1];
342 for(j=0;j<l;j++) fIdName[i][j] = fId5Name[i][j];
343 fIdName[i][l] = '\0'; // Null terminate this string.
349 //_____________________________________________________________________________
350 void AliITSv5::StepManager(){
352 // Called for every step in the ITS
358 TLorentzVector position, momentum;
359 TClonesArray &lhits = *fHits;
363 if(gMC->IsTrackInside()) vol[3] += 1;
364 if(gMC->IsTrackEntering()) vol[3] += 2;
365 if(gMC->IsTrackExiting()) vol[3] += 4;
366 if(gMC->IsTrackOut()) vol[3] += 8;
367 if(gMC->IsTrackDisappeared()) vol[3] += 16;
368 if(gMC->IsTrackStop()) vol[3] += 32;
369 if(gMC->IsTrackAlive()) vol[3] += 64;
371 // Fill hit structure.
372 if(!(gMC->TrackCharge())) return;
374 // Only entering charged tracks
375 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
377 id = gMC->CurrentVolOffID(0,copy);
378 //detector copy in the ladder = 1<->4 (ITS1)
380 gMC->CurrentVolOffID(1,copy1);
381 //ladder copy in the module = 1<->2 (I186)
382 gMC->CurrentVolOffID(2,copy2);
383 //module copy in the layer = 1<->10 (I132)
384 vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
385 } else if(id == fIdSens[1]){
387 id = gMC->CurrentVolOffID(0,copy);
388 //detector copy in the ladder = 1<->4 (ITS2)
390 gMC->CurrentVolOffID(1,copy1);
391 //ladder copy in the module = 1<->4 (I131)
392 gMC->CurrentVolOffID(2,copy2);
393 //module copy in the layer = 1<->10 (I132)
394 vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
395 } else if(id == fIdSens[2]){
397 id = gMC->CurrentVolOffID(1,copy);
398 //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
400 id = gMC->CurrentVolOffID(2,copy);
401 //ladder copy in the layer = 1<->12 (I316)
403 } else if(id == fIdSens[3]){
405 id = gMC->CurrentVolOffID(1,copy);
406 //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
408 id = gMC->CurrentVolOffID(2,copy);
409 //ladder copy in the layer = 1<->22 (I417)
411 }else if(id == fIdSens[4]){
413 id = gMC->CurrentVolOffID(1,copy);
414 //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
416 id = gMC->CurrentVolOffID(2,copy);
417 //ladder copy in the layer = 1<->34 (I565)
419 }else if(id == fIdSens[5]){
421 id = gMC->CurrentVolOffID(1,copy);
422 //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
424 id = gMC->CurrentVolOffID(2,copy);
425 //ladder copy in the layer = 1<->38 (I569)
428 return; // not an ITS volume?
429 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
431 gMC->TrackPosition(position);
432 gMC->TrackMomentum(momentum);
440 hits[7]=gMC->TrackTime();
441 // Fill hit structure with this new hit.
442 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
445 //____________________________________________________________________________
446 void AliITSv5::Streamer(TBuffer &R__b)
448 // Stream an object of class AliITSv5.
450 if (R__b.IsReading()) {
451 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
452 AliITS::Streamer(R__b);
453 // This information does not need to be read. It is "hard wired"
454 // into this class via its creators.
456 //R__b.ReadArray(fId5Name);
458 R__b.WriteVersion(AliITSv5::IsA());
459 AliITS::Streamer(R__b);
460 // This information does not need to be saved. It is "hard wired"
461 // into this class via its creators.
463 //R__b.WriteArray(fId5Name, __COUNTER__);