ATLAS Offline Software
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 
18  : XMLHandler(s, c)
19 {
20 }
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);
69  double zpos=zPos;
71  AGDDDetectorPositioner *p __attribute__((__unused__));
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);
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 }
AGDDController.h
AGDDDetectorStore.h
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
InDetAccessor::phi0
@ phi0
Definition: InDetAccessor.h:33
AGDDDetectorPositioner
Definition: AGDDDetectorPositioner.h:39
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
XMLHandler::getAttributeAsDouble
double getAttributeAsDouble(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:78
sTgcIdHelper::sTgcChannelTypes
sTgcChannelTypes
Definition: sTgcIdHelper.h:190
x
#define x
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
AGDDController
Definition: AGDDController.h:30
AGDDDetector
Definition: AGDDDetector.h:15
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:538
AGDDDetectorPositioner.h
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
AGDDDetector::SetAddressAndPosition
void SetAddressAndPosition(AGDDDetectorPositioner *)
Definition: AGDDDetector.cxx:8
XMLHandler::getAttributeAsString
std::string getAttributeAsString(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:69
chamberPositionerHandler.h
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
XMLHandler
Definition: XMLHandler.h:15
chamberPositionerHandler::ElementHandle
virtual void ElementHandle(AGDDController &c, xercesc::DOMNode *t) override
Definition: chamberPositionerHandler.cxx:22
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
AGDDDetector.h
__attribute__
__attribute__((always_inline)) inline uint16_t TileCalibDrawerBase
Definition: TileCalibDrawerBase.h:190
y
#define y
chamberPositionerHandler::chamberPositionerHandler
chamberPositionerHandler(const std::string &, AGDDController &c)
Definition: chamberPositionerHandler.cxx:16
XMLHandler::getAttributeAsInt
int getAttributeAsInt(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:89
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
AGDDDetector::subType
void subType(const std::string &s)
Definition: AGDDDetector.h:32
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
python.compressB64.c
def c
Definition: compressB64.py:93
python.SystemOfUnits.degree
tuple degree
Definition: SystemOfUnits.py:106