#ifndef AGDBMPOSPHIHH #define AGDBMPOSPHIHH #include "ExpatInterface/Element.h" #include "agdbPos.hh" #include "agdbBase.hh" #include "agdbVolume.hh" #include "agdbAttribute.hh" namespace agdb { class MPosPhi : public Pos { private: Volume * _volume; // volume IDREF #REQUIRED Attribute _n; // ncopy CDATA #REQUIRED Attribute _phi0; // Phi0 CDATA "0" Attribute _dPhi; // dPhi CDATA #IMPLIED Attribute _rZ; // R_Z CDATA "0 0" Attribute _stagger; // S CDATA "0" Attribute _rot; // rot CDATA "0 0 0" Attribute _indexStep; // indexstep CDATA "1" public: MPosPhi() : Pos("mposPhi"), _volume(0), _n ("ncopy" , Attribute::required), _phi0 ("Phi0" , "0" ), _dPhi ("dPhi" , Attribute::implied ), _rZ ("R_Z" , "0 0" ), _stagger ("S" , "0" ), _rot ("rot" , "0 0 0" ), _indexStep("indexstep", "1" ) {}; void putMeIn(xml::Element & parent) { //cout << "mPosPhi put me in" << endl; xml::Element * const child = new xml::Element(); assert(child); parent.addChild(child); // LESTER Must complete ... add checks child->setTagName(Base::getTagName()); // crude check assert(_volume); child->addAttribute("volume", _volume->getName()); _n .addAttributeTo(child); _phi0 .addAttributeTo(child); _dPhi .addAttributeTo(child); _rZ .addAttributeTo(child); _stagger .addAttributeTo(child); _rot .addAttributeTo(child); _indexStep.addAttributeTo(child); //child->addAttribute("R_Z", Pos::makeNumberString(_r, _z)); }; MPosPhi & setVolume(Volume * volume) { assert(volume); _volume = volume; return *this; }; MPosPhi & setVolume(Volume & volume) { _volume = &volume; return *this; }; MPosPhi & setN(unsigned int n) { _n.setValue(makeNumberString(n)); return *this; }; MPosPhi & setRZ(double r, double z) { _rZ.setValue(makeNumberString(r,z)); return *this; }; MPosPhi & setRot(double rx, double ry, double rz) { _rot.setValue(makeNumberString(rx, ry, rz)); return *this; }; MPosPhi & setPhi0(double phi0) { _phi0.setValue(makeNumberString(phi0)); return *this; }; }; } #endif