ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
HGTD_GmxInterface Class Reference

#include <HGTD_GmxInterface.h>

Inheritance diagram for HGTD_GmxInterface:
Collaboration diagram for HGTD_GmxInterface:

Public Member Functions

 HGTD_GmxInterface (HGTD_DetectorManager *detectorManager, InDetDD::SiCommonItems *commonItems)
 
virtual int sensorId (std::map< std::string, int > &index) const override final
 
virtual void addSensorType (const std::string &clas, const std::string &typeName, const std::map< std::string, std::string > &parameters) override final
 
void addSensor (const std::string &typeName, std::map< std::string, int > &index, int sequentialId, GeoVFullPhysVol *fpv) override final
 
void buildReadoutGeometryFromSqlite (IRDBAccessSvc *rdbAccessSvc, GeoModelIO::ReadGeoModel *sqlreader)
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

void makeLgadModule (const std::string &typeName, const std::map< std::string, std::string > &parameters)
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::map< std::string, const InDetDD::HGTD_ModuleDesign * > m_geometryMap
 
HGTD_DetectorManagerm_detectorManager {}
 
InDetDD::SiCommonItemsm_commonItems {}
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Definition at line 28 of file HGTD_GmxInterface.h.

Constructor & Destructor Documentation

◆ HGTD_GmxInterface()

HGTD_GmxInterface::HGTD_GmxInterface ( HGTD_DetectorManager detectorManager,
InDetDD::SiCommonItems commonItems 
)

Definition at line 25 of file HGTD_GmxInterface.cxx.

27  : AthMessaging("HGTD_GmxInterface"),
28  m_detectorManager(detectorManager),
29  m_commonItems(commonItems)
30 {
31 }

Member Function Documentation

◆ addSensor()

void HGTD_GmxInterface::addSensor ( const std::string &  typeName,
std::map< std::string, int > &  index,
int  sequentialId,
GeoVFullPhysVol *  fpv 
)
finaloverride

Definition at line 136 of file HGTD_GmxInterface.cxx.

140 {
141  //
142  // Get the ATLAS "Offline" wafer identifier
143  //
144  const HGTD_ID* hgtdIdHelper = dynamic_cast<const HGTD_ID *> (m_commonItems->getIdHelper());
145 
146  Identifier id;
147 
148  bool useNewIdentifierScheme = hgtdIdHelper->get_useNewIdentifierScheme(); // to find which identification scheme is configured
149  if(useNewIdentifierScheme){
150  id = hgtdIdHelper->wafer_id(index["endcap"],
151  index["layer"],
152  index["moduleInLayer"],
153  0);
154  ATH_MSG_DEBUG("HGTD New ID scheme");
155  } else {
156  id = hgtdIdHelper->wafer_id(index["endcap"],
157  index["layer"],
158  index["rowNumber"],
159  index["moduleNumberInRow"]);
160  ATH_MSG_DEBUG("HGTD Old ID scheme");
161  }
162  IdentifierHash hashId = hgtdIdHelper->wafer_hash(id);
163 
164  //
165  // Now do our best to check if this is a valid id. If either the gmx file is wrong, or the xml file
166  // defining the allowed id's is wrong, you can get disallowed id's. These cause a crash later
167  // if allowed through. To do the check, we ask for the hash-id of this id. Invalid ids give a
168  // special invalid hash-id (0xFFFFFFFF). But we don't exit the run, to help debug things quicker.
169  // //
170  if (hashId.is_valid()) {
171  ATH_MSG_DEBUG("valid id");
172  for (const auto& [key, value] : index) {
173  ATH_MSG_DEBUG(key << " = " << value << "; ");
174  }
175  } else {
176  ATH_MSG_ERROR("Invalid id for sensitive module " << typeName << " volume with indices");
177  for (const auto& [key, value] : index) {
178  ATH_MSG_ERROR(key << " = " << value << "; ");
179  }
180  ATH_MSG_ERROR("Refusing to make it into a sensitive element. Incompatible gmx and identifier-xml files.");
181  return;
182  }
183 
184  //
185  // Create the detector element and add to the DetectorManager
186  //
188  if (design == nullptr) {
189  ATH_MSG_ERROR("addSensor: Error: Readout sensor type " << typeName << " not found.");
190  throw std::runtime_error("readout sensor type " + typeName + " not found.");
191  }
193 
194  return;
195 }

