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.15 2000/02/23 16:25:21 fca
19 AliVMC and AliGeant3 classes introduced
20 ReadEuclid moved from AliRun to AliModule
22 Revision 1.14.4.3 2000/03/04 23:46:38 nilsen
23 Fixed up the comments/documentation.
25 Revision 1.14.4.2 2000/03/02 21:53:02 nilsen
26 To make it compatable with the changes in AliRun/AliModule.
28 Revision 1.14.4.1 2000/01/12 19:03:33 nilsen
29 This is the version of the files after the merging done in December 1999.
30 See the ReadMe110100.txt file for details
32 Revision 1.14 1999/10/22 08:16:49 fca
33 Correct destructors, thanks to I.Hrivnacova
35 Revision 1.13 1999/10/06 10:15:19 fca
36 Correct bug in allocation of layer name and add destructor
38 Revision 1.12 1999/10/05 08:05:09 fca
39 Minor corrections for uninitialised variables.
41 Revision 1.11 1999/09/29 09:24:20 fca
42 Introduction of the Copyright and cvs Log
46 ///////////////////////////////////////////////////////////////////////////////
48 // Inner Traking System version 5
49 // This class contains the base procedures for the Inner Tracking System
51 // Authors: R. Barbera, B. S. Nilsen.
53 // Created September 17 1999.
55 ///////////////////////////////////////////////////////////////////////////////
57 // See AliITSv5::StepManager().
58 #define ALIITSPRINTGEOM 0 // default. don't print out gemetry information
59 //#define ALIITSPRINTGEOM 1 // print out geometry information
67 #if ALIITSPRINTGEOM==1
68 #include "../TGeant3/TGeant3.h"
70 #include "AliITShit.h"
73 #include "AliITSgeom.h"
77 //_____________________________________________________________________________
78 AliITSv5::AliITSv5() {
79 ////////////////////////////////////////////////////////////////////////
80 // Standard default constructor for the ITS version 5.
81 ////////////////////////////////////////////////////////////////////////
83 fId5Name = new char*[fId5N];
91 //_____________________________________________________________________________
92 AliITSv5::~AliITSv5() {
93 ////////////////////////////////////////////////////////////////////////
94 // Standard destructor for the ITS version 5.
95 ////////////////////////////////////////////////////////////////////////
98 //_____________________________________________________________________________
99 AliITSv5::AliITSv5(const char *name, const char *title) : AliITS(name, title){
100 ////////////////////////////////////////////////////////////////////////
101 // Standard constructor for the ITS version 5.
102 ////////////////////////////////////////////////////////////////////////
104 fId5Name = new char*[fId5N];
105 fId5Name[0] = "ITS1";
106 fId5Name[1] = "ITS2";
107 fId5Name[2] = "ITS3";
108 fId5Name[3] = "ITS4";
109 fId5Name[4] = "ITS5";
110 fId5Name[5] = "ITS6";
112 fEuclidMaterial = "$ALICE_ROOT/Euclid/ITSgeometry_5.tme";
113 fEuclidGeometry = "$ALICE_ROOT/Euclid/ITSgeometry_5.euc";
115 //_____________________________________________________________________________
116 void AliITSv5::CreateMaterials(){
117 ////////////////////////////////////////////////////////////////////////
118 // Read a file containing the materials for the ITS version 5.
119 ////////////////////////////////////////////////////////////////////////
122 filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
124 FILE *file = fopen(filtmp,"r");
127 ReadEuclidMedia(filtmp);
129 Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",filtmp);
133 //_____________________________________________________________________________
134 void AliITSv5::CreateGeometry(){
135 //////////////////////////////////////////////////////////////////////
136 // This is the geometry used for the ITS Pre-TDR and comes from an
137 // Euclid to Geant conversion. The only difference
138 // is in the details of the ITS supports. The detectors elements,
139 // detector numbering, and local and global reference frames are shown in
140 // the following figures.
143 <img src="picts/ITS/its1+2_convention_front_5.gif">
146 <font size=+2 color=red>
147 <p>This shows the front view of the SPDs.
150 <img src="picts/ITS/its1+2_convention_side_5.gif">
153 <font size=+2 color=red>
154 <p>This shows the perspective view of the SPDs.
156 <img src="picts/ITS/its1+2_tree.gif">
159 <font size=+2 color=red>
160 <p>This shows the geometry Tree for the SPDs.
165 <img src="picts/ITS/its3+4_convention_front_5.gif">
168 <font size=+2 color=red>
169 <p>This shows the front view of the SDDs.
172 <img src="picts/ITS/its3+4_convention_side_5.gif">
175 <font size=+2 color=red>
176 <p>This shows the perspective view of the SDDs.
178 <img src="picts/ITS/its3+4_tree.gif">
181 <font size=+2 color=red>
182 <p>This shows the geometry Tree for the SDDs.
187 <img src="picts/ITS/its5+6_convention_front_5.gif">
190 <font size=+2 color=red>
191 <p>This shows the front view of the SSDs.
194 <img src="picts/ITS/its5+6_convention_side_5.gif">
197 <font size=+2 color=red>
198 <p>This shows the perspective view of the SSDs.
201 <img src="picts/ITS/its5+6_tree.gif">
204 <font size=+2 color=red>
205 <p>This shows the geometry Tree for the SSDs.
210 <img src="picts/ITS/its_layer1-6_2.gif">
213 <font size=+2 color=red>
214 <p>This shows the front view of the whole ITS..
218 <img src="picts/ITS/its_layer1-6_1.gif">
221 <font size=+2 color=red>
222 <p>This shows the perspective view of the whole ITS..
226 <img src="picts/ITS/its1-6_tree.gif">
229 <font size=+2 color=red>
230 <p>This shows the geometry Tree for the whole ITS.
237 // Here are shown the details of the ITS support cones and services.
238 // First is a GEANT tree showing the organization of all of the volumes
239 // that make up the ITS supports and services.
242 <img src="picts/ITS/supports_tree.gif">
245 // What follows are a number of figures showing what these support
246 // structures look like.
250 <img src="picts/ITS/supports_3.gif">
253 <font size=+2 color=red>
254 <p>This shows the geometry of the supports for the Drift and Strip layers only.
258 <img src="picts/ITS/supports_2.gif">
261 <font size=+2 color=red>
262 <p>This shows the geometry of the supports for the Drift and Strip layers in front cut out.
266 <img src="picts/ITS/supports_1.gif">
269 <font size=+2 color=red>
270 <p>This shows the geometry of the supports for the Drift and Strip layers in a back cut out..
274 <img src="picts/ITS/suppssd.gif">
277 <font size=+2 color=red>
278 <p>This shows the geometry for the Strip layers supports.
282 <img src="picts/ITS/suppsdd.gif">
285 <font size=+2 color=red>
286 <p>This shows the geometry for the Drift layers supports.
292 // Read a file containing the geometry for the ITS version 5.
293 ////////////////////////////////////////////////////////////////////////
299 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
300 FILE *file = fopen(filtmp,"r");
304 printf("Ready to read Euclid geometry file\n");
305 ReadEuclid(fEuclidGeometry.Data(),topvol);
306 printf("Read in euclid geometries\n");
308 Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
309 fEuclidGeometry.Data());
313 // Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
316 gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
318 // Outputs the geometry tree in the EUCLID/CAD format if requested to do so
321 gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
322 } // end if (fEuclidOut)
324 // read in the file containing the transformations for the active
325 // volumes for the ITS version 5. This is expected to be in a file
326 // ending in .det. This geometry is kept in the AliITSgeom class.
327 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
328 size = strlen(filtmp);
330 filtmp[size-3] = 'd'; // change from .euc to .det
331 filtmp[size-2] = 'e';
332 filtmp[size-1] = 't';
333 file = fopen(filtmp,"r");
334 if(file){ // if file exists use it to fill AliITSgeom structure.
336 printf("ready to read .det file %s\n",filtmp);
337 fITSgeom = new AliITSgeom(filtmp);
340 // fill AliITSgeom structure from geant structure just filled above
344 printf("finished with euclid geometrys\n");
346 //_____________________________________________________________________________
347 void AliITSv5::Init(){
348 ////////////////////////////////////////////////////////////////////////
349 // Initialise the ITS after it has been created.
350 ////////////////////////////////////////////////////////////////////////
354 fIdName = new char*[fId5N];
355 fIdSens = new Int_t[fId5N];
356 for(i=0;i<fId5N;i++) {
357 l = strlen(fId5Name[i]);
358 fIdName[i] = new char[l+1];
359 for(j=0;j<l;j++) fIdName[i][j] = fId5Name[i][j];
360 fIdName[i][l] = '\0'; // Null terminate this string.
365 //_____________________________________________________________________________
366 void AliITSv5::StepManager(){
367 ////////////////////////////////////////////////////////////////////////
368 // Called for every step in the ITS, then calles the AliITShit class
369 // creator with the information to be recoreded about that hit.
370 // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
371 // printing of information to a file which can be used to create a .det
372 // file read in by the routine CreateGeometry(). If set to 0 or any other
373 // value except 1, the default behavior, then no such file is created nor
374 // it the extra variables and the like used in the printing allocated.
375 ////////////////////////////////////////////////////////////////////////
380 TLorentzVector position, momentum;
381 TClonesArray &lhits = *fHits;
382 #if ALIITSPRINTGEOM==1
385 Float_t xl[3],xt[3],angl[6];
386 // Float_t par[20],att[20];
388 static Bool_t first=kTRUE,printit[6][50][50];
389 if(first){ for(copy1=0;copy1<6;copy1++)for(copy2=0;copy2<50;copy2++)
390 for(id=0;id<50;id++) printit[copy1][copy2][id] = kTRUE;
398 if(gMC->IsTrackInside()) vol[3] += 1;
399 if(gMC->IsTrackEntering()) vol[3] += 2;
400 if(gMC->IsTrackExiting()) vol[3] += 4;
401 if(gMC->IsTrackOut()) vol[3] += 8;
402 if(gMC->IsTrackDisappeared()) vol[3] += 16;
403 if(gMC->IsTrackStop()) vol[3] += 32;
404 if(gMC->IsTrackAlive()) vol[3] += 64;
406 // Fill hit structure.
407 if(!(gMC->TrackCharge())) return;
409 // Only entering charged tracks
410 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
412 id = gMC->CurrentVolOffID(0,copy);
413 //detector copy in the ladder = 1<->4 (ITS1)
415 gMC->CurrentVolOffID(1,copy1);
416 //ladder copy in the module = 1<->2 (I186)
417 gMC->CurrentVolOffID(2,copy2);
418 //module copy in the layer = 1<->10 (I132)
419 vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
420 } else if(id == fIdSens[1]){
422 id = gMC->CurrentVolOffID(0,copy);
423 //detector copy in the ladder = 1<->4 (ITS2)
425 gMC->CurrentVolOffID(1,copy1);
426 //ladder copy in the module = 1<->4 (I131)
427 gMC->CurrentVolOffID(2,copy2);
428 //module copy in the layer = 1<->10 (I132)
429 vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
430 } else if(id == fIdSens[2]){
432 id = gMC->CurrentVolOffID(1,copy);
433 //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
435 id = gMC->CurrentVolOffID(2,copy);
436 //ladder copy in the layer = 1<->12 (I316)
438 } else if(id == fIdSens[3]){
440 id = gMC->CurrentVolOffID(1,copy);
441 //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
443 id = gMC->CurrentVolOffID(2,copy);
444 //ladder copy in the layer = 1<->22 (I417)
446 }else if(id == fIdSens[4]){
448 id = gMC->CurrentVolOffID(1,copy);
449 //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
451 id = gMC->CurrentVolOffID(2,copy);
452 //ladder copy in the layer = 1<->34 (I565)
454 }else if(id == fIdSens[5]){
456 id = gMC->CurrentVolOffID(1,copy);
457 //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
459 id = gMC->CurrentVolOffID(2,copy);
460 //ladder copy in the layer = 1<->38 (I569)
463 return; // not an ITS volume?
464 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
466 gMC->TrackPosition(position);
467 gMC->TrackMomentum(momentum);
475 hits[7]=gMC->TrackTime();
476 // Fill hit structure with this new hit.
477 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
478 #if ALIITSPRINTGEOM==1
479 if(printit[vol[0]][vol[2]][vol[1]]){
480 printit[vol[0]][vol[2]][vol[1]] = kFALSE;
481 xl[0] = xl[1] = xl[2] = 0.0;
483 for(i=0;i<9;i++) mat[i] = 0.0;
484 mat[0] = mat[4] = mat[8] = 1.0; // default with identity matrix
487 gMC->Gdtom(xl,&(mat[0]),2);
490 gMC->Gdtom(xl,&(mat[3]),2);
493 gMC->Gdtom(xl,&(mat[6]),2);
495 angl[0] = TMath::ACos(mat[2]);
496 if(mat[2]==1.0) angl[0] = 0.0;
497 angl[1] = TMath::ATan2(mat[1],mat[0]);
498 if(angl[1]<0.0) angl[1] += 2.0*TMath::Pi();
500 angl[2] = TMath::ACos(mat[5]);
501 if(mat[5]==1.0) angl[2] = 0.0;
502 angl[3] = TMath::ATan2(mat[4],mat[3]);
503 if(angl[3]<0.0) angl[3] += 2.0*TMath::Pi();
505 angl[4] = TMath::ACos(mat[8]);
506 if(mat[8]==1.0) angl[4] = 0.0;
507 angl[5] = TMath::ATan2(mat[7],mat[6]);
508 if(angl[5]<0.0) angl[5] += 2.0*TMath::Pi();
510 for(i=0;i<6;i++) angl[i] *= 180.0/TMath::Pi(); // degrees
511 fp = fopen("ITSgeometry_v5.det","a");
512 fprintf(fp,"%2d %2d %2d %9e %9e %9e %9e %9e %9e %9e %9e %9e ",
513 vol[0],vol[2],vol[1], // layer ladder detector
514 xt[0],xt[1],xt[2], // Translation vector
515 angl[0],angl[1],angl[2],angl[3],angl[4],angl[5] // Geant rotaion
518 fprintf(fp,"%9e %9e %9e %9e %9e %9e %9e %9e %9e",
519 mat[0],mat[1],mat[2],mat[3],mat[4],mat[5],mat[6],mat[7],mat[8]
520 ); // Adding the rotation matrix.
523 } // end if printit[layer][ladder][detector]
527 //____________________________________________________________________________
528 void AliITSv5::Streamer(TBuffer &R__b){
529 ////////////////////////////////////////////////////////////////////////
530 // A dummy Streamer function for this class AliITSv5. By default it
531 // only streams the AliITS class as it is required. Since this class
532 // dosen't contain any "real" data to be saved, it doesn't.
533 ////////////////////////////////////////////////////////////////////////
534 if (R__b.IsReading()) {
535 Version_t R__v = R__b.ReadVersion();
537 AliITS::Streamer(R__b);
538 // This information does not need to be read. It is "hard wired"
539 // into this class via its creators.
541 //R__b.ReadArray(fId5Name);
545 R__b.WriteVersion(AliITSv5::IsA());
546 AliITS::Streamer(R__b);
547 // This information does not need to be saved. It is "hard wired"
548 // into this class via its creators.
550 //R__b.WriteArray(fId5Name, __COUNTER__);
551 } // end if R__b.IsReading()