ATLAS Offline Software
InDetMaterialManager.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3  */
4 
8 #include "GeoModelKernel/GeoIntrusivePtr.h"
9 #include "GeoModelKernel/GeoMaterial.h"
10 #include "GeoModelKernel/GeoElement.h"
11 #include "GeoModelKernel/Units.h"
12 #include "GaudiKernel/SystemOfUnits.h"
16 #include "StoreGate/StoreGateSvc.h"
17 
18 #include <iostream>
19 #include <iomanip>
20 #include <cmath>
21 #include <stdexcept>
22 
23 // Constructor
24 InDetMaterialManager::InDetMaterialManager(const std::string& managerName,
26  : AthMessaging(managerName),
27  m_managerName(managerName),
28  m_extraFunctionality(false),
29  m_athenaComps(nullptr) {
31 }
32 
33 // Constructor
34 InDetMaterialManager::InDetMaterialManager(const std::string& managerName,
36  const IRDBRecordset_ptr& weightTable,
37  const std::string& space,
38  bool extraFunctionality)
39  : AthMessaging(managerName),
40  m_managerName(managerName),
41  m_extraFunctionality(extraFunctionality),
42  m_athenaComps(nullptr) {
44 
45  if (weightTable) addWeightTable(weightTable, space);
46 
47  // For testing we add a few materials.
48  //m_weightMap["sct::CoolingBlock"] = MaterialByWeight(2.418*CLHEP::gram);
49  //m_weightMap["sct::CoolingBlock"] = MaterialByWeight(2*CLHEP::gram);
50  //m_weightMap["sct::BrlHybrid"] = MaterialByWeight("sct::Hybrid", 8*CLHEP::gram);
51  //m_weightMap["sct::FwdHybrid"] = MaterialByWeight("std::Carbon", 7.662*CLHEP::gram);
52 }
53 
55  const IRDBRecordset_ptr& weightTable,
56  const IRDBRecordset_ptr& compositionTable,
57  const std::string& space)
58  : AthMessaging(managerName),
59  m_managerName(managerName),
60  m_extraFunctionality(true),
61  m_athenaComps(nullptr) {
63 
64  if (weightTable) addWeightTable(weightTable, space);
65  if (compositionTable) addCompositionTable(compositionTable, space);
66 }
67 
68 InDetMaterialManager::InDetMaterialManager(const std::string& managerName,
69  InDetDD::AthenaComps* athenaComps)
70  : AthMessaging(managerName),
71  m_managerName(managerName),
72  m_extraFunctionality(true),
73  m_athenaComps(athenaComps) {
74  m_materialManager = retrieveManager(athenaComps->detStore());
76 }
77 
79 
82  return detStore->tryRetrieve<StoredMaterialManager>("MATERIALS");
83 }
84 
85 const GeoElement*
86 InDetMaterialManager::getElement(const std::string& elementName) {
87  if(!m_materialManager) {
88  std::string errorMessage("Null pointer to Stored Material Manager!");
89  ATH_MSG_FATAL(errorMessage);
90  throw std::runtime_error(errorMessage);
91  }
92  return m_materialManager->getElement(elementName);
93 }
94 
95 const GeoMaterial*
96 InDetMaterialManager::getMaterial(const std::string& materialName) {
97  return extraScaledMaterial(materialName, getMaterialInternal(materialName));
98 }
99 
100 bool
101 InDetMaterialManager::hasMaterial(const std::string& materialName) const {
102  return m_weightMap.find(materialName) != m_weightMap.end();
103 }
104 
105 const GeoMaterial*
106 InDetMaterialManager::getMaterialInternal(const std::string& materialName) {
107  // First check local store of materials. If not found then get it from the GeoModel
108  // manager.
109  const GeoMaterial* material = getAdditionalMaterial(materialName);
110 
111  if (!material) {
112  if(!m_materialManager) {
113  std::string errorMessage("Null pointer to Stored Material Manager!");
114  ATH_MSG_FATAL(errorMessage);
115  throw std::runtime_error(errorMessage);
116  }
117  // This prints error message if not found.
118  material = m_materialManager->getMaterial(materialName);
119  }
120  return material;
121 }
122 
123 const GeoMaterial*
124 InDetMaterialManager::getAdditionalMaterial(const std::string& materialName) const {
125  MaterialStore::const_iterator iter;
126  if ((iter = m_store.find(materialName)) != m_store.end()) {
127  return iter->second;
128  } else {
129  return nullptr;
130  }
131 }
132 
133 const GeoMaterial*
135  const double volumeTot,
136  const double volume1, const std::string& matName1,
137  const double volume2, const std::string& matName2
138  ) {
139  std::vector<std::string> baseMaterials;
140  std::vector<double> fracWeight;
141  baseMaterials.reserve(2);
142  fracWeight.reserve(2);
143 
144  ATH_MSG_DEBUG("Composite material : " << volumeTot / Gaudi::Units::cm3 << " = " << volume1 / Gaudi::Units::cm3
145  << " + " << volume2 / Gaudi::Units::cm3);
146  ATH_MSG_DEBUG("Composite material : " << matName1 << " " << matName2);
147 
148  double density1, density2;
149 
150  MaterialWeightMap::const_iterator iter;
151  if ((iter = m_weightMap.find(matName1)) != m_weightMap.end()) {
152  const GeoMaterial* mat1 = getMaterialForVolume(matName1, volume1);
153  density1 = mat1->getDensity();
154  ATH_MSG_DEBUG("Composite material 1 - weight : " << density1 / (GeoModelKernelUnits::gram / Gaudi::Units::cm3));
155  } else {
156  const GeoMaterial* mat1 = getMaterial(matName1);
157  density1 = mat1->getDensity();
158  ATH_MSG_DEBUG("Composite material 1 - standard : " << density1 / (GeoModelKernelUnits::gram / Gaudi::Units::cm3));
159  }
160 
161  if ((iter = m_weightMap.find(matName2)) != m_weightMap.end()) {
162  const GeoMaterial* mat2 = getMaterialForVolume(matName2, volume2);
163  density2 = mat2->getDensity();
164  ATH_MSG_DEBUG("Composite material 2 - weight : " << density2 / (GeoModelKernelUnits::gram / Gaudi::Units::cm3));
165  } else {
166  const GeoMaterial* mat2 = getMaterial(matName2);
167  density2 = mat2->getDensity();
168  ATH_MSG_DEBUG("Composite material 2 - standard : " << density2 / (GeoModelKernelUnits::gram / Gaudi::Units::cm3));
169  }
170 
171  double weight1 = density1 * volume1;
172  double weight2 = density2 * volume2;
173  double invWeightTot = 1.0 / (weight1 + weight2);
174 
175  double density = (weight1 + weight2) / volumeTot;
176 
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);
181  ATH_MSG_DEBUG("-> weights : " << weight1 / (GeoModelKernelUnits::gram) << " " << weight2 / (GeoModelKernelUnits::gram));
182  ATH_MSG_DEBUG("-> density : " << density / (GeoModelKernelUnits::gram / Gaudi::Units::cm3) << " " << density_2 /
184 
185 
186  baseMaterials.push_back(matName1);
187  baseMaterials.push_back(matName2);
188  fracWeight.push_back(weight1 * invWeightTot);
189  fracWeight.push_back(weight2 * invWeightTot);
190 
191  return getMaterial(newMatName, baseMaterials, fracWeight, density);
192 }
193 
194 // This creates a new material with specified density.
195 
196 // If a newName is supplied it creates the new material even if the orginal material
197 // has the same density. It however first checks if the material with NewName exists.
198 
199 // If no new name is supplied then it checks the density of
200 // the existing material. If it is consistent it returns the material.
201 // If it is different it creates a material with the string "Modified" added to the
202 // name.
203 
204 
205 const GeoMaterial*
206 InDetMaterialManager::getMaterial(const std::string& origMaterialName,
207  double density,
208  const std::string& newName) {
209  return extraScaledMaterial(origMaterialName, newName,
210  getMaterialInternal(origMaterialName, density, newName));
211 }
212 
213 const GeoMaterial*
214 InDetMaterialManager::getMaterialInternal(const std::string& origMaterialName,
215  double density,
216  const std::string& newName) {
217  std::string newName2 = newName;
218  bool newNameProvided = !newName2.empty();
219  if (!newNameProvided) {
220  newName2 = origMaterialName + "Modified";
221  }
222 
223  const GeoMaterial* newMaterial = nullptr;
224 
225  // First see if we already have the modified material
226  const GeoMaterial* material = getAdditionalMaterial(newName2);
227  if (material) {
228  if (!compareDensity(material->getDensity(), density)) {
229  ATH_MSG_WARNING("Density is not consistent for material " << newName2
230  << " " << material->getDensity() / (GeoModelKernelUnits::gram / Gaudi::Units::cm3)
231  << " / " << density / (GeoModelKernelUnits::gram / Gaudi::Units::cm3));
232  }
233  newMaterial = material;
234  } else {
235  const GeoMaterial* origMaterial = getMaterialInternal(origMaterialName);
236  newMaterial = origMaterial;
237  if (origMaterial) {
238  // If no new name was provided we check if the density is compatible
239  // and if so we return the original material.
240  if (newNameProvided || !compareDensity(origMaterial->getDensity(), density)) {
241  // create new material
242  GeoMaterial* newMaterialTmp = new GeoMaterial(newName2, density);
243  newMaterialTmp->add(const_cast<GeoMaterial*>(origMaterial), 1.);
244  addMaterial(newMaterialTmp);
245  newMaterial = newMaterialTmp;
246  }
247  }
248  }
249  return newMaterial;
250 }
251 
252 const GeoMaterial*
253 InDetMaterialManager::getMaterialScaled(const std::string& origMaterialName,
254  double scaleFactor,
255  const std::string& newName) {
256  return extraScaledMaterial(origMaterialName, newName,
257  getMaterialScaledInternal(origMaterialName, scaleFactor, newName));
258 }
259 
260 const GeoMaterial*
261 InDetMaterialManager::getMaterialScaledInternal(const std::string& origMaterialName,
262  double scaleFactor,
263  const std::string& newName) {
264  // Don't allow large scale factors
265  if (scaleFactor > 1000 || scaleFactor < 0.001) {
266  ATH_MSG_ERROR("Scale factor must be between 0.001 and 1000.");
267  return nullptr;
268  }
269 
270  const GeoMaterial* origMaterial = getMaterialInternal(origMaterialName);
271 
272  // If scalefactor is 1 and no new name is requested
273  // then just return the orginal material
274  if (newName.empty() && scaleFactor == 1.) return origMaterial;
275 
276  const GeoMaterial* newMaterial = nullptr;
277 
278  if (origMaterial) {
279  double density = origMaterial->getDensity() * scaleFactor;
280  std::string newName2 = newName;
281  if (newName2.empty()) {
282  // Create name using the scale factor.
283  int scaleInt = static_cast<int>(scaleFactor * 10000);
284  int scale1 = scaleInt / 10000;
285  int scale2 = scaleInt % 10000;
286 
287  std::ostringstream os;
288  os << origMaterialName << scale1 << "_" << std::setw(4) << std::setfill('0') << scale2;
289  newName2 = os.str();
290  }
291 
292  newMaterial = getMaterialInternal(origMaterialName, density, newName2);
293  }
294 
295  return newMaterial;
296 }
297 
298 void
299 InDetMaterialManager::addMaterial(GeoMaterial* material) {
300  GeoIntrusivePtr<const GeoMaterial> matPtr{material};
301  std::string name(material->getName());
302  if (m_store.find(name) != m_store.end()) {
303  ATH_MSG_WARNING("Ignoring attempt to redefine an existing material: " << name);
304  // Delete the material if it is not already ref counted.
305  //std::cout << m_store[name] << std::endl;
306  } else {
307  material->lock();
308  m_store[name] = matPtr;
309 
310  ATH_MSG_DEBUG("Created new material: " << name << ", " << material->getDensity() /
311  (Gaudi::Units::g / Gaudi::Units::cm3) << " g/cm3");
312  }
313 }
314 
315 bool
317  return(std::abs(d1 / d2 - 1.) < 1e-5);
318 }
319 
320 void
321 InDetMaterialManager::addWeightTable(const IRDBRecordset_ptr& weightTable, const std::string& space) {
322  ATH_MSG_DEBUG("Reading in weight table: " << weightTable->nodeName());
323  // If not using geometryDBSvc revert to old version
324  if (!db()) {
325  ATH_MSG_DEBUG("GeometryDBSvc not available. Using old version.");
326  addWeightTableOld(weightTable, space);
327  return;
328  }
329  for (unsigned int i = 0; i < db()->getTableSize(weightTable); i++) {
330  std::string materialName = db()->getString(weightTable, "MATERIAL", i);
331  if (!space.empty()) {
332  materialName = space + "::" + materialName;
333  }
334  std::string materialBase;
335  if (db()->testField(weightTable, "BASEMATERIAL", i)) {
336  materialBase = db()->getString(weightTable, "BASEMATERIAL", i);
337  }
338  double weight = db()->getDouble(weightTable, "WEIGHT", i) * GeoModelKernelUnits::gram;
339  //std::cout << materialName << " " << materialBase << " " << weight/CLHEP::g << std::endl;
340 
341  bool linearWeightFlag = false;
342  if (m_extraFunctionality && db()->testField(weightTable, "LINWEIGHTFLAG", i)) {
343  linearWeightFlag = db()->getInt(weightTable, "LINWEIGHTFLAG", i);
344  }
345 
346  if (m_weightMap.find(materialName) != m_weightMap.end()) {
347  ATH_MSG_WARNING("Material: " << materialName << " already exists in weight table");
348  } else {
349  ATH_MSG_DEBUG("Adding " << materialName
350  << " weight " << weight
351  << " linearWeightFlag " << linearWeightFlag
352  << " raw weight " << db()->getDouble(weightTable, "WEIGHT", i)
353  << " m_extraFunctionality " << m_extraFunctionality
354  << " to weight table");
355  m_weightMap[materialName] = MaterialByWeight(materialBase, weight, linearWeightFlag);
356  }
357  }
358 }
359 
360 void
361 InDetMaterialManager::addWeightMaterial(const std::string& materialName, const std::string& materialBase, double weight,
362  int linearWeightFlag) {
363  // Weight in gr
365 
366  if (m_weightMap.find(materialName) != m_weightMap.end()) {
367  ATH_MSG_WARNING("Material: " << materialName << " already exists in weight table");
368  } else {
369  ATH_MSG_DEBUG("Adding " << materialName
370  << " weight " << weight
371  << " linearWeightFlag " << linearWeightFlag
372  << " to weight table");
373  m_weightMap[materialName] = MaterialByWeight(materialBase, weight, linearWeightFlag);
374  }
375 }
376 
377 void
378 InDetMaterialManager::addWeightTableOld(const IRDBRecordset_ptr& weightTable, const std::string& space) {
379  for (unsigned int i = 0; i < weightTable->size(); i++) {
380  const IRDBRecord* record = (*weightTable)[i];
381  std::string materialName = record->getString("MATERIAL");
382  if (!space.empty()) {
383  materialName = space + "::" + materialName;
384  }
385  std::string materialBase;
386  if (!record->isFieldNull("BASEMATERIAL")) {
387  materialBase = record->getString("BASEMATERIAL");
388  }
389  double weight = record->getDouble("WEIGHT") * GeoModelKernelUnits::gram;
390  //std::cout << materialName << " " << materialBase << " " << weight/CLHEP::g << std::endl;
391 
392  bool linearWeightFlag = false;
393  if (m_extraFunctionality) {
394  linearWeightFlag = record->getInt("LINWEIGHTFLAG");
395  }
396 
397  if (m_weightMap.find(materialName) != m_weightMap.end()) {
398  ATH_MSG_WARNING("Material: " << materialName << " already exists in weight table");
399  } else {
400  m_weightMap[materialName] = MaterialByWeight(materialBase, weight, linearWeightFlag);
401  }
402  }
403 }
404 
405 void
406 InDetMaterialManager::addCompositionTable(const IRDBRecordset_ptr& compositionTable, const std::string& space) {
407  ATH_MSG_DEBUG("Reading in composition table: " << compositionTable->nodeName());
408 
409  if (!db()) {
410  ATH_MSG_ERROR("GeometryDBSvc not available. Unable to read in composition table.");
411  }
412  for (unsigned int i = 0; i < db()->getTableSize(compositionTable); i++) {
413  std::string materialName = db()->getString(compositionTable, "MATERIAL", i);
414  if (!space.empty()) {
415  materialName = space + "::" + materialName;
416  }
417 
418  std::string componentName = db()->getString(compositionTable, "COMPONENT", i);
419  int count = db()->getInt(compositionTable, "COUNT", i);
420  double factor = db()->getDouble(compositionTable, "FACTOR", i);
421  double actualLength = db()->getDouble(compositionTable, "ACTUALLENGTH", i);
422 
423  m_matCompositionMap.insert(std::pair<std::string, MaterialComponent>(materialName,
424  MaterialComponent(componentName,
425  count * factor,
426  actualLength)));
427  }
428 }
429 
430 void
432  if (!scalingTable) return;
433 
434  if (db()->getTableSize(scalingTable) == 0) return;
435 
436  ATH_MSG_DEBUG("Reading in extra material scaling table: " << scalingTable->nodeName());
437  if (!db()) {
438  ATH_MSG_ERROR("GeometryDBSvc not available. Unable to read in scaling table.");
439  }
440  for (unsigned int i = 0; i < db()->getTableSize(scalingTable); i++) {
441  std::string materialName = db()->getString(scalingTable, "MATERIAL", i);
442  double scalingFactor = db()->getDouble(scalingTable, "FACTOR", i);
443 
444  if (msgLvl(MSG::DEBUG)) {
445  if (scalingFactor >= 0 || scalingFactor == 1) {
446  msg(MSG::DEBUG) << "Material " << materialName << " will be scaled by: " << scalingFactor << endmsg;
447  } else {
448  // -ve or scalefactor = 1 means will not be scaled.
449  msg(MSG::DEBUG) << "Material " << materialName << " will be NOT be scaled." << endmsg;
450  }
451  }
452  if (m_scalingMap.find(materialName) != m_scalingMap.end()) {
453  ATH_MSG_WARNING("Overriding material: " << materialName << " which already exists in scaling table");
454  }
455  m_scalingMap[materialName] = scalingFactor;
456  }
457 }
458 
459 const GeoMaterial*
460 InDetMaterialManager::getMaterialForVolume(const std::string& materialName, double volume, const std::string& newName) {
461  // Make sure we have a valid volume size.
462  if (volume <= 0) {
463  ATH_MSG_ERROR("Invalid volume : " << volume);
464  return nullptr;
465  }
466 
467  // Find if material is in the weight table.
468  // If so we use the information to create a material with the
469  // density calculated from the volume and weight. If a base material
470  // is specified in the weight table, then a new material is made
471  // which is the same as the base material but with the new
472  // density. If no base material is specified then there should be a
473  // material already existing with that name. If the existing material already has the
474  // correct density it is used, otherwise a new material is created
475  // with the string "Modified" added to the material name.
476 
477  MaterialWeightMap::const_iterator iter;
478  if ((iter = m_weightMap.find(materialName)) != m_weightMap.end()) {
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: " <<
484  materialName);
485  }
486 
487  ATH_MSG_VERBOSE("Found material in weight table - name, base, weight(g), volume(cm3), density(g/cm3): "
488  << materialName << ", "
489  << materialBase << ", "
490  << weight / GeoModelKernelUnits::gram << ", "
491  << volume / Gaudi::Units::cm3 << ", "
492  << density / (Gaudi::Units::g / Gaudi::Units::cm3));
493 
494  if (materialBase.empty()) {
495  return getMaterial(materialName, density, newName);
496  } else {
497  if (newName.empty()) {
498  return getMaterial(materialBase, density, materialName);
499  } else {
500  return getMaterial(materialBase, density, newName);
501  }
502  }
503  } else {
504  // If not in the weight table we just return the material.
505  // This is not an error.
506  ATH_MSG_VERBOSE("Material not in weight table, using standard material: "
507  << materialName
508  << ", volume(cm3) = " << volume / Gaudi::Units::cm3);
509  return getMaterial(materialName);
510  }
511 }
512 
513 const GeoMaterial*
514 InDetMaterialManager::getMaterialForVolumeLength(const std::string& materialName, double volume, double length,
515  const std::string& newName) {
516  // In the case there is no material composition table (MaterialCompositionMap) and no linear weights are used this
517  // will
518  // behave the same way as getMaterialForVolume.
519  // If the material is in the MaterialCompositionMap it will build a material using the components
520  // from that table. If any components are defined as a linear weight the length is used to calculate the
521  // weight (ie linear weight * length).
522 
523 
524  std::string name;
525  if (newName.empty()) {
526  name = materialName;
527  } else {
528  name = newName;
529  }
530 
531  // Make sure we have a valid volume size.
532  if (volume <= 0 || length <= 0) {
533  ATH_MSG_ERROR("Invalid volume or length : " << volume << ", " << length);
534  return nullptr;
535  }
536 
537  // First look in the predefinded collections
538  std::pair<MaterialCompositionMap::const_iterator, MaterialCompositionMap::const_iterator> iterRange;
539  iterRange = m_matCompositionMap.equal_range(materialName);
540  if (iterRange.first != m_matCompositionMap.end()) {
541  ATH_MSG_VERBOSE("Found material in material composition table:" << materialName);
542 
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);
550  }
551  return getMaterialForVolumeLength(name, components, factors, volume, length);
552  }
553 
554  // Next look in weight table
555  MaterialWeightMap::const_iterator iter;
556  if ((iter = m_weightMap.find(materialName)) != m_weightMap.end()) {
557  const std::string& materialBase = iter->second.name;
558  double weight = iter->second.weight;
559  double density = weight / volume;
560  if (iter->second.linearWeightFlag) weight *= length;
561 
562  if (materialBase.empty()) {
563  return getMaterial(materialName, density, newName);
564  } else {
565  return getMaterial(materialBase, density, name);
566  }
567  } else {
568  // Otherwise we just return the material.
569  // This is not an error.
570  ATH_MSG_VERBOSE("Material not in weight table, using standard material: "
571  << materialName
572  << ", volume(cm3) = " << volume / Gaudi::Units::cm3);
573  return getMaterial(materialName);
574  }
575 }
576 
577 const GeoMaterial*
579  const std::string& materialComponent,
580  double factor,
581  double volume,
582  double length) {
583  std::vector<std::string> tmpMaterialComponents(1, materialComponent);
584  std::vector<double> tmpFactors(1, factor);
585  return getMaterialForVolumeLength(name, tmpMaterialComponents, tmpFactors, volume, length);
586 }
587 
588 const GeoMaterial*
590  const std::vector<std::string>& materialComponents,
591  const std::vector<double>& factors,
592  double volume,
593  double length) {
594  // Make sure we have a valid volume size.
595  if (volume <= 0 || length <= 0) {
596  ATH_MSG_ERROR("Invalid volume or length : " << volume << ", " << length);
597  return nullptr;
598  }
599 
600  if (!factors.empty() && factors.size() < materialComponents.size()) {
601  ATH_MSG_WARNING("getMaterialForVolumeLength: factor vector size too small. Setting remaining factors to 1.");
602  }
603 
604  std::vector<std::string> baseMaterials;
605  std::vector<double> fracWeight;
606  baseMaterials.reserve(materialComponents.size());
607  fracWeight.reserve(materialComponents.size());
608 
609  double totWeight = 0;
610  for (unsigned int iComp = 0; iComp < materialComponents.size(); ++iComp) {
611  const std::string& materialName = materialComponents[iComp];
612 
613  // First search in MaterialWeightMap
614  MaterialWeightMap::const_iterator iter;
615  if ((iter = m_weightMap.find(materialName)) != m_weightMap.end()) {
616  const std::string& materialBase = iter->second.name;
617  double weight = iter->second.weight;
618 
619  if (iComp < factors.size()) {
620  weight *= factors[iComp];
621  }
622  ATH_MSG_DEBUG("Material " << materialName
623  << " found in weight table, weight " << iter->second.weight / GeoModelKernelUnits::gram
624  << " factor " << factors[iComp]
625  << " w*fac*len " << weight * length / GeoModelKernelUnits::gram
626  << " basMat " << materialBase
627  << " linear? " << iter->second.linearWeightFlag);
628 
629  if (iter->second.linearWeightFlag) weight *= length;
630  if (materialBase.empty()) {
631  // If no base material then name should refer to an already defined material
632  baseMaterials.push_back(materialName);
633  } else {
634  baseMaterials.push_back(materialBase);
635  }
636  fracWeight.push_back(weight); // Will be normalized later.
637  totWeight += weight;
638  } else {
639  // If not in the weight table we look for a regular material.
640  // I don't think this would normally be intentional so we give a warning message.
641  /*
642  if (msgLvl(MSG::WARNING))
643  msg(MSG::WARNING)
644  << "Component material not in weight table, using standard material: "
645  << materialName << " with weight= "
646  << factors.at(iComp) * length
647  << endmsg;
648  const GeoMaterial * material = getMaterialInternal(materialName);
649  */
650 
651  // In this case the factor should correspond to the linear weight
652  double weight = factors.at(iComp) * length * GeoModelKernelUnits::gram;
653 
654  // If material not found, will get error message when attempting to make the material. So carry on here.
655  baseMaterials.push_back(materialName);
656  fracWeight.push_back(weight);
657  totWeight += weight;
658  }
659  }
660 
661  if (msgLvl(MSG::VERBOSE)) {
662  msg(MSG::VERBOSE) << "Creating material from multiple components: " << name << endmsg;
663  for (unsigned int i = 0; i < materialComponents.size(); ++i) {
664  msg(MSG::VERBOSE) << " Component " << i << ": Name = " << baseMaterials[i]
665  << " Weight(g) = " << fracWeight[i] / Gaudi::Units::g << endmsg;
666  }
667  }
668 
669  for (unsigned int i = 0; i < fracWeight.size(); ++i) {
670  fracWeight[i] /= totWeight;
671  }
672  double density = totWeight / volume;
673 
674  return getMaterial(name, baseMaterials, fracWeight, density);
675 }
676 
677 // Add materials assuming they simply occupy the same volume.
678 /*
679  const GeoMaterial*
680  InDetMaterialManager::getMaterial(const std::vector<const GeoMaterial *> & materialComponents,
681  const std::string & newName)
682  {
683  const GeoMaterial * newMaterial = 0;
684  std::vector<double> fracWeight;
685  fracWeight.reserve(materialComponents.size());
686 
687  for (unsigned int i = 0; i < materialComponents.size(); i++) {
688  const GeoMaterial * origMaterial = materialComponents[i];
689  double weight = origMaterial->getDensity();
690  fracWeight.push_back(weight);
691  totWeight += weight;
692  }
693  for (unsigned int i = 0; i < fracWeight.size(); ++i) {
694  fracWeight[i] /= totWeight;
695  }
696  return getMaterial(materialComponents, fracWeight, totWeight, newName);
697  }
698 
699  const GeoMaterial*
700  InDetMaterialManager::getMaterial(const std::vector<std::string> & materialComponents,
701  const std::string & newName)
702  {
703  const GeoMaterial * newMaterial = 0;
704 
705  // First see if we already have the modified material
706  const GeoMaterial* material = getAdditionalMaterial(newName);
707 
708  for (unsigned int i = 0; i < materialComponents.size(); i++) {
709  const GeoMaterial * origMaterial = getMaterial(materialComponents[i]);
710  components.push_back(origMaterial);
711  }
712  return getMaterial(components, newName);
713  }
714  */
715 
716 
717 const GeoMaterial*
719  const std::vector<std::string>& materialComponents,
720  const std::vector<double>& fracWeight,
721  double density) {
722  return extraScaledMaterial(name, getMaterialInternal(name, materialComponents, fracWeight, density));
723 }
724 
725 const GeoMaterial*
727  const std::vector<std::string>& materialComponents,
728  const std::vector<double>& fracWeight,
729  double density) {
730  const GeoMaterial* newMaterial = nullptr;
731 
732  // First see if we already have the material
733  const GeoMaterial* material = getAdditionalMaterial(name);
734 
735  if (material) {
736  if (!compareDensity(material->getDensity(), density)) {
737  ATH_MSG_WARNING("Density is not consistent for material " << name);
738  }
739  newMaterial = material;
740  } else {
741  GeoMaterial* newMaterialTmp = new GeoMaterial(name, density);
742  for (unsigned int i = 0; i < materialComponents.size(); i++) {
743  const GeoMaterial* origMaterial = getMaterialInternal(materialComponents[i]);
744  if (origMaterial) {
745  newMaterialTmp->add(const_cast<GeoMaterial*>(origMaterial), fracWeight[i]);
746  } else {
747  ATH_MSG_ERROR("Material component missing " << materialComponents[i]);
748  }
749  }
750  addMaterial(newMaterialTmp);
751  newMaterial = newMaterialTmp;
752  }
753  return newMaterial;
754 }
755 
756 const IGeometryDBSvc*
758  if (m_athenaComps) return m_athenaComps->geomDB();
759 
760  return nullptr;
761 }
762 
763 void
765  const std::string materialTable = "ExtraMaterials";
766  const std::string componentsTable = "ExtraMatComponents";
767 
768  // Look for tables ExtraMaterials and ExtraMatComponents.
769  // These are text file only tables where extra materials are desired or
770  // one wants to override some database ones.
771  if (!db() || !db()->testField("", "TableSize:" + materialTable) || !db()->getTableSize(materialTable)
772  || !db()->testField("", "TableSize:" + componentsTable) || !db()->getTableSize(componentsTable)) return;
773 
774 
775  ATH_MSG_INFO("Extra materials being read in from text file.");
776 
777  using MatMap = std::map<std::string, MaterialDef>;
778  MatMap materials;
779 
780  // read in material table
781  for (unsigned int iMat = 0; iMat < db()->getTableSize(materialTable); iMat++) {
782  std::string materialName = db()->getString(materialTable, "NAME", iMat);
783  double density = db()->getDouble(materialTable, "DENSITY", iMat) * Gaudi::Units::g / Gaudi::Units::cm3;
784  materials[materialName] = MaterialDef(materialName, density);
785  }
786 
787  // read in material component table
788  for (unsigned int iComp = 0; iComp < db()->getTableSize(componentsTable); iComp++) {
789  std::string materialName = db()->getString(componentsTable, "NAME", iComp);
790  std::string compName = db()->getString(componentsTable, "COMPNAME", iComp);
791  double fracWeight = db()->getDouble(componentsTable, "FRACTION", iComp);
792  MatMap::iterator iter = materials.find(materialName);
793  if (iter != materials.end()) {
794  iter->second.addComponent(compName, fracWeight);
795  } else {
796  ATH_MSG_ERROR("Attemp to add material component, " << compName << ", to non-existing material: "
797  << materialName);
798  }
799  }
800 
801  //Now create the materials
802  int matCount = 0;
803  int matCountLast = -1;
804  bool someUndefined = true;
805  // While there are still undefined materials keep creating materials.
806  // Check also that the matCount had change to avoid endless loop due to cyclicly
807  // defined materials.
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()) {
814  // Check if any components are materials in this table and if they are defined.
815  // If not flag that there are undefined materials and go to next material
816  bool compsDefined = true;
817  for (unsigned int iComp = 0; iComp < tmpMat.numComponents(); ++iComp) {
818  const std::string& compName = tmpMat.compName(iComp);
819  MatMap::iterator iter2 = materials.find(compName);
820  if (iter2 != materials.end()) {
821  if (!iter2->second.isCreated()) {
822  compsDefined = false;
823  break;
824  }
825  }
826  }
827  if (compsDefined) {
828  createMaterial(tmpMat);
829  tmpMat.setCreated();
830  matCount++;
831  } else {
832  someUndefined = true;
833  }
834  }
835  }
836  }
837 
838 
839  if (someUndefined) {
840  ATH_MSG_ERROR("Not all materials could be defined due to cyclic definitions");
841  }
842 }
843 
844 void
846  if (material.numComponents() == 0) {
847  ATH_MSG_ERROR("Material has no components: " << material.name());
848  return;
849  }
850 
851  // If total of fractions is greater than 1.1 then assume material is define by ratio of atoms.
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) {
858  // If component name has "::" in it then its not an element.
859  ATH_MSG_ERROR("Material, " << material.name() <<
860  ", is assumed to be defined by atomic ratio (due to total fraction > 1)"
861  " but component is not an element: " << material.compName(i));
862  return;
863  }
864  const GeoElement* element = getElement(material.compName(i));
865  if (!element) {
866  ATH_MSG_ERROR("Error making material " << material.name() << ". Element not found: " <<
867  material.compName(i));
868  return;
869  }
870  totWeight += material.fraction(i) * element->getA();
871  }
872  } else {
873  // Check if total fraction is close to 1.
874  if (std::abs(totWeight - 1) > 0.01) {
875  ATH_MSG_WARNING("Total fractional weight does not sum to 1. Will renormalize. Total = " << totWeight);
876  }
877  }
878  // Now build the material
879  GeoIntrusivePtr<GeoMaterial> newMaterial{new GeoMaterial(material.name(), material.density())};
880  ATH_MSG_DEBUG("Creating material: " << material.name() << " with density: "
881  << material.density() / (Gaudi::Units::g / Gaudi::Units::cm3));
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));
886  if (!element) {
887  ATH_MSG_ERROR("Error making material " << material.name() << ". Element not found: " << material.compName(i));
888  // delete the partially created material
889  return;
890  }
891  if (byAtomicRatio) {
892  fracWeight = material.fraction(i) * element->getA() / totWeight;
893  }
894  newMaterial->add(const_cast<GeoElement*>(element), fracWeight);
895  ATH_MSG_DEBUG(" Component: " << material.compName(i) << " " << fracWeight);
896  } else {
897  GeoIntrusivePtr<const GeoMaterial> materialTmp{getMaterialInternal(material.compName(i))};
898  if (!materialTmp) {
899  ATH_MSG_ERROR("Error making material " << material.name() << ". Component not found: " << material.compName(i));
900  // delete the partially created material
901  return;
902  }
903  if (byAtomicRatio) {
904  // Should not happen as already checked that all components were elements.
905  ATH_MSG_ERROR("Unexpected Error");
906  }
907  newMaterial->add(const_cast<GeoMaterial*>(materialTmp.get()), fracWeight);
908  ATH_MSG_DEBUG(" Component: " << material.compName(i) << " " << fracWeight);
909  }
910  }
911  newMaterial->lock();
912  addMaterial(newMaterial);
913 }
914 
916  : m_density(0),
917  m_created(false)
918 {}
919 
920 InDetMaterialManager::MaterialDef::MaterialDef(const std::string& name, double density)
921  : m_name(name),
922  m_density(density),
923  m_created(false)
924 {}
925 
926 void
927 InDetMaterialManager::MaterialDef::addComponent(const std::string& compName, double fraction) {
928  m_components.push_back(compName);
929  m_fractions.push_back(fraction);
930 }
931 
932 double
934  double sum = 0;
935 
936  for (unsigned int i = 0; i < m_fractions.size(); i++) {
937  sum += m_fractions[i];
938  }
939  return sum;
940 }
941 
942 // We need the original name as the GeoMaterial from the standard
943 // material manager has its namespace dropped. We have two versions
944 // of extraScaledMaterial. One where two names are provided. In this
945 // version if newName is not empty that is used, otherwise
946 // materialName is used. The other just has one name and that is the
947 // one that is used.
948 
949 const GeoMaterial*
950 InDetMaterialManager::extraScaledMaterial(const std::string& materialName,
951  const std::string& newName,
952  const GeoMaterial* origMaterial) {
953  if (newName.empty()) {
954  return extraScaledMaterial(materialName, origMaterial);
955  } else {
956  return extraScaledMaterial(newName, origMaterial);
957  }
958 }
959 
960 const GeoMaterial*
961 InDetMaterialManager::extraScaledMaterial(const std::string& materialName, const GeoMaterial* origMaterial) {
962  if (!origMaterial) throw std::runtime_error(std::string("Invalid material: ") + materialName);
963 
964  double scaleFactor = getExtraScaleFactor(materialName);
965  // -1 (or any -ve number) indicates material is not scaled. And if the scale factor
966  // is 1 then there is no need to create a new material.
967  if (scaleFactor < 0 || scaleFactor == 1 || materialName.find("Ether") != std::string::npos) return origMaterial;
968 
969  if (scaleFactor == 0) return getMaterialInternal("std::Vacuum");
970 
971  std::string newName = materialName + "_ExtraScaling";
972 
973  // Check if it is already made.
974  const GeoMaterial* newMaterial = getAdditionalMaterial(newName);
975 
976  // Already made so we return it.
977  if (newMaterial) return newMaterial;
978 
979  // Otherwise we need to make it.
980  double density = origMaterial->getDensity() * scaleFactor;
981 
982  // create new material
983  GeoMaterial* newMaterialTmp = new GeoMaterial(newName, density);
984  newMaterialTmp->add(const_cast<GeoMaterial*>(origMaterial), 1.);
985  addMaterial(newMaterialTmp);
986  newMaterial = newMaterialTmp;
987 
988  return newMaterial;
989 }
990 
991 double
992 InDetMaterialManager::getExtraScaleFactor(const std::string& materialName) {
993  // If name is found in map we return the corresponding scale factor.
994  // The special name "ALL" indicates all materials are scaled.
995  // Individual materials can be excluded from scaling by giving either
996  // a -ve scaling factor or just specifying a scaling factor of 1.
997  // A scaling factor of 0 means the material will be replaced by vacuum.
998 
999  ExtraScaleFactorMap::const_iterator iter = m_scalingMap.find(materialName);
1000  if (iter != m_scalingMap.end()) {
1001  return iter->second;
1002  } else {
1003  // Check for special names
1004  // ALL means everything scaled. Do not scale air or vacuum (unless explicity requested)
1005  iter = m_scalingMap.find("ALL");
1006  if (iter != m_scalingMap.end() && materialName != "std::Air" && materialName != "std::Vacuum") {
1007  return iter->second;
1008  }
1009  }
1010 
1011  // If not found then return -1 to indicate material is not to be scaled.
1012  return -1;
1013 }
IRDBRecord::getInt
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
InDetMaterialManager::addMaterial
void addMaterial(GeoMaterial *material)
Add material.
Definition: InDetMaterialManager.cxx:299
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
InDetMaterialManager::addWeightTable
void addWeightTable(const IRDBRecordset_ptr &weightTable, const std::string &space="")
Definition: InDetMaterialManager.cxx:321
AddEmptyComponent.compName
compName
Definition: AddEmptyComponent.py:32
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
InDetMaterialManager::MaterialDef::fraction
double fraction(unsigned int i) const
Definition: InDetMaterialManager.h:169
scale2
#define scale2
Definition: JetAttributeHisto.cxx:42
InDetMaterialManager::m_athenaComps
const InDetDD::AthenaComps * m_athenaComps
Definition: InDetMaterialManager.h:230
InDetMaterialManager::getAdditionalMaterial
const GeoMaterial * getAdditionalMaterial(const std::string &materialName) const
Definition: InDetMaterialManager.cxx:124
IGeometryDBSvc.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
InDetMaterialManager::m_materialManager
StoredMaterialManager * m_materialManager
Definition: InDetMaterialManager.h:212
IRDBRecord::getString
virtual const std::string & getString(const std::string &fieldName) const =0
Get string field value.
InDetDD::AthenaComps
Class to hold various Athena components.
Definition: InDetDDAthenaComps.h:21
StoredMaterialManager::getElement
virtual const GeoElement * getElement(const std::string &name)=0
cm3
#define cm3
InDetMaterialManager::MaterialDef::compName
const std::string & compName(unsigned int i) const
Definition: InDetMaterialManager.h:168
dq_defect_virtual_defect_validation.d1
d1
Definition: dq_defect_virtual_defect_validation.py:79
InDetMaterialManager::getMaterialScaledInternal
const GeoMaterial * getMaterialScaledInternal(const std::string &origMaterialName, double scaleFactor, const std::string &newName="")
Definition: InDetMaterialManager.cxx:261
InDetMaterialManager::MaterialDef::numComponents
unsigned int numComponents() const
Definition: InDetMaterialManager.h:164
python.SystemOfUnits.gram
int gram
Definition: SystemOfUnits.py:165
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
InDetMaterialManager::m_matCompositionMap
MaterialCompositionMap m_matCompositionMap
Definition: InDetMaterialManager.h:222
IGeometryDBSvc::getTableSize
virtual unsigned int getTableSize(IRDBRecordset_ptr recordSet) const =0
InDetMaterialManager::getMaterialInternal
const GeoMaterial * getMaterialInternal(const std::string &materialName)
Definition: InDetMaterialManager.cxx:106
InDetMaterialManager::MaterialDef::density
double density() const
Definition: InDetMaterialManager.h:167
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
InDetMaterialManager::addTextFileMaterials
void addTextFileMaterials()
Definition: InDetMaterialManager.cxx:764
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
InDetMaterialManager::MaterialByWeight
Definition: InDetMaterialManager.h:135
InDetMaterialManager::~InDetMaterialManager
~InDetMaterialManager()
InDetMaterialManager::MaterialDef::totalFraction
double totalFraction() const
Definition: InDetMaterialManager.cxx:933
InDetMaterialManager::m_store
MaterialStore m_store
Definition: InDetMaterialManager.h:216
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
InDetMaterialManager::MaterialDef::name
const std::string & name() const
Definition: InDetMaterialManager.h:166
InDetMaterialManager::MaterialDef::addComponent
void addComponent(const std::string &compName, double fraction)
Definition: InDetMaterialManager.cxx:927
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
AthMessaging::msgLvl
bool msgLvl(const MSG::Level lvl) const
Test the output level.
Definition: AthMessaging.h:151
lumiFormat.i
int i
Definition: lumiFormat.py:85
InDetMaterialManager::addWeightTableOld
void addWeightTableOld(const IRDBRecordset_ptr &weightTable, const std::string &space)
Definition: InDetMaterialManager.cxx:378
InDetMaterialManager::addCompositionTable
void addCompositionTable(const IRDBRecordset_ptr &compositionTable, const std::string &space="")
Definition: InDetMaterialManager.cxx:406
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDetMaterialManager::createMaterial
void createMaterial(const MaterialDef &material)
Definition: InDetMaterialManager.cxx:845
InDetMaterialManager::m_scalingMap
ExtraScaleFactorMap m_scalingMap
Definition: InDetMaterialManager.h:225
InDetMaterialManager::getMaterialForVolume
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.
Definition: InDetMaterialManager.cxx:460
IGeometryDBSvc
Definition: IGeometryDBSvc.h:21
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
InDetMaterialManager::m_extraFunctionality
bool m_extraFunctionality
Definition: InDetMaterialManager.h:228
InDetDDAthenaComps.h
InDetMaterialManager::getMaterialForVolumeLength
const GeoMaterial * getMaterialForVolumeLength(const std::string &materialName, double volume, double length, const std::string &newName="")
Definition: InDetMaterialManager.cxx:514
InDetMaterialManager::MaterialDef
Class to hold information need to create a material.
Definition: InDetMaterialManager.h:158
InDetMaterialManager::extraScaledMaterial
const GeoMaterial * extraScaledMaterial(const std::string &materialName, const std::string &newName, const GeoMaterial *origMaterial)
Definition: InDetMaterialManager.cxx:950
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
IGeometryDBSvc::getDouble
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.
Trk::MaterialComponent
std::pair< Material, double > MaterialComponent
Definition: VolumeConverter.h:31
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
InDetMaterialManager.h
InDetMaterialManager::getElement
const GeoElement * getElement(const std::string &elementName)
Get element from GeoModel material manager.
Definition: InDetMaterialManager.cxx:86
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
StoredMaterialManager.h
MakeNewFileFromOldAndSubstitution.newName
dictionary newName
Definition: ICHEP2016/MakeNewFileFromOldAndSubstitution.py:95
InDetMaterialManager::addWeightMaterial
void addWeightMaterial(const std::string &materialName, const std::string &materialBase, double weight, int linearWeightFlag)
Definition: InDetMaterialManager.cxx:361
InDetMaterialManager::addScalingTable
void addScalingTable(const IRDBRecordset_ptr &scalingTable)
Definition: InDetMaterialManager.cxx:431
InDetMaterialManager::InDetMaterialManager
InDetMaterialManager(const std::string &managerName, StoreGateSvc *detStore)
Definition: InDetMaterialManager.cxx:24
InDetMaterialManager::retrieveManager
StoredMaterialManager * retrieveManager(const StoreGateSvc *detStore)
Definition: InDetMaterialManager.cxx:81
InDetMaterialManager::MaterialDef::MaterialDef
MaterialDef()
Definition: InDetMaterialManager.cxx:915
InDetMaterialManager::getMaterialScaled
const GeoMaterial * getMaterialScaled(const std::string &origMaterialName, double scaleFactor, const std::string &newName="")
Definition: InDetMaterialManager.cxx:253
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
InDetDD::AthenaComps::geomDB
const IGeometryDBSvc * geomDB() const
Definition: InDetDDAthenaComps.h:63
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
IRDBRecord::isFieldNull
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
InDetMaterialManager::db
const IGeometryDBSvc * db()
Definition: InDetMaterialManager.cxx:757
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
InDetMaterialManager::MaterialDef::isCreated
bool isCreated() const
Definition: InDetMaterialManager.h:165
dq_defect_virtual_defect_validation.d2
d2
Definition: dq_defect_virtual_defect_validation.py:81
DEBUG
#define DEBUG
Definition: page_access.h:11
InDetMaterialManager::getExtraScaleFactor
double getExtraScaleFactor(const std::string &materialName)
Definition: InDetMaterialManager.cxx:992
IGeometryDBSvc::getInt
virtual int getInt(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const =0
StoredMaterialManager::getMaterial
virtual const GeoMaterial * getMaterial(const std::string &name)=0
StoredMaterialManager
This class holds one or more material managers and makes them storeable, under StoreGate.
Definition: StoredMaterialManager.h:28
InDetMaterialManager::m_weightMap
MaterialWeightMap m_weightMap
Definition: InDetMaterialManager.h:219
IGeometryDBSvc::getString
virtual std::string getString(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const =0
IRDBRecord::getDouble
virtual double getDouble(const std::string &fieldName) const =0
Get double field value.
scale1
#define scale1
Definition: JetAttributeHisto.cxx:41
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
InDetMaterialManager::compareDensity
bool compareDensity(double d1, double d2) const
Definition: InDetMaterialManager.cxx:316
InDetMaterialManager::MaterialDef::setCreated
void setCreated()
Definition: InDetMaterialManager.h:163
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
InDetDD::AthenaComps::detStore
const StoreGateSvc * detStore() const
Definition: InDetDDAthenaComps.h:53
InDetMaterialManager::getCompositeMaterialForVolume
const GeoMaterial * getCompositeMaterialForVolume(const std::string &newMatName, const double volumeTot, const double volume1, const std::string &matName1, const double volume2, const std::string &matName2)
Definition: InDetMaterialManager.cxx:134
InDetMaterialManager::getMaterial
const GeoMaterial * getMaterial(const std::string &materialName)
Get material. First looks for locally defined material and if not found looks in GeoModel material ma...
Definition: InDetMaterialManager.cxx:96
StoreGateSvc.h
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
InDetMaterialManager::hasMaterial
bool hasMaterial(const std::string &materialName) const
Definition: InDetMaterialManager.cxx:101