]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSv5.cxx
Change location of figures
[u/mrichter/AliRoot.git] / ITS / AliITSv5.cxx
1 ///////////////////////////////////////////////////////////////////////////////
2 //                                                                           //
3 //  Inner Traking System version 5                                           //
4 //  This class contains the base procedures for the Inner Tracking System    //
5 //                                                                           //
6 // Authors: R. Barbera, B. S. Nilsen.
7 // version 5.
8 // Created September 17 1999.
9 //                                                                           //
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <TMath.h>
15
16 #include "AliRun.h"
17 #include "TSystem.h"
18 #include "AliITShit.h"
19 #include "AliITS.h"
20 #include "AliITSv5.h"
21 #include "AliITSgeom.h"
22
23 ClassImp(AliITSv5)
24  
25 //_____________________________________________________________________________
26 AliITSv5::AliITSv5() : AliITS(){
27     //
28     // Standard constructor for the ITS
29     //
30     fId5N = 5;
31     fId5Name = new char*[fId5N];
32     fId5Name[0] = "ITS1";
33     fId5Name[1] = "ITS2";
34     fId5Name[2] = "ITS3";
35     fId5Name[3] = "ITS4";
36     fId5Name[4] = "ITS5";
37     fId5Name[5] = "ITS6";
38 }
39 //_____________________________________________________________________________
40 AliITSv5::AliITSv5(const char *name, const char *title) : AliITS(name, title){
41     //
42     // Standard constructor for the ITS
43     //
44     fId5N = 6;
45     fId5Name = new char*[fId5N];
46     fId5Name[0] = "ITS1";
47     fId5Name[1] = "ITS2";
48     fId5Name[2] = "ITS3";
49     fId5Name[3] = "ITS4";
50     fId5Name[4] = "ITS5";
51     fId5Name[5] = "ITS6";
52
53     fEuclidMaterial = "$ALICE_ROOT/Euclid/ITSgeometry_5.tme";
54     fEuclidGeometry = "$ALICE_ROOT/Euclid/ITSgeometry_5.euc";
55 }
56
57  
58 //_____________________________________________________________________________
59 void AliITSv5::CreateMaterials(){
60   //
61   // Read materials for the ITS
62   //
63     char *filtmp;
64 //
65   filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
66 //  FILE *file = fopen(fEuclidMaterial.Data(),"r");
67   FILE *file = fopen(filtmp,"r");
68   if(file) {
69     fclose(file);
70 //    gAlice->ReadEuclidMedia(fEuclidMaterial.Data(),this);
71     gAlice->ReadEuclidMedia(filtmp,this);
72   } else {
73     Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
74 //        fEuclidMaterial.Data());
75           filtmp);
76     exit(1);
77   } // end if(file)
78 }
79
80 //_____________________________________________________________________________
81 void AliITSv5::CreateGeometry(){
82 //////////////////////////////////////////////////////////////////////
83 //    This is the geometry used for the ITS Pre-TDR and comes from an 
84 // Euclid to Geant conversion. The only difference
85 // is in the details of the ITS supports. The detectors elements, 
86 // detector numbering, and local and global reference frames are shown in
87 //  the following figures.
88 //Begin_Html
89 /*
90 <img src="picts/ITS/its1+2_convention_front_5.gif">
91 </pre>
92 <br clear=left>
93 <font size=+2 color=red>
94 <p>This shows the front view of the SPDs.
95 </font>
96 <pre>
97 <img src="picts/ITS/its1+2_convention_side_5.gif">
98 </pre>
99 <br clear=left>
100 <font size=+2 color=red>
101 <p>This shows the perspective view of the SPDs.
102 </font>
103 <img src="picts/ITS/its1+2_tree.gif">
104 </pre>
105 <br clear=left>
106 <font size=+2 color=red>
107 <p>This shows the geometry Tree for the SPDs.
108 </font>
109 <pre>
110
111 <pre>
112 <img src="picts/ITS/its3+4_convention_front_5.gif">
113 </pre>
114 <br clear=left>
115 <font size=+2 color=red>
116 <p>This shows the front view of the SDDs.
117 </font>
118 <pre>
119 <img src="picts/ITS/its3+4_convention_side_5.gif">
120 </pre>
121 <br clear=left>
122 <font size=+2 color=red>
123 <p>This shows the perspective view of the SDDs.
124 </font>
125 <img src="picts/ITS/its3+4_tree.gif">
126 </pre>
127 <br clear=left>
128 <font size=+2 color=red>
129 <p>This shows the geometry Tree for the SDDs.
130 </font>
131 <pre>
132
133 <pre>
134 <img src="picts/ITS/its5+6_convention_front_5.gif">
135 </pre>
136 <br clear=left>
137 <font size=+2 color=red>
138 <p>This shows the front view of the SSDs.
139 </font>
140 <pre>
141 <img src="picts/ITS/its5+6_convention_side_5.gif">
142 </pre>
143 <br clear=left>
144 <font size=+2 color=red>
145 <p>This shows the perspective view of the SSDs.
146 </font>
147 <pre>
148 <img src="picts/ITS/its5+6_tree.gif">
149 </pre>
150 <br clear=left>
151 <font size=+2 color=red>
152 <p>This shows the geometry Tree for the SSDs.
153 </font>
154 <pre>
155
156
157 <img src="picts/ITS/its_layer1-6_2.gif">
158 </pre>
159 <br clear=left>
160 <font size=+2 color=red>
161 <p>This shows the front view of the whole ITS..
162 </font>
163 <pre>
164
165 <img src="picts/ITS/its_layer1-6_1.gif">
166 </pre>
167 <br clear=left>
168 <font size=+2 color=red>
169 <p>This shows the perspective view of the whole ITS..
170 </font>
171 <pre>
172
173 <img src="picts/ITS/its1-6_tree.gif">
174 </pre>
175 <br clear=left>
176 <font size=+2 color=red>
177 <p>This shows the geometry Tree for the whole ITS.
178 </font>
179 <pre>
180 */
181 //End_Html
182 //
183 //
184 //      Here are shown the details of the ITS support cones and services.
185 // First is a GEANT tree showing the organization of all of the volumes
186 // that make up the ITS supports and services.
187 //Begin_Html
188 /*
189 <img src="picts/ITS/supports_tree.gif">
190  */
191 //End_Html
192 //     What follows are a number of figures showing what these support
193 // structures look like.
194 //Begin_Html
195 /*
196
197 <img src="picts/ITS/supports_3.gif">
198 </pre>
199 <br clear=left>
200 <font size=+2 color=red>
201 <p>This shows the geometry of the supports for the Drift and Strip layers only.
202 </font>
203 <pre>
204
205 <img src="picts/ITS/supports_2.gif">
206 </pre>
207 <br clear=left>
208 <font size=+2 color=red>
209 <p>This shows the geometry of the supports for the Drift and Strip layers in front cut out.
210 </font>
211 <pre>
212
213 <img src="picts/ITS/supports_1.gif">
214 </pre>
215 <br clear=left>
216 <font size=+2 color=red>
217 <p>This shows the geometry of the supports for the Drift and Strip layers in a back cut out..
218 </font>
219 <pre>
220
221 <img src="picts/ITS/suppssd.gif">
222 </pre>
223 <br clear=left>
224 <font size=+2 color=red>
225 <p>This shows the geometry for the Strip layers supports.
226 </font>
227 <pre>
228
229 <img src="picts/ITS/suppsdd.gif">
230 </pre>
231 <br clear=left>
232 <font size=+2 color=red>
233 <p>This shows the geometry for the Drift layers supports.
234 </font>
235 <pre>
236  */
237 //End_Html
238 ////////////////////////////////////////////////////////////////////////
239 // Read geometry for the ITS
240 //
241
242     Int_t size;
243     char topvol[5];
244     char *filtmp;
245 //
246   filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
247   FILE *file = fopen(filtmp,"r");
248   delete [] filtmp;
249   if(file) {
250     fclose(file);
251     printf("Ready to read Euclid geometry file\n");
252     gAlice->ReadEuclid(fEuclidGeometry.Data(),this,topvol);
253     printf("Read in euclid geometries\n");
254   } else {
255     Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
256           fEuclidGeometry.Data());
257     exit(1);
258   } // end if(file)
259   //
260   //---Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
261   //     invisible
262   //
263   gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
264   //
265   //---Outputs the geometry tree in the EUCLID/CAD format
266   
267     if (fEuclidOut) {
268       gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
269     } // end if (fEuclidOut)
270
271     filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
272     size = strlen(filtmp);
273     if(size>4){
274         filtmp[size-3] = 'd'; // change from .euc to .det
275         filtmp[size-2] = 'e';
276         filtmp[size-1] = 't';
277         file = fopen(filtmp,"r");
278         if(file){ // if file exists use it to fill AliITSgeom structure.
279             fclose(file);
280             printf("ready to read .det file %s\n",filtmp);
281             fITSgeom = new AliITSgeom(filtmp);
282         }else{
283             fITSgeom = 0;
284             // fill AliITSgeom structure from geant structure just filled above
285         }// end if(file)
286         delete [] filtmp;
287     }// end if(size>4)
288     printf("finished with euclid geometrys\n");
289 }
290
291 //_____________________________________________________________________________
292 void AliITSv5::Init(){
293     //
294     // Initialise the ITS after it has been created
295     //
296     Int_t i,j,l;
297
298     fIdN    = fId5N;
299     fIdName = new char*[fId5N];
300     fIdSens = new Int_t[fId5N];
301     for(i=0;i<fId5N;i++) {
302         l = strlen(fId5Name[i]);
303         fIdName[i] = new char[l+1];
304         for(j=0;j<l;j++) fIdName[i][j] = fId5Name[i][j];
305         fIdName[i][l] = '\0'; // Null terminate this string.
306     } // end for i
307
308     AliITS::Init();
309
310  
311 //_____________________________________________________________________________
312 void AliITSv5::StepManager(){
313   //
314   // Called for every step in the ITS
315   //
316   Int_t          copy, id;
317   Int_t          copy1,copy2;
318   Float_t        hits[8];
319   Int_t          vol[4];
320   TLorentzVector position, momentum;
321   TClonesArray   &lhits = *fHits;
322   //
323   // Track status
324   vol[3] = 0;
325   if(gMC->IsTrackInside())      vol[3] +=  1;
326   if(gMC->IsTrackEntering())    vol[3] +=  2;
327   if(gMC->IsTrackExiting())     vol[3] +=  4;
328   if(gMC->IsTrackOut())         vol[3] +=  8;
329   if(gMC->IsTrackDisappeared()) vol[3] += 16;
330   if(gMC->IsTrackStop())        vol[3] += 32;
331   if(gMC->IsTrackAlive())       vol[3] += 64;
332   //
333   // Fill hit structure.
334   if(!(gMC->TrackCharge())) return;
335   //
336   // Only entering charged tracks
337   if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
338       vol[0] = 1;
339       id = gMC->CurrentVolOffID(0,copy);
340       //detector copy in the ladder = 1<->4  (ITS1)
341       vol[1] = copy;
342       gMC->CurrentVolOffID(1,copy1);
343       //ladder copy in the module   = 1<->2  (I186)
344       gMC->CurrentVolOffID(2,copy2);
345       //module copy in the layer    = 1<->10 (I132)
346       vol[2] = copy1+(copy2-1)*2;//# of ladders in one module  = 2
347   } else if(id == fIdSens[1]){
348       vol[0] = 2;
349       id = gMC->CurrentVolOffID(0,copy);
350       //detector copy in the ladder = 1<->4  (ITS2)
351       vol[1] = copy;
352       gMC->CurrentVolOffID(1,copy1);
353       //ladder copy in the module   = 1<->4  (I131)
354       gMC->CurrentVolOffID(2,copy2);
355       //module copy in the layer    = 1<->10 (I132)
356       vol[2] = copy1+(copy2-1)*4;//# of ladders in one module  = 4
357   } else if(id == fIdSens[2]){
358       vol[0] = 3;
359       id = gMC->CurrentVolOffID(1,copy);
360       //detector copy in the ladder = 1<->5  (ITS3 is inside I314)
361       vol[1] = copy;
362       id = gMC->CurrentVolOffID(2,copy);
363       //ladder copy in the layer    = 1<->12 (I316)
364       vol[2] = copy;
365   } else if(id == fIdSens[3]){
366       vol[0] = 4;
367       id = gMC->CurrentVolOffID(1,copy);
368       //detector copy in the ladder = 1<->8  (ITS4 is inside I414)
369       vol[1] = copy;
370       id = gMC->CurrentVolOffID(2,copy);
371       //ladder copy in the layer    = 1<->22 (I417)
372       vol[2] = copy;
373   }else if(id == fIdSens[4]){
374       vol[0] = 5;
375       id = gMC->CurrentVolOffID(1,copy);
376       //detector copy in the ladder = 1<->23  (ITS5 is inside I562)
377       vol[1] = copy;
378       id = gMC->CurrentVolOffID(2,copy);
379      //ladder copy in the layer    = 1<->34 (I565)
380       vol[2] = copy;
381   }else if(id == fIdSens[5]){
382       vol[0] = 6;
383       id = gMC->CurrentVolOffID(1,copy);
384       //detector copy in the ladder = 1<->26  (ITS6 is inside I566)
385       vol[1] = copy;
386       id = gMC->CurrentVolOffID(2,copy);
387       //ladder copy in the layer = 1<->38 (I569)
388       vol[2] = copy;
389   } else {
390       return; // not an ITS volume?
391   } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
392 //
393   gMC->TrackPosition(position);
394   gMC->TrackMomentum(momentum);
395   hits[0]=position[0];
396   hits[1]=position[1];
397   hits[2]=position[2];
398   hits[3]=momentum[0];
399   hits[4]=momentum[1];
400   hits[5]=momentum[2];
401   hits[6]=gMC->Edep();
402   hits[7]=gMC->TrackTime();
403   // Fill hit structure with this new hit.
404   new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
405   return;
406 }
407 //____________________________________________________________________________
408 void AliITSv5::Streamer(TBuffer &R__b)
409 {
410    // Stream an object of class AliITSv5.
411
412    if (R__b.IsReading()) {
413       Version_t R__v = R__b.ReadVersion(); if (R__v) { }
414       AliITS::Streamer(R__b);
415       // This information does not need to be read. It is "hard wired"
416       // into this class via its creators.
417       //R__b >> fId5N;
418       //R__b.ReadArray(fId5Name);
419    } else {
420       R__b.WriteVersion(AliITSv5::IsA());
421       AliITS::Streamer(R__b);
422       // This information does not need to be saved. It is "hard wired"
423       // into this class via its creators.
424       //R__b << fId5N;
425       //R__b.WriteArray(fId5Name, __COUNTER__);
426    }
427 }
428