1 void AliITSPlotGeom(const char *filename="galice.root"){
2 /////////////////////////////////////////////////////////////////////////
3 // This macro displays part of the ITS sensitive volume as defined
6 // Root > .L AliITSPlotGeom.C //this loads the macro in memory
7 // Root > AliITSPlotGeom(); //by default process first event
8 // Root > AliITSPlotGeom("galice2.root"); //process third event from
12 <img src="picts/AliITSplotgeom.gif">
15 /////////////////////////////////////////////////////////////////////////
20 // Dynamically link some shared libs
21 if(gClassTable->GetID("AliRun") < 0) {
22 gROOT->LoadMacro("loadlibs.C");
26 // Connect the Root Galice file containing Geometry, Kine and Hits
27 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
28 if(!file) file = new TFile(filename);
30 // Get AliRun object from file or create it if not on file
32 gAlice = (AliRun*)file->Get("gAlice");
33 if(gAlice) printf("AliRun object found on file\n");
34 if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
38 // Get pointers to the ITS Alice detectors and Hits containers
39 AliITS *ITS = (AliITS*) gAlice->GetDetector("ITS");
41 cout << "ITS not found. Exiting." << endl;
44 AliITSgeom *itsgeom = ITS->GetITSgeom();
46 cout << "ITSgeom not defined. Exiting." << endl;
48 } // end if itsgeom==0
50 is = itsgeom->GetStartSPD();
51 ie = itsgeom->GetLastSPD()+1;
55 // Float_t *x = new Float_t[in];
56 // Float_t *y = new Float_t[in];
57 // Float_t *z = new Float_t[in];
59 TRotMatrix **r = new TRotMatrix*[in];
62 char name[10],title[20],name2[10],title2[20];
63 // cout << in << endl;
65 itsgeom->GetRotMatrix(i+is,m);
66 sprintf(name,"ROT%d",i+is);
67 sprintf(title,"ROT%d",i+is);
68 r[i] = new TRotMatrix(name,title,m);
69 // cout << name << title << endl;
70 // itsgeom->GetTrans(i+is,x[i],y[i],z[i]);
71 // cout << i << " " << x[i] << " " << y[i] << " " << z[i] <<endl;
75 if(itsgeom->IsShapeDefined(0)){
76 TBRIK *spds = (TShape*) (itsgeom->GetShape(0));
78 TBRIK *spds = new TBRIK("SPD","SPD","void",0.64,0.015,3.48);
80 // cout << spds << endl;
81 if(itsgeom->IsShapeDefined(1)){
82 TBRIK *sdds = (TShape*) (itsgeom->GetShape(240));
84 TBRIK *sdds = new TBRIK("SDD","SDD","void",3.50850,0.01499,3.76320);
86 // cout << sdds << endl;
87 if(itsgeom->IsShapeDefined(2)){
88 TBRIK *ssds = (TShape*) (itsgeom->GetShape(1000));
90 TBRIK *ssds = new TBRIK("SSD","SSD","void",3.65,0.015,2.00);
92 // cout << ssds << endl;
96 TCanvas *c1 = new TCanvas("c1","ITS geometry",10,10,700,700);
97 // TPad *p1 = new TPad("p1","p1",0.01,0.01,0.99,0.99,46,3,1);
100 // TView *view = new TView(1);
101 // view->SetRange(-5,-5,-5,5,5,5);
102 TShape *mother = new TBRIK("Mother","Mother Volume","void",10,10,10);
103 // TShape *mother = new TBRIK("Mother","Mother Volume","void",30,30,30);
104 // TShape *mother = new TBRIK("Mother","Mother Volume","void",50,50,50);
105 TNode *node = new TNode("node","Mother Node",mother);
109 TNode **itsn = new TNode*[in];
110 TPolyLine3D **pl = new TPolyLine3D*[in];
111 /* Double_t p[5*3],axis[5*3]={1.,0.,0.,
116 Double_t p[19*3],axis[19*3]={-0.25,0.,1.25, // 1
123 +1.125,0.,0.125, // 8
125 +1.125,0.,0.125, // 10
127 +1.125,0.,0.125, // 12
131 +0.00,1.,0.125, // 16
133 +0.00,1.,0.125, // 18
137 itsgeom->GetTrans(i+is,x,y,z);
138 /* switch (itsgeom->GetGeomMatrix(i+is)->GetDetectorIndex())
140 sprintf(name,"SPD%d",i+is);
141 sprintf(title,"SPD%d",i+is);
142 sprintf(name2,"BSPD%d",i+is);
143 sprintf(title2,"BSPD%d",i+is);
144 itsn[i] = new TNode(name,title,new TBRIK(name2,title2,"void",
145 spds->GetDx(),spds->GetDy(),spds->GetDz()),x,y,z,r[i]);
148 sprintf(name,"SDD%d",i+is);
149 sprintf(title,"SDD%d",i+is);
150 sprintf(name2,"BSDD%d",i+is);
151 sprintf(title2,"BSDD%d",i+is);
152 itsn[i] = new TNode(name,title,new TBRIK(name2,title2,"void",
153 sdds->GetDx(),sdds->GetDy(),sdds->GetDz()),x,y,z,r[i]);
156 sprintf(name,"SSD%d",i+is);
157 sprintf(title,"SSD%d",i+is);
158 sprintf(name2,"BSSD%d",i+is);
159 sprintf(title2,"BSSD%d",i+is);
160 itsn[i] = new TNode(name,title,new TBRIK(name2,title2,"void",
161 ssds->GetDx(),ssds->GetDy(),ssds->GetDz()),x,y,z,r[i]);
163 for(j=0;j<19;j++) itsgeom->LtoG(i+is,(Double_t*)&axis[3*j],
165 pl[i] = new TPolyLine3D(19,p);
171 // for(i=0;i<in;i++) itsn[i]->Draw();
173 for(i=0;i<in;i++) pl[i]->Draw();
180 // for(i=0;i<itsgeom->GetIndexMax();i++) delete[] r[i];