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

IRDBAccessSvcp_RDBAccessSvc
 
IGeoModelSvcp_GeoModelSvc
 
std::string m_svcName
 

Detailed Description

Definition at line 19 of file MuonAGDDToolHelper.h.

Constructor & Destructor Documentation

◆ MuonAGDDToolHelper()

MuonAGDDToolHelper::MuonAGDDToolHelper ( )

Definition at line 46 of file MuonAGDDToolHelper.cxx.

46  :
47  p_RDBAccessSvc(nullptr),
48  p_GeoModelSvc(nullptr),
49  m_svcName("AGDDtoGeoSvc") {
51 
52  result=Gaudi::svcLocator()->service("GeoModelSvc",p_GeoModelSvc);
53  if (result.isFailure())
54  {
55  std::cout<<"MuonAGDDToolHelper\tunable to access GeoModelSvc "<<std::endl;
56  }
57  result=Gaudi::svcLocator()->service("RDBAccessSvc",p_RDBAccessSvc);
58  if (result.isFailure())
59  {
60  std::cout<<"MuonAGDDToolHelper\tunable to access RBDAccessSvc "<<std::endl;
61  }
62 }

Member Function Documentation

◆ BuildMScomponents()

bool MuonAGDDToolHelper::BuildMScomponents ( )
static

Definition at line 135 of file MuonAGDDToolHelper.cxx.

136 {
137  StoreGateSvc* pDetStore=nullptr;
138  ISvcLocator* svcLocator = Gaudi::svcLocator();
139  if (svcLocator->service("DetectorStore",pDetStore).isFailure()) return false;
140  MuonGM::MuonDetectorManager* muonMgr=nullptr;
141  if (pDetStore->retrieve(muonMgr).isFailure()) return false;
142  bool readoutGeoDone = BuildNSWReadoutGeometry::BuildReadoutGeometry(muonMgr, nullptr/*, GetMSdetectors*/);
143  return readoutGeoDone;
144 }

◆ GetAGDD()

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

Definition at line 93 of file MuonAGDDToolHelper.cxx.

94 {
95 
96  const IGeoModelSvc * geoModel=p_GeoModelSvc;
97  if(!geoModel) return "";
98 
99  IRDBAccessSvc * accessSvc=p_RDBAccessSvc;
100  if(!accessSvc) return "";
101 
102  std::string AtlasVersion = geoModel->atlasVersion();
103  std::string MuonVersion = geoModel->muonVersionOverride();
104 
105  std::string detectorKey = MuonVersion.empty() ? AtlasVersion : MuonVersion;
106  std::string detectorNode = MuonVersion.empty() ? "ATLAS" : "MuonSpectrometer";
107  if ( MuonVersion == "CUSTOM"){
108  detectorKey = AtlasVersion ;
109  detectorNode = "ATLAS" ;
110  }
111 
112 
113  IRDBRecordset_ptr recordsetAGDD = accessSvc->getRecordsetPtr(tableName.c_str(),detectorKey,detectorNode);
114  if(!recordsetAGDD) return "";
115 
116  const IRDBRecord *recordAGDD = (*recordsetAGDD)[0];
117  if(!recordAGDD) return "";
118  std::string AgddString = recordAGDD->getString("DATA");
119 
120  size_t pos=AgddString.find("AGDD.dtd");
121  if (pos!=std::string::npos) AgddString.replace(pos-21,32,"-- Reference to AGDD.dtd automatically removed -->");
122  std::ofstream GeneratedFile;
123  if (dumpIt)
124  {
125  std::ofstream GeneratedFile;
126  GeneratedFile.open(outFileName);
127  GeneratedFile<<AgddString;
128  GeneratedFile.close();
129  }
130 
131  return AgddString;
132 
133 }

◆ ReadAGDDFlags()

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

Definition at line 64 of file MuonAGDDToolHelper.cxx.

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

◆ setAGDDtoGeoSvcName()

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

Definition at line 166 of file MuonAGDDToolHelper.cxx.

166  {
167  m_svcName = name;
168 }

◆ SetNSWComponents()

void MuonAGDDToolHelper::SetNSWComponents ( )

Definition at line 146 of file MuonAGDDToolHelper.cxx.

147 {
148  IAGDDtoGeoSvc* agddsvc = nullptr;
149  if (Gaudi::svcLocator()->service(m_svcName,agddsvc).isFailure()) {
150  throw std::runtime_error("MuonAGDDToolHelper::SetNSWComponents() - Could not retrieve "
151  + m_svcName + " from ServiceLocator");
152  }
153 
155 
156  agddsvc->addHandler(new micromegasHandler("micromegas", *c));
157  agddsvc->addHandler(new mm_TechHandler("mm_Tech", *c));
158  agddsvc->addHandler(new sTGCHandler("sTGC", *c));
159  agddsvc->addHandler(new sTGC_readoutHandler("sTGC_readout", *c));
160  agddsvc->addHandler(new sTGC_TechHandler("sTGC_Tech", *c));
161  agddsvc->addHandler(new mmSpacerHandler("mmSpacer", *c));
162  agddsvc->addHandler(new mmSpacer_TechHandler("mmSpacer_Tech", *c));
163  agddsvc->addHandler(new mm_readoutHandler("mm_readout", *c));
164 }

Member Data Documentation

◆ m_svcName

std::string MuonAGDDToolHelper::m_svcName
private

Definition at line 38 of file MuonAGDDToolHelper.h.

◆ p_GeoModelSvc

IGeoModelSvc* MuonAGDDToolHelper::p_GeoModelSvc
private

Definition at line 37 of file MuonAGDDToolHelper.h.

◆ p_RDBAccessSvc

IRDBAccessSvc* MuonAGDDToolHelper::p_RDBAccessSvc
private

Definition at line 36 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.
get_generator_info.result
result
Definition: get_generator_info.py:21
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.
IGeoModelSvc
Definition: IGeoModelSvc.h:17
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_svcName
std::string m_svcName
Definition: MuonAGDDToolHelper.h:38
MuonAGDDToolHelper::p_RDBAccessSvc
IRDBAccessSvc * p_RDBAccessSvc
Definition: MuonAGDDToolHelper.h:36
mmSpacer_TechHandler
Definition: mmSpacer_TechHandler.h:11
DumpGeoConfig.outFileName
string outFileName
Definition: DumpGeoConfig.py:238
MuonAGDDToolHelper::p_GeoModelSvc
IGeoModelSvc * p_GeoModelSvc
Definition: MuonAGDDToolHelper.h:37
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:92
IRDBAccessSvc
IRDBAccessSvc is an abstract interface to the athena service that provides the following functionalit...
Definition: IRDBAccessSvc.h:45
sTGCHandler
Definition: sTGCHandler.h:14
Atlas.StoreGateSvc
StoreGateSvc
Definition: Atlas.UnixStandardJob.py:25
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
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
IAGDDtoGeoSvc::addHandler
virtual void addHandler(XMLHandler *)=0
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
IAGDDtoGeoSvc::getController
virtual LockedController getController()=0
IAGDDtoGeoSvc
Definition: IAGDD2GeoSvc.h:20
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:49
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