void LevelSet::_getCellLayers(std::vector<std::vector<GridIndex>> &layers) { Array3d<int> layerGrid(_isize, _jsize, _ksize, -1); std::vector<GridIndex> layer; for (int k = 0; k < _ksize; k++) { for (int j = 0; j < _jsize; j++) { for (int i = 0; i < _isize; i++) { if (_isDistanceSet(i, j, k)) { layer.push_back(GridIndex(i, j, k)); layerGrid.set(i, j, k, 0); } } } } std::vector<GridIndex> q; layers.push_back(q); _getLayerCells(1, layer, layers[0], layerGrid); for (int i = 2; layers[i-2].size() > 0 && i < _numLayers; i++) { std::vector<GridIndex> q; layers.push_back(q); _getLayerCells(i, layers[i - 2], layers[i - 1], layerGrid); } }
void GridBuilder::verifyGrid(HitCollection & hits, const Grid & grid){ bool valid = true; for(uint e = 0; e < grid.config.nEvents; ++e){ for(uint l = 1; l <= grid.config.nLayers; ++l){ LayerGrid layerGrid(grid, l,e); for(uint z = 0; z < grid.config.nSectorsZ; ++z){ for(uint p = 0; p < grid.config.nSectorsPhi; ++p){ for(uint h = layerGrid(z, p); h < layerGrid(z,p+1); ++h){ Hit hit(hits, h); if(hit.getValue<EventNumber>() % grid.config.nEvents != e){ /* ist not necessarly wrong -> skip events valid = false; PLOG << "Invalid event number" << std::endl;*/ } if(hit.getValue<DetectorLayer>() != l){ valid = false; PLOG << "Invalid layer " << std::endl; } if(hit.globalZ() < grid.config.boundaryValueZ(z) || hit.globalZ() > grid.config.boundaryValueZ(z+1)){ valid = false; PLOG << "Invalid z cell" << std::endl; } if(hit.phi() < grid.config.boundaryValuePhi(p) || hit.phi() > grid.config.boundaryValuePhi(p+1)){ valid = false; PLOG << "Invalid phi cell" << std::endl; } } } } } } if(valid) LOG << "Grid built correctly" << std::endl; }
void GridBuilder::printGrid(const Grid & grid){ for(uint e = 0; e < grid.config.nEvents; ++e){ PLOG << "Event: " << e << std::endl; for(uint l = 1; l <= grid.config.nLayers; ++l){ PLOG << "Layer: " << l << std::endl; //output z boundaries PLOG << "z/phi\t\t"; for(uint i = 0; i <= grid.config.nSectorsZ; ++i){ PLOG << grid.config.boundaryValueZ(i) << "\t"; } PLOG << std::endl; LayerGrid layerGrid(grid, l,e); for(uint p = 0; p <= grid.config.nSectorsPhi; ++p){ PLOG << std::setprecision(3) << grid.config.boundaryValuePhi(p) << "\t\t"; for(uint z = 0; z <= grid.config.nSectorsZ; ++z){ PLOG << layerGrid(z,p) << "\t"; } PLOG << std::endl; } } } }