ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
chamberPositionerHandler Class Reference

#include <chamberPositionerHandler.h>

Inheritance diagram for chamberPositionerHandler:
Collaboration diagram for chamberPositionerHandler:

Public Member Functions

 chamberPositionerHandler (const std::string &, AGDDController &c)
 
virtual void ElementHandle (AGDDController &c, xercesc::DOMNode *t) override
 
const std::string & GetName () const
 
virtual void Handle (AGDDController &c, xercesc::DOMNode *t)
 
void StopLoop (bool)
 
bool IsLoopToBeStopped () const
 

Protected Member Functions

bool isAttribute (const xercesc::DOMNode *t, const std::string &) const
 
std::string getAttribute (const xercesc::DOMNode *t, const std::string &, bool &) const
 
std::string getAttributeAsString (AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
 
std::string getAttributeAsString (AGDDController &c, const xercesc::DOMNode *t, const std::string &, bool &) const
 
std::string getAttributeAsString (AGDDController &c, const xercesc::DOMNode *t, const std::string &, const std::string &) const
 
double getAttributeAsDouble (AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
 
double getAttributeAsDouble (AGDDController &c, const xercesc::DOMNode *t, const std::string &, bool &) const
 
double getAttributeAsDouble (AGDDController &c, const xercesc::DOMNode *t, const std::string &, const double) const
 
int getAttributeAsInt (AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
 
int getAttributeAsInt (AGDDController &c, const xercesc::DOMNode *t, const std::string &, bool &) const
 
int getAttributeAsInt (AGDDController &c, const xercesc::DOMNode *t, const std::string &, const int) const
 
std::vector< double > getAttributeAsVector (AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
 
std::vector< double > getAttributeAsVector (AGDDController &c, const xercesc::DOMNode *t, const std::string &, bool &) const
 
std::vector< double > getAttributeAsVector (AGDDController &c, const xercesc::DOMNode *t, const std::string &, const std::vector< double > &) const
 
std::vector< int > getAttributeAsIntVector (AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
 
std::vector< int > getAttributeAsIntVector (AGDDController &c, const xercesc::DOMNode *t, const std::string &, bool &) const
 
std::vector< int > getAttributeAsIntVector (AGDDController &c, const xercesc::DOMNode *t, const std::string &, const std::vector< int > &) const
 

Protected Attributes

std::string m_name
 
bool m_stopLoop
 

Private Member Functions

void RegisterToStore (AGDDController &c)
 

Detailed Description

Definition at line 12 of file chamberPositionerHandler.h.

Constructor & Destructor Documentation

◆ chamberPositionerHandler()

chamberPositionerHandler::chamberPositionerHandler ( const std::string &  s,
AGDDController c 
)

Definition at line 16 of file chamberPositionerHandler.cxx.

18  : XMLHandler(s, c)
19 {
20 }

Member Function Documentation

◆ ElementHandle()

void chamberPositionerHandler::ElementHandle ( AGDDController c,
xercesc::DOMNode *  t 
)
overridevirtual

Implements XMLHandler.

Definition at line 22 of file chamberPositionerHandler.cxx.

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 }

◆ getAttribute()

std::string XMLHandler::getAttribute ( const xercesc::DOMNode *  t,
const std::string &  name,
bool &  isPresent 
) const
protectedinherited

Definition at line 43 of file XMLHandler.cxx.

45 {
46  std::string retValue="";
47  isPresent=false;
48  if (t->hasAttributes()) {
49  DOMNamedNodeMap *pAttributes = t->getAttributes();
50  auto deleter = [&](XMLCh buf[]) { XMLString::release(&buf); };
51  std::unique_ptr<XMLCh[], decltype(deleter)> ptr(XMLString::transcode(name.c_str()), deleter);
52  DOMAttr *pAttributeNode = (DOMAttr*) pAttributes->getNamedItem(ptr.get());
53  if (pAttributeNode) {
54 
55  char* val=XMLString::transcode(pAttributeNode->getValue());
56  if (val) {
57 
58  isPresent=true;
59  retValue=val;
61  return retValue;
62  }
63  }
64  else return retValue;
65 
66  }
67  return retValue;
68 }

◆ getAttributeAsDouble() [1/3]

double XMLHandler::getAttributeAsDouble ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name 
) const
protectedinherited

Definition at line 78 of file XMLHandler.cxx.

81 {
82  double res=0.;
83  bool isPresent;
84  std::string temp=getAttribute(t, name,isPresent);
85  if (!isPresent) std::abort();
86  res=c.Evaluator().Eval(temp.c_str());
87  return res;
88 }

◆ getAttributeAsDouble() [2/3]

double XMLHandler::getAttributeAsDouble ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name,
bool &  isPresent 
) const
protectedinherited

Definition at line 139 of file XMLHandler.cxx.

142 {
143  double res=0.;
144  std::string temp=getAttribute(t, name,isPresent);
145  if (isPresent)
146  {
147  res=c.Evaluator().Eval(temp.c_str());
148  }
149  return res;
150 }

◆ getAttributeAsDouble() [3/3]

double XMLHandler::getAttributeAsDouble ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name,
const double  def 
) const
protectedinherited

Definition at line 206 of file XMLHandler.cxx.

209 {
210  bool isPresent;
211  double res=0.;
212  std::string temp=getAttribute(t, name,isPresent);
213  if (isPresent)
214  {
215  res=c.Evaluator().Eval(temp.c_str());
216  return res;
217  }
218  return def;
219 }

◆ getAttributeAsInt() [1/3]

int XMLHandler::getAttributeAsInt ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name 
) const
protectedinherited

