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

#include <MuonAGDDToolHelper.h>

Collaboration diagram for MuonAGDDToolHelper:

Public Member Functions

 MuonAGDDToolHelper ()
 
std::vector< std::string > ReadAGDDFlags ()
 
void SetNSWComponents ()
 
std::string GetAGDD (const bool dumpIt, const std::string &tableName, const std::string &outFileName)
 
void setAGDDtoGeoSvcName (const std::string &name)
 

Static Public Member Functions

static bool BuildMScomponents ()
 

Private Attributes

IRDBAccessSvcm_rdbAccessSvc {nullptr}
 
IGeoModelSvcm_geoModelSvc {nullptr}
 
std::string m_svcName {"AGDDtoGeoSvc"}
 

Detailed Description

Definition at line 19 of file MuonAGDDToolHelper.h.

Constructor & Destructor Documentation

◆ MuonAGDDToolHelper()

MuonAGDDToolHelper::MuonAGDDToolHelper ( )

Definition at line 46 of file MuonAGDDToolHelper.cxx.

47 {
48  SmartIF<IGeoModelSvc> geomodel{Gaudi::svcLocator()->service("GeoModelSvc")};
49  if(!geomodel.isValid()) throw std::runtime_error("MuonAGDDToolHelper failed to access GeoModelSvc");
50  SmartIF<IRDBAccessSvc> rdbaccess{Gaudi::svcLocator()->service("RDBAccessSvc")};
51  if(!rdbaccess.isValid()) throw std::runtime_error("MuonAGDDToolHelper failed to access RDBAccessSvc");
52 
53  m_geoModelSvc = geomodel.get();
54  m_rdbAccessSvc = rdbaccess.get();
55 }

Member Function Documentation

◆ BuildMScomponents()

bool MuonAGDDToolHelper::BuildMScomponents ( )
static

Definition at line 118 of file MuonAGDDToolHelper.cxx.

119 {
120  SmartIF<StoreGateSvc> pDetStore{Gaudi::svcLocator()->service("DetectorStore")};
121  if (!pDetStore.isValid()) return false;
122  MuonGM::MuonDetectorManager* muonMgr=nullptr;
123  if (pDetStore->retrieve(muonMgr).isFailure()) return false;
124  bool readoutGeoDone = BuildNSWReadoutGeometry::BuildReadoutGeometry(muonMgr, nullptr/*, GetMSdetectors*/);
125  return readoutGeoDone;
126 }

◆ GetAGDD()

std::string MuonAGDDToolHelper::GetAGDD ( const bool  dumpIt,
const std::string &  tableName,
const std::string &  outFileName 
)

Definition at line 86 of file MuonAGDDToolHelper.cxx.

87 {
88  std::string AtlasVersion = m_geoModelSvc->atlasVersion();
89  std::string MuonVersion = m_geoModelSvc->muonVersionOverride();
90 
91  std::string detectorKey = MuonVersion.empty() ? AtlasVersion : MuonVersion;
92  std::string detectorNode = MuonVersion.empty() ? "ATLAS" : "MuonSpectrometer";
93  if ( MuonVersion == "CUSTOM"){
94  detectorKey = AtlasVersion ;
95  detectorNode = "ATLAS" ;
96  }
97 
98  IRDBRecordset_ptr recordsetAGDD = m_rdbAccessSvc->getRecordsetPtr(tableName,detectorKey,detectorNode);
99  if(!recordsetAGDD) return "";
100 
101  const IRDBRecord *recordAGDD = (*recordsetAGDD)[0];
102  if(!recordAGDD) return "";
103  std::string AgddString = recordAGDD->getString("DATA");
104 
105  size_t pos=AgddString.find("AGDD.dtd");
106  if (pos!=std::string::npos) AgddString.replace(pos-21,32,"-- Reference to AGDD.dtd automatically removed -->");
107  std::ofstream GeneratedFile;
108  if (dumpIt)
109  {
110  std::ofstream GeneratedFile;
111  GeneratedFile.open(outFileName);
112  GeneratedFile<<AgddString;
113  GeneratedFile.close();
114  }
115  return AgddString;
116 }

◆ ReadAGDDFlags()

std::vector< std::string > MuonAGDDToolHelper::ReadAGDDFlags ( )

Definition at line 57 of file MuonAGDDToolHelper.cxx.

58 {
59  std::vector<std::string> structuresFromFlags;
60  std::string agdd2geoVersion = m_rdbAccessSvc->getChildTag("AGDD2GeoSwitches",m_geoModelSvc->muonVersion(),"MuonSpectrometer");
61 
62  if(!agdd2geoVersion.empty())
63  {
64  std::string TheKEYNAME;
65  int TheKEYVALUE;
66  IRDBRecordset_ptr pIRDBRecordset = m_rdbAccessSvc->getRecordsetPtr("AGDD2GeoSwitches",m_geoModelSvc->muonVersion(),"MuonSpectrometer");
67  for(unsigned int i=0; i<pIRDBRecordset->size(); i++)
68  {
69  const IRDBRecord* record = (*pIRDBRecordset)[i];
70  TheKEYNAME = record->getString("KEYNAME");
71  TheKEYVALUE = record->getInt("KEYVALUE");
72  if ( TheKEYVALUE == 1 )
73  {
74  structuresFromFlags.push_back(TheKEYNAME);
75  }
76  }
77  }
78  else
79  {
80  std::cout<<"MuonAGDDToolHelper\tagdd2geoVersion is empty " <<std::endl;
81  }
82  return structuresFromFlags;
83 }

