ATLAS Offline Software
Loading...
Searching...
No Matches
chamberPositionerHandler.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
10#include "GeoModelKernel/Units.h"
11#include "GaudiKernel/MsgStream.h"
13
14#include <iostream>
15
21
23 xercesc::DOMNode *t)
24{
25 std::string volume=getAttributeAsString(c, t, "volume");
26
27 AGDDDetector* mCham=c.GetDetectorStore().GetDetector(volume);
28 std::string subType;
29 if (!mCham)
30 {
31 MsgStream log(Athena::getMessageSvc(),"chamberPositionerHandler");
32 log<<MSG::WARNING<<"ElementHandle() - Could not retrieve volume "<<volume<<" from DetectorStore!"<<endmsg;
33 return;
34 }
35 else
36 subType=mCham->subType();
37
38 double radius=getAttributeAsDouble(c, t, "radius");
39 double zPos=getAttributeAsDouble(c, t, "zPos");
40
41 double phi0=getAttributeAsDouble(c, t, "phi0",0.);
42 int iWedge=getAttributeAsInt(c, t, "wedge_number",8);
43
44 std::string zLayout=getAttributeAsString(c, t, "zLayout","Z_SYMMETRIC");
45 std::string type=getAttributeAsString(c, t, "type","BARREL");
46 std::string chType=getAttributeAsString(c, t, "chamberType");
47 std::string iSectors=getAttributeAsString(c, t, "iSectors","11111111");
48 std::string detectorType=getAttributeAsString(c, t, "detectorType","MDT");
49 int etaIndex=getAttributeAsInt(c, t, "etaIndex",0);
50
51 double dPhi=360./iWedge;
52 if (iSectors.size()!= (unsigned int) iWedge) std::abort();
53
54 for (int i=0;i<iWedge;i++)
55 {
56 if (iSectors[i]=='0') continue;
57 if (zLayout!="Z_NEGATIVE")
58 {
59 double Wedge=dPhi*i+phi0;
60 GeoTrf::Transform3D crot = GeoTrf::Transform3D::Identity();
61 if (type=="ENDCAP")
62 {
63 // fix to ensure right order of planes
64 crot = crot*GeoTrf::RotateZ3D(Wedge*GeoModelKernelUnits::degree)*GeoTrf::RotateY3D(90*GeoModelKernelUnits::degree)*GeoTrf::RotateZ3D(180.*GeoModelKernelUnits::degree);
65 }
66 else crot = crot*GeoTrf::RotateZ3D(Wedge*GeoModelKernelUnits::degree);
67 double x=radius*std::cos(Wedge*GeoModelKernelUnits::degree);
68 double y=radius*std::sin(Wedge*GeoModelKernelUnits::degree);
69 double zpos=zPos;
70 GeoTrf::Vector3D cvec=GeoTrf::Vector3D(x,y,zpos);
72 p=new AGDDDetectorPositioner(c.GetPositionerStore(),c.GetVolumeStore(),volume,GeoTrf::Translation3D(cvec)*crot);
73 p->SensitiveDetector(true);
74 p->ID.phiIndex=i;
75 p->ID.sideIndex=1;
76 p->ID.etaIndex=etaIndex;
77 p->ID.detectorType=detectorType;
78
79 p->position.Zposition=zpos;
80 p->position.Radius=radius;
81 p->position.PhiStart=phi0;
82 p->position.Phi=Wedge;
83
84 mCham->SetAddressAndPosition(p);
85
86 }
87 if (zLayout!="Z_POSITIVE")
88 {
89 double Wedge=dPhi*i+phi0;
90 GeoTrf::Transform3D crot = GeoTrf::Transform3D::Identity();
91 if (type=="ENDCAP")
92 {
93 // fix to ensure right order of planes
94 crot = crot*GeoTrf::RotateX3D(180.*GeoModelKernelUnits::degree)*GeoTrf::RotateZ3D(-Wedge*GeoModelKernelUnits::degree)*GeoTrf::RotateY3D(90*GeoModelKernelUnits::degree)*GeoTrf::RotateZ3D(180.*GeoModelKernelUnits::degree);
95 }
96 else crot = crot*GeoTrf::RotateZ3D(Wedge*GeoModelKernelUnits::degree);
97 double x=radius*std::cos(Wedge*GeoModelKernelUnits::degree);
98 double y=radius*std::sin(Wedge*GeoModelKernelUnits::degree);
99 double zpos=zPos;
100 GeoTrf::Vector3D cvec=GeoTrf::Vector3D(x,y,-zpos);
101 AGDDDetectorPositioner *p __attribute__((__unused__));
102 p=new AGDDDetectorPositioner(c.GetPositionerStore(),c.GetVolumeStore(),volume,GeoTrf::Translation3D(cvec)*crot);
103 p->SensitiveDetector(true);
104 p->ID.phiIndex=i;
105 p->ID.sideIndex=-1;
106 p->ID.etaIndex=-etaIndex;
107 p->ID.detectorType=detectorType;
108
109 p->position.Zposition=-zpos;
110 p->position.Radius=radius;
111 p->position.PhiStart=phi0;
112 p->position.Phi=Wedge;
113
114 mCham->SetAddressAndPosition(p);
115 }
116 }
117
118}
#define endmsg
__attribute__((always_inline)) inline uint16_t TileCalibDrawerBase
#define y
#define x
void subType(const std::string &s)
void SetAddressAndPosition(AGDDDetectorPositioner *)
int getAttributeAsInt(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
double getAttributeAsDouble(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
XMLHandler(const std::string &n, AGDDController &c)
std::string getAttributeAsString(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
chamberPositionerHandler(const std::string &, AGDDController &c)
virtual void ElementHandle(AGDDController &c, xercesc::DOMNode *t) override
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)