Definition at line 89 of file XMLHandler.cxx.

92 {
93  int res=0;
94  bool isPresent;
95  std::string temp=getAttribute(t, name,isPresent);
96  if (!isPresent) std::abort();
97  res=c.Evaluator().Eval(temp.c_str());
98  return res;
99 }

◆ getAttributeAsInt() [2/3]

int XMLHandler::getAttributeAsInt ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name,
bool &  isPresent 
) const
protectedinherited

Definition at line 151 of file XMLHandler.cxx.

154 {
155  int res=0;
156  std::string temp=getAttribute(t, name,isPresent);
157  if (isPresent)
158  {
159  res=c.Evaluator().Eval(temp.c_str());
160  }
161  return res;
162 }

◆ getAttributeAsInt() [3/3]

int XMLHandler::getAttributeAsInt ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name,
const int  def 
) const
protectedinherited

Definition at line 220 of file XMLHandler.cxx.

223 {
224  bool isPresent;
225  int res=0;
226  std::string temp=getAttribute(t, name,isPresent);
227  if (isPresent)
228  {
229  res=c.Evaluator().Eval(temp.c_str());
230  return res;
231  }
232  return def;
233 }

◆ getAttributeAsIntVector() [1/3]

std::vector< int > XMLHandler::getAttributeAsIntVector ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name 
) const
protectedinherited

Definition at line 116 of file XMLHandler.cxx.

119 {
120  bool isPresent;
121  std::vector<int> vect;
122  std::string temp=getAttribute(t, name,isPresent);
123  if (!isPresent) std::abort();
124  std::vector<std::string> v=c.Evaluator().tokenize(";",temp);
125  for (unsigned int i=0;i<v.size();i++)
126  {
127  vect.push_back(c.Evaluator().Eval(v[i].c_str()));
128  }
129  return vect;
130 }

◆ getAttributeAsIntVector() [2/3]

std::vector< int > XMLHandler::getAttributeAsIntVector ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name,
bool &  isPresent 
) const
protectedinherited

Definition at line 180 of file XMLHandler.cxx.

