 |
ATLAS Offline Software
|
InDetMaterialManager.
More...
#include <InDetMaterialManager.h>
|
| | InDetMaterialManager (const std::string &managerName, StoreGateSvc *detStore) |
| |
| | InDetMaterialManager (const std::string &managerName, StoreGateSvc *detStore, const IRDBRecordset_ptr &weightTable, const std::string &space="", bool extraFunctionality=false) |
| |
| | InDetMaterialManager (const std::string &managerName, StoreGateSvc *detStore, const IRDBRecordset_ptr &weightTable, const IRDBRecordset_ptr &compositionTable, const std::string &space="") |
| |
| | InDetMaterialManager (const std::string &managerName, InDetDD::AthenaComps *) |
| |
| | ~InDetMaterialManager () |
| |
| void | addWeightTable (const IRDBRecordset_ptr &weightTable, const std::string &space="") |
| |
| void | addWeightMaterial (const std::string &materialName, const std::string &materialBase, double weight, int linearWeightFlag) |
| |
| void | addCompositionTable (const IRDBRecordset_ptr &compositionTable, const std::string &space="") |
| |
| void | addScalingTable (const IRDBRecordset_ptr &scalingTable) |
| |
| bool | hasMaterial (const std::string &materialName) const |
| |
| const GeoMaterial * | getMaterial (const std::string &materialName) |
| | Get material. First looks for locally defined material and if not found looks in GeoModel material manager. More...
|
| |
| const GeoElement * | getElement (const std::string &elementName) |
| | Get element from GeoModel material manager. More...
|
| |
| const GeoMaterial * | getMaterial (const std::string &origMaterialName, double density, const std::string &newName="") |
| | Create and get material with a specified density based on an existing material. More...
|
| |
| const GeoMaterial * | getMaterialScaled (const std::string &origMaterialName, double scaleFactor, const std::string &newName="") |
| |
| const GeoMaterial * | getMaterialForVolume (const std::string &materialName, double volume, const std::string &newName="") |
| | Create and get material with a density calculated to give weight in predefined weight table. More...
|
| |
| const GeoMaterial * | getMaterialForVolumeLength (const std::string &materialName, double volume, double length, const std::string &newName="") |
| |
| const GeoMaterial * | getMaterialForVolumeLength (const std::string &name, const std::vector< std::string > &materialComponents, const std::vector< double > &factors, double volume, double length) |
| |
| const GeoMaterial * | getMaterialForVolumeLength (const std::string &name, const std::string &materialComponent, double factor, double volume, double length) |
| |
| const GeoMaterial * | getCompositeMaterialForVolume (const std::string &newMatName, const double volumeTot, const double volume1, const std::string &matName1, const double volume2, const std::string &matName2) |
| |
| const GeoMaterial * | getMaterial (const std::string &name, const std::vector< std::string > &materialComponents, const std::vector< double > &fractWeights, double density) |
| |
| void | addMaterial (GeoMaterial *material) |
| | Add material. More...
|
| |
| bool | msgLvl (const MSG::Level lvl) const |
| | Test the output level. More...
|
| |
| MsgStream & | msg () const |
| | The standard message stream. More...
|
| |
| MsgStream & | msg (const MSG::Level lvl) const |
| | The standard message stream. More...
|
| |
| void | setLevel (MSG::Level lvl) |
| | Change the current logging level. More...
|
| |
|
| StoredMaterialManager * | retrieveManager (const StoreGateSvc *detStore) |
| |
| const GeoMaterial * | getAdditionalMaterial (const std::string &materialName) const |
| |
| bool | compareDensity (double d1, double d2) const |
| |
| void | addWeightTableOld (const IRDBRecordset_ptr &weightTable, const std::string &space) |
| |
| const GeoMaterial * | getMaterialInternal (const std::string &materialName) |
| |
| const GeoMaterial * | getMaterialInternal (const std::string &origMaterialName, double density, const std::string &newName="") |
| |
| const GeoMaterial * | getMaterialScaledInternal (const std::string &origMaterialName, double scaleFactor, const std::string &newName="") |
| |
| const GeoMaterial * | getMaterialInternal (const std::string &name, const std::vector< std::string > &materialComponents, const std::vector< double > &fractWeights, double density) |
| |
| const GeoMaterial * | extraScaledMaterial (const std::string &materialName, const std::string &newName, const GeoMaterial *origMaterial) |
| |
| const GeoMaterial * | extraScaledMaterial (const std::string &materialName, const GeoMaterial *origMaterial) |
| |
| const IGeometryDBSvc * | db () |
| |
| void | addTextFileMaterials () |
| |
| void | createMaterial (const MaterialDef &material) |
| |
| double | getExtraScaleFactor (const std::string &materialName) |
| |
| void | initMessaging () const |
| | Initialize our message level and MessageSvc. More...
|
| |
InDetMaterialManager.
This provides an interface to the GeoModel Material Manager as well as allowing additional materials to be defined or standard ones redefined. It also allows creating new materials based on existing ones but with a different density. It is also possible to specify a weight table and this is used to create materials with a density such that the the total weight is correct.
Definition at line 33 of file InDetMaterialManager.h.
◆ ExtraScaleFactorMap
◆ MaterialCompositionMap
◆ MaterialStore
◆ MaterialWeightMap
◆ InDetMaterialManager() [1/4]
| InDetMaterialManager::InDetMaterialManager |
( |
const std::string & |
managerName, |
|
|
StoreGateSvc * |
detStore |
|
) |
| |
◆ InDetMaterialManager() [2/4]
◆ InDetMaterialManager() [3/4]
◆ InDetMaterialManager() [4/4]
◆ ~InDetMaterialManager()
| InDetMaterialManager::~InDetMaterialManager |
( |
| ) |
|
|
default |
◆ addCompositionTable()
Definition at line 413 of file InDetMaterialManager.cxx.
414 ATH_MSG_DEBUG(
"Reading in composition table: " << compositionTable->nodeName());
417 ATH_MSG_ERROR(
"GeometryDBSvc not available. Unable to read in composition table.");
420 std::string materialName =
db()->
getString(compositionTable,
"MATERIAL",
i);
421 if (!space.empty()) {
422 materialName = space +
"::" + materialName;
425 std::string componentName =
db()->
getString(compositionTable,
"COMPONENT",
i);
427 double factor =
db()->
getDouble(compositionTable,
"FACTOR",
i);
428 double actualLength =
db()->
getDouble(compositionTable,
"ACTUALLENGTH",
i);
◆ addMaterial()
| void InDetMaterialManager::addMaterial |
( |
GeoMaterial * |
material | ) |
|
Add material.
Definition at line 303 of file InDetMaterialManager.cxx.
304 GeoIntrusivePtr<const GeoMaterial> matPtr{material};
305 std::string
name(material->getName());
314 ATH_MSG_DEBUG(
"Created new material: " <<
name <<
", " << material->getDensity() /
◆ addScalingTable()
Definition at line 438 of file InDetMaterialManager.cxx.
439 if (!scalingTable)
return;
441 if (
db()->getTableSize(scalingTable) == 0)
return;
443 ATH_MSG_DEBUG(
"Reading in extra material scaling table: " << scalingTable->nodeName());
445 ATH_MSG_ERROR(
"GeometryDBSvc not available. Unable to read in scaling table.");
448 std::string materialName =
db()->
getString(scalingTable,
"MATERIAL",
i);
449 double scalingFactor =
db()->
getDouble(scalingTable,
"FACTOR",
i);
452 if (scalingFactor >= 0 || scalingFactor == 1) {
453 msg(
MSG::DEBUG) <<
"Material " << materialName <<
" will be scaled by: " << scalingFactor <<
endmsg;
460 ATH_MSG_WARNING(
"Overriding material: " << materialName <<
" which already exists in scaling table");
◆ addTextFileMaterials()
| void InDetMaterialManager::addTextFileMaterials |
( |
| ) |
|
|
private |
Definition at line 739 of file InDetMaterialManager.cxx.
740 const std::string materialTable =
"ExtraMaterials";
741 const std::string componentsTable =
"ExtraMatComponents";
746 if (!
db() || !
db()->testField(
"",
"TableSize:" + materialTable) || !
db()->getTableSize(materialTable)
747 || !
db()->testField(
"",
"TableSize:" + componentsTable) || !
db()->getTableSize(componentsTable))
return;
750 ATH_MSG_INFO(
"Extra materials being read in from text file.");
752 using MatMap = std::map<std::string, MaterialDef>;
756 for (
unsigned int iMat = 0; iMat <
db()->
getTableSize(materialTable); iMat++) {
757 std::string materialName =
db()->
getString(materialTable,
"NAME", iMat);
759 materials[materialName] = MaterialDef(materialName, density);
763 for (
unsigned int iComp = 0; iComp <
db()->
getTableSize(componentsTable); iComp++) {
764 std::string materialName =
db()->
getString(componentsTable,
"NAME", iComp);
766 double fracWeight =
db()->
getDouble(componentsTable,
"FRACTION", iComp);
768 if (
iter != materials.end()) {
778 int matCountLast = -1;
779 bool someUndefined =
true;
783 while (someUndefined && matCount != matCountLast) {
784 matCountLast = matCount;
785 someUndefined =
false;
787 MaterialDef& tmpMat =
iter->second;
788 if (!tmpMat.isCreated()) {
791 bool compsDefined =
true;
792 for (
unsigned int iComp = 0; iComp < tmpMat.numComponents(); ++iComp) {
793 const std::string&
compName = tmpMat.compName(iComp);
795 if (iter2 != materials.end()) {
796 if (!iter2->second.isCreated()) {
797 compsDefined =
false;
807 someUndefined =
true;
815 ATH_MSG_ERROR(
"Not all materials could be defined due to cyclic definitions");
◆ addWeightMaterial()
| void InDetMaterialManager::addWeightMaterial |
( |
const std::string & |
materialName, |
|
|
const std::string & |
materialBase, |
|
|
double |
weight, |
|
|
int |
linearWeightFlag |
|
) |
| |
Definition at line 368 of file InDetMaterialManager.cxx.
374 ATH_MSG_WARNING(
"Material: " << materialName <<
" already exists in weight table");
378 <<
" linearWeightFlag " << linearWeightFlag
379 <<
" to weight table");
380 m_weightMap[materialName] = MaterialByWeight(materialBase,
weight, linearWeightFlag);
◆ addWeightTable()
Definition at line 328 of file InDetMaterialManager.cxx.
329 ATH_MSG_DEBUG(
"Reading in weight table: " << weightTable->nodeName());
332 ATH_MSG_DEBUG(
"GeometryDBSvc not available. Using old version.");
337 std::string materialName =
db()->
getString(weightTable,
"MATERIAL",
i);
338 if (!space.empty()) {
339 materialName = space +
"::" + materialName;
341 std::string materialBase;
342 if (
db()->testField(weightTable,
"BASEMATERIAL",
i)) {
343 materialBase =
db()->
getString(weightTable,
"BASEMATERIAL",
i);
348 bool linearWeightFlag =
false;
350 linearWeightFlag =
db()->
getInt(weightTable,
"LINWEIGHTFLAG",
i);
354 ATH_MSG_WARNING(
"Material: " << materialName <<
" already exists in weight table");
358 <<
" linearWeightFlag " << linearWeightFlag
359 <<
" raw weight " <<
db()->getDouble(weightTable,
"WEIGHT",
i)
361 <<
" to weight table");
362 m_weightMap[materialName] = MaterialByWeight(materialBase,
weight, linearWeightFlag);
◆ addWeightTableOld()
Definition at line 385 of file InDetMaterialManager.cxx.
386 for (
unsigned int i = 0;
i < weightTable->size();
i++) {
388 std::string materialName = record->
getString(
"MATERIAL");
389 if (!space.empty()) {
390 materialName = space +
"::" + materialName;
392 std::string materialBase;
394 materialBase = record->
getString(
"BASEMATERIAL");
399 bool linearWeightFlag =
false;
401 linearWeightFlag = record->
getInt(
"LINWEIGHTFLAG");
405 ATH_MSG_WARNING(
"Material: " << materialName <<
" already exists in weight table");
407 m_weightMap[materialName] = MaterialByWeight(materialBase,
weight, linearWeightFlag);
◆ compareDensity()
| bool InDetMaterialManager::compareDensity |
( |
double |
d1, |
|
|
double |
d2 |
|
) |
| const |
|
private |
Definition at line 320 of file InDetMaterialManager.cxx.
322 throw (std::runtime_error(
"InDetMaterialManager:compareDensity: Density is zero"));
324 return(std::abs(
d1 /
d2 - 1.) < 1
e-5);
◆ createMaterial()
Definition at line 820 of file InDetMaterialManager.cxx.
821 if (material.numComponents() == 0) {
822 ATH_MSG_ERROR(
"Material has no components: " << material.name());
827 double totWeight = material.totalFraction();
828 bool byAtomicRatio =
false;
829 if (totWeight > 1.1) {
830 byAtomicRatio =
true;
831 for (
unsigned int i = 0;
i < material.numComponents();
i++) {
832 if (material.compName(
i).find(
"::") != std::string::npos) {
835 ", is assumed to be defined by atomic ratio (due to total fraction > 1)"
836 " but component is not an element: " << material.compName(
i));
839 const GeoElement* element =
getElement(material.compName(
i));
841 ATH_MSG_ERROR(
"Error making material " << material.name() <<
". Element not found: " <<
842 material.compName(
i));
845 totWeight += material.fraction(
i) * element->getA();
849 if (std::abs(totWeight - 1) > 0.01) {
850 ATH_MSG_WARNING(
"Total fractional weight does not sum to 1. Will renormalize. Total = " << totWeight);
854 GeoIntrusivePtr<GeoMaterial> newMaterial{
new GeoMaterial(material.name(), material.density())};
855 ATH_MSG_DEBUG(
"Creating material: " << material.name() <<
" with density: "
858 ATH_MSG_ERROR(
"totWeight is zero in InDetMaterialManager::createMaterial");
861 for (
unsigned int i = 0;
i < material.numComponents();
i++) {
862 double fracWeight = material.fraction(
i) / totWeight;
863 if (material.compName(
i).find(
"::") == std::string::npos) {
864 const GeoElement* element =
getElement(material.compName(
i));
866 ATH_MSG_ERROR(
"Error making material " << material.name() <<
". Element not found: " << material.compName(
i));
871 fracWeight = material.fraction(
i) * element->getA() / totWeight;
873 newMaterial->add(
const_cast<GeoElement*
>(element), fracWeight);
874 ATH_MSG_DEBUG(
" Component: " << material.compName(
i) <<
" " << fracWeight);
878 ATH_MSG_ERROR(
"Error making material " << material.name() <<
". Component not found: " << material.compName(
i));
886 newMaterial->add(
const_cast<GeoMaterial*
>(materialTmp.get()), fracWeight);
887 ATH_MSG_DEBUG(
" Component: " << material.compName(
i) <<
" " << fracWeight);
◆ db()
◆ extraScaledMaterial() [1/2]
| const GeoMaterial * InDetMaterialManager::extraScaledMaterial |
( |
const std::string & |
materialName, |
|
|
const GeoMaterial * |
origMaterial |
|
) |
| |
|
private |
Definition at line 940 of file InDetMaterialManager.cxx.
941 if (!origMaterial)
throw std::runtime_error(std::string(
"Invalid material: ") + materialName);
946 if (scaleFactor < 0 || scaleFactor == 1 || materialName.find(
"Ether") != std::string::npos)
return origMaterial;
950 std::string
newName = materialName +
"_ExtraScaling";
956 if (newMaterial)
return newMaterial;
959 double density = origMaterial->getDensity() * scaleFactor;
962 GeoMaterial* newMaterialTmp =
new GeoMaterial(
newName, density);
963 newMaterialTmp->add(
const_cast<GeoMaterial*
>(origMaterial), 1.);
965 newMaterial = newMaterialTmp;
◆ extraScaledMaterial() [2/2]
| const GeoMaterial * InDetMaterialManager::extraScaledMaterial |
( |
const std::string & |
materialName, |
|
|
const std::string & |
newName, |
|
|
const GeoMaterial * |
origMaterial |
|
) |
| |
|
private |
◆ getAdditionalMaterial()
| const GeoMaterial * InDetMaterialManager::getAdditionalMaterial |
( |
const std::string & |
materialName | ) |
const |
|
private |
◆ getCompositeMaterialForVolume()
| const GeoMaterial * InDetMaterialManager::getCompositeMaterialForVolume |
( |
const std::string & |
newMatName, |
|
|
const double |
volumeTot, |
|
|
const double |
volume1, |
|
|
const std::string & |
matName1, |
|
|
const double |
volume2, |
|
|
const std::string & |
matName2 |
|
) |
| |
Definition at line 138 of file InDetMaterialManager.cxx.
143 std::vector<std::string> baseMaterials;
144 std::vector<double> fracWeight;
145 baseMaterials.reserve(2);
146 fracWeight.reserve(2);
150 ATH_MSG_DEBUG(
"Composite material : " << matName1 <<
" " << matName2);
152 double density1, density2;
154 MaterialWeightMap::const_iterator
iter;
157 density1 = mat1->getDensity();
161 density1 = mat1->getDensity();
167 density2 = mat2->getDensity();
171 density2 = mat2->getDensity();
175 double weight1 = density1 * volume1;
176 double weight2 = density2 * volume2;
177 double invWeightTot = 1.0 / (weight1 + weight2);
179 double density = (weight1 + weight2) / volumeTot;
181 double frac1 = weight1 / (weight1 + weight2);
182 double frac2 = weight2 / (weight1 + weight2);
183 double density_2 = 1.0 / (frac1 / density1 + frac2 / density2);
184 double density_3 = (weight1 + weight2) / (volume1 + volume2);
190 baseMaterials.push_back(matName1);
191 baseMaterials.push_back(matName2);
192 fracWeight.push_back(weight1 * invWeightTot);
193 fracWeight.push_back(weight2 * invWeightTot);
195 return getMaterial(newMatName, baseMaterials, fracWeight, density);
◆ getElement()
| const GeoElement * InDetMaterialManager::getElement |
( |
const std::string & |
elementName | ) |
|
Get element from GeoModel material manager.
Definition at line 90 of file InDetMaterialManager.cxx.
92 std::string errorMessage(
"Null pointer to Stored Material Manager!");
94 throw std::runtime_error(errorMessage);
◆ getExtraScaleFactor()
| double InDetMaterialManager::getExtraScaleFactor |
( |
const std::string & |
materialName | ) |
|
|
private |
◆ getMaterial() [1/3]
| const GeoMaterial * InDetMaterialManager::getMaterial |
( |
const std::string & |
materialName | ) |
|
◆ getMaterial() [2/3]
| const GeoMaterial * InDetMaterialManager::getMaterial |
( |
const std::string & |
name, |
|
|
const std::vector< std::string > & |
materialComponents, |
|
|
const std::vector< double > & |
fractWeights, |
|
|
double |
density |
|
) |
| |
◆ getMaterial() [3/3]
| const GeoMaterial * InDetMaterialManager::getMaterial |
( |
const std::string & |
origMaterialName, |
|
|
double |
density, |
|
|
const std::string & |
newName = "" |
|
) |
| |
Create and get material with a specified density based on an existing material.
If a newName is supplied it creates the new material even if the orginal material has the same density. It however first checks if the material with NewName exists. If no newName is supplied then it checks the density of the existing material. If it is consistent it returns the material. If it is different it creates a material with the string "Modified" added to the name.
Definition at line 210 of file InDetMaterialManager.cxx.
◆ getMaterialForVolume()
| const GeoMaterial * InDetMaterialManager::getMaterialForVolume |
( |
const std::string & |
materialName, |
|
|
double |
volume, |
|
|
const std::string & |
newName = "" |
|
) |
| |
Create and get material with a density calculated to give weight in predefined weight table.
Definition at line 467 of file InDetMaterialManager.cxx.
484 MaterialWeightMap::const_iterator
iter;
486 const std::string& materialBase =
iter->second.name;
488 double density =
weight / volume;
489 if (
iter->second.linearWeightFlag) {
490 ATH_MSG_ERROR(
"Material defined by linear weight cannot be created with getMaterialForVolume method: " <<
494 ATH_MSG_VERBOSE(
"Found material in weight table - name, base, weight(g), volume(cm3), density(g/cm3): "
495 << materialName <<
", "
496 << materialBase <<
", "
501 if (materialBase.empty()) {
505 return getMaterial(materialBase, density, materialName);
513 ATH_MSG_VERBOSE(
"Material not in weight table, using standard material: "
◆ getMaterialForVolumeLength() [1/3]
| const GeoMaterial * InDetMaterialManager::getMaterialForVolumeLength |
( |
const std::string & |
materialName, |
|
|
double |
volume, |
|
|
double |
length, |
|
|
const std::string & |
newName = "" |
|
) |
| |
Definition at line 521 of file InDetMaterialManager.cxx.
539 if (volume <= 0 ||
length <= 0) {
545 std::pair<MaterialCompositionMap::const_iterator, MaterialCompositionMap::const_iterator> iterRange;
548 ATH_MSG_VERBOSE(
"Found material in material composition table:" << materialName);
550 std::vector<double> factors;
551 std::vector<std::string> components;
552 for (MaterialCompositionMap::const_iterator
iter = iterRange.first;
iter != iterRange.second; ++
iter) {
553 double factorTmp =
iter->second.factor;
554 if (
iter->second.actualLength > 0) factorTmp *=
iter->second.actualLength /
length;
555 factors.push_back(factorTmp);
556 components.push_back(
iter->second.name);
562 MaterialWeightMap::const_iterator
iter;
564 const std::string& materialBase =
iter->second.name;
566 double density =
weight / volume;
569 if (materialBase.empty()) {
577 ATH_MSG_VERBOSE(
"Material not in weight table, using standard material: "
◆ getMaterialForVolumeLength() [2/3]
| const GeoMaterial * InDetMaterialManager::getMaterialForVolumeLength |
( |
const std::string & |
name, |
|
|
const std::string & |
materialComponent, |
|
|
double |
factor, |
|
|
double |
volume, |
|
|
double |
length |
|
) |
| |
Definition at line 585 of file InDetMaterialManager.cxx.
590 std::vector<std::string> tmpMaterialComponents(1, materialComponent);
591 std::vector<double> tmpFactors(1, factor);
◆ getMaterialForVolumeLength() [3/3]
| const GeoMaterial * InDetMaterialManager::getMaterialForVolumeLength |
( |
const std::string & |
name, |
|
|
const std::vector< std::string > & |
materialComponents, |
|
|
const std::vector< double > & |
factors, |
|
|
double |
volume, |
|
|
double |
length |
|
) |
| |
Definition at line 596 of file InDetMaterialManager.cxx.
602 if (volume <= 0 ||
length <= 0) {
607 if (!factors.empty() && factors.size() < materialComponents.size()) {
608 ATH_MSG_WARNING(
"getMaterialForVolumeLength: factor vector size too small. Setting remaining factors to 1.");
611 std::vector<std::string> baseMaterials;
612 std::vector<double> fracWeight;
613 baseMaterials.reserve(materialComponents.size());
614 fracWeight.reserve(materialComponents.size());
616 double totWeight = 0;
617 for (
unsigned int iComp = 0; iComp < materialComponents.size(); ++iComp) {
618 const std::string& materialName = materialComponents[iComp];
621 MaterialWeightMap::const_iterator
iter;
623 const std::string& materialBase =
iter->second.name;
626 if (iComp < factors.size()) {
631 <<
" factor " << factors[iComp]
633 <<
" basMat " << materialBase
634 <<
" linear? " <<
iter->second.linearWeightFlag);
637 if (materialBase.empty()) {
639 baseMaterials.push_back(materialName);
641 baseMaterials.push_back(materialBase);
643 fracWeight.push_back(
weight);
662 baseMaterials.push_back(materialName);
663 fracWeight.push_back(
weight);
670 for (
unsigned int i = 0;
i < materialComponents.size(); ++
i) {
676 ATH_MSG_ERROR(
"totWeight is zero in InDetMaterialManager::getMaterialForVolumeLength");
679 for (
unsigned int i = 0;
i < fracWeight.size(); ++
i) {
680 fracWeight[
i] /= totWeight;
683 ATH_MSG_ERROR(
"volume is zero in InDetMaterialManager::getMaterialForVolumeLength");
686 double density = totWeight / volume;
◆ getMaterialInternal() [1/3]
| const GeoMaterial * InDetMaterialManager::getMaterialInternal |
( |
const std::string & |
materialName | ) |
|
|
private |
Definition at line 110 of file InDetMaterialManager.cxx.
117 std::string errorMessage(
"Null pointer to Stored Material Manager!");
119 throw std::runtime_error(errorMessage);
◆ getMaterialInternal() [2/3]
| const GeoMaterial * InDetMaterialManager::getMaterialInternal |
( |
const std::string & |
name, |
|
|
const std::vector< std::string > & |
materialComponents, |
|
|
const std::vector< double > & |
fractWeights, |
|
|
double |
density |
|
) |
| |
|
private |
Definition at line 701 of file InDetMaterialManager.cxx.
705 const GeoMaterial* newMaterial =
nullptr;
714 newMaterial = material;
716 GeoMaterial* newMaterialTmp =
new GeoMaterial(
name, density);
717 for (
unsigned int i = 0;
i < materialComponents.size();
i++) {
720 newMaterialTmp->add(
const_cast<GeoMaterial*
>(origMaterial), fracWeight[
i]);
722 ATH_MSG_ERROR(
"Material component missing " << materialComponents[
i]);
726 newMaterial = newMaterialTmp;
◆ getMaterialInternal() [3/3]
| const GeoMaterial * InDetMaterialManager::getMaterialInternal |
( |
const std::string & |
origMaterialName, |
|
|
double |
density, |
|
|
const std::string & |
newName = "" |
|
) |
| |
|
private |
Definition at line 218 of file InDetMaterialManager.cxx.
221 std::string newName2 =
newName;
222 bool newNameProvided = !newName2.empty();
223 if (!newNameProvided) {
224 newName2 = origMaterialName +
"Modified";
227 const GeoMaterial* newMaterial =
nullptr;
237 newMaterial = material;
240 newMaterial = origMaterial;
244 if (newNameProvided || !
compareDensity(origMaterial->getDensity(), density)) {
246 GeoMaterial* newMaterialTmp =
new GeoMaterial(newName2, density);
247 newMaterialTmp->add(
const_cast<GeoMaterial*
>(origMaterial), 1.);
249 newMaterial = newMaterialTmp;
◆ getMaterialScaled()
| const GeoMaterial * InDetMaterialManager::getMaterialScaled |
( |
const std::string & |
origMaterialName, |
|
|
double |
scaleFactor, |
|
|
const std::string & |
newName = "" |
|
) |
| |
◆ getMaterialScaledInternal()
| const GeoMaterial * InDetMaterialManager::getMaterialScaledInternal |
( |
const std::string & |
origMaterialName, |
|
|
double |
scaleFactor, |
|
|
const std::string & |
newName = "" |
|
) |
| |
|
private |
Definition at line 265 of file InDetMaterialManager.cxx.
269 if (scaleFactor > 1000 || scaleFactor < 0.001) {
270 ATH_MSG_ERROR(
"Scale factor must be between 0.001 and 1000.");
278 if (
newName.empty() && scaleFactor == 1.)
return origMaterial;
280 const GeoMaterial* newMaterial =
nullptr;
283 double density = origMaterial->getDensity() * scaleFactor;
284 std::string newName2 =
newName;
285 if (newName2.empty()) {
287 int scaleInt =
static_cast<int>(scaleFactor * 10000);
288 int scale1 = scaleInt / 10000;
289 int scale2 = scaleInt % 10000;
291 std::ostringstream
os;
292 os << origMaterialName <<
scale1 <<
"_" << std::setw(4) << std::setfill(
'0') <<
scale2;
◆ hasMaterial()
| bool InDetMaterialManager::hasMaterial |
( |
const std::string & |
materialName | ) |
const |
◆ initMessaging()
| void AthMessaging::initMessaging |
( |
| ) |
const |
|
privateinherited |
Initialize our message level and MessageSvc.
This method should only be called once.
Definition at line 39 of file AthMessaging.cxx.
◆ msg() [1/2]
| MsgStream & AthMessaging::msg |
( |
| ) |
const |
|
inlineinherited |
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 164 of file AthMessaging.h.
◆ msg() [2/2]
| MsgStream & AthMessaging::msg |
( |
const MSG::Level |
lvl | ) |
const |
|
inlineinherited |
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 179 of file AthMessaging.h.
180 {
return msg() << lvl; }
◆ msgLvl()
| bool AthMessaging::msgLvl |
( |
const MSG::Level |
lvl | ) |
const |
|
inlineinherited |
Test the output level.
- Parameters
-
| lvl | The message level to test against |
- Returns
- boolean Indicating if messages at given level will be printed
- Return values
-
| true | Messages at level "lvl" will be printed |
Definition at line 151 of file AthMessaging.h.
◆ retrieveManager()
◆ setLevel()
| void AthMessaging::setLevel |
( |
MSG::Level |
lvl | ) |
|
|
inherited |
◆ ATLAS_THREAD_SAFE
| std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
|
mutableprivateinherited |
◆ m_athenaComps
◆ m_extraFunctionality
| bool InDetMaterialManager::m_extraFunctionality |
|
private |
◆ m_imsg
| std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr } |
|
mutableprivateinherited |
◆ m_lvl
| std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL } |
|
mutableprivateinherited |
◆ m_managerName
| std::string InDetMaterialManager::m_managerName |
|
private |
◆ m_matCompositionMap
◆ m_materialManager
◆ m_msg_tls
| boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls |
|
mutableprivateinherited |
MsgStream instance (a std::cout like with print-out levels)
Definition at line 132 of file AthMessaging.h.
◆ m_nm
| std::string AthMessaging::m_nm |
|
privateinherited |
◆ m_scalingMap
◆ m_store
◆ m_weightMap
The documentation for this class was generated from the following files:
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
JetConstituentVector::iterator iterator
void addMaterial(GeoMaterial *material)
Add material.
std::atomic< MSG::Level > m_lvl
Current logging level.
void addWeightTable(const IRDBRecordset_ptr &weightTable, const std::string &space="")
const InDetDD::AthenaComps * m_athenaComps
const GeoMaterial * getAdditionalMaterial(const std::string &materialName) const
StoredMaterialManager * m_materialManager
virtual const std::string & getString(const std::string &fieldName) const =0
Get string field value.
virtual const GeoElement * getElement(const std::string &name)=0
const GeoMaterial * getMaterialScaledInternal(const std::string &origMaterialName, double scaleFactor, const std::string &newName="")
#define ATH_MSG_VERBOSE(x)
MaterialCompositionMap m_matCompositionMap
virtual unsigned int getTableSize(IRDBRecordset_ptr recordSet) const =0
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
const GeoMaterial * getMaterialInternal(const std::string &materialName)
IMessageSvc * getMessageSvc(bool quiet=false)
void addTextFileMaterials()
AthMessaging()
Default constructor:
bool msgLvl(const MSG::Level lvl) const
Test the output level.
void addWeightTableOld(const IRDBRecordset_ptr &weightTable, const std::string &space)
void addCompositionTable(const IRDBRecordset_ptr &compositionTable, const std::string &space="")
void createMaterial(const MaterialDef &material)
ExtraScaleFactorMap m_scalingMap
const GeoMaterial * getMaterialForVolume(const std::string &materialName, double volume, const std::string &newName="")
Create and get material with a density calculated to give weight in predefined weight table.
bool m_extraFunctionality
const GeoMaterial * getMaterialForVolumeLength(const std::string &materialName, double volume, double length, const std::string &newName="")
const GeoMaterial * extraScaledMaterial(const std::string &materialName, const std::string &newName, const GeoMaterial *origMaterial)
MsgStream & msg() const
The standard message stream.
virtual double getDouble(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const =0
The following methods will first look in the text file if provided and then look in the database.
std::pair< Material, double > MaterialComponent
const GeoElement * getElement(const std::string &elementName)
Get element from GeoModel material manager.
std::string m_managerName
StoredMaterialManager * retrieveManager(const StoreGateSvc *detStore)
bool close_to_zero(T value, T eps=std::numeric_limits< T >::epsilon())
const IGeometryDBSvc * geomDB() const
#define ATH_MSG_WARNING(x)
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
const IGeometryDBSvc * db()
IRDBRecord is one record in the IRDBRecordset object.
std::string m_nm
Message source name.
double getExtraScaleFactor(const std::string &materialName)
virtual int getInt(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const =0
virtual const GeoMaterial * getMaterial(const std::string &name)=0
This class holds one or more material managers and makes them storeable, under StoreGate.
MaterialWeightMap m_weightMap
virtual std::string getString(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const =0
virtual double getDouble(const std::string &fieldName) const =0
Get double field value.
bool compareDensity(double d1, double d2) const
void initMessaging() const
Initialize our message level and MessageSvc.
const StoreGateSvc * detStore() const
const GeoMaterial * getMaterial(const std::string &materialName)
Get material. First looks for locally defined material and if not found looks in GeoModel material ma...
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)