///////////////////////////////////////////////////////////// // // CbmEmcReader // // Reader of Emc geometry file (ASCII) // // Created 14/08/06 by S.Spataro // /////////////////////////////////////////////////////////////// #include #include #include #include "TString.h" #include "CbmEmcReader.h" using namespace std; CbmEmcReader::CbmEmcReader(TString name) { sName = name; CbmEmcReader::fill_vector(); } CbmEmcReader::~CbmEmcReader() { } void CbmEmcReader::fill_vector() { fstream f; string str; DataG4 data; int line_nr; f.open(sName.Data(), ios::in); cout << "CbmEmcReader: EMC geometry file == " << sName.Data() << endl; if(!f) { cout<<"CbmEmcReader 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; CbmEmcReader::g4data.push_back(data); }; f.close(); }; f.clear(); return; } int CbmEmcReader::GetMaxModules() { int modules = 0; for(unsigned int i=0; iCbmEmcReader::g4data[i].module) modules = CbmEmcReader::g4data[i].module; return modules; } int CbmEmcReader::GetMinRows(int module) { int rows = 1000000; for(unsigned int i=0; iCbmEmcReader::g4data[i].row) rows = CbmEmcReader::g4data[i].row; return rows; } int CbmEmcReader::GetMinCrystals(int module, int row) { int crystals = 1000000; for(unsigned int i=0; iCbmEmcReader::g4data[i].crystal) crystals = CbmEmcReader::g4data[i].crystal; return crystals; } DataG4 CbmEmcReader::GetData(int module, int row, int crystal) { DataG4 data; data.module = -1; // Module not present for(unsigned int i=0; i