183 {
184  std::vector<int> vect;
185  std::string temp=getAttribute(t, name,isPresent);
186  if (isPresent)
187  {
188  std::vector<std::string> v=c.Evaluator().tokenize(";",temp);
189  for (unsigned int i=0;i<v.size();i++)
190  {
191  vect.push_back(c.Evaluator().Eval(v[i].c_str()));
192  }
193  }
194  return vect;
195 }

◆ getAttributeAsIntVector() [3/3]

std::vector< int > XMLHandler::getAttributeAsIntVector ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name,
const std::vector< int > &  def 
) const
protectedinherited

Definition at line 253 of file XMLHandler.cxx.

256 {
257  bool isPresent;
258  std::vector<int> vect;
259  std::string temp=getAttribute(t, name,isPresent);
260  if (isPresent)
261  {
262  std::vector<std::string> v=c.Evaluator().tokenize(";",temp);
263  for (unsigned int i=0;i<v.size();i++)
264  {
265  vect.push_back(c.Evaluator().Eval(v[i].c_str()));
266  }
267  return vect;
268  }
269  return def;
270 }

◆ getAttributeAsString() [1/3]

std::string XMLHandler::getAttributeAsString ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name 
) const
protectedinherited

Definition at line 69 of file XMLHandler.cxx.

72 {
73  bool isPresent;
74  std::string temp=getAttribute(t, name,isPresent);
75  if (!isPresent) std::abort();
76  return temp;
77 }

◆ getAttributeAsString() [2/3]

std::string XMLHandler::getAttributeAsString ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name,
bool &  isPresent 
) const
protectedinherited

Definition at line 132 of file XMLHandler.cxx.

135 {
136  std::string temp=getAttribute(t, name,isPresent);
137  return temp;
138 }

◆ getAttributeAsString() [3/3]

std::string XMLHandler::getAttributeAsString ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name,
const std::string &  def 
) const
protectedinherited

Definition at line 197 of file XMLHandler.cxx.

200 {
201  bool isPresent;
202  std::string temp=getAttribute(t, name,isPresent);
203  if (isPresent) return temp;
204  else return def;
205 }

◆ getAttributeAsVector() [1/3]

std::vector< double > XMLHandler::getAttributeAsVector ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name 
) const
protectedinherited

Definition at line 100 of file XMLHandler.cxx.

103 {
104  bool isPresent;
105  std::vector<double> vect;
106  std::string temp=getAttribute(t, name,isPresent);
107  if (!isPresent) std::abort();
108  std::vector<std::string> v=c.Evaluator().tokenize(";",temp);
109  for (unsigned int i=0;i<v.size();i++)
110  {
111  vect.push_back(c.Evaluator().Eval(v[i].c_str()));
112  }
113  return vect;
114 }

◆ getAttributeAsVector() [2/3]

std::vector< double > XMLHandler::getAttributeAsVector ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name,
bool &  isPresent 
) const
protectedinherited

Definition at line 163 of file XMLHandler.cxx.

166 {
167  std::vector<double> vect;
168  std::string temp=getAttribute(t, name,isPresent);
169  if (isPresent)
170  {
171  std::vector<std::string> v=c.Evaluator().tokenize(";",temp);
172  for (unsigned int i=0;i<v.size();i++)
173  {
174  vect.push_back(c.Evaluator().Eval(v[i].c_str()));
175  }
176  }
177  return vect;
178 }

◆ getAttributeAsVector() [3/3]

std::vector< double > XMLHandler::getAttributeAsVector ( AGDDController c,
const xercesc::DOMNode *  t,
const std::string &  name,
const std::vector< double > &  def 
) const
protectedinherited

Definition at line 234 of file XMLHandler.cxx.

237 {
238  bool isPresent;
239  std::vector<double> vect;
240  std::string temp=getAttribute(t, name,isPresent);
241  if (isPresent)
242  {
243  std::vector<std::string> v=c.Evaluator().tokenize(";",temp);
244  for (unsigned int i=0;i<v.size();i++)
245  {
246  vect.push_back(c.Evaluator().Eval(v[i].c_str()));
247  }
248  return vect;
249  }
250  return def;
251 }

