using namespace std;
#include "hades.h"
#include "hruntimedb.h"
#include "hspectrometer.h"
#include "hrpcdetector.h"
#include "hpario.h"
#include "hdetpario.h"
#include "hrpcgeomcellpar.h"
#include <iostream>
#include <iomanip>
ClassImp(HRpcGeomCellPar)
ClassImp(HRpcGeomCellParSec)
ClassImp(HRpcGeomCellParCol)
ClassImp(HRpcGeomCellParCell)
void HRpcGeomCellParCell::setDefaults(Int_t f) {
Length = 0.0;
X_left = 0.0;
Y_left = 0.0;
width = 0.0;
widthT = 0.0;
thetaL = 0.0;
thetaR = 0.0;
}
void HRpcGeomCellParCell::clear() {
Length = 0.0;
X_left = 0.0;
Y_left = 0.0;
width = 0.0;
widthT = 0.0;
thetaL = 0.0;
thetaR = 0.0;
}
HRpcGeomCellParCol::HRpcGeomCellParCol(Int_t s, Int_t co) {
HRpcDetector* det=(HRpcDetector*)(gHades->getSetup()->getDetector("Rpc"));
Int_t ce = det->getMaxCells();
array = new TObjArray(ce);
for(Int_t i=0 ; i<ce ; i++) array->AddAt(new HRpcGeomCellParCell(),i);
}
HRpcGeomCellParCol::~HRpcGeomCellParCol(void) {
if(array)
{
array->Delete();
delete array;
}
}
HRpcGeomCellParSec::HRpcGeomCellParSec(Int_t s, Int_t co) {
array = new TObjArray(co);
for(Int_t i=0 ; i<co ; i++)
array->AddAt(new HRpcGeomCellParCol(s,i),i);
}
HRpcGeomCellParSec::~HRpcGeomCellParSec(void) {
array->Delete();
delete array;
}
HRpcGeomCellPar::HRpcGeomCellPar(const Char_t* name,const Char_t* title,
const Char_t* context)
: HParSet(name,title,context) {
strcpy(detName,"Rpc");
HRpcDetector* det=(HRpcDetector*)(gHades->getSetup()->getDetector("Rpc"));
Int_t s = det->getMaxSectors();
Int_t co = det->getMaxColumns();
array = new TObjArray(s);
for (Int_t i=0; i<s; i++)
array->AddAt(new HRpcGeomCellParSec(i,co),i);
}
HRpcGeomCellPar::~HRpcGeomCellPar(void) {
array->Delete();
delete array;
}
Bool_t HRpcGeomCellPar::init(HParIo* inp,Int_t* set) {
HDetParIo* input=inp->getDetParIo("HRpcParIo");
if (input) return (input->init(this,set));
return kFALSE;
}
Int_t HRpcGeomCellPar::write(HParIo* output) {
HDetParIo* out=output->getDetParIo("HRpcParIo");
if (out) return out->write(this);
return -1;
}
void HRpcGeomCellPar::clear() {
for(Int_t i0=0;i0<getSize();i0++) {
HRpcGeomCellParSec& sec=(*this)[i0];
Int_t n1=sec.getSize();
for(Int_t i1=0;i1<n1;i1++) {
HRpcGeomCellParCol& col=sec[i1];
Int_t n2=col.getSize();
for(Int_t i2=0;i2<n2;i2++) col[i2].setDefaults(i1);
}
}
status=kFALSE;
resetInputVersions();
}
void HRpcGeomCellPar::readline(const Char_t *buf, Int_t *set) {
Int_t s,co,ce;
Float_t D, Xm, Ym, L, Lt, thetaL, thetaR;
sscanf(buf,"%d%d%d%f%f%f%f%f%f%f", &s, &co, &ce, &Ym, &Xm, &D, &L, &Lt, &thetaL, &thetaR);
HRpcGeomCellParCell& cell=(*this)[s][co][ce];
cell.setY(Ym);
cell.setX(Xm);
cell.setLength(D);
cell.setWidth(L);
cell.setWidthT(Lt);
cell.setThetaL(thetaL);
cell.setThetaR(thetaR);
set[s]=999;
}
void HRpcGeomCellPar::putAsciiHeader(TString& header) {
header=
"#####################################################################################"
"# Geometry parameters for the RPC detector cells\n"
"# Format:\n"
"# \n"
"# Sector Column Cell Ybox[mm] Xbox[mm] Dinf[mm] Lcell[mm] Ltube[mm] theta_L theta_R\n"
"#####################################################################################";
}
Bool_t HRpcGeomCellPar::writeline(Char_t *buf, Int_t s, Int_t co, Int_t ce) {
HRpcGeomCellParCell& cell=(*this)[s][co][ce];
sprintf(buf,"%2i%2i%2i%4.3f%4.3f%4.3f%4.3f%4.3f%4.3f%4.3f\n",
s, co, ce, cell.getY(),
cell.getX(), cell.getLength(), cell.getWidth(), cell.getWidthT(), cell.getThetaL(),
cell.getThetaR());
return kTRUE;
}
void HRpcGeomCellPar::printPause(void) {
printf("Press any key to continue");
getchar();
printf("\n\n");
}
void HRpcGeomCellPar::printParam(void) {
printf("\n Geometry parameters for the RPC detector cells\n");
printf(" Format:\n");
printf(" Sector Column Cell Ybox[mm] Xbox[mm] Dinf[mm] Lcell[mm] Ltube[mm] theta_L theta_R\n");
printf("==============================================\n");
Text_t buf[155];
Int_t n0 = getSize();
for(Int_t i0=0; i0<n0; i0++) {
Int_t n1 = (*this)[i0].getSize();
for(Int_t i1=0; i1<n1; i1++) {
Int_t n2 = (*this)[i0][i1].getSize();
for(Int_t i2=0; i2<n2; i2++) {
if (writeline(buf, i0, i1, i2)) printf(buf,strlen(buf));
}
}
}
printf("==============================================================\n");
}
Last change: Sat May 22 13:11:15 2010
Last generated: 2010-05-22 13:11
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.