Double check if SM is running added. Some redundant output removed from SM
[u/mrichter/AliRoot.git] / ITS / AliITSPrintGeom.C
CommitLineData
7f7b1c24 1void AliITSPrintGeom(TString hfn="galice.root",Int_t mod=-1){
2 // Macro to print out the information kept in the AliITSgeom class, for
7916245f 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.
7f7b1c24 12
13 // Dynamically link some shared libs
14 if (gClassTable->GetID("AliRun") < 0) {
15 gROOT->LoadMacro("loadlibs.C");
16 loadlibs();
7916245f 17 }else {
18 if(gAlice){
33c3c91a 19 delete AliRunLoader::Instance();
7916245f 20 delete gAlice;
21 gAlice=0;
22 } // end if gAlice
23 } // end if aliroot or not.
7f7b1c24 24
d2e7afa1 25 AliRunLoader* rl = AliRunLoader::Open(hfn.Data());
26 if (rl == 0x0){
7916245f 27 cerr<<"AliITSPrintGeom.C : Can not open session RL=NULL"<< endl;
28 return;
29 } // end if no loader
d2e7afa1 30
31 Int_t retval = rl->LoadgAlice();
7916245f 32 if (retval){
33 cerr<<"AliITSHits2SDigits.C : LoadgAlice returned error"<< endl;
34 return 3;
35 } // end if loader error
d2e7afa1 36 if(!gAlice){
7916245f 37 cerr<<"AliITSPrintGeom.C. AliRun object not found\n";
38 return;
39 } // end if no gAlice error
7f7b1c24 40
7f7b1c24 41 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
42 if(!ITS){
43 cout << "Error: no ITS found. Aborting"<<endl;
44 return;
45 } // end if !ITS
d2e7afa1 46
7f7b1c24 47 AliITSgeom *gm = ITS->GetITSgeom();
48 Int_t mod1 = 0;
49 Int_t mod2 = gm->GetIndexMax();
50 if(mod>=0){
51 mod1 = mod;
d2e7afa1 52 mod2 = mod+1;
7f7b1c24 53 } // end if mod>=0
54 AliITSgeomMatrix *gmm = gm->GetGeomMatrix(0);
7916245f 55 Int_t m,lay,lad,det;
56 Double_t xyz[3],rcyl;
d2e7afa1 57 cout<<endl<<endl<<"====================================\n";
7916245f 58 if(mod<-1){ gmm->PrintComment(&cout); cout << endl;}
d2e7afa1 59 cout<<endl<<endl<<"====================================\n";
7f7b1c24 60 for(m=mod1;m<mod2;m++){
7916245f 61 gm->GetModuleId(m,lay,lad,det);
7f7b1c24 62 gmm = gm->GetGeomMatrix(m);
7916245f 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
7f7b1c24 72 } // end for m
73}