void KVSpectroDetector::AddAbsorberLayer( TGeoVolume *vol, Bool_t active){ // Add an absorber layer to the detector made from the shape of the // volume. // If active = kTRUE the layer is set active. TGeoMaterial* material = vol->GetMaterial(); KVIonRangeTableMaterial* irmat = KVMaterial::GetRangeTable()->GetMaterial(material); if(!irmat){ Warning("AddAbsorberLayer", "Unknown material %s/%s used in layer %s of detector %s", material->GetName(), material->GetTitle(), vol->GetName(), GetName()); return; } TGeoBBox* sh = dynamic_cast<TGeoBBox*>(vol->GetShape()); if(!sh) { Warning("AddAbsorberLayer", "Unknown shape class %s used in layer %s of detector %s", vol->GetShape()->ClassName(), vol->GetName(), GetName()); return; // just in case - for now, all shapes derive from TGeoBBox... } Double_t width = 2.*sh->GetDZ(); // thickness in centimetres KVMaterial* absorber; if( irmat->IsGas() ){ Double_t p = material->GetPressure(); Double_t T = material->GetTemperature(); absorber = new KVMaterial(irmat->GetType(), width, p, T); } else absorber = new KVMaterial(irmat->GetType(), width); KVDetector::AddAbsorber(absorber); ClearHits(); if( active ) SetActiveLayer( GetListOfAbsorbers()->GetEntries()-1 ); }
void KVGeoImport::AddLayer(KVDetector *det, TGeoVolume *vol) { // Add an absorber layer to the detector // Volumes representing 'active' layers in detectors must have names // which begin with "ACTIVE_" TString vnom = vol->GetName(); // exclude dead zone layers if(vnom.BeginsWith("DEADZONE")) return; TGeoMaterial* material = vol->GetMaterial(); KVIonRangeTableMaterial* irmat = fRangeTable->GetMaterial(material); if(!irmat){ Warning("AddLayer", "Unknown material %s/%s used in layer %s of detector %s", material->GetName(), material->GetTitle(), vol->GetName(), det->GetName()); return; } TGeoBBox* sh = dynamic_cast<TGeoBBox*>(vol->GetShape()); if(!sh) { Warning("AddLayer", "Unknown shape class %s used in layer %s of detector %s", vol->GetShape()->ClassName(), vol->GetName(), det->GetName()); return; // just in case - for now, all shapes derive from TGeoBBox... } Double_t width = 2.*sh->GetDZ(); // thickness in centimetres KVMaterial* absorber; if( irmat->IsGas() ){ Double_t p = material->GetPressure(); Double_t T = material->GetTemperature(); absorber = new KVMaterial(irmat->GetType(), width, p, T); } else absorber = new KVMaterial(irmat->GetType(), width); det->AddAbsorber(absorber); if(vnom.BeginsWith("ACTIVE_")) det->SetActiveLayer( det->GetListOfAbsorbers()->GetEntries()-1 ); }
TObjArray* KVRangeYanez::GetListOfMaterials() { // Create and fill a list of all materials for which range tables exist. // Each entry is a TNamed with the name and type (title) of the material. // User's responsibility to delete list after use (it owns its objects). TObjArray* list = new TObjArray(fMaterials->GetEntries()); list->SetOwner(kTRUE); TIter next(fMaterials); KVIonRangeTableMaterial* mat; while ((mat = (KVIonRangeTableMaterial*)next())) { list->Add(new TNamed(mat->GetName(), mat->GetType())); } return list; }