#ifndef AGDDMPOSPHIHH #define AGDDMPOSPHIHH #include "agddPos.hh" #include "agddVolume.hh" #include "agddAttribute.hh" #include "DWUnits.hh" namespace agdd { class MPosPhi : public Pos { private: Volume * _volume; Solid * _solid; 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), _solid(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 putMeInThisPosContainer(PosContainer * container) { assert(container); makeTheElement(); container->posElementsGoHere()->addChild(theElement()); _n .addAttributeTo(theElement()); _phi0 .addAttributeTo(theElement()); _dPhi .addAttributeTo(theElement()); _rZ .addAttributeTo(theElement()); _stagger .addAttributeTo(theElement()); _rot .addAttributeTo(theElement()); _indexStep.addAttributeTo(theElement()); if (!_volume) { cerr << "ERROR: You have not " << "set the volume associated with an mPosPhi." << endl; }; assert(_volume); theElement()->addAttribute("volume", _volume->getName()); _volume->putMyselfIn(container->defaultSection()); }; void putMeInThisSolidPosContainer(SolidPosContainer * container) { assert(container); if (!_solid) { cerr << "ERROR: You are either trying to use mPosPhi to place a " << "non-solid (a composition, for example) within " << "a solid object (such as a union), or you have not " << "set the volume associated with the position." << endl; }; assert(_solid); cout << "Making materials uniform ... " << flush; _solid->setMaterial(container->getSolidPosContainerMaterialName()); cout << "done." << endl; putMeInThisPosContainer(container); }; void setVolume(Volume * volume) { assert(volume); _volume = volume; _solid = 0; }; void setVolume(Solid * solid) { assert(solid); _solid = solid; _volume = solid; }; // Here come all the other parameters void setN(unsigned int n) { _n.setValue(makeNumberString(n)); }; void setRZ(double r, double z) {// Arguments in internal units only! _rZ.setValue(makeNumberString(r/DWmm, z/DWmm)); }; void setRot(double rx, double ry, double rz) { // ditto _rot.setValue(makeNumberString(rx/DWmm, ry/DWmm, rz/DWmm)); }; void setPhi0(double phi0) { // ditto _phi0.setValue(makeNumberString(phi0/DWdegree)); }; void setDPhi(double dPhi) { // ditto _dPhi.setValue(makeNumberString(dPhi/DWdegree)); }; void setStagger(double stagger) { // ditto _stagger.setValue(makeNumberString(stagger/DWmm)); }; void setIndexStep(int indexStep) { // ditto _indexStep.setValue(makeNumberString(indexStep)); }; void setIndexStep(const string & indexStep) { // ditto _indexStep.setValue(indexStep); }; }; } #endif