void AliITSMaterialsTGeo(TString gfile="geometry.root"){ // Macro to print out the ITS material definitions as found // in the TGeo geometry file. // retrives geometry if(!gGeoManager) gGeoManager = new TGeoManager(); TGeoManager::Import(gfile.Data()); if (!gGeoManager) { cout<<"geometry not found\n"; return; } // end if TList *medlist=gGeoManager->GetListOfMedia(); TGeoMedium *med; TGeoMaterial *mat; Int_t imed,nmed,i; printf("imed Id Med_Name Mat_Name "); for(i=0;i<20;i++) printf(" par[%2d] ",i); printf("\n"); imed=0; do{ med = (TGeoMedium*)(medlist->At(imed)); if(!med) continue; /*if((((med->GetName())[0]=='I')&& // Only ITS. ((med->GetName())[1]=='T')&& ((med->GetName())[2]=='S')&& ((med->GetName())[3]=='_')))*/{ mat = med->GetMaterial(); if(mat) printf("%4d %4d %30s %30s",imed,med->GetId(),med->GetName(),mat->GetName()); else printf("%4d %4d %30s %30s",imed,med->GetId(),med->GetName(),"No Material"); for(i=0;i<20;i++) printf(" %12g",med->GetParam(i)); printf("\n"); imed++; } }while(med!=medlist->Last()); }
TGeoMedium* KVSpectroDetector::GetGeoMedium(const Char_t* mat_name){ // By default, return pointer to TGeoMedium corresponding to this KVMaterial. // If argument "mat_name" is given, a pointer to a medium is return for this material. // mat_name = "Vacuum" is a special case: if the "Vacuum" does not exist, we create it. // // Instance of geometry manager class TGeoManager must be created before calling this // method, otherwise 0x0 will be returned. // If the required TGeoMedium is not already available in the TGeoManager, we create // a new TGeoMedium corresponding to the material given in argument. if( !gGeoManager ) return NULL; TString medName, matName; if( !strcmp(mat_name,"") ){ // for gaseous materials, the TGeoMedium/Material name is of the form // gasname_pressure // e.g. C3F8_37.5 for C3F8 gas at 37.5 torr // each gas with different pressure has to have a separate TGeoMaterial/Medium matName = GetName(); KVIonRangeTableMaterial* irmat = KVMaterial::GetRangeTable()->GetMaterial(matName.Data()); if(irmat->IsGas()) medName.Form("%s_%f", matName.Data(), GetPressure()); else medName = GetName(); } else{ matName = mat_name; medName = mat_name; } TGeoMedium* gmed = gGeoManager->GetMedium( medName); if( gmed ) return gmed; TGeoMaterial *gmat = gGeoManager->GetMaterial( medName); if( !gmat ){ if( !strcmp(matName.Data(), "Vacuum") ){ // create material gmat = new TGeoMaterial("Vacuum",0,0,0 ); } else{ // create material gmat = GetRangeTable()->GetTGeoMaterial(matName.Data()); if(!gmat){ Error("GetGeoMedium","Material %s is nowhere to be found in %s" ,matName.Data(),GetRangeTable()->GetName()); return NULL; } gmat->SetPressure( GetPressure() ); gmat->SetTemperature( GetTemperature() ); gmat->SetTransparency(0); } } // For the moment the names of material and medium do not // depend on the temperature of the material. gmat->SetName(medName); gmat->SetTitle(matName); // create medium TGeoMedium* lastmed = (TGeoMedium*)gGeoManager->GetListOfMedia()->Last(); Int_t numed = (lastmed ? lastmed->GetId()+1 : 0); // static counter variable used to number media gmed = new TGeoMedium( medName, numed, gmat ); numed+=1; return gmed; }