//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Implementation of class TpcDevmapCylLoader // See class header for details // // Environment: // Software developed for the PANDA Detector at FAIR. // // Author List: // Felix Boehmer TUM (original author) // // //----------------------------------------------------------- //This class' Header --------------------------------------- #include "TpcDevmapCylLoader.h" //C++ Headers ---------------------------------------------- #include #include //Collaborating Headers ------------------------------------ #include "TpcDevmapCyl.h" #include "TError.h" //Class Member Definitions --------------------------------- TpcDevmapCylLoader::TpcDevmapCylLoader(TpcDevmapCyl* devmap, const char* const fileName) { _devmap = devmap; _fileName = fileName; _vDrift = _devmap->vDrift(); } TpcDevmapCylLoader::~TpcDevmapCylLoader() {;} void TpcDevmapCylLoader::load() { // try to find and open the file std::ifstream infile(_fileName, std::fstream::in); if (!infile.good()) { Fatal("TpcDevmapCylLoader::load()","devmap-file could not be found."); return; } int rSteps, zSteps; double rMin, rMax, rWidth, zMin, zMax, zWidth; infile>>rSteps>>zSteps>>rMin>>rMax>>zMin>>zMax; rWidth = (double)(rMax - rMin)/rSteps; zWidth = (double)(zMax - zMin)/zSteps; _devmap->setNominal(TVector3(0.,0.,0.)); _devmap->setMinR(rMin); _devmap->setSpacingR(rWidth); _devmap->setMinZ(zMin); _devmap->setSpacingZ(zWidth); // Initialize the field-map _fieldmap = new std::vector*>; // fill the matrix from the file; z-Index runs first for (int nr=0; nrpush_back(new std::vector(zSteps)); for (int nz=0; nz>devX>>devY>>time>>dump>>dump; straight_way = (nz + 0.5) * zWidth; devZ = time*_vDrift - straight_way; //actual z-deviation _fieldmap->at(nr)->at(nz) = new TVector3(devX, devY, devZ); } } std::cout<<"\n\n\nTpcDevmapCylLoader::load(): successfully initialized the Dev-field" <size(); int lengthz = _fieldmap->at(0)->size(); std::cout << "fieldmap has " << lengthr <<" bins in r and \n" << lengthz << " bins in z direction."; _devmap->_pGrid = _fieldmap; //TpcDevmapCyl takes ownership infile.close(); }