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