#include <bSector.h>
Public Member Functions | |
bSector () | |
Default ctor is needed to have arrays. | |
bSector (handles::const_iterator begin, handles::const_iterator end) | |
Constructor from list of volumes. | |
MagBSector * | buildMagBSector () const |
Construct the MagBSector upon request. | |
const handles & | getVolumes () const |
Return all volumes in this sector. | |
const float | RN () const |
Distance from center along normal of sectors. | |
~bSector () | |
Destructor. | |
Private Attributes | |
MagBSector * | msector |
std::vector< bRod > | rods |
handles | volumes |
A sector of volumes in a barrel layer (i.e. only 1 element in R) One sector is composed of 1 or more rods.
MagGeoBuilderFromDDD::bSector::bSector | ( | ) |
MagGeoBuilderFromDDD::bSector::bSector | ( | handles::const_iterator | begin, |
handles::const_iterator | end | ||
) |
Constructor from list of volumes.
FIXME: (float) resolution; ??
Definition at line 30 of file bSector.cc.
References ClusterizingHistogram::clusterize(), gather_cfg::cout, MagGeoBuilderFromDDD::debug, f, ClusterizingHistogram::fill(), first, i, prof2calltree::last, MagGeoBuilderFromDDD::maxZ(), cmsRun_displayProdMFGeom_cfg::minZ, jptDQMConfig_cff::phiMax, jptDQMConfig_cff::phiMin, precomputed_value_sort(), MagGeoBuilderFromDDD::volumeHandle::printUniqueNames(), dtDQMClient_cfg::resolution, rods, and volumes.
: volumes(begin,end), msector(0) { if (MagGeoBuilderFromDDD::debug) cout << " Sector at Phi " << volumes.front()->center().phi() << " " << volumes.back()->center().phi() << endl; if (volumes.size() == 1) { if (MagGeoBuilderFromDDD::debug) { cout << " Rod at: 0 elements: " << end-begin << " unique volumes: "; volumeHandle::printUniqueNames(begin,end); } rods.push_back(bRod(begin,end)); } else { // Clusterize in phi. Use bin edge so that complete clusters can be // easily found (not trivial using bin centers!) // Unfortunately this makes the result more sensitive to the // "resolution" parameter... // To avoid +-pi boundary problems, take phi distance from min phi. // Caveat of implicit conversions of Geom::Phi!!! // Sort volumes in DELTA phi - i.e. phi(j)-phi(i) > 0 if j>1. precomputed_value_sort(volumes.begin(), volumes.end(), ExtractPhiMax(), LessDPhi()); const Geom::Phi<float> resolution(0.01); // rad Geom::Phi<float> phi0 = volumes.front()->maxPhi(); float phiMin = -(float) resolution; float phiMax = volumes.back()->maxPhi() - phi0 + resolution; ClusterizingHistogram hisPhi( int((phiMax-phiMin)/resolution) + 1, phiMin, phiMax); handles::const_iterator first = volumes.begin(); handles::const_iterator last = volumes.end(); for (handles::const_iterator i=first; i!=last; ++i){ hisPhi.fill((*i)->maxPhi()-phi0); } vector<float> phiClust = hisPhi.clusterize(resolution); if (MagGeoBuilderFromDDD::debug) cout << " Found " << phiClust.size() << " clusters in Phi, " << " rods: " << endl; handles::const_iterator rodStart = first; handles::const_iterator separ = first; float DZ = (*max_element(first,last,LessZ()))->maxZ() - (*min_element(first,last,LessZ()))->minZ(); float DZ1 = 0.; for (unsigned int i=0; i<phiClust.size(); ++i) { float phiSepar; if (i<phiClust.size()-1) { phiSepar = (phiClust[i] + phiClust[i+1])/2.f; } else { phiSepar = phiMax; } if (MagGeoBuilderFromDDD::debug) cout << " cluster " << i << " phisepar " << phiSepar <<endl; while (separ < last && (*separ)->maxPhi()-phi0 < phiSepar ) { DZ1 += ((*separ)->maxZ() - (*separ)->minZ()); if (MagGeoBuilderFromDDD::debug) cout << " " << (*separ)->name << " " << (*separ)->maxPhi()-phi0 << " " << (*separ)->maxZ() << " " << (*separ)->minZ() << " " << DZ1 << endl; ++separ; } // FIXME: print warning for small discrepancies. Tolerance (below) // had to be increased since discrepancies sum to up to ~ 2 mm. if (fabs(DZ-DZ1) > 0.001 && fabs(DZ-DZ1) < 0.5) { if (MagGeoBuilderFromDDD::debug) cout << "*** WARNING: Z lenght mismatch by " << DZ-DZ1 << " " << DZ << " " << DZ1 << endl; } if (fabs(DZ-DZ1) > 0.25 ) { // FIXME hardcoded tolerance if (MagGeoBuilderFromDDD::debug) cout << " Incomplete, use also next cluster: " << DZ << " " << DZ1 << " " << DZ-DZ1 << endl; DZ1 = 0.; continue; } else if (DZ1>DZ+0.05) { // Wrong: went past max lenght // FIXME hardcoded tolerance cout << " *** ERROR: bSector finding messed up." << endl; volumeHandle::printUniqueNames(rodStart, separ); DZ1 = 0.; } else { if (MagGeoBuilderFromDDD::debug) { cout << " Rod at: " << phiClust[i] <<" elements: " << separ-rodStart << " unique volumes: "; volumeHandle::printUniqueNames(rodStart, separ); } rods.push_back(bRod(rodStart, separ)); rodStart = separ; DZ1 = 0.; } } if (MagGeoBuilderFromDDD::debug) cout << "-----------------------" << endl; } }
MagGeoBuilderFromDDD::bSector::~bSector | ( | ) |
MagBSector * MagGeoBuilderFromDDD::bSector::buildMagBSector | ( | ) | const |
Construct the MagBSector upon request.
Definition at line 136 of file bSector.cc.
const handles& MagGeoBuilderFromDDD::bSector::getVolumes | ( | ) | const [inline] |
const float MagGeoBuilderFromDDD::bSector::RN | ( | ) | const [inline] |
MagBSector* MagGeoBuilderFromDDD::bSector::msector [mutable, private] |
std::vector<bRod> MagGeoBuilderFromDDD::bSector::rods [private] |
Definition at line 43 of file bSector.h.
Referenced by bSector(), getVolumes(), and RN().