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.1.2.2 2000/03/02 21:53:36 nilsen
19 to make it compatable with the changes in AliRun/AliModule.
21 Revision 1.1.2.1 2000/01/12 20:19:03 nilsen
22 The changes made with this latest inclusion of code is very large.
23 Many of the new files were added just in December when P. Cerello added his
24 SDD simulations to the distrobutions. Also added are some file of P. Skowronski
25 for SSD cluster finding and ghost RecPoints. None of this "new" code has been
26 proporly tested. Other code new to this cvs repository is explained in the
27 ITS Off-line web page. In general the changes are too large to give a resonable
28 discription of them but probably should be taken as the starting point for
29 the developement branch (ITS-working).
32 Revision 1.13 1999/10/16 19:49:00 BSN
38 ///////////////////////////////////////////////////////////////////////////////
40 // Inner Traking System version Test //
41 // This class contains the base procedures for the Inner Tracking System //
43 // Authors: R. Barbera, B. S. Nilsen. //
45 // Created October 16 1999. //
47 ///////////////////////////////////////////////////////////////////////////////
55 #include "AliITShit.h"
57 #include "AliITSvtest.h"
58 #include "AliITSgeom.h"
62 //_____________________________________________________________________________
63 AliITSvtest::AliITSvtest() {
65 // Standard constructor for the ITS
69 fIdTestName = new TString[fIdTestN];
70 fIdTestName[0] = "ITS1";
71 fIdTestName[1] = "ITS2";
72 fIdTestName[2] = "ITS3";
73 fIdTestName[3] = "ITS4";
74 fIdTestName[4] = "ITS5";
75 fIdTestName[5] = "ITS6";
78 //____________________________________________________________________________
79 AliITSvtest::AliITSvtest(const AliITSvtest &source){
80 ////////////////////////////////////////////////////////////////////////
81 // Copy Constructor for ITS test version.
82 ////////////////////////////////////////////////////////////////////////
83 if(&source == this) return;
84 printf("Not allowed to copy AliITSvtest\n");
87 //_____________________________________________________________________________
88 AliITSvtest& AliITSvtest::operator=(const AliITSvtest &source){
89 ////////////////////////////////////////////////////////////////////////
90 // Assignment operator for the ITS version 1.
91 ////////////////////////////////////////////////////////////////////////
92 if(&source == this) return *this;
93 printf("Not allowed to copy AliITSvtest\n");
96 //_____________________________________________________________________________
97 AliITSvtest::~AliITSvtest() {
99 // Standard destructor for the ITS
101 delete [] fIdTestName;
103 //_____________________________________________________________________________
104 AliITSvtest::AliITSvtest(const char *fileeuc,const char *filetme,
105 const char *name, const char *title)
106 : AliITS(name, title){
108 // Standard constructor for the ITS
111 fIdTestName = new TString[fIdTestN];
112 fIdTestName[0] = "ITS1";
113 fIdTestName[1] = "ITS2";
114 fIdTestName[2] = "ITS3";
115 fIdTestName[3] = "ITS4";
116 fIdTestName[4] = "ITS5";
117 fIdTestName[5] = "ITS6";
119 fEuclidMaterial = filetme;
120 fEuclidGeometry = fileeuc;
121 // The .det file for the geometry must have the same name as fileeuc with
122 // .euc replaced by .det.
126 //_____________________________________________________________________________
127 void AliITSvtest::CreateMaterials(){
129 // Read materials for the ITS
133 filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
134 // FILE *file = fopen(fEuclidMaterial.Data(),"r");
135 FILE *file = fopen(filtmp,"r");
138 // ReadEuclidMedia(fEuclidMaterial.Data(),this);
139 ReadEuclidMedia(filtmp);
141 Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
142 // fEuclidMaterial.Data());
148 //_____________________________________________________________________________
149 void AliITSvtest::CreateGeometry(){
150 //////////////////////////////////////////////////////////////////////
151 ////////////////////////////////////////////////////////////////////////
152 // Read geometry for the ITS
159 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
160 FILE *file = fopen(filtmp,"r");
164 printf("Ready to read Euclid geometry file\n");
165 ReadEuclid(fEuclidGeometry.Data(),topvol);
166 printf("Read in euclid geometries\n");
168 Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
169 fEuclidGeometry.Data());
173 //---Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
176 gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
178 //---Outputs the geometry tree in the EUCLID/CAD format
181 gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
182 } // end if (fEuclidOut)
184 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
185 size = strlen(filtmp);
187 filtmp[size-3] = 'd'; // change from .euc to .det
188 filtmp[size-2] = 'e';
189 filtmp[size-1] = 't';
190 file = fopen(filtmp,"r");
191 if(file){ // if file exists use it to fill AliITSgeom structure.
193 printf("ready to read .det file %s\n",filtmp);
194 fITSgeom = new AliITSgeom(filtmp);
197 // fill AliITSgeom structure from geant structure just filled above
201 printf("finished with euclid geometrys\n");
204 //_____________________________________________________________________________
205 void AliITSvtest::Init(){
207 // Initialise the ITS after it has been created
212 fIdName = new TString[fIdTestN];
213 fIdSens = new Int_t[fIdTestN];
214 for(i=0;i<fIdTestN;i++) {
215 fIdName[i]=fIdTestName[i];
217 l = strlen(fIdTestName[i]);
218 fIdName[i] = new char[l+1];
219 for(j=0;j<l;j++) fIdName[i][j] = fIdTestName[i][j];
220 fIdName[i][l] = '\0'; // Null terminate this string.
227 //_____________________________________________________________________________
228 void AliITSvtest::StepManager(){
230 // Called for every step in the ITS
236 TLorentzVector position, momentum;
237 TClonesArray &lhits = *fHits;
241 if(gMC->IsTrackInside()) vol[3] += 1;
242 if(gMC->IsTrackEntering()) vol[3] += 2;
243 if(gMC->IsTrackExiting()) vol[3] += 4;
244 if(gMC->IsTrackOut()) vol[3] += 8;
245 if(gMC->IsTrackDisappeared()) vol[3] += 16;
246 if(gMC->IsTrackStop()) vol[3] += 32;
247 if(gMC->IsTrackAlive()) vol[3] += 64;
249 // Fill hit structure.
250 if(!(gMC->TrackCharge())) return;
252 // Only entering charged tracks
253 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
255 id = gMC->CurrentVolOffID(0,copy);
256 //detector copy in the ladder = 1<->4 (ITS1)
258 gMC->CurrentVolOffID(1,copy1);
259 //ladder copy in the module = 1<->2 (I186)
260 gMC->CurrentVolOffID(2,copy2);
261 //module copy in the layer = 1<->10 (I132)
262 vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
263 } else if(id == fIdSens[1]){
265 id = gMC->CurrentVolOffID(0,copy);
266 //detector copy in the ladder = 1<->4 (ITS2)
268 gMC->CurrentVolOffID(1,copy1);
269 //ladder copy in the module = 1<->4 (I131)
270 gMC->CurrentVolOffID(2,copy2);
271 //module copy in the layer = 1<->10 (I132)
272 vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
273 } else if(id == fIdSens[2]){
275 id = gMC->CurrentVolOffID(1,copy);
276 //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
278 id = gMC->CurrentVolOffID(2,copy);
279 //ladder copy in the layer = 1<->12 (I316)
281 } else if(id == fIdSens[3]){
283 id = gMC->CurrentVolOffID(1,copy);
284 //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
286 id = gMC->CurrentVolOffID(2,copy);
287 //ladder copy in the layer = 1<->22 (I417)
289 }else if(id == fIdSens[4]){
291 id = gMC->CurrentVolOffID(1,copy);
292 //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
294 id = gMC->CurrentVolOffID(2,copy);
295 //ladder copy in the layer = 1<->34 (I565)
297 }else if(id == fIdSens[5]){
299 id = gMC->CurrentVolOffID(1,copy);
300 //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
302 id = gMC->CurrentVolOffID(2,copy);
303 //ladder copy in the layer = 1<->38 (I569)
306 return; // not an ITS volume?
307 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
309 gMC->TrackPosition(position);
310 gMC->TrackMomentum(momentum);
318 hits[7]=gMC->TrackTime();
319 // Fill hit structure with this new hit.
320 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
323 //____________________________________________________________________________
324 void AliITSvtest::Streamer(TBuffer &R__b)
326 // Stream an object of class AliITSvtest.
328 if (R__b.IsReading()) {
329 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
330 AliITS::Streamer(R__b);
332 R__b.WriteVersion(AliITSvtest::IsA());
333 AliITS::Streamer(R__b);