79 fZSliceHeaderMerged(0),
150 z = 6.0, a = 12.011 *
g/
mole );
153 z = 1.0, a = 1.008 *
g/
mole );
156 z = 7.0, a = 14.007 *
g/
mole );
159 z = 8.0, a = 16.00 *
g/
mole );
162 z= 11.0, a = 22.98977*
g/
mole );
165 z = 12.0, a = 24.3050*
g/
mole );
168 z = 15.0, a = 30.973976*
g/
mole );
171 z = 16.0,a = 32.065*
g/
mole );
174 z = 17.0, a = 35.453*
g/
mole );
177 z = 19.0, a = 30.0983*
g/
mole );
181 z = 26, a = 56.845*
g/
mole );
185 z = 20.0, a = 40.078*
g/
mole );
189 z = 30.0,a = 65.382*
g/
mole );
192 G4int numberofElements;
197 numberofElements = 2 );
204 numberofElements = 13);
221 density = 0.217*
g/
cm3,
222 numberofElements = 9);
235 density = 0.508*
g/
cm3,
236 numberofElements = 9 );
249 density = 0.967*
g/
cm3,
250 numberofElements = 7);
261 numberofElements = 13);
279 density = 0.990*
g/
cm3,
280 numberofElements = 8 );
292 numberofElements = 8);
306 numberofElements = 2 );
312 density = 1.061*
g/
cm3,
313 numberofElements = 9 );
326 density = 1.071*
g/
cm3,
327 numberofElements = 9);
340 numberofElements = 10);
355 numberofElements = 12 );
373 numberofElements = 12);
389 density = 1.575*
g/
cm3,
390 numberofElements = 11 );
405 numberofElements = 9);
419 numberofElements = 10);
431 #ifdef DICOM_USE_HEAD
441 G4cout <<
"The materials of the DICOM Head have been used" <<
G4endl;
453 G4cout <<
"The default materials of the DICOM Extended examples have been used"
464 std::ifstream
fin(fileName);
465 std::vector<G4String> wl;
470 for(
G4int ii = 0; ii < nMaterials; ii++ ){
473 if( mateName[0] ==
'"' && mateName[mateName.length()-1] ==
'"' ) {
474 mateName = mateName.substr(1,mateName.length()-2);
476 G4cout <<
"GmReadPhantomG4Geometry::ReadPhantomData reading nmate "
477 << ii <<
" = " << nmate
478 <<
" mate " << mateName <<
G4endl;
480 G4Exception(
"GmReadPhantomG4Geometry::ReadPhantomData",
483 "Material number should be in increasing order:wrong material number");
487 std::vector<G4Material*>::const_iterator matite;
488 for( matite = matTab->begin(); matite != matTab->end(); ++matite ) {
489 if( (*matite)->GetName() == mateName ) {
496 if( !mate )
G4Exception(
"GmReadPhantomG4Geometry::ReadPhantomData",
499 (
"Material not found" + mateName).c_str());
504 G4cout <<
"GmReadPhantomG4Geometry::ReadPhantomData fNVoxel X/Y/Z "
514 G4cout <<
" Extension in X " <<
fMinX <<
" " << fMaxX << G4endl
515 <<
" Extension in Y " <<
fMinY <<
" " << fMaxY << G4endl
516 <<
" Extension in Z " <<
fMinZ <<
" " << fMaxZ <<
G4endl;
526 if( mateID < 0 || mateID >= nMaterials ) {
527 G4Exception(
"GmReadPhantomG4Geometry::ReadPhantomData",
528 "Wrong index in phantom file",
530 G4String(
"It should be between 0 and "
549 std::map<G4int, std::pair<G4double,G4double> > densiMinMax;
550 std::map<G4int, std::pair<G4double,G4double> >::iterator mpite;
555 char*
part = getenv(
"DICOM_CHANGE_MATERIAL_DENSITY" );
559 std::map<G4int,G4double> densityDiffs;
561 densityDiffs[ii] = densityDiff;
566 std::map< std::pair<G4Material*,G4int>,
matInfo* > newMateDens;
578 if( densityDiff != -1. )
continue;
581 mpite = densiMinMax.find(
fMateIDs[copyNo] );
582 if( dens < (*mpite).second.first ) (*mpite).second.first = dens;
583 if( dens > (*mpite).second.second ) (*mpite).second.second = dens;
586 std::map<G4int,G4Material*>::const_iterator imite =
590 if(std::fabs(dens - (*imite).second->GetDensity()/
CLHEP::g*
CLHEP::cm3 ) < 1.
e-9 )
continue;
594 G4int densityBin = (
G4int(dens/densityDiffs[mateID]));
598 std::pair<G4Material*,G4int> matdens((*imite).second, densityBin );
600 std::map< std::pair<G4Material*,G4int>,
matInfo* >::iterator mppite =
601 newMateDens.find( matdens );
602 if( mppite != newMateDens.end() ){
603 matInfo* mi = (*mppite).second;
611 mi->
fId = newMateDens.size()+1;
612 newMateDens[matdens] = mi;
619 if( densityDiff != -1. ) {
620 for( mpite = densiMinMax.begin(); mpite != densiMinMax.end(); mpite++ ){
622 G4cout <<
"DicomDetectorConstruction::ReadVoxelDensities ORIG MATERIALS DENSITY "
623 << (*mpite).first <<
" MIN " << (*mpite).second.first <<
" MAX "
624 << (*mpite).second.second <<
G4endl;
631 std::map<G4int,G4Material*>::const_iterator mimite;
638 std::map< std::pair<G4Material*,G4int>,
matInfo* >::iterator mppite;
639 for( mppite= newMateDens.begin(); mppite != newMateDens.end(); mppite++ ){
643 G4cout <<
"DicomDetectorConstruction::ReadVoxelDensities AVER DENS "
644 << averdens <<
" -> "
645 << saverdens <<
" -> " <<
G4int(1000*averdens) <<
" "
646 <<
G4int(1000*averdens)/1000
653 (*mppite).first.first, averdens, mateName ) );
661 #ifdef DICOM_USE_HEAD
662 G4String path = getenv(
"DICOM_PATH");
663 G4String dataFile = path+
"/Data.dat";
667 std::ifstream finDF(dataFile.c_str());
670 if(finDF.good() != 1 )
672 G4String descript =
"Problem reading data file: "+dataFile;
673 G4Exception(
" DicomDetectorConstruction::ReadPhantomData",
" ",
678 finDF >> compression;
699 G4cout <<
" DicomDetectorConstruction::ReadPhantomDataFile opening file "
703 G4cout <<
" DicomDetectorConstruction::ReadPhantomDataFile opening file "
708 if( !
fin.is_open() ) {
709 G4Exception(
"DicomDetectorConstruction::ReadPhantomDataFile",
712 G4String(
"File not found " + fname ).c_str());
716 char*
part = getenv(
"DICOM_CHANGE_MATERIAL_DENSITY" );
719 if( densityDiff != -1. ) {
749 for(
G4int ii = 0; ii < nVoxels; ii++, voxelCopyNo++ ){
760 for(
G4int ii = 0; ii < nVoxels; ii++, voxelCopyNo++ ){
770 float densityBin = 0.;
771 if( densityDiff != -1.) {
782 if(
fMaterials[im]->GetName() == newMateName ) {
791 if( densityDiff != -1.) {
793 densityBin, newMateName ) );
798 G4Exception(
"DicomDetectorConstruction::ReadPhantomDataFile",
801 "Wrong index in material");
828 for(
G4int ii = 0; ii < nelem; ii++ ){
877 G4cout <<
" placing voxel container volume at " << posCentreVoxels <<
G4endl;
919 G4cout <<
" placing voxel container volume at " << posCentreVoxels <<
G4endl;
966 G4String concreteSDname =
"phantomSD";
967 std::vector<G4String> scorer_names;
968 scorer_names.push_back(concreteSDname);
983 for(std::set<G4LogicalVolume*>::iterator ite =
fScorers.begin();
CLHEP::Hep3Vector G4ThreeVector
static G4double ConvertToDouble(const char *st)
const G4double * GetFractionVector() const
std::vector< ExP01TrackerHit * > a
std::set< G4LogicalVolume * > fScorers
void ConstructPhantomContainer()
static constexpr double cm3
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
void InitialisationOfMaterials()
static constexpr double STP_Temperature
Definition of the DicomRun class.
static G4MaterialTable * GetMaterialTable()
static DicomFileMgr * GetInstance()
static constexpr double g
void AddNewDetector(G4VSensitiveDetector *aSD)
virtual void ConstructPhantom()=0
static constexpr double perCent
static constexpr double mole
void ReadPhantomDataNew()
void SetScorer(G4LogicalVolume *voxel_logic)
G4String GetFileOutName() const
void MergeZSliceHeaders()
G4VPhysicalVolume * fContainer_phys
DicomDetectorConstruction()
Definition of the DicomRunAction class.
std::vector< G4Material * > fMaterials
static constexpr double mg
const G4String & GetName() const
static constexpr double g
static constexpr double m
static constexpr double perCent
std::map< G4int, G4Material * > thePhantomMaterialsOriginal
static constexpr double mg
void ConstructPhantomContainerNew()
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
Definition of the DicomDetectorConstruction class.
std::vector< G4Material * > fOriginalMaterials
std::vector< DicomPhantomZSliceHeader * > fZSliceHeaders
G4bool RegisterPrimitive(G4VPrimitiveScorer *)
G4GLOB_DLL std::ostream G4cerr
std::vector< G4Material * > G4MaterialTable
static constexpr double m
void ReadPhantomDataFile(const G4String &fname)
static G4String ConvertToString(G4bool boolVal)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static G4SDManager * GetSDMpointer()
~DicomDetectorConstruction()
G4VPhysicalVolume * fWorld_phys
void AddElement(G4Element *element, G4int nAtoms)
DicomPhantomZSliceHeader * fZSliceHeaderMerged
G4Material * BuildMaterialWithChangingDensity(const G4Material *origMate, float density, G4String newMateName)
G4GLOB_DLL std::ostream G4cout
void ReadVoxelDensities(std::ifstream &fin)
virtual G4VPhysicalVolume * Construct()
std::map< G4int, G4double > fDensityDiffs
static constexpr double mole
G4LogicalVolume * fWorld_logic
static constexpr double cm3
const G4Element * GetElement(G4int iel) const
G4LogicalVolume * fContainer_logic
virtual void ConstructSDandField()
size_t GetNumberOfElements() const
const G4String & GetName() const
static G4NistManager * Instance()