15 using namespace SurfaceOrientation;
16 using namespace magneticfield;
19 bRod::bRod(handles::const_iterator
begin, handles::const_iterator
end,
bool debugVal)
20 : volumes(begin, end), mrod(nullptr),
debug(debugVal) {
30 std::cout <<
" Z slabs: " << zmin <<
" " << zmax << std::endl;
35 for (handles::const_iterator
i = first;
i !=
last; ++
i) {
36 hisZ.
fill((*i)->center().z());
38 std::vector<float> zClust = hisZ.
clusterize(resolution);
41 std::cout <<
" Found " << zClust.size() <<
" clusters in Z, "
42 <<
" slabs: " << std::endl;
44 handles::const_iterator slabStart =
first;
45 handles::const_iterator separ =
first;
47 for (
unsigned int i = 0;
i < zClust.size() - 1; ++
i) {
48 float zSepar = (zClust[
i] + zClust[
i + 1]) / 2.
f;
49 while ((*separ)->center().z() < zSepar)
52 std::cout <<
" Slab at: " << zClust[
i] <<
" elements: " << separ - slabStart <<
" unique volumes: ";
61 std::cout <<
" Slab at: " << zClust.back() <<
" elements: " << last - separ <<
" unique volumes: ";
68 std::vector<bSlab>::const_iterator
i =
slabs.begin();
71 for (++i; i !=
slabs.end(); ++
i) {
72 if (fabs(phimax - (*i).maxPhi()) > 0.001 || fabs(phimin - (*i).minPhi()) > 0.001) {
74 std::cout <<
"*** WARNING: slabs in this rod have different dphi! minphi " <<
phimin;
75 std::cout <<
" != " << (*i).minPhi() <<
" or maxphi " << phimax <<
" != " << (*i).maxPhi() << std::endl;
82 if (
mrod ==
nullptr) {
83 std::vector<MagBSlab*> mSlabs;
84 for (std::vector<bSlab>::const_iterator slab =
slabs.begin(); slab !=
slabs.end(); ++slab) {
85 mSlabs.push_back((*slab).buildMagBSlab());
void printUniqueNames(handles::const_iterator begin, handles::const_iterator end, bool uniq=true)
Just for debugging...
MagBRod * buildMagBRod() const
Construct the MagBRod upon request.
std::vector< float > clusterize(float resolution)
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
std::vector< bSlab > slabs