#include "hmdcgeompar.h"
#include "hades.h"
#include "hruntimedb.h"
#include "hpario.h"
#include "hdetpario.h"
#include "hgeomcompositevolume.h"
ClassImp(HMdcGeomPar)
HMdcGeomPar::HMdcGeomPar(const Char_t* name,const Char_t* title,
const Char_t* context)
: HDetGeomPar(name,title,context,"Mdc") {
}
Bool_t HMdcGeomPar::init(HParIo* inp,Int_t* set) {
Bool_t rc=kFALSE;
HDetParIo* input=inp->getDetParIo("HMdcParIo");
if (input) {
rc= (input->init(this,set));
if (rc&&changed) {
shiftLayerTransToCenter();
}
}
return rc;
}
void HMdcGeomPar::shiftLayerTransToCenter() {
for (Int_t m=0;m<refVolumes->GetSize();m++) {
HGeomCompositeVolume* refMod=(HGeomCompositeVolume*)(refVolumes->At(m));
if (refMod) {
for(Int_t c=0;c<refMod->getNumComponents();c++) {
HGeomVolume* vol=refMod->getComponent(c);
if (vol) {
Double_t zShift=(vol->getPoint(4)->getZ()+vol->getPoint(0)->getZ())/2.;
zShift=round(zShift*1000.)/1000.;
if (fabs(zShift)>=0.001) {
for(Int_t k=0;k<vol->getNumPoints();k++) {
HGeomVector* point=vol->getPoint(k);
point->setZ(point->getZ()-zShift);
}
HGeomTransform& trans=vol->getTransform();
HGeomVector pos=trans.getTransVector();
pos.setZ(pos.getZ()+zShift);
trans.setTransVector(pos);
}
}
}
}
}
}
Int_t HMdcGeomPar::write(HParIo* output) {
HDetParIo* out=output->getDetParIo("HMdcParIo");
if (out) return out->write(this);
return -1;
}
Last change: Sat May 22 13:02:07 2010
Last generated: 2010-05-22 13:02
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.