ATLAS Offline Software
Loading...
Searching...
No Matches
mposPhiHandler.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
8#include "GeoModelKernel/Units.h"
9#include "GaudiKernel/MsgStream.h"
11
12#include <iostream>
13
14mposPhiHandler::mposPhiHandler(const std::string& s,
16 : XMLHandler(s, c)
17{
18}
19
21 xercesc::DOMNode *t)
22{
23
24 bool res;
25 std::string volume=getAttributeAsString(c, t, "volume");
26 int icopy=getAttributeAsInt(c, t, "ncopy",0);
27 double phi0=getAttributeAsDouble(c, t, "Phi0",res);
28 if (!res) phi0=0;
29 double dphi=getAttributeAsDouble(c, t, "dPhi",res);
30
31 if (!res) // dphi must be calculated
32 {
33 if (icopy>0)
34 dphi=360./icopy;
35 else
36 {
37 MsgStream log(Athena::getMessageSvc(),"mposPhiHandler");
38 log<<MSG::WARNING<<"ElementHandle() - both icopy and dphi are nullptr!! volume "<<volume<<" cannot continue!"<<endmsg;
39 return;
40 }
41 }
42 bool impliedRot;
43 std::string s;
44 std::string iR=getAttributeAsString(c, t, "impliedRot",impliedRot);
45 if (impliedRot) s=iR;
46 double lateral_displacement=getAttributeAsDouble(c, t, "S",res);
47 if (!res) lateral_displacement=0;
48
49 std::vector<double> vvv = getAttributeAsVector(c, t, "R_Z",res);
50 double rad=0,zpos=0;
51 if (res)
52 {
53 rad=vvv[0];
54 zpos=vvv[1];
55 }
56
57 GeoTrf::Transform3D crot = GeoTrf::Transform3D::Identity();
58
59 vvv=getAttributeAsVector(c, t, "rot",res);
60 if (res)
61 {
62 crot = crot*GeoTrf::RotateZ3D(vvv[2]*GeoModelKernelUnits::degree)*GeoTrf::RotateY3D(vvv[1]*GeoModelKernelUnits::degree)*GeoTrf::RotateX3D(vvv[0]*GeoModelKernelUnits::degree);
63 }
64
65 for (int i=0;i<icopy;i++)
66 {
67 GeoTrf::Vector2D position(rad,lateral_displacement);
68 double phi=phi0+dphi*i;
69 position = Eigen::Rotation2Dd(phi*GeoModelKernelUnits::degree)*position;
70
71 double x=position.x();
72 double y=position.y();
73
74 GeoTrf::Vector3D cvec=GeoTrf::Vector3D(x,y,zpos);
75 if (s!="false"&&i>0) crot = GeoTrf::RotateZ3D(dphi*GeoModelKernelUnits::degree)*crot;
76 else if (s!="false"&&i==0) crot = GeoTrf::RotateZ3D(phi0*GeoModelKernelUnits::degree)*crot;
77
78 new AGDDPositioner(c.GetPositionerStore(),
79 c.GetVolumeStore(),
80 volume,GeoTrf::Translation3D(cvec)*crot);
81 }
82}
Scalar phi() const
phi method
#define endmsg
std::pair< std::vector< unsigned int >, bool > res
#define y
#define x
int getAttributeAsInt(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
std::vector< double > getAttributeAsVector(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
virtual void ElementHandle(AGDDController &c, xercesc::DOMNode *t) override
mposPhiHandler(const std::string &, AGDDController &c)
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)