◆ addSensorType()

void HGTD_GmxInterface::addSensorType ( const std::string &  clas,
const std::string &  typeName,
const std::map< std::string, std::string > &  parameters 
)
finaloverridevirtual

Definition at line 78 of file HGTD_GmxInterface.cxx.

81 {
82  ATH_MSG_DEBUG("addSensorType called for class " << clas << ", typeName " << typeName);
83 
84  if (clas == "LGAD_module") {
85  // TODO: implement method to actually add the sensor type (also to the detector manager)
87  } else {
88  ATH_MSG_ERROR("addSensorType: unrecognised sensor class: " << clas);
89  ATH_MSG_ERROR("No sensor design created");
90  }
91 }

◆ buildReadoutGeometryFromSqlite()

void HGTD_GmxInterface::buildReadoutGeometryFromSqlite ( IRDBAccessSvc rdbAccessSvc,
GeoModelIO::ReadGeoModel *  sqlreader 
)

Definition at line 197 of file HGTD_GmxInterface.cxx.

198 {
199  IRDBRecordset_ptr LGAD_module = rdbAccessSvc->getRecordsetPtr("LGAD_module","");
200  const std::array<std::string,7> LGAD_moduleParamNames({"thickness","xPitch","yPitch","circuitsPerColumn","circuitsPerRow","padColumns","padRows"});
201 
202  if(LGAD_module->size() !=0){
203  for (const IRDBRecord_ptr& typeParams:*LGAD_module){
204  std::map<std::string,std::string> LGAD_moduleMap;
205  for(const std::string& paramName:LGAD_moduleParamNames){
206  std::string paramValue = typeParams->getString(paramName);
207  LGAD_moduleMap[paramName] = paramValue;
208  }
209  std::string LGAD_moduleName = typeParams->getString("SensorType");
210  makeLgadModule(LGAD_moduleName,LGAD_moduleMap);
211  }
212  }
213  else ATH_MSG_WARNING("Could not retrieve LGAD_module table");
214 
215  //Now, loop over the FullPhysVols and create the HGTD_DetectorElements (including splitting where needed)
216  //lots of string parsing...
217  std::vector<std::string> fields({"endcap","layer","moduleInLayer"});
218  //The map below is a map of string keys which contains all the Identifier/DetElement relevant info, and the associated FullPhysVol
219  std::map<std::string, GeoFullPhysVol*> mapFPV = sqlreader->getPublishedNodes<std::string, GeoFullPhysVol*>("GeoModelXML");
220  for (const auto&[fullPhysVolInfoString, fullPhysVolPointer] : mapFPV){
221  //find the name of the corresponding detector design type
222  size_t startLGAD = fullPhysVolInfoString.find("lgad");
223  if(startLGAD==std::string::npos){
224  ATH_MSG_DEBUG("GeoFullPhysVol "<<fullPhysVolInfoString<<" does not have the expected format. Skipping");
225  continue;
226  }
227  std::string typeName = fullPhysVolInfoString.substr(startLGAD);
228  std::map<std::string, int> index;
229  for (const std::string& field:fields){
230  size_t first = fullPhysVolInfoString.find(field+"_");
231  size_t last = fullPhysVolInfoString.find('_',first+field.size()+1);//start looking only after end of first delimiter (plus 1 for the "_" appended) ends
232  if(first==std::string::npos || last==std::string::npos){
233  ATH_MSG_DEBUG("Could not extract "<<field<<" from "<<fullPhysVolInfoString<<". Skipping");
234  continue;
235  }
236  std::string strNew = fullPhysVolInfoString.substr(first+field.size()+1,last-(first+field.size()+1));
237  index[field] = std::stoi(strNew);
238  }
239 
240  addSensor(typeName,index,0,fullPhysVolPointer);
241  }
242 }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ makeLgadModule()

void HGTD_GmxInterface::makeLgadModule ( const std::string &  typeName,
const std::map< std::string, std::string > &  parameters 
)
private

Definition at line 94 of file HGTD_GmxInterface.cxx.

