37 SmartIF<IGeoModelSvc> geoModel{svcLocator->service(
"GeoModelSvc")};
39 throw std::runtime_error(
"CellVolumes error: cannot access GeoModelSvc");
41 SmartIF<IGeoDbTagSvc> geoDbTagSvc{svcLocator->service(
"GeoDbTagSvc")};
43 throw std::runtime_error(
"CellVolumes error: cannot access GeoDbTagSvc");
45 SmartIF<IRDBAccessSvc> rdbAccess{svcLocator->service(geoDbTagSvc->getParamSvcName())};
47 throw std::runtime_error(
"CellVolumes error: cannot access RDBAccessSvc");
49 std::string larKey, larNode;
50 if(geoDbTagSvc->getSqliteReader()==
nullptr) {
51 DecodeVersionKey detectorKey = DecodeVersionKey(geoModel,
"LAr");
52 larKey = detectorKey.tag();
53 larNode = detectorKey.node();
56 IRDBRecordset_ptr cellVolRec = rdbAccess->getRecordsetPtr(
"LArCellVolumes",larKey,larNode);
57 if(cellVolRec->size()==0) {
58 cellVolRec = rdbAccess->getRecordsetPtr(
"LArCellVolumes",
"LArCellVolumes-00");
59 if(cellVolRec->size()==0) {
60 throw std::runtime_error(
"CaloCellVolumes error: 0 size of LArCellVolumes recordset");
65 IRDBRecordset_ptr fcalModRec = rdbAccess->getRecordsetPtr(
"FCalMod",larKey,larNode);
66 if(fcalModRec->
size()==0) {
67 fcalModRec = rdbAccess->getRecordsetPtr(
"FCalMod",
"FCalMod-00");
68 if(fcalModRec->size()==0) {
69 throw std::runtime_error(
"CaloCellVolumes error: 0 size of FCalMod recordset");
74 m_fcalTubeSpacings[rec->getInt(
"FCALSAMPLING")] = rec->getDouble(
"TUBESPACING");
77 m_geometryLayout =
"Atlas";
78 if(geoDbTagSvc->getSqliteReader()==
nullptr) {
79 std::string LArTag = rdbAccess->getChildTag(
"LAr",larKey,larNode);
80 if(LArTag.find(
"H8")!=std::string::npos) {
81 m_geometryLayout =
"H8";
83 else if(LArTag.find(
"H6")!=std::string::npos) {
84 m_geometryLayout =
"H6";
86 else if(LArTag.find(
"G3")!=std::string::npos) {
87 m_geometryLayout =
"G3";
94 int subcalo = rec->getInt(
"SUBCALO");
95 int posneg = rec->getInt(
"POSNEG");
96 int sampling = rec->getInt(
"SAMPLING");
97 int region = rec->getInt(
"REGION");
98 int eta = rec->getInt(
"ETA");
99 int phi = rec->getInt(
"PHI");
103 channelID = m_calocell_id->cell_id (subcalo, posneg, sampling, region,
eta,
phi);
106 Identifier reg_id = m_calocell_id->region_id(subcalo, posneg, sampling, region);
107 int phimin = m_calocell_id->phi_min(reg_id);
108 channelID = m_calocell_id->cell_id (subcalo, posneg, sampling, region,
eta, phimin);
113 cellVol.
volume = rec->getDouble(
"VOLUME");
114 m_cellVolumes.push_back(cellVol);
117 if (m_cellVolumes.empty()) {
118 throw std::runtime_error(
"CaloCellVolumes error: 0 volumes have been built!");
121 std::sort (m_cellVolumes.begin(), m_cellVolumes.end(),
149 volId =
m_calocell_id->cell_id(subCalo, posneg, sampling, region,
eta, phimin);
156 CaloCellVolumeVector::const_iterator it =
159 if (it !=
m_cellVolumes.end() && it->channelID == volId)
return it->volume;