]>
Commit | Line | Data |
---|---|---|
1 | void AliITSPrintGeom(TString hfn="galice.root",Int_t mod=-1){ | |
2 | // Macro to print out the information kept in the AliITSgeom class, for | |
3 | // all or a specific module. | |
4 | // Inputs: | |
5 | // TString hfn input file name | |
6 | // Int_t mod The specific module to print out transformations for. | |
7 | // if mod<0, does all modules. | |
8 | // Output: | |
9 | // none. | |
10 | // Return: | |
11 | // none. | |
12 | ||
13 | // Dynamically link some shared libs | |
14 | if (gClassTable->GetID("AliRun") < 0) { | |
15 | gROOT->LoadMacro("loadlibs.C"); | |
16 | loadlibs(); | |
17 | }else { | |
18 | if(gAlice){ | |
19 | delete AliRunLoader::Instance(); | |
20 | delete gAlice; | |
21 | gAlice=0; | |
22 | } // end if gAlice | |
23 | } // end if aliroot or not. | |
24 | ||
25 | AliRunLoader* rl = AliRunLoader::Open(hfn.Data()); | |
26 | if (rl == 0x0){ | |
27 | cerr<<"AliITSPrintGeom.C : Can not open session RL=NULL"<< endl; | |
28 | return; | |
29 | } // end if no loader | |
30 | ||
31 | Int_t retval = rl->LoadgAlice(); | |
32 | if (retval){ | |
33 | cerr<<"AliITSHits2SDigits.C : LoadgAlice returned error"<< endl; | |
34 | return 3; | |
35 | } // end if loader error | |
36 | if(!gAlice){ | |
37 | cerr<<"AliITSPrintGeom.C. AliRun object not found\n"; | |
38 | return; | |
39 | } // end if no gAlice error | |
40 | ||
41 | AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS"); | |
42 | if(!ITS){ | |
43 | cout << "Error: no ITS found. Aborting"<<endl; | |
44 | return; | |
45 | } // end if !ITS | |
46 | ||
47 | AliITSgeom *gm = ITS->GetITSgeom(); | |
48 | Int_t mod1 = 0; | |
49 | Int_t mod2 = gm->GetIndexMax(); | |
50 | if(mod>=0){ | |
51 | mod1 = mod; | |
52 | mod2 = mod+1; | |
53 | } // end if mod>=0 | |
54 | AliITSgeomMatrix *gmm = gm->GetGeomMatrix(0); | |
55 | Int_t m,lay,lad,det; | |
56 | Double_t xyz[3],rcyl; | |
57 | cout<<endl<<endl<<"====================================\n"; | |
58 | if(mod<-1){ gmm->PrintComment(&cout); cout << endl;} | |
59 | cout<<endl<<endl<<"====================================\n"; | |
60 | for(m=mod1;m<mod2;m++){ | |
61 | gm->GetModuleId(m,lay,lad,det); | |
62 | gmm = gm->GetGeomMatrix(m); | |
63 | gmm->GetTranslation(xyz); | |
64 | rcyl = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); | |
65 | if(mod<-1){ | |
66 | gmm->Print(&cout); | |
67 | cout << endl; | |
68 | }else{ | |
69 | cout << "module="<<m<<" "<<lay<<" "<<lad<<" "<<det; | |
70 | cout << " Rcyl="<<rcyl<<" cm"<<endl; | |
71 | } // end if | |
72 | } // end for m | |
73 | } |