]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSPrintGeom.C
ae22077e191328bdb147dd86267cb792c5647e42
[u/mrichter/AliRoot.git] / ITS / AliITSPrintGeom.C
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
5     // Dynamically link some shared libs
6     if (gClassTable->GetID("AliRun") < 0) {
7         gROOT->LoadMacro("loadlibs.C");
8         loadlibs();
9     } 
10     else {
11       if(gAlice){
12         delete gAlice->GetRunLoader();
13         delete gAlice;
14         gAlice=0;
15       }
16     }
17
18     AliRunLoader* rl = AliRunLoader::Open(hfn.Data());
19     if (rl == 0x0){
20       cerr<<"AliITSPrintGeom.C : Can not open session RL=NULL"<< endl;
21       return;
22     }
23
24     Int_t retval = rl->LoadgAlice();
25     if (retval)
26      {
27       cerr<<"AliITSHits2SDigits.C : LoadgAlice returned error"
28            << endl;
29        return 3;
30      }
31     //    gAlice=rl->GetAliRun();
32     if(!gAlice){
33       cerr<<"AliITSPrintGeom.C. AliRun object not found\n";
34       return;
35     }
36
37     AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
38     if(!ITS){
39         cout << "Error: no ITS found. Aborting"<<endl;
40         return;
41     } // end if !ITS
42
43     AliITSgeom *gm = ITS->GetITSgeom();
44     Int_t mod1 = 0;
45     Int_t mod2 = gm->GetIndexMax();
46     if(mod>=0){
47         mod1 = mod;
48         mod2 = mod+1;
49     } // end if mod>=0
50     AliITSgeomMatrix *gmm = gm->GetGeomMatrix(0);
51     Int_t m;
52     cout<<endl<<endl<<"====================================\n";
53     gmm->PrintComment(&cout); cout << endl;
54     cout<<endl<<endl<<"====================================\n";
55     for(m=mod1;m<mod2;m++){
56         gmm = gm->GetGeomMatrix(m);
57         gmm->Print(&cout); cout << endl;
58     } // end for m
59 }