78    fZSliceHeaderMerged(0),
 
  149                                    z = 6.0, a = 12.011 * 
g/
mole );
 
  152                                    z = 1.0, a = 1.008  * 
g/
mole );
 
  155                                    z = 7.0, a = 14.007 * 
g/
mole );
 
  158                                    z = 8.0, a = 16.00  * 
g/
mole );
 
  161                                     z= 11.0, a = 22.98977* 
g/
mole );
 
  164                                    z = 16.0,a = 32.065* 
g/
mole );
 
  167                                     z = 17.0, a = 35.453* 
g/
mole );
 
  170                                    z = 19.0, a = 39.0983* 
g/
mole );
 
  173                                    z = 15.0, a = 30.973976* 
g/
mole );
 
  176                                     z = 26, a = 56.845* 
g/
mole );
 
  179                                     z = 12.0, a = 24.3050* 
g/
mole );
 
  182                                     z = 20.0, a = 40.078* 
g/
mole );
 
  185     G4int numberofElements;
 
  190                           numberofElements = 2 );
 
  196                                             density = 0.217*
g/
cm3,
 
  197                                             numberofElements = 9);
 
  210                                             density = 0.508*
g/
cm3,
 
  211                                             numberofElements = 9 );
 
  224                                                density = 0.967*
g/
cm3,
 
  225                                                numberofElements = 7);
 
  236                                         density = 0.990*
g/
cm3,
 
  237                                         numberofElements = 8 );
 
  250                                        numberofElements = 2 );
 
  256                                         density = 1.061*
g/
cm3,
 
  257                                         numberofElements = 9 );
 
  270                                        density = 1.071*
g/
cm3,
 
  271                                        numberofElements = 9);
 
  284                                                 density = 1.159*
g/
cm3,
 
  285                                                 numberofElements = 12 );
 
  301                                            density = 1.575*
