]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSv5symm.cxx
Merging the VirtualMC branch to the main development branch (HEAD)
[u/mrichter/AliRoot.git] / ITS / AliITSv5symm.cxx
CommitLineData
e5745edc 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$
b9d0a01d 18Revision 1.13.10.2 2002/08/30 15:45:54 alibrary
19Adding geant4vmc support
20
21Revision 1.13.10.1 2002/06/10 17:51:15 hristov
22Merged with v3-08-02
23
24Revision 1.13 2001/05/30 16:15:47 fca
25Correct comparison wiht AliGeant3::Class() introduced. Thanks to I.Hrivnacova
26
cbfdea0d 27Revision 1.12 2001/05/30 15:55:35 hristov
28Strings compared instead of pointers
29
268b9c60 30Revision 1.11 2001/05/30 14:04:31 hristov
31Dynamic cast replaced (F.Carminati)
32
4154d3d8 33Revision 1.10 2001/05/25 06:47:16 hristov
34Bug fix in the creation of the AliITSgeom::fShape entry for SPD. Now there is both a proper shape entry and a default, should there be future changes. This bug was related to fMinorVersion=3 was not antisipated. (B.Nilsen)
35
3e225ff6 36Revision 1.9 2001/04/18 12:07:37 barbera
37Number of modules in layer 5 and 6 re-set to 23 and 26
38
18c21458 39Revision 1.8 2001/03/23 00:12:23 nilsen
40Set Reading of AliITSgeom data from Geant3 common blocks as the default and
41not a .det file. Removed redundent calls to BuildGeometry.
42
0646a0e8 43Revision 1.7 2001/02/13 16:53:35 nilsen
44Fixed a but when trying to use GEANT4. Needed to replace
45if(!((TGeant3*)gMC)) with if(!(dynamic_casst<TGeant3*>(gMC)))
46because just casting gMC to be TGeant3* even when it realy is a TGeant3 pointer
47did not result in a zero value. For AliITSv5asymm and AliITSv5symm, needed
48to fix a bug in the initilizers and a bug in BuildGeometry. This is now done
49in the same way as in AliITSv5.cxx.
50
9a4c6ea3 51Revision 1.6 2001/02/09 20:06:26 nilsen
52Fixed bug in distructor. Can't distroy fixxed length arrays. Thanks Peter.
53
58e13d99 54Revision 1.5 2001/02/09 00:05:31 nilsen
55Added fMajor/MinorVersion variables and made other changes to better make
56use of the new code changes in AliITSgeom related classes.
57
bae7e562 58Revision 1.4 2001/02/02 23:57:29 nilsen
59Added include file that are no londer included in AliITSgeom.h
60
d953664a 61Revision 1.3 2001/01/30 09:23:13 hristov
62Streamers removed (R.Brun)
63
a8a6107b 64Revision 1.2 2000/11/30 11:13:11 barbera
65 Added changes suggested by Federico Carminati on nov, 30, 2000
66
a07ced09 67Revision 1.1 2000/10/07 15:46:29 barbera
68Version 5 of the geometry with symmetric services
69
e5745edc 70Revision 1.25 2000/10/05 20:50:00 nilsen
71Now using root generated streamers.
72
73Revision 1.14.4.12 2000/10/02 16:04:03 barbera
74Forward declarations added
75
76Revision 1.22 2000/07/10 16:07:19 fca
77Release version of ITS code
78
79Revision 1.14.4.4 2000/05/19 10:10:21 nilsen
80fix for bug with HP and Sun unix + fix for event display in ITS-working branch
81
82Revision 1.14.4.3 2000/03/04 23:46:38 nilsen
83Fixed up the comments/documentation.
84
85Revision 1.14.4.2 2000/03/02 21:53:02 nilsen
86To make it compatable with the changes in AliRun/AliModule.
87
88Revision 1.14.4.1 2000/01/12 19:03:33 nilsen
89This is the version of the files after the merging done in December 1999.
90See the ReadMe110100.txt file for details
91
92Revision 1.14 1999/10/22 08:16:49 fca
93Correct destructors, thanks to I.Hrivnacova
94
95Revision 1.13 1999/10/06 10:15:19 fca
96Correct bug in allocation of layer name and add destructor
97
98Revision 1.12 1999/10/05 08:05:09 fca
99Minor corrections for uninitialised variables.
100
101Revision 1.11 1999/09/29 09:24:20 fca
102Introduction of the Copyright and cvs Log
103
104*/
105
106///////////////////////////////////////////////////////////////////////////////
107//
108// Inner Traking System version 5 with symmetric services
109// This class contains the base procedures for the Inner Tracking System
110//
111// Authors: R. Barbera, B. S. Nilsen.
112// version 5.
113// Created October 7 2000.
114//
115///////////////////////////////////////////////////////////////////////////////
d953664a 116#include <iostream.h>
117#include <iomanip.h>
e5745edc 118#include <stdio.h>
119#include <stdlib.h>
120#include <TMath.h>
121#include <TGeometry.h>
122#include <TNode.h>
123#include <TTUBE.h>
124#include <TFile.h> // only required for Tracking function?
125#include <TCanvas.h>
126#include <TObjArray.h>
a07ced09 127#include <TLorentzVector.h>
e5745edc 128#include <TObjString.h>
129#include <TClonesArray.h>
130#include <TBRIK.h>
131#include <TSystem.h>
132
133#include "AliMC.h"
134#include "AliRun.h"
e5745edc 135#include "AliITShit.h"
bae7e562 136#include "AliITSGeant3Geometry.h"
e5745edc 137#include "AliITS.h"
138#include "AliITSv5symm.h"
139#include "AliITSgeom.h"
bae7e562 140#include "AliITSgeomSPD.h"
141#include "AliITSgeomSDD.h"
142#include "AliITSgeomSSD.h"
e5745edc 143
144ClassImp(AliITSv5symm)
145
146//_____________________________________________________________________________
147AliITSv5symm::AliITSv5symm() {
148////////////////////////////////////////////////////////////////////////
149// Standard default constructor for the ITS version 5.
150////////////////////////////////////////////////////////////////////////
bae7e562 151 Int_t i;
e5745edc 152
153 fIdN = 0;
154 fIdName = 0;
155 fIdSens = 0;
bae7e562 156 fEuclidOut = kFALSE; // Don't write Euclide file
157 fGeomDetOut = kFALSE; // Don't write .det file
0646a0e8 158 fGeomDetIn = kFALSE; // Don't Read .det file
159 fGeomOldDetIn = kFALSE; // Don't Read old formatted .det file
bae7e562 160 fMajorVersion = IsVersion();
161 fMinorVersion = 2;
162 for(i=0;i<60;i++) fRead[i] = '\0';
163 for(i=0;i<60;i++) fWrite[i] = '\0';
164 for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
165}
166//_____________________________________________________________________________
167AliITSv5symm::AliITSv5symm(const char *name, const char *title) : AliITS(name, title){
168/////////////////////////////////////////////////////////////////////////////
169// Standard constructor for the ITS version 5 with symmetrical services.
170/////////////////////////////////////////////////////////////////////////////
171 Int_t i;
172
173 fIdN = 6;
174 fIdName = new TString[fIdN];
175 fIdName[0] = "ITS1";
176 fIdName[1] = "ITS2";
177 fIdName[2] = "ITS3";
178 fIdName[3] = "ITS4";
179 fIdName[4] = "ITS5";
180 fIdName[5] = "ITS6";
181 fIdSens = new Int_t[fIdN];
182 for (i=0;i<fIdN;i++) fIdSens[i] = 0;
183 fEuclidOut = kFALSE; // Don't write Euclide file
184 fGeomDetOut = kFALSE; // Don't write .det file
0646a0e8 185 fGeomDetIn = kFALSE; // Don't Read .det file
186 fGeomOldDetIn = kFALSE; // Don't Read old formatted .det file
bae7e562 187 fMajorVersion = IsVersion();
188 fMinorVersion = 2;
189 for(i=0;i<60;i++) fRead[i] = '\0';
190 for(i=0;i<60;i++) fWrite[i] = '\0';
191
192 fEuclidMaterial = "$ALICE_ROOT/Euclid/ITSgeometry_5symm.tme";
193 fEuclidGeometry = "$ALICE_ROOT/Euclid/ITSgeometry_5symm.euc";
194 strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_v5symm.det",60);
195 strncpy(fRead,fEuclidGeomDet,60);
196 strncpy(fWrite,fEuclidGeomDet,60);
e5745edc 197}
198//____________________________________________________________________________
199AliITSv5symm::AliITSv5symm(const AliITSv5symm &source){
200////////////////////////////////////////////////////////////////////////
201// Copy Constructor for ITS version 5.
202////////////////////////////////////////////////////////////////////////
203 if(&source == this) return;
bae7e562 204 Warning("Copy Constructor","Not allowed to copy AliITSv5symm");
e5745edc 205 return;
206}
207//_____________________________________________________________________________
208AliITSv5symm& AliITSv5symm::operator=(const AliITSv5symm &source){
209////////////////////////////////////////////////////////////////////////
bae7e562 210// Assignment operator for the ITS version 5.
e5745edc 211////////////////////////////////////////////////////////////////////////
212
213 if(&source == this) return *this;
bae7e562 214 Warning("= operator","Not allowed to copy AliITSv5symm");
e5745edc 215 return *this;
216
217}
218//_____________________________________________________________________________
219AliITSv5symm::~AliITSv5symm() {
220////////////////////////////////////////////////////////////////////////
221// Standard destructor for the ITS version 5.
222////////////////////////////////////////////////////////////////////////
e5745edc 223}
224//_____________________________________________________________________________
225void AliITSv5symm::BuildGeometry(){
226////////////////////////////////////////////////////////////////////////
227// Geometry builder for the ITS version 5.
228////////////////////////////////////////////////////////////////////////
229 //
230 // Build ITS TNODE geometry for event display using detailed geometry.
231 // This function builds a simple ITS geometry used by the ROOT macro
232 // ITSdisplay.C.
233
234 TNode *top;
235 TNode *nd;
236 //const int kColorITSSPD=kRed;
237 //const int kColorITSSDD=kGreen;
238 const int kColorITSSSD=kBlue;
239 //
e5745edc 240 AliITSgeom *gm = this->GetITSgeom();
9a4c6ea3 241 if(gm==0) return;
242 top=gAlice->GetGeometry()->GetNode("alice");
e5745edc 243
244 Int_t lay,lad,det,i;
245 Text_t name[10];
246 Float_t xg[3];
247 Float_t rt[9];
248 Double_t rtd[9];
249 TBRIK *box;
250 TRotMatrix *rm;
251 //TCanvas *c1 = new TCanvas("c1","ITS");
252
253 for(lay=1;lay<=2;lay++)
254 for(lad=1;lad<=gm->GetNladders(lay);lad++)
255 for(det=1;det<=gm->GetNdetectors(lay);det++){
256 try {
257 box = new TBRIK ("ActiveSPD","Active volume of SPD","SPD SI DET",
258 0.64,0.0075,4.19);
259 } catch (...) {
260 cout << "EXCEPTION in box = new TBRIK" << endl;
261 return;
262 }
263 gm->GetTrans(lay,lad,det,xg[0],xg[1],xg[2]);
264 gm->GetRotMatrix(lay,lad,det,rt);
265 //sprintf(name,"ROT%1.1d2.2d2.2d",lay,lad,det);
266 for(i=0;i<9;i++) rtd[i] = rt[i];
267 try {
268 rm = new TRotMatrix(name,name,rtd);
269 } catch (...) {
270 cout << "EXCEPTION in new TRotMatrix" << endl;
271 return;
272 }
273 top->cd();
274 //sprintf(name,"ND%1.1d2.2d2.2d",lay,lad,det);
275 try {
276 nd = new TNode("SPD"," ",box,xg[0],xg[1],xg[2],rm);
277 } catch (...) {
278 cout << "EXCEPTION in new TNode" << endl;
279 return;
280 }
281 nd->SetLineColor(kColorITSSSD);
282 fNodes->Add(nd);
283 }
284
285 for(lay=3;lay<=3;lay++)
286 for(lad=1;lad<=gm->GetNladders(lay);lad++)
287 for(det=1;det<=gm->GetNdetectors(lay);det++){
288 try {
289 box = new TBRIK ("ActiveSDD","Active volume of SDD","SDD SI DET",
290 3.5,0.014,3.763);
291 } catch (...) {
292 cout << "EXCEPTION in box = new TBRIK" << endl;
293 return;
294 }
295 gm->GetTrans(lay,lad,det,xg[0],xg[1],xg[2]);
296 gm->GetRotMatrix(lay,lad,det,rt);
297 //sprintf(name,"ROT%1.1d2.2d2.2d",lay,lad,det);
298 for(i=0;i<9;i++) rtd[i] = rt[i];
299 try {
300 rm = new TRotMatrix(name,name,rtd);
301 } catch (...) {
302 cout << "EXCEPTION in new TRotMatrix" << endl;
303 return;
304 }
305 top->cd();
306 //sprintf(name,"ND%1.1d2.2d2.2d",lay,lad,det);
307 try {
308 nd = new TNode("SDD"," ",box,xg[0],xg[1],xg[2],rm);
309 } catch (...) {
310 cout << "EXCEPTION in new TNode" << endl;
311 return;
312 }
313 nd->SetLineColor(kColorITSSSD);
314 fNodes->Add(nd);
315 }
316
317 for(lay=4;lay<=4;lay++)
318 for(lad=1;lad<=gm->GetNladders(lay);lad++)
319 for(det=1;det<=gm->GetNdetectors(lay);det++){
320 try {
321 box = new TBRIK ("ActiveSDD","Active volume of SDD","SDD SI DET",
322 3.5,0.014,3.763);
323 } catch (...) {
324 cout << "EXCEPTION in box = new TBRIK" << endl;
325 return;
326 }
327 gm->GetTrans(lay,lad,det,xg[0],xg[1],xg[2]);
328 gm->GetRotMatrix(lay,lad,det,rt);
329 //sprintf(name,"ROT%1.1d2.2d2.2d",lay,lad,det);
330 for(i=0;i<9;i++) rtd[i] = rt[i];
331 try {
332 rm = new TRotMatrix(name,name,rtd);
333 } catch (...) {
334 cout << "EXCEPTION in new TRotMatrix" << endl;
335 return;
336 }
337 top->cd();
338 //sprintf(name,"ND%1.1d2.2d2.2d",lay,lad,det);
339 try {
340 nd = new TNode("SDD"," ",box,xg[0],xg[1],xg[2],rm);
341 } catch (...) {
342 cout << "EXCEPTION in new TNode" << endl;
343 return;
344 }
345 nd->SetLineColor(kColorITSSSD);
346 fNodes->Add(nd);
347 }
348 for(lay=5;lay<=5;lay++)
349 for(lad=1;lad<=gm->GetNladders(lay);lad++)
350 for(det=1;det<=gm->GetNdetectors(lay);det++){
351 try {
352 box = new TBRIK ("ActiveSSD","Active volume of SSD","SSD SI DET",
353 3.65,0.015,2.0);
354 } catch (...) {
355 cout << "EXCEPTION in box = new TBRIK" << endl;
356 return;
357 }
358 gm->GetTrans(lay,lad,det,xg[0],xg[1],xg[2]);
359 gm->GetRotMatrix(lay,lad,det,rt);
360 //sprintf(name,"ROT%1.1d2.2d2.2d",lay,lad,det);
361 for(i=0;i<9;i++) rtd[i] = rt[i];
362 try {
363 rm = new TRotMatrix(name,name,rtd);
364 } catch (...) {
365 cout << "EXCEPTION in new TRotMatrix" << endl;
366 return;
367 }
368 top->cd();
369 //sprintf(name,"ND%1.1d2.2d2.2d",lay,lad,det);
370 try {
371 nd = new TNode("SSD"," ",box,xg[0],xg[1],xg[2],rm);
372 } catch (...) {
373 cout << "EXCEPTION in new TNode" << endl;
374 return;
375 }
376 nd->SetLineColor(kColorITSSSD);
377 fNodes->Add(nd);
378 }
379
380 for(lay=6;lay<=6;lay++)
381 for(lad=1;lad<=gm->GetNladders(lay);lad++)
382 for(det=1;det<=gm->GetNdetectors(lay);det++){
383 try {
384 box = new TBRIK ("ActiveSSD","Active volume of SSD","SSD SI DET",
385 3.65,0.015,2.0);
386 } catch (...) {
387 cout << "EXCEPTION in box = new TBRIK" << endl;
388 return;
389 }
390
391 gm->GetTrans(lay,lad,det,xg[0],xg[1],xg[2]);
392 gm->GetRotMatrix(lay,lad,det,rt);
393 //sprintf(name,"ROT%1.1d2.2d2.2d",lay,lad,det);
394 for(i=0;i<9;i++) rtd[i] = rt[i];
395 try {
396 rm = new TRotMatrix(name,name,rtd);
397 } catch (...) {
398 cout << "EXCEPTION in new TRotMatrix" << endl;
399 return;
400 }
401 top->cd();
402 //sprintf(name,"ND%1.1d2.2d2.2d",lay,lad,det);
403 try {
404 nd = new TNode("SSD"," ",box,xg[0],xg[1],xg[2],rm);
405 } catch (...) {
406 cout << "EXCEPTION in new TNode" << endl;
407 return;
408 }
409 nd->SetLineColor(kColorITSSSD);
410 fNodes->Add(nd);
411 }
412
413
414}
415//_____________________________________________________________________________
416void AliITSv5symm::CreateMaterials(){
417////////////////////////////////////////////////////////////////////////
418// Read a file containing the materials for the ITS version 5.
419////////////////////////////////////////////////////////////////////////
420 char *filtmp;
421
422 filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
423
424 FILE *file = fopen(filtmp,"r");
425 if(file) {
426 fclose(file);
427 ReadEuclidMedia(filtmp);
428 } else {
429 Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",filtmp);
430 exit(1);
431 } // end if(file)
432}
433//_____________________________________________________________________________
434void AliITSv5symm::CreateGeometry(){
435//////////////////////////////////////////////////////////////////////
436// This is the geometry used for the ITS Pre-TDR and comes from an
437// Euclid to Geant conversion. The only difference
438// is in the details of the ITS supports. The detectors elements,
439// detector numbering, and local and global reference frames are shown in
440// the following figures.
441//Begin_Html
442/*
443<img src="picts/ITS/its1+2_convention_front_5.gif">
444</pre>
445<br clear=left>
446<font size=+2 color=red>
447<p>This shows the front view of the SPDs.
448</font>
449<pre>
450<img src="picts/ITS/its1+2_convention_side_5.gif">
451</pre>
452<br clear=left>
453<font size=+2 color=red>
454<p>This shows the perspective view of the SPDs.
455</font>
456<img src="picts/ITS/its1+2_tree.gif">
457</pre>
458<br clear=left>
459<font size=+2 color=red>
460<p>This shows the geometry Tree for the SPDs.
461</font>
462<pre>
463
464<pre>
465<img src="picts/ITS/its3+4_convention_front_5.gif">
466</pre>
467<br clear=left>
468<font size=+2 color=red>
469<p>This shows the front view of the SDDs.
470</font>
471<pre>
472<img src="picts/ITS/its3+4_convention_side_5.gif">
473</pre>
474<br clear=left>
475<font size=+2 color=red>
476<p>This shows the perspective view of the SDDs.
477</font>
478<img src="picts/ITS/its3+4_tree.gif">
479</pre>
480<br clear=left>
481<font size=+2 color=red>
482<p>This shows the geometry Tree for the SDDs.
483</font>
484<pre>
485
486<pre>
487<img src="picts/ITS/its5+6_convention_front_5.gif">
488</pre>
489<br clear=left>
490<font size=+2 color=red>
491<p>This shows the front view of the SSDs.
492</font>
493<pre>
494<img src="picts/ITS/its5+6_convention_side_5.gif">
495</pre>
496<br clear=left>
497<font size=+2 color=red>
498<p>This shows the perspective view of the SSDs.
499</font>
500<pre>
501<img src="picts/ITS/its5+6_tree.gif">
502</pre>
503<br clear=left>
504<font size=+2 color=red>
505<p>This shows the geometry Tree for the SSDs.
506</font>
507<pre>
508
509
510<img src="picts/ITS/its_layer1-6_2.gif">
511</pre>
512<br clear=left>
513<font size=+2 color=red>
514<p>This shows the front view of the whole ITS..
515</font>
516<pre>
517
518<img src="picts/ITS/its_layer1-6_1.gif">
519</pre>
520<br clear=left>
521<font size=+2 color=red>
522<p>This shows the perspective view of the whole ITS..
523</font>
524<pre>
525
526<img src="picts/ITS/its1-6_tree.gif">
527</pre>
528<br clear=left>
529<font size=+2 color=red>
530<p>This shows the geometry Tree for the whole ITS.
531</font>
532<pre>
533*/
534//End_Html
535//
536//
537// Here are shown the details of the ITS support cones and services.
538// First is a GEANT tree showing the organization of all of the volumes
539// that make up the ITS supports and services.
540//Begin_Html
541/*
542<img src="picts/ITS/supports_tree.gif">
543 */
544//End_Html
545// What follows are a number of figures showing what these support
546// structures look like.
547//Begin_Html
548/*
549
550<img src="picts/ITS/supports_3.gif">
551</pre>
552<br clear=left>
553<font size=+2 color=red>
554<p>This shows the geometry of the supports for the Drift and Strip layers only.
555</font>
556<pre>
557
558<img src="picts/ITS/supports_2.gif">
559</pre>
560<br clear=left>
561<font size=+2 color=red>
562<p>This shows the geometry of the supports for the Drift and Strip layers in front cut out.
563</font>
564<pre>
565
566<img src="picts/ITS/supports_1.gif">
567</pre>
568<br clear=left>
569<font size=+2 color=red>
570<p>This shows the geometry of the supports for the Drift and Strip layers in a back cut out..
571</font>
572<pre>
573
574<img src="picts/ITS/suppssd.gif">
575</pre>
576<br clear=left>
577<font size=+2 color=red>
578<p>This shows the geometry for the Strip layers supports.
579</font>
580<pre>
581
582<img src="picts/ITS/suppsdd.gif">
583</pre>
584<br clear=left>
585<font size=+2 color=red>
586<p>This shows the geometry for the Drift layers supports.
587</font>
588<pre>
589 */
590//End_Html
591//
592// Read a file containing the geometry for the ITS version 5.
593////////////////////////////////////////////////////////////////////////
e5745edc 594 char topvol[5];
595 char *filtmp;
596
597 filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
598 FILE *file = fopen(filtmp,"r");
599 delete [] filtmp;
600 if(file) {
601 fclose(file);
602 printf("Ready to read Euclid geometry file\n");
603 ReadEuclid(fEuclidGeometry.Data(),topvol);
604 printf("Read in euclid geometries\n");
605 } else {
606 Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
607 fEuclidGeometry.Data());
608 exit(1);
609 } // end if(file)
610 //
611 // Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
612 // invisible
613 //
614 gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
615 //
616 // Outputs the geometry tree in the EUCLID/CAD format if requested to do so
617
618 if (fEuclidOut) {
619 gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
620 } // end if (fEuclidOut)
bae7e562 621 cout << "finished with euclid geometrys" << endl;
622}
623//______________________________________________________________________
624void AliITSv5symm::ReadOldGeometry(const char *filename){
e5745edc 625 // read in the file containing the transformations for the active
626 // volumes for the ITS version 5. This is expected to be in a file
627 // ending in .det. This geometry is kept in the AliITSgeom class.
bae7e562 628 Int_t size;
629 char *filtmp;
630 FILE *file;
631
632 filtmp = gSystem->ExpandPathName(filename);
e5745edc 633 size = strlen(filtmp);
bae7e562 634 if(size>4 && fGeomDetIn){
635 filtmp[size-3] = 'd'; // change from .euc to .det
e5745edc 636 filtmp[size-2] = 'e';
637 filtmp[size-1] = 't';
bae7e562 638 file = fopen(filtmp,"r");
639 if(file){ // if file exists use it to fill AliITSgeom structure.
640 fclose(file);
641 fITSgeom = new AliITSgeom(filtmp);
642 fITSgeom->DefineShapes(3); // if fShape isn't defined define it.
643 // Now define the detector types/shapes.
644 fITSgeom->ReSetShape(kSPD,(TObject *) new AliITSgeomSPD300());
645 fITSgeom->ReSetShape(kSDD,(TObject *) new AliITSgeomSDD300());
646 fITSgeom->ReSetShape(kSSD,(TObject *) new AliITSgeomSSD());
647 }else{
648 fITSgeom = 0;
649 // fill AliITSgeom structure from geant structure just filled above
650 }// end if(file)
e5745edc 651 delete [] filtmp;
652 }// end if(size>4)
bae7e562 653}
654//______________________________________________________________________
655void AliITSv5symm::InitAliITSgeom(){
656// Based on the geometry tree defined in Geant 3.21, this
657// routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
658// sturture.
b9d0a01d 659// if(gMC->IsA()!=TGeant3::Class()) {
660 if(strcmp(gMC->GetName(),"TGeant3")) {
bae7e562 661 Error("InitAliITSgeom",
662 "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls");
663 return;
664 } // end if
665 cout << "Reading Geometry transformation directly from Geant 3." << endl;
666 const Int_t nlayers = 6;
667 const Int_t ndeep = 7;
668 Int_t itsGeomTreeNames[nlayers][ndeep],lnam[20],lnum[20];
669 Int_t nlad[nlayers],ndet[nlayers];
670 Double_t t[3],r[10];
671 Float_t par[20],att[20];
672 Int_t npar,natt,idshape,imat,imed;
673 AliITSGeant3Geometry *ig = new AliITSGeant3Geometry();
674 Int_t mod,lay,lad,det,i,j,k;
675 char *names[nlayers][ndeep] = {
676 {"ALIC","ITSV","ITSD","IT12","I132","I186","ITS1"}, // lay=1
677 {"ALIC","ITSV","ITSD","IT12","I132","I131","ITS2"}, // lay=2
678 {"ALIC","ITSV","ITSD","IT34","I004","I302","ITS3"}, // lay=3
679 {"ALIC","ITSV","ITSD","IT34","I005","I402","ITS4"}, // lay=4
680 {"ALIC","ITSV","ITSD","IT56","I565","I562","ITS5"}, // lay=5
681 {"ALIC","ITSV","ITSD","IT56","I569","I566","ITS6"}};// lay=6
682 Int_t itsGeomTreeCopys[nlayers][ndeep] = {{1,1,1,1,10, 2,4}, // lay=1
683 {1,1,1,1,10, 4,4}, // lay=2
684 {1,1,1,1,14, 6,1}, // lay=3
685 {1,1,1,1,22, 8,1}, // lay=4
686 {1,1,1,1,34,23,1}, // lay=5
687 {1,1,1,1,38,26,1}};// lay=6
688
689 // Sorry, but this is not very pritty code. It should be replaced
690 // at some point with a version that can search through the geometry
691 // tree its self.
692 cout << "Reading Geometry informaton from Geant3 common blocks" << endl;
693 for(i=0;i<20;i++) lnam[i] = lnum[i] = 0;
694 for(i=0;i<nlayers;i++)for(j=0;j<ndeep;j++)
695 itsGeomTreeNames[i][j] = ig->StringToInt(names[i][j]);
696 mod = 0;
697 for(i=0;i<nlayers;i++){
698 k = 1;
699 for(j=0;j<ndeep;j++) if(itsGeomTreeCopys[i][j]!=0)
700 k *= TMath::Abs(itsGeomTreeCopys[i][j]);
701 mod += k;
702 } // end for i
703
704 if(fITSgeom!=0) delete fITSgeom;
705 nlad[0]=20;nlad[1]=40;nlad[2]=14;nlad[3]=22;nlad[4]=34;nlad[5]=38;
18c21458 706 ndet[0]=4;ndet[1]=4;ndet[2]=6;ndet[3]=8;ndet[4]=23;ndet[5]=26;
bae7e562 707 fITSgeom = new AliITSgeom(0,6,nlad,ndet,mod);
708 mod = -1;
709 for(lay=1;lay<=nlayers;lay++){
710 for(j=0;j<ndeep;j++) lnam[j] = itsGeomTreeNames[lay-1][j];
711 for(j=0;j<ndeep;j++) lnum[j] = itsGeomTreeCopys[lay-1][j];
712 switch (lay){
713 case 1: case 2: // layers 1 and 2 are a bit special
714 lad = 0;
715 for(j=1;j<=itsGeomTreeCopys[lay-1][4];j++){
716 lnum[4] = j;
717 for(k=1;k<=itsGeomTreeCopys[lay-1][5];k++){
718 lad++;
719 lnum[5] = k;
720 for(det=1;det<=itsGeomTreeCopys[lay-1][6];det++){
721 lnum[6] = det;
722 mod++;
723 ig->GetGeometry(ndeep,lnam,lnum,t,r,idshape,npar,natt,
724 par,att,imat,imed);
725 fITSgeom->CreatMatrix(mod,lay,lad,det,kSPD,t,r);
726 if(!(fITSgeom->IsShapeDefined((Int_t)kSPD)))
727 if(fMinorVersion==1){
728 fITSgeom->ReSetShape(kSPD,
729 new AliITSgeomSPD300());
3e225ff6 730 } else if(fMinorVersion==2){
731 fITSgeom->ReSetShape(kSPD,
732 new AliITSgeomSPD300());
733 }else if(fMinorVersion==3){
734 fITSgeom->ReSetShape(kSPD,
735 new AliITSgeomSPD425Long());
736 }else{
bae7e562 737 fITSgeom->ReSetShape(kSPD,
738 new AliITSgeomSPD300());
3e225ff6 739 } // end if
bae7e562 740 } // end for det
741 } // end for k
742 } // end for j
743 break;
744 case 3: case 4: case 5: case 6: // layers 3-6
745 lnum[6] = 1;
746 for(lad=1;lad<=itsGeomTreeCopys[lay-1][4];lad++){
747 lnum[4] = lad;
748 for(det=1;det<=itsGeomTreeCopys[lay-1][5];det++){
749 lnum[5] = det;
750 mod++;
751 ig->GetGeometry(7,lnam,lnum,t,r,idshape,npar,natt,
752 par,att,imat,imed);
753 switch (lay){
754 case 3: case 4:
755 fITSgeom->CreatMatrix(mod,lay,lad,det,kSDD,t,r);
756 if(!(fITSgeom->IsShapeDefined(kSDD)))
757 fITSgeom->ReSetShape(kSDD,new AliITSgeomSDD300());
758 break;
759 case 5: case 6:
760 fITSgeom->CreatMatrix(mod,lay,lad,det,kSSD,t,r);
761 if(!(fITSgeom->IsShapeDefined(kSSD)))
762 fITSgeom->ReSetShape(kSSD,new AliITSgeomSSD175());
763 break;
764 } // end switch
765 } // end for det
766 } // end for lad
767 break;
768 } // end switch
769 } // end for lay
770 return;
e5745edc 771}
772//_____________________________________________________________________________
773void AliITSv5symm::Init(){
774////////////////////////////////////////////////////////////////////////
775// Initialise the ITS after it has been created.
776////////////////////////////////////////////////////////////////////////
bae7e562 777 Int_t i;
e5745edc 778
bae7e562 779 cout << endl;
0646a0e8 780 for(i=0;i<28;i++) cout << "*";cout << " ITSv5symm_Init ";
781 for(i=0;i<28;i++) cout << "*";cout << endl;
bae7e562 782//
783 if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
784 if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
785 if(fITSgeom!=0) delete fITSgeom;
786 fITSgeom = new AliITSgeom();
787 if(fGeomDetIn && !fGeomOldDetIn) fITSgeom->ReadNewFile(fRead);
788 if(fGeomDetIn && fGeomOldDetIn) this->ReadOldGeometry(fRead);
789
790 if(!fGeomDetIn) this->InitAliITSgeom();
791 if(fGeomDetOut) fITSgeom->WriteNewFile(fWrite);
e5745edc 792 AliITS::Init();
bae7e562 793//
794 for(i=0;i<72;i++) cout << "*";
795 cout << endl;
e5745edc 796}
797//_____________________________________________________________________________
798void AliITSv5symm::StepManager(){
799////////////////////////////////////////////////////////////////////////
800// Called for every step in the ITS, then calles the AliITShit class
801// creator with the information to be recoreded about that hit.
802// The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
803// printing of information to a file which can be used to create a .det
804// file read in by the routine CreateGeometry(). If set to 0 or any other
805// value except 1, the default behavior, then no such file is created nor
806// it the extra variables and the like used in the printing allocated.
807////////////////////////////////////////////////////////////////////////
808 Int_t copy, id;
809 Int_t copy1,copy2;
810 Float_t hits[8];
811 Int_t vol[4];
812 TLorentzVector position, momentum;
813 TClonesArray &lhits = *fHits;
e5745edc 814 //
815 // Track status
816 vol[3] = 0;
817 if(gMC->IsTrackInside()) vol[3] += 1;
818 if(gMC->IsTrackEntering()) vol[3] += 2;
819 if(gMC->IsTrackExiting()) vol[3] += 4;
820 if(gMC->IsTrackOut()) vol[3] += 8;
821 if(gMC->IsTrackDisappeared()) vol[3] += 16;
822 if(gMC->IsTrackStop()) vol[3] += 32;
823 if(gMC->IsTrackAlive()) vol[3] += 64;
824 //
825 // Fill hit structure.
826 if(!(gMC->TrackCharge())) return;
827 //
828 // Only entering charged tracks
829 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
830 vol[0] = 1;
831 id = gMC->CurrentVolOffID(0,copy);
832 //detector copy in the ladder = 1<->4 (ITS1)
833 vol[1] = copy;
834 gMC->CurrentVolOffID(1,copy1);
835 //ladder copy in the module = 1<->2 (I186)
836 gMC->CurrentVolOffID(2,copy2);
837 //module copy in the layer = 1<->10 (I132)
838 vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
839 } else if(id == fIdSens[1]){
840 vol[0] = 2;
841 id = gMC->CurrentVolOffID(0,copy);
842 //detector copy in the ladder = 1<->4 (ITS2)
843 vol[1] = copy;
844 gMC->CurrentVolOffID(1,copy1);
845 //ladder copy in the module = 1<->4 (I131)
846 gMC->CurrentVolOffID(2,copy2);
847 //module copy in the layer = 1<->10 (I132)
848 vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
849 } else if(id == fIdSens[2]){
850 vol[0] = 3;
851 id = gMC->CurrentVolOffID(1,copy);
852 //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
853 vol[1] = copy;
854 id = gMC->CurrentVolOffID(2,copy);
855 //ladder copy in the layer = 1<->12 (I316)
856 vol[2] = copy;
857 } else if(id == fIdSens[3]){
858 vol[0] = 4;
859 id = gMC->CurrentVolOffID(1,copy);
860 //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
861 vol[1] = copy;
862 id = gMC->CurrentVolOffID(2,copy);
863 //ladder copy in the layer = 1<->22 (I417)
864 vol[2] = copy;
865 }else if(id == fIdSens[4]){
866 vol[0] = 5;
867 id = gMC->CurrentVolOffID(1,copy);
868 //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
869 vol[1] = copy;
870 id = gMC->CurrentVolOffID(2,copy);
871 //ladder copy in the layer = 1<->34 (I565)
872 vol[2] = copy;
873 }else if(id == fIdSens[5]){
874 vol[0] = 6;
875 id = gMC->CurrentVolOffID(1,copy);
876 //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
877 vol[1] = copy;
878 id = gMC->CurrentVolOffID(2,copy);
879 //ladder copy in the layer = 1<->38 (I569)
880 vol[2] = copy;
881 } else {
882 return; // not an ITS volume?
883 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
884//
885 gMC->TrackPosition(position);
886 gMC->TrackMomentum(momentum);
887 hits[0]=position[0];
888 hits[1]=position[1];
889 hits[2]=position[2];
890 hits[3]=momentum[0];
891 hits[4]=momentum[1];
892 hits[5]=momentum[2];
893 hits[6]=gMC->Edep();
894 hits[7]=gMC->TrackTime();
895 // Fill hit structure with this new hit.
896 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
e5745edc 897 return;
898}