]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSvtest.cxx
update info about cvs installation using cvs account
[u/mrichter/AliRoot.git] / ITS / AliITSvtest.cxx
CommitLineData
e8189707 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/*
17$Log$
18Revision 1.1.2.2 2000/03/02 21:53:36 nilsen
19to make it compatable with the changes in AliRun/AliModule.
20
21Revision 1.1.2.1 2000/01/12 20:19:03 nilsen
22 The changes made with this latest inclusion of code is very large.
23Many of the new files were added just in December when P. Cerello added his
24SDD simulations to the distrobutions. Also added are some file of P. Skowronski
25for SSD cluster finding and ghost RecPoints. None of this "new" code has been
26proporly tested. Other code new to this cvs repository is explained in the
27ITS Off-line web page. In general the changes are too large to give a resonable
28discription of them but probably should be taken as the starting point for
29the developement branch (ITS-working).
30 B. S. Nilsen
31
32Revision 1.13 1999/10/16 19:49:00 BSN
33$Name$
34$Author$
35$Id$
36*/
37
38///////////////////////////////////////////////////////////////////////////////
39// //
40// Inner Traking System version Test //
41// This class contains the base procedures for the Inner Tracking System //
42// //
43// Authors: R. Barbera, B. S. Nilsen. //
44// version Test //
45// Created October 16 1999. //
46// //
47///////////////////////////////////////////////////////////////////////////////
48
49#include <stdio.h>
50#include <stdlib.h>
51#include <TMath.h>
52
53#include "AliRun.h"
54#include "TSystem.h"
55#include "AliITShit.h"
56#include "AliITS.h"
57#include "AliITSvtest.h"
58#include "AliITSgeom.h"
59
60ClassImp(AliITSvtest)
61
62//_____________________________________________________________________________
63AliITSvtest::AliITSvtest() {
64 //
65 // Standard constructor for the ITS
66 //
67/*
68 fIdTestN = 6;
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";
76*/
77}
78//____________________________________________________________________________
79AliITSvtest::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");
85 return;
86}
87//_____________________________________________________________________________
88AliITSvtest& 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");
94 return *this;
95}
96//_____________________________________________________________________________
97AliITSvtest::~AliITSvtest() {
98 //
99 // Standard destructor for the ITS
100 //
101 delete [] fIdTestName;
102}
103//_____________________________________________________________________________
104AliITSvtest::AliITSvtest(const char *fileeuc,const char *filetme,
105 const char *name, const char *title)
106 : AliITS(name, title){
107 //
108 // Standard constructor for the ITS
109 //
110 fIdTestN = 6;
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";
118
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.
123}
124
125
126//_____________________________________________________________________________
127void AliITSvtest::CreateMaterials(){
128 //
129 // Read materials for the ITS
130 //
131 char *filtmp;
132//
133 filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
134// FILE *file = fopen(fEuclidMaterial.Data(),"r");
135 FILE *file = fopen(filtmp,"r");
136 if(file) {
137 fclose(file);
138// ReadEuclidMedia(fEuclidMaterial.Data(),this);
139 ReadEuclidMedia(filtmp);
140 } else {
141 Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
142// fEuclidMaterial.Data());
143 filtmp);
144 exit(1);
145 } // end if(file)
146}
147
148//_____________________________________________________________________________
149void AliITSvtest::CreateGeometry(){
150//////////////////////////////////////////////////////////////////////
151////////////////////////////////////////////////////////////////////////
152// Read geometry for the ITS
153//
154
155 Int_t size;
156 char topvol[5];
157 char *filtmp;
158//
159 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
160 FILE *file = fopen(filtmp,"r");
161 delete [] filtmp;
162 if(file) {
163 fclose(file);
164 printf("Ready to read Euclid geometry file\n");
165 ReadEuclid(fEuclidGeometry.Data(),topvol);
166 printf("Read in euclid geometries\n");
167 } else {
168 Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
169 fEuclidGeometry.Data());
170 exit(1);
171 } // end if(file)
172 //
173 //---Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
174 // invisible
175 //
176 gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
177 //
178 //---Outputs the geometry tree in the EUCLID/CAD format
179
180 if (fEuclidOut) {
181 gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
182 } // end if (fEuclidOut)
183
184 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
185 size = strlen(filtmp);
186 if(size>4){
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.
192 fclose(file);
193 printf("ready to read .det file %s\n",filtmp);
194 fITSgeom = new AliITSgeom(filtmp);
195 }else{
196 fITSgeom = 0;
197 // fill AliITSgeom structure from geant structure just filled above
198 }// end if(file)
199 delete [] filtmp;
200 }// end if(size>4)
201 printf("finished with euclid geometrys\n");
202}
203
204//_____________________________________________________________________________
205void AliITSvtest::Init(){
206 //
207 // Initialise the ITS after it has been created
208 //
209 Int_t i;
210
211 fIdN = fIdTestN;
212 fIdName = new TString[fIdTestN];
213 fIdSens = new Int_t[fIdTestN];
214 for(i=0;i<fIdTestN;i++) {
215 fIdName[i]=fIdTestName[i];
216 /*
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.
221 */
222 } // end for i
223
224 AliITS::Init();
225}
226
227//_____________________________________________________________________________
228void AliITSvtest::StepManager(){
229 //
230 // Called for every step in the ITS
231 //
232 Int_t copy, id;
233 Int_t copy1,copy2;
234 Float_t hits[8];
235 Int_t vol[4];
236 TLorentzVector position, momentum;
237 TClonesArray &lhits = *fHits;
238 //
239 // Track status
240 vol[3] = 0;
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;
248 //
249 // Fill hit structure.
250 if(!(gMC->TrackCharge())) return;
251 //
252 // Only entering charged tracks
253 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
254 vol[0] = 1;
255 id = gMC->CurrentVolOffID(0,copy);
256 //detector copy in the ladder = 1<->4 (ITS1)
257 vol[1] = copy;
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]){
264 vol[0] = 2;
265 id = gMC->CurrentVolOffID(0,copy);
266 //detector copy in the ladder = 1<->4 (ITS2)
267 vol[1] = copy;
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]){
274 vol[0] = 3;
275 id = gMC->CurrentVolOffID(1,copy);
276 //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
277 vol[1] = copy;
278 id = gMC->CurrentVolOffID(2,copy);
279 //ladder copy in the layer = 1<->12 (I316)
280 vol[2] = copy;
281 } else if(id == fIdSens[3]){
282 vol[0] = 4;
283 id = gMC->CurrentVolOffID(1,copy);
284 //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
285 vol[1] = copy;
286 id = gMC->CurrentVolOffID(2,copy);
287 //ladder copy in the layer = 1<->22 (I417)
288 vol[2] = copy;
289 }else if(id == fIdSens[4]){
290 vol[0] = 5;
291 id = gMC->CurrentVolOffID(1,copy);
292 //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
293 vol[1] = copy;
294 id = gMC->CurrentVolOffID(2,copy);
295 //ladder copy in the layer = 1<->34 (I565)
296 vol[2] = copy;
297 }else if(id == fIdSens[5]){
298 vol[0] = 6;
299 id = gMC->CurrentVolOffID(1,copy);
300 //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
301 vol[1] = copy;
302 id = gMC->CurrentVolOffID(2,copy);
303 //ladder copy in the layer = 1<->38 (I569)
304 vol[2] = copy;
305 } else {
306 return; // not an ITS volume?
307 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
308//
309 gMC->TrackPosition(position);
310 gMC->TrackMomentum(momentum);
311 hits[0]=position[0];
312 hits[1]=position[1];
313 hits[2]=position[2];
314 hits[3]=momentum[0];
315 hits[4]=momentum[1];
316 hits[5]=momentum[2];
317 hits[6]=gMC->Edep();
318 hits[7]=gMC->TrackTime();
319 // Fill hit structure with this new hit.
320 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
321 return;
322}
323//____________________________________________________________________________
324void AliITSvtest::Streamer(TBuffer &R__b)
325{
326 // Stream an object of class AliITSvtest.
327
328 if (R__b.IsReading()) {
329 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
330 AliITS::Streamer(R__b);
331 } else {
332 R__b.WriteVersion(AliITSvtest::IsA());
333 AliITS::Streamer(R__b);
334 }
335}
336