|
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 406 of file InDetMaterialManager.cxx.
407 ATH_MSG_DEBUG(
"Reading in composition table: " << compositionTable->nodeName());
410 ATH_MSG_ERROR(
"GeometryDBSvc not available. Unable to read in composition table.");
413 std::string materialName =
db()->
getString(compositionTable,
"MATERIAL",
i);
414 if (!space.empty()) {
415 materialName = space +
"::" + materialName;
418 std::string componentName =
db()->
getString(compositionTable,
"COMPONENT",
i);
420 double factor =
db()->
getDouble(compositionTable,
"FACTOR",
i);
421 double actualLength =
db()->
getDouble(compositionTable,
"ACTUALLENGTH",
i);
◆ addMaterial()
void InDetMaterialManager::addMaterial |
( |
GeoMaterial * |
material | ) |
|
Add material.
Definition at line 299 of file InDetMaterialManager.cxx.
300 GeoIntrusivePtr<const GeoMaterial> matPtr{material};
301 std::string
name(material->getName());
310 ATH_MSG_DEBUG(
"Created new material: " <<
name <<
", " << material->getDensity() /
◆ addScalingTable()
Definition at line 431 of file InDetMaterialManager.cxx.
432 if (!scalingTable)
return;
434 if (
db()->getTableSize(scalingTable) == 0)
return;
436 ATH_MSG_DEBUG(
"Reading in extra material scaling table: " << scalingTable->nodeName());
438 ATH_MSG_ERROR(
"GeometryDBSvc not available. Unable to read in scaling table.");
441 std::string materialName =
db()->
getString(scalingTable,
"MATERIAL",
i);
442 double scalingFactor =
db()->
getDouble(scalingTable,
"FACTOR",
i);
445 if (scalingFactor >= 0 || scalingFactor == 1) {
446 msg(
MSG::DEBUG) <<
"Material " << materialName <<
" will be scaled by: " << scalingFactor <<
endmsg;
453 ATH_MSG_WARNING(
"Overriding material: " << materialName <<
" which already exists in scaling table");
◆ addTextFileMaterials()
void InDetMaterialManager::addTextFileMaterials |
( |
| ) |
|
|
private |
Definition at line 764 of file InDetMaterialManager.cxx.
765 const std::string materialTable =
"ExtraMaterials";
766 const std::string componentsTable =
"ExtraMatComponents";
771 if (!
db() || !
db()->testField(
"",
"TableSize:" + materialTable) || !
db()->getTableSize(materialTable)
772 || !
db()->testField(
"",
"TableSize:" + componentsTable) || !
db()->getTableSize(componentsTable))
return;
775 ATH_MSG_INFO(
"Extra materials being read in from text file.");
777 using MatMap = std::map<std::string, MaterialDef>;
781 for (
unsigned int iMat = 0; iMat <
db()->
getTableSize(materialTable); iMat++) {
782 std::string materialName =
db()->
getString(materialTable,
"NAME", iMat);
784 materials[materialName] = MaterialDef(materialName, density);
788 for (
unsigned int iComp = 0; iComp <
db()->
getTableSize(componentsTable); iComp++) {
789 std::string materialName =
db()->
getString(componentsTable,
"NAME", iComp);
791 double fracWeight =
db()->
getDouble(componentsTable,
"FRACTION", iComp);
793 if (iter != materials.end()) {
794 iter->second.addComponent(
compName, fracWeight);
803 int matCountLast = -1;
804 bool someUndefined =
true;
808 while (someUndefined && matCount != matCountLast) {
809 matCountLast = matCount;
810 someUndefined =
false;
811 for (
MatMap::iterator iter = materials.begin(); iter != materials.end(); ++iter) {
812 MaterialDef& tmpMat = iter->second;
813 if (!tmpMat.isCreated()) {
816 bool compsDefined =
true;
817 for (
unsigned int iComp = 0; iComp < tmpMat.numComponents(); ++iComp) {
818 const std::string&
compName = tmpMat.compName(iComp);
820 if (iter2 != materials.end()) {
821 if (!iter2->second.isCreated()) {
822 compsDefined =
false;
832 someUndefined =
true;
840 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 361 of file InDetMaterialManager.cxx.
367 ATH_MSG_WARNING(
"Material: " << materialName <<
" already exists in weight table");
371 <<
" linearWeightFlag " << linearWeightFlag
372 <<
" to weight table");
373 m_weightMap[materialName] = MaterialByWeight(materialBase,
weight, linearWeightFlag);
◆ addWeightTable()
Definition at line 321 of file InDetMaterialManager.cxx.
322 ATH_MSG_DEBUG(
"Reading in weight table: " << weightTable->nodeName());
325 ATH_MSG_DEBUG(
"GeometryDBSvc not available. Using old version.");
330 std::string materialName =
db()->
getString(weightTable,
"MATERIAL",
i);
331 if (!space.empty()) {
332 materialName = space +
"::" + materialName;
334 std::string materialBase;
335 if (
db()->testField(weightTable,
"BASEMATERIAL",
i)) {
336 materialBase =
db()->
getString(weightTable,
"BASEMATERIAL",
i);
341 bool linearWeightFlag =
false;
343 linearWeightFlag =
db()->
getInt(weightTable,
"LINWEIGHTFLAG",
i);
347 ATH_MSG_WARNING(
"Material: " << materialName <<
" already exists in weight table");
351 <<
" linearWeightFlag " << linearWeightFlag
352 <<
" raw weight " <<
db()->getDouble(weightTable,
"WEIGHT",
i)
354 <<
" to weight table");
355 m_weightMap[materialName] = MaterialByWeight(materialBase,
weight, linearWeightFlag);
◆ addWeightTableOld()
Definition at line 378 of file InDetMaterialManager.cxx.
379 for (
unsigned int i = 0;
i < weightTable->size();
i++) {
381 std::string materialName = record->
getString(
"MATERIAL");
382 if (!space.empty()) {
383 materialName = space +
"::" + materialName;
385 std::string materialBase;
387 materialBase = record->
getString(
"BASEMATERIAL");
392 bool linearWeightFlag =
false;
394 linearWeightFlag = record->
getInt(
"LINWEIGHTFLAG");
398 ATH_MSG_WARNING(
"Material: " << materialName <<
" already exists in weight table");
400 m_weightMap[materialName] = MaterialByWeight(materialBase,
weight, linearWeightFlag);
◆ compareDensity()
bool InDetMaterialManager::compareDensity |
( |
double |
d1, |
|
|
double |
d2 |
|
) |
| const |
|
private |
◆ createMaterial()
Definition at line 845 of file InDetMaterialManager.cxx.
846 if (material.numComponents() == 0) {
847 ATH_MSG_ERROR(
"Material has no components: " << material.name());
852 double totWeight = material.totalFraction();
853 bool byAtomicRatio =
false;
854 if (totWeight > 1.1) {
855 byAtomicRatio =
true;
856 for (
unsigned int i = 0;
i < material.numComponents();
i++) {
857 if (material.compName(
i).find(
"::") != std::string::npos) {
860 ", is assumed to be defined by atomic ratio (due to total fraction > 1)"
861 " but component is not an element: " << material.compName(
i));
864 const GeoElement* element =
getElement(material.compName(
i));
866 ATH_MSG_ERROR(
"Error making material " << material.name() <<
". Element not found: " <<
867 material.compName(
i));
870 totWeight += material.fraction(
i) * element->getA();
874 if (std::abs(totWeight - 1) > 0.01) {
875 ATH_MSG_WARNING(
"Total fractional weight does not sum to 1. Will renormalize. Total = " << totWeight);
879 GeoIntrusivePtr<GeoMaterial> newMaterial{
new GeoMaterial(material.name(), material.density())};
880 ATH_MSG_DEBUG(
"Creating material: " << material.name() <<
" with density: "
882 for (
unsigned int i = 0;
i < material.numComponents();
i++) {
883 double fracWeight = material.fraction(
i) / totWeight;
884 if (material.compName(
i).find(
"::") == std::string::npos) {
885 const GeoElement* element =
getElement(material.compName(
i));
887 ATH_MSG_ERROR(
"Error making material " << material.name() <<
". Element not found: " << material.compName(
i));
892 fracWeight = material.fraction(
i) * element->getA() / totWeight;
894 newMaterial->add(
const_cast<GeoElement*
>(element), fracWeight);
895 ATH_MSG_DEBUG(
" Component: " << material.compName(
i) <<
" " << fracWeight);
899 ATH_MSG_ERROR(
"Error making material " << material.name() <<
". Component not found: " << material.compName(
i));
907 newMaterial->add(
const_cast<GeoMaterial*
>(materialTmp.get()), fracWeight);
908 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 961 of file InDetMaterialManager.cxx.
962 if (!origMaterial)
throw std::runtime_error(std::string(
"Invalid material: ") + materialName);
967 if (scaleFactor < 0 || scaleFactor == 1 || materialName.find(
"Ether") != std::string::npos)
return origMaterial;
971 std::string
newName = materialName +
"_ExtraScaling";
977 if (newMaterial)
return newMaterial;
980 double density = origMaterial->getDensity() * scaleFactor;
983 GeoMaterial* newMaterialTmp =
new GeoMaterial(
newName, density);
984 newMaterialTmp->add(
const_cast<GeoMaterial*
>(origMaterial), 1.);
986 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 134 of file InDetMaterialManager.cxx.
139 std::vector<std::string> baseMaterials;
140 std::vector<double> fracWeight;
141 baseMaterials.reserve(2);
142 fracWeight.reserve(2);
146 ATH_MSG_DEBUG(
"Composite material : " << matName1 <<
" " << matName2);
148 double density1, density2;
150 MaterialWeightMap::const_iterator iter;
153 density1 = mat1->getDensity();
157 density1 = mat1->getDensity();
163 density2 = mat2->getDensity();
167 density2 = mat2->getDensity();
171 double weight1 = density1 * volume1;
172 double weight2 = density2 * volume2;
173 double invWeightTot = 1.0 / (weight1 + weight2);
175 double density = (weight1 + weight2) / volumeTot;
177 double frac1 = weight1 / (weight1 + weight2);
178 double frac2 = weight2 / (weight1 + weight2);
179 double density_2 = 1.0 / (frac1 / density1 + frac2 / density2);
180 double density_3 = (weight1 + weight2) / (volume1 + volume2);
186 baseMaterials.push_back(matName1);
187 baseMaterials.push_back(matName2);
188 fracWeight.push_back(weight1 * invWeightTot);
189 fracWeight.push_back(weight2 * invWeightTot);
191 return getMaterial(newMatName, baseMaterials, fracWeight, density);
◆ getElement()
const GeoElement * InDetMaterialManager::getElement |
( |
const std::string & |
elementName | ) |
|
Get element from GeoModel material manager.
Definition at line 86 of file InDetMaterialManager.cxx.
88 std::string errorMessage(
"Null pointer to Stored Material Manager!");
90 throw std::runtime_error(errorMessage);
◆ getExtraScaleFactor()
double InDetMaterialManager::getExtraScaleFactor |
( |
const std::string & |
materialName | ) |
|
|
private |
Definition at line 992 of file InDetMaterialManager.cxx.
999 ExtraScaleFactorMap::const_iterator iter =
m_scalingMap.find(materialName);
1001 return iter->second;
1006 if (iter !=
m_scalingMap.end() && materialName !=
"std::Air" && materialName !=
"std::Vacuum") {
1007 return iter->second;
◆ 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 206 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 460 of file InDetMaterialManager.cxx.
477 MaterialWeightMap::const_iterator iter;
479 const std::string& materialBase = iter->second.name;
480 double weight = iter->second.weight;
481 double density =
weight / volume;
482 if (iter->second.linearWeightFlag) {
483 ATH_MSG_ERROR(
"Material defined by linear weight cannot be created with getMaterialForVolume method: " <<
487 ATH_MSG_VERBOSE(
"Found material in weight table - name, base, weight(g), volume(cm3), density(g/cm3): "
488 << materialName <<
", "
489 << materialBase <<
", "
494 if (materialBase.empty()) {
498 return getMaterial(materialBase, density, materialName);
506 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 514 of file InDetMaterialManager.cxx.
532 if (volume <= 0 ||
length <= 0) {
538 std::pair<MaterialCompositionMap::const_iterator, MaterialCompositionMap::const_iterator> iterRange;
541 ATH_MSG_VERBOSE(
"Found material in material composition table:" << materialName);
543 std::vector<double> factors;
544 std::vector<std::string> components;
545 for (MaterialCompositionMap::const_iterator iter = iterRange.first; iter != iterRange.second; ++iter) {
546 double factorTmp = iter->second.factor;
547 if (iter->second.actualLength > 0) factorTmp *= iter->second.actualLength /
length;
548 factors.push_back(factorTmp);
549 components.push_back(iter->second.name);
555 MaterialWeightMap::const_iterator iter;
557 const std::string& materialBase = iter->second.name;
558 double weight = iter->second.weight;
559 double density =
weight / volume;
562 if (materialBase.empty()) {
570 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 578 of file InDetMaterialManager.cxx.
583 std::vector<std::string> tmpMaterialComponents(1, materialComponent);
584 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 589 of file InDetMaterialManager.cxx.
595 if (volume <= 0 ||
length <= 0) {
600 if (!factors.empty() && factors.size() < materialComponents.size()) {
601 ATH_MSG_WARNING(
"getMaterialForVolumeLength: factor vector size too small. Setting remaining factors to 1.");
604 std::vector<std::string> baseMaterials;
605 std::vector<double> fracWeight;
606 baseMaterials.reserve(materialComponents.size());
607 fracWeight.reserve(materialComponents.size());
609 double totWeight = 0;
610 for (
unsigned int iComp = 0; iComp < materialComponents.size(); ++iComp) {
611 const std::string& materialName = materialComponents[iComp];
614 MaterialWeightMap::const_iterator iter;
616 const std::string& materialBase = iter->second.name;
617 double weight = iter->second.weight;
619 if (iComp < factors.size()) {
624 <<
" factor " << factors[iComp]
626 <<
" basMat " << materialBase
627 <<
" linear? " << iter->second.linearWeightFlag);
630 if (materialBase.empty()) {
632 baseMaterials.push_back(materialName);
634 baseMaterials.push_back(materialBase);
636 fracWeight.push_back(
weight);
655 baseMaterials.push_back(materialName);
656 fracWeight.push_back(
weight);
663 for (
unsigned int i = 0;
i < materialComponents.size(); ++
i) {
669 for (
unsigned int i = 0;
i < fracWeight.size(); ++
i) {
670 fracWeight[
i] /= totWeight;
672 double density = totWeight / volume;
◆ getMaterialInternal() [1/3]
const GeoMaterial * InDetMaterialManager::getMaterialInternal |
( |
const std::string & |
materialName | ) |
|
|
private |
Definition at line 106 of file InDetMaterialManager.cxx.
113 std::string errorMessage(
"Null pointer to Stored Material Manager!");
115 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 726 of file InDetMaterialManager.cxx.
730 const GeoMaterial* newMaterial =
nullptr;
739 newMaterial = material;
741 GeoMaterial* newMaterialTmp =
new GeoMaterial(
name, density);
742 for (
unsigned int i = 0;
i < materialComponents.size();
i++) {
745 newMaterialTmp->add(
const_cast<GeoMaterial*
>(origMaterial), fracWeight[
i]);
747 ATH_MSG_ERROR(
"Material component missing " << materialComponents[
i]);
751 newMaterial = newMaterialTmp;
◆ getMaterialInternal() [3/3]
const GeoMaterial * InDetMaterialManager::getMaterialInternal |
( |
const std::string & |
origMaterialName, |
|
|
double |
density, |
|
|
const std::string & |
newName = "" |
|
) |
| |
|
private |
Definition at line 214 of file InDetMaterialManager.cxx.
217 std::string newName2 =
newName;
218 bool newNameProvided = !newName2.empty();
219 if (!newNameProvided) {
220 newName2 = origMaterialName +
"Modified";
223 const GeoMaterial* newMaterial =
nullptr;
233 newMaterial = material;
236 newMaterial = origMaterial;
240 if (newNameProvided || !
compareDensity(origMaterial->getDensity(), density)) {
242 GeoMaterial* newMaterialTmp =
new GeoMaterial(newName2, density);
243 newMaterialTmp->add(
const_cast<GeoMaterial*
>(origMaterial), 1.);
245 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 261 of file InDetMaterialManager.cxx.
265 if (scaleFactor > 1000 || scaleFactor < 0.001) {
266 ATH_MSG_ERROR(
"Scale factor must be between 0.001 and 1000.");
274 if (
newName.empty() && scaleFactor == 1.)
return origMaterial;
276 const GeoMaterial* newMaterial =
nullptr;
279 double density = origMaterial->getDensity() * scaleFactor;
280 std::string newName2 =
newName;
281 if (newName2.empty()) {
283 int scaleInt =
static_cast<int>(scaleFactor * 10000);
284 int scale1 = scaleInt / 10000;
285 int scale2 = scaleInt % 10000;
287 std::ostringstream
os;
288 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)
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)