ATLAS Offline Software
Loading...
Searching...
No Matches
MMDetectorHelper Class Reference

#include <MMDetectorHelper.h>

Collaboration diagram for MMDetectorHelper:

Public Member Functions

 MMDetectorHelper ()
MicromegasIterator MM_begin ()
MicromegasIterator MM_end ()
MMDetectorDescriptionGet_MMDetectorType (const std::string &type)
MMDetectorDescriptionGet_MMDetectorSubType (const std::string &type)
MMDetectorDescriptionGet_MMDetector (char type, int ieta, int iphi, int layer=1, char side='A')
AGDDPositionedDetector Get_MMPositionedDetector (char type, int ieta, int iphi, int layer=1, char side='A')
IAGDDtoGeoSvc::LockedController Get_Controller ()

Private Attributes

MicromegasMap m_MicromegasList
MicromegasMapSubType m_MicromegasListSubType
ServiceHandle< IAGDDtoGeoSvcm_svc {"AGDDtoGeoSvc", "MMDetectorHelper"}

Detailed Description

Definition at line 24 of file MMDetectorHelper.h.

Constructor & Destructor Documentation

◆ MMDetectorHelper()

MMDetectorHelper::MMDetectorHelper ( )

Definition at line 15 of file MMDetectorHelper.cxx.

16{
17 if (m_svc.retrieve().isFailure()) {
18 std::abort();
19 }
20 IAGDDtoGeoSvc::LockedController c = m_svc->getController();
21 detectorList vl= c->GetDetectorStore().GetDetectorList();
22
23 for ( const auto& vl_iter: vl)
24 {
25 MMDetectorDescription* st=dynamic_cast<MMDetectorDescription*>(vl_iter.second);
26 if (st) {
27 m_MicromegasList[vl_iter.first]=st;
28 m_MicromegasListSubType[vl_iter.second->subType()]=st;
29 }
30 }
31
32}
std::map< std::string, AGDDDetector * > detectorList
CxxUtils::LockedPointer< AGDDController > LockedController
ServiceHandle< IAGDDtoGeoSvc > m_svc
MicromegasMap m_MicromegasList
MicromegasMapSubType m_MicromegasListSubType

Member Function Documentation

◆ Get_Controller()

IAGDDtoGeoSvc::LockedController MMDetectorHelper::Get_Controller ( )

Definition at line 126 of file MMDetectorHelper.cxx.

127{
128 return m_svc->getController();
129}

◆ Get_MMDetector()

MMDetectorDescription * MMDetectorHelper::Get_MMDetector ( char type,
int ieta,
int iphi,
int layer = 1,
char side = 'A' )

Definition at line 41 of file MMDetectorHelper.cxx.

42{
43 MMDetectorDescription* mm=nullptr;
44
45 IAGDDtoGeoSvc::LockedController c = m_svc->getController();
46 AGDDPositionerStore& ps = c->GetPositionerStore();
47 for (unsigned int i=0;i<ps.size();i++)
48 {
49 AGDDDetectorPositioner* dp=dynamic_cast<AGDDDetectorPositioner*>(ps[i]);
50 if (dp)
51 {
52 if (dp->ID.detectorType != "Micromegas") continue;
53 std::string_view dad=dp->ID.detectorAddress;
54
55 char dtype=dad[3];
56 char dctype='L';
57 if (dtype=='3') dctype='S';
58 if (dctype!=type) continue;
59 int deta=myatoi(dad.substr(5,1));
60 if (deta!=ieta) continue;
61 int dphi=myatoi(dad.substr(12,1));
62 if (dphi!=iphi) continue;
63 int dlayer=myatoi(dad.substr(7,1));
64 if (dlayer!=layer) continue;
65 char dside=dad[13];
66 if (dside!=side) continue;
67
68 mm=dynamic_cast<MMDetectorDescription*>(dp->theDetector);
69 }
70 if(mm) break;
71 }
72 if (!mm) std::cout<<" could not find a positioned Micromegas!!!! "<<std::endl;
73 return mm;
74}
int myatoi(std::string_view str)

◆ Get_MMDetectorSubType()

MMDetectorDescription * MMDetectorHelper::Get_MMDetectorSubType ( const std::string & type)

Definition at line 119 of file MMDetectorHelper.cxx.

120{
121 if (auto itr = m_MicromegasListSubType.find(type); itr != m_MicromegasListSubType.end()) return itr->second;
122 return nullptr;
123}

◆ Get_MMDetectorType()

MMDetectorDescription * MMDetectorHelper::Get_MMDetectorType ( const std::string & type)

Definition at line 113 of file MMDetectorHelper.cxx.

114{
115 if (auto itr = m_MicromegasList.find(type); itr != m_MicromegasList.end()) return itr->second;
116 return nullptr;
117}

◆ Get_MMPositionedDetector()

AGDDPositionedDetector MMDetectorHelper::Get_MMPositionedDetector ( char type,
int ieta,
int iphi,
int layer = 1,
char side = 'A' )

Definition at line 76 of file MMDetectorHelper.cxx.

77{
78 MMDetectorDescription* mm=nullptr;
79 AGDDDetectorPositioner* dp=nullptr;
80
81 IAGDDtoGeoSvc::LockedController c = m_svc->getController();
82 AGDDPositionerStore& ps = c->GetPositionerStore();
83 for (unsigned int i=0;i<ps.size();i++)
84 {
85 dp=dynamic_cast<AGDDDetectorPositioner*>(ps[i]);
86 if (dp)
87 {
88 if (dp->ID.detectorType != "Micromegas") continue;
89 std::string_view dad=dp->ID.detectorAddress;
90
91 char dtype=dad[3];
92 char dctype='L';
93 if (dtype=='3') dctype='S';
94 if (dctype!=type) continue;
95 int deta=myatoi(dad.substr(5,1));
96 if (deta!=ieta) continue;
97 int dphi=myatoi(dad.substr(12,1));
98 if (dphi!=iphi) continue;
99 int dlayer=myatoi(dad.substr(7,1));
100 if (dlayer!=layer) continue;
101 char dside=dad[13];
102 if (dside!=side) continue;
103
104 mm=dynamic_cast<MMDetectorDescription*>(dp->theDetector);
105 }
106 if(mm) break;
107 }
108 if (!mm) std::cout<<" could not find a positioned Micromegas!!!! "<<std::endl;
109 AGDDPositionedDetector p_mm(mm,dp);
110 return p_mm;
111}
std::pair< MMDetectorDescription *, AGDDDetectorPositioner * > AGDDPositionedDetector

◆ MM_begin()

MicromegasIterator MMDetectorHelper::MM_begin ( )
inline

Definition at line 27 of file MMDetectorHelper.h.

27{return m_MicromegasList.begin();}

◆ MM_end()

MicromegasIterator MMDetectorHelper::MM_end ( )
inline

Definition at line 28 of file MMDetectorHelper.h.

28{return m_MicromegasList.end();}

Member Data Documentation

◆ m_MicromegasList

MicromegasMap MMDetectorHelper::m_MicromegasList
private

Definition at line 38 of file MMDetectorHelper.h.

◆ m_MicromegasListSubType

MicromegasMapSubType MMDetectorHelper::m_MicromegasListSubType
private

Definition at line 39 of file MMDetectorHelper.h.

◆ m_svc

ServiceHandle<IAGDDtoGeoSvc> MMDetectorHelper::m_svc {"AGDDtoGeoSvc", "MMDetectorHelper"}
private

Definition at line 40 of file MMDetectorHelper.h.

40{"AGDDtoGeoSvc", "MMDetectorHelper"};

The documentation for this class was generated from the following files: