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.13 1999/10/06 10:15:19 fca
19 Correct bug in allocation of layer name and add destructor
21 Revision 1.12 1999/10/05 08:05:09 fca
22 Minor corrections for uninitialised variables.
24 Revision 1.11 1999/09/29 09:24:20 fca
25 Introduction of the Copyright and cvs Log
29 ///////////////////////////////////////////////////////////////////////////////
31 // Inner Traking System version 5 //
32 // This class contains the base procedures for the Inner Tracking System //
34 // Authors: R. Barbera, B. S. Nilsen.
36 // Created September 17 1999.
38 ///////////////////////////////////////////////////////////////////////////////
46 #include "AliITShit.h"
49 #include "AliITSgeom.h"
53 //_____________________________________________________________________________
54 AliITSv5::AliITSv5() {
56 // Standard constructor for the ITS
59 fId5Name = new char*[fId5N];
67 //_____________________________________________________________________________
68 AliITSv5::~AliITSv5() {
70 // Standard destructor for the ITS
74 //_____________________________________________________________________________
75 AliITSv5::AliITSv5(const char *name, const char *title) : AliITS(name, title){
77 // Standard constructor for the ITS
80 fId5Name = new char*[fId5N];
88 fEuclidMaterial = "$ALICE_ROOT/Euclid/ITSgeometry_5.tme";
89 fEuclidGeometry = "$ALICE_ROOT/Euclid/ITSgeometry_5.euc";
93 //_____________________________________________________________________________
94 void AliITSv5::CreateMaterials(){
96 // Read materials for the ITS
100 filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
101 // FILE *file = fopen(fEuclidMaterial.Data(),"r");
102 FILE *file = fopen(filtmp,"r");
105 // gAlice->ReadEuclidMedia(fEuclidMaterial.Data(),this);
106 gAlice->ReadEuclidMedia(filtmp,this);
108 Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
109 // fEuclidMaterial.Data());
115 //_____________________________________________________________________________
116 void AliITSv5::CreateGeometry(){
117 //////////////////////////////////////////////////////////////////////
118 // This is the geometry used for the ITS Pre-TDR and comes from an
119 // Euclid to Geant conversion. The only difference
120 // is in the details of the ITS supports. The detectors elements,
121 // detector numbering, and local and global reference frames are shown in
122 // the following figures.
125 <img src="picts/ITS/its1+2_convention_front_5.gif">
128 <font size=+2 color=red>
129 <p>This shows the front view of the SPDs.
132 <img src="picts/ITS/its1+2_convention_side_5.gif">
135 <font size=+2 color=red>
136 <p>This shows the perspective view of the SPDs.
138 <img src="picts/ITS/its1+2_tree.gif">
141 <font size=+2 color=red>
142 <p>This shows the geometry Tree for the SPDs.
147 <img src="picts/ITS/its3+4_convention_front_5.gif">
150 <font size=+2 color=red>
151 <p>This shows the front view of the SDDs.
154 <img src="picts/ITS/its3+4_convention_side_5.gif">
157 <font size=+2 color=red>
158 <p>This shows the perspective view of the SDDs.
160 <img src="picts/ITS/its3+4_tree.gif">
163 <font size=+2 color=red>
164 <p>This shows the geometry Tree for the SDDs.
169 <img src="picts/ITS/its5+6_convention_front_5.gif">
172 <font size=+2 color=red>
173 <p>This shows the front view of the SSDs.
176 <img src="picts/ITS/its5+6_convention_side_5.gif">
179 <font size=+2 color=red>
180 <p>This shows the perspective view of the SSDs.
183 <img src="picts/ITS/its5+6_tree.gif">
186 <font size=+2 color=red>
187 <p>This shows the geometry Tree for the SSDs.
192 <img src="picts/ITS/its_layer1-6_2.gif">
195 <font size=+2 color=red>
196 <p>This shows the front view of the whole ITS..
200 <img src="picts/ITS/its_layer1-6_1.gif">
203 <font size=+2 color=red>
204 <p>This shows the perspective view of the whole ITS..
208 <img src="picts/ITS/its1-6_tree.gif">
211 <font size=+2 color=red>
212 <p>This shows the geometry Tree for the whole ITS.
219 // Here are shown the details of the ITS support cones and services.
220 // First is a GEANT tree showing the organization of all of the volumes
221 // that make up the ITS supports and services.
224 <img src="picts/ITS/supports_tree.gif">
227 // What follows are a number of figures showing what these support
228 // structures look like.
232 <img src="picts/ITS/supports_3.gif">
235 <font size=+2 color=red>
236 <p>This shows the geometry of the supports for the Drift and Strip layers only.
240 <img src="picts/ITS/supports_2.gif">
243 <font size=+2 color=red>
244 <p>This shows the geometry of the supports for the Drift and Strip layers in front cut out.
248 <img src="picts/ITS/supports_1.gif">
251 <font size=+2 color=red>
252 <p>This shows the geometry of the supports for the Drift and Strip layers in a back cut out..
256 <img src="picts/ITS/suppssd.gif">
259 <font size=+2 color=red>
260 <p>This shows the geometry for the Strip layers supports.
264 <img src="picts/ITS/suppsdd.gif">
267 <font size=+2 color=red>
268 <p>This shows the geometry for the Drift layers supports.
273 ////////////////////////////////////////////////////////////////////////
274 // Read geometry for the ITS
281 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
282 FILE *file = fopen(filtmp,"r");
286 printf("Ready to read Euclid geometry file\n");
287 gAlice->ReadEuclid(fEuclidGeometry.Data(),this,topvol);
288 printf("Read in euclid geometries\n");
290 Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
291 fEuclidGeometry.Data());
295 //---Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
298 gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
300 //---Outputs the geometry tree in the EUCLID/CAD format
303 gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
304 } // end if (fEuclidOut)
306 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
307 size = strlen(filtmp);
309 filtmp[size-3] = 'd'; // change from .euc to .det
310 filtmp[size-2] = 'e';
311 filtmp[size-1] = 't';
312 file = fopen(filtmp,"r");
313 if(file){ // if file exists use it to fill AliITSgeom structure.
315 printf("ready to read .det file %s\n",filtmp);
316 fITSgeom = new AliITSgeom(filtmp);
319 // fill AliITSgeom structure from geant structure just filled above
323 printf("finished with euclid geometrys\n");
326 //_____________________________________________________________________________
327 void AliITSv5::Init(){
329 // Initialise the ITS after it has been created
334 fIdName = new char*[fId5N];
335 fIdSens = new Int_t[fId5N];
336 for(i=0;i<fId5N;i++) {
337 l = strlen(fId5Name[i]);
338 fIdName[i] = new char[l+1];
339 for(j=0;j<l;j++) fIdName[i][j] = fId5Name[i][j];
340 fIdName[i][l] = '\0'; // Null terminate this string.
346 //_____________________________________________________________________________
347 void AliITSv5::StepManager(){
349 // Called for every step in the ITS
355 TLorentzVector position, momentum;
356 TClonesArray &lhits = *fHits;
360 if(gMC->IsTrackInside()) vol[3] += 1;
361 if(gMC->IsTrackEntering()) vol[3] += 2;
362 if(gMC->IsTrackExiting()) vol[3] += 4;
363 if(gMC->IsTrackOut()) vol[3] += 8;
364 if(gMC->IsTrackDisappeared()) vol[3] += 16;
365 if(gMC->IsTrackStop()) vol[3] += 32;
366 if(gMC->IsTrackAlive()) vol[3] += 64;
368 // Fill hit structure.
369 if(!(gMC->TrackCharge())) return;
371 // Only entering charged tracks
372 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
374 id = gMC->CurrentVolOffID(0,copy);
375 //detector copy in the ladder = 1<->4 (ITS1)
377 gMC->CurrentVolOffID(1,copy1);
378 //ladder copy in the module = 1<->2 (I186)
379 gMC->CurrentVolOffID(2,copy2);
380 //module copy in the layer = 1<->10 (I132)
381 vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
382 } else if(id == fIdSens[1]){
384 id = gMC->CurrentVolOffID(0,copy);
385 //detector copy in the ladder = 1<->4 (ITS2)
387 gMC->CurrentVolOffID(1,copy1);
388 //ladder copy in the module = 1<->4 (I131)
389 gMC->CurrentVolOffID(2,copy2);
390 //module copy in the layer = 1<->10 (I132)
391 vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
392 } else if(id == fIdSens[2]){
394 id = gMC->CurrentVolOffID(1,copy);
395 //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
397 id = gMC->CurrentVolOffID(2,copy);
398 //ladder copy in the layer = 1<->12 (I316)
400 } else if(id == fIdSens[3]){
402 id = gMC->CurrentVolOffID(1,copy);
403 //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
405 id = gMC->CurrentVolOffID(2,copy);
406 //ladder copy in the layer = 1<->22 (I417)
408 }else if(id == fIdSens[4]){
410 id = gMC->CurrentVolOffID(1,copy);
411 //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
413 id = gMC->CurrentVolOffID(2,copy);
414 //ladder copy in the layer = 1<->34 (I565)
416 }else if(id == fIdSens[5]){
418 id = gMC->CurrentVolOffID(1,copy);
419 //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
421 id = gMC->CurrentVolOffID(2,copy);
422 //ladder copy in the layer = 1<->38 (I569)
425 return; // not an ITS volume?
426 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
428 gMC->TrackPosition(position);
429 gMC->TrackMomentum(momentum);
437 hits[7]=gMC->TrackTime();
438 // Fill hit structure with this new hit.
439 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
442 //____________________________________________________________________________
443 void AliITSv5::Streamer(TBuffer &R__b)
445 // Stream an object of class AliITSv5.
447 if (R__b.IsReading()) {
448 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
449 AliITS::Streamer(R__b);
450 // This information does not need to be read. It is "hard wired"
451 // into this class via its creators.
453 //R__b.ReadArray(fId5Name);
455 R__b.WriteVersion(AliITSv5::IsA());
456 AliITS::Streamer(R__b);
457 // This information does not need to be saved. It is "hard wired"
458 // into this class via its creators.
460 //R__b.WriteArray(fId5Name, __COUNTER__);