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"],
164 index[
"moduleNumberInRow"]);
177 for (
const auto& [key, value] :
index) {
181 ATH_MSG_ERROR(
"Invalid id for sensitive module " << typeName <<
" volume with indices");
182 for (
const auto& [key, value] :
index) {
185 ATH_MSG_ERROR(
"Refusing to make it into a sensitive element. Incompatible gmx and identifier-xml files.");
193 if (design ==
nullptr) {
194 ATH_MSG_ERROR(
"addSensor: Error: Readout sensor type " << typeName <<
" not found.");
195 throw std::runtime_error(
"readout sensor type " + typeName +
" not found.");
205 const std::array<std::string,7> LGAD_moduleParamNames({
"thickness",
"xPitch",
"yPitch",
"circuitsPerColumn",
"circuitsPerRow",
"padColumns",
"padRows"});
207 if(LGAD_module->
size() !=0){
209 std::map<std::string,std::string> LGAD_moduleMap;
210 for(
const std::string& paramName:LGAD_moduleParamNames){
211 LGAD_moduleMap[paramName] = typeParams->getString(paramName);
213 std::string LGAD_moduleName = typeParams->getString(
"SensorType");
221 std::vector<std::string> fields({
"endcap",
"layer",
"moduleInLayer"});
224 std::map<std::string, GeoFullPhysVol*> mapFPV;
228 const std::array<std::string,2> publishers({
"HGTD",
"GeoModelXML"});
230 for (
auto & iPub : publishers){
232 mapFPV = sqlreader->getPublishedNodes<std::string, GeoFullPhysVol*>(iPub,
true);
233 if (!mapFPV.empty()) {
238 if (mapFPV.empty())
ATH_MSG_ERROR(
"Could not find any FPV tables under the expected names: "<<publishers);
240 for (
const auto&[fullPhysVolInfoString, fullPhysVolPointer] : mapFPV){
242 size_t startLGAD = fullPhysVolInfoString.find(
"lgad");
243 if(startLGAD==std::string::npos){
244 ATH_MSG_DEBUG(
"GeoFullPhysVol "<<fullPhysVolInfoString<<
" does not have the expected format. Skipping");
247 std::string typeName = fullPhysVolInfoString.substr(startLGAD);
248 std::map<std::string, int>
index;
249 for (
const std::string& field:fields){
250 size_t first = fullPhysVolInfoString.find(field+
"_");
251 size_t last = fullPhysVolInfoString.find(
'_',first+field.size()+1);
252 if(first==std::string::npos || last==std::string::npos){
253 ATH_MSG_DEBUG(
"Could not extract "<<field<<
" from "<<fullPhysVolInfoString<<
". Skipping");
256 std::string strNew = fullPhysVolInfoString.substr(first+field.size()+1,last-(first+field.size()+1));
257 index[field] = std::stoi(strNew);
265 std::map<std::string, int> &
index,
266 GeoVFullPhysVol *fpv,
267 GeoAlignableTransform *transform)
290 index[
"moduleInLayer"],
299 index[
"moduleNumberInRow"]
310 if (!hash.is_valid()) {
316 <<
" endcap=" <<
index[
"endcap"]
317 <<
" layer=" <<
index[
"layer"]
318 <<
" moduleInLayer=" <<
index[
"moduleInLayer"]
319 <<
" idHash=" << hash);
323 <<
" transform ptr=" << transform
324 <<
" fpv ptr=" << fpv);
#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)
virtual void addAlignable(int level, std::map< std::string, int > &index, GeoVFullPhysVol *fpv, GeoAlignableTransform *transform) override final
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(std::string_view node, std::string_view tag, std::string_view tag2node="", std::string_view 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.
constexpr bool is_valid() const
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()