A rod of volumes in a barrel sector. A rod is made of several "slabs".
- Date:
- 2005/09/27 15:15:52
- Revision:
- 1.2
- Author:
- N. Amapane - INFN Torino
Definition at line 19 of file bRod.h.
MagGeoBuilderFromDDD::bRod::bRod |
( |
handles::const_iterator |
begin, |
|
|
handles::const_iterator |
end |
|
) |
| |
Constructor from list of volumes.
Definition at line 22 of file bRod.cc.
References ClusterizingHistogram::clusterize(), gather_cfg::cout, MagGeoBuilderFromDDD::debug, f, ClusterizingHistogram::fill(), first, i, prof2calltree::last, phimax, phimin, precomputed_value_sort(), MagGeoBuilderFromDDD::volumeHandle::printUniqueNames(), dtDQMClient_cfg::resolution, slabs, volumes, SiStripMonitorClusterAlca_cfi::zmax, and SiStripMonitorClusterAlca_cfi::zmin.
:
volumes(begin,end),
mrod(0)
{
precomputed_value_sort(volumes.begin(), volumes.end(), ExtractZ());
const float resolution = 5.;
float zmin = volumes.front()->center().z()-resolution;
float zmax = volumes.back()->center().z()+resolution;
ClusterizingHistogram hisZ( int((zmax-zmin)/resolution) + 1, zmin, zmax);
if (MagGeoBuilderFromDDD::debug) std::cout << " Z slabs: " << zmin << " " << zmax << std::endl;
handles::const_iterator first = volumes.begin();
handles::const_iterator last = volumes.end();
for (handles::const_iterator i=first; i!=last; ++i){
hisZ.fill((*i)->center().z());
}
std::vector<float> zClust = hisZ.clusterize(resolution);
if (MagGeoBuilderFromDDD::debug) std::cout << " Found " << zClust.size() << " clusters in Z, "
<< " slabs: " << std::endl;
handles::const_iterator slabStart = first;
handles::const_iterator separ = first;
for (unsigned int i=0; i<zClust.size() - 1; ++i) {
float zSepar = (zClust[i] + zClust[i+1])/2.f;
while ((*separ)->center().z() < zSepar) ++separ;
if (MagGeoBuilderFromDDD::debug) {
std::cout << " Slab at: " << zClust[i]
<< " elements: " << separ-slabStart << " unique volumes: ";
volumeHandle::printUniqueNames(slabStart, separ);
}
slabs.push_back(bSlab(slabStart, separ));
slabStart = separ;
}
{
if (MagGeoBuilderFromDDD::debug) {
std::cout << " Slab at: " << zClust.back() <<" elements: " << last-separ
<< " unique volumes: ";
volumeHandle::printUniqueNames(separ,last);
}
slabs.push_back(bSlab(separ, last));
}
std::vector<bSlab>::const_iterator i = slabs.begin();
Geom::Phi<float> phimax = (*i).maxPhi();
Geom::Phi<float> phimin = (*i).minPhi();
for (++i; i!= slabs.end(); ++i) {
if(fabs(phimax - (*i).maxPhi()) > 0.001 ||
fabs(phimin - (*i).minPhi()) > 0.001){
if (MagGeoBuilderFromDDD::debug) std::cout << "*** WARNING: slabs in this rod have different dphi!" <<std::endl;
}
}
}