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.4 2001/01/18 06:25:09 barbera
19 ITS geometry using test Euclid files
21 Revision 1.1.2.8 2000/10/05 20:28:18 nilsen
22 Now using root generated streamer function.
24 Revision 1.1.2.7 2000/07/31 13:51:22 barbera
25 Updated from the release
27 Revision 1.2 2000/07/10 16:07:19 fca
28 Release version of ITS code
30 Revision 1.1.2.2 2000/03/02 21:53:36 nilsen
31 to make it compatable with the changes in AliRun/AliModule.
33 Revision 1.1.2.1 2000/01/12 20:19:03 nilsen
34 The changes made with this latest inclusion of code is very large.
35 Many of the new files were added just in December when P. Cerello added his
36 SDD simulations to the distrobutions. Also added are some file of P. Skowronski
37 for SSD cluster finding and ghost RecPoints. None of this "new" code has been
38 proporly tested. Other code new to this cvs repository is explained in the
39 ITS Off-line web page. In general the changes are too large to give a resonable
40 discription of them but probably should be taken as the starting point for
41 the developement branch (ITS-working).
44 Revision 1.13 1999/10/16 19:49:00 BSN
50 ///////////////////////////////////////////////////////////////////////////////
52 // Inner Traking System version Test //
53 // This class contains the base procedures for the Inner Tracking System //
55 // Authors: R. Barbera, B. S. Nilsen. //
57 // Created October 16 1999. //
59 ///////////////////////////////////////////////////////////////////////////////
63 #include <TGeometry.h>
66 #include <TFile.h> // only required for Tracking function?
68 #include <TObjArray.h>
69 #include <TObjString.h>
70 #include <TClonesArray.h>
71 #include <TLorentzVector.h>
77 #include "AliITShit.h"
79 #include "AliITSvtest.h"
80 #include "AliITSgeom.h"
84 //_____________________________________________________________________________
85 AliITSvtest::AliITSvtest() {
87 // Standard constructor for the ITS
95 //____________________________________________________________________________
96 AliITSvtest::AliITSvtest(const AliITSvtest &source){
97 ////////////////////////////////////////////////////////////////////////
98 // Copy Constructor for ITS test version.
99 ////////////////////////////////////////////////////////////////////////
100 if(&source == this) return;
101 printf("Not allowed to copy AliITSvtest\n");
104 //_____________________________________________________________________________
105 AliITSvtest& AliITSvtest::operator=(const AliITSvtest &source){
106 ////////////////////////////////////////////////////////////////////////
107 // Assignment operator for the ITS version 1.
108 ////////////////////////////////////////////////////////////////////////
109 if(&source == this) return *this;
110 printf("Not allowed to copy AliITSvtest\n");
113 //_____________________________________________________________________________
114 AliITSvtest::~AliITSvtest() {
116 // Standard destructor for the ITS
119 //_____________________________________________________________________________
120 AliITSvtest::AliITSvtest(const char *fileeuc,const char *filetme,
121 const char *name, const char *title)
122 : AliITS(name, title){
124 // Standard constructor for the ITS
128 // TObjArray of TObjStrings
129 fIdName = new TObjArray(fIdN);
130 fIdName->AddAt(new TObjString("ITS1"),0);
131 fIdName->AddAt(new TObjString("ITS2"),1);
132 fIdName->AddAt(new TObjString("ITS3"),2);
133 fIdName->AddAt(new TObjString("ITS4"),3);
134 fIdName->AddAt(new TObjString("ITS5"),4);
135 fIdName->AddAt(new TObjString("ITS6"),5);
137 // Array of TStrings.
138 fIdName = new TString[fIdN];
145 fIdSens = new Int_t[fIdN];
146 for (Int_t i=0;i<fIdN;i++) fIdSens[i] = 0;
150 fEuclidMaterial = filetme;
151 fEuclidGeometry = fileeuc;
152 // The .det file for the geometry must have the same name as fileeuc with
153 // .euc replaced by .det.
157 //_____________________________________________________________________________
158 void AliITSvtest::CreateMaterials(){
160 // Read materials for the ITS
164 filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
165 // FILE *file = fopen(fEuclidMaterial.Data(),"r");
166 FILE *file = fopen(filtmp,"r");
169 // ReadEuclidMedia(fEuclidMaterial.Data(),this);
170 ReadEuclidMedia(filtmp);
172 Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
173 // fEuclidMaterial.Data());
179 //_____________________________________________________________________________
180 void AliITSvtest::CreateGeometry(){
181 //////////////////////////////////////////////////////////////////////
182 ////////////////////////////////////////////////////////////////////////
183 // Read geometry for the ITS
190 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
191 FILE *file = fopen(filtmp,"r");
195 printf("Ready to read Euclid geometry file\n");
196 ReadEuclid(fEuclidGeometry.Data(),topvol);
197 printf("Read in euclid geometries\n");
199 Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
200 fEuclidGeometry.Data());
204 //---Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
207 gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
209 //---Outputs the geometry tree in the EUCLID/CAD format
212 gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
213 } // end if (fEuclidOut)
215 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
216 size = strlen(filtmp);
218 filtmp[size-3] = 'd'; // change from .euc to .det
219 filtmp[size-2] = 'e';
220 filtmp[size-1] = 't';
221 file = fopen(filtmp,"r");
222 if(file){ // if file exists use it to fill AliITSgeom structure.
224 printf("ready to read .det file %s\n",filtmp);
225 fITSgeom = new AliITSgeom(filtmp);
228 // fill AliITSgeom structure from geant structure just filled above
232 printf("finished with euclid geometrys\n");
235 //_____________________________________________________________________________
236 void AliITSvtest::Init(){
238 // Initialise the ITS after it has been created
245 //_____________________________________________________________________________
246 void AliITSvtest::StepManager(){
248 // Called for every step in the ITS
254 TLorentzVector position, momentum;
255 TClonesArray &lhits = *fHits;
259 if(gMC->IsTrackInside()) vol[3] += 1;
260 if(gMC->IsTrackEntering()) vol[3] += 2;
261 if(gMC->IsTrackExiting()) vol[3] += 4;
262 if(gMC->IsTrackOut()) vol[3] += 8;
263 if(gMC->IsTrackDisappeared()) vol[3] += 16;
264 if(gMC->IsTrackStop()) vol[3] += 32;
265 if(gMC->IsTrackAlive()) vol[3] += 64;
267 // Fill hit structure.
268 if(!(gMC->TrackCharge())) return;
270 // Only entering charged tracks
271 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
273 id = gMC->CurrentVolOffID(0,copy);
274 //detector copy in the ladder = 1<->4 (ITS1)
276 gMC->CurrentVolOffID(1,copy1);
277 //ladder copy in the module = 1<->2 (I186)
278 gMC->CurrentVolOffID(2,copy2);
279 //module copy in the layer = 1<->10 (I132)
280 vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
281 } else if(id == fIdSens[1]){
283 id = gMC->CurrentVolOffID(0,copy);
284 //detector copy in the ladder = 1<->4 (ITS2)
286 gMC->CurrentVolOffID(1,copy1);
287 //ladder copy in the module = 1<->4 (I131)
288 gMC->CurrentVolOffID(2,copy2);
289 //module copy in the layer = 1<->10 (I132)
290 vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
291 } else if(id == fIdSens[2]){
293 id = gMC->CurrentVolOffID(1,copy);
294 //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
296 id = gMC->CurrentVolOffID(2,copy);
297 //ladder copy in the layer = 1<->12 (I316)
299 } else if(id == fIdSens[3]){
301 id = gMC->CurrentVolOffID(1,copy);
302 //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
304 id = gMC->CurrentVolOffID(2,copy);
305 //ladder copy in the layer = 1<->22 (I417)
307 }else if(id == fIdSens[4]){
309 id = gMC->CurrentVolOffID(1,copy);
310 //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
312 id = gMC->CurrentVolOffID(2,copy);
313 //ladder copy in the layer = 1<->34 (I565)
315 }else if(id == fIdSens[5]){
317 id = gMC->CurrentVolOffID(1,copy);
318 //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
320 id = gMC->CurrentVolOffID(2,copy);
321 //ladder copy in the layer = 1<->38 (I569)
324 return; // not an ITS volume?
325 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
327 gMC->TrackPosition(position);
328 gMC->TrackMomentum(momentum);
336 hits[7]=gMC->TrackTime();
337 // Fill hit structure with this new hit.
338 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);