◆ setAGDDtoGeoSvcName()

void MuonAGDDToolHelper::setAGDDtoGeoSvcName ( const std::string &  name)

Definition at line 148 of file MuonAGDDToolHelper.cxx.

148  {
149  m_svcName = name;
150 }

◆ SetNSWComponents()

void MuonAGDDToolHelper::SetNSWComponents ( )

Definition at line 128 of file MuonAGDDToolHelper.cxx.

129 {
130  SmartIF<IAGDDtoGeoSvc> agddsvc{Gaudi::svcLocator()->service(m_svcName)};
131  if(!agddsvc.isValid()) {
132  throw std::runtime_error("MuonAGDDToolHelper::SetNSWComponents() - Could not retrieve "
133  + m_svcName + " from ServiceLocator");
134  }
135 
136  IAGDDtoGeoSvc::LockedController c = agddsvc->getController();
137 
138  agddsvc->addHandler(new micromegasHandler("micromegas", *c));
139  agddsvc->addHandler(new mm_TechHandler("mm_Tech", *c));
140  agddsvc->addHandler(new sTGCHandler("sTGC", *c));
141  agddsvc->addHandler(new sTGC_readoutHandler("sTGC_readout", *c));
142  agddsvc->addHandler(new sTGC_TechHandler("sTGC_Tech", *c));
143  agddsvc->addHandler(new mmSpacerHandler("mmSpacer", *c));
144  agddsvc->addHandler(new mmSpacer_TechHandler("mmSpacer_Tech", *c));
145  agddsvc->addHandler(new mm_readoutHandler("mm_readout", *c));
146 }

Member Data Documentation

◆ m_geoModelSvc

IGeoModelSvc* MuonAGDDToolHelper::m_geoModelSvc {nullptr}
private

Definition at line 37 of file MuonAGDDToolHelper.h.

◆ m_rdbAccessSvc

IRDBAccessSvc* MuonAGDDToolHelper::m_rdbAccessSvc {nullptr}
private

Definition at line 36 of file MuonAGDDToolHelper.h.

◆ m_svcName

std::string MuonAGDDToolHelper::m_svcName {"AGDDtoGeoSvc"}
private

Definition at line 38 of file MuonAGDDToolHelper.h.


The documentation for this class was generated from the following files:
IRDBRecord::getInt
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
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.
sTGC_TechHandler
Definition: sTGC_TechHandler.h:11
CxxUtils::LockedPointer
A pointer together with a movable lock.
Definition: LockedPointer.h:35
BuildNSWReadoutGeometry::BuildReadoutGeometry
static bool BuildReadoutGeometry(MuonGM::MuonDetectorManager *mgr, const NswPassivationDbData *)
Definition: BuildNSWReadoutGeometry.cxx:23
mm_readoutHandler
Definition: mm_readoutHandler.h:11
mmSpacerHandler
Definition: mmSpacerHandler.h:11
IRDBRecord::getString
virtual const std::string & getString(const std::string &fieldName) const =0
Get string field value.
MuonAGDDToolHelper::m_rdbAccessSvc
IRDBAccessSvc * m_rdbAccessSvc
Definition: MuonAGDDToolHelper.h:36
MuonAGDDToolHelper::m_svcName
std::string m_svcName
Definition: MuonAGDDToolHelper.h:38
mmSpacer_TechHandler
Definition: mmSpacer_TechHandler.h:11
DumpGeoConfig.outFileName
string outFileName
Definition: DumpGeoConfig.py:252
EventInfoWrite.AtlasVersion
AtlasVersion
Definition: EventInfoWrite.py:17
IRDBAccessSvc::getChildTag
virtual std::string getChildTag(const std::string &childNode, const std::string &parentTag, const std::string &parentNode, const std::string &connName="ATLASDD")=0
Gets the tag name for the node by giving its parent node tag.
lumiFormat.i
int i
Definition: lumiFormat.py:85
sTGCHandler
Definition: sTGCHandler.h:14
IGeoModelSvc::muonVersionOverride
virtual const std::string & muonVersionOverride() const =0
IGeoModelSvc::muonVersion
virtual const std::string & muonVersion() const =0
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MuonAGDDToolHelper::m_geoModelSvc
IGeoModelSvc * m_geoModelSvc
Definition: MuonAGDDToolHelper.h:37
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
micromegasHandler
Definition: micromegasHandler.h:14
IGeoModelSvc::atlasVersion
virtual const std::string & atlasVersion() const =0
sTGC_readoutHandler
Definition: sTGC_readoutHandler.h:11
python.compressB64.c
def c
Definition: compressB64.py:93
mm_TechHandler
Definition: mm_TechHandler.h:11