///////////////////////////////////////////////////////////// // // PndEmcReader // // Reader of Emc geometry file (ASCII) // // Created 14/08/06 by S.Spataro // /////////////////////////////////////////////////////////////// #include #include #include #include "TString.h" #include "PndEmcReader.h" using namespace std; PndEmcReader::PndEmcReader(TString name) { sName = name; PndEmcReader::fill_vector(); } PndEmcReader::~PndEmcReader() { } void PndEmcReader::fill_vector() { fstream f; string str; DataG4 data; int line_nr; f.open(sName.Data(), ios::in); cout << "PndEmcReader: EMC geometry file == " << sName.Data() << endl; if(!f) { cout<<"PndEmcReader Error: Data file cannot be open!"<>data.module>>data.row>>data.crystal>>data.theta>>data.phi>>data.tau>>data.posX>>data.posY>>data.posZ>>data.pDz >>data.pTheta>>data.pPhi>>data.pDy1>>data.pDx1>>data.pDx2>>data.pAlp1>>data.pDy2>>data.pDx3>>data.pDx4>>data.pAlp2; PndEmcReader::g4data.push_back(data); }; f.close(); }; f.clear(); return; } int PndEmcReader::GetMaxModules() { int modules = 0; for(unsigned int i=0; iPndEmcReader::g4data[i].module) modules = PndEmcReader::g4data[i].module; return modules; } int PndEmcReader::GetMinRows(int module) { int rows = 1000000; for(unsigned int i=0; iPndEmcReader::g4data[i].row) rows = PndEmcReader::g4data[i].row; return rows; } int PndEmcReader::GetMinCrystals(int module, int row) { int crystals = 1000000; for(unsigned int i=0; iPndEmcReader::g4data[i].crystal) crystals = PndEmcReader::g4data[i].crystal; return crystals; } DataG4 PndEmcReader::GetData(int module, int row, int crystal) { DataG4 data; data.module = -1; // Module not present for(unsigned int i=0; i