17#include <GeoModelRead/ReadGeoModel.h>
18#include <GeoModelKernel/GeoFullPhysVol.h>
22constexpr int HGTD_HitIndex{2};
39 if (not hgtdIdHelper) {
40 ATH_MSG_ERROR(
"HGTD_GmxInterface::sensorId: Dynamic cast of helper failed.");
49 index[
"moduleInLayer"],
53 <<
index[
"moduleInLayer"] );
54 ATH_MSG_DEBUG(
"hitIdOfWafer = " << std::hex << hitIdOfWafer << std::dec);
62 index[
"moduleNumberInRow"],
67 <<
index[
"moduleNumberInRow"] <<
" " <<
index[
"rowNumber"]);
68 ATH_MSG_DEBUG(
"hitIdOfWafer = " << std::hex << hitIdOfWafer << std::dec);
81 const std::string &typeName,
82 const std::map<std::string, std::string> ¶meters)
84 ATH_MSG_DEBUG(
"addSensorType called for class " << clas <<
", typeName " << typeName);
86 if (clas ==
"LGAD_module") {
90 ATH_MSG_ERROR(
"addSensorType: unrecognised sensor class: " << clas);
97 const std::map<std::string, std::string> ¶meters)
102 int circuitsPerColumn{};
103 int circuitsPerRow{};
109 getParameter(typeName, parameters,
"thickness", thickness);
110 getParameter(typeName, parameters,
"xPitch", xPitch);
111 getParameter(typeName, parameters,
"yPitch", yPitch);
112 getParameter(typeName, parameters,
"circuitsPerColumn", circuitsPerColumn);
113 getParameter(typeName, parameters,
"circuitsPerRow", circuitsPerRow);
114 getParameter(typeName, parameters,
"padColumns", padColumns);
115 getParameter(typeName, parameters,
"padRows", padRows);
119 std::move(normalCell), padColumns, 0);
121 std::move(singleRow), padRows, 0);
127 circuitsPerColumn, circuitsPerRow,
128 padColumns, padRows/2,
129 padColumns, padRows/2,
130 std::move(fullMatrix),
139 std::map<std::string, int> &
index,
141 GeoVFullPhysVol *fpv)
151 if(useNewIdentifierScheme){
154 index[
"moduleInLayer"],
161 index[
"moduleNumberInRow"]);
174 for (
const auto& [key, value] :
index) {
178 ATH_MSG_ERROR(
"Invalid id for sensitive module " << typeName <<
" volume with indices");
179 for (
const auto& [key, value] :
index) {
182 ATH_MSG_ERROR(
"Refusing to make it into a sensitive element. Incompatible gmx and identifier-xml files.");
190 if (design ==
nullptr) {
191 ATH_MSG_ERROR(
"addSensor: Error: Readout sensor type " << typeName <<
" not found.");
192 throw std::runtime_error(
"readout sensor type " + typeName +
" not found.");
202 const std::array<std::string,7> LGAD_moduleParamNames({
"thickness",
"xPitch",
"yPitch",
"circuitsPerColumn",
"circuitsPerRow",
"padColumns",
"padRows"});
204 if(LGAD_module->
size() !=0){
206 std::map<std::string,std::string> LGAD_moduleMap;
207 for(
const std::string& paramName:LGAD_moduleParamNames){
208 LGAD_moduleMap[paramName] = typeParams->getString(paramName);
210 std::string LGAD_moduleName = typeParams->getString(
"SensorType");
218 std::vector<std::string> fields({
"endcap",
"layer",
"moduleInLayer"});
221 std::map<std::string, GeoFullPhysVol*> mapFPV;
225 const std::array<std::string,2> publishers({
"HGTD",
"GeoModelXML"});
227 for (
auto & iPub : publishers){
229 mapFPV = sqlreader->getPublishedNodes<std::string, GeoFullPhysVol*>(iPub,
true);
230 if (!mapFPV.empty()) {
235 if (mapFPV.empty())
ATH_MSG_ERROR(
"Could not find any FPV tables under the expected names: "<<publishers);
237 for (
const auto&[fullPhysVolInfoString, fullPhysVolPointer] : mapFPV){
239 size_t startLGAD = fullPhysVolInfoString.find(
"lgad");
240 if(startLGAD==std::string::npos){
241 ATH_MSG_DEBUG(
"GeoFullPhysVol "<<fullPhysVolInfoString<<
" does not have the expected format. Skipping");
244 std::string typeName = fullPhysVolInfoString.substr(startLGAD);
245 std::map<std::string, int>
index;
246 for (
const std::string& field:fields){
247 size_t first = fullPhysVolInfoString.find(field+
"_");
248 size_t last = fullPhysVolInfoString.find(
'_',first+field.size()+1);
249 if(first==std::string::npos || last==std::string::npos){
250 ATH_MSG_DEBUG(
"Could not extract "<<field<<
" from "<<fullPhysVolInfoString<<
". Skipping");
253 std::string strNew = fullPhysVolInfoString.substr(first+field.size()+1,last-(first+field.size()+1));
254 index[field] = std::stoi(strNew);
#define ATH_MSG_WARNING(x)
Definition of the abstract IRDBAccessSvc interface.
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
std::unique_ptr< IRDBRecord > IRDBRecord_ptr
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
The Detector manager has methods to retrieve the Identifier helper and methods to retrieve the detect...
virtual int sensorId(std::map< std::string, int > &index) const override final
InDetDD::SiCommonItems * m_commonItems
HGTD_DetectorManager * m_detectorManager
std::map< std::string, const InDetDD::HGTD_ModuleDesign * > m_geometryMap
void makeLgadModule(const std::string &typeName, const std::map< std::string, std::string > ¶meters)
virtual void addSensorType(const std::string &clas, const std::string &typeName, const std::map< std::string, std::string > ¶meters) override final
void buildReadoutGeometryFromSqlite(IRDBAccessSvc *rdbAccessSvc, GeoModelIO::ReadGeoModel *sqlreader)
HGTD_GmxInterface(HGTD_DetectorManager *detectorManager, InDetDD::SiCommonItems *commonItems)
void addSensor(const std::string &typeName, std::map< std::string, int > &index, int sequentialId, GeoVFullPhysVol *fpv) override final
This is an Identifier helper class for the HGTD subdetector.
Identifier wafer_id(int endcap, int layer, int phi_module, int eta_module) const
For a single crystal.
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
bool get_useNewIdentifierScheme() const
IRDBAccessSvc is an abstract interface to the athena service that provides the following functionalit...
virtual IRDBRecordset_ptr getRecordsetPtr(const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD")=0
Provides access to the Recordset object containing HVS-tagged data.
virtual unsigned int size() const =0
This is a "hash" representation of an Identifier.
bool is_valid() const
Check if id is in a valid state.
Class to hold geometrical description of an HGTD detector element.
Class used to describe the design of a module (diode segmentation and readout scheme)
static std::shared_ptr< const PixelDiodeMatrix > construct(double phiWidth, double etaWidth)
Construct method for just a single cell.
Helper class to concentrate common items, such as the pointer to the IdHelper, the lorentzAngle tool ...
int buildHitId(const int, const int, const int, const int, const int, const int) const
static const SiHitIdHelper * GetHelper()