g/
cm3,
 
  302                                            numberofElements = 11 );
 
  335   std::ifstream fin(fileName);
 
  336   std::vector<G4String> wl;
 
  341   for( 
G4int ii = 0; ii < nMaterials; ii++ ){
 
  344     if( mateName[0] == 
'"' && mateName[mateName.length()-1] == 
'"' ) {
 
  345       mateName = mateName.substr(1,mateName.length()-2);
 
  347     G4cout << 
"GmReadPhantomG4Geometry::ReadPhantomData reading nmate " << ii << 
" = " << nmate 
 
  348            << 
" mate " << mateName << 
G4endl;
 
  349     if( ii != nmate ) 
G4Exception(
"GmReadPhantomG4Geometry::ReadPhantomData",
 
  352                       "Material number should be in increasing order: wrong material number ");
 
  356     std::vector<G4Material*>::const_iterator matite;
 
  357     for( matite = matTab->begin(); matite != matTab->end(); ++matite ) {
 
  358       if( (*matite)->GetName() == mateName ) {
 
  365     if( !mate ) 
G4Exception(
"GmReadPhantomG4Geometry::ReadPhantomData",
 
  368                             (
"Material not found" + mateName).c_str());
 
  373   G4cout << 
"GmReadPhantomG4Geometry::ReadPhantomData fNVoxel X/Y/Z " << 
fNVoxelX << 
" "  
  382   G4cout << 
" Extension in X " << 
fMinX << 
" " << fMaxX << G4endl
 
  383          << 
" Extension in Y " << 
fMinY << 
" " << fMaxY << G4endl
 
  384          << 
" Extension in Z " << 
fMinZ << 
" " << fMaxZ << 
G4endl;
 
  394         if( mateID < 0 || mateID >= nMaterials ) {
 
  395           G4Exception(
"GmReadPhantomG4Geometry::ReadPhantomData",
 
  396                       "Wrong index in phantom file",
 
  398                       G4String(
"It should be between 0 and " 
  419   std::map<G4int, std::pair<G4double,G4double> > densiMinMax;
 
  420   std::map<G4int, std::pair<G4double,G4double> >::iterator mpite;
 
  425   char* part = getenv( 
"DICOM_CHANGE_MATERIAL_DENSITY" );
 
  429   std::map<G4int,G4double> densityDiffs;
 
  431     densityDiffs[ii] = densityDiff; 
 
  436   std::map< std::pair<G4Material*,G4int>, 
matInfo* > newMateDens;
 
  447         if( densityDiff != -1. ) 
continue; 
 
  450         mpite = densiMinMax.find( 
fMateIDs[copyNo] );
 
  451         if( dens < (*mpite).second.first ) (*mpite).second.first = dens;
 
  452         if( dens > (*mpite).second.second ) (*mpite).second.second = dens;
 
  455         std::map<G4int,G4Material*>::const_iterator imite = 
 
  459         if( std::fabs(dens - (*imite).second->GetDensity()/
CLHEP::g*
CLHEP::cm3 ) < 1.e-9 ) 
continue;
 
  463         G4int densityBin = (
G4int(dens/densityDiffs[mateID]));
 
  467         std::pair<G4Material*,G4int> matdens((*imite).second, densityBin );
 
  469         std::map< std::pair<G4Material*,G4int>, 
matInfo* >::iterator mppite = 
 
  470          newMateDens.find( matdens );
 
  471         if( mppite != newMateDens.end() ){
 
  472           matInfo* mi = (*mppite).second;
 
  480           mi->
fId = newMateDens.size()+1;
 
  481           newMateDens[matdens] = mi;
 
  488   if( densityDiff != -1. ) { 
 
  489     for( mpite = densiMinMax.begin(); mpite != densiMinMax.end(); mpite++ ){
 
  491       G4cout << 
"DicomDetectorConstruction::ReadVoxelDensities ORIG MATERIALS DENSITY "  
  492              << (*mpite).first << 
" MIN " << (*mpite).second.first << 
" MAX "  
  493              << (*mpite).second.second << 
G4endl;
 
  500   std::map<G4int,G4Material*>::const_iterator mimite;
 
  507 std::map< std::pair<G4Material*,G4int>, 
matInfo* >::iterator mppite;
 
  508   for( mppite= newMateDens.begin(); mppite != newMateDens.end(); mppite++ ){
 
  512     G4cout << 
"DicomDetectorConstruction::ReadVoxelDensities AVER DENS " << averdens << 
" -> "  
  513            << saverdens << 
" -> " << 
G4int(1000*averdens) << 
" " << 
G4int(1000*averdens)/1000 
 
  520      (*mppite).first.first, averdens, mateName ) );
 
  530     std::ifstream finDF(dataFile.c_str());
 
  532     if(finDF.good() != 1 ) {
 
  533         G4String descript = 
"Problem reading data file: "+dataFile;
 
  534         G4Exception(
" DicomDetectorConstruction::ReadPhantomData",
 
  541     finDF >> compression; 
 
  561   G4cout << 
" DicomDetectorConstruction::ReadPhantomDataFile opening file "  
  564   G4cout << 
" DicomDetectorConstruction::ReadPhantomDataFile opening file "  
  567   std::ifstream fin(fname.c_str(), std::ios_base::in);
 
  568   if( !fin.is_open() ) {
 
  569     G4Exception(
"DicomDetectorConstruction::ReadPhantomDataFile",
 
  572                 G4String(
"File not found " + fname ).c_str());
 
  576   char* part = getenv( 
"DICOM_CHANGE_MATERIAL_DENSITY" );
 
  579   if( densityDiff != -1. ) {
 
  609   for( 
G4int ii = 0; ii < nVoxels; ii++, voxelCopyNo++ ){
 
  620   for( 
G4int ii = 0; ii < nVoxels; ii++, voxelCopyNo++ ){
 
  630     float densityBin = 0.;
 
  631     if( densityDiff != -1.) {
 
  642       if( 
fMaterials[im]->GetName() == newMateName ) {
 
  651       if( densityDiff != -1.) {
 
  653                                                   densityBin, newMateName ) );
 
  658         G4Exception(
"DicomDetectorConstruction::ReadPhantomDataFile",
 
  661                     "Wrong index in material"); 
 
  688   for( 
G4int ii = 0; ii < nelem; ii++ ){
 
  737   G4cout << 
" placing voxel container volume at " << posCentreVoxels << 
G4endl;
 
  779   G4cout << 
" placing voxel container volume at " << posCentreVoxels << 
G4endl;
 
  826   G4String concreteSDname = 
"phantomSD";
 
  827   std::vector<G4String> scorer_names;
 
  828   scorer_names.push_back(concreteSDname);
 
  843   for(std::set<G4LogicalVolume*>::iterator ite = 
fScorers.begin(); 
 
static constexpr double m
 
G4bool RegisterPrimitive(G4VPrimitiveScorer *)
 
void SetScorer(G4LogicalVolume *voxel_logic)
 
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
 
Definition of the DicomDetectorConstruction class. 
 
void MergeZSliceHeaders()
 
std::set< G4LogicalVolume * > fScorers
 
static constexpr double mg
 
CLHEP::Hep3Vector G4ThreeVector
 
std::vector< ExP01TrackerHit * > a
 
Definition of the DicomRunAction class. 
 
G4LogicalVolume * fWorld_logic
 
const G4String & GetName() const 
 
std::vector< DicomPhantomZSliceHeader * > fZSliceHeaders
 
static G4MaterialTable * GetMaterialTable()
 
std::vector< G4Material * > G4MaterialTable
 
static G4String ConvertToString(G4bool boolVal)
 
void ReadPhantomDataNew()
 
virtual G4VPhysicalVolume * Construct()
 
static constexpr double mg
 
const G4Element * GetElement(G4int iel) const 
 
static G4NistManager * Instance()
 
Definition of the DicomRun class. 
 
static constexpr double g
 
DicomPhantomZSliceHeader * fZSliceHeaderMerged
 
G4VPhysicalVolume * fWorld_phys
 
G4LogicalVolume * fContainer_logic
 
void ReadVoxelDensities(std::ifstream &fin)
 
void ConstructPhantomContainer()
 
void InitialisationOfMaterials()
 
G4Material * BuildMaterialWithChangingDensity(const G4Material *origMate, float density, G4String newMateName)
 
G4GLOB_DLL std::ostream G4cout
 
static constexpr double m
 
virtual void ConstructSDandField()
 
static G4double ConvertToDouble(const char *st)
 
G4String GetFileOutName() const 
 
static constexpr double cm3
 
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
void AddNewDetector(G4VSensitiveDetector *aSD)
 
G4VPhysicalVolume * fContainer_phys
 
static G4SDManager * GetSDMpointer()
 
void ConstructPhantomContainerNew()
 
void AddElement(G4Element *element, G4int nAtoms)
 
size_t GetNumberOfElements() const 
 
static constexpr double mole
 
const G4String & GetName() const 
 
std::vector< G4Material * > fMaterials
 
std::vector< G4Material * > fOriginalMaterials
 
void ReadPhantomDataFile(const G4String &fname)
 
const G4double * GetFractionVector() const 
 
static constexpr double mole
 
virtual void ConstructPhantom()=0
 
DicomDetectorConstruction()
 
~DicomDetectorConstruction()
 
static DicomFileMgr * GetInstance()
 
G4GLOB_DLL std::ostream G4cerr
 
std::map< G4int, G4double > fDensityDiffs
 
std::map< G4int, G4Material * > thePhantomMaterialsOriginal
 
static constexpr double cm3