1 #if !defined(__CINT__) || defined(__MAKECINT__)
6 #include <TClassTable.h>
7 #include <TInterpreter.h>
8 #include <TGeoManager.h>
11 #include "AliGeomManager.h"
12 #include "AliITSgeomTGeo.h"
13 #include "AliRunLoader.h"
14 #include "AliITSLoader.h"
18 ///////////////////////////////////////////////////////////////////////////
20 // Macro to Create SDD geometrical map starting from geometry.root file //
22 ///////////////////////////////////////////////////////////////////////////
24 if (gClassTable->GetID("AliRun") < 0) {
25 gInterpreter->ExecuteMacro("loadlibs.C");
29 delete AliRunLoader::Instance();
36 AliGeomManager::LoadGeometry("geometry.root");
39 TNtuple *ntsddgeo=new TNtuple("ntsddgeo","SDD module positions","iMod:lay:lad:det:x:y:z:r:theta:phi");
42 outfil=fopen("SDDgeomap.data","w");
44 Int_t first = AliITSgeomTGeo::GetModuleIndex(3,1,1);
45 Int_t last = AliITSgeomTGeo::GetModuleIndex(5,1,1)-1;
48 // TPaveText **text=new TPaveText*[36];
49 TLatex **text=new TLatex*[36];
50 TLatex **ltext=new TLatex*[36];
51 TLine **linxy=new TLine*[36];
55 Float_t D=3.5; //SDD half length along drift
56 for (Int_t iMod=first; iMod<=last; iMod++){
57 fprintf(outfil,"=========================================================\n");
58 AliITSgeomTGeo::GetModuleId(iMod,lay,lad,det);
59 AliITSgeomTGeo::GetTranslation(iMod,pos);
60 Float_t rad=TMath::Sqrt(pos[0]*pos[0]+pos[1]*pos[1]);
61 Float_t theta=90.-TMath::ATan2(pos[2],rad)*TMath::RadToDeg();
62 Float_t phi=TMath::ATan2(pos[1],pos[0])*TMath::RadToDeg();
63 fprintf(outfil,"ModuleId=%d --- Layer %d Ladder %d Det %d\n",iMod,lay,lad,det);
64 fprintf(outfil,"Global coordinates: x=%f \t y=%f \t z=%f\n",pos[0],pos[1],pos[2]);
65 fprintf(outfil," r=%f \t theta=%f \t phi=%f\n",rad,theta,phi);
77 sprintf(modtxt,"%d",iMod);
78 sprintf(ladtxt,"L%d",lad);
80 text[it]=new TLatex(1.1*pos[0],1.1*pos[1],modtxt);
81 text[it]->SetTextAlign(22);
82 text[it]->SetTextColor(2);
83 text[it]->SetTextSize(0.03);
84 ltext[it]=new TLatex(.9*pos[0],.9*pos[1],ladtxt);
85 ltext[it]->SetTextAlign(22);
86 ltext[it]->SetTextColor(4);
87 ltext[it]->SetTextSize(0.03);
88 Float_t deltax=D*TMath::Sin(phi*TMath::DegToRad());
89 Float_t deltay=D*TMath::Cos(phi*TMath::DegToRad());
90 linxy[it]=new TLine(pos[0]-deltax,pos[1]+deltay,pos[0]+deltax,pos[1]-deltay);
91 linxy[it]->SetLineWidth(2);
96 TFile *f=new TFile("SDDgeomap.root","recreate");
101 ntsddgeo->SetMarkerStyle(7);
103 c1=new TCanvas("c1","",800,800);
104 ntsddgeo->Draw("y:x");
105 for(Int_t i=0;i<36;i++){
111 TCanvas *c2=new TCanvas("c2","",1200,800);
114 ntsddgeo->SetMarkerColor(1);
115 ntsddgeo->Draw("x:iMod");
116 ntsddgeo->SetMarkerColor(2);
117 ntsddgeo->Draw("x:iMod","lay==4","same");
119 ntsddgeo->SetMarkerColor(1);
120 ntsddgeo->Draw("y:iMod");
121 ntsddgeo->SetMarkerColor(2);
122 ntsddgeo->Draw("y:iMod","lay==4","same");
124 ntsddgeo->SetMarkerColor(1);
125 ntsddgeo->Draw("z:iMod");
126 ntsddgeo->SetMarkerColor(2);
127 ntsddgeo->Draw("z:iMod","lay==4","same");
129 ntsddgeo->SetMarkerColor(1);
130 ntsddgeo->Draw("r:iMod");
131 ntsddgeo->SetMarkerColor(2);
132 ntsddgeo->Draw("r:iMod","lay==4","same");
133 TLatex *t3=new TLatex(0.68,0.45,"Layer 3");
134 t3->SetTextSize(0.05);
137 TLatex *t4=new TLatex(0.68,0.37,"Layer 4");
138 t4->SetTextSize(0.05);
143 ntsddgeo->SetMarkerColor(1);
144 ntsddgeo->Draw("phi:iMod");
145 ntsddgeo->SetMarkerColor(2);
146 ntsddgeo->Draw("phi:iMod","lay==4","same");
150 ntsddgeo->SetMarkerColor(1);
151 ntsddgeo->Draw("theta:iMod");
152 ntsddgeo->SetMarkerColor(2);
153 ntsddgeo->Draw("theta:iMod","lay==4","same");