12 #include "GaudiKernel/Bootstrap.h"
13 #include "Gaudi/Property.h"
14 #include "GaudiKernel/IService.h"
15 #include "GaudiKernel/IToolSvc.h"
19 #include "GeoModelKernel/GeoFullPhysVol.h"
20 #include "GeoModelKernel/Units.h"
21 #include "GaudiKernel/SystemOfUnits.h"
30 const std::string&
name,
64 ATH_MSG_INFO (
" LArRecoMaterialTool successfully initialized ");
65 return StatusCode::SUCCESS;
70 double&
mass,
double& volume,
71 double& x0,
double& dEdx,
72 double& aveA,
double& aveZ
96 double& x0,
double& dEdx,
97 double& aveA,
double& aveZ
174 double&
mass,
double& x0,
double& dEdx,
175 double& aveA,
double& aveZ)
187 ATH_MSG_INFO (
"method ScanCryo does not support CaloSubdetNames::ALIGNVOL " << (
int) alvol);
218 m_child_massFractions.clear();
219 m_child_volumeFractions.clear();
220 m_child_x0Fractions.clear();
221 m_child_dEdXFractions.clear();
222 m_child_averageAFractions.clear();
223 m_child_averageZFractions.clear();
225 m_child_Volume.clear();
226 m_child_Mass.clear();
228 double childVolume = 0.;
229 double childMass = 0.;
231 double childDeDx = 0.;
232 double childAverageA = 0.;
233 double childAverageZ = 0.;
234 double childRho = 0.;
237 std::string
key = map_av(alvol);
251 const GeoFullPhysVol* larTopVolLink = storedPV->
getPhysVol();
254 unsigned int larChilds = larTopVolLink->getNChildVols();
256 for (
unsigned int ichild = 0; ichild<larChilds; ++ichild){
262 larTopVolLink->getNameOfChildVol(ichild) ==
"Total LAR Volume")
stop =
true;
264 larTopVolLink->getNameOfChildVol(ichild) ==
"Total LAR Volume")
stop =
true;
269 <<
" Direct Child " << ichild <<
" - with name : "
270 << larTopVolLink->getNameOfChildVol(ichild));
272 PVConstLink childVolLink = larTopVolLink->getChildVol(ichild);
274 m_massFractions.clear();
275 m_volumeFractions.clear();
276 m_x0Fractions.clear();
277 m_dEdXFractions.clear();
278 m_averageAFractions.clear();
279 m_averageZFractions.clear();
281 this->blendGeoVolume(childVolLink,
287 m_averageZFractions);
289 this->averageFraction(m_volumeFractions,
295 childMass, childVolume,
297 childAverageA, childAverageZ, childRho );
299 m_child_x0Fractions.push_back( childX0 );
300 m_child_dEdXFractions.push_back( childDeDx );
301 m_child_averageAFractions.push_back( childAverageA );
302 m_child_averageZFractions.push_back( childAverageZ );
303 m_child_Rho.push_back( childRho );
304 m_child_Volume.push_back( childVolume );
305 m_child_Mass.push_back( childMass );
312 ATH_MSG_DEBUG (
"Final average for CaloSubdetNames::ALIGNVOL " << (
int) alvol
315 this->averageFraction(m_child_Volume, m_child_Mass,
317 m_child_dEdXFractions,
318 m_child_averageAFractions,
319 m_child_averageZFractions,
320 childMass, childVolume,
322 childAverageA, childAverageZ, childRho );
327 aveA = childAverageA;
328 aveZ = childAverageZ;
332 m_alignvol_number.push_back( alvol );
333 m_alignvol_mass.push_back(
mass );
334 m_alignvol_x0.push_back( x0 );
335 m_alignvol_dEdX.push_back( dEdx );
336 m_alignvol_aveA.push_back( aveA );
337 m_alignvol_aveZ.push_back( aveZ );
344 double&
mass,
double& x0,
double& dEdx,
345 double& aveA,
double& aveZ)
358 ATH_MSG_INFO (
"method ScanCryo does not support CaloSubdetNames::ALIGNVOL " << (
int) alvol);
389 double childVolume = 0.;
390 double childMass = 0.;
392 double childDeDx = 0.;
393 double childAverageA = 0.;
394 double childAverageZ = 0.;
395 double childRho = 0.;
412 const GeoFullPhysVol* larTopVolLink = storedPV->
getPhysVol();
415 unsigned int larChilds = larTopVolLink->getNChildVols();
417 for (
unsigned int ichild = 0; ichild<larChilds; ++ichild){
428 <<
" Direct Child " << ichild <<
" - with name : "
429 << larTopVolLink->getNameOfChildVol(ichild));
431 PVConstLink childVolLink = larTopVolLink->getChildVol(ichild);
454 childMass, childVolume,
456 childAverageA, childAverageZ, childRho );
471 ATH_MSG_DEBUG (
"Final average for CaloSubdetNames::ALIGNVOL " << (
int) alvol
479 childMass, childVolume,
481 childAverageA, childAverageZ, childRho );
486 aveA = childAverageA;
487 aveZ = childAverageZ;
502 double&
mass,
double& x0,
double& dEdx,
503 double& aveA,
double& aveZ)
513 ATH_MSG_INFO (
"method ScanEMB does not support CaloSubdetNames::ALIGNVOL " << (
int) alvol);
539 double childVolume = 0.;
540 double childMass = 0.;
542 double childDeDx = 0.;
543 double childAverageA = 0.;
544 double childAverageZ = 0.;
545 double childRho = 0.;
567 const GeoFullPhysVol* larTopVolLink = storedPV->
getPhysVol();
570 unsigned int larChilds = larTopVolLink->getNChildVols();
572 for (
unsigned int ichild = 0; ichild<larChilds; ++ichild){
583 <<
" Direct Child " << ichild <<
" - with name : "
584 << larTopVolLink->getNameOfChildVol(ichild));
586 PVConstLink childVolLink = larTopVolLink->getChildVol(ichild);
609 childMass, childVolume,
611 childAverageA, childAverageZ, childRho );
626 ATH_MSG_DEBUG (
"Final average for CaloSubdetNames::ALIGNVOL " << (
int) alvol
634 childMass, childVolume,
636 childAverageA, childAverageZ, childRho );
641 aveA = childAverageA;
642 aveZ = childAverageZ;
657 double&
mass,
double& x0,
double& dEdx,
658 double& aveA,
double& aveZ)
667 ATH_MSG_INFO (
"method ScanEMEM does not support CaloSubdetNames::ALIGNVOL " << (
int) alvol);
695 double&
mass,
double& x0,
double& dEdx,
696 double& aveA,
double& aveZ)
708 ATH_MSG_INFO (
"method ScanEMB does not support CaloSubdetNames::ALIGNVOL "
735 double childVolume = 0.;
736 double childMass = 0.;
738 double childDeDx = 0.;
739 double childAverageA = 0.;
740 double childAverageZ = 0.;
741 double childRho = 0.;
763 const GeoFullPhysVol* larTopVolLink = storedPV->
getPhysVol();
766 unsigned int larChilds = larTopVolLink->getNChildVols();
768 for (
unsigned int ichild = 0; ichild<larChilds; ++ichild){
779 <<
" Direct Child " << ichild <<
" - with name : "
780 << larTopVolLink->getNameOfChildVol(ichild));
782 PVConstLink childVolLink = larTopVolLink->getChildVol(ichild);
805 childMass, childVolume,
807 childAverageA, childAverageZ, childRho );
822 ATH_MSG_DEBUG (
"Final average for CaloSubdetNames::ALIGNVOL " << (
int) alvol
830 childMass, childVolume,
832 childAverageA, childAverageZ, childRho );
837 aveA = childAverageA;
838 aveZ = childAverageZ;
853 double&
mass,
double& x0,
double& dEdx,
854 double& aveA,
double& aveZ)
868 ATH_MSG_INFO (
"method ScanEMB does not support CaloSubdetNames::ALIGNVOL "
913 double childVolume = 0.;
914 double childMass = 0.;
916 double childDeDx = 0.;
917 double childAverageA = 0.;
918 double childAverageZ = 0.;
919 double childRho = 0.;
941 const GeoFullPhysVol* larTopVolLink = storedPV->
getPhysVol();
944 unsigned int larChilds = larTopVolLink->getNChildVols();
946 for (
unsigned int ichild = 0; ichild<larChilds; ++ichild){
957 <<
" Direct Child " << ichild <<
" - with name : "
958 << larTopVolLink->getNameOfChildVol(ichild));
960 PVConstLink childVolLink = larTopVolLink->getChildVol(ichild);
983 childMass, childVolume,
985 childAverageA, childAverageZ, childRho );
1000 ATH_MSG_DEBUG (
"Final average for CaloSubdetNames::ALIGNVOL " << (
int) alvol
1008 childMass, childVolume,
1010 childAverageA, childAverageZ, childRho );
1015 aveA = childAverageA;
1016 aveZ = childAverageZ;
1031 std::vector<double>& volume,
1032 std::vector<double>&
mass,
1033 std::vector<double>& x0,
1034 std::vector<double>& dEdX,
1035 std::vector<double>& aveA,
1036 std::vector<double>& aveZ)
const
1039 const GeoLogVol* currentVol = geoVolLink->getLogVol();
1042 unsigned int currentVolChilds = geoVolLink->getNChildVols();
1043 for (
unsigned int ichild = 0; ichild < currentVolChilds; ichild++){
1044 GeoPVConstLink childVolumeLink = geoVolLink->getChildVol(ichild);
1052 std::vector<double>& volume,
1053 std::vector<double>&
mass,
1054 std::vector<double>& x0,
1055 std::vector<double>& dEdX,
1056 std::vector<double>& aveA,
1057 std::vector<double>& aveZ)
const
1059 const GeoShape* childShape = geoVol.getShape();
1060 const GeoMaterial* childMaterial = geoVol.getMaterial();
1062 double childVolume = childShape->volume();
1064 double childNumberOfElements = childMaterial->getNumElements();
1065 double childX0 = childMaterial->getRadLength ();
1066 double childDeDx = childMaterial->getDeDxMin();
1067 double childRho = childMaterial->getDensity();
1070 <<
" has volume=" << childVolume <<
" mm**3 and "
1071 << childNumberOfElements <<
" elements ");
1073 for (
unsigned int iEl=0; iEl<childNumberOfElements; iEl++){
1074 const GeoElement* geoEl = childMaterial->getElement(iEl);
1075 double fraction = childMaterial->getFraction(iEl);
1077 ATH_MSG_DEBUG (
" direct child : " << geoEl->getName() <<
" fraction = " << fraction
1080 volume.push_back(fraction*childVolume);
1081 mass.push_back(fraction*childVolume*childRho);
1082 x0.push_back(fraction*childX0);
1083 dEdX.push_back(fraction*childDeDx);
1085 aveZ.push_back(fraction*(geoEl->getZ()));
1092 std::vector<double>& massFractions,
1093 std::vector<double>& x0Fractions,
1094 std::vector<double>& dEdXFractions,
1095 std::vector<double>& averageAFractions,
1096 std::vector<double>& averageZFractions,
1097 double& childMass,
double& childVolume,
1098 double& childX0,
double& childDeDx,
1099 double& childAverageA,
double& childAverageZ,
double& childRho )
1101 unsigned int parsedVolumes = massFractions.size();
1103 << parsedVolumes <<
" elements ");
1113 for (
unsigned int ivols = 0; ivols < parsedVolumes; ++ivols) {
1114 childMass += massFractions[ivols];
1115 childVolume += volumeFractions[ivols];
1118 for (
unsigned int ivolfrac = 0; ivolfrac < parsedVolumes; ++ivolfrac){
1119 double volfrac = volumeFractions[ivolfrac]/childVolume;
1120 childX0 += volfrac * x0Fractions[ivolfrac];
1121 childDeDx += volfrac * dEdXFractions[ivolfrac];
1122 double massfrac = massFractions[ivolfrac]/childMass;
1123 childAverageA += massfrac * averageAFractions[ivolfrac];
1124 childAverageZ += massfrac * averageZFractions[ivolfrac];
1130 ATH_MSG_DEBUG (
" + averaged over " << parsedVolumes <<
" volumes ");
1148 return std::string(
"LARCRYO_B");
1150 return std::string(
"LARCRYO_EC_POS");
1152 return std::string(
"LARCRYO_EC_NEG");
1154 return std::string(
"SOLENOID");
1156 return std::string(
"PRESAMPLER_B_POS");
1158 return std::string(
"PRESAMPLER_B_NEG");
1160 return std::string(
"EMB_POS");
1162 return std::string(
"EMB_NEG");
1164 return std::string(
"PRESAMPLER_EC_POS");
1166 return std::string(
"PRESAMPLER_EC_NEG");
1168 return std::string(
"EMEC_POS");
1170 return std::string(
"EMEC_NEG");
1172 return std::string(
"HEC1_POS");
1174 return std::string(
"HEC1_NEG");
1176 return std::string(
"HEC2_POS");
1178 return std::string(
"HEC2_NEG");
1180 return std::string(
"FCAL1_POS");
1182 return std::string(
"FCAL1_NEG");
1184 return std::string(
"FCAL2_POS");
1186 return std::string(
"FCAL2_NEG");
1188 return std::string(
"FCAL3_POS");
1190 return std::string(
"FCAL3_NEG");
1192 return std::string(
"");