◆ GetName()

const std::string& XMLHandler::GetName ( ) const
inlineinherited

Definition at line 19 of file XMLHandler.h.

19 {return m_name;}

◆ Handle()

virtual void XMLHandler::Handle ( AGDDController c,
xercesc::DOMNode *  t 
)
inlinevirtualinherited

Definition at line 22 of file XMLHandler.h.

24  {
25  ElementHandle(c, t);
26  }

◆ isAttribute()

bool XMLHandler::isAttribute ( const xercesc::DOMNode *  t,
const std::string &  name 
) const
protectedinherited

Definition at line 36 of file XMLHandler.cxx.

38 {
39  bool res;
40  std::string temp=getAttribute(t, name,res);
41  return res;
42 }

◆ IsLoopToBeStopped()

bool XMLHandler::IsLoopToBeStopped ( ) const
inherited

Definition at line 32 of file XMLHandler.cxx.

33 {
34  return m_stopLoop;
35 }

◆ RegisterToStore()

void XMLHandler::RegisterToStore ( AGDDController c)
privateinherited

Definition at line 23 of file XMLHandler.cxx.

24 {
25  c.GetHandlerStore().RegisterHandler(this);
26 }

◆ StopLoop()

void XMLHandler::StopLoop ( bool  v)
inherited

Definition at line 28 of file XMLHandler.cxx.

29 {
30  m_stopLoop=v;
31 }

Member Data Documentation

◆ m_name

std::string XMLHandler::m_name
protectedinherited

Definition at line 30 of file XMLHandler.h.

◆ m_stopLoop

bool XMLHandler::m_stopLoop
protectedinherited

Definition at line 31 of file XMLHandler.h.


The documentation for this class was generated from the following files:
temp
Definition: JetEventDict.h:21
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
InDetAccessor::phi0
@ phi0
Definition: InDetAccessor.h:33
AGDDDetectorPositioner
Definition: AGDDDetectorPositioner.h:39
CoreParser::DOMNamedNodeMap
std::map< std::string, std::string > DOMNamedNodeMap
Definition: DOMNode.h:15
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
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
sTgcIdHelper::sTgcChannelTypes
sTgcChannelTypes
Definition: sTgcIdHelper.h:190
x
#define x
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
AGDDDetector
Definition: AGDDDetector.h:15
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
XMLHandler::ElementHandle
virtual void ElementHandle(AGDDController &c, xercesc::DOMNode *t)=0
python.DecayParser.buf
buf
print ("=> [%s]"cmd)
Definition: DecayParser.py:27
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
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
AGDDDetector::SetAddressAndPosition
void SetAddressAndPosition(AGDDDetectorPositioner *)
Definition: AGDDDetector.cxx:8
XMLHandler::getAttribute
std::string getAttribute(const xercesc::DOMNode *t, const std::string &, bool &) const
Definition: XMLHandler.cxx:43
XMLHandler::m_name
std::string m_name
Definition: XMLHandler.h:30
XMLHandler::getAttributeAsString
std::string getAttributeAsString(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:69
python.EventInfoMgtInit.release
release
Definition: EventInfoMgtInit.py:24
XMLHandler::XMLHandler
XMLHandler(const std::string &n, AGDDController &c)
Definition: XMLHandler.cxx:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
XMLHandler::m_stopLoop
bool m_stopLoop
Definition: XMLHandler.h:31
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
python.PyAthena.v
v
Definition: PyAthena.py:154
__attribute__
__attribute__((always_inline)) inline uint16_t TileCalibDrawerBase
Definition: TileCalibDrawerBase.h:190
y
#define y
XMLHandler::getAttributeAsInt
int getAttributeAsInt(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:89
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
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