ATLAS Offline Software
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 
14 mposPhiHandler::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 
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 }
AGDDController.h
AGDDPositioner.h
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
InDetAccessor::phi0
@ phi0
Definition: InDetAccessor.h:33
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
XMLHandler::getAttributeAsDouble
double getAttributeAsDouble(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:78
x
#define x
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
AGDDPositioner
Definition: AGDDPositioner.h:18
AGDDController
Definition: AGDDController.h:30
mposPhiHandler.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
XMLHandler::getAttributeAsVector
std::vector< double > getAttributeAsVector(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:100
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
XMLHandler::getAttributeAsString
std::string getAttributeAsString(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:69
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
XMLHandler
Definition: XMLHandler.h:15
mposPhiHandler::ElementHandle
virtual void ElementHandle(AGDDController &c, xercesc::DOMNode *t) override
Definition: mposPhiHandler.cxx:20
y
#define y
XMLHandler::getAttributeAsInt
int getAttributeAsInt(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:89
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
python.compressB64.c
def c
Definition: compressB64.py:93
mposPhiHandler::mposPhiHandler
mposPhiHandler(const std::string &, AGDDController &c)
Definition: mposPhiHandler.cxx:14
python.SystemOfUnits.degree
tuple degree
Definition: SystemOfUnits.py:106
python.SystemOfUnits.rad
int rad
Definition: SystemOfUnits.py:111