96 {
97  double thickness{};
98  double xPitch{};
99  double yPitch{};
100  int circuitsPerColumn{};
101  int circuitsPerRow{};
102  int padColumns{};
103  int padRows{};
104 
105  // read parameters
106  // TO DO : checking for unlogical values
107  getParameter(typeName, parameters, "thickness", thickness);
108  getParameter(typeName, parameters, "xPitch", xPitch);
109  getParameter(typeName, parameters, "yPitch", yPitch);
110  getParameter(typeName, parameters, "circuitsPerColumn", circuitsPerColumn);
111  getParameter(typeName, parameters, "circuitsPerRow", circuitsPerRow);
112  getParameter(typeName, parameters, "padColumns", padColumns);
113  getParameter(typeName, parameters, "padRows", padRows);
114 
115  std::shared_ptr<const InDetDD::PixelDiodeMatrix> normalCell = InDetDD::PixelDiodeMatrix::construct(xPitch, yPitch);
116  std::shared_ptr<const InDetDD::PixelDiodeMatrix> singleRow = InDetDD::PixelDiodeMatrix::construct(InDetDD::PixelDiodeMatrix::phiDir, 0,
117  normalCell, padColumns, 0);
118  std::shared_ptr<const InDetDD::PixelDiodeMatrix> fullMatrix = InDetDD::PixelDiodeMatrix::construct(InDetDD::PixelDiodeMatrix::etaDir, 0,
119  singleRow, padRows, 0);
120 
121 
123 
125  circuitsPerColumn, circuitsPerRow,
126  padColumns, padRows/2,
127  padColumns, padRows/2,
128  fullMatrix,
129  InDetDD::CarrierType::electrons, 1, yDirection );
130 
131 
132  m_geometryMap[typeName] = design;
133 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ sensorId()

int HGTD_GmxInterface::sensorId ( std::map< std::string, int > &  index) const
finaloverridevirtual

Definition at line 34 of file HGTD_GmxInterface.cxx.

35 {
36  const HGTD_ID* hgtdIdHelper = dynamic_cast<const HGTD_ID *> (m_commonItems->getIdHelper());
37  bool newIdenSche = hgtdIdHelper->get_useNewIdentifierScheme(); // to choise which identification scheme will be used
38 
39  // Return the Simulation HitID (nothing to do with "ATLAS Identifiers" aka "Offline Identifiers"
40  int hitIdOfWafer;
41 
42  if(newIdenSche){
43  hitIdOfWafer = SiHitIdHelper::GetHelper()->buildHitId(HGTD_HitIndex,
44  index["endcap"],
45  index["layer"],
46  0,
47  index["moduleInLayer"],
48  0); // side is just 0 for HGTD
49 
50  ATH_MSG_DEBUG("Index list: " << index["endcap"] << " " << index["layer"] << " "
51  << index["moduleInLayer"] );
52  ATH_MSG_DEBUG("hitIdOfWafer = " << std::hex << hitIdOfWafer << std::dec);
53  ATH_MSG_DEBUG(" endcap = " << SiHitIdHelper::GetHelper()->getBarrelEndcap(hitIdOfWafer)
54  << " layer = " << SiHitIdHelper::GetHelper()->getLayerDisk(hitIdOfWafer)
55  << " moduleInLayer = " << SiHitIdHelper::GetHelper()->getPhiModule(hitIdOfWafer));
56  } else {
57  hitIdOfWafer = SiHitIdHelper::GetHelper()->buildHitId(HGTD_HitIndex,
58  index["endcap"],
59  index["layer"],
60  index["moduleNumberInRow"],
61  index["rowNumber"],
62  0); // side is just 0 for HGTD
63 
64  ATH_MSG_DEBUG("Index list: " << index["endcap"] << " " << index["layer"] << " "
65  << index["moduleNumberInRow"] << " " << index["rowNumber"]);
66  ATH_MSG_DEBUG("hitIdOfWafer = " << std::hex << hitIdOfWafer << std::dec);
67  ATH_MSG_DEBUG(" endcap = " << SiHitIdHelper::GetHelper()->getBarrelEndcap(hitIdOfWafer)
68  << " layer = " << SiHitIdHelper::GetHelper()->getLayerDisk(hitIdOfWafer)
69  << " moduleNumberInRow = " << SiHitIdHelper::GetHelper()->getEtaModule(hitIdOfWafer)
70  << " rowNumber = " << SiHitIdHelper::GetHelper()->getPhiModule(hitIdOfWafer));
71 
72  }
73  return hitIdOfWafer;
74 
75 }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_commonItems

InDetDD::SiCommonItems* HGTD_GmxInterface::m_commonItems {}
private

