#include #include #include using namespace RAT; using namespace RAT::DU; #include using namespace std; ClassImp( RAT::DU::PMTInfo ) void PMTInfo::BeginOfRun() { DBLinkPtr pmtDB = DB::Get()->GetLink( "PMTINFO" ); fPanels = pmtDB->GetIArray("panelnumber"); vector types = pmtDB->GetIArray("pmt_type"); // make this optional vector petalstatus; try{ petalstatus = pmtDB->GetIArray("petal_status"); }catch( DBNotFoundError& e ){ warn << "DU::PMTInfo::BeginOfRun() petal_status not available \n"; for(size_t id=0; id pmtx = pmtDB->GetDArray("x"); vector pmty = pmtDB->GetDArray("y"); vector pmtz = pmtDB->GetDArray("z"); vector dirx = pmtDB->GetDArray("u"); vector diry = pmtDB->GetDArray("v"); vector dirz = pmtDB->GetDArray("w"); unsigned int size = types.size(); Log::Assert( size == fPanels.size() && size == pmtx.size(), "PMTInfo::BeginOfRun: Mis-sized PMT database arrays." ); fTypes.resize( size ); fPetalStatus.resize( size ); fPositions.resize( size ); fDirections.resize( size ); for( size_t id = 0; id < types.size(); id++ ) { fTypes[id] = static_cast( types[id] ); fPetalStatus[id] = static_cast( petalstatus[id] ); fPositions[id] = TVector3( pmtx[id], pmty[id], pmtz[id] ); fDirections[id] = TVector3( dirx[id], diry[id], dirz[id] ).Unit(); } debug << "PMTInfo::BeginOfRun: Loaded " << fTypes.size() << " PMTs.\n"; }