Exemple #1
0
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 );
}
Exemple #2
0
void fw_simGeo_fix_materials()
{
   Int_t base_element_offset = TGeoMaterial::Class()->GetDataMemberOffset("fElement");

   TString vacuum("materials:Vacuum");

   TGeoMaterial *m;
   TIter it(FWGeometryTableViewManager_GetGeoManager()->GetListOfMaterials());
   while ((m = (TGeoMaterial*) it()) != 0)
   {
      // Fixes
      if (vacuum == m->GetName())
      {
         m->SetZ(0);
      }

      TGeoMixture *mix = dynamic_cast<TGeoMixture*>(m);
      if (mix == 0)
      {
         if ( ! m->GetBaseElement())
         {
            *(TGeoElement**)(((char*)m) + base_element_offset) = g_element_table->GetElement(m->GetZ());
         }
      }
   }
}
Exemple #3
0
void fw_simGeo_dump_materials(Bool_t dump_components=false)
{
   TGeoMaterial *m;
   TIter it(FWGeometryTableViewManager_GetGeoManager()->GetListOfMaterials());
   while ((m = (TGeoMaterial*) it()) != 0)
   {
      TGeoMixture *mix = dynamic_cast<TGeoMixture*>(m);
      printf("%-50s | %-40s | %2d | %.3f\n", m->GetName(), m->GetTitle(),
             mix ? mix->GetNelements() : 0, m->GetZ());
      if (dump_components)
      {
         if (mix == 0)
         {
            printf("  %4d %6s %s\n", m->GetBaseElement()->Z(), m->GetBaseElement()->GetName(), m->GetBaseElement()->GetTitle());
         }
         else
         {
            Double_t *ww = mix->GetWmixt();
            for (Int_t i = 0; i < mix->GetNelements(); ++i)
            {
               TGeoElement *e = mix->GetElement(i);
               printf("  %4d %-4s %f\n",  e->Z(), e->GetName(), ww[i]);
            }
         }
      }
   }
}
Exemple #4
0
void fw_simGeo_set_volume_color_by_material(const char* material_re, Bool_t use_names, Color_t color, Char_t transparency=-1)
{
   // Note: material_re is a perl regexp!
   // If you want exact match, enclose in begin / end meta characters (^ / $):
   //   set_volume_color_by_material("^materials:Silicon$", kRed);

   TPMERegexp re(material_re, "o");
   TGeoMaterial *m;
   TIter it(FWGeometryTableViewManager_GetGeoManager()->GetListOfMaterials());
   while ((m = (TGeoMaterial*) it()) != 0)
   {
      if (re.Match(use_names ? m->GetName() : m->GetTitle()))
      {
         if (transparency != -1)
         {
            m->SetTransparency(transparency);
         }
         TGeoVolume *v;
         TIter it2(FWGeometryTableViewManager_GetGeoManager()->GetListOfVolumes());
         while ((v = (TGeoVolume*) it2()) != 0)
         {
            if (v->GetMaterial() == m)
            {
               v->SetLineColor(color);
            }
         }
      }
   }
}
Exemple #5
0
void set_volume_color_by_material(const char* material_re, Color_t color, Char_t transparency=-1)
{
   // Note: material_re is a perl regexp!
   // If you want exact match, enclose in begin / end meta characters (^ / $):
   //   set_volume_color_by_material("^materials:Silicon$", kRed);

   TPMERegexp re(material_re, "o");
   TGeoMaterial *m;
   TIter it(gGeoManager->GetListOfMaterials());
   while ((m = (TGeoMaterial*) it()) != 0)
   {
      if (re.Match(m->GetName()))
      {
         if (transparency != -1)
         {
            m->SetTransparency(transparency);
         }
         TGeoVolume *v;
         TIter it2(gGeoManager->GetListOfVolumes());
         while ((v = (TGeoVolume*) it2()) != 0)
         {
            if (v->GetMaterial() == m)
            {
               v->SetLineColor(color);
            }
         }
      }
   }
   full_update();
}
Exemple #6
0
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 );
}
Exemple #7
0
void visibility_volume_by_material(const char* material_re, Bool_t vis_state)
{
   TPMERegexp re(material_re, "o");
   TGeoMaterial *m;
   TIter it(gGeoManager->GetListOfMaterials());
   while ((m = (TGeoMaterial*) it()) != 0)
   {
      if (re.Match(m->GetName()))
      {
         TGeoVolume *v;
         TIter it2(gGeoManager->GetListOfVolumes());
         while ((v = (TGeoVolume*) it2()) != 0)
         {
            if (v->GetMaterial() == m)
            {
               v->SetVisibility(vis_state);
            }
         }
      }
   }
   full_update();
}
Exemple #8
0
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());
}