Definition at line 51 of file HGTD_GmxInterface.h.

◆ m_detectorManager

HGTD_DetectorManager* HGTD_GmxInterface::m_detectorManager {}
private

Definition at line 50 of file HGTD_GmxInterface.h.

◆ m_geometryMap

std::map<std::string, const InDetDD::HGTD_ModuleDesign *> HGTD_GmxInterface::m_geometryMap
private

Definition at line 49 of file HGTD_GmxInterface.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
IRDBAccessSvc::getRecordsetPtr
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.
HGTD_ID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: HGTD_ID.h:404
InDetDD::SiCommonItems::getIdHelper
const AtlasDetectorID * getIdHelper() const
Definition: SiCommonItems.h:83
index
Definition: index.py:1
InDetDD::DetectorDesign::yAxis
@ yAxis
Definition: DetectorDesign.h:60
HGTD_ID::get_useNewIdentifierScheme
bool get_useNewIdentifierScheme() const
Definition: HGTD_ID.cxx:594
InDetDD::HGTD_DetectorElement
Definition: HGTD_DetectorElement.h:40
InDetDD::PixelDiodeMatrix::construct
static std::shared_ptr< const PixelDiodeMatrix > construct(double phiWidth, double etaWidth)
Construct method for just a single cell.
Definition: PixelDiodeMatrix.cxx:14
athena.value
value
Definition: athena.py:122
InDetDD::DetectorDesign::Axis
Axis
Definition: DetectorDesign.h:59
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
HGTD_ID::wafer_id
Identifier wafer_id(int endcap, int layer, int phi_module, int eta_module) const
For a single crystal.
Definition: HGTD_ID.h:287
InDetDD::PixelDiodeMatrix::phiDir
@ phiDir
Definition: PixelDiodeMatrix.h:97
PixelConditionsData::getParameter
std::vector< T > getParameter(const std::string &varName, const std::vector< std::string > &buffer)
Definition: PixelConditionsDataStringUtils.h:51
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
HGTD_GmxInterface::m_geometryMap
std::map< std::string, const InDetDD::HGTD_ModuleDesign * > m_geometryMap
Definition: HGTD_GmxInterface.h:49
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HGTD_ID
Definition: HGTD_ID.h:47
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
IdentifierHash::is_valid
bool is_valid() const
Check if id is in a valid state.
HGTD_GmxInterface::makeLgadModule
void makeLgadModule(const std::string &typeName, const std::map< std::string, std::string > &parameters)
Definition: HGTD_GmxInterface.cxx:94
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
HGTD_GmxInterface::m_commonItems
InDetDD::SiCommonItems * m_commonItems
Definition: HGTD_GmxInterface.h:51
HGTD_DetectorManager::addDetectorElement
void addDetectorElement(InDetDD::HGTD_DetectorElement *element)
Add elememts.
Definition: HGTD_DetectorManager.cxx:94
DeMoScan.index
string index
Definition: DeMoScan.py:362
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
DeMoScan.first
bool first
Definition: DeMoScan.py:534
IRDBRecord_ptr
std::unique_ptr< IRDBRecord > IRDBRecord_ptr
Definition: IRDBRecordset.h:23
SiHitIdHelper::GetHelper
static const SiHitIdHelper * GetHelper()
Definition: SiHitIdHelper.cxx:19
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
ReadCalibFromCool.typeName
typeName
Definition: ReadCalibFromCool.py:477
InDetDD::HGTD_ModuleDesign
Definition: HGTD_ModuleDesign.h:43
HGTD_GmxInterface::m_detectorManager
HGTD_DetectorManager * m_detectorManager
Definition: HGTD_GmxInterface.h:50
CaloCondBlobAlgs_fillNoiseFromASCII.fields
fields
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:106
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
IdentifierHash
Definition: IdentifierHash.h:38
SiHitIdHelper::buildHitId
int buildHitId(const int, const int, const int, const int, const int, const int) const
Definition: SiHitIdHelper.cxx:118
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
HGTD_GmxInterface::addSensor
void addSensor(const std::string &typeName, std::map< std::string, int > &index, int sequentialId, GeoVFullPhysVol *fpv) override final
Definition: HGTD_GmxInterface.cxx:136
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17
InDetDD::PixelDiodeMatrix::etaDir
@ etaDir
Definition: PixelDiodeMatrix.h:97
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37