ROOT logo
#include "hgeantmedia.h"

#include <iostream>

//_HADES_CLASS_DESCRIPTION 
/////////////////////////////////////////////////////////////////////////////
//
//  HGeantMedia
// 
//  List of GEANT media
//  
//  It is used to store the GEANT media common block in the ROOT output file
//  and maps the medium ids to the medium names
//
/////////////////////////////////////////////////////////////////////////////

ClassImp(HGeantMedia)

void HGeantMedia::addMedium(Int_t medId, const char* medName) {
  // adds the medium to the map
  // used in hgeant2/geant/hgeahropen to copy the GEANT media common block
  TString name(medName);
  if(name.CompareTo("") != 0 && medId > 0 ) media[medId] = name;
}

TString HGeantMedia::getMediumName (Int_t medId) {
  // returns the name of the medium with id medId
  TString name;
  if(medId > 0) {
    iter = media.find(medId);
    if (iter != media.end()) name = iter->second;
  }  
  return name;
}

Int_t HGeantMedia::getMediumId (const TString& medName) {
  // returns the id of the medium with name medName
  Int_t id = -1;
  for (iter=media.begin(); iter!=media.end() && id<0; ++iter) {
    if (iter->second.CompareTo(medName)==0) id = iter->first;
  }
  return id;
}

void HGeantMedia::print() {
  // prints all media
  for (iter=media.begin(); iter!=media.end(); ++iter) {
    cout << iter->first << "  " << iter->second << '\n';
  }
}
 hgeantmedia.cc:1
 hgeantmedia.cc:2
 hgeantmedia.cc:3
 hgeantmedia.cc:4
 hgeantmedia.cc:5
 hgeantmedia.cc:6
 hgeantmedia.cc:7
 hgeantmedia.cc:8
 hgeantmedia.cc:9
 hgeantmedia.cc:10
 hgeantmedia.cc:11
 hgeantmedia.cc:12
 hgeantmedia.cc:13
 hgeantmedia.cc:14
 hgeantmedia.cc:15
 hgeantmedia.cc:16
 hgeantmedia.cc:17
 hgeantmedia.cc:18
 hgeantmedia.cc:19
 hgeantmedia.cc:20
 hgeantmedia.cc:21
 hgeantmedia.cc:22
 hgeantmedia.cc:23
 hgeantmedia.cc:24
 hgeantmedia.cc:25
 hgeantmedia.cc:26
 hgeantmedia.cc:27
 hgeantmedia.cc:28
 hgeantmedia.cc:29
 hgeantmedia.cc:30
 hgeantmedia.cc:31
 hgeantmedia.cc:32
 hgeantmedia.cc:33
 hgeantmedia.cc:34
 hgeantmedia.cc:35
 hgeantmedia.cc:36
 hgeantmedia.cc:37
 hgeantmedia.cc:38
 hgeantmedia.cc:39
 hgeantmedia.cc:40
 hgeantmedia.cc:41
 hgeantmedia.cc:42
 hgeantmedia.cc:43
 hgeantmedia.cc:44
 hgeantmedia.cc:45
 hgeantmedia.cc:46
 hgeantmedia.cc:47
 hgeantmedia.cc:48
 hgeantmedia.cc:49
 hgeantmedia.cc:50